1 #ifndef AliHMPIDReconstructor_h
2 #define AliHMPIDReconstructor_h
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
6 // HMPID base class to reconstruct an event
8 #include <AliReconstructor.h> //base class
9 #include "AliHMPIDTracker.h" //CreateTracker()
10 #include "AliHMPIDDigit.h" //Dig2Clu(), UseDig()
11 #include "AliHMPIDRecoParamV1.h"
12 #include <TMatrixF.h> //UseDig()
13 #include <TClonesArray.h> //UseDig()
14 #include <TObjArray.h> //SigConv()
16 class AliRawReader; //Reconstruct() with raw data
17 class AliHMPIDCluster; //Dig2Clu()
19 class AliHMPIDReconstructor: public AliReconstructor
22 AliHMPIDReconstructor();
23 virtual ~AliHMPIDReconstructor() {delete fDig;delete fClu;}//dtor
25 AliTracker* CreateTracker () const {return new AliHMPIDTracker;} //from AliReconstructor for clusters->PID
26 void ConvertDigits (AliRawReader *pRR, TTree *pDigTree) const; //from AliReconstruction for raw->digit
27 Bool_t HasDigitConversion() const {return kTRUE;} //HMPID digits converted with ConvertDigits
28 void Reconstruct (TTree* digitsTree, TTree* clustersTree) const; //from AliReconstruction for digit->cluster
29 void FillESD (TTree* /*digitsTree*/, TTree* /*clustersTree*/, AliESDEvent *pESD)const; //calculate pid for HMPID
30 static Int_t StreamLevel() { return fgStreamLevel;}
31 static void SetStreamLevel(Int_t level) { fgStreamLevel = level;}
34 using AliReconstructor::FillESD; //
35 using AliReconstructor::Reconstruct; //
38 static void Dig2Clu (TObjArray *pDigLst,TObjArray *pCluLst,Int_t *pUserCut,Bool_t isUnfold=kTRUE );//digits->clusters
39 static void FormClu (AliHMPIDCluster *pClu,AliHMPIDDigit *pDig,TClonesArray *pDigLst,TMatrixF *pPadMap);//cluster formation recursive algorithm
40 static inline AliHMPIDDigit* UseDig (Int_t padX,Int_t padY, TClonesArray *pDigLst,TMatrixF *pDigMap);//use this pad's digit to form a cluster
41 inline Bool_t IsDigSurvive(Int_t *pUserCut, AliHMPIDDigit *pDig )const;//check for sigma cut
42 static const AliHMPIDRecoParamV1* GetRecoParam() { return dynamic_cast<const AliHMPIDRecoParamV1*>(AliReconstructor::GetRecoParam(5)); } //5 is the HMPID detector code
45 TObjArray *fDaqSig; // container for the pad pedestal sigmas
46 TObjArray *fDig; // tmp list of digits
47 TObjArray *fClu; // tmp list of clusters
50 AliHMPIDReconstructor(const AliHMPIDReconstructor&); //Not implemented
51 AliHMPIDReconstructor &operator=(const AliHMPIDReconstructor&); //Not implemented
52 static Int_t fgStreamLevel; // flag for streaming - for HMPID reconstruction
54 ClassDef(AliHMPIDReconstructor, 3) // class for the HMPID reconstruction
57 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
58 AliHMPIDDigit* AliHMPIDReconstructor::UseDig(Int_t padX,Int_t padY,TClonesArray *pDigLst,TMatrixF *pPadMap)
60 //Digit map contains a matrix if digit numbers.
61 //Main operation in forming initial cluster is done here. Requested digit pointer is returned and this digit marked as taken.
62 //Arguments: padX,padY - pad number
63 // pDigLst - list of digits for one sector
64 // pDigMap - map of those digits
65 // Returns: pointer to digit if not yet used or 0 if used
66 Int_t iDig=(Int_t)(*pPadMap)(padX,padY);(*pPadMap)(padX,padY)=-1;//take digit number from the map and reset this map cell to -1
67 if(iDig!=-1) return (AliHMPIDDigit*)pDigLst->At(iDig); //digit pointer
70 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
71 Bool_t AliHMPIDReconstructor::IsDigSurvive(Int_t *pUserCut, AliHMPIDDigit *pDig)const
73 //Check if the current digit survive to a riapllied sigma cut
74 //Arguments: pDig pointer to the current digit
75 // Returns: kTRUE if charge > mean+n*sigma
76 Int_t iCh = pDig->Ch();
77 Int_t iDaqSigCut =(Int_t)fDaqSig->At(iCh)->GetUniqueID();
78 if(pUserCut[iCh]<=iDaqSigCut) return kTRUE;
79 TMatrixF *pM = (TMatrixF*)fDaqSig->At(pDig->Ch());
80 Float_t sig = (*pM)(pDig->PadChX(),pDig->PadChY());
81 if(pDig->Q()>pUserCut[iCh]*sig) return kTRUE;