Setting splitlevel to 0 by default in treeH, TreeR and TreeT branches. TreeD is still...
[u/mrichter/AliRoot.git] / RICH / AliRICHParam.cxx
CommitLineData
d48cca74 1#include "AliRICHParam.h"
c2c6679b 2#include <TMath.h>
3#include <TRandom.h>
d48cca74 4
5ClassImp(AliRICHParam)
6
d48cca74 7// RICH main parameters manipulator
c2c6679b 8//__________________________________________________________________________________________________
a277aaca 9AliRICHParam::AliRICHParam():
a277aaca 10fDeadZone(0),
c60862bf 11fPadSizeX(0),fPadSizeY(0),
c60862bf 12fCurrentPadX(0),fCurrentPadY(0),fCurrentWire(0),
a277aaca 13fSizeZ(0),
c60862bf 14fAngleRot(0),fAngleYZ(0),fAngleXY(0),
a277aaca 15fOffset(0),
16fGapThickness(0),
17fProximityGapThickness(0),
18fQuartzLength(0),
19fQuartzWidth(0),
20fQuartzThickness(0),
21fOuterFreonLength(0),
22fOuterFreonWidth(0),
23fInnerFreonLength(0),
24fInnerFreonWidth(0),
25fFreonThickness(0),
26fRadiatorToPads(0),
a277aaca 27fChargeSlope(0),
28fChargeSpreadX(0),
29fChargeSpreadY(0),
30fSigmaIntegration(0),
31fAlphaFeedback(0),
32fEIonisation(0),
33fMaxAdc(0),
34fSqrtKx3(0),
35fKx2(0),
36fKx4(0),
37fSqrtKy3(0),
38fKy2(0),
39fKy4(0),
40fPitch(0),
41fWireSag(0),
42fVoltage(0)
d48cca74 43{//defines the default parameters
543d5224 44 DeadZone (3); //spacer between PC planes
45 PadSize (0.84,0.80);
46
a277aaca 47 Size (132.6*kcm,26*kcm,136.7*kcm); //full length, not GEANT half notation
e62e4625 48 AngleRot (-60); //rotation of the whole RICH around Z, deg
49 Angles (20,19.5); //XY angle, YZ angle deg
50 Offset (490*kcm+1.267*kcm); //1.267???????cm distance from IP to the center of module
a277aaca 51 GapThickness (8*kcm);
52 ProximityGapThickness(0.4*kcm);
53 QuartzLength (133*kcm);
54 QuartzWidth (127.9*kcm);
55 QuartzThickness (0.5*kcm);
56 OuterFreonLength (133*kcm);
57 OuterFreonWidth (41.3*kcm);
58 InnerFreonLength (133*kcm);
59 InnerFreonWidth (41.3*kcm);
60 FreonThickness (1.5*kcm);
61 RadiatorToPads (80*kmm);
d48cca74 62
d48cca74 63 ChargeSlope(27.);
64 ChargeSpreadX(0.18);ChargeSpreadY(0.18);
853634d3 65 SigmaIntegration(5.);
d48cca74 66 MaxAdc(4096);
67 AlphaFeedback(0.036);
68 EIonisation(26.e-9);
69 SqrtKx3(0.77459667);
70 Kx2(0.962);
71 Kx4(0.379);
72 SqrtKy3(0.77459667);
73 Ky2(0.962);
74 Ky4(0.379);
75 Pitch(0.25);
76 WireSag(1); // 1->On, 0->Off
77 Voltage(2150); // Should only be 2000, 2050, 2100 or 2150
d48cca74 78}//AliRICHParam::named ctor
c2c6679b 79//__________________________________________________________________________________________________
543d5224 80Int_t AliRICHParam::Local2Sector(Float_t &x, Float_t &y)const
c60862bf 81{//Determines sector for a given hit (x,y) and trasform this point to the local system of that sector.
c2c6679b 82 Int_t sector=kBad;
543d5224 83 Float_t x1=-0.5*PcSizeX(); Float_t x2=-0.5*SectorSizeX()-DeadZone(); Float_t x3=-0.5*SectorSizeX();
84 Float_t x4= 0.5*SectorSizeX(); Float_t x5= 0.5*SectorSizeX()+DeadZone(); Float_t x6= 0.5*PcSizeX();
85
86 if (x>=x1&&x<=x2) {sector=1;x+=0.5*PcSizeX();}
87 else if(x>=x3&&x<=x4) {sector=2;x+=0.5*SectorSizeX();}
88 else if(x>=x5&&x<=x6) {sector=3;x-=0.5*SectorSizeX()+DeadZone();}
89 else if(x< x1||x> x6) {Error("Sector","given x position is out of PC area");return kBad;}
90 else {return kBad;} //in dead zone
c60862bf 91
543d5224 92 if (y>=-0.5*PcSizeY() &&y<=-0.5*DeadZone()) {y+=0.5*PcSizeY(); return -sector;}
93 else if(y> -0.5*DeadZone() &&y< 0.5*DeadZone()) {return kBad;} //in dead zone
94 else if(y>= 0.5*DeadZone() &&y<= 0.5*PcSizeY()) {y-=0.5*DeadZone(); return sector;}
95 else {Error("Sector","given y position is out of PC area");return kBad;}
96}//Int_t AliRICHParam::Local2Sector(Float_t x, Float_t y)
c2c6679b 97//__________________________________________________________________________________________________
543d5224 98Int_t AliRICHParam::Pad2Sector(Int_t &padx, Int_t &pady)const
99{//Determines sector for a given pad (padx,pady) and trasform this point to the local system of that sector.
100 Int_t sector=kBad;
101 if (padx>=1 &&padx<=NpadsXsec()) {sector=1;}
102 else if(padx> NpadsXsec() &&padx<=NpadsXsec()*2) {sector=2;padx-=NpadsXsec();}
103 else if(padx> NpadsXsec()*2&&padx<=NpadsX()) {sector=3;padx-=NpadsXsec()*2;}
104 else {Error("Sector","given padx position is out of PC area");return kBad;}
105
106 if (pady>=1 &&pady<= NpadsYsec()) {return -sector;}
107 else if(pady>NpadsYsec()&&pady<= NpadsY()) {pady-=NpadsYsec();return sector;}
108 else {Error("Sector","given y position is out of PC area");return kBad;}
109}//Local2Sector()
110//__________________________________________________________________________________________________
111Int_t AliRICHParam::Local2Pad(Float_t x, Float_t y, Int_t &padx, Int_t &pady)const
c60862bf 112{//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y)
113 //count starts in lower left corner from 1,1 to 144,180
114
115 padx=pady=kBad;
543d5224 116 Int_t sector=Local2Sector(x,y);
c60862bf 117 if(sector==kBad) return sector;
118
543d5224 119 padx=Int_t(x/PadSizeX())+1;
120 if(padx>NpadsXsec()) padx= NpadsXsec();
121 if(sector==2||sector==-2) padx+=NpadsXsec();
122 else if(sector==3||sector==-3) padx+=NpadsXsec()*2;
c60862bf 123
543d5224 124 pady=Int_t(y/PadSizeY())+1;
125 if(pady>NpadsYsec()) padx= NpadsYsec();
126 if(sector>0) pady+=NpadsYsec();
c2c6679b 127
c2c6679b 128 return sector;
543d5224 129}//Local2Pad()
130//__________________________________________________________________________________________________
131void AliRICHParam::Pad2Local(Int_t padx,Int_t pady,Float_t &x,Float_t &y)
132{
133 Int_t sector=Pad2Sector(padx,pady);
134 if(sector>0)
135 y=0.5*DeadZone()+pady*PadSizeY()-0.5*PadSizeY();
136 else{
137 sector=-sector;
138 y=-0.5*PcSizeY()+pady*PadSizeY()-0.5*PadSizeY();
139 }
140 if(sector==1)
141 x=-0.5*PcSizeX()+padx*PadSizeX()-0.5*PadSizeX();
142 else if(sector==2)
143 x=-0.5*SectorSizeX()+padx*PadSizeX()-0.5*PadSizeX();
144 else
145 x= 0.5*SectorSizeX()+DeadZone()+padx*PadSizeX()-0.5*PadSizeX();
146 return;
147}//Pad2Local()
c2c6679b 148//__________________________________________________________________________________________________
149Float_t AliRICHParam::Gain(Float_t y)
150{//Calculates the gain
151 if(fWireSag){
152 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;
153 Float_t gain = (ChargeSlope()+ChargeSlope()*gainK/100)*0.9;
154 return -gain*TMath::Log(gRandom->Rndm());
155 }else
156 return -ChargeSlope()*TMath::Log(gRandom->Rndm());
157}//Float_t AliRICHParam::IntPH(Float_t yhit)
158//__________________________________________________________________________________________________
159Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss,Float_t y)
160{//Get number of electrons and return charge
161
c60862bf 162 if(iPID>50000)//it's photon no more then 1 electron after photoelectron conversion
c2c6679b 163 return Gain(y);
164 else{
165 Int_t iNelectrons=Int_t(eloss/fEIonisation);if(iNelectrons==0) iNelectrons=1;
166 Float_t charge=0;
167 for(Int_t i=1;i<=iNelectrons;i++)
c60862bf 168 charge+=Gain(y);
c2c6679b 169 return charge;
170 }
171}//Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss, Float_t y)
172//__________________________________________________________________________________________________
c60862bf 173void AliRICHParam::FirstPad(Float_t x,Float_t y)
174{
175 Int_t padx,pady;
543d5224 176 Local2Pad(x,y,padx,pady);
c60862bf 177}//void AliRICHParam::FirstPad(Float_t x,Float_t y)