]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDReconstructor.cxx
First revision of 'detailed' or 'detector' pid information.
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDReconstructor.cxx
index 80e9d5542b90b67c1a949494b50a71247b8383c2..2265284322c5ec171afa5ab68d2f26832d04a14d 100644 (file)
 #include <AliCDBManager.h>         //ctor
 #include <AliESDEvent.h>           //FillEsd()
 #include <AliRawReader.h>          //Reconstruct() for raw digits
+#include "AliHMPIDRawStream.h"     //ConvertDigits()
+#include "AliHMPIDRecoParam.h"     //ctor
 ClassImp(AliHMPIDReconstructor)
 
+AliHMPIDRecoParam* AliHMPIDReconstructor::fgkRecoParam =0;  // 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fDaqSig(0),fDig(0),fClu(0)
 {
@@ -44,17 +47,25 @@ AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fD
     pClus->SetUniqueID(i);
     fClu->AddAt(pClus,i);
   }
-  
+
+   if(fgkRecoParam!=0x0 && fgkRecoParam->GetUserCutMode()==kFALSE)
+  {
+      for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
+      fUserCut[iCh] = fgkRecoParam->GetUserCut(iCh);
+      Printf("HMPID: UserCut successfully loaded (from RecoParam) for chamber %i -> %i ",iCh,fUserCut[iCh]);
+   }
+  }  
+  else {
   AliCDBEntry *pUserCutEnt =AliCDBManager::Instance()->Get("HMPID/Calib/UserCut");    //contains TObjArray of 14 TObject with n. of sigmas to cut charge 
   if(pUserCutEnt) {
     TObjArray *pUserCut = (TObjArray*)pUserCutEnt->GetObject(); 
     for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){                  //chambers loop 
       fUserCut[iCh] = pUserCut->At(iCh)->GetUniqueID();
-      Printf("HMPID: UserCut successfully loaded for chamber %i -> %i ",iCh,fUserCut[iCh]);
+      Printf("HMPID: UserCut successfully loaded (from OCDB) for chamber %i -> %i ",iCh,fUserCut[iCh]);
     }
+   }
   }
-
-  
+   
   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();
@@ -139,47 +150,6 @@ void AliHMPIDReconstructor::Reconstruct(TTree *pDigTree,TTree *pCluTree)const
   AliDebug(1,"Stop.");      
 }//Reconstruct(for simulated digits)
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDReconstructor::Reconstruct(AliRunLoader *pAL,AliRawReader* pRR)const
-{
-//Invoked  by AliReconstruction to convert raw digits from DDL files to clusters
-//Arguments: pAL - ALICE run loader pointer
-//           pRR - ALICE raw reader pointer
-//  Returns: none
-  AliLoader *pRL=pAL->GetDetectorLoader("HMPID");  AliHMPID *pRich=(AliHMPID*)pAL->GetAliRun()->GetDetector("HMPID");//get pointers for HMPID and HMPID loader
-
-  AliHMPIDDigit dig; //tmp digit, raw digit will be converted to it
-
-  TObjArray digLst; Int_t iDigCnt[7]; for(Int_t i=0;i<7;i++){digLst.AddAt(new TClonesArray("AliHMPIDDigit"),i); iDigCnt[i]=0;} //tmp list of digits for allchambers
-
-  Int_t iEvtN=0;
-  while(pRR->NextEvent()){//events loop
-    pAL->GetEvent(iEvtN++);
-    pRL->MakeTree("R");  pRich->MakeBranch("R");
-    
-    for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
-      AliHMPIDRawStream stream(pRR);
-      while(stream.Next())
-       {
-         UInt_t ddl=stream.GetDDLNumber(); //returns 0,1,2 ... 13  
-         if((UInt_t)(2*iCh)==ddl || (UInt_t)(2*iCh+1)==ddl) {
-         for(Int_t row = 1; row <=AliHMPIDRawStream::kNRows; row++){
-          for(Int_t dil = 1; dil <=AliHMPIDRawStream::kNDILOGICAdd; dil++){
-            for(Int_t pad = 0; pad < AliHMPIDRawStream::kNPadAdd; pad++){
-              if(stream.GetCharge(ddl,row,dil,pad) < 1) continue; 
-              AliHMPIDDigit dig(stream.GetPad(ddl,row,dil,pad),stream.GetCharge(ddl,row,dil,pad));
-              if(!IsDigSurvive(&dig)) continue;
-              new((*((TClonesArray*)digLst.At(iCh)))[iDigCnt[iCh]++]) AliHMPIDDigit(dig); //add this digit to the tmp list
-             }//pad
-            }//dil
-           }//row
-       }//while stream    
-    }//ch loop
-  }   
-  }
-         
-  pRL->UnloadRecPoints();
-}//Reconstruct raw data
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDReconstructor::ConvertDigits(AliRawReader *pRR,TTree *pDigTree)const
 {
 //Invoked  by AliReconstruction to convert raw digits from DDL files to digits
@@ -221,7 +191,7 @@ void AliHMPIDReconstructor::ConvertDigits(AliRawReader *pRR,TTree *pDigTree)cons
   AliDebug(1,"Stop.");
 }//Reconstruct digits from raw digits
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDReconstructor::FillESD(AliRunLoader *, AliESDEvent *pESD) const
+void AliHMPIDReconstructor::FillESD(TTree */*digitsTree*/, TTree */*clustersTree*/, AliESDEvent *pESD) const
 {
 // Calculates probability to be a electron-muon-pion-kaon-proton
 // from the given Cerenkov angle and momentum assuming no initial particle composition
@@ -259,4 +229,3 @@ void AliHMPIDReconstructor::FillESD(AliRunLoader *, AliESDEvent *pESD) const
     pTrk->SetHMPIDpid(pid);
   }//ESD tracks loop
 }//FillESD()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++