LDMX Software
eventdisplay::DetectorGeometry Class Reference

Class to translated between detector location (section, layer, strip) and real space. More...

#include <DetectorGeometry.h>

Public Member Functions

BoundingBox getBoundingBox (const ldmx::HcalHit &hit) const
 Calculate real space coordinates from detector location.
 
BoundingBox getBoundingBox (const std::vector< ldmx::HcalHit > &hitVec) const
 Calculate real space coordinates of a cluster of hits.
 
BoundingBox getBoundingBox (ldmx::HcalID::HcalSection section) const
 Get bounding box for the input section.
 
HexPrism getHexPrism (const ldmx::EcalID &id) const
 Calculate bounding hexagonal prism for input EcalHit.
 
HexPrism getHexTower (int towerIndex) const
 Get HexPrism for a tower.
 
double getRotAngle (int layerID, int moduleID) const
 Get Rotation Angle around z-axis for the input layerID and moduleID.
 
BoundingBox getBoundingBox (int layerID, int moduleID) const
 Get Bounding Box for input recoil module NOTE: This does not take into account any rotation! Use getRotAngle as well!
 
BoundingBox getBoundingBox (const ldmx::SimTrackerHit &recoilHit) const
 Get Bounding Box for input recoil hit NOTE: This does not take into account any rotation! Use getRotAngle as well!
 

Static Public Member Functions

static const DetectorGeometrygetInstance ()
 Get the single instance of this class.
 

Private Member Functions

 DetectorGeometry ()
 Constructor This is where all the detector constants are set.
 

Private Attributes

std::map< ldmx::HcalID::HcalSection, int > hcal_n_layers_
 Number of layers in each section.
 
std::map< ldmx::HcalID::HcalSection, int > hcal_n_strips_
 Number of strips per layer in each section.
 
std::map< ldmx::HcalID::HcalSection, double > hcal_length_scint_
 Length of Scintillator Strip [mm].
 
std::map< ldmx::HcalID::HcalSection, double > hcal_zero_layer_
 The plane of the zero'th layer of each section [mm].
 
std::map< ldmx::HcalID::HcalSection, double > hcal_zero_strip_
 The plane of the zero'th strip of each section [mm].
 
std::map< ldmx::HcalID::HcalSection, double > hcal_layer_thickness_
 Thickness of the layers in each seciton [mm].
 
int hcal_parity_vertical_
 an example layer number of a vertical layer
 
double hcal_uncertainty_timing_pos_
 Uncertainty in timing position along a bar/strip [mm].
 
double hcal_thickness_scint_
 Thickness of Scintillator Strip [mm].
 
double hcal_width_scint_
 Width of Scintillator Strip [mm].
 
double ecal_si_thickness_
 Thickness of sensitive Si layers.
 
double ecal_depth_
 Total depth of ECAL (length in Z direction)
 
double ecal_zero_layer_
 z-coordinate of plane for first ecal layer [mm]
 
std::unique_ptr< ldmx::EcalHexReadout > ecal_hex_reader_
 Helper class to calculate (x,y) coordinate from hexagons.
 
double recoil_stereo_strip_length_
 
double recoil_stereo_x_width_
 
double recoil_stereo_y_width_
 
double recoil_stereo_separation_
 
double recoil_stereo_angle_
 
double recoil_mono_strip_length_
 
double recoil_mono_x_width_
 
double recoil_mono_y_width_
 
double recoil_mono_separation_
 
double recoil_sensor_thickness_
 
std::map< int, std::vector< double > > recoil_module_pos_
 position of each module in recoil detector The key in this map is 10*layerID+moduleID
 
std::map< int, double > recoil_module_angle_
 angular tilt for each module in recoil detector The key in this map is 10*layerID+moduleID
 

Detailed Description

Class to translated between detector location (section, layer, strip) and real space.

Definition at line 54 of file DetectorGeometry.h.

Constructor & Destructor Documentation

◆ DetectorGeometry()

eventdisplay::DetectorGeometry::DetectorGeometry ( )
private

Constructor This is where all the detector constants are set.

It is private so that the user is forced to use the single instance acquired from getInstance() above.

Definition at line 10 of file DetectorGeometry.cxx.

