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