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