HerdSoftware  0.2.3
FitGeoParams.h
Go to the documentation of this file.
1 /*
2  * FitGeoParams.h
3  *
4  * Created on: 20 Feb 2020
5  * Author: Valerio Formato
6  */
7 
10 #ifndef HERD_FITGEOPARAMS_H_
11 #define HERD_FITGEOPARAMS_H_
12 
13 #ifdef HS_USE_ROOT
14 #include "Rtypes.h"
15 #endif
16 
17 // C++ headers
18 #include <sstream>
19 #include <vector>
20 
21 // HERD headers
22 #include "common/AxesArray.h"
23 #include "common/SidesArray.h"
24 #include "dataobjects/Point.h"
26 
27 namespace Herd {
28 
33 // clang-format off
34  // sipm setup parameters
35 
36  // Default Mat and SiPMs
37  // -----------------------------------------------------------
38  // |---------------| |---------------| |---------------|
39  // | | | | | |
40  // | SiPM0 |0.09| SiPM1 |0.09| SiPM2 |
41  // | 32.54mm | mm | 32.54mm | mm | 32.54mm |
42  // | | | | | |
43  // |---------------| |---------------| |---------------|
44  // -----------------------------------------------------------
45  // \_________________________97.8mm__________________________/
46  //
47  //
48  // SiPM structure
49  //
50  // ==================================================
51  // | | | | | |
52  // | | | | | |
53  // | | active die0 | | active die0 | |
54  // |0.16| |0.22| |0.16|
55  // | mm | 0.25mm*64 | mm | 0.25mm*64 | mm |
56  // | | | | | |
57  // | | | | | |
58  // | | | | | |
59  // ==================================================
60  // \__________________32.54mm_______________________/
61  //
62 // clang-format on
63 
65 public:
70  FitGeoParams();
71 
78  FitGeoParams(RefFrame::Side dside, size_t layerNumber, RefFrame::Direction mainSegm);
79 
81  virtual ~FitGeoParams() = default;
82 
88  unsigned int NSipmPerMat() const { return _nSipmsPerMat; }
89 
95  int NChannelsPerSipm() const { return _sipmDieChannels * _sipmNDies; }
96 
102  int NChannelsPerMat() const { return _nSipmsPerMat * NChannelsPerSipm(); }
103 
110  const AxesArray<int> &NMats() const { return _nMats; }
111 
116  unsigned int NTotElements() const {
118  };
119 
125  const AxesArray<float> &MatSize() const { return _matSize; }
126 
132  float GetSipmAirGap() const { return _sipmAirGap; };
133 
140  Point ElementPosition(unsigned int elementID) const override;
141 
148  Point SipmPosition(unsigned int sipmID) const;
149 
156  Point MatPosition(unsigned int matID) const { return _matPos.at(matID); };
157 
163  unsigned int MatID(const Point &position) const;
164 
170  unsigned int MatIDFromChannelID(unsigned int channelID) const;
171 
177  unsigned int SipmIDFromChannelID(unsigned int channelID) const;
178 
186  unsigned int ElementID(const Point &position) const override;
187 
198  unsigned int SipmIDOnMat(float relativePosition) const;
199 
210  unsigned int ChannelIDOnMat(float relativePosition) const;
211 
218  float ChannelPositionOnMat(unsigned int channelIDOnMat) const;
219 
226  void SetSideAndMainSegmDir(RefFrame::Side dside, RefFrame::Direction segmDir) override;
227 
237  void SetNSipmPerMat(int nSipms) { _nSipmsPerMat = nSipms; };
238 
244  void SetMatSize(const AxesArray<float> &sizes);
245 
254  void SetNMats(AxesArray<int> nMats);
255 
264  void SetMatPosition(size_t matID, Point position) { _matPos.at(matID) = position; }
265 
266  struct PointOnDeadZone : public std::exception {
268  std::string _deadZoneType;
270 
271  public:
272  PointOnDeadZone(Point point, std::string deadZoneType, bool isLocalPoint = false)
273  : _point(std::move(point)), _deadZoneType(std::move(deadZoneType)), _isLocalPoint(isLocalPoint){};
274 
275  void SetPoint(Point point) { _point = point; }
276 
277  const char *what() const throw() {
278  // Use a static return string to let the embedded const char* survive after exiting this function
279  static std::string returnStr;
280  returnStr = "FitGeoParams: Point (" + //
281  std::to_string(_point[RefFrame::Coo::X]) + "," + //
282  std::to_string(_point[RefFrame::Coo::Y]) + "," + //
283  std::to_string(_point[RefFrame::Coo::X]) + ") is on dead zone (" + _deadZoneType + ")";
284  return returnStr.c_str();
285  }
286  };
287 
293  class LayerZone {
294  public:
300  LayerZone(float minSegm, float maxSegm) : _min{minSegm}, _max{maxSegm} {}
301 
306  float MinSegm() const { return _min; }
307 
312  float MaxSegm() const { return _max; }
313 
314  private:
315  float _min, _max;
316  };
317 
319  using LayerZones = std::vector<LayerZone>;
320 
327  const LayerZones &ActiveZones();
328 
335  const LayerZones &DeadZones();
336 
337 private:
338  unsigned int _nSipmsPerMat;
341  std::vector<Point> _matPos;
342 
344 
345  void ComputeActiveDeadZones();
346 
347 protected:
348  float _sipmAirGap = 0.009;
349  float _sipmDieGap = 0.022;
350  float _sipmDeadRegion = 0.016;
351  float _sipmChannelPitch = 0.025;
352  size_t _sipmDieChannels = 64;
353  size_t _sipmNDies = 2;
354  float _sipmWidth =
355  2 * _sipmDieChannels * _sipmChannelPitch + 2 * _sipmDeadRegion + _sipmDieGap;
356  std::vector<std::pair<float, float>> _sipmRelativePositions;
357 
358 #ifdef HS_USE_ROOT
359  ClassDefOverride(FitGeoParams, 1)
360 #endif
361 };
362 
363 } // namespace Herd
364 
365 #endif /* HERD_FITGEOPARAMS_H_ */
unsigned int ChannelIDOnMat(float relativePosition) const
Returns the channel ID on mat.
Definition: FitGeoParams.cpp:177
const LayerZones & ActiveZones()
Returns the active zones.
Definition: FitGeoParams.cpp:305
int NChannelsPerMat() const
Get the number of channels that are in a mat.
Definition: FitGeoParams.h:102
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
virtual ~FitGeoParams()=default
Virtual destructor.
float _min
Definition: FitGeoParams.h:315
unsigned int NSipmPerMat() const
Get the number of sipms that are attached to a mat.
Definition: FitGeoParams.h:88
void SetNMats(AxesArray< int > nMats)
Set the number of mats along each axis.
Definition: FitGeoParams.cpp:57
unsigned int SipmIDOnMat(float relativePosition) const
Returns the sipm ID on mat.
Definition: FitGeoParams.cpp:111
const char * what() const
Definition: FitGeoParams.h:277
Data structure for single silicon layer geometry parameters.
Definition: FitGeoParams.h:64
void SetMatSize(const AxesArray< float > &sizes)
Set the mat sizes along the three axes.
Definition: FitGeoParams.cpp:37
unsigned int MatIDFromChannelID(unsigned int channelID) const
Retrieves the volume ID of the mat containing the sipm with the given channelID.
Definition: FitGeoParams.cpp:33
Side
Aliases for the five sides. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:106
void SetMatPosition(size_t matID, Point position)
Set the mat position for a given mat.
Definition: FitGeoParams.h:264
LayerZone(float minSegm, float maxSegm)
Constructor.
Definition: FitGeoParams.h:300
size_t _sipmNDies
Number of channels in a single die.
Definition: FitGeoParams.h:353
LayerZones _deadZones
Definition: FitGeoParams.h:343
float MaxSegm() const
Getter for maximum coordinate.
Definition: FitGeoParams.h:312
float GetSipmAirGap() const
Get gap between two consecutive SiPM.
Definition: FitGeoParams.h:132
Point _point
Definition: FitGeoParams.h:267
A class describing a vector in 3D space.
Definition: Vec3D.h:33
Definition: FitGeoParams.h:266
std::vector< std::pair< float, float > > _sipmRelativePositions
Width of the SiPM sensor [cm].
Definition: FitGeoParams.h:356
std::vector< Point > _matPos
Dimensions of a mat along the three axes.
Definition: FitGeoParams.h:341
const LayerZones & DeadZones()
Returns the dead zones.
Definition: FitGeoParams.cpp:313
FitGeoParams()
Default constructor.
Definition: FitGeoParams.cpp:14
float _sipmAirGap
Definition: FitGeoParams.h:348
std::vector< LayerZone > LayerZones
Definition: FitGeoParams.h:319
float _sipmDeadRegion
Gap between two dies in a SiPM.
Definition: FitGeoParams.h:350
size_t _sipmDieChannels
Pitch of a single SiPM channel (250um)
Definition: FitGeoParams.h:352
void SetPoint(Point point)
Definition: FitGeoParams.h:275
void SetNSipmPerMat(int nSipms)
Set the number of sipms per mat.
Definition: FitGeoParams.h:237
float _sipmChannelPitch
Dead region at the border of a SiPM.
Definition: FitGeoParams.h:351
unsigned int NTotElements() const
Return the total number of FIT mats.
Definition: FitGeoParams.h:116
float _sipmDieGap
Gap between two consecutive SiPMs.
Definition: FitGeoParams.h:349
PointOnDeadZone(Point point, std::string deadZoneType, bool isLocalPoint=false)
Definition: FitGeoParams.h:272
AxesArray< int > _nMats
Number of SiPMs in each mat.
Definition: FitGeoParams.h:339
unsigned int MatID(const Point &position) const
Retrieves the volume ID of the mat containing the given point.
Definition: FitGeoParams.cpp:126
bool _isLocalPoint
Definition: FitGeoParams.h:269
Point SipmPosition(unsigned int sipmID) const
Get position of a given SiPM.
Definition: FitGeoParams.cpp:97
float MinSegm() const
Getter for minimum coordinate.
Definition: FitGeoParams.h:306
unsigned int ElementID(const Point &position) const override
Utility function to get the element ID from a set of coordinates.
Definition: FitGeoParams.cpp:142
Point MatPosition(unsigned int matID) const
Get position of a given mat.
Definition: FitGeoParams.h:156
int NChannelsPerSipm() const
Get the number of channels in a single SiPM.
Definition: FitGeoParams.h:95
Point ElementPosition(unsigned int elementID) const override
Get position of a given element.
Definition: FitGeoParams.cpp:76
const AxesArray< int > & NMats() const
Get the number of ladder that make up a layer. This is intended as number of ladders along each direc...
Definition: FitGeoParams.h:110
void ComputeActiveDeadZones()
Root-transient.
Definition: FitGeoParams.cpp:320
std::string _deadZoneType
Definition: FitGeoParams.h:268
Definition: FitGeoParams.h:293
const AxesArray< float > & MatSize() const
Get the dimensions of the single mat.
Definition: FitGeoParams.h:125
AxesArray< float > _matSize
Number of mats along the three axes.
Definition: FitGeoParams.h:340
void SetSideAndMainSegmDir(RefFrame::Side dside, RefFrame::Direction segmDir) override
Set the detector side and the main segmentation direction for fibers.
Definition: FitGeoParams.cpp:221
float ChannelPositionOnMat(unsigned int channelIDOnMat) const
Get position of a given channel relative to the mat "left" edge.
Definition: FitGeoParams.cpp:161
Base data structure for single tracking detector layer geometry parameters.
Definition: TrackingDetectorGeoParams.h:28
unsigned int _nSipmsPerMat
Definition: FitGeoParams.h:338
float _sipmWidth
Number of dies in a SiPM.
Definition: FitGeoParams.h:354
LayerZones _activeZones
Position of all the mats.
Definition: FitGeoParams.h:343
Direction
Aliases for the six axis directions. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:54
unsigned int SipmIDFromChannelID(unsigned int channelID) const
Retrieves the ID of the SiPM containing the channel with the given channelID.
Definition: FitGeoParams.cpp:35