10 {
12 // HCAL
13
15
17
19
20 hcal_width_scint_ = 50.0;
21
22 hcal_n_layers_[ldmx::HcalID::HcalSection::BACK] = 100;
23 hcal_n_layers_[ldmx::HcalID::HcalSection::TOP] = 28;
24 hcal_n_layers_[ldmx::HcalID::HcalSection::BOTTOM] = 28;
25 hcal_n_layers_[ldmx::HcalID::HcalSection::LEFT] = 26;
26 hcal_n_layers_[ldmx::HcalID::HcalSection::RIGHT] = 26;
27
28 hcal_n_strips_[ldmx::HcalID::HcalSection::BACK] = 62;
29 hcal_n_strips_[ldmx::HcalID::HcalSection::TOP] = 12;
30 hcal_n_strips_[ldmx::HcalID::HcalSection::BOTTOM] = 12;
31 hcal_n_strips_[ldmx::HcalID::HcalSection::LEFT] = 12;
32 hcal_n_strips_[ldmx::HcalID::HcalSection::RIGHT] = 12;
33
34 double ecal_z = 440.;
35 double ecal_xy = 600.;
36 double back_transverse_width = 3100.;
37 double ecal_front_z = 220.;
38
39 hcal_length_scint_[ldmx::HcalID::HcalSection::BACK] = back_transverse_width;
40 hcal_length_scint_[ldmx::HcalID::HcalSection::TOP] =
41 (back_transverse_width + ecal_xy) / 2.;
42 hcal_length_scint_[ldmx::HcalID::HcalSection::BOTTOM] =
43 (back_transverse_width + ecal_xy) / 2.;
44 hcal_length_scint_[ldmx::HcalID::HcalSection::LEFT] =
45 (back_transverse_width + ecal_xy) / 2.;
46 hcal_length_scint_[ldmx::HcalID::HcalSection::RIGHT] =
47 (back_transverse_width + ecal_xy) / 2.;
48
49 hcal_zero_layer_[ldmx::HcalID::HcalSection::BACK] =
50 ecal_front_z + 600.; // leaving 60cm cube for ecal
51 hcal_zero_layer_[ldmx::HcalID::HcalSection::TOP] = ecal_xy / 2.;
52 hcal_zero_layer_[ldmx::HcalID::HcalSection::BOTTOM] = ecal_xy / 2.;
53 hcal_zero_layer_[ldmx::HcalID::HcalSection::LEFT] = ecal_xy / 2.;
54 hcal_zero_layer_[ldmx::HcalID::HcalSection::RIGHT] = ecal_xy / 2.;
55
56 hcal_zero_strip_[ldmx::HcalID::HcalSection::BACK] =
57 back_transverse_width / 2.;
58 hcal_zero_strip_[ldmx::HcalID::HcalSection::TOP] = ecal_front_z;
59 hcal_zero_strip_[ldmx::HcalID::HcalSection::BOTTOM] = ecal_front_z;
60 hcal_zero_strip_[ldmx::HcalID::HcalSection::LEFT] = ecal_front_z;
61 hcal_zero_strip_[ldmx::HcalID::HcalSection::RIGHT] = ecal_front_z;
62
63 // absorber + scintillator + 2*air
64 hcal_layer_thickness_[ldmx::HcalID::HcalSection::BACK] =
65 25. + hcal_thickness_scint_ + 2 * 2.;
66 hcal_layer_thickness_[ldmx::HcalID::HcalSection::TOP] =
67 20. + hcal_thickness_scint_ + 2 * 2.;
68 hcal_layer_thickness_[ldmx::HcalID::HcalSection::BOTTOM] =
69 20. + hcal_thickness_scint_ + 2 * 2.;
70 hcal_layer_thickness_[ldmx::HcalID::HcalSection::LEFT] =
71 20. + hcal_thickness_scint_ + 2 * 2.;
72 hcal_layer_thickness_[ldmx::HcalID::HcalSection::RIGHT] =
73 20. + hcal_thickness_scint_ + 2 * 2.;
74
76 // ECAL
77
78 ecal_zero_layer_ = ecal_front_z;
79
81
82 ecal_depth_ = ecal_z;
83
84 std::vector<double> ecalSiPlanes = {
85 7.850, 13.300, 26.400, 33.500, 47.950, 56.550, 72.250,
86 81.350, 97.050, 106.150, 121.850, 130.950, 146.650, 155.750,
87 171.450, 180.550, 196.250, 205.350, 221.050, 230.150, 245.850,
88 254.950, 270.650, 279.750, 298.950, 311.550, 330.750, 343.350,
89 362.550, 375.150, 394.350, 406.950, 426.150, 438.750};
90
91 std::map<std::string, std::any> hexReadoutParams;
92 hexReadoutParams["gap"] = 1.5;
93 hexReadoutParams["moduleMinR"] = 85.0;
94 hexReadoutParams["layerZPositions"] = ecalSiPlanes;
95 hexReadoutParams["ecalFrontZ"] = ecal_zero_layer_;
96 hexReadoutParams["nCellRHeight"] = 35.3;
97 hexReadoutParams["verbose"] = 0;
98
100 hexReadout.setParameters(hexReadoutParams);
101 ecal_hex_reader_ = std::unique_ptr<ldmx::EcalHexReadout>(
102 ldmx::EcalHexReadout::debugMake(hexReadout));
103
105 // RECOIL TRACKER
106 // The gdml file for the recoil tracker is kinda opaque.
107 // The layer and module IDs are calculated from the copy number of each
108 // of the sensor volumes.
109 // layer = copyNum / 10 (integer division)
110 // module = copyNum % 10
111 // The first 8 layer IDs are the first 4 layers of stereo sensors.
112 // Each stereo layer contains a front layer that is not tilted at an
113 // angle and a back layer that is tilted.
114 // The last 2 layer IDs correspond to the 2 layers of mono sensors.
115 // Each mono layer contains 10 modules (ids 0 - 9) that have a
116 // complicated position arrangement.
117 //
118 // In order to avoid mistakes, the position and angle of each module will
119 // be hard coded here instead of calculated from design specifications
120 // like the HCAL case.
121
122 recoil_stereo_strip_length_ = 98.0;
123
124 recoil_stereo_x_width_ = 40.34;
125
126 recoil_stereo_y_width_ = 100.0;
127
128 recoil_stereo_separation_ = 3.0;
129
130 recoil_stereo_angle_ = 0.1;
131
132 recoil_mono_strip_length_ = 78.0;
133
134 recoil_mono_x_width_ = 50.0;
135
136 recoil_mono_y_width_ = 80.0;
137
138 recoil_mono_separation_ = 1.0;
139
140 recoil_sensor_thickness_ = 0.52;
141
142 // The following keys for the position and angle maps should correspond to the
143 // copynumber in the recoil.gdml file At writing, the layerIDs and moduleIDs
144 // are set in the simulation from this copy number (TrackerSD.cxx in SimCore)
145
146 std::vector<double> recoilStereoLayerZPos = {7.5, 22.5, 37.5, 52.5};
147
148 recoil_module_pos_[10] = {
149 0, 0, recoilStereoLayerZPos.at(0) - recoil_stereo_separation_};
150 recoil_module_pos_[20] = {
151 0, 0, recoilStereoLayerZPos.at(0) + recoil_stereo_separation_};
152
153 recoil_module_pos_[30] = {
154 0, 0, recoilStereoLayerZPos.at(1) - recoil_stereo_separation_};
155 recoil_module_pos_[40] = {
156 0, 0, recoilStereoLayerZPos.at(1) + recoil_stereo_separation_};
157
158 recoil_module_pos_[50] = {
159 0, 0, recoilStereoLayerZPos.at(2) - recoil_stereo_separation_};
160 recoil_module_pos_[60] = {
161 0, 0, recoilStereoLayerZPos.at(2) + recoil_stereo_separation_};
162
163 recoil_module_pos_[70] = {
164 0, 0, recoilStereoLayerZPos.at(3) - recoil_stereo_separation_};
165 recoil_module_pos_[80] = {
166 0, 0, recoilStereoLayerZPos.at(3) + recoil_stereo_separation_};
167
168 std::vector<double> recoilMonoLayerZPos = {90.0, 180.0};
169
170 recoil_module_pos_[90] = {
171 2 * recoil_mono_x_width_, 0.5 * recoil_mono_y_width_,
172 recoilMonoLayerZPos.at(0) + recoil_mono_separation_};
173 recoil_module_pos_[91] = {
174 recoil_mono_x_width_, 0.5 * recoil_mono_y_width_,
175 recoilMonoLayerZPos.at(0) - recoil_mono_separation_};
176 recoil_module_pos_[92] = {
177 0.0, 0.5 * recoil_mono_y_width_,
178 recoilMonoLayerZPos.at(0) + recoil_mono_separation_};
179 recoil_module_pos_[93] = {
180 -1 * recoil_mono_x_width_, 0.5 * recoil_mono_y_width_,
181 recoilMonoLayerZPos.at(0) - recoil_mono_separation_};
182 recoil_module_pos_[94] = {
183 -2 * recoil_mono_x_width_, 0.5 * recoil_mono_y_width_,
184 recoilMonoLayerZPos.at(0) + recoil_mono_separation_};
185 recoil_module_pos_[95] = {
186 2 * recoil_mono_x_width_, -0.5 * recoil_mono_y_width_,
187 recoilMonoLayerZPos.at(0) + recoil_mono_separation_};
188 recoil_module_pos_[96] = {
189 recoil_mono_x_width_, -0.5 * recoil_mono_y_width_,
190 recoilMonoLayerZPos.at(0) - recoil_mono_separation_};
191 recoil_module_pos_[97] = {
192 0.0, -0.5 * recoil_mono_y_width_,
193 recoilMonoLayerZPos.at(0) + recoil_mono_separation_};
194 recoil_module_pos_[98] = {
195 -1 * recoil_mono_x_width_, -0.5 * recoil_mono_y_width_,
196 recoilMonoLayerZPos.at(0) - recoil_mono_separation_};
197 recoil_module_pos_[99] = {
198 -2 * recoil_mono_x_width_, -0.5 * recoil_mono_y_width_,
199 recoilMonoLayerZPos.at(0) + recoil_mono_separation_};
200
201 recoil_module_pos_[100] = {
202 2 * recoil_mono_x_width_, 0.5 * recoil_mono_y_width_,
203 recoilMonoLayerZPos.at(1) + recoil_mono_separation_};
204 recoil_module_pos_[101] = {
205 recoil_mono_x_width_, 0.5 * recoil_mono_y_width_,
206 recoilMonoLayerZPos.at(1) - recoil_mono_separation_};
207 recoil_module_pos_[102] = {
208 0.0, 0.5 * recoil_mono_y_width_,
209 recoilMonoLayerZPos.at(1) + recoil_mono_separation_};
210 recoil_module_pos_[103] = {
211 -1 * recoil_mono_x_width_, 0.5 * recoil_mono_y_width_,
212 recoilMonoLayerZPos.at(1) - recoil_mono_separation_};
213 recoil_module_pos_[104] = {
214 -2 * recoil_mono_x_width_, 0.5 * recoil_mono_y_width_,
215 recoilMonoLayerZPos.at(1) + recoil_mono_separation_};
216 recoil_module_pos_[105] = {
217 2 * recoil_mono_x_width_, -0.5 * recoil_mono_y_width_,
218 recoilMonoLayerZPos.at(1) + recoil_mono_separation_};
219 recoil_module_pos_[106] = {
220 recoil_mono_x_width_, -0.5 * recoil_mono_y_width_,
221 recoilMonoLayerZPos.at(1) - recoil_mono_separation_};
222 recoil_module_pos_[107] = {
223 0.0, -0.5 * recoil_mono_y_width_,
224 recoilMonoLayerZPos.at(1) + recoil_mono_separation_};
225 recoil_module_pos_[108] = {
226 -1 * recoil_mono_x_width_, -0.5 * recoil_mono_y_width_,
227 recoilMonoLayerZPos.at(1) - recoil_mono_separation_};
228 recoil_module_pos_[109] = {
229 -2 * recoil_mono_x_width_, -0.5 * recoil_mono_y_width_,
230 recoilMonoLayerZPos.at(1) + recoil_mono_separation_};
231
232 // Recoil Angles
233 recoil_module_angle_[10] = 0.0;
234 recoil_module_angle_[20] = recoil_stereo_angle_;
235
236 recoil_module_angle_[30] = 0.0;
237 recoil_module_angle_[40] = -recoil_stereo_angle_;
238
239 recoil_module_angle_[50] = 0.0;
240 recoil_module_angle_[60] = recoil_stereo_angle_;
241
242 recoil_module_angle_[70] = 0.0;
243 recoil_module_angle_[80] = -recoil_stereo_angle_;
244
245 recoil_module_angle_[90] = 0.0;
246 recoil_module_angle_[91] = 0.0;
247 recoil_module_angle_[92] = 0.0;
248 recoil_module_angle_[93] = 0.0;
249 recoil_module_angle_[94] = 0.0;
250 recoil_module_angle_[95] = 0.0;
251 recoil_module_angle_[96] = 0.0;
252 recoil_module_angle_[97] = 0.0;
253 recoil_module_angle_[98] = 0.0;
254 recoil_module_angle_[99] = 0.0;
255
256 recoil_module_angle_[100] = 0.0;
257 recoil_module_angle_[101] = 0.0;
258 recoil_module_angle_[102] = 0.0;
259 recoil_module_angle_[103] = 0.0;
260 recoil_module_angle_[104] = 0.0;
261 recoil_module_angle_[105] = 0.0;
262 recoil_module_angle_[106] = 0.0;
263 recoil_module_angle_[107] = 0.0;
264 recoil_module_angle_[108] = 0.0;
265 recoil_module_angle_[109] = 0.0;
266
267 // TODO Tagger
268 // TODO Trigger Pad
269}
double hcal_uncertainty_timing_pos_
Uncertainty in timing position along a bar/strip [mm].
int hcal_parity_vertical_
an example layer number of a vertical layer
std::map< ldmx::HcalID::HcalSection, double > hcal_length_scint_
Length of Scintillator Strip [mm].
std::map< ldmx::HcalID::HcalSection, int > hcal_n_layers_
Number of layers in each section.
std::map< int, double > recoil_module_angle_
angular tilt for each module in recoil detector The key in this map is 10*layerID+moduleID
double ecal_zero_layer_
z-coordinate of plane for first ecal layer [mm]
std::unique_ptr< ldmx::EcalHexReadout > ecal_hex_reader_
Helper class to calculate (x,y) coordinate from hexagons.
std::map< ldmx::HcalID::HcalSection, double > hcal_zero_layer_
The plane of the zero'th layer of each section [mm].
double hcal_width_scint_
Width of Scintillator Strip [mm].
double hcal_thickness_scint_
Thickness of Scintillator Strip [mm].
std::map< ldmx::HcalID::HcalSection, double > hcal_zero_strip_
The plane of the zero'th strip of each section [mm].
std::map< int, std::vector< double > > recoil_module_pos_
position of each module in recoil detector The key in this map is 10*layerID+moduleID
double ecal_depth_
Total depth of ECAL (length in Z direction)
std::map< ldmx::HcalID::HcalSection, int > hcal_n_strips_
Number of strips per layer in each section.
double ecal_si_thickness_
Thickness of sensitive Si layers.
std::map< ldmx::HcalID::HcalSection, double > hcal_layer_thickness_
Thickness of the layers in each seciton [mm].
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29

