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 "Math/Vector3D.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 ROOT::Math::XYZVector getStripCenterPosition(ldmx::HcalID id) const {
76 return strip_position_map_.at(id);
77 }
78
82 std::map<ldmx::HcalID, ROOT::Math::XYZVector> getStripPositionMap() const {
84 }
85
90 bool backLayerIsHorizontal(const int layer) const {
91 return layer % 2 == back_horizontal_parity_;
92 }
100 double getHalfTotalWidth(int isection, int layer = 1) const {
101 // Layer numbering starts at 1, but a vector is zero-indexed
102 auto layer_index = layer - 1;
103 return half_total_width_.at(isection).at(layer_index);
104 }
105
112 return scint_length_.at(id.section()).at(id.layer() - 1);
113 }
117 double getScintillatorWidth() const { return scint_width_; }
118
123
127 int getNumSections() const { return num_sections_; }
128
132 int getNumLayers(int isection) const { return num_layers_.at(isection); }
133
137 int getNumStrips(int isection, int layer = 1) const {
138 auto layer_index = layer - 1;
139 return num_strips_.at(isection).at(layer_index);
140 }
141
145 int getZeroStrip(int isection, int layer = 1) const {
146 auto layer_index = layer - 1;
147 return zero_strip_.at(isection).at(layer_index);
148 }
149
153 double getEcalDx() const { return ecal_dx_; }
154
158 double getEcalDy() const { return ecal_dy_; }
159
166 bool hasSide3DReadout() const { return side_3d_readout_; }
167
168 /*
169 * Is the hcal geometry one of the geometries used for the CERN testbeam
170 * activities?
171 */
172 bool isPrototype() const { return is_prototype_; }
173
196 std::vector<double> rotateGlobalToLocalBarPosition(
197 const std::vector<double> &globalPosition, const ldmx::HcalID &id) const;
198
199 private:
206 friend class hcal::HcalGeometryProvider;
207
225 void printPositionMap(int section) const;
232 void printPositionMap() const {
233 for (int section = 0; section < num_sections_; ++section) {
234 printPositionMap(section);
235 }
236 }
237
238 private:
241 int verbose_{0};
242
245
248
250 std::vector<double> zero_layer_;
251
253 std::vector<double> layer_thickness_;
254
256 std::vector<int> num_layers_;
257
260
262 double ecal_dx_;
263 double ecal_dy_;
264
265 // Offset of the entire Hcal geometry in y (mm)
266 double y_offset_;
267
268 // Defines what parity (0/1, i.e. even/odd parity) of a layer number in the
269 // geometry that corresponds to a horizontal layer (scintillator bar length
270 // along the x-axis) in the back HCal.
271 int back_horizontal_parity_{};
272
273 // 3D readout for side Hcal
274 int side_3d_readout_{};
275
277 std::vector<std::vector<int>> num_strips_;
279 std::vector<std::vector<double>> zero_strip_;
281 std::vector<std::vector<double>> half_total_width_;
283 std::vector<std::vector<double>> scint_length_;
284
285 bool is_prototype_{};
286
291 std::map<ldmx::HcalID, ROOT::Math::XYZVector> strip_position_map_;
292};
293
294} // namespace ldmx
295
296#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:29
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?
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].
std::map< ldmx::HcalID, ROOT::Math::XYZVector > getStripPositionMap() const
Get the strip position map.
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].
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 > 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.
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].
HcalGeometry(const framework::config::Parameters &ps)
Class constructor, for use only by the provider.
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::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