1 #include "AliRICHParam.h"
7 // RICH main parameters manipulator
8 //__________________________________________________________________________________________________
9 AliRICHParam::AliRICHParam():
10 fCurrentPadX(0),fCurrentPadY(0),fCurrentWire(0),
12 fAngleRot(0),fAngleYZ(0),fAngleXY(0),
15 fProximityGapThickness(0),
34 {//defines the default parameters
35 Size (132.6*kcm,26*kcm,136.7*kcm); //full length, not GEANT half notation
36 AngleRot (-60); //rotation of the whole RICH around Z, deg
37 Angles (20,19.5); //XY angle, YZ angle deg
38 Offset (490*kcm+1.267*kcm); //1.267???????cm distance from IP to the center of module
40 ProximityGapThickness(0.4*kcm);
41 QuartzLength (133*kcm);
42 QuartzWidth (127.9*kcm);
43 QuartzThickness (0.5*kcm);
44 OuterFreonLength (133*kcm);
45 OuterFreonWidth (41.3*kcm);
46 InnerFreonLength (133*kcm);
47 InnerFreonWidth (41.3*kcm);
48 FreonThickness (1.5*kcm);
49 RadiatorToPads (80*kmm);
52 ChargeSpreadX(0.18);ChargeSpreadY(0.18);
57 WireSag(1); // 1->On, 0->Off
58 Voltage(2150); // Should only be 2000, 2050, 2100 or 2150
59 }//AliRICHParam::named ctor
60 //__________________________________________________________________________________________________
61 Int_t AliRICHParam::Local2Sector(Float_t &x, Float_t &y)
62 {//Determines sector for a given hit (x,y) and trasform this point to the local system of that sector.
64 Float_t x1=-0.5*PcSizeX(); Float_t x2=-0.5*SectorSizeX()-DeadZone(); Float_t x3=-0.5*SectorSizeX();
65 Float_t x4= 0.5*SectorSizeX(); Float_t x5= 0.5*SectorSizeX()+DeadZone(); Float_t x6= 0.5*PcSizeX();
67 if (x>=x1&&x<=x2) {sector=1;x+=0.5*PcSizeX();}
68 else if(x>=x3&&x<=x4) {sector=2;x+=0.5*SectorSizeX();}
69 else if(x>=x5&&x<=x6) {sector=3;x-=0.5*SectorSizeX()+DeadZone();}
70 else if(x< x1||x> x6) {return kBad;}
71 else {return kBad;} //in dead zone
73 if (y>=-0.5*PcSizeY() &&y<=-0.5*DeadZone()) {y+=0.5*PcSizeY(); return -sector;}
74 else if(y> -0.5*DeadZone() &&y< 0.5*DeadZone()) {return kBad;} //in dead zone
75 else if(y>= 0.5*DeadZone() &&y<= 0.5*PcSizeY()) {y-=0.5*DeadZone(); return sector;}
77 }//Int_t AliRICHParam::Local2Sector(Float_t x, Float_t y)
78 //__________________________________________________________________________________________________
79 Int_t AliRICHParam::Pad2Sector(Int_t &padx, Int_t &pady)
80 {//Determines sector for a given pad (padx,pady) and trasform this point to the local system of that sector.
82 if (padx>=1 &&padx<=NpadsXsec()) {sector=1;}
83 else if(padx> NpadsXsec() &&padx<=NpadsXsec()*2) {sector=2;padx-=NpadsXsec();}
84 else if(padx> NpadsXsec()*2&&padx<=NpadsX()) {sector=3;padx-=NpadsXsec()*2;}
87 if (pady>=1 &&pady<= NpadsYsec()) {return -sector;}
88 else if(pady>NpadsYsec()&&pady<= NpadsY()) {pady-=NpadsYsec();return sector;}
91 //__________________________________________________________________________________________________
92 Int_t AliRICHParam::Local2Pad(Float_t x, Float_t y, Int_t &padx, Int_t &pady)
93 {//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y)
94 //count starts in lower left corner from 1,1 to 144,180
97 Int_t sector=Local2Sector(x,y);
98 if(sector==kBad) return sector;
100 padx=Int_t(x/PadSizeX())+1;
101 if(padx>NpadsXsec()) padx= NpadsXsec();
102 if(sector==2||sector==-2) padx+=NpadsXsec();
103 else if(sector==3||sector==-3) padx+=NpadsXsec()*2;
105 pady=Int_t(y/PadSizeY())+1;
106 if(pady>NpadsYsec()) padx= NpadsYsec();
107 if(sector>0) pady+=NpadsYsec();
111 //__________________________________________________________________________________________________
112 void AliRICHParam::Pad2Local(Int_t padx,Int_t pady,Float_t &x,Float_t &y)
114 Int_t sector=Pad2Sector(padx,pady);
116 y=0.5*DeadZone()+pady*PadSizeY()-0.5*PadSizeY();
119 y=-0.5*PcSizeY()+pady*PadSizeY()-0.5*PadSizeY();
122 x=-0.5*PcSizeX()+padx*PadSizeX()-0.5*PadSizeX();
124 x=-0.5*SectorSizeX()+padx*PadSizeX()-0.5*PadSizeX();
126 x= 0.5*SectorSizeX()+DeadZone()+padx*PadSizeX()-0.5*PadSizeX();
129 //__________________________________________________________________________________________________
130 Float_t AliRICHParam::Gain(Float_t y)
131 {//Calculates the gain
133 Float_t gainK=9e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0316*TMath::Power(y,2)-3e-4*y+25.367;
134 Float_t gain = (ChargeSlope()+ChargeSlope()*gainK/100)*0.9;
135 return -gain*TMath::Log(gRandom->Rndm());
137 return -ChargeSlope()*TMath::Log(gRandom->Rndm());
138 }//Float_t AliRICHParam::IntPH(Float_t yhit)
139 //__________________________________________________________________________________________________
140 Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss,Float_t y)
141 {//Get number of electrons and return charge
143 if(iPID>50000)//it's photon no more then 1 electron after photoelectron conversion
146 Int_t iNelectrons=Int_t(eloss/fEIonisation);if(iNelectrons==0) iNelectrons=1;
148 for(Int_t i=1;i<=iNelectrons;i++)
152 }//Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss, Float_t y)
153 //__________________________________________________________________________________________________
154 void AliRICHParam::FirstPad(Float_t x,Float_t y)
157 Local2Pad(x,y,padx,pady);
158 }//void AliRICHParam::FirstPad(Float_t x,Float_t y)
159 //__________________________________________________________________________________________________
160 Float_t AliRICHParam::AssignChargeToPad(Float_t hitx,Float_t hity,Int_t padx,Int_t pady)
162 Float_t padXcenter=0,padYcenter=0;
163 Pad2Local(padx,pady,padXcenter,padYcenter);
165 Float_t xi1=hitx-padXcenter-PadSizeX()/2;
166 Float_t xi2=hitx-padXcenter+PadSizeX()/2;
167 Float_t yi1=hity-padYcenter-PadSizeY()/2;
168 Float_t yi2=hity-padYcenter+PadSizeY()/2;
169 xi1/=AnodeCathodeGap();
170 xi2/=AnodeCathodeGap();
171 yi1/=AnodeCathodeGap();
172 yi2/=AnodeCathodeGap();
173 // The Mathieson function
174 Double_t ux1=SqrtKx3()*TMath::TanH(Kx2()*xi1);
175 Double_t ux2=SqrtKx3()*TMath::TanH(Kx2()*xi2);
176 Double_t uy1=SqrtKy3()*TMath::TanH(Ky2()*yi1);
177 Double_t uy2=SqrtKy3()*TMath::TanH(Ky2()*yi2);
178 return 4.*Kx4()*(TMath::ATan(ux2)-TMath::ATan(ux1))*Ky4()*(TMath::ATan(uy2)-TMath::ATan(uy1));
179 }//AssignChargeToPad()
180 //__________________________________________________________________________________________________