References ecal_depth_, ecal_hex_reader_, ecal_si_thickness_, ecal_zero_layer_, hcal_layer_thickness_, hcal_length_scint_, hcal_n_layers_, hcal_n_strips_, hcal_parity_vertical_, hcal_thickness_scint_, hcal_uncertainty_timing_pos_, hcal_width_scint_, hcal_zero_layer_, hcal_zero_strip_, recoil_module_angle_, and recoil_module_pos_.

Member Function Documentation

◆ getBoundingBox() [1/5]

BoundingBox eventdisplay::DetectorGeometry::getBoundingBox ( const ldmx::HcalHit & hit) const

Calculate real space coordinates from detector location.

Parameters
hitHcalHit to find real space hit for
Returns
BoundingBox in real space

Definition at line 271 of file DetectorGeometry.cxx.

271 {
272 // pairs that will go into BoundingBox
273 std::pair<double, double> X(0, 0), Y(0, 0), Z(0, 0);
274
275 ldmx::HcalID id(hit.getID());
277 int layer = id.layer();
278 int strip = id.strip();
279
280 // calculate center of layer,strip with respect to detector section
281 double layercenter =
282 layer * hcal_layer_thickness_.at(section) + 0.5 * hcal_thickness_scint_;
283 double stripcenter = (strip + 0.5) * hcal_width_scint_;
284
285 // calculate error in layer,strip position
286 double elayer = 0.5 * hcal_thickness_scint_;
287 double estrip = 0.5 * hcal_width_scint_;
288
289 double x, y, z;
290 if (section == ldmx::HcalID::HcalSection::BACK) {
291 z = hcal_zero_layer_.at(section) + layercenter;
292 Z.first = z - elayer;
293 Z.second = z + elayer;
294
295 // only horizontal layers implemented currently
296 if (false) { //( (layer ^ hcal_parity_vertical_) & 1) == 0 ) { //checks for
297 // same parity
298 // Vertical Layers
299
300 x = -hcal_zero_strip_.at(section) + stripcenter;
301 X.first = x - estrip;
302 X.second = x + estrip;
303
304 y = hit.getYPos();
305 Y.first = y - hcal_uncertainty_timing_pos_;
306 Y.second = y + hcal_uncertainty_timing_pos_;
307
308 } else {
309 // Horizontal Layers
310
311 x = hit.getXPos();
312 X.first = x - hcal_uncertainty_timing_pos_;
313 X.second = x + hcal_uncertainty_timing_pos_;
314
315 y = -1 * hcal_zero_strip_.at(section) + stripcenter;
316 Y.first = y - estrip;
317 Y.second = y + estrip;
318
319 } // calculate depending on layer
320
321 } else {
322 z = hcal_zero_strip_.at(section) + stripcenter;
323 Z.first = z - estrip;
324 Z.second = z + estrip;
325
326 if (section == ldmx::HcalID::HcalSection::TOP or
327 section == ldmx::HcalID::HcalSection::BOTTOM) {
328 x = hit.getXPos();
329 X.first = x - hcal_uncertainty_timing_pos_;
330 X.second = x + hcal_uncertainty_timing_pos_;
331
332 y = hcal_zero_layer_.at(section) + layercenter;
333 if (section == ldmx::HcalID::HcalSection::BOTTOM) {
334 y *= -1;
335 }
336
337 Y.first = y - elayer;
338 Y.second = y + elayer;
339
340 } else if (section == ldmx::HcalID::HcalSection::LEFT or
341 section == ldmx::HcalID::HcalSection::RIGHT) {
342 y = hit.getYPos();
343 Y.first = y - hcal_uncertainty_timing_pos_;
344 Y.second = y + hcal_uncertainty_timing_pos_;
345
346 x = hcal_zero_layer_.at(section) + layercenter;
347 if (section == ldmx::HcalID::HcalSection::RIGHT) {
348 x *= -1;
349 }
350
351 X.first = x - elayer;
352 X.second = x + elayer;
353
354 } else {
355 std::cerr
356 << "[ DetectorGeometry::getBoundingBox ] : Unknown Hcal Section!"
357 << std::endl;
358 std::cerr << " Returning a valid BoundingBox but with values that are "
359 "all zero."
360 << std::endl;
361 } // side hcal
362
363 } // calculate depending on section
364
365 BoundingBox hbox;
366 hbox.push_back(X);
367 hbox.push_back(Y);
368 hbox.push_back(Z);
369 return hbox;
370}
std::vector< std::pair< double, double > > BoundingBox
@type BoundingBox
float getYPos() const
Get the Y position of the hit [mm].
int getID() const
Get the detector ID.
float getXPos() const
Get the X position of the hit [mm].
Implements detector ids for HCal subdetector.
Definition HcalID.h:19
HcalSection
Encodes the section of the HCal based on the 'section' field value.
Definition HcalID.h:24

