LDMX Software
DetectorGeometry.cxx
Go to the documentation of this file.
1
7
8namespace eventdisplay {
9
12 // HCAL
13
15
17
19
20 hcalWidthScint_ = 50.0;
21
22 hcalNLayers_[ldmx::HcalID::HcalSection::BACK] = 100;
23 hcalNLayers_[ldmx::HcalID::HcalSection::TOP] = 28;
24 hcalNLayers_[ldmx::HcalID::HcalSection::BOTTOM] = 28;
25 hcalNLayers_[ldmx::HcalID::HcalSection::LEFT] = 26;
26 hcalNLayers_[ldmx::HcalID::HcalSection::RIGHT] = 26;
27
28 hcalNStrips_[ldmx::HcalID::HcalSection::BACK] = 62;
29 hcalNStrips_[ldmx::HcalID::HcalSection::TOP] = 12;
30 hcalNStrips_[ldmx::HcalID::HcalSection::BOTTOM] = 12;
31 hcalNStrips_[ldmx::HcalID::HcalSection::LEFT] = 12;
32 hcalNStrips_[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 hcalLengthScint_[ldmx::HcalID::HcalSection::BACK] = back_transverse_width;
40 hcalLengthScint_[ldmx::HcalID::HcalSection::TOP] =
41 (back_transverse_width + ecal_xy) / 2.;
42 hcalLengthScint_[ldmx::HcalID::HcalSection::BOTTOM] =
43 (back_transverse_width + ecal_xy) / 2.;
44 hcalLengthScint_[ldmx::HcalID::HcalSection::LEFT] =
45 (back_transverse_width + ecal_xy) / 2.;
46 hcalLengthScint_[ldmx::HcalID::HcalSection::RIGHT] =
47 (back_transverse_width + ecal_xy) / 2.;
48
49 hcalZeroLayer_[ldmx::HcalID::HcalSection::BACK] =
50 ecal_front_z + 600.; // leaving 60cm cube for ecal
51 hcalZeroLayer_[ldmx::HcalID::HcalSection::TOP] = ecal_xy / 2.;
52 hcalZeroLayer_[ldmx::HcalID::HcalSection::BOTTOM] = ecal_xy / 2.;
53 hcalZeroLayer_[ldmx::HcalID::HcalSection::LEFT] = ecal_xy / 2.;
54 hcalZeroLayer_[ldmx::HcalID::HcalSection::RIGHT] = ecal_xy / 2.;
55
56 hcalZeroStrip_[ldmx::HcalID::HcalSection::BACK] = back_transverse_width / 2.;
57 hcalZeroStrip_[ldmx::HcalID::HcalSection::TOP] = ecal_front_z;
58 hcalZeroStrip_[ldmx::HcalID::HcalSection::BOTTOM] = ecal_front_z;
59 hcalZeroStrip_[ldmx::HcalID::HcalSection::LEFT] = ecal_front_z;
60 hcalZeroStrip_[ldmx::HcalID::HcalSection::RIGHT] = ecal_front_z;
61
62 // absorber + scintillator + 2*air
63 hcalLayerThickness_[ldmx::HcalID::HcalSection::BACK] =
64 25. + hcalThicknessScint_ + 2 * 2.;
65 hcalLayerThickness_[ldmx::HcalID::HcalSection::TOP] =
66 20. + hcalThicknessScint_ + 2 * 2.;
67 hcalLayerThickness_[ldmx::HcalID::HcalSection::BOTTOM] =
68 20. + hcalThicknessScint_ + 2 * 2.;
69 hcalLayerThickness_[ldmx::HcalID::HcalSection::LEFT] =
70 20. + hcalThicknessScint_ + 2 * 2.;
71 hcalLayerThickness_[ldmx::HcalID::HcalSection::RIGHT] =
72 20. + hcalThicknessScint_ + 2 * 2.;
73
75 // ECAL
76
77 ecalZeroLayer_ = ecal_front_z;
78
79 ecalSiThickness_ = 0.5;
80
81 ecalDepth_ = ecal_z;
82
83 std::vector<double> ecalSiPlanes = {
84 7.850, 13.300, 26.400, 33.500, 47.950, 56.550, 72.250,
85 81.350, 97.050, 106.150, 121.850, 130.950, 146.650, 155.750,
86 171.450, 180.550, 196.250, 205.350, 221.050, 230.150, 245.850,
87 254.950, 270.650, 279.750, 298.950, 311.550, 330.750, 343.350,
88 362.550, 375.150, 394.350, 406.950, 426.150, 438.750};
89
90 std::map<std::string, std::any> hexReadoutParams;
91 hexReadoutParams["gap"] = 1.5;
92 hexReadoutParams["moduleMinR"] = 85.0;
93 hexReadoutParams["layerZPositions"] = ecalSiPlanes;
94 hexReadoutParams["ecalFrontZ"] = ecalZeroLayer_;
95 hexReadoutParams["nCellRHeight"] = 35.3;
96 hexReadoutParams["verbose"] = 0;
97
99 hexReadout.setParameters(hexReadoutParams);
100 ecalHexReader_ = std::unique_ptr<ldmx::EcalHexReadout>(
101 ldmx::EcalHexReadout::debugMake(hexReadout));
102
104 // RECOIL TRACKER
105 // The gdml file for the recoil tracker is kinda opaque.
106 // The layer and module IDs are calculated from the copy number of each
107 // of the sensor volumes.
108 // layer = copyNum / 10 (integer division)
109 // module = copyNum % 10
110 // The first 8 layer IDs are the first 4 layers of stereo sensors.
111 // Each stereo layer contains a front layer that is not tilted at an
112 // angle and a back layer that is tilted.
113 // The last 2 layer IDs correspond to the 2 layers of mono sensors.
114 // Each mono layer contains 10 modules (ids 0 - 9) that have a
115 // complicated position arrangement.
116 //
117 // In order to avoid mistakes, the position and angle of each module will
118 // be hard coded here instead of calculated from design specifications
119 // like the HCAL case.
120
121 recoilStereoStripLength_ = 98.0;
122
123 recoilStereoXWidth_ = 40.34;
124
125 recoilStereoYWidth_ = 100.0;
126
127 recoilStereoSeparation_ = 3.0;
128
129 recoilStereoAngle_ = 0.1;
130
131 recoilMonoStripLength_ = 78.0;
132
133 recoilMonoXWidth_ = 50.0;
134
135 recoilMonoYWidth_ = 80.0;
136
137 recoilMonoSeparation_ = 1.0;
138
139 recoilSensorThickness_ = 0.52;
140
141 // The following keys for the position and angle maps should correspond to the
142 // copynumber in the recoil.gdml file At writing, the layerIDs and moduleIDs
143 // are set in the simulation from this copy number (TrackerSD.cxx in SimCore)
144
145 std::vector<double> recoilStereoLayerZPos = {7.5, 22.5, 37.5, 52.5};
146
147 recoilModulePos_[10] = {
148 0, 0, recoilStereoLayerZPos.at(0) - recoilStereoSeparation_};
149 recoilModulePos_[20] = {
150 0, 0, recoilStereoLayerZPos.at(0) + recoilStereoSeparation_};
151
152 recoilModulePos_[30] = {
153 0, 0, recoilStereoLayerZPos.at(1) - recoilStereoSeparation_};
154 recoilModulePos_[40] = {
155 0, 0, recoilStereoLayerZPos.at(1) + recoilStereoSeparation_};
156
157 recoilModulePos_[50] = {
158 0, 0, recoilStereoLayerZPos.at(2) - recoilStereoSeparation_};
159 recoilModulePos_[60] = {
160 0, 0, recoilStereoLayerZPos.at(2) + recoilStereoSeparation_};
161
162 recoilModulePos_[70] = {
163 0, 0, recoilStereoLayerZPos.at(3) - recoilStereoSeparation_};
164 recoilModulePos_[80] = {
165 0, 0, recoilStereoLayerZPos.at(3) + recoilStereoSeparation_};
166
167 std::vector<double> recoilMonoLayerZPos = {90.0, 180.0};
168
169 recoilModulePos_[90] = {2 * recoilMonoXWidth_, 0.5 * recoilMonoYWidth_,
170 recoilMonoLayerZPos.at(0) + recoilMonoSeparation_};
171 recoilModulePos_[91] = {recoilMonoXWidth_, 0.5 * recoilMonoYWidth_,
172 recoilMonoLayerZPos.at(0) - recoilMonoSeparation_};
173 recoilModulePos_[92] = {0.0, 0.5 * recoilMonoYWidth_,
174 recoilMonoLayerZPos.at(0) + recoilMonoSeparation_};
175 recoilModulePos_[93] = {-1 * recoilMonoXWidth_, 0.5 * recoilMonoYWidth_,
176 recoilMonoLayerZPos.at(0) - recoilMonoSeparation_};
177 recoilModulePos_[94] = {-2 * recoilMonoXWidth_, 0.5 * recoilMonoYWidth_,
178 recoilMonoLayerZPos.at(0) + recoilMonoSeparation_};
179 recoilModulePos_[95] = {2 * recoilMonoXWidth_, -0.5 * recoilMonoYWidth_,
180 recoilMonoLayerZPos.at(0) + recoilMonoSeparation_};
181 recoilModulePos_[96] = {recoilMonoXWidth_, -0.5 * recoilMonoYWidth_,
182 recoilMonoLayerZPos.at(0) - recoilMonoSeparation_};
183 recoilModulePos_[97] = {0.0, -0.5 * recoilMonoYWidth_,
184 recoilMonoLayerZPos.at(0) + recoilMonoSeparation_};
185 recoilModulePos_[98] = {-1 * recoilMonoXWidth_, -0.5 * recoilMonoYWidth_,
186 recoilMonoLayerZPos.at(0) - recoilMonoSeparation_};
187 recoilModulePos_[99] = {-2 * recoilMonoXWidth_, -0.5 * recoilMonoYWidth_,
188 recoilMonoLayerZPos.at(0) + recoilMonoSeparation_};
189
190 recoilModulePos_[100] = {2 * recoilMonoXWidth_, 0.5 * recoilMonoYWidth_,
191 recoilMonoLayerZPos.at(1) + recoilMonoSeparation_};
192 recoilModulePos_[101] = {recoilMonoXWidth_, 0.5 * recoilMonoYWidth_,
193 recoilMonoLayerZPos.at(1) - recoilMonoSeparation_};
194 recoilModulePos_[102] = {0.0, 0.5 * recoilMonoYWidth_,
195 recoilMonoLayerZPos.at(1) + recoilMonoSeparation_};
196 recoilModulePos_[103] = {-1 * recoilMonoXWidth_, 0.5 * recoilMonoYWidth_,
197 recoilMonoLayerZPos.at(1) - recoilMonoSeparation_};
198 recoilModulePos_[104] = {-2 * recoilMonoXWidth_, 0.5 * recoilMonoYWidth_,
199 recoilMonoLayerZPos.at(1) + recoilMonoSeparation_};
200 recoilModulePos_[105] = {2 * recoilMonoXWidth_, -0.5 * recoilMonoYWidth_,
201 recoilMonoLayerZPos.at(1) + recoilMonoSeparation_};
202 recoilModulePos_[106] = {recoilMonoXWidth_, -0.5 * recoilMonoYWidth_,
203 recoilMonoLayerZPos.at(1) - recoilMonoSeparation_};
204 recoilModulePos_[107] = {0.0, -0.5 * recoilMonoYWidth_,
205 recoilMonoLayerZPos.at(1) + recoilMonoSeparation_};
206 recoilModulePos_[108] = {-1 * recoilMonoXWidth_, -0.5 * recoilMonoYWidth_,
207 recoilMonoLayerZPos.at(1) - recoilMonoSeparation_};
208 recoilModulePos_[109] = {-2 * recoilMonoXWidth_, -0.5 * recoilMonoYWidth_,
209 recoilMonoLayerZPos.at(1) + recoilMonoSeparation_};
210
211 // Recoil Angles
212 recoilModuleAngle_[10] = 0.0;
213 recoilModuleAngle_[20] = recoilStereoAngle_;
214
215 recoilModuleAngle_[30] = 0.0;
216 recoilModuleAngle_[40] = -recoilStereoAngle_;
217
218 recoilModuleAngle_[50] = 0.0;
219 recoilModuleAngle_[60] = recoilStereoAngle_;
220
221 recoilModuleAngle_[70] = 0.0;
222 recoilModuleAngle_[80] = -recoilStereoAngle_;
223
224 recoilModuleAngle_[90] = 0.0;
225 recoilModuleAngle_[91] = 0.0;
226 recoilModuleAngle_[92] = 0.0;
227 recoilModuleAngle_[93] = 0.0;
228 recoilModuleAngle_[94] = 0.0;
229 recoilModuleAngle_[95] = 0.0;
230 recoilModuleAngle_[96] = 0.0;
231 recoilModuleAngle_[97] = 0.0;
232 recoilModuleAngle_[98] = 0.0;
233 recoilModuleAngle_[99] = 0.0;
234
235 recoilModuleAngle_[100] = 0.0;
236 recoilModuleAngle_[101] = 0.0;
237 recoilModuleAngle_[102] = 0.0;
238 recoilModuleAngle_[103] = 0.0;
239 recoilModuleAngle_[104] = 0.0;
240 recoilModuleAngle_[105] = 0.0;
241 recoilModuleAngle_[106] = 0.0;
242 recoilModuleAngle_[107] = 0.0;
243 recoilModuleAngle_[108] = 0.0;
244 recoilModuleAngle_[109] = 0.0;
245
246 // TODO Tagger
247 // TODO Trigger Pad
248}
249
251 // pairs that will go into BoundingBox
252 std::pair<double, double> X(0, 0), Y(0, 0), Z(0, 0);
253
254 ldmx::HcalID id(hit.getID());
256 int layer = id.layer();
257 int strip = id.strip();
258
259 // calculate center of layer,strip with respect to detector section
260 double layercenter =
261 layer * hcalLayerThickness_.at(section) + 0.5 * hcalThicknessScint_;
262 double stripcenter = (strip + 0.5) * hcalWidthScint_;
263
264 // calculate error in layer,strip position
265 double elayer = 0.5 * hcalThicknessScint_;
266 double estrip = 0.5 * hcalWidthScint_;
267
268 double x, y, z;
269 if (section == ldmx::HcalID::HcalSection::BACK) {
270 z = hcalZeroLayer_.at(section) + layercenter;
271 Z.first = z - elayer;
272 Z.second = z + elayer;
273
274 // only horizontal layers implemented currently
275 if (false) { //( (layer ^ hcalParityVertical_) & 1) == 0 ) { //checks for
276 // same parity
277 // Vertical Layers
278
279 x = -hcalZeroStrip_.at(section) + stripcenter;
280 X.first = x - estrip;
281 X.second = x + estrip;
282
283 y = hit.getYPos();
284 Y.first = y - hcalUncertaintyTimingPos_;
285 Y.second = y + hcalUncertaintyTimingPos_;
286
287 } else {
288 // Horizontal Layers
289
290 x = hit.getXPos();
291 X.first = x - hcalUncertaintyTimingPos_;
292 X.second = x + hcalUncertaintyTimingPos_;
293
294 y = -1 * hcalZeroStrip_.at(section) + stripcenter;
295 Y.first = y - estrip;
296 Y.second = y + estrip;
297
298 } // calculate depending on layer
299
300 } else {
301 z = hcalZeroStrip_.at(section) + stripcenter;
302 Z.first = z - estrip;
303 Z.second = z + estrip;
304
305 if (section == ldmx::HcalID::HcalSection::TOP or
306 section == ldmx::HcalID::HcalSection::BOTTOM) {
307 x = hit.getXPos();
308 X.first = x - hcalUncertaintyTimingPos_;
309 X.second = x + hcalUncertaintyTimingPos_;
310
311 y = hcalZeroLayer_.at(section) + layercenter;
312 if (section == ldmx::HcalID::HcalSection::BOTTOM) {
313 y *= -1;
314 }
315
316 Y.first = y - elayer;
317 Y.second = y + elayer;
318
319 } else if (section == ldmx::HcalID::HcalSection::LEFT or
320 section == ldmx::HcalID::HcalSection::RIGHT) {
321 y = hit.getYPos();
322 Y.first = y - hcalUncertaintyTimingPos_;
323 Y.second = y + hcalUncertaintyTimingPos_;
324
325 x = hcalZeroLayer_.at(section) + layercenter;
326 if (section == ldmx::HcalID::HcalSection::RIGHT) {
327 x *= -1;
328 }
329
330 X.first = x - elayer;
331 X.second = x + elayer;
332
333 } else {
334 std::cerr
335 << "[ DetectorGeometry::getBoundingBox ] : Unknown Hcal Section!"
336 << std::endl;
337 std::cerr << " Returning a valid BoundingBox but with values that are "
338 "all zero."
339 << std::endl;
340 } // side hcal
341
342 } // calculate depending on section
343
344 BoundingBox hbox;
345 hbox.push_back(X);
346 hbox.push_back(Y);
347 hbox.push_back(Z);
348 return hbox;
349}
350
352 const std::vector<ldmx::HcalHit> &hitVec) const {
353 std::vector<double> pointSum(3, 0.0); // sums of weighted coordinates
354 std::vector<double> weightSum(3, 0.0); // sums of weights for each coordinate
355
356 // calculate real space point for each hit
357 for (const ldmx::HcalHit &hit : hitVec) {
358 BoundingBox box = getBoundingBox(hit);
359
360 // Add weighted values to sums
361 double weight;
362 for (unsigned int iC = 0; iC < 3; iC++) {
363 double cer = abs(box[iC].second - box[iC].first) / 2.0;
364
365 weight = 1.0 / (cer * cer);
366 weightSum[iC] += weight;
367 pointSum[iC] += weight * ((box[iC].second + box[iC].first) / 2.0);
368 }
369 } // go through hitVec
370
371 // Construct final BoundingBox
372 BoundingBox hbox;
373 for (int iC = 0; iC < 3; iC++) {
374 double c = pointSum[iC] / weightSum[iC];
375 double ec = 1.0 / sqrt(weightSum[iC]);
376 hbox.emplace_back(c - ec, c + ec);
377 }
378
379 return hbox;
380}
381
383 ldmx::HcalID::HcalSection section) const {
384 std::pair<double, double> X(0, 0), Y(0, 0), Z(0, 0);
385
386 double total_strip_width = hcalNStrips_.at(section) * hcalWidthScint_;
387 double total_thickness =
388 hcalNLayers_.at(section) * hcalLayerThickness_.at(section);
389 if (section == ldmx::HcalID::HcalSection::BACK) {
390 X.first = -hcalZeroStrip_.at(ldmx::HcalID::HcalSection::BACK);
391 X.second = X.first + total_strip_width;
392
393 Y.first = -hcalLengthScint_.at(ldmx::HcalID::HcalSection::BACK) / 2.0;
394 Y.second = hcalLengthScint_.at(ldmx::HcalID::HcalSection::BACK) / 2.0;
395
396 Z.first = hcalZeroLayer_.at(ldmx::HcalID::HcalSection::BACK);
397 Z.second = Z.first + total_thickness;
398
399 } else {
400 Z.first = hcalZeroStrip_.at(section);
401 Z.second = Z.first + total_strip_width;
402
403 if (section == ldmx::HcalID::HcalSection::LEFT) {
404 X.first = hcalZeroLayer_.at(ldmx::HcalID::HcalSection::LEFT);
405 X.second = X.first + total_thickness;
406
407 Y.second = hcalZeroLayer_.at(ldmx::HcalID::HcalSection::TOP);
408 Y.first = Y.second - hcalLengthScint_.at(ldmx::HcalID::HcalSection::LEFT);
409
410 } else if (section == ldmx::HcalID::HcalSection::RIGHT) {
411 X.second = -hcalZeroLayer_.at(ldmx::HcalID::HcalSection::RIGHT);
412 X.first = X.second - total_thickness;
413
414 Y.first = -hcalZeroLayer_.at(ldmx::HcalID::HcalSection::BOTTOM);
415 Y.second =
416 Y.first + hcalLengthScint_.at(ldmx::HcalID::HcalSection::RIGHT);
417
418 } else if (section == ldmx::HcalID::HcalSection::TOP) {
419 Y.first = hcalZeroLayer_.at(ldmx::HcalID::HcalSection::TOP);
420 Y.second = Y.first + total_thickness;
421
422 X.first = -hcalZeroLayer_.at(ldmx::HcalID::HcalSection::RIGHT);
423 X.second = X.first + hcalLengthScint_.at(ldmx::HcalID::HcalSection::TOP);
424
425 } else if (section == ldmx::HcalID::HcalSection::BOTTOM) {
426 Y.second = -hcalZeroLayer_.at(ldmx::HcalID::HcalSection::BOTTOM);
427 Y.first = Y.second - total_thickness;
428
429 X.second = hcalZeroLayer_.at(ldmx::HcalID::HcalSection::LEFT);
430 X.first =
431 X.second - hcalLengthScint_.at(ldmx::HcalID::HcalSection::BOTTOM);
432
433 } else {
434 std::cerr << "[ Warning ] : Unrecognized ldmx::HcalID::HcalSection in "
435 "DetectorGeometry::getBoundingBox."
436 << std::endl;
437 std::cerr << " Will return an incorrect geometry description!"
438 << std::endl;
439 }
440 }
441
442 BoundingBox boundingbox;
443 boundingbox.push_back(X);
444 boundingbox.push_back(Y);
445 boundingbox.push_back(Z);
446
447 return boundingbox;
448}
449
451 HexPrism hexpris;
452 ecalHexReader_->getCellAbsolutePosition(id, hexpris.x, hexpris.y, hexpris.z);
453 hexpris.height = ecalSiThickness_;
454 hexpris.radius = ecalHexReader_->getCellMaxR();
455
456 return hexpris;
457}
458
460 HexPrism hexpris;
461
462 if (towerIndex < 0 or towerIndex > 6) {
463 std::cerr << "[ Warning ] : towerIndex " << towerIndex << " out of bounds!"
464 << std::endl;
465 std::cerr << " Will return a malformed HexPrism." << std::endl;
466 return hexpris;
467 }
468
469 hexpris.x = ecalHexReader_->getModuleCenter(towerIndex).first;
470 hexpris.y = ecalHexReader_->getModuleCenter(towerIndex).second;
471 hexpris.z = ecalZeroLayer_ + ecalDepth_ / 2;
472 hexpris.height = ecalDepth_;
473 hexpris.radius = ecalHexReader_->getModuleMaxR();
474
475 return hexpris;
476}
477
478double DetectorGeometry::getRotAngle(int layerID, int moduleID) const {
479 int combined = layerID * 10 + moduleID;
480
481 if (recoilModuleAngle_.find(combined) == recoilModuleAngle_.end()) {
482 std::cerr << "[ Warning ] : DetectorGeometry::getRotAngle : Input layerID ("
483 << layerID << ") and input moduleID (" << moduleID
484 << ") are not included in the geometry!" << std::endl;
485 return 0.0;
486 }
487
488 return recoilModuleAngle_.at(combined);
489}
490
491BoundingBox DetectorGeometry::getBoundingBox(int layerID, int moduleID) const {
492 int combined = layerID * 10 + moduleID;
493
494 BoundingBox bbox;
495 if (recoilModulePos_.find(combined) == recoilModulePos_.end()) {
496 std::cerr
497 << "[ Warning ] : DetectorGeometry::getBoundingBox : Input layerID ("
498 << layerID << ") and input moduleID (" << moduleID
499 << ") are not included in the geometry!" << std::endl;
500 return bbox;
501 }
502
503 double xWidth = recoilStereoXWidth_;
504 double yWidth = recoilStereoStripLength_;
505 if (layerID > 8) {
506 xWidth = recoilMonoXWidth_;
507 yWidth = recoilMonoStripLength_;
508 }
509
510 bbox.emplace_back(recoilModulePos_.at(combined).at(0) - xWidth / 2.,
511 recoilModulePos_.at(combined).at(0) + xWidth / 2.);
512 bbox.emplace_back(recoilModulePos_.at(combined).at(1) - yWidth / 2.,
513 recoilModulePos_.at(combined).at(1) + yWidth / 2.);
514 bbox.emplace_back(
515 recoilModulePos_.at(combined).at(2) - recoilSensorThickness_ / 2.,
516 recoilModulePos_.at(combined).at(2) + recoilSensorThickness_ / 2.);
517
518 return bbox;
519}
520
522 const ldmx::SimTrackerHit &recoilHit) const {
523 int layerID = recoilHit.getLayerID();
524 int moduleID = recoilHit.getModuleID();
525 int combined = layerID * 10 + moduleID;
526
527 BoundingBox bbox;
528 if (recoilModulePos_.find(combined) == recoilModulePos_.end()) {
529 std::cerr
530 << "[ Warning ] : DetectorGeometry::getBoundingBox : Input layerID ("
531 << layerID << ") and input moduleID (" << moduleID
532 << ") are not included in the geometry!" << std::endl;
533 return bbox;
534 }
535
536 std::vector<float> hitPos = recoilHit.getPosition();
537
538 double xWidth = 1.0;
539 double yWidth = recoilStereoStripLength_;
540 if (layerID > 8) {
541 yWidth = recoilMonoStripLength_;
542 }
543
544 // we have to un-rotate the x-position of the hit, so we can rotate it later
545 // with the drawer
546 double rotAngle = this->getRotAngle(layerID, moduleID);
547 double xPos = hitPos.at(0) * cos(-rotAngle) - hitPos.at(1) * sin(-rotAngle);
548
549 bbox.emplace_back(xPos - xWidth / 2., xPos + xWidth / 2.);
550 bbox.emplace_back(recoilModulePos_.at(combined).at(1) - yWidth / 2.,
551 recoilModulePos_.at(combined).at(1) + yWidth / 2.);
552 bbox.emplace_back(
553 recoilModulePos_.at(combined).at(2) - recoilSensorThickness_ / 2.,
554 recoilModulePos_.at(combined).at(2) + recoilSensorThickness_ / 2.);
555
556 return bbox;
557}
558} // namespace eventdisplay
Header file for class DetectorGeometry.
std::vector< std::pair< double, double > > BoundingBox
@type BoundingBox
HexPrism getHexTower(int towerIndex) const
Get HexPrism for a tower.
std::map< ldmx::HcalID::HcalSection, int > hcalNLayers_
Number of layers in each section.
HexPrism getHexPrism(const ldmx::EcalID &id) const
Calculate bounding hexagonal prism for input EcalHit.
double getRotAngle(int layerID, int moduleID) const
Get Rotation Angle around z-axis for the input layerID and moduleID.
double ecalZeroLayer_
z-coordinate of plane for first ecal layer [mm]
double hcalThicknessScint_
Thickness of Scintillator Strip [mm].
DetectorGeometry()
Constructor This is where all the detector constants are set.
std::map< ldmx::HcalID::HcalSection, double > hcalLayerThickness_
Thickness of the layers in each seciton [mm].
std::map< ldmx::HcalID::HcalSection, double > hcalLengthScint_
Length of Scintillator Strip [mm].
std::map< int, std::vector< double > > recoilModulePos_
position of each module in recoil detector The key in this map is 10*layerID+moduleID
std::unique_ptr< ldmx::EcalHexReadout > ecalHexReader_
Helper class to calculate (x,y) coordinate from hexagons.
double ecalSiThickness_
Thickness of sensitive Si layers.
int hcalParityVertical_
an example layer number of a vertical layer
double hcalUncertaintyTimingPos_
Uncertainty in timing position along a bar/strip [mm].
double ecalDepth_
Total depth of ECAL (length in Z direction)
double hcalWidthScint_
Width of Scintillator Strip [mm].
BoundingBox getBoundingBox(const ldmx::HcalHit &hit) const
Calculate real space coordinates from detector location.
std::map< int, double > recoilModuleAngle_
angular tilt for each module in recoil detector The key in this map is 10*layerID+moduleID
std::map< ldmx::HcalID::HcalSection, int > hcalNStrips_
Number of strips per layer in each section.
std::map< ldmx::HcalID::HcalSection, double > hcalZeroLayer_
The plane of the zero'th layer of each section [mm].
std::map< ldmx::HcalID::HcalSection, double > hcalZeroStrip_
The plane of the zero'th strip of each section [mm].
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
void setParameters(std::map< std::string, std::any > parameters)
Set the mapping of parameter names to value.
Definition Parameters.h:41
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:23
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.