LDMX Software
ldmx::HcalGeometry Class Reference

Implementation of HCal strip readout. More...

#include <HcalGeometry.h>

Public Types

enum class  ScintillatorOrientation { horizontal = 0 , vertical = 1 , depth = 2 }
 Encodes the orientation of a bar. More...
 

Public Member Functions

 ~HcalGeometry ()=default
 Class destructor.
 
ScintillatorOrientation getScintillatorOrientation (const ldmx::HcalID id) const
 
ROOT::Math::XYZVector getStripCenterPosition (ldmx::HcalID id) const
 Get a strip center position from a combined hcal ID.
 
std::map< ldmx::HcalID, ROOT::Math::XYZVector > getStripPositionMap () const
 Get the strip position map.
 
bool backLayerIsHorizontal (const int layer) const
 Check whether a given layer corresponds to a horizontal (scintillator length along the x-axis) or vertical layer in the back HCal.
 
double getHalfTotalWidth (int isection, int layer=1) const
 Get the half total width of a layer for a given section(strip) for back(side) Hcal.
 
double getScintillatorLength (ldmx::HcalID id) const
 Get the length of a scintillator bar.
 
double getScintillatorWidth () const
 Get the scitillator width.
 
double getScintillatorThickness () const
 Get the scitillator thickness.
 
int getNumSections () const
 Get the number of sections.
 
int getNumLayers (int isection) const
 Get the number of layers for that section.
 
int getNumStrips (int isection, int layer=1) const
 Get the number of strips per layer for that section and layer.
 
int getZeroStrip (int isection, int layer=1) const
 Get the location of the zeroStrip in a given section and layer.
 
double getEcalDx () const
 Get the length of the Ecal in (x) for the side Hcal.
 
double getEcalDy () const
 Get the length of the Ecal in (y) for the side Hcal.
 
bool hasSide3DReadout () const
 Does the Side Hcal have 3D readout?
 
bool isPrototype () const
 
std::vector< double > rotateGlobalToLocalBarPosition (const std::vector< double > &globalPosition, const ldmx::HcalID &id) const
 Coordinates that are given by Geant4 are typically global.
 
- Public Member Functions inherited from framework::ConditionsObject
 ConditionsObject (const std::string &name)
 Class constructor.
 
virtual ~ConditionsObject ()
 Destructor.
 
std::string getName () const
 Get the name of this object.
 

Static Public Attributes

static constexpr const char * CONDITIONS_OBJECT_NAME {"hcal_geometry"}
 Conditions object: The name of the python configuration calling this class (Hcal/python/HcalGeometry.py) needs to match the CONDITIONS_OBJECT_NAME exactly.
 

Private Member Functions

 HcalGeometry (const framework::config::Parameters &ps)
 Class constructor, for use only by the provider.
 
void buildStripPositionMap ()
 Map builder of HcalID and position.
 
void printPositionMap (int section) const
 Debugging utility, prints out the HcalID and corresponding value of all entries in the strip_position_map_ for a given section.
 
void printPositionMap () const
 Debugging utility, prints out the HcalID and corresponding value of all entries in the strip_position_map_.
 

Private Attributes

int verbose_ {0}
 Parameters that apply to all types of geometries Verbosity, not configurable but helpful if developing.
 
double scint_thickness_
 Thickness of scintillator.
 
double scint_width_
 Width of Scintillator Strip [mm].
 
std::vector< double > zero_layer_
 Front of HCal relative to world geometry for each section [mm].
 
std::vector< double > layer_thickness_
 Thickness of the layers in each section [mm].
 
std::vector< int > num_layers_
 Number of layers in each section.
 
int num_sections_
 Number of sections.
 
double ecal_dx_
 Lenght of the Ecal (in x and y)
 
double ecal_dy_
 
double y_offset_
 
int back_horizontal_parity_ {}
 
int side_3d_readout_ {}
 
std::vector< std::vector< int > > num_strips_
 Number of strips per layer in each section and each layer.
 
std::vector< std::vector< double > > zero_strip_
 The plane of the zero'th strip of each section [mm].
 
std::vector< std::vector< double > > half_total_width_
 Half Total Width of Strips [mm].
 
std::vector< std::vector< double > > scint_length_
 Length of strips [mm].
 
bool is_prototype_ {}
 
std::map< ldmx::HcalID, ROOT::Math::XYZVector > strip_position_map_
 Map of the HcalID position of strip centers relative to world geometry.
 