References ldmx::CalorimeterHit::getID(), ldmx::CalorimeterHit::getXPos(), ldmx::CalorimeterHit::getYPos(), hcal_layer_thickness_, hcal_thickness_scint_, hcal_uncertainty_timing_pos_, hcal_width_scint_, hcal_zero_layer_, and hcal_zero_strip_.

Referenced by eventdisplay::Objects::draw(), and getBoundingBox().

◆ getBoundingBox() [2/5]

BoundingBox eventdisplay::DetectorGeometry::getBoundingBox ( const ldmx::SimTrackerHit & recoilHit) const

Get Bounding Box for input recoil hit NOTE: This does not take into account any rotation! Use getRotAngle as well!

Parameters
recoilHitSimTrackerHit in recoil tracker
Returns
BoundingBox that bounds the hit

Definition at line 545 of file DetectorGeometry.cxx.

546 {
547 int layerID = recoilHit.getLayerID();
548 int moduleID = recoilHit.getModuleID();
549 int combined = layerID * 10 + moduleID;
550
551 BoundingBox bbox;
552 if (recoil_module_pos_.find(combined) == recoil_module_pos_.end()) {
553 std::cerr
554 << "[ Warning ] : DetectorGeometry::getBoundingBox : Input layerID ("
555 << layerID << ") and input moduleID (" << moduleID
556 << ") are not included in the geometry!" << std::endl;
557 return bbox;
558 }
559
560 std::vector<float> hitPos = recoilHit.getPosition();
561
562 double xWidth = 1.0;
563 double yWidth = recoil_stereo_strip_length_;
564 if (layerID > 8) {
565 yWidth = recoil_mono_strip_length_;
566 }
567
568 // we have to un-rotate the x-position of the hit, so we can rotate it later
569 // with the drawer
570 double rotAngle = this->getRotAngle(layerID, moduleID);
571 double xPos = hitPos.at(0) * cos(-rotAngle) - hitPos.at(1) * sin(-rotAngle);
572
573 bbox.emplace_back(xPos - xWidth / 2., xPos + xWidth / 2.);
574 bbox.emplace_back(recoil_module_pos_.at(combined).at(1) - yWidth / 2.,
575 recoil_module_pos_.at(combined).at(1) + yWidth / 2.);
576 bbox.emplace_back(
577 recoil_module_pos_.at(combined).at(2) - recoil_sensor_thickness_ / 2.,
578 recoil_module_pos_.at(combined).at(2) + recoil_sensor_thickness_ / 2.);
579
580 return bbox;
581}
double getRotAngle(int layerID, int moduleID) const
Get Rotation Angle around z-axis for the input layerID and moduleID.
int getModuleID() const
Get the module ID associated with a hit.
std::vector< float > getPosition() const
Get the XYZ position of the hit [mm].
int getLayerID() const
Get the geometric layer ID of the hit.

