]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALReconstructioner.cxx
Use of (dummy) reconstructors for all detectors (T.Kuhr)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALReconstructioner.cxx
index 4544dfd7e2c091a903004dc9edffaa6a9027c66e..2df6ba1887ac2c5f3003f95dd30c7c33b3f8093e 100644 (file)
 /////////////////////////////////////////////////////////////////////////////////////
 //  Wrapping class for reconstruction. Allows to produce reconstruction from 
 //  different steps: from previously produced hits,sdigits, etc. Each new reconstruction
-//  flow (e.g. digits, made from them RecPoints, subsequently made TrackSegments, 
+//  flow (e.g. digits, made from them RecPoints,
 //  subsequently made RecParticles) are distinguished by the title of created branches. One can 
 //  use this title as a comment, see use case below. 
 //  Thanks to getters, one can set 
 //  parameters to reconstruction briks. The full set of parameters is saved in the 
 //  corresponding branch: e.g. parameters of clusterizer are stored in branch 
-//  TreeR::AliEMCALClusterizer with the same title as the branch containing the RecPoints. 
-//  TTree does not support overwriting, therefore one can not produce several 
+//  TreeR::AliEMCALClusterizer with the same title as the branch containing the RecPoints. //  TTree does not support overwriting, therefore one can not produce several 
 //  branches with the same names and titles - use different titles.
 //
 //  Use case: 
 //             // branches produced in this pass
 //  root [4] r->StartFrom("AliEMCALClusterizer","Local max cut 0.02") 
 //             // means that will use already generated Digits and produce only RecPoints, 
-//             // TS and RecParticles 
+//             // and RecParticles 
 //
 //             // And finally one can call ExecuteTask() with the following options
 //  root [5] r->ExecuteTask("debug all timing")
-//             // deb     - prints the numbers of produced SDigits, Digits etc.
-//             // deb all - prints in addition list of made SDigits, digits etc.
+//             // deb     - prints the numbers of RecPoints and RecParticles
+//             // deb all - prints in addition list of RecPoints and RecParticles
 //             // timing  - prints benchmarking results
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 // --- ROOT system ---
 
-#include "TClonesArray.h"
-#include "TROOT.h"
-#include "TTree.h"
-#include "TFile.h"
-
 // --- Standard library ---
 
 // --- AliRoot header files ---
-#include "AliRun.h"
+#include "AliESD.h"
+#include "AliESDCaloTrack.h"
 #include "AliEMCALReconstructioner.h"
 #include "AliEMCALClusterizerv1.h"
-#include "AliEMCALDigitizer.h"
-#include "AliEMCALSDigitizer.h"
-//#include "AliEMCALTrackSegmentMakerv1.h"
-//#include "AliEMCALPIDv1.h"
-//#include "AliEMCALFastRecParticle.h"
-//#include "AliEMCALCpvRecPoint.h"
+#include "AliEMCALPIDv1.h"
+#include "AliEMCALGetter.h"
 
 ClassImp(AliEMCALReconstructioner)
 
@@ -84,128 +75,117 @@ ClassImp(AliEMCALReconstructioner)
   AliEMCALReconstructioner::AliEMCALReconstructioner():TTask("AliEMCALReconstructioner","")
 {
   // ctor
-  fToSplit = kFALSE ;
-  fDigitizer   = 0 ;
   fClusterizer = 0 ;
-  //fTSMaker     = 0 ;
-  //fPID         = 0 ; 
-  fSDigitizer  = 0 ;
-  fHeaderFileName = "galice.root" ;
+  fPID         = 0 ; 
 
   fIsInitialized = kFALSE ;
 
 } 
 
 //____________________________________________________________________________
-AliEMCALReconstructioner::AliEMCALReconstructioner(const char* headerFile,const char * branchName,Bool_t toSplit):
-TTask("AliEMCALReconstructioner","")
+AliEMCALReconstructioner::AliEMCALReconstructioner(const char* evFoldName,const char * branchName):
+TTask("AliEMCALReconstructioner",evFoldName)
 {
   // ctor
   
-  fHeaderFileName = headerFile ;
-  fToSplit = toSplit ;
-  fSDigitsBranch= branchName; 
-  fSDigitizer  = new AliEMCALSDigitizer(fHeaderFileName.Data(),fSDigitsBranch.Data(),toSplit) ; 
-  Add(fSDigitizer) ;
-
-  fDigitsBranch=branchName ; 
-  fDigitizer   = new AliEMCALDigitizer(fHeaderFileName.Data(),fDigitsBranch.Data(),toSplit) ; 
-  Add(fDigitizer) ;
-
+  AliEMCALGetter::Instance(evFoldName) ; 
 
   fRecPointBranch=branchName ; 
-  fClusterizer = new AliEMCALClusterizerv1(fHeaderFileName.Data(),fRecPointBranch.Data(),toSplit) ; 
-  Add(fClusterizer) ;
-  
-
-//   fTSBranch=branchName ; 
-//   fTSMaker     = new AliEMCALTrackSegmentMakerv1(fHeaderFileName.Data(),fTSBranch.Data(),toSplit) ;
-//   Add(fTSMaker) ;
-  
+  fClusterizer = new AliEMCALClusterizerv1(evFoldName, GetTitle());
+  Add(fClusterizer);
   
-//   fRecPartBranch=branchName ; 
-//   fPID         = new AliEMCALPIDv1(fHeaderFileName.Data(),fRecPartBranch.Data(),toSplit) ;
-//   Add(fPID) ;
+  fRecPartBranch=branchName ; 
+  fPID         = new AliEMCALPIDv1(evFoldName, GetTitle());
+  Add(fPID);
   
   fIsInitialized = kTRUE ;
-  
 } 
 //____________________________________________________________________________
