1 #ifndef AliRICHCluster_h
2 #define AliRICHCluster_h
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
9 #include "AliRICHDigit.h"
11 class AliRICHCluster :public TObject
14 enum ClusterStatus {kEdge,kShape,kSize,kRaw,kResolved,kEmpty};
15 AliRICHCluster():TObject(),fCFM(0),fSize(0),fShape(0),fQdc(0),fChamber(0),fX(0),fY(0),fStatus(kEmpty),fDigits(0) {} //default ctor
16 virtual ~AliRICHCluster() {AliDebug(1,"Start");/*Reset();*/} //dtor
17 // AliRICHcluster(const AliRICHcluster& clus):TObject(clus) {} //copy ctor
18 AliRICHCluster& operator=(const AliRICHCluster&) {return *this;} //copy operator
22 void Reset() {DeleteDigits();fCFM=fSize=fShape=fQdc=fChamber=0;fX=fY=0;fStatus=kEmpty;} //cleans the cluster
23 void DeleteDigits() {if(fDigits) {delete fDigits;} fDigits=0;} //deletes the list of digits
24 Int_t Nlocals() const{return fSize-10000*(fSize/10000);} //number of local maximums
25 Int_t Size() const{return fSize/10000;} //number of digits in cluster
26 Int_t Fsize() const{return fSize;} //
27 Int_t Shape() const{return fShape;} //cluster shape rectangulare
28 Int_t C() const{return fChamber/10;} //chamber number
29 Int_t S() const{return fChamber-(fChamber/10)*10;} //sector number
30 Int_t Fchamber() const{return fChamber;} //
31 Int_t Q() const{return fQdc;} //cluster charge in QDC channels
32 Double_t X() const{return fX;} //cluster x position in LRS
33 Double_t Y() const{return fY;} //cluster y position in LRS
34 Int_t Status() const{return fStatus;} //
35 void SetStatus(Int_t status) {fStatus=status;} //
36 Int_t Nmips() const{return fCFM-1000000*Ncerenkovs()-1000*Nfeedbacks();} //
37 Int_t Ncerenkovs() const{return fCFM/1000000;} //
38 Int_t Nfeedbacks() const{return (fCFM-1000000*Ncerenkovs())/1000;} //
39 Bool_t IsPureMip() const{return fCFM<1000;} //
40 Bool_t IsPureCerenkov() const{return Nmips()==0&&Nfeedbacks()==0;} //
41 Bool_t IsPureFeedback() const{return Nmips()==0&&Ncerenkovs()==0;} //
42 Bool_t IsSingleMip() const{return Nmips()==1&&Ncerenkovs()==0&&Nfeedbacks()==0;} //
43 Bool_t IsSingleCerenkov() const{return Nmips()==0&&Ncerenkovs()==1&&Nfeedbacks()==0;} //
44 Bool_t IsSingleFeedback() const{return Nmips()==0&&Ncerenkovs()==0&&Nfeedbacks()==1;} //
45 Bool_t IsMip() const{return Nmips()!=0;} //
46 Bool_t IsCerenkov() const{return Ncerenkovs()!=0;} //
47 Bool_t IsFeedback() const{return Nfeedbacks()!=0;} //
48 Int_t CombiPid() const{return fCFM;} //
49 void CFM(Int_t c,Int_t f,Int_t m) {fCFM=1000000*c+1000*f+m;} //cluster contributors
50 TObjArray* Digits() const{return fDigits;} //
51 virtual void Print(Option_t *option="")const; //
52 inline void AddDigit(AliRICHDigit *pDig); //
53 inline void CoG(Int_t nLocals); //calculates center of gravity
54 void Fill(AliRICHCluster *pRaw,Double_t x,Double_t y,Double_t q,Int_t cfm) //form new resolved cluster from raw one
55 {fCFM=cfm;fChamber=pRaw->Fchamber();fSize=pRaw->Fsize();fQdc=(Int_t)(q*pRaw->Q());fX=x;fY=y;fStatus=kResolved;}
56 Double_t DistTo(TVector2 x) const{return TMath::Sqrt((x.X()-fX)*(x.X()-fX)+(x.Y()-fY)*(x.Y()-fY));} //distance to given point
57 Double_t DistX(TVector2 x) const{return (x.X()-fX);} //distance in x to given point
58 Double_t DistY(TVector2 x) const{return (x.Y()-fY);} //distance to given point
60 Int_t fCFM; //1000000*Ncerenkovs+1000*Nfeedbacks+Nmips
61 Int_t fSize; //10000*(how many digits belong to this cluster) + nLocalMaxima
62 Int_t fShape; //100*xdim+ydim box containing the cluster
63 Int_t fQdc; //QDC value
64 Int_t fChamber; //10*module number+sector number
65 Double_t fX; //local x postion
66 Double_t fY; //local y postion
67 Int_t fStatus; //flag to mark the quality of the cluster
68 TObjArray *fDigits; //! list of digits forming this cluster
69 ClassDef(AliRICHCluster,2) //RICH cluster class
70 };//class AliRICHCluster
71 //__________________________________________________________________________________________________
72 void AliRICHCluster::AddDigit(AliRICHDigit *pDig)
74 // Adds a given digit to the list of digits belonging to this cluster
75 if(!fDigits) {fQdc=fSize=fCFM=0;fDigits = new TObjArray;}
76 fQdc+=(Int_t)pDig->Q(); fDigits->Add(pDig);
77 fChamber=10*pDig->C()+pDig->S();
81 //__________________________________________________________________________________________________
82 void AliRICHCluster::CoG(Int_t nLocals)
84 // Calculates naive cluster position as a center of gravity of its digits.
85 Float_t xmin=999,ymin=999,xmax=0,ymax=0;
87 for(Int_t iDig=0;iDig<Size();iDig++) {
88 AliRICHDigit *pDig=(AliRICHDigit*)fDigits->At(iDig);
89 TVector pad=pDig->Pad(); Double_t q=pDig->Q();
90 TVector2 x2=AliRICHParam::Pad2Loc(pad);
91 fX += x2.X()*q;fY +=x2.Y()*q;
92 if(pad[0]<xmin)xmin=pad[0];if(pad[0]>xmax)xmax=pad[0];if(pad[1]<ymin)ymin=pad[1];if(pad[1]>ymax)ymax=pad[1];
94 fX/=fQdc;fY/=fQdc;//Center of Gravity
96 TVector2 center = AliRICHParam::Pad2Loc(AliRICHParam::Loc2Pad(TVector2(fX,fY)));
97 fX += AliRICHParam::CogCorr(fX-center.X());
99 fShape=Int_t(100*(xmax-xmin+1)+ymax-ymin+1);//find box containing cluster
103 //__________________________________________________________________________________________________