]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDReconstructor.h
Protection in case of wrong wavelength values
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDReconstructor.h
index ccf3c1546dd3dc49b00c048cd93f4b2eaca0f4bb..d0588f16aca41e3b598d7a4ec7351fe8b8a5f315 100644 (file)
@@ -2,43 +2,60 @@
 #define AliHMPIDReconstructor_h
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
-
-#include <AliReconstructor.h>       //base class
+//.
+// HMPID base class to reconstruct an event
+//.
+#include <AliReconstructor.h>        //base class
 #include "AliHMPIDTracker.h"         //CreateTracker()
-#include <TMatrixF.h>               //UseDig()
-#include <TClonesArray.h>           //UseDig()
-class AliRawReader;                 //Reconstruct() with raw data   
-class AliHMPIDDigit;                 //Dig2Clu(), UseDig()
+#include "AliHMPIDDigit.h"           //Dig2Clu(), UseDig()
+#include "AliHMPIDRecoParam.h"       //Init
+
+#include <TMatrixF.h>                //UseDig()
+#include <TClonesArray.h>            //UseDig()
+#include <TObjArray.h>               //SigConv()
+class AliRawReader;                  //Reconstruct() with raw data   
 class AliHMPIDCluster;               //Dig2Clu()
 
 class AliHMPIDReconstructor: public AliReconstructor 
 {
 public:
-           AliHMPIDReconstructor(): AliReconstructor()              {}//default ctor
-  virtual ~AliHMPIDReconstructor()                                  {}//dtor  
+           AliHMPIDReconstructor();              
+  virtual ~AliHMPIDReconstructor()                                  {delete fDig;delete fClu;delete [] fUserCut;}//dtor  
 //framework part  
-  AliTracker*  CreateTracker         (AliRunLoader*                      )const{return new AliHMPIDTracker;}            //from AliReconstructor for clusters->PID
-  void         Reconstruct           (AliRunLoader* pAL                  )const;                                       //from AliReconstruction for digits->clusters
-  void         Reconstruct           (AliRunLoader* pAL,AliRawReader *pRR)const;                                       //from AliReconstruction for raws->clusters
-  virtual void FillESD               (AliRunLoader* pAL,AliESD *pESD)const;                                    //calculate pid for HMPID
-  virtual void FillESD(AliRunLoader*, AliRawReader*, AliESD*) const { };
-  virtual void FillESD(AliRawReader*, TTree*, AliESD*) const { };
-  virtual void FillESD(TTree*, TTree*, AliESD*) const { };
-
+  AliTracker*  CreateTracker         () const {return new AliHMPIDTracker;}            //from AliReconstructor for clusters->PID
+  void         ConvertDigits         (AliRawReader *pRR, TTree *pDigTree) const;                                        //from AliReconstruction for raw->digit
+  Bool_t       HasDigitConversion()   const {return kTRUE;}                                                             //HMPID digits converted with ConvertDigits 
+  void         Reconstruct           (TTree* digitsTree, TTree* clustersTree) const;                                    //from AliReconstruction for digit->cluster
+  void         FillESD               (TTree* /*digitsTree*/, TTree* /*clustersTree*/, AliESDEvent *pESD)const;                                        //calculate pid for HMPID
   
-   using AliReconstructor::Reconstruct;                                                                                 //to get rid of virtual hidden warning 
+  using AliReconstructor::FillESD;                                                                                      //
+  using AliReconstructor::Reconstruct;                                                                                  // 
 
   //private part  
-  static        void          Dig2Clu (TClonesArray*pDigLst,TClonesArray *pCluLst,Bool_t isTryUnfold=kTRUE            );//digits list -> clusters list
-  static        void          CluQA   (AliRunLoader* pAL                                                              );//QA for clusters
-  static        void          FormClu (AliHMPIDCluster *pClu,AliHMPIDDigit *pDig,TClonesArray *pDigLst,TMatrixF *pDigMap);//cluster formation recursive algorithm
-  static inline AliHMPIDDigit* UseDig  (Int_t padX,Int_t padY,TClonesArray *pDigList,TMatrixF *pDigMap                 );//use this pad's digit to form a cluster
+  static        void           Dig2Clu (TObjArray *pDigLst,TObjArray *pCluLst,Int_t *pUserCut,Bool_t isUnfold=kTRUE     );//digits->clusters
+  static        void           FormClu (AliHMPIDCluster *pClu,AliHMPIDDigit *pDig,TClonesArray *pDigLst,TMatrixF *pPadMap);//cluster formation recursive algorithm
+  static inline AliHMPIDDigit* UseDig  (Int_t padX,Int_t padY,                    TClonesArray *pDigLst,TMatrixF *pDigMap);//use this pad's digit to form a cluster
+  inline Bool_t                IsDigSurvive(AliHMPIDDigit *pDig                                                     )const;//check for sigma cut
+  void SetRecoParam(AliHMPIDRecoParam *recopar){ fgkRecoParam = recopar;}
+  static const AliHMPIDRecoParam* GetRecoParam(){ return fgkRecoParam;}
 
+  
   protected:
-  ClassDef(AliHMPIDReconstructor, 0)   //class for the HMPID reconstruction
+  static AliHMPIDRecoParam*  fgkRecoParam;      // Pointer to HMPID RecoParams
+  Int_t     *fUserCut;                 // n sigmas for pedestals decided by the User for each chamber(if in OCDB)
+  TObjArray *fDaqSig;                  // container for the pad pedestal sigmas
+  TObjArray *fDig;                     // tmp list of digits
+  TObjArray *fClu;                     // tmp list of clusters
+//
+  private:
+  AliHMPIDReconstructor(const AliHMPIDReconstructor& r);              //dummy copy constructor
+  AliHMPIDReconstructor &operator=(const AliHMPIDReconstructor& r);   //dummy assignment operator
+//  
+  ClassDef(AliHMPIDReconstructor, 1)   // class for the HMPID reconstruction
 };