Friends

class hcal::HcalGeometryProvider
 

Detailed Description

Implementation of HCal strip readout.

Definition at line 33 of file HcalGeometry.h.

Member Enumeration Documentation

◆ ScintillatorOrientation

Encodes the orientation of a bar.

horizontal : The length of the bar is along the x-axis vertical : The length of the bar is along the y-axis depth : The length of the bar is along the z-axis

Definition at line 49 of file HcalGeometry.h.

49 {
50 horizontal = 0,
51 vertical = 1,
52 depth = 2
53 };

Constructor & Destructor Documentation

◆ ~HcalGeometry()

ldmx::HcalGeometry::~HcalGeometry ( )
default

Class destructor.

Does nothing because the stl containers clean up automatically.

◆ HcalGeometry()

ldmx::HcalGeometry::HcalGeometry ( const framework::config::Parameters & ps)
private

Class constructor, for use only by the provider.

Parameters
psParameters to configure the HcalGeometry

Definition at line 12 of file HcalGeometry.cxx.

14 scint_thickness_ = ps.get<double>("scint_thickness");
15 scint_width_ = ps.get<double>("scint_width");
16 zero_layer_ = ps.get<std::vector<double>>("zero_layer");
17 layer_thickness_ = ps.get<std::vector<double>>("layer_thickness");
18 num_layers_ = ps.get<std::vector<int>>("num_layers");
19 num_sections_ = ps.get<int>("num_sections");
20 ecal_dx_ = ps.get<double>("ecal_dx");
21 ecal_dy_ = ps.get<double>("ecal_dy");
22 verbose_ = ps.get<int>("verbose");
23 back_horizontal_parity_ = ps.get<int>("back_horizontal_parity");
24 side_3d_readout_ = ps.get<int>("side_3d_readout");
25 y_offset_ = ps.get<double>("y_offset");
26
27 auto detectors_valid = ps.get<std::vector<std::string>>("detectors_valid");
28 // If one of the strings in detectors_valid is "ldmx-hcal-prototype", we
29 // will use prototype geometry initialization
30 is_prototype_ = std::find_if(detectors_valid.cbegin(), detectors_valid.cend(),
31 [](const auto detector) {
32 return detector.find("ldmx-hcal-prototype") !=
33 std::string::npos;
34 }) != detectors_valid.cend();
35
36 num_strips_ = ps.get<std::vector<std::vector<int>>>("num_strips");
38 ps.get<std::vector<std::vector<double>>>("half_total_width");
39 zero_strip_ = ps.get<std::vector<std::vector<double>>>("zero_strip");
40 scint_length_ = ps.get<std::vector<std::vector<double>>>("scint_length");
41
43
44 if (verbose_ > 0) {
46 }
47}
Base class for all conditions objects, very simple.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:75
std::vector< double > layer_thickness_
Thickness of the layers in each section [mm].
std::vector< double > zero_layer_
Front of HCal relative to world geometry for each section [mm].
double ecal_dx_
Lenght of the Ecal (in x and y)
void buildStripPositionMap()
Map builder of HcalID and position.
std::vector< std::vector< double > > zero_strip_
The plane of the zero'th strip of each section [mm].
static constexpr const char * CONDITIONS_OBJECT_NAME
Conditions object: The name of the python configuration calling this class (Hcal/python/HcalGeometry....
void printPositionMap() const
Debugging utility, prints out the HcalID and corresponding value of all entries in the strip_position...
std::vector< std::vector< double > > scint_length_
Length of strips [mm].
int verbose_
Parameters that apply to all types of geometries Verbosity, not configurable but helpful if developin...
std::vector< std::vector< double > > half_total_width_
Half Total Width of Strips [mm].
double scint_width_
Width of Scintillator Strip [mm].
double scint_thickness_
Thickness of scintillator.
std::vector< int > num_layers_
Number of layers in each section.
std::vector< std::vector< int > > num_strips_
Number of strips per layer in each section and each layer.
int num_sections_
Number of sections.

References buildStripPositionMap(), ecal_dx_, framework::config::Parameters::get(), half_total_width_, layer_thickness_, num_layers_, num_sections_, num_strips_, printPositionMap(), scint_length_, scint_thickness_, scint_width_, verbose_, zero_layer_, and zero_strip_.

Member Function Documentation

◆ backLayerIsHorizontal()

bool ldmx::HcalGeometry::backLayerIsHorizontal ( const int layer) const
inline

Check whether a given layer corresponds to a horizontal (scintillator length along the x-axis) or vertical layer in the back HCal.

See the back_horizontal_parity_ member for details.

Definition at line 89 of file HcalGeometry.h.

89 {
90 return layer % 2 == back_horizontal_parity_;
91 }

◆ buildStripPositionMap()

void ldmx::HcalGeometry::buildStripPositionMap ( )
private

Map builder of HcalID and position.

To build the map we loop over the number of Hcal sections, layers and strips. The Hcal sections range from 0 to 4. (We hard-code the number of sections as seen in HcalID) The Hcal layers range from 1 to NumLayers_[section]. The Hcal strips range from 0 to NumStrips_[section].

Odd layers have horizontal strips. Even layers have vertical strips.

For back Hcal:

  • layers in z
  • strips occupy thickness of scintillator in z (e.g. 20mm)
  • strips orientation is in x(y) depending on back_horizontal parity

Now compute, y(x) position for horizontal(vertical) layers, relative to the center of detector. Strips enumeration starts from -y(-x) stripcenter will be large for +y(+x) and the half width of the strip needs to be subtracted The halfwidth of the scintillator is given by half_total_width_. The x(y) position is set to the center of the strip (0).

For side Hcal before 3D readout

  • layers in y(x)
  • all layers have strips in x(y) for top-bottom (left-right) sections
  • all layers have strips occupying width of scintillator in z (e.g. 50mm)

Definition at line 170 of file HcalGeometry.cxx.

170 {
171 // We hard-code the number of sections as seen in HcalID
172 for (unsigned int section = 0; section < num_sections_; section++) {
173 for (unsigned int layer = 1; layer <= num_layers_[section]; layer++) {
174 for (unsigned int strip = 0; strip < getNumStrips(section, layer);
175 strip++) {
176 // initialize values
177 double x{-99999}, y{-99999}, z{-99999};
178
179 // get hcal section
180 ldmx::HcalID::HcalSection hcalsection =
182
183 const ldmx::HcalID id{section, layer, strip};
184 const auto orientation{getScintillatorOrientation(id)};
185 // the center of a layer: (layer-1) * (layer_thickness) +
186 // scint_thickness/2
187 double layercenter =
188 (layer - 1) * layer_thickness_.at(section) + 0.5 * scint_thickness_;
189
190 // the center of a strip: (strip + 0.5) * (strip_dx)
191 double stripcenter = (strip + 0.5) * scint_width_;
192
193 if (hcalsection == ldmx::HcalID::HcalSection::BACK) {
201 // z position: zero-layer(z) + layer_z + scint_thickness / 2
202 z = zero_layer_.at(section) + layercenter;
203
212 if (orientation == ScintillatorOrientation::horizontal) {
213 y = stripcenter - getZeroStrip(section, layer);
214 x = 0;
215 } else {
216 x = stripcenter - getZeroStrip(section, layer);
217 y = 0;
218 }
219 } else {
220 if (side_3d_readout_) {
221 /*
222 *
223 * For 3D readout:
224 * - odd layers have strips in z
225 * - even layers have strips in x(y) for top-bottom (left-right)
226 * sections
227 * - odd layers have strips occupying width of scintillator in x(y)
228 * - even layers have strips occupying width of scintillator in z
229 *
230 */
231 switch (hcalsection) {
232 case ldmx::HcalID::HcalSection::BACK:
233 // Handled earlier in the code!
234 case ldmx::HcalID::HcalSection::LEFT:
235 case ldmx::HcalID::HcalSection::RIGHT:
236 if (orientation == ScintillatorOrientation::vertical) {
237 x = zero_layer_[section] + 0.5 * scint_thickness_ +
238 (layer - 1) * layer_thickness_[section];
239 y = ecal_dy_ -
240 (getScintillatorLength({id.section(), 2, id.strip()}) -
242 2;
243 z = getZeroStrip(section, layer) +
244 (strip + 0.5) * getScintillatorWidth();
245 } else if (orientation == ScintillatorOrientation::depth) {
246 x = zero_layer_[section] + 0.5 * scint_thickness_ +
247 layer_thickness_[section] * (layer - 1);
248 y = -ecal_dy_ / 2 + (strip + 0.5) * getScintillatorWidth();
249 z = getZeroStrip(section, layer + 1) +
250 getScintillatorLength(id) / 2;
251 }
252 if (section == ldmx::HcalID::HcalSection::LEFT) {
253 y *= -1;
254 x *= -1;
255 }
256 break;
257
258 case ldmx::HcalID::HcalSection::BOTTOM:
259 case ldmx::HcalID::HcalSection::TOP:
260 if (orientation == ScintillatorOrientation::horizontal) {
261 //
262 // Second half of the expression is the difference between the
263 // longest strips (first module) and the current module.
264 //
265 // 22 mm extra for space for 1 absorber and one air box
266 x = -ecal_dx_ / 2 - 2 - 20 +
267 (getScintillatorLength({id.section(), 2, id.strip()}) -
269 2;
270 y = zero_layer_[section] + 0.5 * scint_thickness_ +
271 (layer - 1) * layer_thickness_[section];
272 z = getZeroStrip(section, layer) +
273 (strip + 0.5) * getScintillatorWidth();
274 }
275 if (orientation == ScintillatorOrientation::depth) {
276 x = (ecal_dx_ / 2) - (strip + 0.5) * getScintillatorWidth();
277 y = zero_layer_[section] + 0.5 * scint_thickness_ +
278 layer_thickness_[section] * (layer - 1);
279 z = getZeroStrip(section, layer + 1) +
280 getScintillatorLength(id) / 2;
281 }
282 if (section == ldmx::HcalID::HcalSection::BOTTOM) {
283 y *= -1;
284 x *= -1;
285 }
286 break;
287 }
288
289 } else {
299 // z position: zero-strip(z) + strip_center(z)
300 z = getZeroStrip(section, layer) + stripcenter;
301 if (hcalsection == ldmx::HcalID::HcalSection::TOP or
302 hcalsection == ldmx::HcalID::HcalSection::BOTTOM) {
303 y = zero_layer_.at(section) + layercenter;
304 x = getHalfTotalWidth(section, layer);
305 if (hcalsection == ldmx::HcalID::HcalSection::BOTTOM) {
306 y *= -1;
307 x *= -1;
308 }
309
310 } else {
311 x = zero_layer_.at(section) + layercenter;
312 y = getHalfTotalWidth(section, layer);
313 if (hcalsection == ldmx::HcalID::HcalSection::RIGHT) {
314 x *= -1;
315 y *= -1;
316 }
317 }
318 }
319 }
320
321 y += y_offset_;
322 ROOT::Math::XYZVector pos;
323 pos.SetXYZ(x, y, z);
324 strip_position_map_[ldmx::HcalID(section, layer, strip)] = pos;
325 } // loop over strips
326 } // loop over layers
327 } // loop over sections
328} // strip position map
std::map< ldmx::HcalID, ROOT::Math::XYZVector > strip_position_map_
Map of the HcalID position of strip centers relative to world geometry.
int getZeroStrip(int isection, int layer=1) const
Get the location of the zeroStrip in a given section and layer.
double getScintillatorLength(ldmx::HcalID id) const
Get the length of a scintillator bar.
double getScintillatorWidth() const
Get the scitillator width.
int getNumStrips(int isection, int layer=1) const
Get the number of strips per layer for that section and layer.
double getHalfTotalWidth(int isection, int layer=1) const
Get the half total width of a layer for a given section(strip) for back(side) Hcal.
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 ecal_dx_, getHalfTotalWidth(), getNumStrips(), getScintillatorLength(), getScintillatorWidth(), getZeroStrip(), layer_thickness_, num_layers_, num_sections_, scint_thickness_, scint_width_, strip_position_map_, and zero_layer_.

Referenced by HcalGeometry().

◆ getEcalDx()

double ldmx::HcalGeometry::getEcalDx ( ) const
inline

Get the length of the Ecal in (x) for the side Hcal.

Definition at line 152 of file HcalGeometry.h.

152{ return ecal_dx_; }

References ecal_dx_.

◆ getEcalDy()

double ldmx::HcalGeometry::getEcalDy ( ) const
inline

Get the length of the Ecal in (y) for the side Hcal.

Definition at line 157 of file HcalGeometry.h.

157{ return ecal_dy_; }

◆ getHalfTotalWidth()

double ldmx::HcalGeometry::getHalfTotalWidth ( int isection,
int layer = 1 ) const
inline

Get the half total width of a layer for a given section(strip) for back(side) Hcal.

Parameters
section
layer
Returns
half total width [mm]

Definition at line 99 of file HcalGeometry.h.

99 {
100 // Layer numbering starts at 1, but a vector is zero-indexed
101 auto layer_index = layer - 1;
102 return half_total_width_.at(isection).at(layer_index);
103 }

References half_total_width_.

Referenced by buildStripPositionMap().

◆ getNumLayers()

int ldmx::HcalGeometry::getNumLayers ( int isection) const
inline

Get the number of layers for that section.

Definition at line 131 of file HcalGeometry.h.

131{ return num_layers_.at(isection); }

References num_layers_.

◆ getNumSections()

int ldmx::HcalGeometry::getNumSections ( ) const
inline

Get the number of sections.

Definition at line 126 of file HcalGeometry.h.

126{ return num_sections_; }

References num_sections_.

◆ getNumStrips()

int ldmx::HcalGeometry::getNumStrips ( int isection,
int layer = 1 ) const
inline

Get the number of strips per layer for that section and layer.

Definition at line 136 of file HcalGeometry.h.

136 {
137 auto layer_index = layer - 1;
138 return num_strips_.at(isection).at(layer_index);
139 }

References num_strips_.

Referenced by buildStripPositionMap(), and printPositionMap().

◆ getScintillatorLength()

double ldmx::HcalGeometry::getScintillatorLength ( ldmx::HcalID id) const
inline

Get the length of a scintillator bar.

Parameters
idThe HcalID of the bar
Returns
The length of the bar with ID id [mm]

Definition at line 110 of file HcalGeometry.h.

110 {
111 return scint_length_.at(id.section()).at(id.layer() - 1);
112 }

References scint_length_.

Referenced by buildStripPositionMap().

◆ getScintillatorOrientation()

HcalGeometry::ScintillatorOrientation ldmx::HcalGeometry::getScintillatorOrientation ( const ldmx::HcalID id) const

Definition at line 99 of file HcalGeometry.cxx.

100 {
101 if (hasSide3DReadout()) {
102 // v14 or later detector
103 switch (id.section()) {
104 case ldmx::HcalID::HcalSection::TOP:
105 case ldmx::HcalID::HcalSection::BOTTOM:
106 // Odd layers are in z/depth direction, even are in the x/horizontal
107 // direction
108 return id.layer() % 2 == 0 ? ScintillatorOrientation::horizontal
109 : ScintillatorOrientation::depth;
110
111 case ldmx::HcalID::HcalSection::LEFT:
112 case ldmx::HcalID::HcalSection::RIGHT:
113 // Odd layers are in the z/depth direction, even are in the y/vertical
114 // direction
115 return id.layer() % 2 == 0 ? ScintillatorOrientation::vertical
116 : ScintillatorOrientation::depth;
117 case ldmx::HcalID::HcalSection::BACK:
118 // Configurable
119 return id.layer() % 2 == back_horizontal_parity_
120 ? ScintillatorOrientation::horizontal
121 : ScintillatorOrientation::vertical;
122 } // V14 or later detector
123 }
124 if (isPrototype()) {
125 // The prototype only has the back section. However, the orientation
126 // depends on the configuration so we delegate to the
127 // back_horizontal_parity parameter
128 return id.layer() % 2 == back_horizontal_parity_
129 ? ScintillatorOrientation::horizontal
130 : ScintillatorOrientation::vertical;
131 } // Prototype detector
132 // v13/v12
133 switch (id.section()) {
134 // For the v13 side hcal, the bars in each section have the same
135 // orientation
136 case ldmx::HcalID::HcalSection::TOP:
137 case ldmx::HcalID::HcalSection::BOTTOM:
138 return ScintillatorOrientation::horizontal;
139 case ldmx::HcalID::HcalSection::LEFT:
140 case ldmx::HcalID::HcalSection::RIGHT:
141 return ScintillatorOrientation::vertical;
142 case ldmx::HcalID::HcalSection::BACK:
143 // Configurable
144 return id.layer() % 2 == back_horizontal_parity_
145 ? ScintillatorOrientation::horizontal
146 : ScintillatorOrientation::vertical;
147 } // v13/v12 detector
148 // Can only reach this part if we somehow didn't match any of the options
149 // above. This could happen if someone introduces a new geometry but doesn't
150 // patch this part.
151 EXCEPTION_RAISE("InvalidRotation",
152 "Attempted to rotate into an invalid "
153 "orientation for a scintillator bar!");
154}
bool hasSide3DReadout() const
Does the Side Hcal have 3D readout?

◆ getScintillatorThickness()

double ldmx::HcalGeometry::getScintillatorThickness ( ) const
inline

Get the scitillator thickness.

Definition at line 121 of file HcalGeometry.h.

121{ return scint_thickness_; }

References scint_thickness_.

◆ getScintillatorWidth()

double ldmx::HcalGeometry::getScintillatorWidth ( ) const
inline

Get the scitillator width.

Definition at line 116 of file HcalGeometry.h.

116{ return scint_width_; }

References scint_width_.

Referenced by buildStripPositionMap().

◆ getStripCenterPosition()

ROOT::Math::XYZVector ldmx::HcalGeometry::getStripCenterPosition ( ldmx::HcalID id) const
inline

Get a strip center position from a combined hcal ID.

Exceptions
std::out_of_rangeif HcalID is not on map.
Parameters
HcalID
Returns
A ROOT::Math::XYZVector with the X, Y and Z position of the center of the bar.

Definition at line 74 of file HcalGeometry.h.

74 {
75 return strip_position_map_.at(id);
76 }

References strip_position_map_.

Referenced by printPositionMap(), and hcal::HcalClusterProducer::produce().

◆ getStripPositionMap()

std::map< ldmx::HcalID, ROOT::Math::XYZVector > ldmx::HcalGeometry::getStripPositionMap ( ) const
inline

Get the strip position map.

Definition at line 81 of file HcalGeometry.h.

81 {
83 }

References strip_position_map_.

◆ getZeroStrip()

int ldmx::HcalGeometry::getZeroStrip ( int isection,
int layer = 1 ) const
inline

Get the location of the zeroStrip in a given section and layer.

Definition at line 144 of file HcalGeometry.h.

144 {
145 auto layer_index = layer - 1;
146 return zero_strip_.at(isection).at(layer_index);
147 }

References zero_strip_.

Referenced by buildStripPositionMap().

◆ hasSide3DReadout()

bool ldmx::HcalGeometry::hasSide3DReadout ( ) const
inline

Does the Side Hcal have 3D readout?

In other words, does the side hcal layers alter in scintillator direction (z vs x/y).

Definition at line 165 of file HcalGeometry.h.

165{ return side_3d_readout_; }

◆ isPrototype()

bool ldmx::HcalGeometry::isPrototype ( ) const
inline

Definition at line 171 of file HcalGeometry.h.

171{ return is_prototype_; }

◆ printPositionMap() [1/2]

void ldmx::HcalGeometry::printPositionMap ( ) const
inlineprivate

Debugging utility, prints out the HcalID and corresponding value of all entries in the strip_position_map_.

For printing only one of the sections, see the overloaded version of this function taking a section parameter.

Definition at line 231 of file HcalGeometry.h.

231 {
232 for (int section = 0; section < num_sections_; ++section) {
233 printPositionMap(section);
234 }
235 }

References num_sections_, and printPositionMap().

Referenced by HcalGeometry(), and printPositionMap().

◆ printPositionMap() [2/2]

void ldmx::HcalGeometry::printPositionMap ( int section) const
private

Debugging utility, prints out the HcalID and corresponding value of all entries in the strip_position_map_ for a given section.

Parameters
sectionThe section number to print, see HcalID for details.

Definition at line 155 of file HcalGeometry.cxx.

155 {
156 // Note that layer numbering starts at 1 rather than 0
157 for (int layer = 1; layer <= num_layers_[section]; ++layer) {
158 for (int strip = 0; strip < getNumStrips(section, layer); ++strip) {
159 HcalID id(section, layer, strip);
160 auto center_position = getStripCenterPosition(id);
161 auto x = center_position.X();
162 auto y = center_position.Y();
163 auto z = center_position.Z();
164 std::cout << id << ": Center position: (" << x << ", " << y << ", " << z
165 << ")\n";
166 }
167 }
168}
ROOT::Math::XYZVector getStripCenterPosition(ldmx::HcalID id) const
Get a strip center position from a combined hcal ID.

References getNumStrips(), getStripCenterPosition(), and num_layers_.

◆ rotateGlobalToLocalBarPosition()

std::vector< double > ldmx::HcalGeometry::rotateGlobalToLocalBarPosition ( const std::vector< double > & globalPosition,
const ldmx::HcalID & id ) const

Coordinates that are given by Geant4 are typically global.

These can be transformed into corresponding local coordinates of a volume with a TopTransform. However, a TopTransform translates to the local bar but does not do the rotation (this is because we don't do a rotation when placing the bars in the GDML). This is used primarily for recording pre and post step positions in local coordinates of the volume in HcalSD.

the logic below does the rotation to the local coordiates where x : short transverse side of bar y : long transverse side of bar z : along length of bar

Note
This logic only applies to the v14 and prototype detector; however, support for v12 is not broken because no studies using these pre/post step positions have been (or should be) done with the v12 detector. /
: The native position type in Geant4 is typically a G4ThreeVector, which is a typedef for a CLHEP::Hep3Vector. However, DetDescr currently does not have a dependency on Geant4/CLHEP so we are taking the position as a vector of floats (which is what is used by SimCalorimeterHit)

Definition at line 48 of file HcalGeometry.cxx.

49 {
50 const auto orientation{getScintillatorOrientation(id)};
51 switch (id.section()) {
52 case ldmx::HcalID::HcalSection::BACK:
53 switch (orientation) {
54 case ScintillatorOrientation::horizontal:
55 return {globalPosition[2], globalPosition[1], globalPosition[0]};
56 case ScintillatorOrientation::vertical:
57 return {globalPosition[2], globalPosition[0], globalPosition[1]};
58 default: // Should not be possible with current geometries
59 EXCEPTION_RAISE("InvalidRotation",
60 "Attempted to rotate into an invalid "
61 "orientation for a scintillator bar!");
62 }
63 case ldmx::HcalID::HcalSection::TOP:
64 [[fallthrough]];
65 case ldmx::HcalID::HcalSection::BOTTOM:
66 switch (orientation) {
67 case ScintillatorOrientation::horizontal:
68 return {globalPosition[1], globalPosition[2], globalPosition[0]};
69 case ScintillatorOrientation::depth:
70 return {globalPosition[1], globalPosition[0], globalPosition[2]};
71 default: // Should not be possible with current geometries
72 EXCEPTION_RAISE("InvalidRotation",
73 "Attempted to rotate into an invalid "
74 "orientation for a scintillator bar!");
75 }
76 case ldmx::HcalID::HcalSection::LEFT:
77 [[fallthrough]];
78 case ldmx::HcalID::HcalSection::RIGHT:
79 switch (orientation) {
80 case ScintillatorOrientation::vertical:
81 return {globalPosition[0], globalPosition[2], globalPosition[1]};
82 case ScintillatorOrientation::depth:
83 return globalPosition;
84 default: // Should not be possible with current geometries
85 EXCEPTION_RAISE("InvalidRotation",
86 "Attempted to rotate into an invalid "
87 "orientation for a scintillator bar!");
88 }
89 default:
90 // Can only reach this part if we somehow didn't match any of the options
91 // above. This could happen if someone introduces a new geometry but
92 // doesn't patch this part.
93 EXCEPTION_RAISE("InvalidRotation",
94 "Attempted to rotate into an invalid "
95 "orientation for a scintillator bar!");
96 }
97}

Friends And Related Symbol Documentation

◆ hcal::HcalGeometryProvider

friend class hcal::HcalGeometryProvider
friend

Definition at line 205 of file HcalGeometry.h.

Member Data Documentation

◆ back_horizontal_parity_

int ldmx::HcalGeometry::back_horizontal_parity_ {}
private

Definition at line 270 of file HcalGeometry.h.

270{};

◆ CONDITIONS_OBJECT_NAME

const char* ldmx::HcalGeometry::CONDITIONS_OBJECT_NAME {"hcal_geometry"}
staticconstexpr

Conditions object: The name of the python configuration calling this class (Hcal/python/HcalGeometry.py) needs to match the CONDITIONS_OBJECT_NAME exactly.

Definition at line 41 of file HcalGeometry.h.

41{"hcal_geometry"};

Referenced by simcore::HcalSD::decodeCopyNumber(), hcal::HcalTriggerGeometryProvider::getCondition(), simcore::HcalSD::ProcessHits(), hcal::HcalClusterProducer::produce(), hcal::HcalDigiProducer::produce(), hcal::HcalDoubleEndRecProducer::produce(), hcal::HcalRecProducer::produce(), hcal::HcalSimpleDigiAndRecProducer::produce(), and hcal::HcalSingleEndRecProducer::produce().

◆ ecal_dx_

double ldmx::HcalGeometry::ecal_dx_
private

Lenght of the Ecal (in x and y)

Definition at line 261 of file HcalGeometry.h.

Referenced by buildStripPositionMap(), getEcalDx(), and HcalGeometry().

◆ ecal_dy_

double ldmx::HcalGeometry::ecal_dy_
private

Definition at line 262 of file HcalGeometry.h.

◆ half_total_width_

std::vector<std::vector<double> > ldmx::HcalGeometry::half_total_width_
private

Half Total Width of Strips [mm].

Definition at line 280 of file HcalGeometry.h.

Referenced by getHalfTotalWidth(), and HcalGeometry().

◆ is_prototype_

bool ldmx::HcalGeometry::is_prototype_ {}
private

Definition at line 284 of file HcalGeometry.h.

284{};

◆ layer_thickness_

std::vector<double> ldmx::HcalGeometry::layer_thickness_
private

Thickness of the layers in each section [mm].

Definition at line 252 of file HcalGeometry.h.

Referenced by buildStripPositionMap(), and HcalGeometry().

◆ num_layers_

std::vector<int> ldmx::HcalGeometry::num_layers_
private

Number of layers in each section.

Definition at line 255 of file HcalGeometry.h.

Referenced by buildStripPositionMap(), getNumLayers(), HcalGeometry(), and printPositionMap().

◆ num_sections_

int ldmx::HcalGeometry::num_sections_
private

Number of sections.

Definition at line 258 of file HcalGeometry.h.

Referenced by buildStripPositionMap(), getNumSections(), HcalGeometry(), and printPositionMap().

◆ num_strips_

std::vector<std::vector<int> > ldmx::HcalGeometry::num_strips_
private

Number of strips per layer in each section and each layer.

Definition at line 276 of file HcalGeometry.h.

Referenced by getNumStrips(), and HcalGeometry().

◆ scint_length_

std::vector<std::vector<double> > ldmx::HcalGeometry::scint_length_
private

Length of strips [mm].

Definition at line 282 of file HcalGeometry.h.

Referenced by getScintillatorLength(), and HcalGeometry().

◆ scint_thickness_

double ldmx::HcalGeometry::scint_thickness_
private

Thickness of scintillator.

Definition at line 243 of file HcalGeometry.h.

Referenced by buildStripPositionMap(), getScintillatorThickness(), and HcalGeometry().

◆ scint_width_

double ldmx::HcalGeometry::scint_width_
private

Width of Scintillator Strip [mm].

Definition at line 246 of file HcalGeometry.h.

Referenced by buildStripPositionMap(), getScintillatorWidth(), and HcalGeometry().

◆ side_3d_readout_

int ldmx::HcalGeometry::side_3d_readout_ {}
private

Definition at line 273 of file HcalGeometry.h.

273{};

◆ strip_position_map_

std::map<ldmx::HcalID, ROOT::Math::XYZVector> ldmx::HcalGeometry::strip_position_map_
private

Map of the HcalID position of strip centers relative to world geometry.

The map is not configurable and is calculated by buildStripPositionMap().

Definition at line 290 of file HcalGeometry.h.

Referenced by buildStripPositionMap(), getStripCenterPosition(), and getStripPositionMap().

◆ verbose_

int ldmx::HcalGeometry::verbose_ {0}
private

Parameters that apply to all types of geometries Verbosity, not configurable but helpful if developing.

Definition at line 240 of file HcalGeometry.h.

240{0};

Referenced by HcalGeometry().

◆ y_offset_

double ldmx::HcalGeometry::y_offset_
private

Definition at line 265 of file HcalGeometry.h.

◆ zero_layer_

std::vector<double> ldmx::HcalGeometry::zero_layer_
private

Front of HCal relative to world geometry for each section [mm].

Definition at line 249 of file HcalGeometry.h.

Referenced by buildStripPositionMap(), and HcalGeometry().

◆ zero_strip_

std::vector<std::vector<double> > ldmx::HcalGeometry::zero_strip_
private

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

Definition at line 278 of file HcalGeometry.h.

Referenced by getZeroStrip(), and HcalGeometry().


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