LDMX Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 > hcalNLayers_
 Number of layers in each section.
 
std::map< ldmx::HcalID::HcalSection, int > hcalNStrips_
 Number of strips per layer in each section.
 
std::map< ldmx::HcalID::HcalSection, double > hcalLengthScint_
 Length of Scintillator Strip [mm].
 
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].
 
std::map< ldmx::HcalID::HcalSection, double > hcalLayerThickness_
 Thickness of the layers in each seciton [mm].
 
int hcalParityVertical_
 an example layer number of a vertical layer
 
double hcalUncertaintyTimingPos_
 Uncertainty in timing position along a bar/strip [mm].
 
double hcalThicknessScint_
 Thickness of Scintillator Strip [mm].
 
double hcalWidthScint_
 Width of Scintillator Strip [mm].
 
double ecalSiThickness_
 Thickness of sensitive Si layers.
 
double ecalDepth_
 Total depth of ECAL (length in Z direction)
 
double ecalZeroLayer_
 z-coordinate of plane for first ecal layer [mm]
 
std::unique_ptr< ldmx::EcalHexReadout > ecalHexReader_
 Helper class to calculate (x,y) coordinate from hexagons.
 
double recoilStereoStripLength_
 
double recoilStereoXWidth_
 
double recoilStereoYWidth_
 
double recoilStereoSeparation_
 
double recoilStereoAngle_
 
double recoilMonoStripLength_
 
double recoilMonoXWidth_
 
double recoilMonoYWidth_
 
double recoilMonoSeparation_
 
double recoilSensorThickness_
 
std::map< int, std::vector< double > > recoilModulePos_
 position of each module in recoil detector The key in this map is 10*layerID+moduleID
 
std::map< int, double > recoilModuleAngle_
 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 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}
std::map< ldmx::HcalID::HcalSection, int > hcalNLayers_
Number of layers in each section.
double ecalZeroLayer_
z-coordinate of plane for first ecal layer [mm]
double hcalThicknessScint_
Thickness of Scintillator Strip [mm].
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].
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

References ecalDepth_, ecalHexReader_, ecalSiThickness_, ecalZeroLayer_, hcalLayerThickness_, hcalLengthScint_, hcalNLayers_, hcalNStrips_, hcalParityVertical_, hcalThicknessScint_, hcalUncertaintyTimingPos_, hcalWidthScint_, hcalZeroLayer_, hcalZeroStrip_, recoilModuleAngle_, recoilModulePos_, and framework::config::Parameters::setParameters().

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 250 of file DetectorGeometry.cxx.

250 {
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}
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(), hcalLayerThickness_, hcalThicknessScint_, hcalUncertaintyTimingPos_, hcalWidthScint_, hcalZeroLayer_, and hcalZeroStrip_.

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 521 of file DetectorGeometry.cxx.

522 {
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}
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 recoilModulePos_.

◆ 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 351 of file DetectorGeometry.cxx.

352 {
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}
BoundingBox getBoundingBox(const ldmx::HcalHit &hit) const
Calculate real space coordinates from detector location.
Stores reconstructed hit information from the HCAL.
Definition HcalHit.h:23

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 491 of file DetectorGeometry.cxx.

491 {
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}

References recoilModulePos_.

◆ 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 382 of file DetectorGeometry.cxx.

383 {
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}

References hcalLayerThickness_, hcalLengthScint_, hcalNLayers_, hcalNStrips_, hcalWidthScint_, hcalZeroLayer_, and hcalZeroStrip_.

◆ 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 450 of file DetectorGeometry.cxx.

450 {
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}

References ecalHexReader_, and ecalSiThickness_.

◆ getHexTower()

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

Get HexPrism for a tower.

Parameters
towerIndexint index of hexagonal tower
Returns
HexPrism

Definition at line 459 of file DetectorGeometry.cxx.

459 {
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}

References ecalDepth_, ecalHexReader_, and ecalZeroLayer_.

◆ 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 478 of file DetectorGeometry.cxx.

478 {
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}

References recoilModuleAngle_.

Referenced by getBoundingBox().

Member Data Documentation

◆ ecalDepth_

double eventdisplay::DetectorGeometry::ecalDepth_
private

