]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/AliHMPIDCluster.h
Minor protection
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDCluster.h
1 #ifndef AliHMPIDCluster_h
2 #define AliHMPIDCluster_h
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 #include "AliHMPIDDigit.h"  //DigAdd()
7 #include <TObjArray.h>     //DigAdd()      
8 class TClonesArray;        //Solve()
9
10 class AliHMPIDCluster :public TObject
11 {
12 public:
13   enum EClusterStatus {kFrm,kCoG,kLo1,kUnf,kMax,kAbn,kNot,kEdg,kSi1,kNoLoc,kEmp=-1};      //status flags    
14   AliHMPIDCluster():TObject( ),fCh(-1),fSi(-1),fSt(kEmp),fBox(-1),fNlocMax(-1),fMaxQpad(-1),fMaxQ(-1),fQ(-1),fQi(-1),fQe(-1),fX(-1),fXi(-1),fXe(-1),fY(-1),fYi(-1),fYe(-1),fChi2(-1),fDigs(0) {} //empty ctor
15   
16   
17   AliHMPIDCluster           (const AliHMPIDCluster &c):TObject(c),fCh(c.fCh),fSi(c.fSi),fSt(c.fSt),fBox(c.fBox),fNlocMax(c.fNlocMax),fMaxQpad(c.fMaxQpad),fMaxQ(c.fMaxQ),
18                                                                   fQ (c.fQ ),fQi(c.fQi),fQe(c.fQe),
19                                                                   fX (c.fX ),fXi(c.fXi),fXe(c.fXe),
20                                                                   fY (c.fY ),fYi(c.fYi),fYe(c.fYe),fChi2(c.fChi2),fDigs(0)                  {}//copy ctor
21   AliHMPIDCluster &operator=(const AliHMPIDCluster &c) {if(this == &c)return *this;TObject::operator=(c);          
22                                                         fSi=c.fSi;  fSt=c.fSt; fCh=c.fCh; fBox=c.fBox;fNlocMax=c.fNlocMax;fMaxQpad=c.fMaxQpad; fMaxQ=c.fMaxQ;
23                                                         fQ=c.fQ; fQi=c.fQi;fQe=c.fQe; 
24                                                         fX=c.fX; fXi=c.fXi;fXe=c.fXe;
25                                                         fY=c.fY; fYi=c.fYi;fYe=c.fYe; fChi2=c.fChi2;fDigs=c.fDigs ? new TObjArray(*c.fDigs):0; return *this;}
26     
27   virtual ~AliHMPIDCluster(                                     )                                                                        {if(fDigs) delete fDigs; fDigs=0;}
28 //framework part                   
29          void           Draw   (Option_t *opt=""                                  );                       //overloaded TObject::Print() to draw cluster in current canvas
30          void           Print  (Option_t *opt=""                                  )const;                  //overloaded TObject::Print() to print cluster info
31   static void           FitFunc(Int_t &, Double_t *, Double_t &, Double_t *, Int_t);                       //fit function to be used by MINUIT
32 //private part  
33          void           CoG      (                                         );                                                      //calculates center of gravity
34          void           CorrSin  (                                         );                                                      //sinoidal correction   
35          Int_t          Ch       (                                         )const{return fCh;                                    } //chamber number
36   inline void           DigAdd   (AliHMPIDDigit *pDig                      );                                                      //add new digit ot the cluster
37          AliHMPIDDigit* Dig      (Int_t i                                  )const{return (AliHMPIDDigit*)fDigs->At(i);           } //pointer to i-th digi 
38   inline Bool_t         IsInPc   ();                                                                                        //check if is in the current PC
39   inline void           Reset    (                                         );                                                      //cleans the cluster
40          Int_t          Size     (                                         )const{return fSi;                                    } //returns number of pads in formed cluster 
41          Int_t          Solve    (TClonesArray *pCluLst,Bool_t isUnfold    );                                                      //solve cluster: MINUIT fit or CoG
42          Int_t          Status  (                                          ) const{return fSt;}                                   //Status of cluster                                  
43          Double_t       Q        (                                         )const{return fQ;                                     } //cluster charge in QDC channels 
44          Double_t       Qi       (                                         )const{return fQi;                                    } //cluster charge in QDC channels 
45          Double_t       Qe       (                                         )const{return fQe;                                    } //cluster charge in QDC channels 
46          Double_t       X        (                                         )const{return fX;                                     } //cluster x position in LRS
47          Double_t       Xi       (                                         )const{return fXi;                                    } //cluster charge in QDC channels 
48          Double_t       Xe       (                                         )const{return fXe;                                    } //cluster charge in QDC channels 
49          Double_t       Y        (                                         )const{return fY;                                     } //cluster y position in LRS 
50          Double_t       Yi       (                                         )const{return fYi;                                    } //cluster charge in QDC channels 
51          Double_t       Ye       (                                         )const{return fYe;                                    } //cluster charge in QDC channels 
52          Double_t       Chi2     (                                         )const{return fChi2;                                  } 
53 protected:
54   Int_t         fCh;          //chamber number
55   Int_t         fSi;          //size of the formed cluster from which this cluster deduced  
56   Int_t         fSt;          //flag to mark the quality of the cluster   
57   Int_t         fBox;         //box contaning this cluster  
58   Int_t         fNlocMax;     //number of local maxima in formed cluster        
59   Int_t         fMaxQpad;     //abs pad number of a pad with the highest charge
60   Double_t      fMaxQ;        //that max charge value             
61   Double_t      fQ;           //QDC value
62   Double_t      fQi;          //initial Q of local maximum
63   Double_t      fQe;          //error on Q 
64   Double_t      fX;           //local x postion, [cm] 
65   Double_t      fXi;          //initial x of local maximum, [cm] 
66   Double_t      fXe;          //error on x postion, [cm] 
67   Double_t      fY;           //local y postion, [cm]  
68   Double_t      fYi;          //initial y of local maximum, [cm] 
69   Double_t      fYe;          //error on y postion, [cm] 
70   Double_t      fChi2;        //some estimatore of fit quality  
71   TObjArray    *fDigs;        //! list of digits forming this cluster
72   ClassDef(AliHMPIDCluster,5) //HMPID cluster class       
73 };//class AliHMPIDCluster
74
75 typedef AliHMPIDCluster AliRICHCluster; // for backward compatibility
76
77 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
78 void AliHMPIDCluster::DigAdd(AliHMPIDDigit *pDig)
79 {
80 // Adds a given digit to the list of digits belonging to this cluster, cluster is not owner of digits
81 // Arguments: pDig - pointer to digit to be added  
82 //   Returns: none  
83   if(!fDigs) {fSi=0;fDigs = new TObjArray;} //create list of digits in the first invocation
84   fDigs->Add(pDig);
85   fSt=kFrm;
86   fSi++;
87 }
88 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
89 void AliHMPIDCluster::Reset()
90 {
91   if(fDigs) delete fDigs; 
92   fDigs=0; 
93   fQ=fCh=fSi=-1;fX=fY=-1;fSt=kEmp;      
94 }
95 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
96 Bool_t AliHMPIDCluster::IsInPc()
97 {
98   Int_t pc = ((AliHMPIDDigit*)fDigs->At(0))->Pc();
99  
100   
101   if ( fX < AliHMPIDDigit::fMinPcX[pc] || fX > AliHMPIDDigit::fMaxPcX[pc] || 
102        fY < AliHMPIDDigit::fMinPcY[pc] || fY > AliHMPIDDigit::fMaxPcY[pc] ) return kFALSE;
103   
104   return kTRUE;
105   
106 }
107
108 #endif