]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
EMCAL e-by-e reconstruction methods from Cvetan
authorjklay <jklay@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Sep 2007 20:56:39 +0000 (20:56 +0000)
committerjklay <jklay@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Sep 2007 20:56:39 +0000 (20:56 +0000)
EMCAL/AliEMCALClusterizer.cxx
EMCAL/AliEMCALClusterizer.h
EMCAL/AliEMCALClusterizerv1.cxx
EMCAL/AliEMCALClusterizerv1.h
EMCAL/AliEMCALRawUtils.cxx
EMCAL/AliEMCALRawUtils.h
EMCAL/AliEMCALRecParam.cxx
EMCAL/AliEMCALRecParam.h
EMCAL/AliEMCALReconstructor.cxx
EMCAL/AliEMCALReconstructor.h

index a42fa6a7244e946aca092f622884ec0eefac63a9..c36b80125d682a572d6356d9082c46522ddd6c70 100644 (file)
 //////////////////////////////////////////////////////////////////////////////
 
 // --- ROOT system ---
+#include "TClonesArray.h"
+#include "TTree.h"
 
 // --- Standard library ---
 
 
 // --- AliRoot header files ---
 #include "AliEMCALClusterizer.h"
-#include "AliRunLoader.h"
+#include "AliLog.h"
 
 ClassImp(AliEMCALClusterizer)
 
 //____________________________________________________________________________
-AliEMCALClusterizer::AliEMCALClusterizer()
-  : TTask("",""),
-    fEventFolderName("")
+AliEMCALClusterizer::AliEMCALClusterizer():
+  fDigitsArr(NULL),
+  fTreeR(NULL),
+  fRecPoints(NULL)
 {
   // ctor
 }
 
 //____________________________________________________________________________
-AliEMCALClusterizer::AliEMCALClusterizer(const TString alirunFileName, 
-                                        const TString eventFolderName)
-  : TTask("EMCAL"+AliConfig::Instance()->GetReconstructionerTaskName(), alirunFileName),
-    fEventFolderName(eventFolderName)
+AliEMCALClusterizer::~AliEMCALClusterizer()
 {
-  // ctor
+  // dtor
+  if (fDigitsArr) {
+    fDigitsArr->Delete();
+    delete fDigitsArr;
+  }
+  if (fRecPoints) {
+    fRecPoints->Delete();
+    delete fRecPoints;
+  }
 }
 
 //____________________________________________________________________________
-AliEMCALClusterizer::AliEMCALClusterizer(const AliEMCALClusterizer& clu)
-  : TTask(clu.GetName(),clu.GetTitle()),
-    fEventFolderName(clu.fEventFolderName)
+void AliEMCALClusterizer::SetInput(TTree *digitsTree)
 {
-  // copy ctor
+  // Read the digits from the input tree
+  TBranch *branch = digitsTree->GetBranch("EMCAL");
+  if (!branch) { 
+    AliError("can't get the branch with the EMCAL digits !");
+    return;
+  }
+  fDigitsArr = new TClonesArray("AliEMCALDigit",100);
+  branch->SetAddress(&fDigitsArr);
+  branch->GetEntry(0);
 }
 
 //____________________________________________________________________________
-AliEMCALClusterizer::~AliEMCALClusterizer()
+void AliEMCALClusterizer::SetOutput(TTree *clustersTree)
 {
-  // dtor
- //Remove this from the parental task before destroying
-  AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL")->CleanReconstructioner();
+  // Read the digits from the input tree
+  fTreeR = clustersTree;
+  
+  AliDebug(9, "Making array for EMCAL clusters");
+  fRecPoints = new TObjArray(100) ;
+  Int_t split = 0;
+  Int_t bufsize = 32000;
+  fTreeR->Branch("EMCALECARP", "TObjArray", &fRecPoints, bufsize, split);
 }
-
index 8df299986f4cc09b5ff2694844486fc8a1b3c6d3..db445807900f231f83a734ffe4ad42001899cdc1 100644 (file)
 //                           of new  IO (à la PHOS)
 // --- ROOT system ---
 
-#include "TTask.h" 
-#include "AliConfig.h"
+#include "TObject.h" 
+class TTree;
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
 
