Belle II Software  release-08-01-10
ARICHGeometryPar.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #ifndef ARICHGEOMETRYPAR_H
10 #define ARICHGEOMETRYPAR_H
11 
12 #include <vector>
13 #include <string>
14 #include <map>
15 #include <unordered_set>
16 #include <framework/gearbox/GearDir.h>
17 #include <Math/Vector3D.h>
18 #include "TVector3.h"
19 #include "TVector2.h"
20 #include <G4ThreeVector.hh>
21 
22 #define MAX_N_ALAYERS 5
23 #define MAXPTS_QE 100
24 
25 namespace Belle2 {
31 
36 
37  public:
38 
41 
43  virtual ~ARICHGeometryPar();
44 
46 
49  static ARICHGeometryPar* Instance();
51  void Initialize(const GearDir& content);
53  void Initialize(const GearDir& content, const GearDir& mirrorinfo);
54 
56  void clear(void);
57 
59  void Print(void) const;
60 
62  void read(const GearDir& content);
63 
65  void readModuleInfo(const GearDir& content);
66 
68  double QE(double e) const;
69 
71  double getColEffi() const;
72 
74  double getSensitiveSurfaceSize() const;
76  int getNMCopies() const;
78  int getCopyNo(TVector3 hit);
80  int getCopyNo(const ROOT::Math::XYZVector& hit);
82  TVector3 getOrigin(int copyno);
84  G4ThreeVector getOriginG4(int copyNo);
86  double getModAngle(int copyno);
88  int getChannelID(TVector2 hit);
90  TVector2 getChannelCenterLoc(int chID);
92  double getChannelQE(int moduleID, int channelID);
94  TVector2 getChipLocPos(int chipID);
96  int getChipID(TVector2 locpos);
98  TVector3 getChannelCenterGlob(int modID, int chanID);
100  TVector3 getMirrorNormal(int mirID);
102  TVector3 getMirrorPoint(int mirID);
104  double getAerogelTransmissionLength(int ilayer);
106  double getAerogelRefIndex(int ilayer);
108  double getAerogelThickness(int ilayer);
110  double getAerogelZPosition(int ilayer);
112  int getNMirrors();
114  double getMirrorsStartAngle();
116  double getMirrorsZPosition();
120  double getDetectorWindowRefIndex();
124  double getDetectorPadSize();
126  double getDetectorZPosition();
128  int getDetectorXPadNumber();
130  double getQEScaling();
132  double getWindowAbsorbtion();
134  double getChipNegativeCrosstalk();
136  int getNrTiles();
138  int getNphiTiles(int nRing);
140  double getTileGap();
142  double getAeroTubeRin();
144  double getAeroTubeRout();
146  void setAeroTransLength(int ilayer, double trlen);
148  void setAeroRefIndex(int ilayer, double n);
150  void setAerogelThickness(int ilayer, double thick);
152  void setAerogelZPosition(int ilayer, double zPos);
154  void setWindowRefIndex(double refInd);
156  bool isInit();
158  bool isSimple();
160  void initDetectorMask(int nmodules);
162  void setActive(int module, int channel, bool val);
164  bool isActive(int module, int channel);
165 
167  int getMergerFromCooper(int cooperID, int finesse);
169  int getBoardFromMerger(int mergerID, int slot);
171  int getNBoardsOnMerger(int mergerID);
172 
174  int getAerogelTileID(TVector2 locpos);
175 
177  const std::unordered_set<unsigned int>& getCopperIDs() const
178  {
179  return m_copperIDs;
180  }
181 
182  private:
183 
184  std::string m_version;
185  double m_padSize;
186  double m_chipGap;
189  double m_detZpos;
190  double m_modXSize;
191  double m_modZSize;
192  double m_winThick;
193  double m_winRefInd;
198  double m_mirrorZPos;
199  int m_nPadX;
200  int m_nRad;
201  bool m_init;
202  bool m_simple;
203  double m_aeroTrLength[MAX_N_ALAYERS];
204  double m_aeroRefIndex[MAX_N_ALAYERS];
205  double m_aeroZPosition[MAX_N_ALAYERS];
206  double m_aeroThickness[MAX_N_ALAYERS];
207  int m_nPads;
208  std::vector<uint32_t> m_DetectorMask;
209  std::vector<uint8_t> m_ChannelQE;
211  double m_ColEffi;
212  double m_LambdaFirst;
213  double m_LambdaStep;
215  double m_qeScale;
218  double m_QE[MAXPTS_QE];
220  int m_tileNr;
221  int m_tileNphi[5];
222  double m_tileGap;
223  double m_aeroRin;
224  double m_aeroRout;
227  void modulesPosition(const GearDir& content);
228 
230  void modulesPositionSimple(const GearDir& content);
231 
233  void chipLocPosition();
234 
236  void padPositions();
238 
240  void mirrorPositions(const GearDir& content);
241 
243  void readMirrorAlignment(const GearDir& content);
244 
246  void mirrorPositionSimple(const GearDir& content);
247 
249  void frontEndMapping(const GearDir& content);
250 
253  // vectors holding information on HAPDs and chips and pads positions.
254 
255  std::vector<int>
257  std::vector<double> m_fDFi;
258  std::vector<double> m_fDR;
259  int m_nrow;
260  std::vector<double> m_fR;
261  std::vector<double> m_fFi;
262  std::vector<double> m_fFiMod;
263  std::vector<TVector2> m_chipLocPos;
264  std::map<int, TVector2> m_padLocPositions;
265  std::vector<TVector2> m_padWorldPositions;
266  std::vector<TVector3> m_mirrornorm;
267  std::vector<TVector3> m_mirrorpoint;
269  std::map<std::pair<unsigned, int>, unsigned> m_copper2merger;
270  std::map<int, std::vector<unsigned>> m_merger2feb;
271  std::unordered_set<unsigned int> m_copperIDs;
272  std::unordered_set<unsigned int> m_mergerIDs;
273  std::unordered_set<unsigned int> m_boardIDs;
275  };
276 
277  //-----------------------------------------------------------------------------
278 
279  inline double ARICHGeometryPar::getColEffi() const
280  {
281  return m_ColEffi;
282  }
283 
285  {
286  return m_nPadX * m_padSize + m_chipGap;
287  }
288 
289  inline int ARICHGeometryPar::getNMCopies() const
290  {
291  return m_fR.size();
292  }
293 
294  inline TVector2 ARICHGeometryPar::getChipLocPos(int chipID)
295  {
296  return m_chipLocPos.at(chipID);
297  }
298 
300  {
301  return m_init;
302  }
303 
305  {
306  return m_simple;
307  }
308 
309 
311  {
312  return m_aeroTrLength[layer];
313  }
314 
315  inline double ARICHGeometryPar::getAerogelRefIndex(int layer)
316  {
317  return m_aeroRefIndex[layer];
318  }
319 
320  inline double ARICHGeometryPar::getAerogelThickness(int layer)
321  {
322  return m_aeroThickness[layer];
323  }
324 
325  inline double ARICHGeometryPar::getAerogelZPosition(int layer)
326  {
327  return m_aeroZPosition[layer];
328  }
329 
331  {
332  return m_nMirrors;
333  }
334 
336  {
337  return m_winThick;
338  }
339 
341  {
342  return m_winRefInd;
343  }
344 
346  {
347  return m_nRad;
348  }
349 
351  {
352  return m_padSize;
353  }
354 
356  {
357  return m_nPadX;
358  }
359 
361  {
362  return m_mirrorStartAng;
363  }
364 
366  {
367  return m_mirrorZPos;
368  }
369 
371  {
372  return m_detZpos;
373  }
374 
376  {
377  return m_qeScale;
378  }
379 
381  {
382  return m_windowAbsorbtion;
383  }
384 
386  {
388  }
389 
391  {
392  return m_tileNr;
393  }
394 
395  inline int ARICHGeometryPar::getNphiTiles(int nRing)
396  {
397  if (nRing > 4) return 0;
398  return m_tileNphi[nRing];
399  }
400 
402  {
403  return m_tileGap;
404  }
405 
407  {
408  return m_aeroRin;
409  }
410 
412  {
413  return m_aeroRout;
414  }
415 
416 
417 
419 } // end of namespace Belle2
420 
421 #endif
422 
The Class for ARICH Geometry Parameters.
double m_modXSize
Detector module length.
double m_tileGap
Gap size between two aerogel tiles.
double m_winThick
Thickness of detector module window.
double m_padSize
Detector pad size.
double m_chipGap
Gap between chips in detector module.
double m_LambdaFirst
wavelength [nm]: first QE data point
double m_aeroRout
Outer radius of aerogel tube.
double m_detZpos
Z position of detector plane.
double m_detInnerRadius
Inner radius of detector tube.
double m_aeroRin
Inner radius of aerogel tube.
const std::unordered_set< unsigned int > & getCopperIDs() const
Returns a set of copper ID's.
double m_mirrorOuterRad
Radius of circle outscribed to mirrors polygon.
double m_aeroZPosition[MAX_N_ALAYERS]
Array of aerogel Z positions.
double m_qeScale
QE scale factor for photons internally reflected in HAPD window.
std::vector< TVector3 > m_mirrorpoint
vector holding one point of each mirror plate
double m_detOuterRadius
Outer radius of detector tube.
std::vector< double > m_fDR
minimal distance between detector modules in radial direction
int m_nrow
number of detector rings
std::map< int, TVector2 > m_padLocPositions
map holding channel local positions (in detector module local coordinates)
double m_modZSize
Detector module height.
std::string m_version
The version of geometry parameters.
double m_aeroTrLength[MAX_N_ALAYERS]
Array of aerogel transmission lenths.
std::vector< TVector2 > m_padWorldPositions
map holding channel global positions
int m_NpointsQE
number of QE data points
std::unordered_set< unsigned int > m_boardIDs
FEB ID's.
std::unordered_set< unsigned int > m_mergerIDs
Merger ID's.
std::vector< double > m_fR
radial coordinate of detector modules
double m_LambdaStep
wavelength [nm]: step
int m_tileNphi[5]
Number of aerogel tiles in phi direction of each "radial" ring.
double m_winRefInd
Detector window refractive index.
std::vector< uint32_t > m_DetectorMask
Detector Mask of inactive channels.
double m_ColEffi
collection efficiency
bool m_simple
True if parametrization initialized with simple geometry (beamtest)
std::vector< TVector3 > m_mirrornorm
vector holding normal vectors of mirror plates
int m_nRad
Number of aerogel layers.
double m_mirrorZPos
Z position of mirror plates (starting z)
std::vector< double > m_fDFi
angle covered by one detector module in ring
double m_chipNegativeCrosstalk
to simulate opposite polarity crosstalk among channels on chip
double m_QE[MAXPTS_QE]
quantum efficiency curve
std::unordered_set< unsigned int > m_copperIDs
COPPER ID's.
double m_aeroRefIndex[MAX_N_ALAYERS]
Array of aerogel refracive indices.
std::vector< double > m_fFi
angular coordinate of detector modules
double m_windowAbsorbtion
absorbtion probability for photons internally reflected in HAPD window
std::map< std::pair< unsigned, int >, unsigned > m_copper2merger
mapping of merger boards to cooper boards
std::vector< TVector2 > m_chipLocPos
vector holding chip positions (in detector module local coordinates)
bool m_init
True if parametrization is already initialized.
int m_nPadX
Number of detector module pads in one direction.
int m_nPads
total number of pads in a sensor
std::vector< uint8_t > m_ChannelQE
Channel QE at 400nm.
std::vector< double > m_fFiMod
angle of detector module
double m_mirrorStartAng
The angle of first corner of mirror plates polygon.
double m_aeroThickness[MAX_N_ALAYERS]
Array of aerogel thickness.
int m_nMirrors
Number of mirrors segments.
std::map< int, std::vector< unsigned > > m_merger2feb
mapping of front-end boards to mergers
std::vector< int > m_ncol
m_ncol[i] gives number of detector modules in i-th detector ring (first one is the outer most)
int m_tileNr
Number of aerogel tiles in radial direction.
double m_mirrorThickness
Thickness of mirror plates.
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
TVector3 getOrigin(int copyno)
get the position of copyno-th HAPD module origin
TVector3 getMirrorNormal(int mirID)
get normal vector of mirID-th mirror plate
int getNphiTiles(int nRing)
get number of aerogel tiles in each radial ring
bool isInit()
returns true if parametrisation is initialized, false otherwise
int getDetectorXPadNumber()
get number of pads of detector module (in one direction)
int getMergerFromCooper(int cooperID, int finesse)
returns merger board ID from cooperID and finesse
void setAeroTransLength(int ilayer, double trlen)
set transmission length of "ilayer" aerogel layer
int getBoardFromMerger(int mergerID, int slot)
returns front-end board ID from merger ID and slot
double getWindowAbsorbtion()
get absorbtion probability for photons internally reflected in HAPD window
int getNMirrors()
get number of mirror plates
double getMirrorsStartAngle()
get the phi angle of first corner of mirror polygon
void mirrorPositions(const GearDir &content)
calculates parameters of all mirror planes (normal vector and point on plane)
double getAerogelZPosition(int ilayer)
get z position of "ilayer" aerogel layer
int getNrTiles()
get number of aerogel tiles in radial direction (number of rings)
double getDetectorZPosition()
get z position of detector plane (starting z)
void setAerogelThickness(int ilayer, double thick)
set thickness of "ilayer" aerogel layer
double getColEffi() const
get HAPD collection efficiency.
double getSensitiveSurfaceSize() const
get size of detector sensitive surface (size of two chips + gap between)
void modulesPositionSimple(const GearDir &content)
gets modules positions directly from xml file (for simple "beamtest" geometry).
void frontEndMapping(const GearDir &content)
reads front-end board to merger to cooper mapping from an xml file
void padPositions()
calculates the centers of channels in local (detector module) and global coordinates
double getAeroTubeRout()
get the outer size of aerogel tube
double getTileGap()
get size of the gap between aerogel tiles
TVector3 getChannelCenterGlob(int modID, int chanID)
get center of chanID channel of modID detector module (in global coordinates)
int getChannelID(TVector2 hit)
get ID number of channel containing point "hit" (hit is in detector module local coordinates)
TVector2 getChannelCenterLoc(int chID)
get center position of chID channel (in detector module local coordinates)
int getAerogelTileID(TVector2 locpos)
returns ID number of aerogel tile containing locpos (x-y) point.
int getNBoardsOnMerger(int mergerID)
returns number of front-end boards connected to the merger
void Initialize(const GearDir &content)
calculates detector parameters needed for geometry build and reconstruction.
double getDetectorWindowRefIndex()
get refractive index of detector module window
void setAerogelZPosition(int ilayer, double zPos)
set z position of "ilayer" aerogel layer
TVector3 getMirrorPoint(int mirID)
get one point lying on mirID-th mirror plate
int getNumberOfAerogelRadiators()
get number of aerogel layers
double getDetectorPadSize()
get detectors module pad size
void read(const GearDir &content)
gets geometry parameters from gearbox.
double getDetectorWindowThickness()
get thickness of detector module window
void Print(void) const
Print some debug information.
void mirrorPositionSimple(const GearDir &content)
Gets mirrors positions directly from xml file (in case of simple "beamtest" geometry).
double getAerogelThickness(int ilayer)
get thickness of "ilayer" aerogel layer
TVector2 getChipLocPos(int chipID)
get center position of chipID-th chip of detector module (in detector module local coordinates)
double getMirrorsZPosition()
get the z position of mirror plates (starting z)
static ARICHGeometryPar * Instance()
Static method to get a reference to the ARICHGeometryPar instance.
double getAerogelTransmissionLength(int ilayer)
get transmission length of "ilayer" aerogel layer
int getChipID(TVector2 locpos)
get ID number of chip containing point "locpos"
void setAeroRefIndex(int ilayer, double n)
set refractive index of "ilayer" aerogel layer
virtual ~ARICHGeometryPar()
Destructor.
double getAerogelRefIndex(int ilayer)
get refractive index of "ilayer" aerogel layer
double getModAngle(int copyno)
get the angle of copyno-th HAPD rotation
static ARICHGeometryPar * p_B4ARICHGeometryParDB
Pointer that saves the instance of this class.
G4ThreeVector getOriginG4(int copyNo)
get the position of copyNo-th HAPD module origin (returns G4ThreeVector)
void readMirrorAlignment(const GearDir &content)
Reads mirror plates alignment parameters.
int getNMCopies() const
get the total number of HAPD modules
void setActive(int module, int channel, bool val)
set the channel on/off
void initDetectorMask(int nmodules)
initialize detector mask
void setWindowRefIndex(double refInd)
set detector module window refractive index
void chipLocPosition()
calculates the centers of chips in detector module local coordinates
void readModuleInfo(const GearDir &content)
read parameters of each module from gearbox.
bool isSimple()
returns true if parametrisation is initialized with simple geometry (beamtest)
double getChipNegativeCrosstalk()
get factor to suppress p.e. detection efficiency due to negative polarity crosstalk among chip channe...
bool isActive(int module, int channel)
check the activity of the channel
double getChannelQE(int moduleID, int channelID)
get channel quantum efficiency
double QE(double e) const
get photocathode quantum efficiency at energy e.
double getAeroTubeRin()
get the inner size of aerogel tube
int getCopyNo(TVector3 hit)
get the copy number of HAPD module containing point "hit"
void modulesPosition(const GearDir &content)
calculates the positions of HAPD modules, with the parameters from xml.
double getQEScaling()
get QE scaling factor for photons internally reflected in HAPD window
Abstract base class for different kinds of events.