-void AliEMCALReconstructioner::Exec(Option_t *option)
+void AliEMCALReconstructioner::Exec(Option_t *opt)
 {
-  //chesk, if the names of branches, which should be made conicide with already
+  //check, if the names of branches, which should be made coincide with already
   //existing
+  if (!opt) 
+    return ; 
   if(!fIsInitialized)
     Init() ;
 }
+//____________________________________________________________________________
+void AliEMCALReconstructioner:: Clusters2Tracks(Int_t ievent, AliESD *event)
+{
+  // Convert EMCAL reconstructed particles into ESD object for event# ievent.
+  // ESD object is returned as an argument event
+
+  if(!fIsInitialized) Init() ;
 
+  fClusterizer->SetEventRange(ievent,ievent);
+  fClusterizer->ExecuteTask();
+  
+  fPID        ->SetEventRange(ievent,ievent);
+  fPID        ->ExecuteTask();
+
+  AliEMCALGetter *gime = AliEMCALGetter::Instance();
+  TClonesArray *recParticles = gime->RecParticles();
+  Int_t nOfRecParticles = recParticles->GetEntries();
+  for (Int_t recpart=0; recpart<nOfRecParticles; recpart++) {
+    AliESDCaloTrack *ct = new AliESDCaloTrack((AliEMCALRecParticle*)recParticles->At(recpart));
+    event->AddCaloTrack(ct);
+  }
+  
+}
 //____________________________________________________________________________
  void AliEMCALReconstructioner::Init()
 {
   // initiliaze Reconstructioner if necessary: we can not do this in default constructor
 
   if(!fIsInitialized){
-    // Initialisation
-
-    fSDigitsBranch="Default" ; 
-    fSDigitizer  = new AliEMCALSDigitizer(fHeaderFileName.Data(),fSDigitsBranch.Data(),fToSplit) ; 
-    Add(fSDigitizer) ;
-
-    fDigitsBranch="Default" ; 
-    fDigitizer   = new AliEMCALDigitizer(fHeaderFileName.Data(),fDigitsBranch.Data(),fToSplit) ; 
-    Add(fDigitizer) ;
 
     fRecPointBranch="Default" ; 
-    fClusterizer = new AliEMCALClusterizerv1(fHeaderFileName.Data(),fRecPointBranch.Data(),fToSplit) ; 
+    fClusterizer = new AliEMCALClusterizerv1(GetTitle(),fRecPointBranch.Data());
     Add(fClusterizer) ;
 
-//     fTSBranch="Default" ; 
-//     fTSMaker     = new AliEMCALTrackSegmentMakerv1(fHeaderFileName.Data(),fTSBranch.Data(),fToSplit) ;
-//     Add(fTSMaker) ;
-
-
-//     fRecPartBranch="Default" ; 
-//     fPID         = new AliEMCALPIDv1(fHeaderFileName.Data(),fRecPartBranch.Data(),fToSplit) ;
-//     Add(fPID) ;
+    fRecPartBranch="Default"; 
+    fPID         = new AliEMCALPIDv1(GetTitle(),fRecPartBranch.Data()) ;
+    Add(fPID) ;
     
     fIsInitialized = kTRUE ;
+    
   }
 } 
 //____________________________________________________________________________
 AliEMCALReconstructioner::~AliEMCALReconstructioner()
 {
   // Delete data members if any
-
 } 
 
 //____________________________________________________________________________
-
-void AliEMCALReconstructioner::Print(Option_t * option)const {
+void AliEMCALReconstructioner::Print()const {
   // Print reconstructioner data  
 
-  printf("\n") ; 
-
-  printf(" Reconstruction of the header file "); 
-  printf(fHeaderFileName.Data());
-  printf("\n with the following modules:\n");
-
-  if(fSDigitizer->IsActive()){
-     printf("   (+)   "); 
-     printf(fSDigitizer->GetName()); 
-     printf(" to branch : "); 
-     printf(fSDigitsBranch.Data()); 
-  }
-  if(fDigitizer->IsActive()){
-    printf("\n   (+)   "); 
-    printf(fDigitizer->GetName()); 
-    printf(" to branch : "); 
-    printf(fDigitsBranch.Data()); 
-  }
+  TString message ; 
+  message  = "-----------------AliEMCALReconstructioner---------------\n" ;
+  message += " Reconstruction of the header file %s\n" ;
+  message += " with the following modules:\n" ;
   
   if(fClusterizer->IsActive()){
-    printf("\n   (+)   "); 
-    printf(fClusterizer->GetName()); 
-    printf(" to branch : "); 
-    printf(fRecPointBranch.Data()); 
-  } 
+    message += "   (+)   %s to branch %s\n" ;
+  }
+
+  if(fPID->IsActive()){
+    message += "   (+)   %s to branch %s\n" ;  
+  }
+  Info("Print", message.Data(), 
+       GetTitle(), 
+       fClusterizer->GetName(), fRecPointBranch.Data(), 
+       fPID->GetName(), fRecPartBranch.Data() ) ; 
+}
+
+//____________________________________________________________________________
+void AliEMCALReconstructioner::SetEventRange(Int_t first, Int_t last)
+{
+  // Set the event range to process
+  fFirstEvent=first; 
+  fLastEvent=last; 
+  fClusterizer->SetEventRange(fFirstEvent, fLastEvent) ; 
+  fPID->SetEventRange(fFirstEvent, fLastEvent) ;
 }