-class AliEMCALClusterizer : public TTask {
+class AliEMCALClusterizer : public TObject {
 
 public:
 
   AliEMCALClusterizer() ;        // default ctor
-  AliEMCALClusterizer(const TString alirunFileName, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
-  AliEMCALClusterizer(const AliEMCALClusterizer &); //copy ctor
   virtual ~AliEMCALClusterizer() ; // dtorEM
 
-  virtual Float_t GetTowerClusteringThreshold()const {Warning("GetTowerClusteringThreshold", "Not Defined") ; return 0. ; }
-  virtual Float_t GetTowerLocalMaxCut()const {Warning("GetTowerLocalMaxCut", "Not Defined") ; return 0. ; }
-  virtual Float_t GetTowerLogWeight()const {Warning("GetTowerLogWeight", "Not Defined") ; return 0. ; }
-  virtual Float_t GetTimeCut() const {Warning("GetTimeCut", "Not Defined") ; return 0. ; }
-  virtual const char *  GetRecPointsBranch() const {Warning("GetRecPointsBranch", "Not Defined") ; return 0 ; }
-  virtual Int_t GetRecPointsInRun()  const {Warning("GetRecPointsInRun", "Not Defined") ; return 0 ; }
-  virtual const char *  GetDigitsBranch() const  {Warning("GetDigitsBranch", "Not Defined") ; return 0 ; }
+  virtual void    Digits2Clusters(Option_t *option) = 0;
 
-  virtual void MakeClusters() = 0;
+  virtual Float_t GetTimeCut() const = 0;
 
   virtual void SetECAClusteringThreshold(Float_t) = 0;
   virtual void SetECALocalMaxCut(Float_t)         = 0;
   virtual void SetECALogWeight(Float_t)           = 0;
   virtual void SetTimeCut(Float_t)                = 0;
   virtual void SetUnfolding(Bool_t)               = 0;
-  void SetEventFolderName(TString name) { fEventFolderName = name ; }
-
-  AliEMCALClusterizer & operator = (const AliEMCALClusterizer & /*rvalue*/)  {return *this ;} 
 
   virtual const char * Version() const {Warning("Version", "Not Defined") ; return 0 ; } 
 
+  virtual void SetInput(TTree *digitsTree);
+  virtual void SetOutput(TTree *clustersTree);
+
 protected:
-  TString fEventFolderName ;  // event folder name
 
-  ClassDef(AliEMCALClusterizer,0)  // Clusterization algorithm class 
+  virtual void MakeClusters(char* opt) = 0;
+
+  TClonesArray *fDigitsArr; // Array with EMCAL digits
+  TTree *fTreeR;            // Tree with output clusters
+  TObjArray    *fRecPoints; // Array with EMCAL clusters
+
+private:
+  AliEMCALClusterizer(const AliEMCALClusterizer &); //copy ctor
+  AliEMCALClusterizer & operator = (const AliEMCALClusterizer &);
+
+  ClassDef(AliEMCALClusterizer,1)  // Clusterization algorithm class 
 } ;
 
 #endif // AliEMCALCLUSTERIZER_H
index 4e9786a76e92e06c90816211f3dbe33d7a4bf1ac..7863f079568b95c1a6f1605710a481fd67d45163 100644 (file)
@@ -67,15 +67,15 @@ class TSystem;
 #include "AliRunLoader.h"
 #include "AliRun.h"
 #include "AliESD.h"
-#include "AliEMCALLoader.h"
 #include "AliEMCALClusterizerv1.h"
 #include "AliEMCALRecPoint.h"
 #include "AliEMCALDigit.h"
 #include "AliEMCALDigitizer.h"
 #include "AliEMCAL.h"
 #include "AliEMCALGeometry.h"
-#include "AliEMCALRawUtils.h"
 #include "AliEMCALHistoUtilities.h"
+#include "AliEMCALRecParam.h"
+#include "AliEMCALReconstructor.h"
 #include "AliCDBManager.h"
 
 class AliCDBStorage;
@@ -84,27 +84,8 @@ class AliCDBStorage;
 ClassImp(AliEMCALClusterizerv1)
 
 //____________________________________________________________________________
-AliEMCALClusterizerv1::AliEMCALClusterizerv1() 
+AliEMCALClusterizerv1::AliEMCALClusterizerv1()
   : AliEMCALClusterizer(),
-    fHists(0),fPointE(0),fPointL1(0),fPointL2(0),
-    fPointDis(0),fPointMult(0),fDigitAmp(0),fMaxE(0),
-    fMaxL1(0),fMaxL2(0),fMaxDis(0),fGeom(0),
-    fDefaultInit(kTRUE),
-    fToUnfold(kFALSE),
-    fNumberOfECAClusters(0),fNTowerInGroup(0),fCalibData(0),
-    fADCchannelECA(0.),fADCpedestalECA(0.),fECAClusteringThreshold(0.),fECALocMaxCut(0.),
-    fECAW0(0.),fRecPointsInRun(0),fTimeCut(0.),fMinECut(0.)
-{
-  // default ctor (to be used mainly by Streamer)
-  
-  InitParameters() ; 
-  fGeom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaulGeometryName());
-  fGeom->GetTransformationForSM(); // Global <-> Local
-}
-
-//____________________________________________________________________________
-AliEMCALClusterizerv1::AliEMCALClusterizerv1(const TString alirunFileName, const TString eventFolderName)
-  : AliEMCALClusterizer(alirunFileName, eventFolderName),
     fHists(0),fPointE(0),fPointL1(0),fPointL2(0),
     fPointDis(0),fPointMult(0),fDigitAmp(0),fMaxE(0),
     fMaxL1(0),fMaxL2(0),fMaxDis(0),fGeom(0),
@@ -112,7 +93,7 @@ AliEMCALClusterizerv1::AliEMCALClusterizerv1(const TString alirunFileName, const
     fToUnfold(kFALSE),
     fNumberOfECAClusters(0),fNTowerInGroup(0),fCalibData(0),
     fADCchannelECA(0.),fADCpedestalECA(0.),fECAClusteringThreshold(0.),fECALocMaxCut(0.),
-    fECAW0(0.),fRecPointsInRun(0),fTimeCut(0.),fMinECut(0.)
+    fECAW0(0.),fTimeCut(0.),fMinECut(0.)
 {
   // ctor with the indication of the file where header Tree and digits Tree are stored
   
@@ -120,50 +101,12 @@ AliEMCALClusterizerv1::AliEMCALClusterizerv1(const TString alirunFileName, const
   Init() ;
 }
 
-//____________________________________________________________________________
-AliEMCALClusterizerv1::AliEMCALClusterizerv1(const AliEMCALClusterizerv1& clus)
-  : AliEMCALClusterizer(clus),
-    fHists(clus.fHists),
-    fPointE(clus.fPointE),
-    fPointL1(clus.fPointL1),
-    fPointL2(clus.fPointL2),
-    fPointDis(clus.fPointDis),
-    fPointMult(clus.fPointMult),
-    fDigitAmp(clus.fDigitAmp),
-    fMaxE(clus.fMaxE),
-    fMaxL1(clus.fMaxL1),
-    fMaxL2(clus.fMaxL2),
-    fMaxDis(clus.fMaxDis),
-    fGeom(clus.fGeom),
-    fDefaultInit(clus.fDefaultInit),
-    fToUnfold(clus.fToUnfold),
-    fNumberOfECAClusters(clus.fNumberOfECAClusters),
-    fNTowerInGroup(clus.fNTowerInGroup),
-    fCalibData(clus.fCalibData),
-    fADCchannelECA(clus.fADCchannelECA),
-    fADCpedestalECA(clus.fADCpedestalECA),
-    fECAClusteringThreshold(clus.fECAClusteringThreshold),
-    fECALocMaxCut(clus.fECALocMaxCut),
-    fECAW0(clus.fECAW0),
-    fRecPointsInRun(clus.fRecPointsInRun),
-    fTimeCut(clus.fTimeCut),
-    fMinECut(clus.fMinECut)
-{
-  //copy ctor
-}
-
 //____________________________________________________________________________
   AliEMCALClusterizerv1::~AliEMCALClusterizerv1()
 {
   // dtor
 }
 
-//____________________________________________________________________________
-const TString AliEMCALClusterizerv1::BranchName() const 
-{ 
-   return GetName();
-}
-
 //____________________________________________________________________________
 Float_t  AliEMCALClusterizerv1::Calibrate(Int_t amp, Int_t AbsId) 
 {
@@ -205,7 +148,7 @@ Float_t  AliEMCALClusterizerv1::Calibrate(Int_t amp, Int_t AbsId)
 }
 
 //____________________________________________________________________________
-void AliEMCALClusterizerv1::Exec(Option_t * option)
+void AliEMCALClusterizerv1::Digits2Clusters(Option_t * option)
 {
   // Steering method to perform clusterization for the current event 
   // in AliEMCALLoader
@@ -216,9 +159,6 @@ void AliEMCALClusterizerv1::Exec(Option_t * option)
   if(strstr(option,"print"))
     Print("") ; 
  
-  AliRunLoader *rl = AliRunLoader::GetRunLoader();
-  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
-
   //Get calibration parameters from file or digitizer default values.
   GetCalibrationParameters() ;
 
@@ -233,15 +173,12 @@ void AliEMCALClusterizerv1::Exec(Option_t * option)
   if(fToUnfold)
     MakeUnfolding() ;
 
-  WriteRecPoints() ;
-
+  fTreeR->Fill();
+  
   if(strstr(option,"deb") || strstr(option,"all"))  
     PrintRecPoints(option) ;
 
-  AliDebug(1,Form("EMCAL Clusterizer found %d Rec Points",emcalLoader->RecPoints()->GetEntriesFast()));
-
-  //increment the total number of recpoints per run   
-  fRecPointsInRun += emcalLoader->RecPoints()->GetEntriesFast() ;  
+  AliDebug(1,Form("EMCAL Clusterizer found %d Rec Points",fRecPoints->GetEntriesFast()));
 
   if(strstr(option,"tim")){
     gBenchmark->Stop("EMCALClusterizer");
@@ -258,16 +195,13 @@ Bool_t AliEMCALClusterizerv1::FindFit(AliEMCALRecPoint * emcRP, AliEMCALDigit **
   // The initial values for fitting procedure are set equal to the positions of local maxima.
   // Cluster will be fitted as a superposition of nPar/3 electromagnetic showers
 
-  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
-  TClonesArray *digits = emcalLoader->Digits();
-
   gMinuit->mncler();                     // Reset Minuit's list of paramters
   gMinuit->SetPrintLevel(-1) ;           // No Printout
   gMinuit->SetFCN(AliEMCALClusterizerv1::UnfoldingChiSquare) ;  
                                          // To set the address of the minimization function 
   TList * toMinuit = new TList();
   toMinuit->AddAt(emcRP,0) ;
-  toMinuit->AddAt(digits,1) ;
+  toMinuit->AddAt(fDigitsArr,1) ;
   
   gMinuit->SetObjectFit(toMinuit) ;         // To tranfer pointer to UnfoldingChiSquare
 
@@ -353,22 +287,28 @@ void AliEMCALClusterizerv1::GetCalibrationParameters()
 
   //Check if calibration is stored in data base
 
-  AliEMCALLoader *emcalLoader = 
-    dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));  
-
-  fCalibData =emcalLoader->CalibData();
-
-   if(!fCalibData)
-     {
-       //If calibration is not available use default parameters
-       //Loader
-       if ( !emcalLoader->Digitizer() ) 
-        emcalLoader->LoadDigitizer();
-       AliEMCALDigitizer * dig = dynamic_cast<AliEMCALDigitizer*>(emcalLoader->Digitizer());
+  if(!fCalibData && (AliCDBManager::Instance()->IsDefaultStorageSet()))
+    {
+      AliCDBEntry *entry = (AliCDBEntry*) 
+       AliCDBManager::Instance()->Get("EMCAL/Calib/Data");
+      if (entry) fCalibData =  (AliEMCALCalibData*) entry->GetObject();
+    }
+  
+  if(!fCalibData)
+    AliFatal("Calibration parameters not found in CDB!");
+  //  Please fix it!! Or better just remove it...
+//    if(!fCalibData)
+//      {
+//        //If calibration is not available use default parameters
+//        //Loader
+//        if ( !emcalLoader->Digitizer() ) 
+//      emcalLoader->LoadDigitizer();
+//        AliEMCALDigitizer * dig = dynamic_cast<AliEMCALDigitizer*>(emcalLoader->Digitizer());
        
-       fADCchannelECA   = dig->GetECAchannel() ;
-       fADCpedestalECA  = dig->GetECApedestal();
-     }
+//        fADCchannelECA   = dig->GetECAchannel() ;
+//        fADCpedestalECA  = dig->GetECApedestal();
+//      }
 }
 
 //____________________________________________________________________________
@@ -400,27 +340,22 @@ void AliEMCALClusterizerv1::InitParameters()
 
   fNTowerInGroup = 36;  //Produces maximum of 80 pseudoclusters per event
 
-  fECAClusteringThreshold   = 0.5;  // Best value for 2 GeV gamma merged with Ideal HIJING. Retune later? 
   fECALocMaxCut = 0.03; // ??
 
-  fECAW0    = 4.5;
   fTimeCut = 300e-9 ; // 300 ns time cut (to be tuned) 
   fToUnfold = kFALSE ;
-  fRecPointsInRun  = 0 ;
-  fMinECut = 0.45; // Best value for 2 GeV gamma merged with Ideal HIJING. Retune later? 
 
   fCalibData               = 0 ;
 
-  // If reconstruction parameters are found in OCDB, take them from it
-
-  AliEMCALLoader *emcalLoader = 
-    dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
-  AliEMCALRecParam *recParamDB = emcalLoader->RecParam();
-  if (recParamDB != 0) {
-    fECAClusteringThreshold = recParamDB->GetClusteringThreshold();
-    fECAW0                  = recParamDB->GetW0();
-    fMinECut                = recParamDB->GetMinECut();
-    AliDebug(1,Form("Reconstruction parameters were taken from OCDB: fECAClusteringThreshold=%.3f, fECAW=%.3f, fMinECut=%.3f",
+  const AliEMCALRecParam* recParam = AliEMCALReconstructor::GetRecParam();
+  if(!recParam) {
+    AliFatal("Reconstruction parameters for EMCAL not set!");
+  }
+  else {
+    fECAClusteringThreshold = recParam->GetClusteringThreshold();
+    fECAW0                  = recParam->GetW0();
+    fMinECut                = recParam->GetMinECut();
+    AliDebug(1,Form("Reconstruction parameters: fECAClusteringThreshold=%.3f, fECAW=%.3f, fMinECut=%.3f",
                 fECAClusteringThreshold,fECAW0,fMinECut));
   }
 
@@ -510,56 +445,6 @@ Int_t AliEMCALClusterizerv1::AreInGroup(AliEMCALDigit * d1, AliEMCALDigit * d2)
   return rv ;
 }
  
-//____________________________________________________________________________
-void AliEMCALClusterizerv1::WriteRecPoints()
-{
-
-  // Creates new branches with given title
-  // fills and writes into TreeR.
-
-  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
-
-  TObjArray * aECARecPoints = emcalLoader->RecPoints() ; 
-
-  TClonesArray * digits = emcalLoader->Digits() ; 
-  TTree * treeR = emcalLoader->TreeR();  
-  if ( treeR==0 ) {
-    emcalLoader->MakeRecPointsContainer();
-    treeR = emcalLoader->TreeR();  
-  }
-  else if (treeR->GetEntries() > 0) {
-    Warning("WriteRecPoints","RecPoints already exist in output file. New Recpoitns will not be visible.");
-  }
-  Int_t index ;
-
-  //Evaluate position, dispersion and other RecPoint properties for EC section
-  for(index = 0; index < aECARecPoints->GetEntries(); index++) {
-    if (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index))->GetClusterType() != AliESDCaloCluster::kPseudoCluster)
-       dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index))->EvalAll(fECAW0,digits) ;
-  }
-  
-  aECARecPoints->Sort() ;
-
-  for(index = 0; index < aECARecPoints->GetEntries(); index++) {
-    (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index)))->SetIndexInList(index) ;
-    (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index)))->Print();
-  }
-
-  Int_t bufferSize = 32000 ;    
-  Int_t splitlevel = 0 ; 
-
-  //EC section branch
-  
-  TBranch * branchECA = 0;
-  if ((branchECA = treeR->GetBranch("EMCALECARP")))
-    branchECA->SetAddress(&aECARecPoints);
-  else
-    treeR->Branch("EMCALECARP","TObjArray",&aECARecPoints,bufferSize,splitlevel);
-  treeR->Fill() ;
-
-  emcalLoader->WriteRecPoints("OVERWRITE");
-}
-
 //____________________________________________________________________________
 void AliEMCALClusterizerv1::MakeClusters(char* option)
 {
@@ -569,15 +454,11 @@ void AliEMCALClusterizerv1::MakeClusters(char* option)
 
   if (fGeom==0) AliFatal("Did not get geometry from EMCALLoader");
 
-  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
-  TObjArray * aECARecPoints = emcalLoader->RecPoints() ; 
-  aECARecPoints->Clear();
-
-  TClonesArray *digits = emcalLoader->Digits();
+  fRecPoints->Clear();
 
   // Set up TObjArray with pointers to digits to work on 
   TObjArray *digitsC = new TObjArray();
-  TIter nextdigit(digits);
+  TIter nextdigit(fDigitsArr);
   AliEMCALDigit *digit;
   while ( (digit = dynamic_cast<AliEMCALDigit*>(nextdigit())) ) {
     digitsC->AddLast(digit);
@@ -588,7 +469,7 @@ void AliEMCALClusterizerv1::MakeClusters(char* option)
     //
     // New algorithm : will be created one pseudo cluster per module  
     //
-    AliDebug(1,Form("Pseudo clustering #digits : %i ",digits->GetEntries()));
+    AliDebug(1,Form("Pseudo clustering #digits : %i ",fDigitsArr->GetEntries()));
 
     AliEMCALRecPoint *recPoints[12]; // max size is 12 : see fGeom->GetNumberOfSuperModules();
     for(int i=0; i<12; i++) recPoints[i] = 0;
@@ -608,7 +489,7 @@ void AliEMCALClusterizerv1::MakeClusters(char* option)
     }
     fNumberOfECAClusters = 0;
     for(int i=0; i<fGeom->GetNumberOfSuperModules(); i++) { // put non empty rec.points to container
-      if(recPoints[i]) aECARecPoints->AddAt(recPoints[i], fNumberOfECAClusters++);
+      if(recPoints[i]) fRecPoints->AddAt(recPoints[i], fNumberOfECAClusters++);
     }
     AliDebug(1,Form(" Number of PC %d ", fNumberOfECAClusters));
   }