References ldmx::SimTrackerHit::getLayerID(), ldmx::SimTrackerHit::getModuleID(), ldmx::SimTrackerHit::getPosition(), getRotAngle(), and recoil_module_pos_.

◆ getBoundingBox() [3/5]

BoundingBox eventdisplay::DetectorGeometry::getBoundingBox ( const std::vector< ldmx::HcalHit > & hitVec) const

Calculate real space coordinates of a cluster of hits.

Determines cluster's coordinates by a weighted mean of the individuals.

Parameters
hitVecvector of HcalHits to find a "center" for
Returns
BoundingBox in real space

Definition at line 372 of file DetectorGeometry.cxx.

373 {
374 std::vector<double> pointSum(3, 0.0); // sums of weighted coordinates
375 std::vector<double> weightSum(3, 0.0); // sums of weights for each coordinate
376
377 // calculate real space point for each hit
378 for (const ldmx::HcalHit &hit : hitVec) {
379 BoundingBox box = getBoundingBox(hit);
380
381 // Add weighted values to sums
382 double weight;
383 for (unsigned int iC = 0; iC < 3; iC++) {
384 double cer = abs(box[iC].second - box[iC].first) / 2.0;
385
386 weight = 1.0 / (cer * cer);
387 weightSum[iC] += weight;
388 pointSum[iC] += weight * ((box[iC].second + box[iC].first) / 2.0);
389 }
390 } // go through hitVec
391
392 // Construct final BoundingBox
393 BoundingBox hbox;
394 for (int iC = 0; iC < 3; iC++) {
395 double c = pointSum[iC] / weightSum[iC];
396 double ec = 1.0 / sqrt(weightSum[iC]);
397 hbox.emplace_back(c - ec, c + ec);
398 }
399
400 return hbox;
401}
BoundingBox getBoundingBox(const ldmx::HcalHit &hit) const
Calculate real space coordinates from detector location.
Stores reconstructed hit information from the HCAL.
Definition HcalHit.h:24

