PatRec adapted to new IO
[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   Int_t   Local2Pad(Float_t x,Float_t y,Int_t &padx,Int_t &pady)const;               //(x,y)->(padx,pady), returns sector code 
17   Int_t   Local2PadX(Float_t x,Float_t y)    const {Int_t padx,pady;Local2Pad(x,y,padx,pady);return padx;}//(x,y)->padx
18   Int_t   Local2PadY(Float_t x,Float_t y)    const {Int_t padx,pady;Local2Pad(x,y,padx,pady);return pady;}//(x,y)->pady
19   void    Pad2Local(Int_t padx,Int_t pady,Float_t &x,Float_t &y);                                         //(padx,pady)->(x,y)
20   Int_t   LocalX2Wire(Float_t x)             const {return  Int_t((x+PcSizeX()/2)/fWirePitch)+1;}         //x->wire number
21   Float_t Wire2LocalX(Int_t iWireN)          const {return iWireN*fWirePitch-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   Float_t PadCharge(Int_t /* iPadX */,Int_t /* iPadY */) {return 0;}   //Returns charge for a given pad
26   void    FirstPad(Float_t x,Float_t y);
27           
28   static  Int_t   NpadsX()                   {return 144;}
29   static  Int_t   NpadsY()                   {return 160;}   
30   static  Int_t   NpadsXsec()                {return NpadsX()/3;}   
31   static  Int_t   NpadsYsec()                {return NpadsY()/2;}   
32   void    DeadZone(Float_t a)                {       fDeadZone=a;}
33   Float_t DeadZone()                    const{return fDeadZone;}
34   void    PadSize(Float_t x,Float_t y)       {       fPadSizeX=x;fPadSizeY=y;} 
35   Float_t PadSizeX()                    const{return fPadSizeX;}
36   Float_t PadSizeY()                    const{return fPadSizeY;}
37   Float_t SectorSizeX()                 const{return NpadsX()*PadSizeX()/3;}
38   Float_t SectorSizeY()                 const{return NpadsY()*PadSizeY()/2;}  
39   Float_t PcSizeX()                     const{return NpadsX()*PadSizeX()+2*DeadZone();}
40   Float_t PcSizeY()                     const{return NpadsY()*PadSizeY()+DeadZone();}
41   Float_t WirePitch()                   const{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   void    GapThickness(Float_t a)            {       fGapThickness=a;}    
56   Float_t GapThickness()                const{return fGapThickness;}      
57   void    ProximityGapThickness(Float_t a)   {       fProximityGapThickness=a;}
58   Float_t ProximityGapThickness()       const{return fProximityGapThickness;}    
59   void    QuartzLength(Float_t a)            {       fQuartzLength=a;}
60   Float_t QuartzLength()                const{return fQuartzLength;}   
61   void    QuartzWidth(Float_t a)             {       fQuartzWidth=a;}
62   Float_t QuartzWidth()                 const{return fQuartzWidth;}
63   void    QuartzThickness(Float_t a)         {       fQuartzThickness=a;}
64   Float_t QuartzThickness()             const{return fQuartzThickness;}   
65   void    OuterFreonLength(Float_t a)        {       fOuterFreonLength=a;}
66   Float_t OuterFreonLength()            const{return fOuterFreonLength;}   
67   void    OuterFreonWidth(Float_t a)         {       fOuterFreonWidth=a;}
68   Float_t OuterFreonWidth()             const{return fOuterFreonWidth;}   
69   void    InnerFreonLength(Float_t a)        {       fInnerFreonLength=a;}
70   Float_t InnerFreonLength()            const{return fInnerFreonLength;}   
71   void    InnerFreonWidth(Float_t a)         {       fInnerFreonWidth=a;}
72   Float_t InnerFreonWidth()             const{return fInnerFreonWidth;}   
73   void    FreonThickness(Float_t a)          {       fFreonThickness=a;}
74   Float_t FreonThickness()              const{return fFreonThickness;}   
75   void    RadiatorToPads(Float_t a)          {       fRadiatorToPads=a;}
76   Float_t RadiatorToPads()              const{return fRadiatorToPads;}   
77         
78   void    SigmaIntegration(Float_t a)        {       fSigmaIntegration=a;}    
79   Float_t SigmaIntegration()            const{return fSigmaIntegration;}    
80   void    ChargeSpreadX(Float_t a)           {       fChargeSpreadX=a;}
81   Float_t ChargeSpreadX()               const{return fChargeSpreadX;}    
82   void    ChargeSpreadY(Float_t a)           {       fChargeSpreadY=a;}  
83   Float_t ChargeSpreadY()               const{return fChargeSpreadY;}  
84   Float_t AreaX()                       const{return fSigmaIntegration*fChargeSpreadX;} 
85   Float_t AreaY()                       const{return fSigmaIntegration*fChargeSpreadY;} 
86   void    ChargeSlope(Float_t a)             {       fChargeSlope=a;}
87   Float_t ChargeSlope()                      {return fChargeSlope;}
88   void    MaxAdc(Int_t a)                    {       fMaxAdc=a;}
89   Int_t   MaxAdc()                      const{return fMaxAdc;}
90   void    Pitch(Float_t a)                   {       fPitch=a;}
91   Float_t Pitch()                       const{return fPitch;}
92   void    AlphaFeedback(Float_t a)           {       fAlphaFeedback=a;}
93   Float_t AlphaFeedback()               const{return fAlphaFeedback;}
94   void    EIonisation(Float_t a)             {       fEIonisation=a;}
95   Float_t EIonisation()                 const{return fEIonisation;}                            
96   void    SqrtKx3(Float_t a)                 {       fSqrtKx3=a;};
97   void    Kx2(Float_t a)                     {       fKx2=a;}
98   void    Kx4(Float_t a)                     {       fKx4=a;}
99   void    SqrtKy3(Float_t a)                 {       fSqrtKy3=a;}
100   void    Ky2(Float_t a)                     {       fKy2=a;}
101   void    Ky4(Float_t a)                     {       fKy4=a;}
102   void    WireSag(Int_t a)                   {       fWireSag=a;}
103   void    Voltage(Int_t a)                   {       fVoltage=a;}       
104   Float_t Voltage()                     const{return fVoltage;}       
105 protected:
106   Int_t   Local2Sector(Float_t &x,Float_t &y)const; //(x,y)->sector
107   Int_t   Pad2Sector(Int_t &padx,Int_t &pady)const; //(padx,pady)->sector
108   
109   Float_t fDeadZone;                                //space between PC sectors, cm     
110   Float_t fPadSizeX,fPadSizeY;                      //pad size, cm
111   Float_t fWirePitch;                               //distance between wires along x
112   
113   Int_t   fCurrentPadX,fCurrentPadY;              //???
114   Int_t   fCurrentWire;                           //???
115     
116   Float_t fSizeX;  Float_t fSizeY; Float_t fSizeZ;                                //chamber outer size, cm
117   Float_t fAngleRot;                                                              //azimuthal rotation XY plane, deg  
118   Float_t fAngleYZ;                                                               //angle between chambers YZ plane, deg
119   Float_t fAngleXY;                                                               //angle between chambers XY plane, deg
120   Float_t fOffset;                                                                //chambers offset from IP, cm   
121   Float_t fGapThickness;                                                          //gap thickness, cm
122   Float_t fProximityGapThickness;                                                 //proximity gap thickness, cm
123   Float_t fQuartzLength;     Float_t fQuartzWidth;     Float_t fQuartzThickness;  //quartz window size, cm
124   Float_t fOuterFreonLength; Float_t fOuterFreonWidth;                            //freon box outer size, cm
125   Float_t fInnerFreonLength; Float_t fInnerFreonWidth;                            //freon box inner size, cm
126   Float_t fFreonThickness;                                                        //freon thickness
127   Float_t fRadiatorToPads;                                                        //distance from radiator to pads, cm
128   
129   Float_t fChargeSlope;              //Slope of the charge distribution
130   Float_t fChargeSpreadX;            //Width of the charge distribution in x
131   Float_t fChargeSpreadY;            //Width of the charge distribution in y
132   Float_t fSigmaIntegration;         //Number of sigma's used for charge distribution
133   Float_t fAlphaFeedback;            //Feedback photons coefficient
134   Float_t fEIonisation;              //Mean ionisation energy
135   Int_t   fMaxAdc;                   //Maximum ADC channel
136   Float_t fSqrtKx3;                  //Mathieson parameters for x
137   Float_t fKx2;                      //Mathieson parameters for x
138   Float_t fKx4;                      //Mathieson parameters for x
139   Float_t fSqrtKy3;                  //Mathieson parameters for y
140   Float_t fKy2;                      //Mathieson parameters for y 
141   Float_t fKy4;                      //Mathieson parameters for y
142   Float_t fPitch;                    //Anode-cathode pitch
143   Int_t   fWireSag;                  //Flag to turn on/off (0/1) wire sag
144   Int_t   fVoltage;                  //Working voltage (2000, 2050, 2100, 2150)
145
146   ClassDef(AliRICHParam,1)    //RICH main parameters
147 };
148 //__________________________________________________________________________________________________
149 void AliRICHParam::SigGenInit(Float_t x,Float_t y)
150 {//Initialises pad and wire position during stepping
151   Local2Pad(x,y,fCurrentPadX,fCurrentPadY);
152   fCurrentWire= (x>0) ? Int_t(x/fWirePitch)+1 : Int_t(x/fWirePitch)-1 ;
153 }
154 //__________________________________________________________________________________________________
155 Bool_t AliRICHParam::SigGenCond(Float_t x,Float_t y)
156 {//Signal will be generated if particle crosses pad boundary or boundary between two wires.
157   Int_t curPadX,curPadY;
158   Local2Pad(x,y,curPadX,curPadY);
159   Int_t currentWire=(x>0) ? Int_t(x/fWirePitch)+1 : Int_t(x/fWirePitch)-1;
160   if((curPadX != fCurrentPadX) || (curPadY != fCurrentPadY) || (currentWire!=fCurrentWire)) 
161     return kTRUE;
162   else
163     return kFALSE;
164 }//Bool_t AliRICHParam::SigGenCond(Float_t x,Float_t y)
165 //__________________________________________________________________________________________________
166 Int_t AliRICHParam::Neighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t listY[4])const
167 {
168   listX[0]=iPadX;   listY[0]=iPadY-1;       
169   listX[1]=iPadX+1; listY[1]=iPadY;       
170   listX[2]=iPadX;   listY[2]=iPadY+1;       
171   listX[3]=iPadX-1; listY[3]=iPadY;       
172   return 4;
173 }
174 //__________________________________________________________________________________________________
175 #endif //AliRICHParam_h