]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Refurbishing AliReconstructor as plugin
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Apr 2004 09:21:10 +0000 (09:21 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Apr 2004 09:21:10 +0000 (09:21 +0000)
PHOS/AliPHOS.cxx
PHOS/AliPHOS.h
PHOS/AliPHOSReconstructor.cxx
PHOS/AliPHOSReconstructor.h

index 34b1634e9fd81099855c0c06ec70f84db3b2cc39..2d35da78dd12af92554c75c7f004de9c834a85c6 100644 (file)
@@ -79,12 +79,6 @@ void AliPHOS::Copy(AliPHOS & phos)
   phos.fTreeQA = fTreeQA->CloneTree() ; 
 }
 
-//____________________________________________________________________________
-AliDigitizer* AliPHOS::CreateDigitizer(AliRunDigitizer* manager) const
-{
-  return new AliPHOSDigitizer(manager);
-}
-
 //____________________________________________________________________________
 void AliPHOS::CreateMaterials()
 {
@@ -376,67 +370,6 @@ void AliPHOS::CreateMaterials()
 
 }
 
-//____________________________________________________________________________
-void AliPHOS::FillESD(AliESD* esd) const 
-{
-  // Called by AliReconstruct after Reconstruct() and global tracking and vertxing
-
-  //Creates the tracksegments and Recparticles
-  AliPHOSReconstructor * rec = new AliPHOSReconstructor((fLoader->GetRunLoader()->GetFileName()).Data()) ; 
-  TList * taskslist = rec->GetListOfTasks() ; 
-  Int_t index ;
-  TTask * task ; 
-  TString name ; 
- // set clusterizer task inactive 
-  for (index = 0; index < taskslist->GetSize(); index++) {
-    task = dynamic_cast<TTask *>(taskslist->At(index)) ; 
-    name = task->GetName() ; 
-    if ( name.Contains(AliConfig::Instance()->GetReconstructionerTaskName()))
-      task->SetActive(kFALSE) ; 
-    if ( name.Contains(AliConfig::Instance()->GetTrackerTaskName()))
-      (dynamic_cast<AliPHOSTrackSegmentMaker *> (task))->SetESD(esd) ; 
-  }
-
-  AliPHOSGetter *gime = AliPHOSGetter::Instance( (fLoader->GetRunLoader()->GetFileName()).Data() ) ;
-  Int_t eventNumber = gime->EventNumber();
-  rec->SetEventRange(eventNumber, eventNumber) ; // do current event; the loop over events is done by AliReconstruction::Run()
-  if ( Debug() ) 
-    rec->ExecuteTask("deb all") ;
-  else 
-    rec->ExecuteTask("") ;
-
-  // Creates AliESDtrack from AliPHOSRecParticles 
-  gime->Event(eventNumber, "P") ; 
-  TClonesArray *recParticles = gime->RecParticles();
-  Int_t nOfRecParticles = recParticles->GetEntries();
-  for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
-    AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
-    if (Debug()) 
-      rp->Print();
-    AliESDtrack * et = new AliESDtrack() ; 
-    // fills the ESDtrack
-    Double_t xyz[3];
-    for (Int_t ixyz=0; ixyz<3; ixyz++) xyz[ixyz] = rp->GetPos()[ixyz];
-    et->SetPHOSposition(xyz) ; 
-    et->SetPHOSsignal  (rp->Energy()) ; 
-    et->SetPHOSpid     (rp->GetPID()) ;
-    // add the track to the esd object
-    esd->AddTrack(et);
-    delete et;
-  }
-}       
-
-//____________________________________________________________________________
-void AliPHOS::Hits2SDigits()  
-{ 
-// create summable digits
-
-  AliPHOSSDigitizer* phosDigitizer = 
-    new AliPHOSSDigitizer(fLoader->GetRunLoader()->GetFileName().Data()) ;
-  phosDigitizer->SetEventRange(0, -1) ; // do all the events
-  phosDigitizer->ExecuteTask("all") ;
-}
-
 //____________________________________________________________________________
 AliLoader* AliPHOS::MakeLoader(const char* topfoldername)
 {
@@ -467,35 +400,6 @@ void AliPHOS::SetTreeAddress()
   }
 }
 