@@ -630,19 +511,19 @@ void AliEMCALClusterizerv1::MakeClusters(char* option)
       ehs += e;
   } 
   AliDebug(1,Form("MakeClusters: Number of digits %d  -> (e %f), ehs %d\n",
-                 digits->GetEntries(),fMinECut,ehs));
+                 fDigitsArr->GetEntries(),fMinECut,ehs));
 
   nextdigitC.Reset();
 
   while ( (digit = dynamic_cast<AliEMCALDigit *>(nextdigitC())) ) { // scan over the list of digitsC
-    TArrayI clusterECAdigitslist(digits->GetEntries());
+    TArrayI clusterECAdigitslist(fDigitsArr->GetEntries());
 
     if(fGeom->CheckAbsCellId(digit->GetId()) && (Calibrate(digit->GetAmp(), digit->GetId()) > fECAClusteringThreshold  ) ){
       // start a new Tower RecPoint
-      if(fNumberOfECAClusters >= aECARecPoints->GetSize()) aECARecPoints->Expand(2*fNumberOfECAClusters+1) ;
+      if(fNumberOfECAClusters >= fRecPoints->GetSize()) fRecPoints->Expand(2*fNumberOfECAClusters+1) ;
       AliEMCALRecPoint *recPoint = new  AliEMCALRecPoint("") ; 
-      aECARecPoints->AddAt(recPoint, fNumberOfECAClusters) ;
-      recPoint = dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(fNumberOfECAClusters)) ; 
+      fRecPoints->AddAt(recPoint, fNumberOfECAClusters) ;
+      recPoint = dynamic_cast<AliEMCALRecPoint *>(fRecPoints->At(fNumberOfECAClusters)) ; 
       fNumberOfECAClusters++ ; 
 
       recPoint->SetClusterType(AliESDCaloCluster::kClusterv1);
@@ -675,7 +556,7 @@ void AliEMCALClusterizerv1::MakeClusters(char* option)
 
   delete digitsC ;
 
-  AliDebug(1,Form("total no of clusters %d from %d digits",fNumberOfECAClusters,digits->GetEntriesFast())); 
+  AliDebug(1,Form("total no of clusters %d from %d digits",fNumberOfECAClusters,fDigitsArr->GetEntriesFast())); 
 }
 
 void AliEMCALClusterizerv1::MakeUnfolding() const
