Possibility to reconstruct selected events via SetEventRange()
[u/mrichter/AliRoot.git] / PHOS / AliPHOSReconstructioner.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//
36// root [0] AliPHOSReconstructioner * r = new AliPHOSReconstructioner("galice.root")
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")
7acf6008 55// // deb - prints the numbers of produced SDigits, Digits etc.
56// // deb all - prints in addition list of made SDigits, digits etc.
57// // timing - prints benchmarking results
9a6ec61a 58///////////////////////////////////////////////////////////////////////////////////////////////////
d15a28e7 59
60// --- ROOT system ---
61
d15a28e7 62// --- Standard library ---
e957fea8 63#include "Riostream.h"
364de5c6 64
d15a28e7 65// --- AliRoot header files ---
88cb7938 66#include "AliRunLoader.h"
d15a28e7 67#include "AliPHOSReconstructioner.h"
7acf6008 68#include "AliPHOSClusterizerv1.h"
69#include "AliPHOSDigitizer.h"
70#include "AliPHOSSDigitizer.h"
71#include "AliPHOSTrackSegmentMakerv1.h"
72#include "AliPHOSPIDv1.h"
e957fea8 73
88cb7938 74#include "AliPHOSLoader.h"
d15a28e7 75
76ClassImp(AliPHOSReconstructioner)
77
d15a28e7 78//____________________________________________________________________________
7acf6008 79 AliPHOSReconstructioner::AliPHOSReconstructioner():TTask("AliPHOSReconstructioner","")
d15a28e7 80{
b2a60966 81 // ctor
7acf6008 82 fDigitizer = 0 ;
83 fClusterizer = 0 ;
84 fTSMaker = 0 ;
85 fPID = 0 ;
86 fSDigitizer = 0 ;
d15a28e7 87
7acf6008 88 fIsInitialized = kFALSE ;
d15a28e7 89
6ad0bfa0 90}
91
6ad0bfa0 92//____________________________________________________________________________
88cb7938 93AliPHOSReconstructioner::AliPHOSReconstructioner(const char* evFoldName,const char * branchName):
94TTask("AliPHOSReconstructioner",evFoldName)
d15a28e7 95{
7acf6008 96 // ctor
88cb7938 97 AliRunLoader* rl = AliRunLoader::GetRunLoader(evFoldName);
98 if (rl == 0x0)
99 {
100 Fatal("AliPHOSReconstructioner","Can not get Run Loader from folder %s.",evFoldName);
101 }
102 if (rl->GetAliRun() == 0x0)
103 {
104 delete gAlice;
105 gAlice = 0x0;
106 rl->LoadgAlice();
107 gAlice = rl->GetAliRun();
108 }
109
110 AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(rl->GetLoader("PHOSLoader"));
111 if (gime == 0x0)
112 {
113 Error("AliPHOSReconstructioner","Can not get PHOS Loader");
114 return;
115 }
116
117 TString galicefn = rl->GetFileName();
118 TString method("AliPHOSReconstructioner::AliPHOSReconstructioner(");
119 method = (((method + evFoldName)+",")+branchName)+"): ";
7acf6008 120
108bc8df 121 fSDigitsBranch= branchName;
88cb7938 122
123 //P.Skowronski remark
124 // Tasks has default fixed names
125 // other tasks can be added, even runtime
126 // with arbitrary name. See AliDataLoader::
127 cout<<"\n\n\n";
128 cout<<method<<"\n\nCreating SDigitizer\n";
129 fSDigitizer = new AliPHOSSDigitizer(galicefn,GetTitle());
130 Add(fSDigitizer);
131 gime->PostSDigitizer(fSDigitizer);
132
133 fDigitsBranch=branchName ;
134 cout<<"\n\n\n";
135 cout<<method<<"\n\nCreating Digitizer\n";
136 fDigitizer = new AliPHOSDigitizer(galicefn,GetTitle()) ;
7acf6008 137 Add(fDigitizer) ;
88cb7938 138 gime->PostDigitizer(fDigitizer);
7acf6008 139
108bc8df 140 fRecPointBranch=branchName ;
88cb7938 141 cout<<"\n\n\n";
142 cout<<method<<"Creating Clusterizer\n";
143 fClusterizer = new AliPHOSClusterizerv1(galicefn,GetTitle());
144 Add(fClusterizer);
145 gime->PostReconstructioner(fClusterizer);
2131115b 146
108bc8df 147 fTSBranch=branchName ;
88cb7938 148 fTSMaker = new AliPHOSTrackSegmentMakerv1(galicefn,GetTitle());
7acf6008 149 Add(fTSMaker) ;
88cb7938 150 gime->PostTracker(fTSMaker);
151
7acf6008 152
108bc8df 153 fRecPartBranch=branchName ;
88cb7938 154 cout<<"\n\n\n";
155 cout<<method<<"Creating PID\n";
156 fPID = new AliPHOSPIDv1(galicefn,GetTitle());
157 Add(fPID);
158 cout<<"\nFINISHED \n\n"<<method;
7acf6008 159
160 fIsInitialized = kTRUE ;
7acf6008 161}
162//____________________________________________________________________________
e957fea8 163void AliPHOSReconstructioner::Exec(Option_t opt)
a4e98857 164{
90cceaf6 165 //check, if the names of branches, which should be made conicide with already
7acf6008 166 //existing
e957fea8 167 if (!opt)
168 return ;
7acf6008 169 if(!fIsInitialized)
170 Init() ;
7acf6008 171}
172//____________________________________________________________________________
173 void AliPHOSReconstructioner::Init()
174{
a4e98857 175 // initiliaze Reconstructioner if necessary: we can not do this in default constructor
7acf6008 176
177 if(!fIsInitialized){
178 // Initialisation
179
81b0fcd1 180 fSDigitsBranch="Default" ;
88cb7938 181 fSDigitizer = new AliPHOSSDigitizer(GetTitle(),fSDigitsBranch.Data()) ;
7acf6008 182 Add(fSDigitizer) ;
183
81b0fcd1 184 fDigitsBranch="Default" ;
88cb7938 185 fDigitizer = new AliPHOSDigitizer(GetTitle(),fDigitsBranch.Data());
7acf6008 186 Add(fDigitizer) ;
187
81b0fcd1 188 fRecPointBranch="Default" ;
88cb7938 189 fClusterizer = new AliPHOSClusterizerv1(GetTitle(),fRecPointBranch.Data());
7acf6008 190 Add(fClusterizer) ;
191
81b0fcd1 192 fTSBranch="Default" ;
88cb7938 193 fTSMaker = new AliPHOSTrackSegmentMakerv1(GetTitle(),fTSBranch.Data());
7acf6008 194 Add(fTSMaker) ;
195
196
88cb7938 197 fRecPartBranch="Default";
198 fPID = new AliPHOSPIDv1(GetTitle(),fRecPartBranch.Data()) ;
7acf6008 199 Add(fPID) ;
200
201 fIsInitialized = kTRUE ;
88cb7938 202
7acf6008 203 }
204}
205//____________________________________________________________________________
206AliPHOSReconstructioner::~AliPHOSReconstructioner()
207{
baef0810 208 // Delete data members if any
7acf6008 209}
baef0810 210
90cceaf6 211void AliPHOSReconstructioner::Print()const {
baef0810 212 // Print reconstructioner data
213
21cd0c07 214 TString message ;
215 message = "-----------------AliPHOSReconstructioner---------------\n" ;
216 message += " Reconstruction of the header file %s\n" ;
217 message += " with the following modules:\n" ;
7acf6008 218
219 if(fSDigitizer->IsActive()){
21cd0c07 220 message += " (+) %s to branch %s\n" ;
7acf6008 221 }
222 if(fDigitizer->IsActive()){
21cd0c07 223 message += " (+) %s to branch %s\n" ;
7acf6008 224 }
225
226 if(fClusterizer->IsActive()){
21cd0c07 227 message += " (+) %s to branch %s\n" ;
7acf6008 228 }
229
230 if(fTSMaker->IsActive()){
21cd0c07 231 message += " (+) %s to branch %s\n" ;
7acf6008 232 }
233
7acf6008 234 if(fPID->IsActive()){
21cd0c07 235 message += " (+) %s to branch %s\n" ;
7acf6008 236 }
21cd0c07 237 Info("Print", message.Data(),
88cb7938 238 GetTitle(),
21cd0c07 239 fSDigitizer->GetName(), fSDigitsBranch.Data(),
240 fDigitizer->GetName(), fDigitsBranch.Data() ,
241 fClusterizer->GetName(), fRecPointBranch.Data(),
242 fTSMaker->GetName(), fTSBranch.Data() ,
243 fPID->GetName(), fRecPartBranch.Data() ) ;
51926850 244}