-//____________________________________________________________________________
-void AliPHOS::Reconstruct() const 
-{ 
-  // method called by AliReconstruction; it should not be called otherwise but the AliPHOSReconstructionner 
-  // should be called for stand alone reconstruction.
-  // 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.
-  AliPHOSReconstructor * rec = new AliPHOSReconstructor((fLoader->GetRunLoader()->GetFileName()).Data()) ; 
-  TList * taskslist = rec->GetListOfTasks() ; 
-  Int_t index ;
-  TTask * task ; 
-  TString name ; 
-  // set all tasks inactive except clusterizer
-  for (index = 0; index < taskslist->GetSize(); index++) {
-    task = dynamic_cast<TTask *>(taskslist->At(index)) ; 
-    name = task->GetName() ; 
-    if ( !name.Contains(AliConfig::Instance()->GetReconstructionerTaskName()))
-      task->SetActive(kFALSE) ; 
-  }
-  rec->SetEventRange(0, -1) ; // do all the events
-  if ( Debug() ) 
-    rec->ExecuteTask("deb all") ; 
-  else 
-    rec->ExecuteTask("") ; 
-  
-}
-
 //____________________________________________________________________________
 void AliPHOS::WriteQA()
 {
index ca51c5f73473d8f03490b18daa9bba92d3bbd846..78f5b5af55e2fc9ff90e315027e65ff432a424fb 100644 (file)
@@ -39,17 +39,13 @@ class AliPHOS : public AliDetector {
   }
   virtual void   AddHit( Int_t shunt, Int_t primary, Int_t track, 
                         Int_t id, Float_t *hits ) = 0 ;   
-  virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
   virtual void  CreateMaterials() ;            
-  virtual void  FillESD(AliESD* esd) const ;          
   virtual void  FinishRun() {WriteQA();}
   virtual AliPHOSGeometry * GetGeometry() const 
   {return AliPHOSGeometry::GetInstance(GetTitle(),"") ;  }
-  virtual void    Hits2SDigits();
   virtual Int_t   IsVersion(void) const = 0 ;  
   virtual AliLoader* MakeLoader(const char* topfoldername);
   AliPHOSQAChecker * QAChecker() {return fQATask;}  
-  virtual void Reconstruct() const; 
   void    SetDebug() { fDebug = kTRUE ; }
   void    ResetDebug() { fDebug = kFALSE ; }
   Bool_t  Debug() const { return fDebug ; } 
index 6a60e95a85366b06250112998cbd2fd189529ef0..8bac1b5b03ad1c78d4474597651cb67a123ec9c3 100644 (file)
 
 //_________________________________________________________________________
 //*--
-//*-- Author: Gines Martinez & Yves Schutz (SUBATECH) 
-//*-- Compleetely redesigned by Dmitri Peressounko (SUBATECH & RRC KI) March 2001
-/////////////////////////////////////////////////////////////////////////////////////
-//  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, 
-//  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::AliPHOSClusterizer 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: 
-//
-//  root [0] AliPHOSReconstructor * r = new AliPHOSReconstructor("galice.root")
-//              //  Set the header file
-//  root [1] r->ExecuteTask() 
-//              //  Make full chain of reconstruction
-//
-//              // One can specify the title for each branch 
-//  root [2] r->SetBranchFileName("RecPoints","RecPoints1") ;
-//      
-//             // One can change parameters of reconstruction algorithms
-//  root [3] r->GetClusterizer()->SetEmcLocalMaxCut(0.02)
-//
-//             // One can specify the starting point of the reconstruction and title of all 
-//             // branches produced in this pass
-//  root [4] r->StartFrom("AliPHOSClusterizer","Local max cut 0.02") 
-//             // means that will use already generated Digits and produce only RecPoints, 
-//             // TS and RecParticles 
-//
-//             // And finally one can call ExecuteTask() with the following options
-//  root [5] r->ExecuteTask("debug all timing")
-//            // deb     - prints the numbers of RecPoints, TrackSegments, RecParticles 
-//            // deb all - prints in addition list of RecPoints, TrackSegments, RecParticles  
-//            // timing  - prints benchmarking results
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
+//*-- Yves Schutz (SUBATECH) 
+// Reconstruction class. Redesigned from the old AliReconstructionner class and 
+// derived from STEER/AliReconstructor. 
+// 
 // --- ROOT system ---
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
 #include "AliESD.h"
-#include "AliESDCaloTrack.h"
 #include "AliPHOSReconstructor.h"
 #include "AliPHOSClusterizerv1.h"
 #include "AliPHOSTrackSegmentMakerv1.h"
 ClassImp(AliPHOSReconstructor)
 
 //____________________________________________________________________________
-  AliPHOSReconstructor::AliPHOSReconstructor():TTask("AliPHOSReconstructor","")
+  AliPHOSReconstructor::AliPHOSReconstructor() : fDebug(kFALSE) 
 {
   // ctor
-  fClusterizer = 0 ;
-  fTSMaker     = 0 ;
-  fPID         = 0 ; 
-  fFirstEvent  = 0 ; 
-  fLastEvent   = -1 ; 
-  fIsInitialized = kFALSE ;
-
 } 
 
-//____________________________________________________________________________
-AliPHOSReconstructor::AliPHOSReconstructor(const char* evFoldName,const char * branchName,const TString taskName):
-TTask("AliPHOSReconstructor",evFoldName)
-{
-  // Create a PHOS reconstructioner for the tasks defined by taskName
-  // "C" - clusterization
-  // "T" - track segment making
-  // "P" - PID
-
-  AliPHOSGetter::Instance(evFoldName) ; 
 
-  if (taskName.Contains("C")) {
-    fRecPointBranch=branchName ; 
-    fClusterizer = new AliPHOSClusterizerv1(evFoldName, GetTitle());
-    Add(fClusterizer);
-  }
-  
-  if (taskName.Contains("T")) {
-    fTSBranch=branchName ; 
-    fTSMaker     = new AliPHOSTrackSegmentMakerv1(evFoldName, GetTitle());
-    Add(fTSMaker) ;
-  }
-  
-  if (taskName.Contains("P")) {
-    fRecPartBranch=branchName ; 
-    fPID         = new AliPHOSPIDv1(evFoldName, GetTitle());
-    Add(fPID);
-  }
-  
-  fIsInitialized = kTRUE ;
-} 
-//____________________________________________________________________________
-void AliPHOSReconstructor::Exec(Option_t *opt)
-{
-  //check, if the names of branches, which should be made coincide with already
-  //existing
-  if (!opt) 
-    return ; 
-  if(!fIsInitialized)
-    Init() ;
-}
 //____________________________________________________________________________
-void AliPHOSReconstructor:: Clusters2Tracks(Int_t ievent, AliESD *event)
+void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const 
 {
-  // Convert PHOS 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();
-
-  fTSMaker    ->SetEventRange(ievent,ievent);
-  fTSMaker    ->ExecuteTask();
-  
-  fPID        ->SetEventRange(ievent,ievent);
-  fPID        ->ExecuteTask();
-
-  AliPHOSGetter *gime = AliPHOSGetter::Instance();
-  TClonesArray *recParticles = gime->RecParticles();
-  Int_t nOfRecParticles = recParticles->GetEntries();
-  for (Int_t recpart=0; recpart<nOfRecParticles; recpart++) {
-    AliESDCaloTrack *ct = new AliESDCaloTrack((AliPHOSRecParticle*)recParticles->At(recpart));
-    event->AddCaloTrack(ct);
-  }
+  // 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.
+  TString headerFile(runLoader->GetFileName()) ; 
+  TString branchName("Default") ;  
   
+  AliPHOSClusterizerv1 clu(headerFile, branchName);
+  clu.SetEventRange(0, -1) ; // do all the events
+  if ( Debug() ) 
+    clu.ExecuteTask("deb all") ; 
+  else 
+    clu.ExecuteTask("") ;  
 }
-//____________________________________________________________________________
- void AliPHOSReconstructor::Init()
-{
-  // initiliaze Reconstructioner if necessary: we can not do this in default constructor
-
-  if(!fIsInitialized){
-    
-    fRecPointBranch="Default" ; 
-    fClusterizer = new AliPHOSClusterizerv1(GetTitle(),fRecPointBranch.Data());
-    Add(fClusterizer) ;
-
-    fTSBranch="Default" ; 
-    fTSMaker     = new AliPHOSTrackSegmentMakerv1(GetTitle(),fTSBranch.Data());
-    Add(fTSMaker) ;
-
 
-    fRecPartBranch="Default"; 
-    fPID         = new AliPHOSPIDv1(GetTitle(),fRecPartBranch.Data()) ;
-    Add(fPID) ;
-    
-    fIsInitialized = kTRUE ;
-    
-  }
-} 
 //____________________________________________________________________________
-AliPHOSReconstructor::~AliPHOSReconstructor()
+void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
 {
-  // Delete data members if any
-} 
-
-void AliPHOSReconstructor::Print()const {
-  // Print reconstructioner data  
-
-  TString message ; 
-  message  = "-----------------AliPHOSReconstructor---------------\n" ;
-  message += " Reconstruction of the header file %s\n" ;
-  message += " with the following modules:\n" ;
-
-  if(fClusterizer->IsActive()){
-    message += "   (+)   %s to branch %s\n" ;
+  // Called by AliReconstruct after Reconstruct() and global tracking and vertxing 
+  //Creates the tracksegments and Recparticles
+  
+  TString headerFile(runLoader->GetFileName()) ; 
+  TString branchName("Default") ;  
+
+  AliPHOSTrackSegmentMakerv1 tsMaker(headerFile, branchName);
+  AliPHOSPIDv1 pID(headerFile, branchName);
+
+  AliPHOSGetter *gime = AliPHOSGetter::Instance( (runLoader->GetFileName()).Data() ) ;
+  Int_t eventNumber = gime->EventNumber();
+  // do current event; the loop over events is done by AliReconstruction::Run()
+  tsMaker.SetEventRange(eventNumber, eventNumber) ; 
+  pID.SetEventRange(eventNumber, eventNumber) ; 
+  if ( Debug() ) {
+   tsMaker.ExecuteTask("deb all") ;
+   pID.ExecuteTask("deb all") ;
   }
-
-  if(fTSMaker->IsActive()){
-    message += "   (+)   %s to branch %s\n" ; 
+  else {
+    tsMaker.ExecuteTask("") ;
+    pID.ExecuteTask("") ;
   }
-
-  if(fPID->IsActive()){
-    message += "   (+)   %s to branch %s\n" ;  
+  
+  // Creates AliESDtrack from AliPHOSRecParticles 
+  gime->Event(eventNumber, "P") ; 
+  TClonesArray *recParticles = gime->RecParticles();
+  Int_t nOfRecParticles = recParticles->GetEntries();
+  for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
+    AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
+    if (Debug()) 
+      rp->Print();
+    AliESDtrack * et = new AliESDtrack() ; 
+    // fills the ESDtrack
+    Double_t xyz[3];
+    for (Int_t ixyz=0; ixyz<3; ixyz++) xyz[ixyz] = rp->GetPos()[ixyz];
+    et->SetPHOSposition(xyz) ; 
+    et->SetPHOSsignal  (rp->Energy()) ; 
+    et->SetPHOSpid     (rp->GetPID()) ;
+    // add the track to the esd object
+    esd->AddTrack(et);
+    delete et;
   }
-  Info("Print", message.Data(), 
-       GetTitle(), 
-       fClusterizer->GetName(), fRecPointBranch.Data(), 
-       fTSMaker->GetName(), fTSBranch.Data() , 
-       fPID->GetName(), fRecPartBranch.Data() ) ; 
-}
-
-//____________________________________________________________________________
-void AliPHOSReconstructor::SetEventRange(Int_t first, Int_t last)
-{
-  // Set the event range to process
-  fFirstEvent=first; 
-  fLastEvent=last; 
-  fClusterizer->SetEventRange(fFirstEvent, fLastEvent) ; 
-  fTSMaker->SetEventRange(fFirstEvent, fLastEvent) ;
-  fPID->SetEventRange(fFirstEvent, fLastEvent) ;
 }
index 14548c9477da5373e06905cd7e54d8bcb8603d9a..f5b195ba1ed57e4d21250d47749211a5dd600e91 100644 (file)
@@ -8,12 +8,14 @@
 //_________________________________________________________________________
 //  Wrapping class for reconstruction
 //*--
-//*-- Author: Gines Martinez & Yves Schutz (SUBATECH) 
-//*--         Dmitri Peressounko (SUBATECH & Kurchatov Institute)
+//*-- Author: Yves Schutz (SUBATECH) 
+// Reconstruction class. Redesigned from the old AliReconstructionner class and 
+// derived from STEER/AliReconstructor. 
+//_________________________________________________________________________
 
 // --- ROOT system ---
 
-#include "TTask.h"
+#include "AliReconstructor.h" 
 class AliPHOSDigitizer ;
 class AliPHOSClusterizer ;
 class AliPHOSTrackSegmentMaker ;
@@ -25,29 +27,22 @@ class AliESD ;
 
 // --- AliRoot header files ---
 
-class AliPHOSReconstructor : public TTask {
+class AliPHOSReconstructor : public AliReconstructor {
 
 public:
 
   AliPHOSReconstructor() ; //ctor            
-  AliPHOSReconstructor(const char * headerFile, const char * branchName = "Default",const TString taskName="CTP");
-  AliPHOSReconstructor(const AliPHOSReconstructor & rec) : TTask(rec) {
+  AliPHOSReconstructor(const AliPHOSReconstructor & rec) : AliReconstructor(rec) {
     // cpy ctor: 
     // requested by the Coding Convention
     Fatal("cpy ctor", "not implemented") ;
   }
    
-  virtual ~AliPHOSReconstructor() ;
-
-  virtual void Exec(Option_t *) ;
-  void Clusters2Tracks(Int_t ievent, AliESD *event);
+  virtual ~AliPHOSReconstructor() {} ;
 
-  AliPHOSClusterizer       * GetClusterizer()const { return fClusterizer ; }
-  AliPHOSPID               * GetPID()        const { return fPID;          }
-  AliPHOSTrackSegmentMaker * GetTSMaker()    const { return fTSMaker ;     }
-  void SetEventRange(Int_t first=0, Int_t last=-1) ; 
-
-  void Print()const ;
+  Bool_t                     Debug() const { return fDebug ; }
+  virtual void               FillESD(AliRunLoader* runLoader, AliESD* esd) const ;
+  virtual void               Reconstruct(AliRunLoader* runLoader) const ;
 
   AliPHOSReconstructor & operator = (const AliPHOSReconstructor & /*rvalue*/)  {
     // assignement operator requested by coding convention but not needed
@@ -55,25 +50,11 @@ public:
     return *this ; 
   }
   
-
-private:
-  void Init() ;  
-
 private:
   
-  TString  fRecPointBranch ;    // Title of RecPoints branch   
-  TString  fTSBranch  ;         // Title of TrackSegments branch
-  TString  fRecPartBranch ;     // Title of RecParticles branch 
-
+  Bool_t fDebug; //! verbosity controller
 
-  AliPHOSClusterizer       * fClusterizer ; //! Pointer to AliPHOSClusterizer
-  AliPHOSPID               * fPID ;         //! Pointer to AliPHOSPID
-  AliPHOSTrackSegmentMaker * fTSMaker ;     //! Pointer to AliPHOSTrackSegmentMaker
-  Bool_t  fIsInitialized ; // kTRUE if reconstructioner is initialized
-  Int_t   fFirstEvent;        // first event to process
-  Int_t   fLastEvent;         // last  event to process
-  ClassDef(AliPHOSReconstructor,1)  // Reconstruction algorithm class (Base Class)
+  ClassDef(AliPHOSReconstructor,2)  // Reconstruction algorithm class (Base Class)
 
 };