Adding support for HLT code
[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//__________________________________________________________________________________________________
d48cca74 10AliRICHParam::AliRICHParam()
11{//defines the default parameters
c2c6679b 12 Segmentation (144,160); //nx,ny for the whole chamber
853634d3 13 DeadZone (3*cm); //spacer between PC planes
14 PadSize (8.4*mm,8.0*mm);
c2c6679b 15 fWirePitch=PadSizeX()/2;
853634d3 16
c2c6679b 17 Size (132.6*cm,26*cm,136.7*cm); //full length, not GEANT half notation
18 AngleRot (60); //rotation of the whole RICH around Z, deg
19 Angles (20,19.5); //XY angle, YZ angle deg
20 Offset (490*cm+1.267*cm); //1.267???????cm distance from IP to the center of module
853634d3 21 GapThickness (8*cm);
22 ProximityGapThickness(0.4*cm);
23 QuartzLength (133*cm);
24 QuartzWidth (127.9*cm);
25 QuartzThickness (0.5*cm);
26 OuterFreonLength (133*cm);
27 OuterFreonWidth (41.3*cm);
28 InnerFreonLength (133*cm);
29 InnerFreonWidth (41.3*cm);
30 FreonThickness (1.5*cm);
c2c6679b 31 RadiatorToPads (80*mm);
d48cca74 32
d48cca74 33 ChargeSlope(27.);
34 ChargeSpreadX(0.18);ChargeSpreadY(0.18);
853634d3 35 SigmaIntegration(5.);
d48cca74 36 MaxAdc(4096);
37 AlphaFeedback(0.036);
38 EIonisation(26.e-9);
39 SqrtKx3(0.77459667);
40 Kx2(0.962);
41 Kx4(0.379);
42 SqrtKy3(0.77459667);
43 Ky2(0.962);
44 Ky4(0.379);
45 Pitch(0.25);
46 WireSag(1); // 1->On, 0->Off
47 Voltage(2150); // Should only be 2000, 2050, 2100 or 2150
48
49 Recalc();
50}//AliRICHParam::named ctor
c2c6679b 51//__________________________________________________________________________________________________
d48cca74 52void AliRICHParam::Recalc()
53{//recalculate
c2c6679b 54 fPcSizeX=Nx()*fPadSizeX+2*fDeadZone;
55 fPcSizeY=Ny()*fPadSizeY+fDeadZone;
56 fSectorSizeX=(fPcSizeX-2*fDeadZone)/3;
57 fSectorSizeY=(fPcSizeY-fDeadZone)/2;
d48cca74 58}//void AliRICHParam::Recalc()
c2c6679b 59//__________________________________________________________________________________________________
60Int_t AliRICHParam::Sector(Float_t x, Float_t y)const
61{//Calculate in which sector is the hit
62 if(TMath::Abs(x)>fPcSizeX/2 || TMath::Abs(y)>fPcSizeY/2){
63 Error("Sector","given position is out of active PC area");
64 return kBad;
65 }
66 Int_t sector=kBad;
67 if(x<=-fSectorSizeX/2-fDeadZone) sector=1;
68 if(x>=-fSectorSizeX/2 && x<=fSectorSizeX/2) sector=2;
69 if(x>= fSectorSizeX/2+fDeadZone) sector=3;
70 if(y>= fDeadZone/2)
71 return sector;
72 else if(y<=-fDeadZone/2)
73 return -sector;
74 else
75 return kBad;
76}//Int_t AliRICHParam::Sector(Float_t x, Float_t y)
77//__________________________________________________________________________________________________
78Int_t AliRICHParam::L2P(Float_t x, Float_t y, Int_t &iPadX, Int_t &iPadY)const
79{//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y)
80//
81// Please check origin of pad numbering !!!
82 iPadX=kBad;
83 iPadY=kBad;
84 Int_t sector=Sector(x,y);
85 switch(sector){
86 case -3:
87 iPadX = Int_t ((x-fDeadZone)/fPadSizeX);
88 iPadY = Int_t ((y+fDeadZone/2)/fPadSizeY)-1;
89 break;
90 case 3:
91 iPadX = Int_t ((x-fDeadZone)/fPadSizeX);
92 iPadY = Int_t ((y-fDeadZone/2)/fPadSizeY);
93 break;
94 case -2:
95 iPadX = (x>=0)? iPadX = Int_t (x/fPadSizeX) : iPadX = Int_t (x/fPadSizeX)-1;
96 iPadY = Int_t ((y+fDeadZone/2)/fPadSizeY)-1;
97 break;
98 case 2:
99 iPadX = (x>=0)? iPadX = Int_t (x/fPadSizeX) : iPadX = Int_t (x/fPadSizeX)-1;
100 iPadY = Int_t ((y-fDeadZone/2)/fPadSizeY);
101 break;
102 case -1:
103 iPadX = Int_t ((x+fDeadZone)/fPadSizeX)-1;
104 iPadY = Int_t ((y+fDeadZone/2)/fPadSizeY)-1;
105 break;
106 case 1:
107 iPadX = Int_t ((x+fDeadZone)/fPadSizeX)-1;
108 iPadY = Int_t ((y-fDeadZone/2)/fPadSizeY);
109 break;
110 }//switch
111
112 if(iPadY> Ny()) iPadY= Ny();
113 if(iPadY<-Ny()) iPadY=-Ny();
114 if(iPadX> Nx()) iPadX= Nx();
115 if(iPadX<-Nx()) iPadX=-Nx();
116 return sector;
117}//void AliRICHParam::L2P(Float_t x, Float_t y, Int_t &iPadX, Int_t &iPadY)
118//__________________________________________________________________________________________________
119Float_t AliRICHParam::Gain(Float_t y)
120{//Calculates the gain
121 if(fWireSag){
122 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;
123 Float_t gain = (ChargeSlope()+ChargeSlope()*gainK/100)*0.9;
124 return -gain*TMath::Log(gRandom->Rndm());
125 }else
126 return -ChargeSlope()*TMath::Log(gRandom->Rndm());
127}//Float_t AliRICHParam::IntPH(Float_t yhit)
128//__________________________________________________________________________________________________
129Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss,Float_t y)
130{//Get number of electrons and return charge
131
132 if(iPID==kCerenkov||iPID==kFeedback)
133 return Gain(y);
134 else{
135 Int_t iNelectrons=Int_t(eloss/fEIonisation);if(iNelectrons==0) iNelectrons=1;
136 Float_t charge=0;
137 for(Int_t i=1;i<=iNelectrons;i++)
138 charge-=Gain(y);
139 return charge;
140 }
141}//Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss, Float_t y)
142//__________________________________________________________________________________________________