HerdSoftware  0.1.1
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 
82  const AxesArray<float> &Sizes() const { return _sizes; };
83 
89  const Point &Position(unsigned int volID) const { return _psdElements[volID]._position; };
90 
96  const CooArray<unsigned char> &CooIndexes(unsigned int volID) const { return _psdElements[volID]._indexes; };
97 
104  void SetNElements(AxesArray<unsigned int> nElements);
105 
110  void SetNormal(RefFrame::Direction normal) { _normal = normal; };
111 
116  void SetSizes(AxesArray<float> sizes) { _sizes = sizes; };
117 
123  void SetPosition(unsigned int volID, Point position) { _psdElements[volID]._position = position; };
124 
126  struct PsdElement {
129 
130  PsdElement() : _position() {
131  _indexes[RefFrame::Coo::X] = std::numeric_limits<unsigned char>::max();
132  _indexes[RefFrame::Coo::Y] = std::numeric_limits<unsigned char>::max();
133  _indexes[RefFrame::Coo::Z] = std::numeric_limits<unsigned char>::max();
134  };
135  };
136 
137 private:
141  std::vector<PsdElement> _psdElements;
142 
143 #ifdef HS_USE_ROOT
144  ClassDef(PsdGeoParams, 1)
145 #endif
146 };
147 
148 } // namespace Herd
149 
150 #endif /* HERD_PSDGEOPARAMS_H_ */
RefFrame::Direction _normal
Normal of the PSD which points outside the full detector.
Definition: PsdGeoParams.h:140
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
PsdElement()
Definition: PsdGeoParams.h:130
#define DEFAULT_INIT(x)
Definition: DefaultValues.h:23
AxesArray< float > _sizes
Size of a PSD element, one value for each direction.
Definition: PsdGeoParams.h:139
CooArray< unsigned char > _indexes
Indexes of the PSD element for each coordinate.
Definition: PsdGeoParams.h:128
Point _position
Position of the center of the PSD element.
Definition: PsdGeoParams.h:127
AxesArray< unsigned int > _nElements
Number of PSD elements along each segmentation axis.
Definition: PsdGeoParams.h:138
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:96
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.
Definition: PsdGeoParams.h:116
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:110
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
void SetPosition(unsigned int volID, Point position)
Set the position of a PSD element.
Definition: PsdGeoParams.h:123
This struct is used only inside the object, it is public since Root can not save the object otherwise...
Definition: PsdGeoParams.h:126
std::vector< PsdElement > _psdElements
Vector of PSD elements, which include the position and the indexes.
Definition: PsdGeoParams.h:141
const Point & Position(unsigned int volID) const
Return the position of a PSD element.
Definition: PsdGeoParams.h:89
virtual ~PsdGeoParams()=default
Virtual destructor.
const AxesArray< float > & Sizes() const
Return the size of a PSD element, one value for each direction.
Definition: PsdGeoParams.h:82
unsigned int NTotElements() const
Return the total number of PSD elements.
Definition: PsdGeoParams.h:59
Direction
Aliases for the six axis directions. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:52