Getting the trigger descriptors from CDB
[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 // Implementation class: AliHMPIDCluster
7 //   
8 //   class to reconstruct clester in HMPID
9 //   it is forseen to Solve (split) the raw cluster in 
10 //   several clusters (# local maxima in the raw cluster -> deconvolution
11 //   according to a Mathieson profile of the charge 
12 //
13 #include "AliHMPIDDigit.h"  //DigAdd()
14 #include <TObjArray.h>     //DigAdd()      
15 class TClonesArray;        //Solve()
16
17 class AliHMPIDCluster :public TObject
18 {
19 public:
20   enum EClusterStatus {kFrm,kCoG,kLo1,kUnf,kMax,kNot,kEdg,kSi1,kNoLoc,kAbn,kEmp=-1};      //status flags    
21   AliHMPIDCluster():TObject( ),fCh(-1),fSi(-1),fSt(kEmp),fBox(-1),fNlocMax(-1),fMaxQpad(-1),fMaxQ(-1),fQRaw(0),fQ(0),fErrQ(-1),fX(0),fErrX(-1),fY(0),fErrY(-1),fChi2(-1),fDigs(0) {} //empty ctor
22   
23   
24   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),fQRaw(c.fQRaw),
25                                                                   fQ (c.fQ ),fErrQ(c.fErrQ),
26                                                                   fX (c.fX ),fErrX(c.fErrX),
27                                                                   fY (c.fY ),fErrY(c.fErrY),fChi2(c.fChi2),fDigs(0)                  {}//copy ctor
28   AliHMPIDCluster &operator=(const AliHMPIDCluster &c) {if(this == &c)return *this;TObject::operator=(c);          
29                                                         fSi=c.fSi;  fSt=c.fSt; fCh=c.fCh; fBox=c.fBox;fNlocMax=c.fNlocMax;fMaxQpad=c.fMaxQpad; fMaxQ=c.fMaxQ;fQRaw=c.fQRaw;
30                                                         fQ=c.fQ; fErrQ=c.fErrQ; 
31                                                         fX=c.fX; fErrX=c.fErrX;
32                                                         fY=c.fY; fErrY=c.fErrY; fChi2=c.fChi2;fDigs=c.fDigs ? new TObjArray(*c.fDigs):0; return *this;}
33     
34   virtual ~AliHMPIDCluster(                                     )                                                                        {if(fDigs) delete fDigs; fDigs=0;}
35 //framework part                   
36          void           Draw   (Option_t *opt=""                                  );                       //overloaded TObject::Print() to draw cluster in current canvas
37          void           Print  (Option_t *opt=""                                  )const;                  //overloaded TObject::Print() to print cluster info
38   static void           FitFunc(Int_t &iNpars, Double_t* /*deriv*/, Double_t &chi2, Double_t *par, Int_t /* */);//fit function to be used by MINUIT
39 //private part  
40          Int_t          Box      (                                         )const{return fBox;                                  }
41          void           CoG      (                                         );                                                      //calculates center of gravity
42          void           CorrSin  (                                         );                                                      //sinoidal correction   
43          Int_t          Ch       (                                         )const{return fCh;                                    } //chamber number
44   inline void           DigAdd   (AliHMPIDDigit *pDig                      );                                                      //add new digit ot the cluster
45          AliHMPIDDigit* Dig      (Int_t i                                  )const{return (AliHMPIDDigit*)fDigs->At(i);           } //pointer to i-th digi 
46   inline Bool_t         IsInPc   ();                                                                                               //check if is in the current PC
47   inline void           Reset    (                                         );                                                      //cleans the cluster
48          Int_t          Size     (                                         )const{return fSi;                                    } //returns number of pads in formed cluster 
49          Int_t          Solve    (TClonesArray *pCluLst,Bool_t isUnfold    );                                                      //solve cluster: MINUIT fit or CoG
50          Int_t          Status   (                                         ) const{return fSt;}                                    //Status of cluster                                  
51          Double_t       QRaw     (                                         )const{return fQRaw;                                  } //raw cluster charge in QDC channels 
52          Double_t       Q        (                                         )const{return fQ;                                     } //given cluster charge in QDC channels 
53          Double_t       Qe       (                                         )const{return fErrQ;                                  } //Error in cluster charge in QDC channels 
54          Double_t       X        (                                         )const{return fX;                                     } //cluster x position in LRS
55          Double_t       Xe       (                                         )const{return fErrX;                                  } //cluster charge in QDC channels 
56          Double_t       Y        (                                         )const{return fY;                                     } //cluster y position in LRS 
57          Double_t       Ye       (                                         )const{return fErrY;                                  } //cluster charge in QDC channels 
58          Double_t       Chi2     (                                         )const{return fChi2;                                  } //chi2 of the fit
59          void           DoCorrSin(Bool_t doCorrSin                         ){fgDoCorrSin=doCorrSin;}                                // Set sinoidal correction
60          void           SetX     (Double_t x                               ){fX=x;}                                                // Setter
61          void           SetY     (Double_t y                               ){fY=y;}                                                // Setter
62 protected:
63   Int_t         fCh;          //chamber number
64   Int_t         fSi;          //size of the formed cluster from which this cluster deduced
65   Int_t         fSt;          //flag to mark the quality of the cluster
66   Int_t         fBox;         //box contaning this cluster
67   Int_t         fNlocMax;     //number of local maxima in formed cluster
68   Int_t         fMaxQpad;     //abs pad number of a pad with the highest charge
69   Double_t      fMaxQ;        //that max charge value
70   Double_t      fQRaw;        //QDC value of the raw cluster
71   Double_t      fQ;           //QDC value of the actual cluster
72   Double_t      fErrQ;        //error on Q
73   Double_t      fX;           //local x postion, [cm]
74   Double_t      fErrX;        //error on x postion, [cm]
75   Double_t      fY;           //local y postion, [cm]
76   Double_t      fErrY;        //error on y postion, [cm]
77   Double_t      fChi2;        //some estimator of the fit quality
78   TObjArray    *fDigs;        //! list of digits forming this cluster
79   static  Bool_t fgDoCorrSin; //flag to switch on/off correction for Sinusoidal to cluster reco
80   ClassDef(AliHMPIDCluster,6) //HMPID cluster class
81 };//class AliHMPIDCluster
82
83 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
84 void AliHMPIDCluster::DigAdd(AliHMPIDDigit *pDig)
85 {
86 // Adds a given digit to the list of digits belonging to this cluster, cluster is not owner of digits
87 // Arguments: pDig - pointer to digit to be added  
88 // Returns: none  
89   if(!fDigs) {fSi=0;fDigs = new TObjArray;} //create list of digits in the first invocation
90   fDigs->Add(pDig);
91   fSt=kFrm;
92   fSi++;
93 }
94 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
95 void AliHMPIDCluster::Reset()
96 {
97   //
98   //
99   //
100   if(fDigs) delete fDigs; 
101   fDigs=0; 
102   fSt=kEmp;
103   fQRaw=fQ=0;
104   fX=fY=0;
105   fCh=fSi=fBox=fNlocMax=fMaxQpad=-1;
106   fMaxQ=fErrQ=fErrX=fErrY=fChi2=-1; //empty ctor
107 }
108 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
109 Bool_t AliHMPIDCluster::IsInPc()
110 {
111   //Check if (X,Y) position is inside the PC limits
112   //Arguments:
113   //  Returns: True or False
114   Int_t pc = ((AliHMPIDDigit*)fDigs->At(0))->Pc();
115  
116   
117   if ( fX < AliHMPIDParam::MinPcX(pc) || fX > AliHMPIDParam::MaxPcX(pc) || 
118        fY < AliHMPIDParam::MinPcY(pc) || fY > AliHMPIDParam::MaxPcY(pc) ) return kFALSE;
119   
120   return kTRUE;
121   
122 }
123
124 #endif