References getBoundingBox().

◆ getBoundingBox() [4/5]

BoundingBox eventdisplay::DetectorGeometry::getBoundingBox ( int layerID,
int moduleID ) const

Get Bounding Box for input recoil module NOTE: This does not take into account any rotation! Use getRotAngle as well!

Parameters
layerIDindex for layer of module
moduleIDindex for module
Returns
BoundingBox that bounds the module

Definition at line 515 of file DetectorGeometry.cxx.

515 {
516 int combined = layerID * 10 + moduleID;
517
518 BoundingBox bbox;
519 if (recoil_module_pos_.find(combined) == recoil_module_pos_.end()) {
520 std::cerr
521 << "[ Warning ] : DetectorGeometry::getBoundingBox : Input layerID ("
522 << layerID << ") and input moduleID (" << moduleID
523 << ") are not included in the geometry!" << std::endl;
524 return bbox;
525 }
526
527 double xWidth = recoil_stereo_x_width_;
528 double yWidth = recoil_stereo_strip_length_;
529 if (layerID > 8) {
530 xWidth = recoil_mono_x_width_;
531 yWidth = recoil_mono_strip_length_;
532 }
533
534 bbox.emplace_back(recoil_module_pos_.at(combined).at(0) - xWidth / 2.,
535 recoil_module_pos_.at(combined).at(0) + xWidth / 2.);
536 bbox.emplace_back(recoil_module_pos_.at(combined).at(1) - yWidth / 2.,
537 recoil_module_pos_.at(combined).at(1) + yWidth / 2.);
538 bbox.emplace_back(
539 recoil_module_pos_.at(combined).at(2) - recoil_sensor_thickness_ / 2.,
540 recoil_module_pos_.at(combined).at(2) + recoil_sensor_thickness_ / 2.);
541
542 return bbox;
543}

References recoil_module_pos_.

◆ getBoundingBox() [5/5]

BoundingBox eventdisplay::DetectorGeometry::getBoundingBox ( ldmx::HcalID::HcalSection section) const

Get bounding box for the input section.

Parameters
sectionHcalID::HcalSection
Returns
BoundingBox that bounds section

Definition at line 403 of file DetectorGeometry.cxx.

