]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSReconstructor.cxx
Rename AliPHOSReconstructioner to AliPHOSReconstructor
[u/mrichter/AliRoot.git] / PHOS / AliPHOSReconstructor.cxx
CommitLineData
d15a28e7 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
b2a60966 16/* $Id$ */
17
d15a28e7 18//_________________________________________________________________________
a3dfe79c 19//*--
7acf6008 20//*-- Author: Gines Martinez & Yves Schutz (SUBATECH)
f1aeaf5d 21//*-- Compleetely redesigned by Dmitri Peressounko (SUBATECH & RRC KI) March 2001
7acf6008 22/////////////////////////////////////////////////////////////////////////////////////
9a6ec61a 23// Wrapping class for reconstruction. Allows to produce reconstruction from
24// different steps: from previously produced hits,sdigits, etc. Each new reconstruction
a4e98857 25// flow (e.g. digits, made from them RecPoints, subsequently made TrackSegments,
26// subsequently made RecParticles) are distinguished by the title of created branches. One can
27// use this title as a comment, see use case below.
28// Thanks to getters, one can set
29// parameters to reconstruction briks. The full set of parameters is saved in the
30// corresponding branch: e.g. parameters of clusterizer are stored in branch
21cd0c07 31// TreeR::AliPHOSClusterizer with the same title as the branch containing the RecPoints. // TTree does not support overwriting, therefore one can not produce several
9a6ec61a 32// branches with the same names and titles - use different titles.
33//
a4e98857 34// Use case:
7acf6008 35//
f444a19f 36// root [0] AliPHOSReconstructor * r = new AliPHOSReconstructor("galice.root")
7acf6008 37// // Set the header file
38// root [1] r->ExecuteTask()
a4e98857 39// // Make full chain of reconstruction
7acf6008 40//
41// // One can specify the title for each branch
42// root [2] r->SetBranchFileName("RecPoints","RecPoints1") ;
7acf6008 43//
9a6ec61a 44// // One can change parameters of reconstruction algorithms
45// root [3] r->GetClusterizer()->SetEmcLocalMaxCut(0.02)
46//
47// // One can specify the starting point of the reconstruction and title of all
48// // branches produced in this pass
49// root [4] r->StartFrom("AliPHOSClusterizer","Local max cut 0.02")
50// // means that will use already generated Digits and produce only RecPoints,
51// // TS and RecParticles
7acf6008 52//
53// // And finally one can call ExecuteTask() with the following options
9a6ec61a 54// root [5] r->ExecuteTask("debug all timing")
85ef0957 55// // deb - prints the numbers of RecPoints, TrackSegments, RecParticles
56// // deb all - prints in addition list of RecPoints, TrackSegments, RecParticles
57// // timing - prints benchmarking results
9a6ec61a 58///////////////////////////////////////////////////////////////////////////////////////////////////
d15a28e7 59
60// --- ROOT system ---
61
d15a28e7 62// --- Standard library ---
364de5c6 63
d15a28e7 64// --- AliRoot header files ---
35293055 65#include "AliESD.h"
66#include "AliESDCaloTrack.h"
f444a19f 67#include "AliPHOSReconstructor.h"
7acf6008 68#include "AliPHOSClusterizerv1.h"
7acf6008 69#include "AliPHOSTrackSegmentMakerv1.h"
70#include "AliPHOSPIDv1.h"
35293055 71#include "AliPHOSGetter.h"
e957fea8 72
d15a28e7 73
f444a19f 74ClassImp(AliPHOSReconstructor)
d15a28e7 75
d15a28e7 76//____________________________________________________________________________
f444a19f 77 AliPHOSReconstructor::AliPHOSReconstructor():TTask("AliPHOSReconstructor","")
d15a28e7 78{
b2a60966 79 // ctor
7acf6008 80 fClusterizer = 0 ;
81 fTSMaker = 0 ;
82 fPID = 0 ;
d7d3b67b 83 fFirstEvent = 0 ;
84 fLastEvent = -1 ;
7acf6008 85 fIsInitialized = kFALSE ;
d15a28e7 86
6ad0bfa0 87}
88
6ad0bfa0 89//____________________________________________________________________________
f444a19f 90AliPHOSReconstructor::AliPHOSReconstructor(const char* evFoldName,const char * branchName,const TString taskName):
91TTask("AliPHOSReconstructor",evFoldName)
d15a28e7 92{
06e774ed 93 // Create a PHOS reconstructioner for the tasks defined by taskName
94 // "C" - clusterization
95 // "T" - track segment making
96 // "P" - PID
88cb7938 97
85ef0957 98 AliPHOSGetter::Instance(evFoldName) ;
7acf6008 99
06e774ed 100 if (taskName.Contains("C")) {
101 fRecPointBranch=branchName ;
102 fClusterizer = new AliPHOSClusterizerv1(evFoldName, GetTitle());
103 Add(fClusterizer);
104 }
2131115b 105
06e774ed 106 if (taskName.Contains("T")) {
107 fTSBranch=branchName ;
108 fTSMaker = new AliPHOSTrackSegmentMakerv1(evFoldName, GetTitle());
109 Add(fTSMaker) ;
110 }
7acf6008 111
06e774ed 112 if (taskName.Contains("P")) {
113 fRecPartBranch=branchName ;
114 fPID = new AliPHOSPIDv1(evFoldName, GetTitle());
115 Add(fPID);
116 }
7acf6008 117
118 fIsInitialized = kTRUE ;
7acf6008 119}
120//____________________________________________________________________________
f444a19f 121void AliPHOSReconstructor::Exec(Option_t *opt)
a4e98857 122{
85ef0957 123 //check, if the names of branches, which should be made coincide with already
7acf6008 124 //existing
e957fea8 125 if (!opt)
126 return ;
7acf6008 127 if(!fIsInitialized)
128 Init() ;
7acf6008 129}
130//____________________________________________________________________________
f444a19f 131void AliPHOSReconstructor:: Clusters2Tracks(Int_t ievent, AliESD *event)
35293055 132{
133 // Convert PHOS reconstructed particles into ESD object for event# ievent.
134 // ESD object is returned as an argument event
135
136 if(!fIsInitialized) Init() ;
137
138 fClusterizer->SetEventRange(ievent,ievent);
139 fClusterizer->ExecuteTask();
140
141 fTSMaker ->SetEventRange(ievent,ievent);
142 fTSMaker ->ExecuteTask();
143
144 fPID ->SetEventRange(ievent,ievent);
145 fPID ->ExecuteTask();
146
147 AliPHOSGetter *gime = AliPHOSGetter::Instance();
148 TClonesArray *recParticles = gime->RecParticles();
149 Int_t nOfRecParticles = recParticles->GetEntries();
150 for (Int_t recpart=0; recpart<nOfRecParticles; recpart++) {
151 AliESDCaloTrack *ct = new AliESDCaloTrack((AliPHOSRecParticle*)recParticles->At(recpart));
152 event->AddCaloTrack(ct);
153 }
154
155}
156//____________________________________________________________________________
f444a19f 157 void AliPHOSReconstructor::Init()
7acf6008 158{
a4e98857 159 // initiliaze Reconstructioner if necessary: we can not do this in default constructor
7acf6008 160
161 if(!fIsInitialized){
85ef0957 162
81b0fcd1 163 fRecPointBranch="Default" ;
88cb7938 164 fClusterizer = new AliPHOSClusterizerv1(GetTitle(),fRecPointBranch.Data());
7acf6008 165 Add(fClusterizer) ;
166
81b0fcd1 167 fTSBranch="Default" ;
88cb7938 168 fTSMaker = new AliPHOSTrackSegmentMakerv1(GetTitle(),fTSBranch.Data());
7acf6008 169 Add(fTSMaker) ;
170
171
88cb7938 172 fRecPartBranch="Default";
173 fPID = new AliPHOSPIDv1(GetTitle(),fRecPartBranch.Data()) ;
7acf6008 174 Add(fPID) ;
175
176 fIsInitialized = kTRUE ;
88cb7938 177
7acf6008 178 }
179}
180//____________________________________________________________________________
f444a19f 181AliPHOSReconstructor::~AliPHOSReconstructor()
7acf6008 182{
baef0810 183 // Delete data members if any
7acf6008 184}
baef0810 185
f444a19f 186void AliPHOSReconstructor::Print()const {
baef0810 187 // Print reconstructioner data
188
21cd0c07 189 TString message ;
f444a19f 190 message = "-----------------AliPHOSReconstructor---------------\n" ;
21cd0c07 191 message += " Reconstruction of the header file %s\n" ;
192 message += " with the following modules:\n" ;
7acf6008 193
7acf6008 194 if(fClusterizer->IsActive()){
21cd0c07 195 message += " (+) %s to branch %s\n" ;
7acf6008 196 }
197
198 if(fTSMaker->IsActive()){
21cd0c07 199 message += " (+) %s to branch %s\n" ;
7acf6008 200 }
201
7acf6008 202 if(fPID->IsActive()){
21cd0c07 203 message += " (+) %s to branch %s\n" ;
7acf6008 204 }
21cd0c07 205 Info("Print", message.Data(),
88cb7938 206 GetTitle(),
21cd0c07 207 fClusterizer->GetName(), fRecPointBranch.Data(),
208 fTSMaker->GetName(), fTSBranch.Data() ,
209 fPID->GetName(), fRecPartBranch.Data() ) ;
51926850 210}
d7d3b67b 211
212//____________________________________________________________________________
f444a19f 213void AliPHOSReconstructor::SetEventRange(Int_t first, Int_t last)
d7d3b67b 214{
215 // Set the event range to process
216 fFirstEvent=first;
217 fLastEvent=last;
218 fClusterizer->SetEventRange(fFirstEvent, fLastEvent) ;
219 fTSMaker->SetEventRange(fFirstEvent, fLastEvent) ;
220 fPID->SetEventRange(fFirstEvent, fLastEvent) ;
221}