HerdSoftware  0.1.1
CaloGeoParams.h
Go to the documentation of this file.
1 /*
2  * CaloGeoParams.h
3  *
4  * Created on: 19 Set 2019
5  * Author: Lorenzo Pacini
6  */
7 
10 #ifndef HERD_CALOGEOPARAMS_H_
11 #define HERD_CALOGEOPARAMS_H_
12 
13 #include "common/AxesArray.h"
14 #include "common/DefaultValues.h"
15 #include "dataobjects/Line.h"
16 #include "dataobjects/Point.h"
17 
18 #ifdef HS_USE_ROOT
19 #include "Rtypes.h"
20 #endif
21 
22 #include <vector>
23 
24 namespace Herd {
25 
30 public:
35  CaloGeoParams(unsigned int nCubes)
37  _caloCubes.resize(nCubes);
38  }
39 
42 
44  virtual ~CaloGeoParams() = default;
45 
51  const Point &Position(unsigned int volID) const { return _caloCubes[volID]._position; };
52 
58  const CooArray<unsigned char> &CooIndexes(unsigned int volID) const { return _caloCubes[volID]._indexes; };
59 
65  bool IsEmpty(unsigned int volID) const { return _caloCubes[volID]._isEmpty; };
66 
71  const float &CubeSize() const { return _cubeSize; };
72 
77  float LYSODensity() const { return _lysoDensity; };
78 
87  float LYSORadiationLength() const { return 8.6728 / _lysoDensity; }; // 8.6728 = 1.172 * 7.4
88 
97  float LYSONuclearInteractionLength() const { return 152.3586 / _lysoDensity; }; // 152.3586 = 20.589 * 7.4
98 
103  const float &CubeSlotSize() const { return _cubeSlotSize; };
104 
109  unsigned int NCubes() const { return _caloCubes.size(); };
110 
124  unsigned int VolumeID(const CooArray<unsigned char> &cooIndex);
125 
135  unsigned int VolumeID(const Point &position);
136 
145  std::pair<Point, Point> GetCubeIntersections(const Line &track, const unsigned int volID,
146  const Herd::RefFrame::Coo sort_by_coo = Herd::RefFrame::Coo::NONE) const;
147 
152  void SetNCubes(unsigned int nCubes) { _caloCubes.resize(nCubes); };
153 
159  void SetPosition(unsigned int volID, Point position) { _caloCubes[volID]._position = position; };
160 
166  void SetCooIndexes(unsigned int volID, CooArray<unsigned char> indexes) { _caloCubes[volID]._indexes = indexes; };
167 
175  void SetIsEmpty(unsigned int volID, bool isEmpty) { _caloCubes[volID]._isEmpty = isEmpty; };
176 
181  void SetCubeSize(float cubeSize) { _cubeSize = cubeSize; };
182 
187  void SetCubeSlotSize(float cubeSlotSize) { _cubeSlotSize = cubeSlotSize; };
188 
193  void SetLYSODensity(float density) { _lysoDensity = density; };
194 
196  struct CaloCube {
197 
200  bool _isEmpty;
201 
202  CaloCube() : DEFAULT_INIT(_position), DEFAULT_INIT(_indexes), _isEmpty(false) {}
203  };
204 
205 private:
210  void FillCooId2VolIDMatrix();
211 
212  std::vector<CaloCube> _caloCubes;
213  float _cubeSize;
215  float _lysoDensity;
216  std::vector<std::vector<std::vector<unsigned short>>>
218 
219 #ifdef HS_USE_ROOT
220  ClassDef(CaloGeoParams, 4)
221 #endif
222 };
223 
224 } // namespace Herd
225 
226 #endif /* HERD_PSDGEOPARAMS_H_ */
Coo
Aliases for the three space coordinates. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:24
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
float LYSODensity() const
Return the LYSO density (g/cm3).
Definition: CaloGeoParams.h:77
CaloCube()
Definition: CaloGeoParams.h:202
float LYSONuclearInteractionLength() const
Return the nuclear interaction length of the LYSO material constituting the cube (cm).
Definition: CaloGeoParams.h:97
void FillCooId2VolIDMatrix()
Fill the private lookup table which converts indexes into volume ID.
Definition: CaloGeoParams.cpp:18
const CooArray< unsigned char > & CooIndexes(unsigned int volID) const
Return the cube indexes.
Definition: CaloGeoParams.h:58
#define DEFAULT_INIT(x)
Definition: DefaultValues.h:23
std::vector< std::vector< std::vector< unsigned short > > > _cooId2VolIDMatrix
Definition: CaloGeoParams.h:217
void SetPosition(unsigned int volID, Point position)
Set the position of the center of the cube.
Definition: CaloGeoParams.h:159
unsigned int VolumeID(const CooArray< unsigned char > &cooIndex)
Return the volume ID starting from the indexes.
Definition: CaloGeoParams.cpp:32
CaloGeoParams()
Default constructor.
Definition: CaloGeoParams.h:41
virtual ~CaloGeoParams()=default
Virtual destructor.
CooArray< unsigned char > _indexes
Indexes of the cube for each coordinate.
Definition: CaloGeoParams.h:199
std::vector< CaloCube > _caloCubes
Vector of CaloCube, which contains the cube position and indexes.
Definition: CaloGeoParams.h:212
A class describing a vector in 3D space.
Definition: Vec3D.h:33
Point _position
Position of the center of the cube.
Definition: CaloGeoParams.h:198
Data structure for the Calo geometry parameters.
Definition: CaloGeoParams.h:29
void SetNCubes(unsigned int nCubes)
Set the number of cubes.
Definition: CaloGeoParams.h:152
const Point & Position(unsigned int volID) const
Return the position of the center of the cube.
Definition: CaloGeoParams.h:51
Class describing a line in the 3D space.
Definition: Line.h:32
float _cubeSize
The size of the cube, i.e. the side length (cm).
Definition: CaloGeoParams.h:213
CaloGeoParams(unsigned int nCubes)
Constructor.
Definition: CaloGeoParams.h:35
const float & CubeSize() const
Return the cube size, i.e the side length [cm].
Definition: CaloGeoParams.h:71
void SetIsEmpty(unsigned int volID, bool isEmpty)
Set the flag which indicates if the cube is empty.
Definition: CaloGeoParams.h:175
void SetCooIndexes(unsigned int volID, CooArray< unsigned char > indexes)
Set the cube indexes.
Definition: CaloGeoParams.h:166
float LYSORadiationLength() const
Return the radiation length of the LYSO material constituting the cube (cm).
Definition: CaloGeoParams.h:87
void SetCubeSize(float cubeSize)
Set the cube size, i.e the side length [cm].
Definition: CaloGeoParams.h:181
bool _isEmpty
True if the cube is empty, true if it is filled with LYSO.
Definition: CaloGeoParams.h:200
void SetLYSODensity(float density)
Set the LYSO density.
Definition: CaloGeoParams.h:193
float _cubeSlotSize
The size of the cube slot (cm).
Definition: CaloGeoParams.h:214
std::pair< Point, Point > GetCubeIntersections(const Line &track, const unsigned int volID, const Herd::RefFrame::Coo sort_by_coo=Herd::RefFrame::Coo::NONE) const
Return the two intersection points between a line and a given cube.
Definition: CaloGeoParams.cpp:66
float _lysoDensity
The density the cube (g/cm3).
Definition: CaloGeoParams.h:215
This struct is used only inside the object, it is public since Root can not save the object otherwise...
Definition: CaloGeoParams.h:196
bool IsEmpty(unsigned int volID) const
Return true if the cube is empty.
Definition: CaloGeoParams.h:65
void SetCubeSlotSize(float cubeSlotSize)
Set the cube slot size [cm].
Definition: CaloGeoParams.h:187
const float & CubeSlotSize() const
Return the size of the tray slot accommodating a single LYSO cube [cm].
Definition: CaloGeoParams.h:103
unsigned int NCubes() const
Return the total number of cubes.
Definition: CaloGeoParams.h:109