Adding Tasks to create NuclexAOD from MC productions and first Task to read Nuclex AOD
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDReconstructor.h
d3da6dc4 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 */
423554a3 5//.
6// HMPID base class to reconstruct an event
a0e5c1b9 8#include <AliReconstructor.h> //base class
d3da6dc4 9#include "AliHMPIDTracker.h" //CreateTracker()
a0e5c1b9 10#include "AliHMPIDDigit.h" //Dig2Clu(), UseDig()
b4b2d95f 11#include "AliHMPIDRecoParamV1.h"
a0e5c1b9 12#include <TMatrixF.h> //UseDig()
13#include <TClonesArray.h> //UseDig()
14#include <TObjArray.h> //SigConv()
451299f3 15
a0e5c1b9 16class AliRawReader; //Reconstruct() with raw data
d3da6dc4 17class AliHMPIDCluster; //Dig2Clu()
19class AliHMPIDReconstructor: public AliReconstructor
94b1fbfa 22 AliHMPIDReconstructor();
ab1d3801 23 virtual ~AliHMPIDReconstructor() {delete fDig;delete fClu;}//dtor
d3da6dc4 24//framework part
d76c31f4 25 AliTracker* CreateTracker () const {return new AliHMPIDTracker;} //from AliReconstructor for clusters->PID
94b1fbfa 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
aed5907d 29 static Int_t StreamLevel() { return fgStreamLevel;}
30 static void SetStreamLevel(Int_t level) { fgStreamLevel = level;}
94b1fbfa 33 using AliReconstructor::FillESD; //
34 using AliReconstructor::Reconstruct; //
d3da6dc4 35
36 //private part
03768ab2 37 static void Dig2Clu (TObjArray *pDigLst,TObjArray *pCluLst,Int_t *pUserCut,Bool_t isUnfold=kTRUE );//digits->clusters
3c6274c1 38 static void FormClu (AliHMPIDCluster *pClu,AliHMPIDDigit *pDig,TClonesArray *pDigLst,TMatrixF *pPadMap);//cluster formation recursive algorithm
39 static inline AliHMPIDDigit* UseDig (Int_t padX,Int_t padY, TClonesArray *pDigLst,TMatrixF *pDigMap);//use this pad's digit to form a cluster
ab1d3801 40 inline Bool_t IsDigSurvive(Int_t *pUserCut, AliHMPIDDigit *pDig )const;//check for sigma cut
b4b2d95f 41 static const AliHMPIDRecoParamV1* GetRecoParam() { return dynamic_cast<const AliHMPIDRecoParamV1*>(AliReconstructor::GetRecoParam(5)); } //5 is the HMPID detector code
451299f3 42
d3da6dc4 43 protected:
a0e5c1b9 44 TObjArray *fDaqSig; // container for the pad pedestal sigmas
94b1fbfa 45 TObjArray *fDig; // tmp list of digits
46 TObjArray *fClu; // tmp list of clusters
8f05fd11 47//
48 private:
3abc001d 49 AliHMPIDReconstructor(const AliHMPIDReconstructor&); //Not implemented
50 AliHMPIDReconstructor &operator=(const AliHMPIDReconstructor&); //Not implemented
aed5907d 51 static Int_t fgStreamLevel; // flag for streaming - for HMPID reconstruction
8f05fd11 52//
aed5907d 53 ClassDef(AliHMPIDReconstructor, 3) // class for the HMPID reconstruction
d3da6dc4 54};
cf7e313e 55
55a829a5 56//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3c6274c1 57AliHMPIDDigit* AliHMPIDReconstructor::UseDig(Int_t padX,Int_t padY,TClonesArray *pDigLst,TMatrixF *pPadMap)
d3da6dc4 58{
59//Digit map contains a matrix if digit numbers.
60//Main operation in forming initial cluster is done here. Requested digit pointer is returned and this digit marked as taken.
61//Arguments: padX,padY - pad number
62// pDigLst - list of digits for one sector
63// pDigMap - map of those digits
64// Returns: pointer to digit if not yet used or 0 if used
3c6274c1 65 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
66 if(iDig!=-1) return (AliHMPIDDigit*)pDigLst->At(iDig); //digit pointer
d3da6dc4 67 else return 0;
a0e5c1b9 69//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ab1d3801 70Bool_t AliHMPIDReconstructor::IsDigSurvive(Int_t *pUserCut, AliHMPIDDigit *pDig)const
a0e5c1b9 71{
72//Check if the current digit survive to a riapllied sigma cut
73//Arguments: pDig pointer to the current digit
74// Returns: kTRUE if charge > mean+n*sigma
9cc1a411 75 Int_t iCh = pDig->Ch();
76 Int_t iDaqSigCut =(Int_t)fDaqSig->At(iCh)->GetUniqueID();
ab1d3801 77 if(pUserCut[iCh]<=iDaqSigCut) return kTRUE;
a0e5c1b9 78 TMatrixF *pM = (TMatrixF*)fDaqSig->At(pDig->Ch());
79 Float_t sig = (*pM)(pDig->PadChX(),pDig->PadChY());
ab1d3801 80 if(pDig->Q()>pUserCut[iCh]*sig) return kTRUE;
a0e5c1b9 81 else return kFALSE;
d3da6dc4 83