d48cca74 |
1 | #ifndef AliRICHParam_h |
2 | #define AliRICHParam_h |
3 | |
c712cb2f |
4 | #include <TObject.h> |
5 | #include <TMath.h> |
6 | #include <TVector3.h> |
7 | #include <TRandom.h> |
9e23b054 |
8 | |
ed3ceb24 |
9 | |
10 | static const int kNCH=7; //number of RICH chambers |
11 | static const int kNpadsX = 144; //number of pads along X in single chamber |
12 | static const int kNpadsY = 160; //number of pads along Y in single chamber |
13 | static const int kBad=-101; //useful static const to mark initial (uninitalised) values |
14 | |
15 | |
16 | static const int kadc_satm = 4096; //dynamic range (10 bits) |
17 | static const int kCerenkov=50000050; //??? go to something more general like TPDGCode |
18 | static const int kFeedback=50000051; //??? go to something more general like TPDGCode |
19 | |
20 | |
d48cca74 |
21 | class AliRICHParam :public TObject |
22 | { |
23 | public: |
c712cb2f |
24 | AliRICHParam() {;} |
08479a10 |
25 | virtual ~AliRICHParam() {;} |
ed3ceb24 |
26 | static const Int_t NpadsX() {return kNpadsX;} |
27 | static const Int_t NpadsY() {return kNpadsY;} |
28 | static Int_t NpadsXsec() {return NpadsX()/3;} |
29 | static Int_t NpadsYsec() {return NpadsY()/2;} |
c712cb2f |
30 | static Double_t DeadZone() {return 2.6;} |
31 | static Double_t PadSizeX() {return 0.84;} |
32 | static Double_t PadSizeY() {return 0.8;} |
33 | static Double_t SectorSizeX() {return NpadsX()*PadSizeX()/3;} |
34 | static Double_t SectorSizeY() {return NpadsY()*PadSizeY()/2;} |
35 | static Double_t PcSizeX() {return NpadsX()*PadSizeX()+2*DeadZone();} |
36 | static Double_t PcSizeY() {return NpadsY()*PadSizeY()+DeadZone();} |
37 | static Double_t WirePitch() {return PadSizeX()/2;} |
38 | static Double_t SizeX() {return 132.6;} |
39 | static Double_t SizeY() {return 26;} |
40 | static Double_t SizeZ() {return 136.7;} |
41 | static Double_t Offset() {return 490+1.267;} |
42 | static Double_t AngleYZ() {return 19.5*TMath::DegToRad();} |
43 | static Double_t AngleXY() {return 20*TMath::DegToRad();} |
44 | static Double_t FreonThickness() {return 1.5;} |
45 | static Double_t QuartzThickness() {return 0.5;} |
46 | static Double_t GapThickness() {return 8.0;} |
47 | static Double_t RadiatorToPads() {return FreonThickness()+QuartzThickness()+GapThickness();} |
48 | static Double_t ProximityGapThickness() {return 0.4;} |
49 | static Double_t AnodeCathodeGap() {return 0.2;} |
50 | static Double_t QuartzLength() {return 133;} |
51 | static Double_t QuartzWidth() {return 127.9;} |
52 | static Double_t OuterFreonLength() {return 133;} |
53 | static Double_t OuterFreonWidth() {return 41.3;} |
54 | static Double_t InnerFreonLength() {return 133;} |
55 | static Double_t InnerFreonWidth() {return 41.3;} |
56 | static Double_t IonisationPotential() {return 26.0e-9;} |
9d6f9427 |
57 | static Double_t MathiesonDeltaX() {return 5*0.18;} |
58 | static Double_t MathiesonDeltaY() {return 5*0.18;} |
c712cb2f |
59 | static Int_t MaxQdc() {return 4095;} |
60 | static Double_t QdcSlope(Int_t sec) {HV(sec);return 27;} |
61 | static Double_t AlphaFeedback(Int_t sec) {HV(sec);return 0.036;} |
853634d3 |
62 | |
e33758d8 |
63 | static Bool_t IsResolveClusters() {return fgIsResolveClusters;} |
c712cb2f |
64 | static Bool_t IsWireSag() {return fgIsWireSag;} |
65 | static Int_t HV(Int_t) {return fgHV;} |
e33758d8 |
66 | static Double_t AngleRot() {return fgAngleRot*TMath::DegToRad();} |
67 | static void SetResolveClusters(Bool_t a){fgIsResolveClusters=a;} |
68 | static void SetWireSag(Bool_t status) {fgIsWireSag=status;} |
69 | static void SetHV(Int_t hv) {fgHV =hv;} |
08479a10 |
70 | static void SetAngleRot(Double_t rot) {fgAngleRot =rot;} |
c712cb2f |
71 | |
9d6f9427 |
72 | inline static Double_t Mathieson(Double_t lx1,Double_t lx2,Double_t ly1,Double_t ly2); |
c712cb2f |
73 | inline static void Loc2Area(TVector3 hitX3,Int_t &padxMin,Int_t &padyMin,Int_t &padxMax,Int_t &padyMax); |
74 | inline static Int_t PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t aListX[4],Int_t aListY[4]); |
75 | inline static Int_t Loc2Pad(Double_t x,Double_t y,Int_t &padx,Int_t &pady); |
76 | inline static void Pad2Loc(Int_t padx,Int_t pady,Double_t &x,Double_t &y); |
77 | inline static Double_t GainVariation(Double_t y,Int_t sector); |
78 | inline static Int_t Loc2TotQdc(TVector3 locX3,Double_t eloss,Int_t iPid, Int_t §or); |
79 | inline static Double_t Loc2PadFrac(TVector3 locX3,Int_t padx,Int_t pady); |
543d5224 |
80 | |
c712cb2f |
81 | inline static Int_t Loc2Sec(Double_t &x,Double_t &y); |
82 | inline static Int_t Pad2Sec(Int_t &padx,Int_t &pady); |
ed3ceb24 |
83 | static Int_t Sector(Int_t padx,Int_t pady) {return Pad2Sec(padx,pady);} |
08479a10 |
84 | inline Bool_t IsOverTh(Int_t iChamber, Int_t x, Int_t y, Double_t q); |
85 | static Int_t NsigmaTh() {return fgNsigmaTh;} |
86 | static Float_t SigmaThMean() {return fgSigmaThMean;} |
87 | static Float_t SigmaThSpread() {return fgSigmaThSpread;} |
88 | void GenSigmaThMap(); |
d48cca74 |
89 | protected: |
08479a10 |
90 | static Bool_t fgIsWireSag; //is wire sagitta taken into account |
91 | static Bool_t fgIsResolveClusters; //performs declustering or not |
92 | static Int_t fgHV; //HV applied to anod wires |
93 | static Double_t fgAngleRot; //rotation of RICH from up postion (0,0,490)cm |
ed3ceb24 |
94 | static Float_t fSigmaThMap[kNCH][kNpadsX][kNpadsY]; // sigma of the pedestal distributions for all pads |
08479a10 |
95 | static Int_t fgNsigmaTh; // n. of sigmas to cut for zero suppression |
96 | static Float_t fgSigmaThMean; // sigma threshold value |
97 | static Float_t fgSigmaThSpread; // spread of sigma |
c712cb2f |
98 | ClassDef(AliRICHParam,4) //RICH main parameters |
d48cca74 |
99 | }; |
c2c6679b |
100 | //__________________________________________________________________________________________________ |
c712cb2f |
101 | Int_t AliRICHParam::PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t listY[4]) |
102 | { |
103 | Int_t nPads=0; |
ed3ceb24 |
104 | if(iPadY!=NpadsY()&&iPadY!=NpadsYsec()) {listX[nPads]=iPadX; listY[nPads]=iPadY+1; nPads++;} |
105 | if(iPadX!=NpadsXsec()&&iPadX!=2*NpadsXsec()&&iPadX!=NpadsX()){listX[nPads]=iPadX+1; listY[nPads]=iPadY; nPads++;} |
106 | if(iPadY!=1&&iPadY!=NpadsYsec()+1) {listX[nPads]=iPadX; listY[nPads]=iPadY-1; nPads++;} |
107 | if(iPadX!=1&&iPadX!=NpadsXsec()+1&&iPadX!=2*NpadsXsec()+1) {listX[nPads]=iPadX-1; listY[nPads]=iPadY; nPads++;} |
108 | |
c712cb2f |
109 | return nPads; |
110 | }//Pad2ClosePads() |
111 | //__________________________________________________________________________________________________ |
112 | Int_t AliRICHParam::Loc2Sec(Double_t &x,Double_t &y) |
113 | {//Determines sector for a given hit (x,y) and trasform this point to the local system of that sector. |
114 | Int_t sector=kBad; |
6a005d35 |
115 | Double_t x1=-PcSizeX()/2; Double_t x2=-SectorSizeX()/2-DeadZone(); Double_t x3=-SectorSizeX()/2; |
116 | Double_t x4= SectorSizeX()/2; Double_t x5= SectorSizeX()/2+DeadZone(); Double_t x6= PcSizeX()/2; |
c712cb2f |
117 | |
6a005d35 |
118 | if (x>=x1&&x<=x2) {sector=1;x+=PcSizeX()/2;} |
119 | else if(x>=x3&&x<=x4) {sector=2;x+=SectorSizeX()/2;} |
120 | else if(x>=x5&&x<=x6) {sector=3;x-=SectorSizeX()/2+DeadZone();} |
121 | else {return kBad;} //in dead zone |
c712cb2f |
122 | |
c1863e3c |
123 | if (y>=-PcSizeY()/2 &&y<=-DeadZone()/2) {y+=PcSizeY()/2; return sector;} |
6a005d35 |
124 | else if(y> -DeadZone()/2 &&y< DeadZone()/2) {return kBad;} //in dead zone |
c1863e3c |
125 | else if(y>= DeadZone()/2 &&y<= PcSizeY()/2) {y-=DeadZone()/2; return sector+3;} |
6a005d35 |
126 | else {return kBad;} |
c712cb2f |
127 | }//Loc2Sec(Double_t x, Double_t y) |
c2c6679b |
128 | //__________________________________________________________________________________________________ |
c712cb2f |
129 | Int_t AliRICHParam::Pad2Sec(Int_t &padx, Int_t &pady) |
130 | {//Determines sector for a given pad (padx,pady) and trasform this point to the local system of that sector. |
131 | Int_t sector=kBad; |
132 | if (padx>=1 &&padx<=NpadsXsec()) {sector=1;} |
133 | else if(padx> NpadsXsec() &&padx<=NpadsXsec()*2) {sector=2;padx-=NpadsXsec();} |
134 | else if(padx> NpadsXsec()*2&&padx<=NpadsX()) {sector=3;padx-=NpadsXsec()*2;} |
135 | else {return kBad;} |
136 | |
c1863e3c |
137 | if (pady>=1 &&pady<= NpadsYsec()) {return sector;} |
138 | else if(pady>NpadsYsec()&&pady<= NpadsY()) {pady-=NpadsYsec();return sector+3;} |
c712cb2f |
139 | else {return kBad;} |
140 | }//Pad2Sec() |
141 | //__________________________________________________________________________________________________ |
142 | Int_t AliRICHParam::Loc2Pad(Double_t x, Double_t y, Int_t &padx, Int_t &pady) |
143 | {//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y) |
144 | //count starts in lower left corner from 1,1 to 144,180 |
145 | |
146 | padx=pady=kBad; |
147 | Int_t sector=Loc2Sec(x,y); |
148 | if(sector==kBad) return sector; |
149 | |
150 | padx=Int_t(x/PadSizeX())+1; |
151 | if(padx>NpadsXsec()) padx= NpadsXsec(); |
c1863e3c |
152 | if(sector==2||sector==5) padx+=NpadsXsec(); |
153 | else if(sector==3||sector==6) padx+=NpadsXsec()*2; |
c712cb2f |
154 | |
155 | pady=Int_t(y/PadSizeY())+1; |
156 | if(pady>NpadsYsec()) padx= NpadsYsec(); |
157 | if(sector>0) pady+=NpadsYsec(); |
158 | |
159 | return sector; |
160 | }//Loc2Pad() |
161 | //__________________________________________________________________________________________________ |
162 | void AliRICHParam::Pad2Loc(Int_t padx,Int_t pady,Double_t &x,Double_t &y) |
163 | { |
164 | Int_t sector=Pad2Sec(padx,pady); |
c1863e3c |
165 | if(sector>3) |
c712cb2f |
166 | y=0.5*DeadZone()+pady*PadSizeY()-0.5*PadSizeY(); |
167 | else{ |
c712cb2f |
168 | y=-0.5*PcSizeY()+pady*PadSizeY()-0.5*PadSizeY(); |
169 | } |
c1863e3c |
170 | if(sector==1||sector==4) |
c712cb2f |
171 | x=-0.5*PcSizeX()+padx*PadSizeX()-0.5*PadSizeX(); |
c1863e3c |
172 | else if(sector==2||sector==5) |
c712cb2f |
173 | x=-0.5*SectorSizeX()+padx*PadSizeX()-0.5*PadSizeX(); |
c2c6679b |
174 | else |
c712cb2f |
175 | x= 0.5*SectorSizeX()+DeadZone()+padx*PadSizeX()-0.5*PadSizeX(); |
176 | return; |
177 | }//Pad2Loc() |
c60862bf |
178 | //__________________________________________________________________________________________________ |
c712cb2f |
179 | Double_t AliRICHParam::GainVariation(Double_t y,Int_t sector) |
c60862bf |
180 | { |
ed3ceb24 |
181 | //returns % of gain degradation due to wire sagita |
c712cb2f |
182 | if(IsWireSag()){ |
183 | if(y>0) y-=SectorSizeY()/2; else y+=SectorSizeY()/2; |
184 | switch(HV(sector)){ |
ed3ceb24 |
185 | case 2150: return 9e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0316*TMath::Power(y,2)-3e-4*y+25.367;//% |
186 | case 2100: return 8e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0283*TMath::Power(y,2)-2e-4*y+23.015; |
187 | case 2050: return 7e-6*TMath::Power(y,4)+1e-7*TMath::Power(y,3)-0.0254*TMath::Power(y,2)-2e-4*y+20.888; |
188 | case 2000: return 6e-6*TMath::Power(y,4)+8e-8*TMath::Power(y,3)-0.0227*TMath::Power(y,2)-1e-4*y+18.961; |
189 | default: return 0; |
c712cb2f |
190 | } |
191 | }else |
192 | return 0; |
193 | } |
194 | //__________________________________________________________________________________________________ |
195 | Int_t AliRICHParam::Loc2TotQdc(TVector3 x3,Double_t eloss,Int_t iPid,Int_t §or) |
196 | {//calculates the total charge produced by the hit given in local refenrence system |
197 | Double_t x=x3.X(),y=x3.Y(); |
198 | |
199 | sector=Loc2Sec(x,y); |
200 | |
201 | Double_t gain=QdcSlope(sector)*(1+GainVariation(x3.Y(),sector)/100); |
202 | |
203 | |
204 | if(iPid>50000){//it's photon => 1 electron |
205 | return Int_t(gain*-TMath::Log(gRandom->Rndm())); |
206 | }else{//it's MIP |
207 | Int_t iNelectrons=Int_t(eloss/IonisationPotential()); |
208 | if(iNelectrons==0) return 0; |
209 | Double_t qdc=0; |
210 | for(Int_t i=1;i<=iNelectrons;i++) qdc+=gain*-TMath::Log(gRandom->Rndm()); |
211 | return Int_t(qdc); |
212 | } |
543d5224 |
213 | } |
c2c6679b |
214 | //__________________________________________________________________________________________________ |
c712cb2f |
215 | Double_t AliRICHParam::Loc2PadFrac(TVector3 hitX3,Int_t padx,Int_t pady) |
216 | {// |
217 | Double_t padXcenter=0,padYcenter=0; Pad2Loc(padx,pady,padXcenter,padYcenter); |
218 | |
219 | //correction to the position of the nearest wire |
220 | |
221 | Double_t normXmin=(hitX3.X()-padXcenter-PadSizeX()/2) /AnodeCathodeGap(); |
222 | Double_t normXmax=(hitX3.X()-padXcenter+PadSizeX()/2) /AnodeCathodeGap(); |
223 | Double_t normYmin=(hitX3.Y()-padYcenter-PadSizeY()/2) /AnodeCathodeGap(); |
224 | Double_t normYmax=(hitX3.Y()-padYcenter+PadSizeY()/2) /AnodeCathodeGap(); |
225 | |
9d6f9427 |
226 | return Mathieson(normXmin,normYmin,normXmax,normYmax); |
c712cb2f |
227 | }//Loc2PadQdc() |
228 | //__________________________________________________________________________________________________ |
9d6f9427 |
229 | Double_t AliRICHParam::Mathieson(Double_t xMin,Double_t yMin,Double_t xMax,Double_t yMax) |
c712cb2f |
230 | {//see NIM A370(1988)602-603 |
53fd478b |
231 | const Double_t kSqrtKx3=0.77459667;const Double_t kX2=0.962;const Double_t kX4=0.379; |
232 | const Double_t kSqrtKy3=0.77459667;const Double_t kY2=0.962;const Double_t kY4=0.379; |
c712cb2f |
233 | |
53fd478b |
234 | Double_t ux1=kSqrtKx3*TMath::TanH(kX2*xMin); |
235 | Double_t ux2=kSqrtKx3*TMath::TanH(kX2*xMax); |
236 | Double_t uy1=kSqrtKy3*TMath::TanH(kY2*yMin); |
237 | Double_t uy2=kSqrtKy3*TMath::TanH(kY2*yMax); |
238 | return 4*kX4*(TMath::ATan(ux2)-TMath::ATan(ux1))*kY4*(TMath::ATan(uy2)-TMath::ATan(uy1)); |
c712cb2f |
239 | } |
240 | //__________________________________________________________________________________________________ |
241 | void AliRICHParam::Loc2Area(TVector3 hitX3,Int_t &iPadXmin,Int_t &iPadYmin,Int_t &iPadXmax,Int_t &iPadYmax) |
242 | {//calculates the area of disintegration for a given hit. Area is a rectangulare set pf pads |
243 | //defined by its left-down and right-up coners |
244 | // hitX3.SetX(Shift2NearestWire(hitX3.X()); |
9d6f9427 |
245 | Loc2Pad(hitX3.X()-MathiesonDeltaX(),hitX3.Y()-MathiesonDeltaY(),iPadXmin,iPadYmin); |
246 | Loc2Pad(hitX3.X()+MathiesonDeltaX(),hitX3.Y()+MathiesonDeltaY(),iPadXmax,iPadYmax); |
c712cb2f |
247 | }// |
08479a10 |
248 | //__________________________________________________________________________________________________ |
249 | Bool_t AliRICHParam::IsOverTh(Int_t iChamber, Int_t x, Int_t y, Double_t q) |
250 | {// Calculate the new charge subtracting pedestal and if the current digit is over threshold |
251 | if(q>NsigmaTh()*fSigmaThMap[iChamber-1][x-1][y-1]) return kTRUE; else return kFALSE; |
252 | }// |
d48cca74 |
253 | #endif //AliRICHParam_h |