404 {
405 std::pair<double, double> X(0, 0), Y(0, 0), Z(0, 0);
406
407 double total_strip_width = hcal_n_strips_.at(section) * hcal_width_scint_;
408 double total_thickness =
409 hcal_n_layers_.at(section) * hcal_layer_thickness_.at(section);
410 if (section == ldmx::HcalID::HcalSection::BACK) {
411 X.first = -hcal_zero_strip_.at(ldmx::HcalID::HcalSection::BACK);
412 X.second = X.first + total_strip_width;
413
414 Y.first = -hcal_length_scint_.at(ldmx::HcalID::HcalSection::BACK) / 2.0;
415 Y.second = hcal_length_scint_.at(ldmx::HcalID::HcalSection::BACK) / 2.0;
416
417 Z.first = hcal_zero_layer_.at(ldmx::HcalID::HcalSection::BACK);
418 Z.second = Z.first + total_thickness;
419
420 } else {
421 Z.first = hcal_zero_strip_.at(section);
422 Z.second = Z.first + total_strip_width;
423
424 if (section == ldmx::HcalID::HcalSection::LEFT) {
425 X.first = hcal_zero_layer_.at(ldmx::HcalID::HcalSection::LEFT);
426 X.second = X.first + total_thickness;
427
428 Y.second = hcal_zero_layer_.at(ldmx::HcalID::HcalSection::TOP);
429 Y.first =
430 Y.second - hcal_length_scint_.at(ldmx::HcalID::HcalSection::LEFT);
431
432 } else if (section == ldmx::HcalID::HcalSection::RIGHT) {
433 X.second = -hcal_zero_layer_.at(ldmx::HcalID::HcalSection::RIGHT);
434 X.first = X.second - total_thickness;
435
436 Y.first = -hcal_zero_layer_.at(ldmx::HcalID::HcalSection::BOTTOM);
437 Y.second =
438 Y.first + hcal_length_scint_.at(ldmx::HcalID::HcalSection::RIGHT);
439
440 } else if (section == ldmx::HcalID::HcalSection::TOP) {
441 Y.first = hcal_zero_layer_.at(ldmx::HcalID::HcalSection::TOP);
442 Y.second = Y.first + total_thickness;
443
444 X.first = -hcal_zero_layer_.at(ldmx::HcalID::HcalSection::RIGHT);
445 X.second =
446 X.first + hcal_length_scint_.at(ldmx::HcalID::HcalSection::TOP);
447
448 } else if (section == ldmx::HcalID::HcalSection::BOTTOM) {
449 Y.second = -hcal_zero_layer_.at(ldmx::HcalID::HcalSection::BOTTOM);
450 Y.first = Y.second - total_thickness;
451
452 X.second = hcal_zero_layer_.at(ldmx::HcalID::HcalSection::LEFT);
453 X.first =
454 X.second - hcal_length_scint_.at(ldmx::HcalID::HcalSection::BOTTOM);
455
456 } else {
457 std::cerr << "[ Warning ] : Unrecognized ldmx::HcalID::HcalSection in "
458 "DetectorGeometry::getBoundingBox."
459 << std::endl;
460 std::cerr << " Will return an incorrect geometry description!"
461 << std::endl;
462 }
463 }
464
465 BoundingBox boundingbox;
466 boundingbox.push_back(X);
467 boundingbox.push_back(Y);
468 boundingbox.push_back(Z);
469
470 return boundingbox;
471}

References hcal_layer_thickness_, hcal_length_scint_, hcal_n_layers_, hcal_n_strips_, hcal_width_scint_, hcal_zero_layer_, and hcal_zero_strip_.

◆ getHexPrism()

HexPrism eventdisplay::DetectorGeometry::getHexPrism ( const ldmx::EcalID & id) const

Calculate bounding hexagonal prism for input EcalHit.

Parameters
idEcalID for the hit
Returns
HexPrism

Definition at line 473 of file DetectorGeometry.cxx.

473 {
474 HexPrism hexpris;
475 ecal_hex_reader_->getCellAbsolutePosition(id, hexpris.x, hexpris.y,
476 hexpris.z);
477 hexpris.height = ecal_si_thickness_;
478 hexpris.radius = ecal_hex_reader_->getCellMaxR();
479
480 return hexpris;
481}

References ecal_hex_reader_, and ecal_si_thickness_.

◆ getHexTower()

HexPrism eventdisplay::DetectorGeometry::getHexTower ( int towerIndex) const

Get HexPrism for a tower.

Parameters
towerIndexint index of hexagonal tower
Returns
HexPrism

Definition at line 483 of file DetectorGeometry.cxx.

483 {
484 HexPrism hexpris;
485
486 if (towerIndex < 0 or towerIndex > 6) {
487 std::cerr << "[ Warning ] : towerIndex " << towerIndex << " out of bounds!"
488 << std::endl;
489 std::cerr << " Will return a malformed HexPrism." << std::endl;
490 return hexpris;
491 }
492
493 hexpris.x = ecal_hex_reader_->getModuleCenter(towerIndex).first;
494 hexpris.y = ecal_hex_reader_->getModuleCenter(towerIndex).second;
495 hexpris.z = ecal_zero_layer_ + ecal_depth_ / 2;
496 hexpris.height = ecal_depth_;
497 hexpris.radius = ecal_hex_reader_->getModuleMaxR();
498
499 return hexpris;
500}

References ecal_depth_, ecal_hex_reader_, and ecal_zero_layer_.

◆ getInstance()

static const DetectorGeometry & eventdisplay::DetectorGeometry::getInstance ( )
inlinestatic

Get the single instance of this class.

Definition at line 59 of file DetectorGeometry.h.

59 {
60 static const DetectorGeometry detector_geometry;
61 return detector_geometry;
62 }
DetectorGeometry()
Constructor This is where all the detector constants are set.

Referenced by eventdisplay::Objects::draw(), eventdisplay::Objects::draw(), eventdisplay::Objects::draw(), eventdisplay::Objects::draw(), eventdisplay::EveDetectorGeometry::drawECAL(), eventdisplay::EveDetectorGeometry::drawHCAL(), and eventdisplay::EveDetectorGeometry::drawRecoilTracker().

◆ getRotAngle()

double eventdisplay::DetectorGeometry::getRotAngle ( int layerID,
int moduleID ) const

Get Rotation Angle around z-axis for the input layerID and moduleID.

Parameters
layerIDindex for layer of recoil module
moduleIDindex for module of recoil module
Returns
rotation angle in radians

Definition at line 502 of file DetectorGeometry.cxx.

502 {
503 int combined = layerID * 10 + moduleID;
504
505 if (recoil_module_angle_.find(combined) == recoil_module_angle_.end()) {
506 std::cerr << "[ Warning ] : DetectorGeometry::getRotAngle : Input layerID ("
507 << layerID << ") and input moduleID (" << moduleID
508 << ") are not included in the geometry!" << std::endl;
509 return 0.0;
510 }
511
512 return recoil_module_angle_.at(combined);
513}

References recoil_module_angle_.

Referenced by getBoundingBox().

Member Data Documentation

◆ ecal_depth_