Total depth of ECAL (length in Z direction)

Definition at line 186 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getHexTower().

◆ ecalHexReader_

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

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

Definition at line 192 of file DetectorGeometry.h.

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

◆ ecalSiThickness_

double eventdisplay::DetectorGeometry::ecalSiThickness_
private

Thickness of sensitive Si layers.

Definition at line 183 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getHexPrism().

◆ ecalZeroLayer_

double eventdisplay::DetectorGeometry::ecalZeroLayer_
private

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

Definition at line 189 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getHexTower().

◆ hcalLayerThickness_

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

Thickness of the layers in each seciton [mm].

Definition at line 165 of file DetectorGeometry.h.

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

◆ hcalLengthScint_

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

Length of Scintillator Strip [mm].

Definition at line 156 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getBoundingBox().

◆ hcalNLayers_

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

Number of layers in each section.

Definition at line 150 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getBoundingBox().

◆ hcalNStrips_

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

Number of strips per layer in each section.

Definition at line 153 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getBoundingBox().

◆ hcalParityVertical_

int eventdisplay::DetectorGeometry::hcalParityVertical_
private

an example layer number of a vertical layer

Definition at line 168 of file DetectorGeometry.h.

Referenced by DetectorGeometry().

◆ hcalThicknessScint_

double eventdisplay::DetectorGeometry::hcalThicknessScint_
private

Thickness of Scintillator Strip [mm].

Definition at line 174 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getBoundingBox().

◆ hcalUncertaintyTimingPos_

double eventdisplay::DetectorGeometry::hcalUncertaintyTimingPos_
private

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

Definition at line 171 of file DetectorGeometry.h.

Referenced by DetectorGeometry(), and getBoundingBox().

◆ hcalWidthScint_

double eventdisplay::DetectorGeometry::hcalWidthScint_
private

Width of Scintillator Strip [mm].

Definition at line 177 of file DetectorGeometry.h.

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

◆ hcalZeroLayer_

std::map<ldmx::HcalID::HcalSection, double> eventdisplay::DetectorGeometry::hcalZeroLayer_
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().

◆ hcalZeroStrip_

std::map<ldmx::HcalID::HcalSection, double> eventdisplay::DetectorGeometry::hcalZeroStrip_
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().

◆ recoilModuleAngle_

std::map<int, double> eventdisplay::DetectorGeometry::recoilModuleAngle_
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().

◆ recoilModulePos_

std::map<int, std::vector<double> > eventdisplay::DetectorGeometry::recoilModulePos_
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().

◆ recoilMonoSeparation_

double eventdisplay::DetectorGeometry::recoilMonoSeparation_
private

Definition at line 213 of file DetectorGeometry.h.

◆ recoilMonoStripLength_

double eventdisplay::DetectorGeometry::recoilMonoStripLength_
private

Definition at line 207 of file DetectorGeometry.h.

◆ recoilMonoXWidth_

double eventdisplay::DetectorGeometry::recoilMonoXWidth_
private

Definition at line 209 of file DetectorGeometry.h.

◆ recoilMonoYWidth_

double eventdisplay::DetectorGeometry::recoilMonoYWidth_
private

Definition at line 211 of file DetectorGeometry.h.

◆ recoilSensorThickness_

double eventdisplay::DetectorGeometry::recoilSensorThickness_
private

Definition at line 215 of file DetectorGeometry.h.

◆ recoilStereoAngle_

double eventdisplay::DetectorGeometry::recoilStereoAngle_
private

Definition at line 205 of file DetectorGeometry.h.

◆ recoilStereoSeparation_

double eventdisplay::DetectorGeometry::recoilStereoSeparation_
private

Definition at line 203 of file DetectorGeometry.h.

◆ recoilStereoStripLength_

double eventdisplay::DetectorGeometry::recoilStereoStripLength_
private

Definition at line 197 of file DetectorGeometry.h.

◆ recoilStereoXWidth_

double eventdisplay::DetectorGeometry::recoilStereoXWidth_
private

Definition at line 199 of file DetectorGeometry.h.

◆ recoilStereoYWidth_

double eventdisplay::DetectorGeometry::recoilStereoYWidth_
private

Definition at line 201 of file DetectorGeometry.h.


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