LDMX Software
HcalGeometry.h
Go to the documentation of this file.
1
6#ifndef DETDESCR_HCALGEOMETRY_H_
7#define DETDESCR_HCALGEOMETRY_H_
8
9// LDMX
10#include "DetDescr/HcalID.h"
12#include "Framework/Configure/Parameters.h"
13#include "Framework/Exception/Exception.h"
14
15// ROOT
16#include "TVector3.h"
17
18// STL
19#include <map>
20
21namespace hcal {
22class HcalGeometryProvider;
23}
24
25namespace ldmx {
26
27class HcalGeometryProvider;
28
35 public:
42 static constexpr const char *CONDITIONS_OBJECT_NAME{"HcalGeometry"};
43
51 horizontal = 0,
52 vertical = 1,
53 depth = 2
54 };
55
61 ~HcalGeometry() = default;
62
63 ScintillatorOrientation getScintillatorOrientation(
64 const ldmx::HcalID id) const;
65
75 return strip_position_map_.at(id);
76 }
77
81 std::map<ldmx::HcalID, TVector3> getStripPositionMap() const {
83 }
84
89 bool backLayerIsHorizontal(const int layer) const {
90 return layer % 2 == back_horizontal_parity_;
91 }
99 double getHalfTotalWidth(int isection, int layer = 1) const {
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 }
104
111 return scint_length_.at(id.section()).at(id.layer() - 1);
112 }
116 double getScintillatorWidth() const { return scint_width_; }
117
122
126 int getNumSections() const { return num_sections_; }
127
131 int getNumLayers(int isection) const { return num_layers_.at(isection); }
132
136 int getNumStrips(int isection, int layer = 1) const {
137 auto layer_index = layer - 1;
138 return num_strips_.at(isection).at(layer_index);
139 }
140
144 int getZeroStrip(int isection, int layer = 1) const {
145 auto layer_index = layer - 1;
146 return zero_strip_.at(isection).at(layer_index);
147 }
148
152 double getEcalDx() const { return ecal_dx_; }
153
157 double getEcalDy() const { return ecal_dy_; }
158
165 bool hasSide3DReadout() const { return side_3d_readout_; }
166
167 /*
168 * Is the hcal geometry one of the geometries used for the CERN testbeam
169 * activities?
170 */
171 bool isPrototype() const { return is_prototype_; }
172
195 std::vector<double> rotateGlobalToLocalBarPosition(
196 const std::vector<double> &globalPosition, const ldmx::HcalID &id) const;
197
198 private:
204 HcalGeometry(const framework::config::Parameters &ps);
205 friend class hcal::HcalGeometryProvider;
206
224 void printPositionMap(int section) const;
231 void printPositionMap() const {
232 for (int section = 0; section < num_sections_; ++section) {
233 printPositionMap(section);
234 }
235 }
236
237 private:
240 int verbose_{0};
241
244
247
249 std::vector<double> zero_layer_;
250
252 std::vector<double> layer_thickness_;
253
255 std::vector<int> num_layers_;
256
259
261 double ecal_dx_;
262 double ecal_dy_;
263
264 // Offset of the entire Hcal geometry in y (mm)
265 double y_offset_;
266
267 // Defines what parity (0/1, i.e. even/odd parity) of a layer number in the
268 // geometry that corresponds to a horizontal layer (scintillator bar length
269 // along the x-axis) in the back HCal.
270 int back_horizontal_parity_{};
271
272 // 3D readout for side Hcal
273 int side_3d_readout_{};
274
276 std::vector<std::vector<int>> num_strips_;
278 std::vector<std::vector<double>> zero_strip_;
280 std::vector<std::vector<double>> half_total_width_;
282 std::vector<std::vector<double>> scint_length_;
283
284 bool is_prototype_{};
285
290 std::map<ldmx::HcalID, TVector3> strip_position_map_;
291};
292
293} // namespace ldmx
294
295#endif
Base class for conditions information like pedestals, gains, electronics maps, etc.
Class that defines an HCal sensitive detector.
Base class for all conditions objects, very simple.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
Implementation of HCal strip readout.
std::vector< double > layer_thickness_
Thickness of the layers in each section [mm].
int getNumLayers(int isection) const
Get the number of layers for that section.
bool hasSide3DReadout() const
Does the Side Hcal have 3D readout?
TVector3 getStripCenterPosition(ldmx::HcalID id) const
Get a strip center position from a combined hcal ID.
double getEcalDx() const
Get the length of the Ecal in (x) for the side Hcal.
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].
int getZeroStrip(int isection, int layer=1) const
Get the location of the zeroStrip in a given section and layer.
int getNumSections() const
Get the number of sections.
static constexpr const char * CONDITIONS_OBJECT_NAME
Conditions object: The name of the python configuration calling this class (Hcal/python/HcalGeometry....
double getScintillatorLength(ldmx::HcalID id) const
Get the length of a scintillator bar.
void printPositionMap() const
Debugging utility, prints out the HcalID and corresponding value of all entries in the strip_position...
double getScintillatorThickness() const
Get the scitillator thickness.
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 getEcalDy() const
Get the length of the Ecal in (y) for the side Hcal.
std::vector< double > rotateGlobalToLocalBarPosition(const std::vector< double > &globalPosition, const ldmx::HcalID &id) const
Coordinates that are given by Geant4 are typically global.
double getScintillatorWidth() const
Get the scitillator width.
double scint_thickness_
Thickness of scintillator.
bool backLayerIsHorizontal(const int layer) const
Check whether a given layer corresponds to a horizontal (scintillator length along the x-axis) or ver...
~HcalGeometry()=default
Class destructor.
std::vector< int > num_layers_
Number of layers in each section.
ScintillatorOrientation
Encodes the orientation of a bar.
int getNumStrips(int isection, int layer=1) const
Get the number of strips per layer for that section and layer.
std::map< ldmx::HcalID, TVector3 > strip_position_map_
Map of the HcalID position of strip centers relative to world geometry.
std::map< ldmx::HcalID, TVector3 > getStripPositionMap() const
Get the strip position map.
std::vector< std::vector< int > > num_strips_
Number of strips per layer in each section and each 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.
int num_sections_
Number of sections.
Implements detector ids for HCal subdetector.
Definition HcalID.h:19