]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHParam.cxx
Adding support for HLT code
[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 {//defines the default parameters
12   Segmentation         (144,160);           //nx,ny  for the whole chamber
13   DeadZone             (3*cm);              //spacer between PC planes
14   PadSize              (8.4*mm,8.0*mm);     
15   fWirePitch=PadSizeX()/2;
16   
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 
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);            
31   RadiatorToPads       (80*mm);                 
32   
33   ChargeSlope(27.);
34   ChargeSpreadX(0.18);ChargeSpreadY(0.18);
35   SigmaIntegration(5.);
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 
51 //__________________________________________________________________________________________________
52 void AliRICHParam::Recalc()
53 {//recalculate  
54   fPcSizeX=Nx()*fPadSizeX+2*fDeadZone;
55   fPcSizeY=Ny()*fPadSizeY+fDeadZone;
56   fSectorSizeX=(fPcSizeX-2*fDeadZone)/3;
57   fSectorSizeY=(fPcSizeY-fDeadZone)/2;  
58 }//void AliRICHParam::Recalc()
59 //__________________________________________________________________________________________________
60 Int_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 //__________________________________________________________________________________________________
78 Int_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 //__________________________________________________________________________________________________
119 Float_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 //__________________________________________________________________________________________________
129 Float_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 //__________________________________________________________________________________________________