82000e8b7ac122b45a1677be084d07651d7024a2
[u/mrichter/AliRoot.git] / RICH / AliRICHParam.h
1 #ifndef AliRICHParam_h
2 #define AliRICHParam_h
3
4 #include <TObject.h>
5 #include "AliRICHConst.h"
6
7 class AliRICHParam :public TObject  
8 {
9 public:
10            AliRICHParam();  
11   virtual ~AliRICHParam()                    {;}  
12   
13   inline  Int_t Neighbours(Int_t iPadX,Int_t iPadY,Int_t aListX[4],Int_t aListY[4])const;                      //pad->neibours
14   inline  void   SigGenInit(Float_t x,Float_t y);
15   inline  Bool_t SigGenCond(Float_t x,Float_t y);
16   static  Int_t   Local2Pad(Float_t x,Float_t y,Int_t &padx,Int_t &pady);               //(x,y)->(padx,pady), returns sector code 
17   static  Int_t   Local2PadX(Float_t x,Float_t y)    {Int_t padx,pady;Local2Pad(x,y,padx,pady);return padx;}//(x,y)->padx
18   static  Int_t   Local2PadY(Float_t x,Float_t y)    {Int_t padx,pady;Local2Pad(x,y,padx,pady);return pady;}//(x,y)->pady
19   static  void    Pad2Local(Int_t padx,Int_t pady,Float_t &x,Float_t &y);                                         //(padx,pady)->(x,y)
20   static  Int_t   LocalX2Wire(Float_t x)      {return  Int_t((x+PcSizeX()/2)/WirePitch())+1;}         //x->wire number
21   static  Float_t Wire2LocalX(Int_t iWireN)   {return iWireN*WirePitch()-PcSizeX()/2;}                //wire number->x
22   
23   Float_t Gain(Float_t y);                                 //Returns total charge induced by single photon
24   Float_t TotalCharge(Int_t iPID,Float_t eloss,Float_t y); //Returns total charge induced by particle lost eloss GeV
25   static  Float_t AssignChargeToPad(Float_t hx,Float_t hy, Int_t px, Int_t py); //Returns charge assigned to given pad for a given hit
26   void    FirstPad(Float_t x,Float_t y);
27           
28   static  Float_t AnodeCathodeGap()          {return 0.2;}
29   
30   static  Int_t   NpadsX()                   {return 144;}
31   static  Int_t   NpadsY()                   {return 160;}   
32   static  Int_t   NpadsXsec()                {return NpadsX()/3;}   
33   static  Int_t   NpadsYsec()                {return NpadsY()/2;}   
34   static  Float_t DeadZone()                 {return 2.6;}
35   static  Float_t PadSizeX()                 {return 0.84;}
36   static  Float_t PadSizeY()                 {return 0.8;}
37   static  Float_t SectorSizeX()              {return NpadsX()*PadSizeX()/3;}
38   static  Float_t SectorSizeY()              {return NpadsY()*PadSizeY()/2;}  
39   static  Float_t PcSizeX()                  {return NpadsX()*PadSizeX()+2*DeadZone();}
40   static  Float_t PcSizeY()                  {return NpadsY()*PadSizeY()+DeadZone();}
41   static  Float_t WirePitch()                {return PadSizeX()/2;}
42             
43   void    Size(Float_t x,Float_t y,Float_t z){fSizeX=x;fSizeY=y;fSizeZ=z;}
44   void    GeantSize(Float_t *pArr)      const{pArr[0]=fSizeX/2;pArr[1]=fSizeY/2;pArr[2]=fSizeZ/2;}  
45   Float_t SizeX()                       const{return fSizeX;}
46   Float_t SizeY()                       const{return fSizeY;}
47   Float_t SizeZ()                       const{return fSizeZ;}   
48   void    Offset(Float_t offset)             {       fOffset=offset;}  
49   Float_t Offset()                      const{return fOffset;}  
50   void    Angles(Float_t xy,Float_t yz)      {       fAngleXY=xy;fAngleYZ=yz;} 
51   Float_t AngleYZ()                     const{return fAngleYZ*kD2r;} 
52   Float_t AngleXY()                     const{return fAngleXY*kD2r;} 
53   void    AngleRot(Float_t angle)            {       fAngleRot=angle;}
54   Float_t AngleRot()                    const{return fAngleRot*kD2r;}                
55   static Float_t GapThickness()              {return 8.0;}      
56   void    ProximityGapThickness(Float_t a)   {       fProximityGapThickness=a;}
57   Float_t ProximityGapThickness()       const{return fProximityGapThickness;}    
58   void    QuartzLength(Float_t a)            {       fQuartzLength=a;}
59   Float_t QuartzLength()                const{return fQuartzLength;}   
60   void    QuartzWidth(Float_t a)             {       fQuartzWidth=a;}
61   Float_t QuartzWidth()                 const{return fQuartzWidth;}
62   static Float_t QuartzThickness()           {return 0.5;}   
63   void    OuterFreonLength(Float_t a)        {       fOuterFreonLength=a;}
64   Float_t OuterFreonLength()            const{return fOuterFreonLength;}   
65   void    OuterFreonWidth(Float_t a)         {       fOuterFreonWidth=a;}
66   Float_t OuterFreonWidth()             const{return fOuterFreonWidth;}   
67   void    InnerFreonLength(Float_t a)        {       fInnerFreonLength=a;}
68   Float_t InnerFreonLength()            const{return fInnerFreonLength;}   
69   void    InnerFreonWidth(Float_t a)         {       fInnerFreonWidth=a;}
70   Float_t InnerFreonWidth()             const{return fInnerFreonWidth;}   
71   static  Float_t FreonThickness()           {return 1.5;}   
72   static  Float_t RadiatorToPads()           {return FreonThickness()+QuartzThickness()+GapThickness();}   
73         
74   void    SigmaIntegration(Float_t a)        {       fSigmaIntegration=a;}    
75   Float_t SigmaIntegration()            const{return fSigmaIntegration;}    
76   void    ChargeSpreadX(Float_t a)           {       fChargeSpreadX=a;}
77   Float_t ChargeSpreadX()               const{return fChargeSpreadX;}    
78   void    ChargeSpreadY(Float_t a)           {       fChargeSpreadY=a;}  
79   Float_t ChargeSpreadY()               const{return fChargeSpreadY;}  
80   Float_t AreaX()                       const{return fSigmaIntegration*fChargeSpreadX;} 
81   Float_t AreaY()                       const{return fSigmaIntegration*fChargeSpreadY;} 
82   void    ChargeSlope(Float_t a)             {       fChargeSlope=a;}
83   Float_t ChargeSlope()                      {return fChargeSlope;}
84   void    MaxAdc(Int_t a)                    {       fMaxAdc=a;}
85   Int_t   MaxAdc()                      const{return fMaxAdc;}
86   void    AlphaFeedback(Float_t a)           {       fAlphaFeedback=a;}
87   Float_t AlphaFeedback()               const{return fAlphaFeedback;}
88   void    EIonisation(Float_t a)             {       fEIonisation=a;}
89   Float_t EIonisation()                 const{return fEIonisation;}                            
90   static Float_t SqrtKx3()  {return 0.77459667;}
91   static Float_t Kx2()      {return 0.962;}
92   static Float_t Kx4()      {return 0.379;}
93   static Float_t SqrtKy3()  {return 0.77459667;}
94   static Float_t Ky2()      {return 0.962;}
95   static Float_t Ky4()      {return 0.379;}
96
97   void    WireSag(Int_t a)                   {       fWireSag=a;}
98   void    Voltage(Int_t a)                   {       fVoltage=a;}       
99   Float_t Voltage()                     const{return fVoltage;}       
100 protected:
101   static Int_t   Local2Sector(Float_t &x,Float_t &y); //(x,y)->sector
102   static Int_t   Pad2Sector(Int_t &padx,Int_t &pady); //(padx,pady)->sector
103   
104   Int_t   fCurrentPadX,fCurrentPadY;              //???
105   Int_t   fCurrentWire;                           //???
106     
107   Float_t fSizeX;  Float_t fSizeY; Float_t fSizeZ;                                //chamber outer size, cm
108   Float_t fAngleRot;                                                              //azimuthal rotation XY plane, deg  
109   Float_t fAngleYZ;                                                               //angle between chambers YZ plane, deg
110   Float_t fAngleXY;                                                               //angle between chambers XY plane, deg
111   Float_t fOffset;                                                                //chambers offset from IP, cm   
112   Float_t fProximityGapThickness;                                                 //proximity gap thickness, cm
113   Float_t fQuartzLength;     Float_t fQuartzWidth;                                //quartz window size, cm
114   Float_t fOuterFreonLength; Float_t fOuterFreonWidth;                            //freon box outer size, cm
115   Float_t fInnerFreonLength; Float_t fInnerFreonWidth;                            //freon box inner size, cm
116   
117   Float_t fChargeSlope;              //Slope of the charge distribution
118   Float_t fChargeSpreadX;            //Width of the charge distribution in x
119   Float_t fChargeSpreadY;            //Width of the charge distribution in y
120   Float_t fSigmaIntegration;         //Number of sigma's used for charge distribution
121   Float_t fAlphaFeedback;            //Feedback photons coefficient
122   Float_t fEIonisation;              //Mean ionisation energy
123   Int_t   fMaxAdc;                   //Maximum ADC channel
124   Int_t   fWireSag;                  //Flag to turn on/off (0/1) wire sag
125   Int_t   fVoltage;                  //Working voltage (2000, 2050, 2100, 2150)
126
127   ClassDef(AliRICHParam,2)    //RICH main parameters
128 };
129 //__________________________________________________________________________________________________
130 void AliRICHParam::SigGenInit(Float_t x,Float_t y)
131 {//Initialises pad and wire position during stepping
132   Local2Pad(x,y,fCurrentPadX,fCurrentPadY);
133   fCurrentWire= (x>0) ? Int_t(x/WirePitch())+1 : Int_t(x/WirePitch())-1 ;
134 }
135 //__________________________________________________________________________________________________
136 Bool_t AliRICHParam::SigGenCond(Float_t x,Float_t y)
137 {//Signal will be generated if particle crosses pad boundary or boundary between two wires.
138   Int_t curPadX,curPadY;
139   Local2Pad(x,y,curPadX,curPadY);
140   Int_t currentWire=(x>0) ? Int_t(x/WirePitch())+1 : Int_t(x/WirePitch())-1;
141   if((curPadX != fCurrentPadX) || (curPadY != fCurrentPadY) || (currentWire!=fCurrentWire)) 
142     return kTRUE;
143   else
144     return kFALSE;
145 }//Bool_t AliRICHParam::SigGenCond(Float_t x,Float_t y)
146 //__________________________________________________________________________________________________
147 Int_t AliRICHParam::Neighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t listY[4])const
148 {
149   listX[0]=iPadX;   listY[0]=iPadY-1;       
150   listX[1]=iPadX+1; listY[1]=iPadY;       
151   listX[2]=iPadX;   listY[2]=iPadY+1;       
152   listX[3]=iPadX-1; listY[3]=iPadY;       
153   return 4;
154 }
155 //__________________________________________________________________________________________________
156 #endif //AliRICHParam_h