@@ -46,34 +46,34 @@ LegendDataManagement provides an extension for SolidStateDetectors, a
46
46
`SolidStateDetector` can be constructed from LEGEND metadata using the
47
47
methods above.
48
48
"""
49
- function SolidStateDetectors. SolidStateDetector (data:: LegendData , detector:: DetectorIdLike )
50
- SolidStateDetectors. SolidStateDetector {_SSDDefaultNumtype} (data, detector)
49
+ function SolidStateDetectors. SolidStateDetector (data:: LegendData , detector:: DetectorIdLike ; kwargs ... )
50
+ SolidStateDetectors. SolidStateDetector {_SSDDefaultNumtype} (data, detector; kwargs ... )
51
51
end
52
52
53
- function SolidStateDetectors. SolidStateDetector {T} (data:: LegendData , detector:: DetectorIdLike ) where {T<: AbstractFloat }
53
+ function SolidStateDetectors. SolidStateDetector {T} (data:: LegendData , detector:: DetectorIdLike ; kwargs ... ) where {T<: AbstractFloat }
54
54
detector_props = getproperty (data. metadata. hardware. detectors. germanium. diodes, Symbol (detector))
55
55
xtal_props = getproperty (data. metadata. hardware. detectors. germanium. crystals, Symbol (string (detector)[1 : end - 1 ]))
56
- SolidStateDetector {T} (LegendData, detector_props, xtal_props)
56
+ SolidStateDetector {T} (LegendData, detector_props, xtal_props; kwargs ... )
57
57
end
58
58
59
- function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , filename:: String ) where {T<: AbstractFloat }
60
- SolidStateDetector {T} (LegendData, readprops (filename, subst_pathvar = false , subst_env = false , trim_null = false ))
59
+ function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , filename:: String ; kwargs ... ) where {T<: AbstractFloat }
60
+ SolidStateDetector {T} (LegendData, readprops (filename, subst_pathvar = false , subst_env = false , trim_null = false ); kwargs ... )
61
61
end
62
62
63
- function SolidStateDetectors. SolidStateDetector (:: Type{LegendData} , filename:: String )
64
- SolidStateDetector {_SSDDefaultNumtype} (LegendData, filename)
63
+ function SolidStateDetectors. SolidStateDetector (:: Type{LegendData} , filename:: String ; kwargs ... )
64
+ SolidStateDetector {_SSDDefaultNumtype} (LegendData, filename; kwargs ... )
65
65
end
66
66
67
- function SolidStateDetectors. SolidStateDetector (:: Type{LegendData} , meta:: AbstractDict )
68
- SolidStateDetectors. SolidStateDetector {_SSDDefaultNumtype} (LegendData, meta)
67
+ function SolidStateDetectors. SolidStateDetector (:: Type{LegendData} , meta:: AbstractDict ; kwargs ... )
68
+ SolidStateDetectors. SolidStateDetector {_SSDDefaultNumtype} (LegendData, meta; kwargs ... )
69
69
end
70
70
71
- function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , meta:: AbstractDict ) where {T<: AbstractFloat }
72
- SolidStateDetectors. SolidStateDetector {T} (LegendData, convert (PropDict, meta), LegendDataManagement. NoSuchPropsDBEntry (" " ,[]))
71
+ function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , meta:: AbstractDict ; kwargs ... ) where {T<: AbstractFloat }
72
+ SolidStateDetectors. SolidStateDetector {T} (LegendData, convert (PropDict, meta), LegendDataManagement. NoSuchPropsDBEntry (" " ,[]); kwargs ... )
73
73
end
74
74
75
- function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , meta:: PropDict , xtal_meta:: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} ) where {T<: AbstractFloat }
76
- config_dict = create_SSD_config_dict_from_LEGEND_metadata (meta, xtal_meta)
75
+ function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , meta:: PropDict , xtal_meta:: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} ; kwargs ... ) where {T<: AbstractFloat }
76
+ config_dict = create_SSD_config_dict_from_LEGEND_metadata (meta, xtal_meta; kwargs ... )
77
77
return SolidStateDetector {T} (config_dict, SolidStateDetectors. construct_units (config_dict))
78
78
end
79
79
@@ -86,39 +86,39 @@ LegendDataManagement provides an extension for SolidStateDetectors, a
86
86
`Simulation` can be constructed from LEGEND metadata using the
87
87
methods above.
88
88
"""
89
- function SolidStateDetectors. Simulation (data:: LegendData , detector:: DetectorIdLike )
90
- SolidStateDetectors. Simulation {_SSDDefaultNumtype} (data, detector)
89
+ function SolidStateDetectors. Simulation (data:: LegendData , detector:: DetectorIdLike ; kwargs ... )
90
+ SolidStateDetectors. Simulation {_SSDDefaultNumtype} (data, detector; kwargs ... )
91
91
end
92
92
93
- function SolidStateDetectors. Simulation {T} (data:: LegendData , detector:: DetectorIdLike ) where {T<: AbstractFloat }
93
+ function SolidStateDetectors. Simulation {T} (data:: LegendData , detector:: DetectorIdLike ; kwargs ... ) where {T<: AbstractFloat }
94
94
detector_props = getproperty (data. metadata. hardware. detectors. germanium. diodes, Symbol (detector))
95
95
xtal_props = getproperty (data. metadata. hardware. detectors. germanium. crystals, Symbol (string (detector)[1 : end - 1 ]))
96
- Simulation {T} (LegendData, detector_props, xtal_props)
96
+ Simulation {T} (LegendData, detector_props, xtal_props; kwargs ... )
97
97
end
98
98
99
- function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , filename:: String ) where {T<: AbstractFloat }
100
- Simulation {T} (LegendData, readprops (filename, subst_pathvar = false , subst_env = false , trim_null = false ))
99
+ function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , filename:: String ; kwargs ... ) where {T<: AbstractFloat }
100
+ Simulation {T} (LegendData, readprops (filename, subst_pathvar = false , subst_env = false , trim_null = false ); kwargs ... )
101
101
end
102
102
103
- function SolidStateDetectors. Simulation (:: Type{LegendData} , filename:: String )
104
- Simulation {_SSDDefaultNumtype} (LegendData, filename)
103
+ function SolidStateDetectors. Simulation (:: Type{LegendData} , filename:: String ; kwargs ... )
104
+ Simulation {_SSDDefaultNumtype} (LegendData, filename; kwargs ... )
105
105
end
106
106
107
- function SolidStateDetectors. Simulation (:: Type{LegendData} , meta:: AbstractDict )
108
- SolidStateDetectors. Simulation {_SSDDefaultNumtype} (LegendData, meta)
107
+ function SolidStateDetectors. Simulation (:: Type{LegendData} , meta:: AbstractDict ; kwargs ... )
108
+ SolidStateDetectors. Simulation {_SSDDefaultNumtype} (LegendData, meta; kwargs ... )
109
109
end
110
110
111
- function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , meta:: AbstractDict ) where {T<: AbstractFloat }
112
- SolidStateDetectors. Simulation {T} (LegendData, convert (PropDict, meta), LegendDataManagement. NoSuchPropsDBEntry (" " , []))
111
+ function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , meta:: AbstractDict ; kwargs ... ) where {T<: AbstractFloat }
112
+ SolidStateDetectors. Simulation {T} (LegendData, convert (PropDict, meta), LegendDataManagement. NoSuchPropsDBEntry (" " , []); kwargs ... )
113
113
end
114
114
115
- function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , meta:: PropDict , xtal_meta:: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} ) where {T<: AbstractFloat }
116
- config_dict = create_SSD_config_dict_from_LEGEND_metadata (meta, xtal_meta)
115
+ function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , meta:: PropDict , xtal_meta:: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} ; kwargs ... ) where {T<: AbstractFloat }
116
+ config_dict = create_SSD_config_dict_from_LEGEND_metadata (meta, xtal_meta; kwargs ... )
117
117
return Simulation {T} (config_dict)
118
118
end
119
119
120
120
121
- function create_SSD_config_dict_from_LEGEND_metadata (meta:: PropDict , xtal_meta:: X ; dicttype = Dict{String,Any}) where {X <: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} }
121
+ function create_SSD_config_dict_from_LEGEND_metadata (meta:: PropDict , xtal_meta:: X ; dicttype = Dict{String,Any}, crystal_impurity :: Bool = false ) where {X <: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} }
122
122
123
123
# Not all possible configurations are yet implemented!
124
124
# https://github.com/legend-exp/legend-metadata/blob/main/hardware/detectors/detector-metadata_1.pdf
@@ -564,8 +564,14 @@ function create_SSD_config_dict_from_LEGEND_metadata(meta::PropDict, xtal_meta::
564
564
@warn " No information regarding impurity density for $(xtal_meta. name) "
565
565
end
566
566
567
- config_dict[" detectors" ][1 ][" semiconductor" ][" impurity_density" ] = \
568
- if X == PropDict && haskey (xtal_meta, :impurity_measurements )
567
+ if ! crystal_impurity
568
+ @warn """
569
+ Reading the impurity density from the crystal metadata will be ignored.
570
+ Set `crystal_impurity=true` to load the impurity density from the crystal metadata
571
+ """
572
+ end
573
+
574
+ config_dict[" detectors" ][1 ][" semiconductor" ][" impurity_density" ] = if X == PropDict && haskey (xtal_meta, :impurity_measurements ) && crystal_impurity
569
575
@info " Reading impurity density values from crystal metadata $(xtal_meta. name) "
570
576
# Fit the impurity measurement data to a Radford model
571
577
@. fit_model (z, p) = p[1 ] + p[2 ]* z + p[3 ]* exp ((z- p[5 ])/ p[4 ])
0 commit comments