HerdSoftware  0.3.2
PsdGeoParams.h
Go to the documentation of this file.
1 /*
2  * PsdGeoParams.h
3  *
4  * Created on: 7 Dec 2018
5  * Author: Nicola Mori
6  */
7 
10 #ifndef HERD_PSDGEOPARAMS_H_
11 #define HERD_PSDGEOPARAMS_H_
12 
13 #include "common/AxesArray.h"
14 #include "common/CooArray.h"
15 #include "common/DefaultValues.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 
29 struct PsdGeoParams {
30 
33 
35  PsdGeoParams(unsigned int nTotElements)
37 
39  virtual ~PsdGeoParams() = default;
40 
53  const AxesArray<unsigned int> &NElements() const { return _nElements; };
54 
59  unsigned int NTotElements() const { return _psdElements.size(); };
60 
65  RefFrame::Direction Normal() const { return _normal; };
66 
76  std::pair<RefFrame::Direction, RefFrame::Direction> SegmentationDirections() const;
77 
83  const AxesArray<float> &Sizes() const { return _sizes; };
84 
90  const Point &Position(unsigned int volID) const { return _psdElements[volID]._position; };
91 
97  const CooArray<unsigned char> &CooIndexes(unsigned int volID) const { return _psdElements[volID]._indexes; };
98 
103  const std::pair<float, float> &BaseAngles() const { return _baseAngles; };
104 
109  bool IsSmallerFaceOutward(unsigned int volID) { return (bool)(volID % 2); };
110 
117  void SetNElements(AxesArray<unsigned int> nElements);
118 
123  void SetNormal(RefFrame::Direction normal) { _normal = normal; };
124 
130  void SetSizes(AxesArray<float> sizes) { _sizes = sizes; };
131 
137  void SetPosition(unsigned int volID, Point position) { _psdElements[volID]._position = position; };
138 
143  void SetBaseAngles(std::pair<float, float> baseAngles) { _baseAngles = baseAngles; };
144 
146  struct PsdElement {
149 
150  PsdElement() : _position() {
151  _indexes[RefFrame::Coo::X] = std::numeric_limits<unsigned char>::max();
152  _indexes[RefFrame::Coo::Y] = std::numeric_limits<unsigned char>::max();
153  _indexes[RefFrame::Coo::Z] = std::numeric_limits<unsigned char>::max();
154  };
155  };
156 
157 private:
161  std::pair<float, float> _baseAngles;
162  std::vector<PsdElement> _psdElements;
163 
164 #ifdef HS_USE_ROOT
165  ClassDef(PsdGeoParams, 2)
166 #endif
167 };
168 
169 } // namespace Herd
170 
171 #endif /* HERD_PSDGEOPARAMS_H_ */
RefFrame::Direction _normal
Normal of the PSD which points outside the full detector.
Definition: PsdGeoParams.h:160
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
PsdElement()
Definition: PsdGeoParams.h:150
#define DEFAULT_INIT(x)
Definition: DefaultValues.h:23
AxesArray< float > _sizes
Size of a PSD element, one value for each direction.
Definition: PsdGeoParams.h:159
CooArray< unsigned char > _indexes
Indexes of the PSD element for each coordinate.
Definition: PsdGeoParams.h:148
Point _position
Position of the center of the PSD element.
Definition: PsdGeoParams.h:147
AxesArray< unsigned int > _nElements
Number of PSD elements along each segmentation axis.
Definition: PsdGeoParams.h:158
void SetBaseAngles(std::pair< float, float > baseAngles)
Set the base angles of the PSD elements.
Definition: PsdGeoParams.h:143
PsdGeoParams()
PsdGeoParams constructor.
Definition: PsdGeoParams.h:32
const CooArray< unsigned char > & CooIndexes(unsigned int volID) const
Return the indexes of a PSD element.
Definition: PsdGeoParams.h:97
A class describing a vector in 3D space.
Definition: Vec3D.h:33
PsdGeoParams(unsigned int nTotElements)
Constructor.
Definition: PsdGeoParams.h:35
void SetSizes(AxesArray< float > sizes)
Set the size of a PSD element, one value for each direction. Size in trapezoidal shapes refers to the...
Definition: PsdGeoParams.h:130
Data structure for PSD geometry parameters.
Definition: PsdGeoParams.h:29
const AxesArray< unsigned int > & NElements() const
Return the number of PSD elements along each segmentation axis.
Definition: PsdGeoParams.h:53
void SetNormal(RefFrame::Direction normal)
Set the normal to the PSD surface, which points outside the full detector.
Definition: PsdGeoParams.h:123
std::pair< RefFrame::Direction, RefFrame::Direction > SegmentationDirections() const
Return the segmentation directions of the PSD layer.
Definition: PsdGeoParams.cpp:37
RefFrame::Direction Normal() const
Return the normal to the PSD surface, which points outside the full detector.
Definition: PsdGeoParams.h:65
void SetNElements(AxesArray< unsigned int > nElements)
Set the number of PSD elements along each segmentation axis and compute the indexes.
Definition: PsdGeoParams.cpp:12
bool IsSmallerFaceOutward(unsigned int volID)
Specifies if the PSD element has the smaller basis of the trapezoidal pointing outward.
Definition: PsdGeoParams.h:109
void SetPosition(unsigned int volID, Point position)
Set the position of a PSD element.
Definition: PsdGeoParams.h:137
This struct is used only inside the object, it is public since Root can not save the object otherwise...
Definition: PsdGeoParams.h:146
std::vector< PsdElement > _psdElements
Vector of PSD elements, which include the position and the indexes.
Definition: PsdGeoParams.h:162
const Point & Position(unsigned int volID) const
Return the position of a PSD element.
Definition: PsdGeoParams.h:90
virtual ~PsdGeoParams()=default
Virtual destructor.
const AxesArray< float > & Sizes() const
Return the size of a PSD element, one value for each direction. Size in trapezoidal shapes refers to ...
Definition: PsdGeoParams.h:83
unsigned int NTotElements() const
Return the total number of PSD elements.
Definition: PsdGeoParams.h:59
const std::pair< float, float > & BaseAngles() const
Return the base angle of the PSD elements.
Definition: PsdGeoParams.h:103
std::pair< float, float > _baseAngles
Base angles of the PSD elements.
Definition: PsdGeoParams.h:161
Direction
Aliases for the six axis directions. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:57