@@ -728,18 +609,12 @@ void AliEMCALClusterizerv1::Print(Option_t * /*option*/)const
     
     // Print parameters
  
-    TString taskName(GetName()) ;
-    taskName.ReplaceAll(Version(), "") ;
+    TString taskName(Version()) ;
     
     printf("--------------- "); 
     printf(taskName.Data()) ; 
     printf(" "); 
-    printf(GetTitle()) ; 
-    printf("-----------\n");  
-    printf("Clusterizing digits from the file: "); 
-    printf(taskName.Data());  
-    printf("\n                           Branch: "); 
-    printf(GetName()); 
+    printf("Clusterizing digits: "); 
     printf("\n                       ECA Local Maximum cut    = %f", fECALocMaxCut); 
     printf("\n                       ECA Logarithmic weight   = %f", fECAW0); 
     if(fToUnfold)
@@ -757,19 +632,13 @@ void AliEMCALClusterizerv1::Print(Option_t * /*option*/)const
 void AliEMCALClusterizerv1::PrintRecPoints(Option_t * option)
 {
   // Prints list of RecPoints produced at the current pass of AliEMCALClusterizer
-  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
-  TObjArray * aECARecPoints = emcalLoader->RecPoints() ; 
-    
   if(strstr(option,"deb")) {
     printf("PrintRecPoints: Clusterization result:") ; 
   
-    printf("event # %d\n", emcalLoader->GetRunLoader()->GetEventNumber() ) ;
     printf("           Found %d ECA Rec Points\n ", 
-        aECARecPoints->GetEntriesFast()) ; 
+        fRecPoints->GetEntriesFast()) ; 
   }
 