double eventdisplay::DetectorGeometry::ecal_depth_
private

Total depth of ECAL (length in Z direction)

Definition at line 186 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getHexTower().

◆ ecal_hex_reader_

std::unique_ptr<ldmx::EcalHexReadout> eventdisplay::DetectorGeometry::ecal_hex_reader_
private

Helper class to calculate (x,y) coordinate from hexagons.

Definition at line 192 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), getHexPrism(), and getHexTower().

◆ ecal_si_thickness_

double eventdisplay::DetectorGeometry::ecal_si_thickness_
private

Thickness of sensitive Si layers.

Definition at line 183 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getHexPrism().

◆ ecal_zero_layer_

double eventdisplay::DetectorGeometry::ecal_zero_layer_
private

z-coordinate of plane for first ecal layer [mm]

Definition at line 189 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getHexTower().

◆ hcal_layer_thickness_

std::map<ldmx::HcalID::HcalSection, double> eventdisplay::DetectorGeometry::hcal_layer_thickness_
private

Thickness of the layers in each seciton [mm].

Definition at line 165 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), getBoundingBox(), and getBoundingBox().

◆ hcal_length_scint_

std::map<ldmx::HcalID::HcalSection, double> eventdisplay::DetectorGeometry::hcal_length_scint_
private

Length of Scintillator Strip [mm].

Definition at line 156 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getBoundingBox().

◆ hcal_n_layers_

std::map<ldmx::HcalID::HcalSection, int> eventdisplay::DetectorGeometry::hcal_n_layers_
private

Number of layers in each section.

Definition at line 150 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getBoundingBox().

◆ hcal_n_strips_

std::map<ldmx::HcalID::HcalSection, int> eventdisplay::DetectorGeometry::hcal_n_strips_
private

Number of strips per layer in each section.

Definition at line 153 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getBoundingBox().

◆ hcal_parity_vertical_

int eventdisplay::DetectorGeometry::hcal_parity_vertical_
private

an example layer number of a vertical layer

Definition at line 168 of file DetectorGeometry.h.

Referenced by DetectorGeometry().

◆ hcal_thickness_scint_

double eventdisplay::DetectorGeometry::hcal_thickness_scint_
private

Thickness of Scintillator Strip [mm].

Definition at line 174 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getBoundingBox().

◆ hcal_uncertainty_timing_pos_

double eventdisplay::DetectorGeometry::hcal_uncertainty_timing_pos_
private

Uncertainty in timing position along a bar/strip [mm].

Definition at line 171 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getBoundingBox().

◆ hcal_width_scint_

double eventdisplay::DetectorGeometry::hcal_width_scint_
private

Width of Scintillator Strip [mm].

Definition at line 177 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), getBoundingBox(), and getBoundingBox().

◆ hcal_zero_layer_

std::map<ldmx::HcalID::HcalSection, double> eventdisplay::DetectorGeometry::hcal_zero_layer_
private

The plane of the zero'th layer of each section [mm].

Definition at line 159 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), getBoundingBox(), and getBoundingBox().

◆ hcal_zero_strip_

std::map<ldmx::HcalID::HcalSection, double> eventdisplay::DetectorGeometry::hcal_zero_strip_
private

The plane of the zero'th strip of each section [mm].

Definition at line 162 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), getBoundingBox(), and getBoundingBox().

◆ recoil_module_angle_

std::map<int, double> eventdisplay::DetectorGeometry::recoil_module_angle_
private

angular tilt for each module in recoil detector The key in this map is 10*layerID+moduleID

Definition at line 225 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getRotAngle().

◆ recoil_module_pos_

std::map<int, std::vector<double> > eventdisplay::DetectorGeometry::recoil_module_pos_
private

position of each module in recoil detector The key in this map is 10*layerID+moduleID

Definition at line 220 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), getBoundingBox(), and getBoundingBox().

◆ recoil_mono_separation_

double eventdisplay::DetectorGeometry::recoil_mono_separation_
private

Definition at line 213 of file DetectorGeometry.h.

◆ recoil_mono_strip_length_

double eventdisplay::DetectorGeometry::recoil_mono_strip_length_
private

Definition at line 207 of file DetectorGeometry.h.

◆ recoil_mono_x_width_

double eventdisplay::DetectorGeometry::recoil_mono_x_width_
private

Definition at line 209 of file DetectorGeometry.h.

◆ recoil_mono_y_width_

double eventdisplay::DetectorGeometry::recoil_mono_y_width_
private

Definition at line 211 of file DetectorGeometry.h.

◆ recoil_sensor_thickness_

double eventdisplay::DetectorGeometry::recoil_sensor_thickness_
private

Definition at line 215 of file DetectorGeometry.h.

◆ recoil_stereo_angle_

double eventdisplay::DetectorGeometry::recoil_stereo_angle_
private

Definition at line 205 of file DetectorGeometry.h.

◆ recoil_stereo_separation_

double eventdisplay::DetectorGeometry::recoil_stereo_separation_
private

Definition at line 203 of file DetectorGeometry.h.

◆ recoil_stereo_strip_length_

double eventdisplay::DetectorGeometry::recoil_stereo_strip_length_
private

Definition at line 197 of file DetectorGeometry.h.

◆ recoil_stereo_x_width_

double eventdisplay::DetectorGeometry::recoil_stereo_x_width_
private

Definition at line 199 of file DetectorGeometry.h.

◆ recoil_stereo_y_width_

double eventdisplay::DetectorGeometry::recoil_stereo_y_width_
private

Definition at line 201 of file DetectorGeometry.h.


The documentation for this class was generated from the following files: