@@ -19,35 +19,27 @@ LegendDataManagement provides an extension for SolidStateDetectors, a
19
19
`SolidStateDetector` can be constructed from LEGEND metadata using the
20
20
methods above.
21
21
"""
22
- function SolidStateDetectors. SolidStateDetector (data:: LegendData , detector :: DetectorIdLike )
23
- SolidStateDetectors . SolidStateDetector {_SSDDefaultNumtype} (data, detector )
22
+ function SolidStateDetectors. SolidStateDetector (data:: LegendData , meta :: Union{<:String, <:AbstractDict, <: DetectorIdLike} , env :: HPGeEnvironment = HPGeEnvironment () )
23
+ SolidStateDetector {_SSDDefaultNumtype} (data, meta, env )
24
24
end
25
25
26
- function SolidStateDetectors. SolidStateDetector {T} (data:: LegendData , detector:: DetectorIdLike ) where {T<: AbstractFloat }
26
+ function SolidStateDetectors. SolidStateDetector {T} (data:: LegendData , detector:: DetectorIdLike , env :: HPGeEnvironment = HPGeEnvironment () ) where {T<: AbstractFloat }
27
27
detector_props = getproperty (data. metadata. hardware. detectors. germanium. diodes, Symbol (detector))
28
28
xtal_props = getproperty (data. metadata. hardware. detectors. germanium. crystals, Symbol (string (detector)[1 : end - 1 ]))
29
- SolidStateDetector {T} (LegendData, detector_props, xtal_props)
29
+ SolidStateDetector {T} (LegendData, detector_props, xtal_props, env )
30
30
end
31
31
32
- function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , filename:: String ) where {T<: AbstractFloat }
33
- SolidStateDetector {T} (LegendData, readprops (filename, subst_pathvar = false , subst_env = false , trim_null = false ))
32
+ function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , filename:: String , env :: HPGeEnvironment = HPGeEnvironment () ) where {T<: AbstractFloat }
33
+ SolidStateDetector {T} (LegendData, readprops (filename, subst_pathvar = false , subst_env = false , trim_null = false ), env )
34
34
end
35
35
36
- function SolidStateDetectors. SolidStateDetector (:: Type{LegendData} , filename :: String )
37
- SolidStateDetector {_SSDDefaultNumtype } (LegendData, filename )
36
+ function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , meta :: AbstractDict , env :: HPGeEnvironment = HPGeEnvironment ()) where {T <: AbstractFloat }
37
+ SolidStateDetector {T } (LegendData, convert (PropDict, meta), LegendDataManagement . NoSuchPropsDBEntry ( " " ,[]), env )
38
38
end
39
39
40
- function SolidStateDetectors. SolidStateDetector (:: Type{LegendData} , meta:: AbstractDict )
41
- SolidStateDetectors. SolidStateDetector {_SSDDefaultNumtype} (LegendData, meta)
42
- end
43
-
44
- function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , meta:: AbstractDict ) where {T<: AbstractFloat }
45
- SolidStateDetectors. SolidStateDetector {T} (LegendData, convert (PropDict, meta), LegendDataManagement. NoSuchPropsDBEntry (" " ,[]))
46
- end
47
-
48
- function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , meta:: PropDict , xtal_meta:: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} ) where {T<: AbstractFloat }
49
- config_dict = create_SSD_config_dict_from_LEGEND_metadata (meta, xtal_meta)
50
- return SolidStateDetector {T} (config_dict, SolidStateDetectors. construct_units (config_dict))
40
+ function SolidStateDetectors. SolidStateDetector {T} (:: Type{LegendData} , meta:: PropDict , xtal_meta:: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} , env:: HPGeEnvironment = HPGeEnvironment ()) where {T<: AbstractFloat }
41
+ config_dict = create_SSD_config_dict_from_LEGEND_metadata (meta, xtal_meta, env)
42
+ SolidStateDetector {T} (config_dict, SolidStateDetectors. construct_units (config_dict))
51
43
end
52
44
53
45
"""
@@ -59,39 +51,30 @@ LegendDataManagement provides an extension for SolidStateDetectors, a
59
51
`Simulation` can be constructed from LEGEND metadata using the
60
52
methods above.
61
53
"""
62
- function SolidStateDetectors. Simulation (data :: LegendData , detector :: DetectorIdLike )
63
- SolidStateDetectors . Simulation {_SSDDefaultNumtype} (data, detector )
54
+ function SolidStateDetectors. Simulation (:: Type{ LegendData} , meta :: Union{<:String, <:AbstractDict, <: DetectorIdLike} , env :: HPGeEnvironment = HPGeEnvironment () )
55
+ Simulation {_SSDDefaultNumtype} (LegendData, meta, env )
64
56
end
65
57
66
- function SolidStateDetectors. Simulation {T} (data:: LegendData , detector:: DetectorIdLike ) where {T<: AbstractFloat }
58
+ function SolidStateDetectors. Simulation {T} (data:: LegendData , detector:: DetectorIdLike , env :: HPGeEnvironment = HPGeEnvironment () ) where {T<: AbstractFloat }
67
59
detector_props = getproperty (data. metadata. hardware. detectors. germanium. diodes, Symbol (detector))
68
60
xtal_props = getproperty (data. metadata. hardware. detectors. germanium. crystals, Symbol (string (detector)[1 : end - 1 ]))
69
- Simulation {T} (LegendData, detector_props, xtal_props)
61
+ Simulation {T} (LegendData, detector_props, xtal_props, env )
70
62
end
71
63
72
- function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , filename:: String ) where {T<: AbstractFloat }
73
- Simulation {T} (LegendData, readprops (filename, subst_pathvar = false , subst_env = false , trim_null = false ))
64
+ function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , filename:: String , env :: HPGeEnvironment = HPGeEnvironment () ) where {T<: AbstractFloat }
65
+ Simulation {T} (LegendData, readprops (filename, subst_pathvar = false , subst_env = false , trim_null = false ), env )
74
66
end
75
67
76
- function SolidStateDetectors. Simulation (:: Type{LegendData} , filename :: String )
77
- Simulation {_SSDDefaultNumtype } (LegendData, filename )
68
+ function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , meta :: AbstractDict , env :: HPGeEnvironment = HPGeEnvironment ()) where {T <: AbstractFloat }
69
+ Simulation {T } (LegendData, convert (PropDict, meta), LegendDataManagement . NoSuchPropsDBEntry ( " " , []), env )
78
70
end
79
71
80
- function SolidStateDetectors. Simulation (:: Type{LegendData} , meta:: AbstractDict )
81
- SolidStateDetectors. Simulation {_SSDDefaultNumtype} (LegendData, meta)
72
+ function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , meta:: PropDict , xtal_meta:: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} , env:: HPGeEnvironment = HPGeEnvironment ()) where {T<: AbstractFloat }
73
+ config_dict = create_SSD_config_dict_from_LEGEND_metadata (meta, xtal_meta, env)
74
+ Simulation {T} (config_dict)
82
75
end
83
76
84
- function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , meta:: AbstractDict ) where {T<: AbstractFloat }
85
- SolidStateDetectors. Simulation {T} (LegendData, convert (PropDict, meta), LegendDataManagement. NoSuchPropsDBEntry (" " , []))
86
- end
87
-
88
- function SolidStateDetectors. Simulation {T} (:: Type{LegendData} , meta:: PropDict , xtal_meta:: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} ) where {T<: AbstractFloat }
89
- config_dict = create_SSD_config_dict_from_LEGEND_metadata (meta, xtal_meta)
90
- return Simulation {T} (config_dict)
91
- end
92
-
93
-
94
- function create_SSD_config_dict_from_LEGEND_metadata (meta:: PropDict , xtal_meta:: X ; dicttype = Dict{String,Any}) where {X <: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} }
77
+ function create_SSD_config_dict_from_LEGEND_metadata (meta:: PropDict , xtal_meta:: X , env:: HPGeEnvironment = HPGeEnvironment (); dicttype = Dict{String,Any}) where {X <: Union{PropDict, LegendDataManagement.NoSuchPropsDBEntry} }
95
78
96
79
# Not all possible configurations are yet implemented!
97
80
# https://github.com/legend-exp/legend-metadata/blob/main/hardware/detectors/detector-metadata_1.pdf
@@ -139,7 +122,7 @@ function create_SSD_config_dict_from_LEGEND_metadata(meta::PropDict, xtal_meta::
139
122
)
140
123
)
141
124
),
142
- " medium" => " vacuum " ,
125
+ " medium" => env . medium ,
143
126
" detectors" => []
144
127
)
145
128
@@ -151,7 +134,7 @@ function create_SSD_config_dict_from_LEGEND_metadata(meta::PropDict, xtal_meta::
151
134
),
152
135
# "impurity_density" => dicttype("parameters" => Vector()),
153
136
" geometry" => dicttype (),
154
- " temperature" => 78
137
+ " temperature" => ustrip ( u " K " , env . temperature)
155
138
),
156
139
" contacts" => []
157
140
))
0 commit comments