Project
Loading...
Searching...
No Matches
Param.h
Go to the documentation of this file.
1// Copyright 2020-2022 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef ALICEO2_HMPID_PARAM_H_
13#define ALICEO2_HMPID_PARAM_H_
14
15#include <cstdio>
16#include <TMath.h>
17#include <TNamed.h> //base class
18#include <TGeoManager.h> //Instance()
19#include <TVector3.h> //Lors2Mars() Mars2Lors()
20
21class TGeoVolume;
22class TGeoHMatrix;
23
24namespace o2
25{
26namespace hmpid
27{
28
29class Param
30{
31
32 public:
33 // ctor&dtor
34 virtual ~Param()
35 {
36 if (fgInstance) {
37 for (Int_t i = 0; i < 7; i++) {
38 delete mM[i];
39 mM[i] = nullptr;
40 };
41 fgInstance = nullptr;
42 }
43 }
44
45 void print(Option_t* opt = "") const; // print current parametrization
46
47 static Param* instance(); // pointer to Param singleton
48 static Param* instanceNoGeo(); // pointer to Param singleton without geometry.root for MOOD, displays, ...
49 // geo info
50 enum EChamberData { kMinCh = 0,
51 kMaxCh = 6,
52 kMinPc = 0,
53 kMaxPc = 5 }; // Segmenation
54 enum EPadxData { kPadPcX = 80,
55 kMinPx = 0,
56 kMaxPx = 79,
57 kMaxPcx = 159 }; // Segmentation structure along x
58 enum EPadyData { kPadPcY = 48,
59 kMinPy = 0,
60 kMaxPy = 47,
61 kMaxPcy = 143 }; // Segmentation structure along y
62 // The electronics takes the 32bit int as: first 9 bits for the pedestal and the second 9 bits for threshold
63 // - values below should be within range
67 kPadSigmaMasked = 20 }; // One can go up to 5 sigma cut, overflow is protected in AliHMPIDCalib
68
69 static float r2d() { return 57.2957795; }
70 static float sizePadX() { return fgCellX; } // pad size x, [cm]
71 static float sizePadY() { return fgCellY; } // pad size y, [cm]
72 static float sizeHalfPadX() { return fgHalfCellX; } // half pad size x, [cm]
73 static float sizeHalfPadY() { return fgHalfCellY; } // half pad size y, [cm]
74
75 static float sizePcX() { return fgPcX; } // PC size x
76 static float sizePcY() { return fgPcY; } // PC size y
77 static float maxPcX(Int_t iPc) { return fgkMaxPcX[iPc]; } // PC limits
78 static float maxPcY(Int_t iPc) { return fgkMaxPcY[iPc]; } // PC limits
79 static float minPcX(Int_t iPc) { return fgkMinPcX[iPc]; } // PC limits
80 static float minPcY(Int_t iPc) { return fgkMinPcY[iPc]; } // PC limits
81 static Int_t nsig() { return fgNSigmas; } // Getter n. sigmas for noise
82 static float sizeAllX() { return fgAllX; } // all PCs size x, [cm]
83 static float sizeAllY() { return fgAllY; } // all PCs size y, [cm]
84
85 // center of the pad x, [cm]
86 static float lorsX(Int_t pc, Int_t padx) { return (padx + 0.5) * sizePadX() + fgkMinPcX[pc]; }
87 // center of the pad y, [cm]
88 static float lorsY(Int_t pc, Int_t pady) { return (pady + 0.5) * sizePadY() + fgkMinPcY[pc]; }
89
90 // PhiMin (degree) of the camber ch
91 float chPhiMin(Int_t ch) { return lors2Mars(ch, lorsX(ch, kMinPx) - mX, lorsY(ch, kMinPy) - mY).Phi() * r2d(); }
92 // ThMin (degree) of the camber ch
93 float chThMin(Int_t ch) { return lors2Mars(ch, lorsX(ch, kMinPx) - mX, lorsY(ch, kMinPy) - mY).Theta() * r2d(); }
94 // PhiMax (degree) of the camber ch
95 float chPhiMax(Int_t ch) { return lors2Mars(ch, lorsX(ch, kMaxPcx) - mX, lorsY(ch, kMaxPcy) - mY).Phi() * r2d(); }
96 // ThMax (degree) of the camber ch
97 float chThMax(Int_t ch) { return lors2Mars(ch, lorsX(ch, kMaxPcx) - mX, lorsY(ch, kMaxPcy) - mY).Theta() * r2d(); }
98
99 static void lors2Pad(float x, float y, Int_t& pc, Int_t& px, Int_t& py); //(x,y)->(pc,px,py)
100
101 static bool isOverTh(float q) { return q >= fgThreshold; } // is digit over threshold?
102
103 bool getInstType() const { return fgInstanceType; } // return if the instance is from geom or ideal
104
105 static bool isInDead(float x, float y); // is the point in dead area?
106 static bool isDeadPad(Int_t padx, Int_t pady, Int_t ch); // is a dead pad?
107
108 inline void setChStatus(Int_t ch, bool status = kTRUE);
109 inline void setSectStatus(Int_t ch, Int_t sect, bool status);
110 inline void setPcStatus(Int_t ch, Int_t pc, bool status);
111 inline void printChStatus(Int_t ch);
112 inline void setGeomAccept();
113
114 static Int_t inHVSector(float y); // find HV sector
115 static Int_t radiator(float y)
116 {
117 if (inHVSector(y) < 0) {
118 return -1;
119 }
120 return inHVSector(y) / 2;
121 }
122
123 // height in the radiator to estimate temperature from gradient
124 static double hinRad(float y)
125 {
126 if (radiator(y) < 0) {
127 return -1;
128 }
129 return y - radiator(y) * fgkMinPcY[radiator(y)];
130 }
131 // is point inside chamber boundaries?
132 static bool isInside(float x, float y, float d = 0)
133 {
134 return x > -d && y > -d && x < fgkMaxPcX[kMaxPc] + d && y < fgkMaxPcY[kMaxPc] + d;
135 }
136
137 // For optical properties
138 static double ePhotMin() { return 5.5; } //
139 static double ePhotMax() { return 8.5; } // Photon energy range,[eV]
140 static double nIdxRad(double eV, double temp)
141 {
142 return TMath::Sqrt(1 + 0.554 * (1239.84 / eV) * (1239.84 / eV) / ((1239.84 / eV) * (1239.84 / eV) - 5769)) - 0.0005 * (temp - 20);
143 }
144 static double nIdxWin(double eV) { return TMath::Sqrt(1 + 46.411 / (10.666 * 10.666 - eV * eV) + 228.71 / (18.125 * 18.125 - eV * eV)); }
145 static double nMgF2Idx(double eV) { return 1.7744 - 2.866e-3 * (1239.842609 / eV) + 5.5564e-6 * (1239.842609 / eV) * (1239.842609 / eV); } // MgF2 idx of trasparency system
146 static double nIdxGap(double eV) { return 1 + 0.12489e-6 / (2.62e-4 - eV * eV / 1239.84 / 1239.84); }
147 static double lAbsRad(double eV) { return (eV < 7.8) * (gausPar(eV, 3.20491e16, -0.00917890, 0.742402) + gausPar(eV, 3035.37, 4.81171, 0.626309)) + (eV >= 7.8) * 0.0001; }
148 static double lAbsWin(double eV) { return (eV < 8.2) * (818.8638 - 301.0436 * eV + 36.89642 * eV * eV - 1.507555 * eV * eV * eV) + (eV >= 8.2) * 0.0001; } // fit from DiMauro data 28.10.03
149 static double lAbsGap(double eV) { return (eV < 7.75) * 6512.399 + (eV >= 7.75) * 3.90743e-2 / (-1.655279e-1 + 6.307392e-2 * eV - 8.011441e-3 * eV * eV + 3.392126e-4 * eV * eV * eV); }
150 static double qEffCSI(double eV) { return (eV > 6.07267) * 0.344811 * (1 - exp(-1.29730 * (eV - 6.07267))); } // fit from DiMauro data 28.10.03
151 static double gausPar(double x, double a1, double a2, double a3) { return a1 * TMath::Exp(-0.5 * ((x - a2) / a3) * ((x - a2) / a3)); }
152
153 // find the temperature of the C6F14 in a given point with coord. y (in x is uniform)
154 inline static double findTemp(double tLow, double tUp, double y);
155
156 double getEPhotMean() const { return mPhotEMean; }
157 double getRefIdx() const { return mRefIdx; } // running refractive index
158
159 double meanIdxRad() const { return nIdxRad(mPhotEMean, mTemp); }
160 double meanIdxWin() const { return nIdxWin(mPhotEMean); }
161 //
162 float distCut() const { return 1.0; } //<--TEMPORAR--> to be removed in future. Cut for MIP-TRACK residual
163 float qCut() const { return 100; } //<--TEMPORAR--> to be removed in future. Separation PHOTON-MIP charge
164 float multCut() const { return 30; } //<--TEMPORAR--> to be removed in future. Multiplicity cut to activate WEIGHT procedure
165
166 double radThick() const { return 1.5; } //<--TEMPORAR--> to be removed in future. Radiator thickness
167 double winThick() const { return 0.5; } //<--TEMPORAR--> to be removed in future. Window thickness
168 double gapThick() const { return 8.0; } //<--TEMPORAR--> to be removed in future. Proximity gap thickness
169 double winIdx() const { return 1.5787; } //<--TEMPORAR--> to be removed in future. Mean refractive index of WIN material (SiO2)
170 double gapIdx() const { return 1.0005; } //<--TEMPORAR--> to be removed in future. Mean refractive index of GAP material (CH4)
171
172 static Int_t stack(Int_t evt = -1, Int_t tid = -1); // Print stack info for event and tid
173 static Int_t stackCount(Int_t pid, Int_t evt); // Counts stack particles of given sort in given event
174 static void idealPosition(Int_t iCh, TGeoHMatrix* m); // ideal position of given chamber
175 // trasformation methodes
176 void lors2Mars(Int_t c, double x, double y, double* m, Int_t pl = kPc) const
177 {
178 double z = 0;
179 switch (pl) {
180 case kPc:
181 z = 8.0;
182 break;
183 case kAnod:
184 z = 7.806;
185 break;
186 case kRad:
187 z = -1.25;
188 break;
189 }
190 double l[3] = {x - mX, y - mY, z};
191 mM[c]->LocalToMaster(l, m);
192 }
193 TVector3 lors2Mars(Int_t c, double x, double y, Int_t pl = kPc) const
194 {
195 double m[3];
196 lors2Mars(c, x, y, m, pl);
197 return TVector3(m);
198 } // MRS->LRS
199 void mars2Lors(Int_t c, double* m, double& x, double& y) const
200 {
201 double l[3];
202 mM[c]->MasterToLocal(m, l);
203 x = l[0] + mX;
204 y = l[1] + mY;
205 } // MRS->LRS
206 void mars2LorsVec(Int_t c, double* m, double& th, double& ph) const
207 {
208 double l[3];
209 mM[c]->MasterToLocalVect(m, l);
210 float pt = TMath::Sqrt(l[0] * l[0] + l[1] * l[1]);
211 th = TMath::ATan(pt / l[2]);
212 ph = TMath::ATan2(l[1], l[0]);
213 }
214 void lors2MarsVec(Int_t c, double* m, double* l) const { mM[c]->LocalToMasterVect(m, l); } // LRS->MRS
215 TVector3 norm(Int_t c) const
216 {
217 double n[3];
218 norm(c, n);
219 return TVector3(n);
220 } // norm
221 void norm(Int_t c, double* n) const
222 {
223 double l[3] = {0, 0, 1};
224 mM[c]->LocalToMasterVect(l, n);
225 } // norm
226 void point(Int_t c, double* p, Int_t plane) const { lors2Mars(c, 0, 0, p, plane); } // point of given chamber plane
227
228 void setTemp(double temp) { mTemp = temp; } // set actual temperature of the C6F14
229 void setEPhotMean(double ePhotMean) { mPhotEMean = ePhotMean; } // set mean photon energy
230
231 void setRefIdx(double refRadIdx) { mRefIdx = refRadIdx; } // set running refractive index
232
233 void setNSigmas(Int_t sigmas) { fgNSigmas = sigmas; } // set sigma cut
234 void setThreshold(Int_t thres) { fgThreshold = thres; } // set sigma cut
235 void setInstanceType(bool inst) { fgInstanceType = inst; } // kTRUE if from geomatry kFALSE if from ideal geometry
236 // For PID
237 double sigLoc(double trkTheta, double trkPhi, double ckovTh, double ckovPh, double beta); // error due to cathode segmetation
238 double sigGeom(double trkTheta, double trkPhi, double ckovTh, double ckovPh, double beta); // error due to unknown photon origin
239 double sigCrom(double trkTheta, double trkPhi, double ckovTh, double ckovPh, double beta); // error due to unknonw photon energy
240 double sigma2(double trkTheta, double trkPhi, double ckovTh, double ckovPh); // photon candidate sigma^2
241
242 static double sigmaCorrFact(Int_t iPart, double occupancy); // correction factor for theoretical resolution
243
244 // Mathieson Getters
245
246 static double pitchAnodeCathode() { return fgkD; }
247 static double sqrtK3x() { return fgkSqrtK3x; }
248 static double k2x() { return fgkK2x; }
249 static double k1x() { return fgkK1x; }
250 static double k4x() { return fgkK4x; }
251 static double sqrtK3y() { return fgkSqrtK3y; }
252 static double k2y() { return fgkK2y; }
253 static double k1y() { return fgkK1y; }
254 static double k4y() { return fgkK4y; }
255 //
256 enum EPlaneId { kPc,
258 kAnod }; // 3 planes in chamber
261 kNoPhotAccept = -11 }; // flags for Reconstruction
262
263 protected:
264 static /*const*/ float fgkMinPcX[6]; // limits PC
265 static /*const*/ float fgkMinPcY[6]; // limits PC
266 static /*const*/ float fgkMaxPcX[6]; // limits PC
267 static /*const*/ float fgkMaxPcY[6];
268
269 static bool fgMapPad[160][144][7]; // map of pads to evaluate if they are active or dead (160,144) pads for 7 chambers
270
271 // Mathieson constants
272 // For HMPID --> x direction means parallel to the wires: K3 = 0.66 (NIM A270 (1988) 602-603) fig.1
273 // For HMPID --> y direction means perpendicular to the wires: K3 = 0.90 (NIM A270 (1988) 602-603) fig.2
274 //
275
276 static const double fgkD; // ANODE-CATHODE distance 0.445/2
277
278 static const double fgkSqrtK3x, fgkK2x, fgkK1x, fgkK4x;
279 static const double fgkSqrtK3y, fgkK2y, fgkK1y, fgkK4y;
280 //
281
282 static Int_t fgNSigmas; // sigma Cut
283 static Int_t fgThreshold; // sigma Cut
284 static bool fgInstanceType; // kTRUE if from geomatry kFALSE if from ideal geometry
285
286 static float fgCellX, fgCellY, fgHalfCellX, fgHalfCellY, fgPcX, fgPcY, fgAllX, fgAllY; // definition of HMPID geometric parameters
287 Param(bool noGeo); // default ctor is protected to enforce it to be singleton
288
289 static Param* fgInstance; // static pointer to instance of Param singleton
290
291 TGeoHMatrix* mM[7]; // pointers to matrices defining HMPID chambers rotations-translations
292 float mX; // x shift of LORS with respect to rotated MARS
293 float mY; // y shift of LORS with respect to rotated MARS
294 double mRefIdx; // running refractive index of C6F14
295 double mPhotEMean; // mean energy of photon
296 double mTemp; // actual temparature of C6F14
297 private:
298 Param(const Param& r); // dummy copy constructor
299 Param& operator=(const Param& r); // dummy assignment operator
300
301 ClassDefNV(Param, 1);
302};
303} // namespace hmpid
304} // namespace o2
305#endif
uint64_t exp(uint64_t base, uint8_t exp) noexcept
void print() const
int32_t i
const GPUTPCGMMerger::trackCluster & a1
uint32_t c
Definition RawData.h:2
static float sizeAllX()
Definition Param.h:82
static float sizeHalfPadX()
Definition Param.h:72
static bool isDeadPad(Int_t padx, Int_t pady, Int_t ch)
Definition Param.cxx:475
double winThick() const
Definition Param.h:167
static void idealPosition(Int_t iCh, TGeoHMatrix *m)
Definition Param.cxx:193
static const double fgkD
Definition Param.h:276
static float fgkMinPcX[6]
Definition Param.h:264
static double ePhotMin()
Definition Param.h:138
static Int_t inHVSector(float y)
Definition Param.cxx:521
static Int_t fgNSigmas
Definition Param.h:282
static Int_t fgThreshold
Definition Param.h:283
static const double fgkSqrtK3y
Definition Param.h:279
static bool isInDead(float x, float y)
Definition Param.cxx:461
void setSectStatus(Int_t ch, Int_t sect, bool status)
Definition Param.cxx:569
void setRefIdx(double refRadIdx)
Definition Param.h:231
void setChStatus(Int_t ch, bool status=kTRUE)
Definition Param.cxx:557
double mPhotEMean
Definition Param.h:295
static float fgkMaxPcX[6]
Definition Param.h:266
double getRefIdx() const
Definition Param.h:157
static const double fgkK4x
Definition Param.h:278
static float fgCellX
Definition Param.h:286
static double hinRad(float y)
Definition Param.h:124
void mars2Lors(Int_t c, double *m, double &x, double &y) const
Definition Param.h:199
static Param * instanceNoGeo()
Definition Param.cxx:450
static float fgkMinPcY[6]
Definition Param.h:265
static double nIdxWin(double eV)
Definition Param.h:144
static float maxPcY(Int_t iPc)
Definition Param.h:78
static float fgHalfCellX
Definition Param.h:286
static const double fgkK1y
Definition Param.h:279
static double lAbsRad(double eV)
Definition Param.h:147
static const double fgkK4y
Definition Param.h:279
static float fgAllY
Definition Param.h:286
float distCut() const
Definition Param.h:162
static double k4y()
Definition Param.h:254
void setPcStatus(Int_t ch, Int_t pc, bool status)
Definition Param.cxx:587
void lors2MarsVec(Int_t c, double *m, double *l) const
Definition Param.h:214
static double lAbsGap(double eV)
Definition Param.h:149
static float sizeAllY()
Definition Param.h:83
static double lAbsWin(double eV)
Definition Param.h:148
double sigCrom(double trkTheta, double trkPhi, double ckovTh, double ckovPh, double beta)
Definition Param.cxx:348
float qCut() const
Definition Param.h:163
double mRefIdx
Definition Param.h:294
float chThMin(Int_t ch)
Definition Param.h:93
static double sigmaCorrFact(Int_t iPart, double occupancy)
Definition Param.cxx:413
static double pitchAnodeCathode()
Definition Param.h:246
static float sizeHalfPadY()
Definition Param.h:73
static float fgAllX
Definition Param.h:286
float chThMax(Int_t ch)
Definition Param.h:97
static void lors2Pad(float x, float y, Int_t &pc, Int_t &px, Int_t &py)
Definition Param.cxx:488
void setInstanceType(bool inst)
Definition Param.h:235
static float sizePcX()
Definition Param.h:75
double getEPhotMean() const
Definition Param.h:156
static float lorsY(Int_t pc, Int_t pady)
Definition Param.h:88
static float fgPcX
Definition Param.h:286
float chPhiMin(Int_t ch)
Definition Param.h:91
static float fgHalfCellY
Definition Param.h:286
double meanIdxRad() const
Definition Param.h:159
void norm(Int_t c, double *n) const
Definition Param.h:221
static bool fgInstanceType
Definition Param.h:284
static const double fgkK2x
Definition Param.h:278
void point(Int_t c, double *p, Int_t plane) const
Definition Param.h:226
static Int_t radiator(float y)
Definition Param.h:115
static const double fgkK2y
Definition Param.h:279
static float minPcX(Int_t iPc)
Definition Param.h:79
double mTemp
Definition Param.h:296
void printChStatus(Int_t ch)
Definition Param.cxx:607
static float maxPcX(Int_t iPc)
Definition Param.h:77
TVector3 norm(Int_t c) const
Definition Param.h:215
double radThick() const
Definition Param.h:166
static float fgkMaxPcY[6]
Definition Param.h:267
static Int_t stackCount(Int_t pid, Int_t evt)
static double qEffCSI(double eV)
Definition Param.h:150
void setNSigmas(Int_t sigmas)
Definition Param.h:233
void setTemp(double temp)
Definition Param.h:228
double winIdx() const
Definition Param.h:169
static float sizePadX()
Definition Param.h:70
static double k1y()
Definition Param.h:253
double meanIdxWin() const
Definition Param.h:160
void lors2Mars(Int_t c, double x, double y, double *m, Int_t pl=kPc) const
Definition Param.h:176
double sigGeom(double trkTheta, double trkPhi, double ckovTh, double ckovPh, double beta)
Definition Param.cxx:374
static bool isInside(float x, float y, float d=0)
Definition Param.h:132
static double nIdxGap(double eV)
Definition Param.h:146
static double k2y()
Definition Param.h:252
static float sizePadY()
Definition Param.h:71
bool getInstType() const
Definition Param.h:103
static double nIdxRad(double eV, double temp)
Definition Param.h:140
static Param * instance()
Definition Param.cxx:438
TGeoHMatrix * mM[7]
Definition Param.h:291
float chPhiMax(Int_t ch)
Definition Param.h:95
static double k2x()
Definition Param.h:248
void mars2LorsVec(Int_t c, double *m, double &th, double &ph) const
Definition Param.h:206
static double k1x()
Definition Param.h:249
static double sqrtK3y()
Definition Param.h:251
static const double fgkSqrtK3x
Definition Param.h:278
double gapIdx() const
Definition Param.h:170
static const double fgkK1x
Definition Param.h:278
static double nMgF2Idx(double eV)
Definition Param.h:145
static float fgPcY
Definition Param.h:286
static double findTemp(double tLow, double tUp, double y)
Definition Param.cxx:539
static double k4x()
Definition Param.h:250
void setEPhotMean(double ePhotMean)
Definition Param.h:229
static double sqrtK3x()
Definition Param.h:247
static float sizePcY()
Definition Param.h:76
void setThreshold(Int_t thres)
Definition Param.h:234
static float lorsX(Int_t pc, Int_t padx)
Definition Param.h:86
static float minPcY(Int_t iPc)
Definition Param.h:80
double sigLoc(double trkTheta, double trkPhi, double ckovTh, double ckovPh, double beta)
Definition Param.cxx:310
static float r2d()
Definition Param.h:69
double gapThick() const
Definition Param.h:168
static float fgCellY
Definition Param.h:286
static double ePhotMax()
Definition Param.h:139
double sigma2(double trkTheta, double trkPhi, double ckovTh, double ckovPh)
Definition Param.cxx:283
TVector3 lors2Mars(Int_t c, double x, double y, Int_t pl=kPc) const
Definition Param.h:193
static bool isOverTh(float q)
Definition Param.h:101
@ kPadMeanZeroCharge
Definition Param.h:64
@ kPadSigmaZeroCharge
Definition Param.h:65
float multCut() const
Definition Param.h:164
static Param * fgInstance
Definition Param.h:289
static bool fgMapPad[160][144][7]
Definition Param.h:269
static Int_t stack(Int_t evt=-1, Int_t tid=-1)
virtual ~Param()
Definition Param.h:34
static Int_t nsig()
Definition Param.h:81
static double gausPar(double x, double a1, double a2, double a3)
Definition Param.h:151
void setGeomAccept()
Definition Param.cxx:629
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
const GLfloat * m
Definition glcorearb.h:4066
GLboolean r
Definition glcorearb.h:1233
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...