Call of reco-param object moved from the class constructor, default value of the...
authorgvolpe <gvolpe@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 16 Jul 2011 16:36:25 +0000 (16:36 +0000)
committergvolpe <gvolpe@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 16 Jul 2011 16:36:25 +0000 (16:36 +0000)
HMPID/AliHMPIDReconstructor.cxx
HMPID/AliHMPIDReconstructor.h

index 1b19729..e91ffe0 100644 (file)
@@ -35,14 +35,13 @@ ClassImp(AliHMPIDReconstructor)
 Int_t AliHMPIDReconstructor::fgStreamLevel = 0;        // stream (debug) level
 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fDaqSig(0),fDig(0),fClu(0)
+AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fDaqSig(0),fDig(0),fClu(0)
 {
 //
 //ctor
 //
   AliHMPIDParam::Instance();                                                        //geometry loaded for reconstruction
 
-  fUserCut = new Int_t[7];
   fClu=new TObjArray(AliHMPIDParam::kMaxCh+1); fClu->SetOwner(kTRUE);
   fDig=new TObjArray(AliHMPIDParam::kMaxCh+1); fDig->SetOwner(kTRUE);
   
@@ -53,23 +52,6 @@ AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fD
     fClu->AddAt(pClus,i);
   }
  
-   
-   if(AliHMPIDReconstructor::GetRecoParam()) {
-    for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
-      fUserCut[iCh] = AliHMPIDReconstructor::GetRecoParam()->GetHmpUserCut(iCh);
-      AliDebug(1,Form("UserCut successfully loaded (from AliHMPIDRecoParamV1) for chamber %i -> %i ",iCh,fUserCut[iCh]));
-    }
-  }
-  else {
-    for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
-      fUserCut[iCh] = 3;                                                                             // minimal requirement for sigma cut
-      AliDebug(1,Form("UserCut loaded from defaults for chamber %i -> %i ",iCh,fUserCut[iCh]));
-      AliDebug(1,Form("Cannot get AliHMPIDRecoParamV1!"));
-      }
-    }
-
-  
-
   AliCDBEntry *pDaqSigEnt =AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig");  //contains TObjArray of TObjArray 14 TMatrixF sigmas values for pads 
   if(!pDaqSigEnt) AliFatal("No pedestals from DAQ!");
   fDaqSig = (TObjArray*)pDaqSigEnt->GetObject();
@@ -141,8 +123,25 @@ void AliHMPIDReconstructor::Reconstruct(TTree *pDigTree,TTree *pCluTree)const
     pCluTree->Branch(Form("HMPID%d",iCh),&((*fClu)[iCh]),7);
     pDigTree->SetBranchAddress(Form("HMPID%d",iCh),&((*fDig)[iCh]));
   }   
+  
+  Int_t *pUserCut = new Int_t[7];
+  
+   if(AliHMPIDReconstructor::GetRecoParam()) {
+    for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
+      pUserCut[iCh] = AliHMPIDReconstructor::GetRecoParam()->GetHmpUserCut(iCh);
+      AliDebug(1,Form("UserCut successfully loaded (from AliHMPIDRecoParamV1) for chamber %i -> %i ",iCh,pUserCut[iCh]));
+    }
+  }
+  else {
+    for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
+      pUserCut[iCh] = 4;                                                                             // minimal requirement for sigma cut
+      AliDebug(1,Form("UserCut loaded from defaults for chamber %i -> %i ",iCh,pUserCut[iCh]));
+      AliDebug(1,Form("Cannot get AliHMPIDRecoParamV1!"));
+      }
+    }  
+  
   pDigTree->GetEntry(0);
-  Dig2Clu(fDig,fClu,fUserCut);     //cluster finder 
+  Dig2Clu(fDig,fClu,pUserCut);     //cluster finder 
   pCluTree->Fill();                //fill tree for current event
   
   for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
@@ -168,6 +167,22 @@ void AliHMPIDReconstructor::ConvertDigits(AliRawReader *pRR,TTree *pDigTree)cons
     pDigTree->Branch(Form("HMPID%d",iCh),&((*fDig)[iCh]));
   }
     
+  Int_t *pUserCut = new Int_t[7];
+  
+   if(AliHMPIDReconstructor::GetRecoParam()) {
+    for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
+      pUserCut[iCh] = AliHMPIDReconstructor::GetRecoParam()->GetHmpUserCut(iCh);
+      AliDebug(1,Form("UserCut successfully loaded (from AliHMPIDRecoParamV1) for chamber %i -> %i ",iCh,pUserCut[iCh]));
+    }
+  }
+  else {
+    for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
+      pUserCut[iCh] = 4;                                                                             // minimal requirement for sigma cut
+      AliDebug(1,Form("UserCut loaded from defaults for chamber %i -> %i ",iCh,pUserCut[iCh]));
+      AliDebug(1,Form("Cannot get AliHMPIDRecoParamV1!"));
+      }
+    }  
+      
   AliHMPIDRawStream stream(pRR);    
   
   while(stream.Next())
@@ -175,7 +190,7 @@ void AliHMPIDReconstructor::ConvertDigits(AliRawReader *pRR,TTree *pDigTree)cons
     Int_t ch = AliHMPIDParam::DDL2C(stream.GetDDLNumber());
     for(Int_t iPad=0;iPad<stream.GetNPads();iPad++) {
       AliHMPIDDigit dig(stream.GetPadArray()[iPad],stream.GetChargeArray()[iPad]);
-      if(!IsDigSurvive(&dig)) continue; 
+      if(!IsDigSurvive(pUserCut,&dig)) continue; 
       new((*((TClonesArray*)fDig->At(ch)))[iDigCnt[ch]++]) AliHMPIDDigit(dig); //add this digit to the tmp list 
     }
   }
index 6852d38..1b516a1 100644 (file)
@@ -20,7 +20,7 @@ class AliHMPIDReconstructor: public AliReconstructor
 {
 public:
            AliHMPIDReconstructor();              
-  virtual ~AliHMPIDReconstructor()                                  {delete fDig;delete fClu;delete [] fUserCut;}//dtor  
+  virtual ~AliHMPIDReconstructor()                                  {delete fDig;delete fClu;}//dtor  
 //framework part  
   AliTracker*  CreateTracker         () const {return new AliHMPIDTracker;}            //from AliReconstructor for clusters->PID
   void         ConvertDigits         (AliRawReader *pRR, TTree *pDigTree) const;                                        //from AliReconstruction for raw->digit
@@ -38,11 +38,10 @@ public:
   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
+  inline Bool_t                IsDigSurvive(Int_t *pUserCut, AliHMPIDDigit *pDig                                         )const;//check for sigma cut
   static const AliHMPIDRecoParamV1* GetRecoParam() { return dynamic_cast<const AliHMPIDRecoParamV1*>(AliReconstructor::GetRecoParam(5)); }  //5 is the HMPID detector code
  
   protected:
-  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
@@ -69,17 +68,17 @@ AliHMPIDDigit* AliHMPIDReconstructor::UseDig(Int_t padX,Int_t padY,TClonesArray
   else            return 0;
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDReconstructor::IsDigSurvive(AliHMPIDDigit *pDig)const
+Bool_t AliHMPIDReconstructor::IsDigSurvive(Int_t *pUserCut, 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;
+  if(pUserCut[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;
+  if(pDig->Q()>pUserCut[iCh]*sig) return kTRUE;
   else return kFALSE;
 }