]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDCluster.h
memory leak fixed
[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//
1b10372c 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//
55a829a5 13#include "AliGeomManager.h"
14#include "AliCluster3D.h"
d3da6dc4 15#include "AliHMPIDDigit.h" //DigAdd()
16#include <TObjArray.h> //DigAdd()
17class TClonesArray; //Solve()
18
55a829a5 19class AliHMPIDCluster :public AliCluster3D
d3da6dc4 20{
21public:
03768ab2 22 enum EClusterStatus {kFrm,kCoG,kLo1,kUnf,kMax,kNot,kEdg,kSi1,kNoLoc,kAbn,kBig,kEmp=-1}; //status flags
55a829a5 23 AliHMPIDCluster():AliCluster3D(),
b38ac33a 24 fCh(-1),fSi(-1),fSt(kEmp),fBox(-1),fNlocMax(-1),fMaxQpad(-1),fMaxQ(-1),fQRaw(0),
c61a7285 25 fQ(0),fErrQ(-1),fXX(0),fErrX(-1),fYY(0),fErrY(-1),fChi2(-1),fDigs(0),fParam(AliHMPIDParam::Instance())
b38ac33a 26 {
b38ac33a 27 }//ctor
d1bf51e1 28
55a829a5 29
30 AliHMPIDCluster(const AliHMPIDCluster &c):AliCluster3D(c),
31 fCh(c.fCh),fSi(c.fSi),fSt(c.fSt),fBox(c.fBox),fNlocMax(c.fNlocMax),fMaxQpad(c.fMaxQpad),fMaxQ(c.fMaxQ),fQRaw(c.fQRaw),
32 fQ (c.fQ ),fErrQ(c.fErrQ),
894758d4 33 fXX (c.fXX ),fErrX(c.fErrX),
c61a7285 34 fYY (c.fYY ),fErrY(c.fErrY),fChi2(c.fChi2),fDigs(0),fParam(c.fParam) {}//copy ctor
55a829a5 35 virtual ~AliHMPIDCluster();//dtor {if(fDigs) delete fDigs; fDigs=0;}
d3da6dc4 36//framework part
d1bf51e1 37 void Draw (Option_t *opt="" ); //overloaded TObject::Print() to draw cluster in current canvas
38 void Print (Option_t *opt="" )const; //overloaded TObject::Print() to print cluster info
b38ac33a 39 static void FitFunc(Int_t &iNpars, Double_t* deriv, Double_t &chi2, Double_t *par, Int_t iflag);//fit function to be used by MINUIT
d3da6dc4 40//private part
54104a7c 41 Int_t Box ( )const{return fBox; } //Dimension of the cluster
d1bf51e1 42 void CoG ( ); //calculates center of gravity
43 void CorrSin ( ); //sinoidal correction
44 Int_t Ch ( )const{return fCh; } //chamber number
45 inline void DigAdd (AliHMPIDDigit *pDig ); //add new digit ot the cluster
46 AliHMPIDDigit* Dig (Int_t i )const{return (AliHMPIDDigit*)fDigs->At(i); } //pointer to i-th digi
27311693 47 inline Bool_t IsInPc (); //check if is in the current PC
d1bf51e1 48 inline void Reset ( ); //cleans the cluster
55a829a5 49 void SetClusterParams(Double_t xL,Double_t yL,Int_t iCh ); //Set AliCluster3D part
d1bf51e1 50 Int_t Size ( )const{return fSi; } //returns number of pads in formed cluster
54104a7c 51 Int_t Solve (TClonesArray *pCluLst,Int_t *pSigmaCut, Bool_t isUnfold); //solve cluster: MINUIT fit or CoG
27311693 52 Int_t Status ( ) const{return fSt;} //Status of cluster
e4a3eae8 53 Double_t QRaw ( )const{return fQRaw; } //raw cluster charge in QDC channels
54 Double_t Q ( )const{return fQ; } //given cluster charge in QDC channels
55 Double_t Qe ( )const{return fErrQ; } //Error in cluster charge in QDC channels
54104a7c 56 Double_t X ( )const{return fXX; } //cluster x position in LRS
e4a3eae8 57 Double_t Xe ( )const{return fErrX; } //cluster charge in QDC channels
54104a7c 58 Double_t Y ( )const{return fYY; } //cluster y position in LRS
27311693 59 Double_t Ye ( )const{return fErrY; } //cluster charge in QDC channels
60 Double_t Chi2 ( )const{return fChi2; } //chi2 of the fit
54104a7c 61 void DoCorrSin(Bool_t doCorrSin ){fgDoCorrSin=doCorrSin;} // Set sinoidal correction
62 void SetX (Double_t x ){fXX=x;} // Setter
63 void SetY (Double_t y ){fYY=y;} // Setter
3d1548fd 64 void SetQ (Double_t q ){fQ=q;if(fQ>4095)fQ=4095;} // Setter
65 void SetQRaw (Double_t qRaw ){fQRaw=qRaw;if(fQRaw>4095)fQRaw=4095;} // Setter
54104a7c 66 void SetSize (Int_t size ){fSi=size;} // Setter
1fd3befe 67 void SetCh (Int_t chamber ){fCh=chamber;} // Setter
3d1548fd 68 void SetChi2 (Double_t chi2 ){fChi2=chi2;} // Setter
b976b16b 69 void SetStatus(Int_t status ){fSt=status;} // Setter
54104a7c 70 void FindClusterSize(Int_t i,Int_t *pSigmaCut); //Find the clusterSize of deconvoluted clusters
5637918c 71 virtual void Clear(const Option_t*) { delete [] fDigs; fDigs=0; delete [] fParam; fParam=0; }
55a829a5 72
d3da6dc4 73protected:
d3da6dc4 74 Int_t fCh; //chamber number
e4a3eae8 75 Int_t fSi; //size of the formed cluster from which this cluster deduced
76 Int_t fSt; //flag to mark the quality of the cluster
77 Int_t fBox; //box contaning this cluster
78 Int_t fNlocMax; //number of local maxima in formed cluster
d1bf51e1 79 Int_t fMaxQpad; //abs pad number of a pad with the highest charge
e4a3eae8 80 Double_t fMaxQ; //that max charge value
81 Double_t fQRaw; //QDC value of the raw cluster
82 Double_t fQ; //QDC value of the actual cluster
83 Double_t fErrQ; //error on Q
894758d4 84 Double_t fXX; //local x postion, [cm]
e4a3eae8 85 Double_t fErrX; //error on x postion, [cm]
894758d4 86 Double_t fYY; //local y postion, [cm]
e4a3eae8 87 Double_t fErrY; //error on y postion, [cm]
88 Double_t fChi2; //some estimator of the fit quality
d3da6dc4 89 TObjArray *fDigs; //! list of digits forming this cluster
69ed32de 90 static Bool_t fgDoCorrSin; //flag to switch on/off correction for Sinusoidal to cluster reco
1d6047fb 91 AliHMPIDParam *fParam; //!Pointer to AliHMPIDParam
b38ac33a 92
93private:
94/*
95 AliHMPIDCluster &operator=(const AliHMPIDCluster &c) {if(this == &c)return *this;AliCluster3D::operator=(c);
96 fSi=c.fSi; fSt=c.fSt; fCh=c.fCh; fBox=c.fBox;fNlocMax=c.fNlocMax;fMaxQpad=c.fMaxQpad; fMaxQ=c.fMaxQ;fQRaw=c.fQRaw;
97 fQ=c.fQ; fErrQ=c.fErrQ;
98 fXX=c.fXX; fErrX=c.fErrX;
99 fYY=c.fYY; fErrY=c.fErrY; fChi2=c.fChi2;fDigs=c.fDigs ? new TObjArray(*c.fDigs):0; return *this;}
100*/
101// AliHMPIDCluster(const AliHMPIDCluster& c); //dummy copy constructor
102 AliHMPIDCluster &operator=(const AliHMPIDCluster& c); //dummy assignment operator
103
104
1d6047fb 105 ClassDef(AliHMPIDCluster,9) //HMPID cluster class
55a829a5 106};
cf7e313e 107
d3da6dc4 108//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
109void AliHMPIDCluster::DigAdd(AliHMPIDDigit *pDig)
110{
111// Adds a given digit to the list of digits belonging to this cluster, cluster is not owner of digits
112// Arguments: pDig - pointer to digit to be added
ea925242 113// Returns: none
d1bf51e1 114 if(!fDigs) {fSi=0;fDigs = new TObjArray;} //create list of digits in the first invocation
d3da6dc4 115 fDigs->Add(pDig);
d1bf51e1 116 fSt=kFrm;
117 fSi++;
118}
119//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
120void AliHMPIDCluster::Reset()
121{
ea925242 122 //
123 //
124 //
d1bf51e1 125 if(fDigs) delete fDigs;
126 fDigs=0;
e4a3eae8 127 fSt=kEmp;
128 fQRaw=fQ=0;
894758d4 129 fXX=fYY=0;
e4a3eae8 130 fCh=fSi=fBox=fNlocMax=fMaxQpad=-1;
131 fMaxQ=fErrQ=fErrX=fErrY=fChi2=-1; //empty ctor
d3da6dc4 132}
133//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
d1bf51e1 134Bool_t AliHMPIDCluster::IsInPc()
135{
ea925242 136 //Check if (X,Y) position is inside the PC limits
137 //Arguments:
138 // Returns: True or False
d1bf51e1 139 Int_t pc = ((AliHMPIDDigit*)fDigs->At(0))->Pc();
140
141
894758d4 142 if ( fXX < AliHMPIDParam::MinPcX(pc) || fXX > AliHMPIDParam::MaxPcX(pc) ||
143 fYY < AliHMPIDParam::MinPcY(pc) || fYY > AliHMPIDParam::MaxPcY(pc) ) return kFALSE;
d1bf51e1 144
145 return kTRUE;
146
147}
148
d3da6dc4 149#endif