]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHDigitN.h
adding entries parameter to execute function
[u/mrichter/AliRoot.git] / RICH / AliRICHDigitN.h
1 #ifndef AliRICHDigitN_h
2 #define AliRICHDigitN_h
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 #include <AliDigit.h>      //base class  
7
8 class AliRICHDigitN :public AliDigit //TObject-AliDigit-AliRICHDigit
9 {
10 public:
11   enum EAbsPad {kChAbs=100000000,kPcAbs=1000000,kPadAbsX=1000,kPadAbsY=1};       //absolute pad number structure
12   enum ERawData{kDilX=8,kDilY=6,kNdil=10,kNrow=24,kNddls=14};                    //RAW data structure
13   enum EPadData{kPadsPcX=80,kPadsPcY=48,kPadsChamX=160,kPadsChamY=144,kNpc=6};   //Segmentation structure 
14 //ctor&dtor    
15            AliRICHDigitN(                                     ):AliDigit(),fPad(Abs(-1,-1,-1,-1)) ,fQdc(-1)  {} //default ctor
16   inline   AliRICHDigitN(Int_t c,Float_t x,Float_t y,Float_t q);                                                //ctor 
17   virtual ~AliRICHDigitN()                                {} //dtor
18 //framework part    
19          Bool_t  IsSortable  (                               )const{return kTRUE;}                                                     //provision to use TObject::Sort() 
20   inline Int_t   Compare     (const TObject *pObj            )const;                                                                   //provision to use TObject::Sort()
21          void    Print       (Option_t *opt=""               )const;                                                                   //TObject::Print() overloaded
22 //private part  
23   static Int_t   Abs         (Int_t c,Int_t s,Int_t x,Int_t y)     {return c*kChAbs+s*kPcAbs+x*kPadAbsX+y*kPadAbsY; }                  //(ch,pc,padx,pady)-> abs pad
24   static Int_t   A2C         (Int_t pad                      )     {return pad/kChAbs;                              }                  //abs pad -> chamber
25   static Int_t   A2P         (Int_t pad                      )     {return pad%kChAbs/kPcAbs;                       }                  //abs pad -> pc
26   static Int_t   A2X         (Int_t pad                      )     {return pad%kPcAbs/kPadAbsX;                     }                  //abs pad -> pad X 
27   static Int_t   A2Y         (Int_t pad                      )     {return pad%kPadAbsX;                            }                  //abs pad -> pad Y 
28          Int_t   Addr        (                               )const{Int_t mapY2A[kDilY]={5,3,1,0,2,4}; return mapY2A[A2Y(fPad)%kDilY]+kDilY*(A2X(fPad)%kDilX);}//raw a=0..47
29          void    AddTidOffset(Int_t offset                   )     {for (Int_t i=0; i<3; i++) if (fTracks[i]>0) fTracks[i]+=offset;};  //needed for merging
30          Int_t   Ch          (                               )const{return A2C(fPad);                               }                  //chamber number
31          Int_t   Dilogic     (                               )const{return 10-PadX()/kDilX;                         }                  //raw d=1..10
32   static void    DrawPc      (                               );                                                                        //draw PCs
33          Int_t   Ddl         (                               )const{return (PadX()<kPadsPcX) ? 2*Ch()-2 : 2*Ch()-1;}                  //DDL number 0..13
34          Float_t LorsX       (                               )const{return (PadX()+0.5)*SizePadX()+(Pc()%2)*(SizePcX()+SizeDead());}   //center of the pad x, [cm]
35          Float_t LorsY       (                               )const{return (PadY()+0.5)*SizePadY()+(Pc()/2)*(SizePcY()+SizeDead());}   //center of the pad y, [cm]
36          Int_t   PadX        (                               )const{return A2X(fPad);}                                                 //x position of the pad
37          Int_t   PadY        (                               )const{return A2Y(fPad);}                                                 //y postion of the pad     
38          Int_t   Pad         (                               )const{return fPad;}                                                      //absolute id of this pad
39          Float_t Qdc         (                               )const{return fQdc;}                                                      //charge, [QDC]
40          Int_t   Pc          (                               )const{return A2P(fPad);}                                                 //PC position number
41   static void    PrintSize   (                               );                                                                        //print all segmentation sizes      
42          Int_t   Row         (                               )const{Int_t r=1+Pc()/2*8+PadY()/kDilY; return (Pc()%2)?kNrow-r+1:r;}     //row r=1..24
43          void    Set         (Int_t c,Int_t s,Int_t x,Int_t y)     {fPad=Abs(c,s,x,y);}                                                //set new digit
44          void    ReadRaw     (Int_t ddl,Int_t r,Int_t d,Int_t a){Int_t mapA2Y[kDilY]={3,2,4,1,5,0};fPad=Abs(ddl/2,ddl%7,d*kDilX+a/kDilY,r*kDilY+mapA2Y[a%kDilY]);} //from raw
45   static Float_t SizePadX    (                               )     {return 0.8;}                                                       //pad size x, [cm]        
46   static Float_t SizePadY    (                               )     {return 0.84;}                                                      //pad size y, [cm]  
47   static Float_t SizePcX     (                               )     {return SizePadX()*kPadsPcX;}                                      //PC size x, [cm]        
48   static Float_t SizePcY     (                               )     {return SizePadY()*kPadsPcY;}                                      //PC size y, [cm]    
49   static Float_t SizeAllX    (                               )     {return SizePadX()*kPadsChamX+SizeDead();}                          //all PCs size x, [cm]        
50   static Float_t SizeAllY    (                               )     {return SizePadY()*kPadsChamY+2*SizeDead();}                        //all PCs size y, [cm]    
51   static Float_t SizeDead    (                               )     {return 2.6;}                                                       //dead zone size x, [cm]         
52   static void    TestSeg     (                               );                                                                        //test segmentation
53          void    Zoom        (                               ); 
54 protected:
55   Int_t   fPad;             //absolute pad number is chamber*kCham
56   Float_t fQdc;             //QDC value, fractions are permitted for summable procedure  
57   ClassDef(AliRICHDigitN,4) //RICH digit class       
58 };//class AliRICHDigitN
59 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
60 Int_t AliRICHDigitN::Compare(const TObject *pObj) const
61 {
62 // Used in Sort() method to compare to objects. Note that abs pad structure is first x then y, hence will be sorted on column basis.
63 // This feature is used in digitizer to facilitate finding of sdigits for the same pad since they all will come together after sorting.
64 // Arguments: pObj - pointer to object to compare with
65 //   Retunrs: -1 if AbsPad less then in pObj, 1 if more and 0 if they are the same      
66   if     (fPad==((AliRICHDigitN*)pObj)->Pad()) return  0;
67   else if(fPad >((AliRICHDigitN*)pObj)->Pad()) return  1;
68   else                                         return -1;
69 }
70 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
71 AliRICHDigitN::AliRICHDigitN(Int_t c,Float_t x,Float_t y,Float_t q):AliDigit(),fPad(Abs(-1,-1,-1,-1)),fQdc(-1)
72 {
73 // Determines abs pad number containing the given point (x,y) defined in the chamber RS.
74 // Pad count starts in lower left corner from 1,1 to 144,160 in upper right corner of a chamber.
75 // y ^  4 5
76 //   |  2 3
77 //   |  0 1
78 //    -------> x
79   Int_t pc,padx,pady;
80   if     (x>=          0          && x<=  SizePcX()            ) {pc=0; padx=Int_t( x                           / SizePadX());}//PC 0 or 2 or 4
81   else if(x>=SizePcX()+SizeDead() && x<=  SizeAllX()           ) {pc=1; padx=Int_t((x-  SizePcX()-  SizeDead()) / SizePadX());}//PC 2 or 4 or 6
82   else return;
83   if     (y>=          0          && y<=  SizePcY()            ) {      pady=Int_t( y                           / SizePadY());}//PC 0 or 1
84   else if(y>=SizePcY()+SizeDead() && y<=2*SizePcY()+SizeDead() ) {pc+=2;pady=Int_t((y-  SizePcY()-  SizeDead()) / SizePadY());}//PC 2 or 3
85   else if(y>=SizeAllY()-SizePcY() && y<=  SizeAllY()           ) {pc+=4;pady=Int_t((y-2*SizePcY()-2*SizeDead()) / SizePadY());}//PC 4 or 5
86   else return;
87   fPad=Abs(c,pc,padx,pady);
88   fQdc=q;
89 }
90 #endif