]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/AliHMPIDReconstructor.h
Changed the interface to AliMUONVStore one (Laurent)
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDReconstructor.h
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                               */
5 //.
6 // HMPID base class to reconstruct an event
7 //.
8 #include <AliReconstructor.h>        //base class
9 #include "AliHMPIDTracker.h"         //CreateTracker()
10 #include "AliHMPIDDigit.h"           //Dig2Clu(), UseDig()
11 #include <TMatrixF.h>                //UseDig()
12 #include <TClonesArray.h>            //UseDig()
13 #include <TObjArray.h>               //SigConv()
14 class AliRawReader;                  //Reconstruct() with raw data   
15 class AliHMPIDCluster;               //Dig2Clu()
16
17 class AliHMPIDReconstructor: public AliReconstructor 
18 {
19 public:
20            AliHMPIDReconstructor();              
21   virtual ~AliHMPIDReconstructor()                                  {delete fDig;delete fClu;}//dtor  
22 //framework part  
23   AliTracker*  CreateTracker         (AliRunLoader*                      )const{return new AliHMPIDTracker;}            //from AliReconstructor for clusters->PID
24   void         ConvertDigits         (AliRawReader *pRR, TTree *pDigTree) const;                                        //from AliReconstruction for raw->digit
25   Bool_t       HasDigitConversion()   const {return kTRUE;}                                                             //HMPID digits converted with ConvertDigits 
26   void         Reconstruct           (TTree* digitsTree, TTree* clustersTree) const;                                    //from AliReconstruction for digit->cluster
27   void         Reconstruct           (AliRunLoader *pAL,AliRawReader* pRR)const;                                        //from AliReconstruction for raw->cluster with Digits on fly
28   Bool_t       HasLocalReconstruction() const {return kTRUE;}                                                           // HMPID has local reconstruction algorithm
29   void         FillESD               (AliRunLoader* pAL,AliESD *pESD)const;                                             //calculate pid for HMPID
30   
31   using AliReconstructor::FillESD;                                                                                      //
32   using AliReconstructor::Reconstruct;                                                                                  // 
33
34   //private part  
35   static        void           Dig2Clu (TObjArray *pDigLst,TObjArray *pCluLst,Bool_t isUnfold=kTRUE                      );//digits->clusters
36   static        void           FormClu (AliHMPIDCluster *pClu,AliHMPIDDigit *pDig,TClonesArray *pDigLst,TMatrixF *pPadMap);//cluster formation recursive algorithm
37   static inline AliHMPIDDigit* UseDig  (Int_t padX,Int_t padY,                    TClonesArray *pDigLst,TMatrixF *pDigMap);//use this pad's digit to form a cluster
38   inline Bool_t                IsDigSurvive(AliHMPIDDigit *pDig                                                     )const;//check for sigma cut
39   void                         SigConv(TObjArray *pDaqSig                                                                );//conversion to 7 TMatrixF for sigmas
40   protected:
41   Int_t      fUserCut;                 // n sigma for pedestals decided by the User (if in OCDB)
42   TObjArray *fDaqSig;                  // container for the pad pedestal sigmas
43   TObjArray *fDig;                     // tmp list of digits
44   TObjArray *fClu;                     // tmp list of clusters
45   ClassDef(AliHMPIDReconstructor, 0)   // class for the HMPID reconstruction
46 };
47
48 //__________________________________________________________________________________________________
49 AliHMPIDDigit* AliHMPIDReconstructor::UseDig(Int_t padX,Int_t padY,TClonesArray *pDigLst,TMatrixF *pPadMap)
50 {
51 //Digit map contains a matrix if digit numbers.
52 //Main operation in forming initial cluster is done here. Requested digit pointer is returned and this digit marked as taken.
53 //Arguments: padX,padY - pad number
54 //           pDigLst   - list of digits for one sector
55 //           pDigMap   - map of those digits
56 //  Returns: pointer to digit if not yet used or 0 if used
57   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
58   if(iDig!=-1)    return (AliHMPIDDigit*)pDigLst->At(iDig);        //digit pointer
59   else            return 0;
60 }
61 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
62 Bool_t AliHMPIDReconstructor::IsDigSurvive(AliHMPIDDigit *pDig)const
63 {
64 //Check if the current digit survive to a riapllied sigma cut
65 //Arguments: pDig pointer to the current digit
66 //  Returns: kTRUE if charge > mean+n*sigma
67   if(!fUserCut) return kTRUE;
68   TMatrixF *pM = (TMatrixF*)fDaqSig->At(pDig->Ch());
69   Float_t sig = (*pM)(pDig->PadChX(),pDig->PadChY());
70   if(pDig->Q()>fUserCut*sig) return kTRUE;
71   else return kFALSE;
72 }
73
74 #endif