]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHParam.cxx
Properly initialise class and respect coding conventiosn
[u/mrichter/AliRoot.git] / RICH / AliRICHParam.cxx
1 #include "AliRICHParam.h"
2 #include "AliRICHConst.h"
3 #include <TMath.h>
4 #include <TRandom.h>
5  
6 ClassImp(AliRICHParam)
7
8 // RICH main parameters manipulator
9 //__________________________________________________________________________________________________
10 AliRICHParam::AliRICHParam():
11 fNpadX(0),
12 fNpadY(0),
13 fDeadZone(0),
14 fPadSizeX(0),
15 fPadSizeY(0),
16 fSectorSizeX(0),
17 fSectorSizeY(0),
18 fWirePitch(0),
19 fCurrentPadX(0),
20 fCurrentPadY(0),
21 fCurrentWire(0),
22 fSizeZ(0),
23 fAngleRot(0),
24 fAngleYZ(0),
25 fAngleXY(0),
26 fOffset(0),
27 fGapThickness(0),
28 fProximityGapThickness(0),
29 fQuartzLength(0),
30 fQuartzWidth(0),
31 fQuartzThickness(0),
32 fOuterFreonLength(0),
33 fOuterFreonWidth(0),
34 fInnerFreonLength(0),
35 fInnerFreonWidth(0),
36 fFreonThickness(0),
37 fRadiatorToPads(0),
38 fPcSizeX(0),
39 fPcSizeY(0),
40 fChargeSlope(0),
41 fChargeSpreadX(0),
42 fChargeSpreadY(0),
43 fSigmaIntegration(0),
44 fAlphaFeedback(0),
45 fEIonisation(0),
46 fMaxAdc(0),
47 fSqrtKx3(0),
48 fKx2(0),
49 fKx4(0),
50 fSqrtKy3(0),
51 fKy2(0),
52 fKy4(0),
53 fPitch(0),
54 fWireSag(0),
55 fVoltage(0)
56 {//defines the default parameters
57   Segmentation         (144,160);           //nx,ny  for the whole chamber
58   DeadZone             (3*kcm);              //spacer between PC planes
59   PadSize              (8.4*kmm,8.0*kmm);     
60   fWirePitch=PadSizeX()/2;
61   
62   Size                 (132.6*kcm,26*kcm,136.7*kcm);  //full length, not GEANT half notation
63   AngleRot             (60);                       //rotation of the whole RICH around Z, deg
64   Angles               (20,19.5);                  //XY angle, YZ angle  deg  
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);                 
77   
78   ChargeSlope(27.);
79   ChargeSpreadX(0.18);ChargeSpreadY(0.18);
80   SigmaIntegration(5.);
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 
96 //__________________________________________________________________________________________________
97 void AliRICHParam::Recalc()
98 {//recalculate  
99   fPcSizeX=Nx()*fPadSizeX+2*fDeadZone;
100   fPcSizeY=Ny()*fPadSizeY+fDeadZone;
101   fSectorSizeX=(fPcSizeX-2*fDeadZone)/3;
102   fSectorSizeY=(fPcSizeY-fDeadZone)/2;  
103 }//void AliRICHParam::Recalc()
104 //__________________________________________________________________________________________________
105 Int_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 //__________________________________________________________________________________________________
123 Int_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 //__________________________________________________________________________________________________
164 Float_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 //__________________________________________________________________________________________________
174 Float_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 //__________________________________________________________________________________________________