-  fRecPointsInRun +=  aECARecPoints->GetEntriesFast() ; 
-  
   if(strstr(option,"all")) {
     if(strstr(option,"deb")) {
       printf("\n-----------------------------------------------------------------------\n") ;
@@ -782,10 +651,10 @@ void AliEMCALClusterizerv1::PrintRecPoints(Option_t * option)
    Float_t maxL2=0; 
    Float_t maxDis=0; 
 
-    AliEMCALHistoUtilities::FillH1(fHists, 12, double(aECARecPoints->GetEntries()));
+    AliEMCALHistoUtilities::FillH1(fHists, 12, double(fRecPoints->GetEntries()));
 
-    for (index = 0 ; index < aECARecPoints->GetEntries() ; index++) {
-      AliEMCALRecPoint * rp = dynamic_cast<AliEMCALRecPoint * >(aECARecPoints->At(index)) ; 
+    for (index = 0 ; index < fRecPoints->GetEntries() ; index++) {
+      AliEMCALRecPoint * rp = dynamic_cast<AliEMCALRecPoint * >(fRecPoints->At(index)) ; 
       TVector3  globalpos;  
       //rp->GetGlobalPosition(globalpos);
       TVector3  localpos;  
@@ -882,10 +751,3 @@ void AliEMCALClusterizerv1::DrawLambdasHists()
     }
   }
 }
-
-void AliEMCALClusterizerv1::Browse(TBrowser* b)
-{
-  if(fHists) b->Add(fHists);
-  if(fGeom)  b->Add(fGeom);
-  TTask::Browse(b);
-}
index 24ac6c8e4fd2f338c0020736a997458078c69d63..13ec854f1b62f1d828f815c63290cec33fdae4a9 100644 (file)
@@ -36,17 +36,8 @@ class AliEMCALClusterizerv1 : public AliEMCALClusterizer {
 public:
   
   AliEMCALClusterizerv1() ;         
-  //cpy ctor required by coding convention
-  AliEMCALClusterizerv1(const AliEMCALClusterizerv1& clus);
 
-  AliEMCALClusterizerv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName());
   virtual ~AliEMCALClusterizerv1()  ;
-  virtual void Browse(TBrowser* b);
-
-  AliEMCALClusterizerv1 & operator = (const AliEMCALClusterizerv1 &) {
-    Fatal("operator =", "not implemented") ;
-    return *this ;
-  }
 
   virtual Int_t   AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d2)const ; 
                                // Checks if digits are in neighbour cells 