-//__________________________________________________________________________________________________
-AliHMPIDDigit* AliHMPIDReconstructor::UseDig(Int_t padX,Int_t padY,TClonesArray *pDigLst,TMatrixF *pDigMap)
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliHMPIDDigit* AliHMPIDReconstructor::UseDig(Int_t padX,Int_t padY,TClonesArray *pDigLst,TMatrixF *pPadMap)
 {
 //Digit map contains a matrix if digit numbers.
 //Main operation in forming initial cluster is done here. Requested digit pointer is returned and this digit marked as taken.
@@ -46,9 +63,23 @@ AliHMPIDDigit* AliHMPIDReconstructor::UseDig(Int_t padX,Int_t padY,TClonesArray
 //           pDigLst   - list of digits for one sector
 //           pDigMap   - map of those digits
 //  Returns: pointer to digit if not yet used or 0 if used
-  Int_t iDig=(Int_t)(*pDigMap)(padX,padY);(*pDigMap)(padX,padY)=-1;//take digit number from the map and reset this map cell to -1
-  if(iDig!=-1)    return (AliHMPIDDigit*)pDigLst->At(iDig);         //digit pointer
+  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
+  if(iDig!=-1)    return (AliHMPIDDigit*)pDigLst->At(iDig);        //digit pointer
   else            return 0;
 }
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Bool_t AliHMPIDReconstructor::IsDigSurvive(AliHMPIDDigit *pDig)const
+{
+//Check if the current digit survive to a riapllied sigma cut
+//Arguments: pDig pointer to the current digit
+//  Returns: kTRUE if charge > mean+n*sigma
+  Int_t iCh = pDig->Ch();
+  Int_t iDaqSigCut =(Int_t)fDaqSig->At(iCh)->GetUniqueID(); 
+  if(fUserCut[iCh]<=iDaqSigCut) return kTRUE;
+  TMatrixF *pM = (TMatrixF*)fDaqSig->At(pDig->Ch());
+  Float_t sig = (*pM)(pDig->PadChX(),pDig->PadChY());
+  if(pDig->Q()>fUserCut[iCh]*sig) return kTRUE;
+  else return kFALSE;
+}
 
 #endif