]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHParam.h
AliRICHDispFast cluster H2 reset added
[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() {;}
853634d3 14 virtual ~AliRICHParam() {;}
c712cb2f 15 static Int_t NpadsX() {return 144;}
16 static Int_t NpadsY() {return 160;}
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;}
46 static Double_t MathiensonDeltaX() {return 5*0.18;}
47 static Double_t MathiensonDeltaY() {return 5*0.18;}
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;}
59 static void SetAngleRot(Double_t rot) {fgAngleRot =rot;}
c712cb2f 60
61 inline static Double_t Mathienson(Double_t lx1,Double_t lx2,Double_t ly1,Double_t ly2);
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);
e33758d8 74
d48cca74 75protected:
e33758d8 76 static Bool_t fgIsWireSag; //is wire sagitta taken into account
77 static Bool_t fgIsResolveClusters; //performs declustering or not
78 static Int_t fgHV; //HV applied to anod wires
79 static Double_t fgAngleRot; //rotation of RICH from up postion (0,0,490)cm
d48cca74 80
c712cb2f 81 ClassDef(AliRICHParam,4) //RICH main parameters
d48cca74 82};
c2c6679b 83//__________________________________________________________________________________________________
c712cb2f 84Int_t AliRICHParam::PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t listY[4])
85{
86 Int_t nPads=0;
87 if(iPadY<NpadsY()){listX[nPads]=iPadX; listY[nPads]=iPadY+1; nPads++;}
88 if(iPadX<NpadsX()){listX[nPads]=iPadX+1; listY[nPads]=iPadY; nPads++;}
89 if(iPadY>1) {listX[nPads]=iPadX; listY[nPads]=iPadY-1; nPads++;}
90 if(iPadX>1) {listX[nPads]=iPadX-1; listY[nPads]=iPadY; nPads++;}
91 return nPads;
92}//Pad2ClosePads()
93//__________________________________________________________________________________________________
94Int_t AliRICHParam::Loc2Sec(Double_t &x,Double_t &y)
95{//Determines sector for a given hit (x,y) and trasform this point to the local system of that sector.
96 Int_t sector=kBad;
6a005d35 97 Double_t x1=-PcSizeX()/2; Double_t x2=-SectorSizeX()/2-DeadZone(); Double_t x3=-SectorSizeX()/2;
98 Double_t x4= SectorSizeX()/2; Double_t x5= SectorSizeX()/2+DeadZone(); Double_t x6= PcSizeX()/2;
c712cb2f 99
6a005d35 100 if (x>=x1&&x<=x2) {sector=1;x+=PcSizeX()/2;}
101 else if(x>=x3&&x<=x4) {sector=2;x+=SectorSizeX()/2;}
102 else if(x>=x5&&x<=x6) {sector=3;x-=SectorSizeX()/2+DeadZone();}
103 else {return kBad;} //in dead zone
c712cb2f 104
c1863e3c 105 if (y>=-PcSizeY()/2 &&y<=-DeadZone()/2) {y+=PcSizeY()/2; return sector;}
6a005d35 106 else if(y> -DeadZone()/2 &&y< DeadZone()/2) {return kBad;} //in dead zone
c1863e3c 107 else if(y>= DeadZone()/2 &&y<= PcSizeY()/2) {y-=DeadZone()/2; return sector+3;}
6a005d35 108 else {return kBad;}
c712cb2f 109}//Loc2Sec(Double_t x, Double_t y)
c2c6679b 110//__________________________________________________________________________________________________
c712cb2f 111Int_t AliRICHParam::Pad2Sec(Int_t &padx, Int_t &pady)
112{//Determines sector for a given pad (padx,pady) and trasform this point to the local system of that sector.
113 Int_t sector=kBad;
114 if (padx>=1 &&padx<=NpadsXsec()) {sector=1;}
115 else if(padx> NpadsXsec() &&padx<=NpadsXsec()*2) {sector=2;padx-=NpadsXsec();}
116 else if(padx> NpadsXsec()*2&&padx<=NpadsX()) {sector=3;padx-=NpadsXsec()*2;}
117 else {return kBad;}
118
c1863e3c 119 if (pady>=1 &&pady<= NpadsYsec()) {return sector;}
120 else if(pady>NpadsYsec()&&pady<= NpadsY()) {pady-=NpadsYsec();return sector+3;}
c712cb2f 121 else {return kBad;}
122}//Pad2Sec()
123//__________________________________________________________________________________________________
124Int_t AliRICHParam::Loc2Pad(Double_t x, Double_t y, Int_t &padx, Int_t &pady)
125{//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y)
126 //count starts in lower left corner from 1,1 to 144,180
127
128 padx=pady=kBad;
129 Int_t sector=Loc2Sec(x,y);
130 if(sector==kBad) return sector;
131
132 padx=Int_t(x/PadSizeX())+1;
133 if(padx>NpadsXsec()) padx= NpadsXsec();
c1863e3c 134 if(sector==2||sector==5) padx+=NpadsXsec();
135 else if(sector==3||sector==6) padx+=NpadsXsec()*2;
c712cb2f 136
137 pady=Int_t(y/PadSizeY())+1;
138 if(pady>NpadsYsec()) padx= NpadsYsec();
139 if(sector>0) pady+=NpadsYsec();
140
141 return sector;
142}//Loc2Pad()
143//__________________________________________________________________________________________________
144void AliRICHParam::Pad2Loc(Int_t padx,Int_t pady,Double_t &x,Double_t &y)
145{
146 Int_t sector=Pad2Sec(padx,pady);
c1863e3c 147 if(sector>3)
c712cb2f 148 y=0.5*DeadZone()+pady*PadSizeY()-0.5*PadSizeY();
149 else{
c712cb2f 150 y=-0.5*PcSizeY()+pady*PadSizeY()-0.5*PadSizeY();
151 }
c1863e3c 152 if(sector==1||sector==4)
c712cb2f 153 x=-0.5*PcSizeX()+padx*PadSizeX()-0.5*PadSizeX();
c1863e3c 154 else if(sector==2||sector==5)
c712cb2f 155 x=-0.5*SectorSizeX()+padx*PadSizeX()-0.5*PadSizeX();
c2c6679b 156 else
c712cb2f 157 x= 0.5*SectorSizeX()+DeadZone()+padx*PadSizeX()-0.5*PadSizeX();
158 return;
159}//Pad2Loc()
c60862bf 160//__________________________________________________________________________________________________
c712cb2f 161Double_t AliRICHParam::GainVariation(Double_t y,Int_t sector)
c60862bf 162{
c712cb2f 163 if(IsWireSag()){
164 if(y>0) y-=SectorSizeY()/2; else y+=SectorSizeY()/2;
165 switch(HV(sector)){
166 case 2150:
167 default:
168 return 9e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0316*TMath::Power(y,2)-3e-4*y+25.367;//%
169 }
170 }else
171 return 0;
172}
173//__________________________________________________________________________________________________
174Int_t AliRICHParam::Loc2TotQdc(TVector3 x3,Double_t eloss,Int_t iPid,Int_t &sector)
175{//calculates the total charge produced by the hit given in local refenrence system
176 Double_t x=x3.X(),y=x3.Y();
177
178 sector=Loc2Sec(x,y);
179
180 Double_t gain=QdcSlope(sector)*(1+GainVariation(x3.Y(),sector)/100);
181
182
183 if(iPid>50000){//it's photon => 1 electron
184 return Int_t(gain*-TMath::Log(gRandom->Rndm()));
185 }else{//it's MIP
186 Int_t iNelectrons=Int_t(eloss/IonisationPotential());
187 if(iNelectrons==0) return 0;
188 Double_t qdc=0;
189 for(Int_t i=1;i<=iNelectrons;i++) qdc+=gain*-TMath::Log(gRandom->Rndm());
190 return Int_t(qdc);
191 }
543d5224 192}
c2c6679b 193//__________________________________________________________________________________________________
c712cb2f 194Double_t AliRICHParam::Loc2PadFrac(TVector3 hitX3,Int_t padx,Int_t pady)
195{//
196 Double_t padXcenter=0,padYcenter=0; Pad2Loc(padx,pady,padXcenter,padYcenter);
197
198 //correction to the position of the nearest wire
199
200 Double_t normXmin=(hitX3.X()-padXcenter-PadSizeX()/2) /AnodeCathodeGap();
201 Double_t normXmax=(hitX3.X()-padXcenter+PadSizeX()/2) /AnodeCathodeGap();
202 Double_t normYmin=(hitX3.Y()-padYcenter-PadSizeY()/2) /AnodeCathodeGap();
203 Double_t normYmax=(hitX3.Y()-padYcenter+PadSizeY()/2) /AnodeCathodeGap();
204
205 return Mathienson(normXmin,normYmin,normXmax,normYmax);
206}//Loc2PadQdc()
207//__________________________________________________________________________________________________
208Double_t AliRICHParam::Mathienson(Double_t xMin,Double_t yMin,Double_t xMax,Double_t yMax)
209{//see NIM A370(1988)602-603
210 const Double_t SqrtKx3=0.77459667;const Double_t Kx2=0.962;const Double_t Kx4=0.379;
211 const Double_t SqrtKy3=0.77459667;const Double_t Ky2=0.962;const Double_t Ky4=0.379;
212
213 Double_t ux1=SqrtKx3*TMath::TanH(Kx2*xMin);
214 Double_t ux2=SqrtKx3*TMath::TanH(Kx2*xMax);
215 Double_t uy1=SqrtKy3*TMath::TanH(Ky2*yMin);
216 Double_t uy2=SqrtKy3*TMath::TanH(Ky2*yMax);
217 return 4*Kx4*(TMath::ATan(ux2)-TMath::ATan(ux1))*Ky4*(TMath::ATan(uy2)-TMath::ATan(uy1));
218}
219//__________________________________________________________________________________________________
220void AliRICHParam::Loc2Area(TVector3 hitX3,Int_t &iPadXmin,Int_t &iPadYmin,Int_t &iPadXmax,Int_t &iPadYmax)
221{//calculates the area of disintegration for a given hit. Area is a rectangulare set pf pads
222 //defined by its left-down and right-up coners
223 // hitX3.SetX(Shift2NearestWire(hitX3.X());
6a005d35 224 Loc2Pad(hitX3.X()-MathiensonDeltaX(),hitX3.Y()-MathiensonDeltaY(),iPadXmin,iPadYmin);
225 Loc2Pad(hitX3.X()+MathiensonDeltaX(),hitX3.Y()+MathiensonDeltaY(),iPadXmax,iPadYmax);
c712cb2f 226}//
d48cca74 227#endif //AliRICHParam_h