@@ -63,10 +54,8 @@ public:
   virtual Float_t GetMinECut()const              { return fMinECut;}
 
   virtual Float_t GetTimeCut() const            { return fTimeCut ; }
-  virtual const char *  GetRecPointsBranch() const{ return GetName() ;}
-  virtual Int_t GetRecPointsInRun() const   {return fRecPointsInRun ;} 
 
-  void    Exec(Option_t *option);                // Does the job
+  virtual void    Digits2Clusters(Option_t *option);                // Does the job
 
   virtual void Print(Option_t * option)const ;
 
@@ -88,9 +77,7 @@ public:
   void   DrawLambdasHists();                     //*MENU*
 protected:
 
-  void           WriteRecPoints() ;
   virtual void   MakeClusters(char* opt );            
-  virtual void   MakeClusters() { Fatal("MakeClusters","not implemented"); }
             
 ///////////////////// 
    TList  *fHists;   //!
@@ -108,8 +95,9 @@ protected:
 
 
 private:
+  AliEMCALClusterizerv1(const AliEMCALClusterizerv1 &); //copy ctor
+  AliEMCALClusterizerv1 & operator = (const AliEMCALClusterizerv1 &);
 
-  const TString BranchName() const ; 
   void    GetCalibrationParameters(void) ;
   
   Bool_t  FindFit(AliEMCALRecPoint * emcRP, AliEMCALDigit ** MaxAt, Float_t * maxAtEnergy, 
@@ -141,11 +129,10 @@ private:
   Float_t fECAClusteringThreshold ;  // minimum energy to seed a EC digit in a cluster
   Float_t fECALocMaxCut ;            // minimum energy difference to distinguish local maxima in a cluster
   Float_t fECAW0 ;                   // logarithmic weight for the cluster center of gravity calculation
-  Int_t   fRecPointsInRun ;            //! Total number of recpoints in one run
   Float_t fTimeCut ;                // Maximum time difference between the digits in ont EMC cluster
   Float_t fMinECut;                  // Minimum energy for a digit to be a member of a cluster
 
-  ClassDef(AliEMCALClusterizerv1,5)   // Clusterizer implementation version 1
+  ClassDef(AliEMCALClusterizerv1,6)   // Clusterizer implementation version 1
 
 };
 
index 9777b85957865892ebd2a856438f9acf298d2ab7..700ffe07f1d19399cad0fdfe373da96c4e5512d5 100644 (file)
 /* $Id$ */
 /* History of cvs commits:
  *
- * $Log$ */
+ * $Log$
+ * Revision 1.1  2007/03/17 19:56:38  mvl
+ * Moved signal shape routines from AliEMCAL to separate class AliEMCALRawUtils to streamline raw data reconstruction code.
+ * */
 
 //*-- Author: Marco van Leeuwen (LBL)
 #include "AliEMCALRawUtils.h"
@@ -169,7 +172,7 @@ void AliEMCALRawUtils::Digits2Raw()
 }
 
 //____________________________________________________________________________
-void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader)
+void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader,TClonesArray *digitsArr)
 {
   // convert raw data of the current event to digits
   AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
@@ -178,14 +181,9 @@ void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader)
     return;
   }
 
-  AliRunLoader *rl = AliRunLoader::GetRunLoader();
-  AliEMCALLoader *loader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
-
-  // get the digits
-  TClonesArray* digits = loader->Digits() ;
-  digits->Clear(); 
+  digitsArr->Clear(); 
 
-  if (!digits) {
+  if (!digitsArr) {
     Error("Raw2Digits", "no digits found !");
     return;
   }
@@ -241,7 +239,7 @@ void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader)
     
     if (amp > 0) {
       AliDebug(2,Form("id %d amp %g", id, amp));
-      new((*digits)[idigit]) AliEMCALDigit( -1, -1, id, (Int_t)amp, time, idigit) ;    
+      new((*digitsArr)[idigit]) AliEMCALDigit( -1, -1, id, (Int_t)amp, time, idigit) ; 
          idigit++ ; 
     }
     Int_t index ; 
