* provided "as is" without express or implied warranty. *
**************************************************************************/
+/* $Id$ */
+
//_________________________________________________________________________
-// A brief description of the class
-//*-- Author : Gines MARTINEZ SUBATECH
-//////////////////////////////////////////////////////////////////////////////
+//*--
+//*-- 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] AliPHOSReconstructioner * r = new AliPHOSReconstructioner("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
+///////////////////////////////////////////////////////////////////////////////////////////////////
// --- ROOT system ---
-#include "TClonesArray.h"
-
// --- Standard library ---
// --- AliRoot header files ---
-
+#include "AliESD.h"
+#include "AliESDCaloTrack.h"
#include "AliPHOSReconstructioner.h"
-#include "AliPHOSClusterizer.h"
+#include "AliPHOSClusterizerv1.h"
+#include "AliPHOSTrackSegmentMakerv1.h"
+#include "AliPHOSPIDv1.h"
+#include "AliPHOSGetter.h"
-ClassImp(AliPHOSReconstructioner)
+ClassImp(AliPHOSReconstructioner)
//____________________________________________________________________________
-AliPHOSReconstructioner::AliPHOSReconstructioner()
+ AliPHOSReconstructioner::AliPHOSReconstructioner():TTask("AliPHOSReconstructioner","")
{
// ctor
-}
+ fClusterizer = 0 ;
+ fTSMaker = 0 ;
+ fPID = 0 ;
+ fFirstEvent = 0 ;
+ fLastEvent = -1 ;
+ fIsInitialized = kFALSE ;
-//____________________________________________________________________________
-AliPHOSReconstructioner::AliPHOSReconstructioner(AliPHOSClusterizer * Clusterizer,
- AliPHOSTrackSegmentMaker * Tracker,
- AliPHOSPID * Pid)
-{
- fClusterizer = Clusterizer ;
- fTrackSegmentMaker = Tracker ;
- fPID = Pid ;
}
//____________________________________________________________________________
-AliPHOSReconstructioner::~AliPHOSReconstructioner()
+AliPHOSReconstructioner::AliPHOSReconstructioner(const char* evFoldName,const char * branchName):
+TTask("AliPHOSReconstructioner",evFoldName)
{
- // dtor
-}
+ // ctor
+
+ AliPHOSGetter::Instance(evFoldName) ;
+ fRecPointBranch=branchName ;
+ fClusterizer = new AliPHOSClusterizerv1(evFoldName, GetTitle());
+ Add(fClusterizer);
+
+ fTSBranch=branchName ;
+ fTSMaker = new AliPHOSTrackSegmentMakerv1(evFoldName, GetTitle());
+ Add(fTSMaker) ;
+
+ fRecPartBranch=branchName ;
+ fPID = new AliPHOSPIDv1(evFoldName, GetTitle());
+ Add(fPID);
+
+ fIsInitialized = kTRUE ;
+}
//____________________________________________________________________________
- void AliPHOSReconstructioner::Init(AliPHOSClusterizer * Clusterizer,
- AliPHOSTrackSegmentMaker * Tracker,
- AliPHOSPID * Pid)
+void AliPHOSReconstructioner::Exec(Option_t *opt)
{
- fClusterizer = Clusterizer ;
- fTrackSegmentMaker = Tracker ;
- fPID = Pid ;
-}
+ //check, if the names of branches, which should be made coincide with already
+ //existing
+ if (!opt)
+ return ;
+ if(!fIsInitialized)
+ Init() ;
+}
+//____________________________________________________________________________
+void AliPHOSReconstructioner:: Clusters2Tracks(Int_t ievent, AliESD *event)
+{
+ // 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);
+ }
+
+}
//____________________________________________________________________________
- void AliPHOSReconstructioner::Make(TClonesArray * dl, RecPointsList * emccl, RecPointsList * ppsdl,
- TrackSegmentsList * trsl, RecParticlesList * rpl)
+ void AliPHOSReconstructioner::Init()
{
- fClusterizer->MakeClusters(dl, emccl, ppsdl);
-
+ // 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 ;
+
+ }
+}
+//____________________________________________________________________________
+AliPHOSReconstructioner::~AliPHOSReconstructioner()
+{
+ // Delete data members if any
+}
- fTrackSegmentMaker->MakeTrackSegments(dl, emccl, ppsdl, trsl) ;
+void AliPHOSReconstructioner::Print()const {
+ // Print reconstructioner data
+
+ TString message ;
+ message = "-----------------AliPHOSReconstructioner---------------\n" ;
+ message += " Reconstruction of the header file %s\n" ;
+ message += " with the following modules:\n" ;
+
+ if(fClusterizer->IsActive()){
+ message += " (+) %s to branch %s\n" ;
+ }
+
+ if(fTSMaker->IsActive()){
+ message += " (+) %s to branch %s\n" ;
+ }
+
+ if(fPID->IsActive()){
+ message += " (+) %s to branch %s\n" ;
+ }
+ Info("Print", message.Data(),
+ GetTitle(),
+ fClusterizer->GetName(), fRecPointBranch.Data(),
+ fTSMaker->GetName(), fTSBranch.Data() ,
+ fPID->GetName(), fRecPartBranch.Data() ) ;
+}
- fPID->MakeParticles(trsl, rpl) ;
+//____________________________________________________________________________
+void AliPHOSReconstructioner::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) ;
}