New Stepmanager function.
[u/mrichter/AliRoot.git] / RICH / AliRICHParam.cxx
CommitLineData
d48cca74 1#include "AliRICHParam.h"
c2c6679b 2#include "AliRICHConst.h"
3#include <TMath.h>
4#include <TRandom.h>
d48cca74 5
6ClassImp(AliRICHParam)
7
d48cca74 8// RICH main parameters manipulator
c2c6679b 9//__________________________________________________________________________________________________
a277aaca 10AliRICHParam::AliRICHParam():
11fNpadX(0),
12fNpadY(0),
13fDeadZone(0),
14fPadSizeX(0),
15fPadSizeY(0),
16fSectorSizeX(0),
17fSectorSizeY(0),
18fWirePitch(0),
19fCurrentPadX(0),
20fCurrentPadY(0),
21fCurrentWire(0),
22fSizeZ(0),
23fAngleRot(0),
24fAngleYZ(0),
25fAngleXY(0),
26fOffset(0),
27fGapThickness(0),
28fProximityGapThickness(0),
29fQuartzLength(0),
30fQuartzWidth(0),
31fQuartzThickness(0),
32fOuterFreonLength(0),
33fOuterFreonWidth(0),
34fInnerFreonLength(0),
35fInnerFreonWidth(0),
36fFreonThickness(0),
37fRadiatorToPads(0),
38fPcSizeX(0),
39fPcSizeY(0),
40fChargeSlope(0),
41fChargeSpreadX(0),
42fChargeSpreadY(0),
43fSigmaIntegration(0),
44fAlphaFeedback(0),
45fEIonisation(0),
46fMaxAdc(0),
47fSqrtKx3(0),
48fKx2(0),
49fKx4(0),
50fSqrtKy3(0),
51fKy2(0),
52fKy4(0),
53fPitch(0),
54fWireSag(0),
55fVoltage(0)
d48cca74 56{//defines the default parameters
c2c6679b 57 Segmentation (144,160); //nx,ny for the whole chamber
a277aaca 58 DeadZone (3*kcm); //spacer between PC planes
59 PadSize (8.4*kmm,8.0*kmm);
c2c6679b 60 fWirePitch=PadSizeX()/2;
853634d3 61
a277aaca 62 Size (132.6*kcm,26*kcm,136.7*kcm); //full length, not GEANT half notation
c2c6679b 63 AngleRot (60); //rotation of the whole RICH around Z, deg
64 Angles (20,19.5); //XY angle, YZ angle deg
a277aaca 65 Offset (490*kcm+1.267*kcm); //1.267???????cm distance from IP to the center of module
66 GapThickness (8*kcm);
67 ProximityGapThickness(0.4*kcm);
68 QuartzLength (133*kcm);
69 QuartzWidth (127.9*kcm);
70 QuartzThickness (0.5*kcm);
71 OuterFreonLength (133*kcm);
72 OuterFreonWidth (41.3*kcm);
73 InnerFreonLength (133*kcm);
74 InnerFreonWidth (41.3*kcm);
75 FreonThickness (1.5*kcm);
76 RadiatorToPads (80*kmm);
d48cca74 77
d48cca74 78 ChargeSlope(27.);
79 ChargeSpreadX(0.18);ChargeSpreadY(0.18);
853634d3 80 SigmaIntegration(5.);
d48cca74 81 MaxAdc(4096);
82 AlphaFeedback(0.036);
83 EIonisation(26.e-9);
84 SqrtKx3(0.77459667);
85 Kx2(0.962);
86 Kx4(0.379);
87 SqrtKy3(0.77459667);
88 Ky2(0.962);
89 Ky4(0.379);
90 Pitch(0.25);
91 WireSag(1); // 1->On, 0->Off
92 Voltage(2150); // Should only be 2000, 2050, 2100 or 2150
93
94 Recalc();
95}//AliRICHParam::named ctor
c2c6679b 96//__________________________________________________________________________________________________
d48cca74 97void AliRICHParam::Recalc()
98{//recalculate
c2c6679b 99 fPcSizeX=Nx()*fPadSizeX+2*fDeadZone;
100 fPcSizeY=Ny()*fPadSizeY+fDeadZone;
101 fSectorSizeX=(fPcSizeX-2*fDeadZone)/3;
102 fSectorSizeY=(fPcSizeY-fDeadZone)/2;
d48cca74 103}//void AliRICHParam::Recalc()
c2c6679b 104//__________________________________________________________________________________________________
105Int_t AliRICHParam::Sector(Float_t x, Float_t y)const
106{//Calculate in which sector is the hit
107 if(TMath::Abs(x)>fPcSizeX/2 || TMath::Abs(y)>fPcSizeY/2){
108 Error("Sector","given position is out of active PC area");
109 return kBad;
110 }
111 Int_t sector=kBad;
112 if(x<=-fSectorSizeX/2-fDeadZone) sector=1;
113 if(x>=-fSectorSizeX/2 && x<=fSectorSizeX/2) sector=2;
114 if(x>= fSectorSizeX/2+fDeadZone) sector=3;
115 if(y>= fDeadZone/2)
116 return sector;
117 else if(y<=-fDeadZone/2)
118 return -sector;
119 else
120 return kBad;
121}//Int_t AliRICHParam::Sector(Float_t x, Float_t y)
122//__________________________________________________________________________________________________
123Int_t AliRICHParam::L2P(Float_t x, Float_t y, Int_t &iPadX, Int_t &iPadY)const
124{//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y)
125//
126// Please check origin of pad numbering !!!
127 iPadX=kBad;
128 iPadY=kBad;
129 Int_t sector=Sector(x,y);
130 switch(sector){
131 case -3:
132 iPadX = Int_t ((x-fDeadZone)/fPadSizeX);
133 iPadY = Int_t ((y+fDeadZone/2)/fPadSizeY)-1;
134 break;
135 case 3:
136 iPadX = Int_t ((x-fDeadZone)/fPadSizeX);
137 iPadY = Int_t ((y-fDeadZone/2)/fPadSizeY);
138 break;
139 case -2:
140 iPadX = (x>=0)? iPadX = Int_t (x/fPadSizeX) : iPadX = Int_t (x/fPadSizeX)-1;
141 iPadY = Int_t ((y+fDeadZone/2)/fPadSizeY)-1;
142 break;
143 case 2:
144 iPadX = (x>=0)? iPadX = Int_t (x/fPadSizeX) : iPadX = Int_t (x/fPadSizeX)-1;
145 iPadY = Int_t ((y-fDeadZone/2)/fPadSizeY);
146 break;
147 case -1:
148 iPadX = Int_t ((x+fDeadZone)/fPadSizeX)-1;
149 iPadY = Int_t ((y+fDeadZone/2)/fPadSizeY)-1;
150 break;
151 case 1:
152 iPadX = Int_t ((x+fDeadZone)/fPadSizeX)-1;
153 iPadY = Int_t ((y-fDeadZone/2)/fPadSizeY);
154 break;
155 }//switch
156
157 if(iPadY> Ny()) iPadY= Ny();
158 if(iPadY<-Ny()) iPadY=-Ny();
159 if(iPadX> Nx()) iPadX= Nx();
160 if(iPadX<-Nx()) iPadX=-Nx();
161 return sector;
162}//void AliRICHParam::L2P(Float_t x, Float_t y, Int_t &iPadX, Int_t &iPadY)
163//__________________________________________________________________________________________________
164Float_t AliRICHParam::Gain(Float_t y)
165{//Calculates the gain
166 if(fWireSag){
167 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;
168 Float_t gain = (ChargeSlope()+ChargeSlope()*gainK/100)*0.9;
169 return -gain*TMath::Log(gRandom->Rndm());
170 }else
171 return -ChargeSlope()*TMath::Log(gRandom->Rndm());
172}//Float_t AliRICHParam::IntPH(Float_t yhit)
173//__________________________________________________________________________________________________
174Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss,Float_t y)
175{//Get number of electrons and return charge
176
177 if(iPID==kCerenkov||iPID==kFeedback)
178 return Gain(y);
179 else{
180 Int_t iNelectrons=Int_t(eloss/fEIonisation);if(iNelectrons==0) iNelectrons=1;
181 Float_t charge=0;
182 for(Int_t i=1;i<=iNelectrons;i++)
183 charge-=Gain(y);
184 return charge;
185 }
186}//Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss, Float_t y)
187//__________________________________________________________________________________________________