LDMX Software
DetectorGeometry.cxx
Go to the documentation of this file.
1
7
8namespace eventdisplay {
9
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}
270
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}
371
373 const std::vector<ldmx::HcalHit> &hitVec) const {
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}
402
404 ldmx::HcalID::HcalSection section) const {
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}
472
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}
482
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}
501
502double DetectorGeometry::getRotAngle(int layerID, int moduleID) const {
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}
514
515BoundingBox DetectorGeometry::getBoundingBox(int layerID, int moduleID) const {
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}
544
546 const ldmx::SimTrackerHit &recoilHit) const {
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}
582} // namespace eventdisplay
Header file for class DetectorGeometry.
std::vector< std::pair< double, double > > BoundingBox
@type BoundingBox
double hcal_uncertainty_timing_pos_
Uncertainty in timing position along a bar/strip [mm].
HexPrism getHexTower(int towerIndex) const
Get HexPrism for a tower.
int hcal_parity_vertical_
an example layer number of a vertical layer
HexPrism getHexPrism(const ldmx::EcalID &id) const
Calculate bounding hexagonal prism for input EcalHit.
std::map< ldmx::HcalID::HcalSection, double > hcal_length_scint_
Length of Scintillator Strip [mm].
double getRotAngle(int layerID, int moduleID) const
Get Rotation Angle around z-axis for the input layerID and moduleID.
std::map< ldmx::HcalID::HcalSection, int > hcal_n_layers_
Number of layers in each section.
DetectorGeometry()
Constructor This is where all the detector constants are set.
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.
BoundingBox getBoundingBox(const ldmx::HcalHit &hit) const
Calculate real space coordinates from detector location.
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
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].
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.
Definition EcalID.h:20
Stores reconstructed hit information from the HCAL.
Definition HcalHit.h:24
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
Represents a simulated tracker hit in the simulation.
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.
Stores the necessary geometry details for a hexagonal prism.