index da327fe0de6ca9f6fe5187631604d79a65984acf..26206426bebf989ca5a4e9dcf643f272cb8f6bf4 100644 (file)
@@ -7,6 +7,9 @@
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.1  2007/03/17 19:56:38  mvl
+ * Moved signal shape routines from AliEMCAL to separate class AliEMCALRawUtils to streamline raw data reconstruction code.
+ *
  *
  */
 //_________________________________________________________________________
@@ -33,7 +36,7 @@ class AliEMCALRawUtils : public TObject {
   virtual ~AliEMCALRawUtils();
 
   void Digits2Raw();
-  void Raw2Digits(AliRawReader *reader);
+  void Raw2Digits(AliRawReader *reader,TClonesArray *digitsArr);
 
   // Signal shape parameters
   Double_t GetRawFormatHighLowGainFactor() const {return fHighLowGainFactor ;}
index efe4f74b595f30ad6e1934bd459aae810f774a19..da8a9c4b9eb43bda732dcb5470332fdd706d52dc 100644 (file)
@@ -28,8 +28,10 @@ ClassImp(AliEMCALRecParam)
 //-----------------------------------------------------------------------------
 
 AliEMCALRecParam::AliEMCALRecParam():
-  fClusteringThreshold(0),fW0(0),fMinECut(0)
-{}
+  fClusteringThreshold(0.5),fW0(4.5),fMinECut(0.45)
+{
+  // default reco values
+}
 
 //-----------------------------------------------------------------------------
 void AliEMCALRecParam::Print(Option_t *) const
index c889cf6eb699e7cd087800b245c345c59b162863..55edbb00447455486756163aa26e138c6ec9d33e 100644 (file)
@@ -22,9 +22,9 @@ public:
   
   AliEMCALRecParam() ;
   virtual ~AliEMCALRecParam() {}
-  Float_t GetClusteringThreshold()      {return fClusteringThreshold;}
-  Float_t GetW0                 ()      {return fW0                 ;}
-  Float_t GetMinECut            ()      {return fMinECut            ;}
+  Float_t GetClusteringThreshold() const     {return fClusteringThreshold;}
+  Float_t GetW0                 () const     {return fW0                 ;}
+  Float_t GetMinECut            () const     {return fMinECut            ;}
   void SetClusteringThreshold(Float_t thrsh)   {fClusteringThreshold = thrsh;}
   void SetW0                 (Float_t w0)      {fW0 = w0                    ;}
   void SetMinECut            (Float_t minEcut) {fMinECut = minEcut          ;}
index ed0c07790ae19ca528af0daef728eed833a565fc..35a36a7d36ec5764ec14f3582eb4be78d267bcd7 100644 (file)
 // --- AliRoot header files ---
 #include "AliEMCALReconstructor.h"
 
-#include "AliRun.h"
 #include "AliESDEvent.h"
 #include "AliESDCaloCluster.h"
 #include "AliESDtrack.h"
-#include "AliRunLoader.h"
 #include "AliEMCALLoader.h"
 #include "AliEMCALRawUtils.h"
 #include "AliEMCALClusterizerv1.h"
 #include "AliEMCALPID.h"
 #include "AliEMCALTrigger.h"
 #include "AliRawReader.h"
+// to be removed - it is here just because of geom
+#include "AliRun.h"
+#include "AliRunLoader.h"
 
 ClassImp(AliEMCALReconstructor)
 
+AliEMCALRecParam* AliEMCALReconstructor::fgkRecParam = 0;  // EMCAL rec. parameters
+
 //____________________________________________________________________________
 AliEMCALReconstructor::AliEMCALReconstructor() 
   : fDebug(kFALSE) 
 {
   // ctor
+  if (!fgkRecParam) {
+    AliWarning("The Reconstruction parameters for EMCAL nonitialized - Used default one");
+    fgkRecParam = new AliEMCALRecParam;
+  }
 } 
 
 //____________________________________________________________________________
@@ -65,82 +72,58 @@ AliEMCALReconstructor::~AliEMCALReconstructor()
 } 
 
 //____________________________________________________________________________
-void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader) const 
+void AliEMCALReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const
 {
   // method called by AliReconstruction; 
   // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
   // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by 
   // the global tracking.
+  // Works on the current event.
  
-  TString headerFile(runLoader->GetFileName()) ; 
-  TString branchName(runLoader->GetEventFolder()->GetName() ) ;  
-  
-  AliEMCALClusterizerv1 clu(headerFile, branchName);
-  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(runLoader->GetDetectorLoader("EMCAL"));    
-
-  Int_t nEvents   = runLoader->GetNumberOfEvents();
-  runLoader->LoadDigits("EMCAL");
-  for (Int_t ievent = 0; ievent < nEvents; ievent++) {
-    runLoader->GetEvent(ievent);
-    if ( Debug() ) 
-      clu.ExecuteTask("deb all") ; 
-    else 
-      clu.ExecuteTask("pseudo") ;  
-  }   
-  // Unload the Digits and RecPoints
-  emcalLoader->UnloadDigits() ; 
-  emcalLoader->UnloadRecPoints() ; 
+  AliEMCALClusterizerv1 clu;
+  clu.SetInput(digitsTree);
+  clu.SetOutput(clustersTree);
+  if ( Debug() ) 
+    clu.Digits2Clusters("deb all") ; 
+  else 
+    clu.Digits2Clusters("pseudo") ;  
 }
 
 //____________________________________________________________________________
