HerdSoftware  0.4.0
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 <optional>
19 #include <sstream>
20 #include <vector>
21 
22 // HERD headers
28 
29 namespace Herd {
30 
35 // clang-format off
36  // sipm setup parameters
37 
38  // Default Mat and SiPMs
39  // -----------------------------------------------------------
40  // |---------------| |---------------| |---------------|
41  // | | | | | |
42  // | SiPM0 |0.09| SiPM1 |0.09| SiPM2 |
43  // | 32.54mm | mm | 32.54mm | mm | 32.54mm |
44  // | | | | | |
45  // |---------------| |---------------| |---------------|
46  // -----------------------------------------------------------
47  // \_________________________97.8mm__________________________/
48  //
49  //
50  // SiPM structure
51  //
52  // ==================================================
53  // | | | | | |
54  // | | | | | |
55  // | | active die0 | | active die0 | |
56  // |0.16| |0.22| |0.16|
57  // | mm | 0.25mm*64 | mm | 0.25mm*64 | mm |
58  // | | | | | |
59  // | | | | | |
60  // | | | | | |
61  // ==================================================
62  // \__________________32.54mm_______________________/
63  //
64 // clang-format on
65 
67 public:
72  FitGeoParams();
73 
81  FitGeoParams(RefFrame::Side dside, size_t layerNumber, RefFrame::Direction mainSegm);
82 
84  ~FitGeoParams() override = default;
85 
91  const Parallelepiped &BoundingBox() const;
92 
98  [[nodiscard]] unsigned int NSipmPerMat() const { return _nSipmsPerMat; }
99 
105  [[nodiscard]] int NChannelsPerSipm() const { return _sipmDieChannels * _sipmNDies; }
106 
112  [[nodiscard]] int NChannelsPerMat() const { return _nSipmsPerMat * NChannelsPerSipm(); }
113 
120  [[nodiscard]] const AxesArray<int> &NMats() const { return _nMats; }
121 
126  [[nodiscard]] unsigned int NTotElements() const {
128  };
129 
135  [[nodiscard]] const AxesArray<float> &MatSize() const { return _matSize; }
136 
142  [[nodiscard]] float SipmAirGap() const { return _sipmAirGap; };
143 
150  [[nodiscard]] Point ElementPosition(unsigned int elementID) const override;
151 
158  [[nodiscard]] Parallelepiped ElementShape(size_t volID) const;
159 
166  [[nodiscard]] Point SipmPosition(unsigned int sipmID) const;
167 
174  [[nodiscard]] Point MatPosition(unsigned int matID) const { return _matPos.at(matID); };
175 
181  [[nodiscard]] std::optional<unsigned int> MatID(const Point &position) const;
182 
188  [[nodiscard]] unsigned int MatIDFromChannelID(unsigned int channelID) const;
189 
195  [[nodiscard]] unsigned int SipmIDFromChannelID(unsigned int channelID) const;
196 
203  [[nodiscard]] std::optional<unsigned int> ElementID(const Point &position) const override;
204 
215  [[nodiscard]] std::optional<unsigned int> SipmIDOnMat(float relativePosition) const;
216 
227  [[nodiscard]] std::optional<unsigned int> ChannelIDOnMat(float relativePosition) const;
228 
235  [[nodiscard]] float ChannelPositionOnMat(unsigned int channelIDOnMat) const;
236 
243  void SetSideAndMainSegmDir(RefFrame::Side dside, RefFrame::Direction segmDir) override;
244 
250  void SetNSipmPerMat(int nSipms) { _nSipmsPerMat = nSipms; };
251 
257  void SetMatSize(const AxesArray<float> &sizes);
258 
267  void SetNMats(AxesArray<int> nMats);
268 
277  void SetMatPosition(size_t matID, Point position);
278 
284  class LayerZone {
285  public:
291  LayerZone(float minSegm, float maxSegm) : _min{minSegm}, _max{maxSegm} {}
292 
297  [[nodiscard]] float MinSegm() const { return _min; }
298 
303  [[nodiscard]] float MaxSegm() const { return _max; }
304 
305  private:
306  float _min, _max;
307  };
308 
310  using LayerZones = std::vector<LayerZone>;
311 
318  const LayerZones &ActiveZones();
319 
326  const LayerZones &DeadZones();
327 
328 private:
329  unsigned int _nSipmsPerMat;
332  std::vector<Point> _matPos;
333  bool mutable _bbIsValid{false};
335 
337 
338  void ComputeBoundingBox() const;
339  void ComputeActiveDeadZones();
340 
341 protected:
342  float _sipmAirGap = 0.009;
343  float _sipmDieGap = 0.022;
344  float _sipmDeadRegion = 0.016;
345  float _sipmChannelPitch = 0.025;
346  size_t _sipmDieChannels = 64;
347  size_t _sipmNDies = 2;
348  float _sipmWidth =
350  std::vector<std::pair<float, float>> _sipmRelativePositions;
351 
352 #ifdef HS_USE_ROOT
353  ClassDefOverride(FitGeoParams, 2)
354 #endif
355 };
356 
357 } // namespace Herd
358 
359 #endif /* HERD_FITGEOPARAMS_H_ */
Herd::FitGeoParams::MatPosition
Point MatPosition(unsigned int matID) const
Get position of a given mat.
Definition: FitGeoParams.h:174
TrackingDetectorGeoParams.h
Herd::FitGeoParams::LayerZone::_min
float _min
Definition: FitGeoParams.h:306
Herd::FitGeoParams::_nSipmsPerMat
unsigned int _nSipmsPerMat
Definition: FitGeoParams.h:329
Herd::FitGeoParams::_sipmDeadRegion
float _sipmDeadRegion
Gap between two dies in a SiPM.
Definition: FitGeoParams.h:344
Herd::TrackingDetectorGeoParams
Base data structure for single tracking detector layer geometry parameters.
Definition: TrackingDetectorGeoParams.h:31
Point.h
Herd::FitGeoParams::SetNSipmPerMat
void SetNSipmPerMat(int nSipms)
Set the number of sipms per mat.
Definition: FitGeoParams.h:250
Herd::Vec3D
A class describing a vector in 3D space.
Definition: Vec3D.h:33
Herd::FitGeoParams::_sipmAirGap
float _sipmAirGap
Definition: FitGeoParams.h:342
Herd::FitGeoParams::LayerZones
std::vector< LayerZone > LayerZones
Definition: FitGeoParams.h:310
Herd::FitGeoParams::SipmAirGap
float SipmAirGap() const
Get gap between two consecutive SiPM.
Definition: FitGeoParams.h:142
Herd::FitGeoParams::NSipmPerMat
unsigned int NSipmPerMat() const
Get the number of sipms that are attached to a mat.
Definition: FitGeoParams.h:98
Herd::FitGeoParams::_boundingBox
Parallelepiped _boundingBox
Flag to signal Bounding box must be recomputed.
Definition: FitGeoParams.h:334
Herd::FitGeoParams::SipmIDFromChannelID
unsigned int SipmIDFromChannelID(unsigned int channelID) const
Retrieves the ID of the SiPM containing the channel with the given channelID.
Definition: FitGeoParams.cpp:36
Herd::FitGeoParams::_sipmNDies
size_t _sipmNDies
Number of channels in a single die.
Definition: FitGeoParams.h:347
Herd::FitGeoParams::_sipmDieGap
float _sipmDieGap
Gap between two consecutive SiPMs.
Definition: FitGeoParams.h:343
Herd::AxesArray< int >
AxesArray.h
Herd::FitGeoParams::NChannelsPerMat
int NChannelsPerMat() const
Get the number of channels that are in a mat.
Definition: FitGeoParams.h:112
Herd::RefFrame::Axis::X
@ X
Herd::FitGeoParams::_sipmChannelPitch
float _sipmChannelPitch
Dead region at the border of a SiPM.
Definition: FitGeoParams.h:345
Herd::RefFrame::Direction
Direction
Aliases for the six axis directions.
Definition: RefFrame.h:55
Herd::FitGeoParams::ActiveZones
const LayerZones & ActiveZones()
Returns the active zones.
Definition: FitGeoParams.cpp:334
Herd::FitGeoParams::ChannelPositionOnMat
float ChannelPositionOnMat(unsigned int channelIDOnMat) const
Get position of a given channel relative to the mat "left" edge.
Definition: FitGeoParams.cpp:191
Herd::RefFrame::Side
Side
Aliases for the five sides.
Definition: RefFrame.h:111
Herd
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:22
Herd::FitGeoParams::_bbIsValid
bool _bbIsValid
Position of all the mats.
Definition: FitGeoParams.h:333
Herd::FitGeoParams::ChannelIDOnMat
std::optional< unsigned int > ChannelIDOnMat(float relativePosition) const
Returns the channel ID on mat.
Definition: FitGeoParams.cpp:207
Herd::FitGeoParams::_activeZones
LayerZones _activeZones
Bounding box for this layer, to use for quick intersection checks.
Definition: FitGeoParams.h:336
Herd::FitGeoParams::SetMatSize
void SetMatSize(const AxesArray< float > &sizes)
Set the mat sizes along the three axes.
Definition: FitGeoParams.cpp:38
Herd::RefFrame::Axis::Y
@ Y
Herd::FitGeoParams::_matPos
std::vector< Point > _matPos
Dimensions of a mat along the three axes.
Definition: FitGeoParams.h:332
Herd::FitGeoParams::MatID
std::optional< unsigned int > MatID(const Point &position) const
Retrieves the volume ID of the mat containing the given point.
Definition: FitGeoParams.cpp:155
Herd::FitGeoParams::SipmIDOnMat
std::optional< unsigned int > SipmIDOnMat(float relativePosition) const
Returns the sipm ID on mat.
Definition: FitGeoParams.cpp:142
Herd::FitGeoParams::LayerZone::MinSegm
float MinSegm() const
Getter for minimum coordinate.
Definition: FitGeoParams.h:297
Herd::FitGeoParams::_sipmRelativePositions
std::vector< std::pair< float, float > > _sipmRelativePositions
Width of the SiPM sensor [cm].
Definition: FitGeoParams.h:350
Herd::FitGeoParams::NChannelsPerSipm
int NChannelsPerSipm() const
Get the number of channels in a single SiPM.
Definition: FitGeoParams.h:105
Herd::FitGeoParams
Data structure for single silicon layer geometry parameters.
Definition: FitGeoParams.h:66
Herd::RefFrame::Axis::Z
@ Z
Herd::FitGeoParams::SetSideAndMainSegmDir
void SetSideAndMainSegmDir(RefFrame::Side dside, RefFrame::Direction segmDir) override
Set the detector side and the main segmentation direction for fibers.
Definition: FitGeoParams.cpp:250
Herd::FitGeoParams::LayerZone::_max
float _max
Definition: FitGeoParams.h:306
SidesArray.h
Herd::FitGeoParams::_sipmDieChannels
size_t _sipmDieChannels
Pitch of a single SiPM channel (250um)
Definition: FitGeoParams.h:346
Herd::FitGeoParams::_nMats
AxesArray< int > _nMats
Number of SiPMs in each mat.
Definition: FitGeoParams.h:330
Herd::FitGeoParams::NTotElements
unsigned int NTotElements() const
Return the total number of FIT mats.
Definition: FitGeoParams.h:126
Herd::FitGeoParams::SetNMats
void SetNMats(AxesArray< int > nMats)
Set the number of mats along each axis.
Definition: FitGeoParams.cpp:65
Herd::FitGeoParams::LayerZone
A data structure for describing an active/dead zone of the FIT layer.
Definition: FitGeoParams.h:284
Herd::FitGeoParams::SipmPosition
Point SipmPosition(unsigned int sipmID) const
Get position of a given SiPM.
Definition: FitGeoParams.cpp:128
Herd::FitGeoParams::_sipmWidth
float _sipmWidth
Number of dies in a SiPM.
Definition: FitGeoParams.h:348
Herd::FitGeoParams::MatIDFromChannelID
unsigned int MatIDFromChannelID(unsigned int channelID) const
Retrieves the volume ID of the mat containing the sipm with the given channelID.
Definition: FitGeoParams.cpp:34
Herd::FitGeoParams::~FitGeoParams
~FitGeoParams() override=default
Virtual destructor
Herd::FitGeoParams::ElementShape
Parallelepiped ElementShape(size_t volID) const
Utility function to get the shape in space of a particular mat.
Definition: FitGeoParams.cpp:107
Herd::FitGeoParams::SetMatPosition
void SetMatPosition(size_t matID, Point position)
Set the mat position for a given mat.
Definition: FitGeoParams.cpp:60
Herd::FitGeoParams::ElementPosition
Point ElementPosition(unsigned int elementID) const override
Get position of a given element.
Definition: FitGeoParams.cpp:86
Herd::FitGeoParams::MatSize
const AxesArray< float > & MatSize() const
Get the dimensions of the single mat.
Definition: FitGeoParams.h:135
Herd::FitGeoParams::ComputeActiveDeadZones
void ComputeActiveDeadZones()
Definition: FitGeoParams.cpp:349
Herd::FitGeoParams::DeadZones
const LayerZones & DeadZones()
Returns the dead zones.
Definition: FitGeoParams.cpp:342
Herd::FitGeoParams::NMats
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:120
Herd::FitGeoParams::LayerZone::MaxSegm
float MaxSegm() const
Getter for maximum coordinate.
Definition: FitGeoParams.h:303
Herd::FitGeoParams::ElementID
std::optional< unsigned int > ElementID(const Point &position) const override
Utility function to get the element ID from a set of coordinates.
Definition: FitGeoParams.cpp:171
Herd::Parallelepiped
A parallelepiped in 3D space.
Definition: Parallelepiped.h:25
Herd::FitGeoParams::BoundingBox
const Parallelepiped & BoundingBox() const
Get the layer bounding box for quick geometric checks (intersections and such).
Definition: FitGeoParams.cpp:409
Parallelepiped.h
Herd::FitGeoParams::_matSize
AxesArray< float > _matSize
Number of mats along the three axes.
Definition: FitGeoParams.h:331
Herd::FitGeoParams::FitGeoParams
FitGeoParams()
Default constructor.
Definition: FitGeoParams.cpp:15
Herd::FitGeoParams::LayerZone::LayerZone
LayerZone(float minSegm, float maxSegm)
Constructor.
Definition: FitGeoParams.h:291
Herd::FitGeoParams::ComputeBoundingBox
void ComputeBoundingBox() const
Root-transient.
Definition: FitGeoParams.cpp:416
Herd::FitGeoParams::_deadZones
LayerZones _deadZones
Definition: FitGeoParams.h:336