-void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const 
+void AliEMCALReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
 
 {
-  // Reconstruction loop for Raw Data processing
-  //
-  // Only the clusterization is performed
-  // Track-cluster matching is done in FillESD because the track
-  // segment maker needs access to the AliESD object to retrieve 
-  // the tracks reconstructed by the global tracking.
-  
-  TString headerFile(runLoader->GetFileName()) ; 
-  TString branchName(runLoader->GetEventFolder()->GetName()) ;  
+  // Conversion from raw data to
+  // EMCAL digits.
+  // Works on a single-event basis
 
-  static AliEMCALRawUtils rawUtils;
-  AliEMCALClusterizerv1 clu(headerFile, branchName);
-  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(runLoader->GetDetectorLoader("EMCAL"));    
-  Int_t iEvent = 0;
   rawReader->Reset() ; 
-  while (rawReader->NextEvent()) {  
-    runLoader->GetEvent(iEvent++);
 
-    rawUtils.Raw2Digits(rawReader);
+  TClonesArray *digitsArr = new TClonesArray("AliEMCALDigit",100);
+  Int_t bufsize = 32000;
+  digitsTree->Branch("EMCAL", &digitsArr, bufsize);
 
-    if ( Debug() ) 
-      clu.ExecuteTask("deb pseudo all") ; 
-    else 
-      clu.ExecuteTask("pseudo") ;  
-    // Unload the RecPoints
-    emcalLoader->UnloadRecPoints() ; 
-  }
+  static AliEMCALRawUtils rawUtils;
+  rawUtils.Raw2Digits(rawReader,digitsArr);
 }
 
 //____________________________________________________________________________
-void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESDEvent* esd) const
+void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, 
+                                   AliESDEvent* esd) const
 {
   // Called by AliReconstruct after Reconstruct() and global tracking and vertexing 
+  // Works on the current event
   const double timeScale = 1.e+11; // transition constant from sec to 0.01 ns 
 
-  Int_t eventNumber = runLoader->GetEventNumber() ;
-
   // Creates AliESDCaloCluster from AliEMCALRecPoints 
-  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(runLoader->GetDetectorLoader("EMCAL"));
-  runLoader->LoadRecPoints("EMCAL");
-  runLoader->GetEvent(eventNumber);
-  TObjArray *clusters = emcalLoader->RecPoints();
+
+  TObjArray *clusters = new TObjArray(100);
+  TBranch *branch = clustersTree->GetBranch("EMCALECARP");
+  branch->SetAddress(&clusters);
+  clustersTree->GetEvent(0);
+
   Int_t nClusters = clusters->GetEntries(), nClustersNew=0;
-  AliDebug(1,Form("Event %d: %d clusters",eventNumber,nClusters));
+  AliDebug(1,Form("%d clusters",nClusters));
   //  Int_t nRP=0, nPC=0; // in input
   esd->SetFirstEMCALCluster(esd->GetNumberOfCaloClusters()); // Put after Phos clusters 
 
@@ -158,6 +141,7 @@ void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESDEvent* esd) c
   Float_t ampOutOfPatchnxn  = tr.GetnxnAmpOutOfPatch() ;
 
   AliEMCALGeometry * geom = 0;
+  AliRunLoader *runLoader = AliRunLoader::GetRunLoader();
   if (runLoader->GetAliRun() && runLoader->GetAliRun()->GetDetector("EMCAL"))
     geom = dynamic_cast<AliEMCAL*>(runLoader->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
   if (geom == 0) 
@@ -223,7 +207,7 @@ void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESDEvent* esd) c
 
 
   for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) {
-    const AliEMCALRecPoint * clust = emcalLoader->RecPoint(iClust);
+    const AliEMCALRecPoint * clust = (const AliEMCALRecPoint*)clusters->At(iClust);
     //if(clust->GetClusterType()== AliESDCaloCluster::kClusterv1) nRP++; else nPC++;
     if (Debug()) clust->Print();
     // Get information from EMCAL reconstruction points
index c89b66397a8beae0705cfb9c565d2a542412f798..994f56a1e6603cd6a12c2aaf5de638be42a0c779 100644 (file)
@@ -19,6 +19,7 @@
 class AliEMCALDigitizer ;
 class AliEMCALClusterizer ;
 class AliEMCALSDigitizer ;
+class AliEMCALRecParam;
 class AliESDEvent ;
 class AliRawReader ;
 
@@ -38,11 +39,15 @@ public:
   Bool_t       Debug() const { return fDebug ; }
 
   using AliReconstructor::FillESD;
-  virtual void FillESD(AliRunLoader* runLoader, AliESDEvent* esd) const ;
+  virtual void FillESD(TTree* digitsTree, TTree* clustersTree, 
+                      AliESDEvent* esd) const;
   AliTracker*  CreateTracker         (AliRunLoader*                      )const{return new AliEMCALTracker;} 
   using AliReconstructor::Reconstruct;
-  virtual void Reconstruct(AliRunLoader* runLoader) const ;
-  virtual void Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const ;
+  virtual Bool_t             HasLocalReconstruction() const {return kTRUE;};
+  virtual void Reconstruct(TTree* digitsTree, TTree* clustersTree) const;
+
+  virtual Bool_t             HasDigitConversion() const {return kTRUE;};
+  virtual void               ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const;
   
   
   AliEMCALReconstructor & operator = (const AliEMCALReconstructor & /*rvalue*/)  {
@@ -51,12 +56,16 @@ public:
     return *this ; 
   }
   
+  void SetRecParam(AliEMCALRecParam * recParam){ fgkRecParam = recParam;}
+
+  static const AliEMCALRecParam* GetRecParam(){ return fgkRecParam;}
 
 private:
   
   Bool_t fDebug; //! verbosity controller
-  ClassDef(AliEMCALReconstructor,1)  // Reconstruction algorithm class (Base Class)
+  static AliEMCALRecParam*   fgkRecParam; // reconstruction parameters for EMCAL
+
+  ClassDef(AliEMCALReconstructor,2)  // Reconstruction algorithm class (Base Class)
 
 };