1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
20 //*-- Author: Gines Martinez & Yves Schutz (SUBATECH)
21 //*-- Compleetely redesigned by Dmitri Peressounko (SUBATECH & RRC KI) March 2001
22 /////////////////////////////////////////////////////////////////////////////////////
23 // Wrapping class for reconstruction. Allows to produce reconstruction from
24 // different steps: from previously produced hits,sdigits, etc. Each new reconstruction
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
31 // TreeR::AliPHOSClusterizer with the same title as the branch containing the RecPoints. // TTree does not support overwriting, therefore one can not produce several
32 // branches with the same names and titles - use different titles.
36 // root [0] AliPHOSReconstructioner * r = new AliPHOSReconstructioner("galice.root")
37 // // Set the header file
38 // root [1] r->ExecuteTask()
39 // // Make full chain of reconstruction
41 // // One can specify the title for each branch
42 // root [2] r->SetBranchFileName("RecPoints","RecPoints1") ;
44 // // One can change parameters of reconstruction algorithms
45 // root [3] r->GetClusterizer()->SetEmcLocalMaxCut(0.02)
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
53 // // And finally one can call ExecuteTask() with the following options
54 // root [5] r->ExecuteTask("debug all timing")
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
58 ///////////////////////////////////////////////////////////////////////////////////////////////////
60 // --- ROOT system ---
62 // --- Standard library ---
63 #include "Riostream.h"
65 // --- AliRoot header files ---
66 #include "AliRunLoader.h"
68 #include "AliESDCaloTrack.h"
69 #include "AliPHOSReconstructioner.h"
70 #include "AliPHOSClusterizerv1.h"
71 #include "AliPHOSDigitizer.h"
72 #include "AliPHOSSDigitizer.h"
73 #include "AliPHOSTrackSegmentMakerv1.h"
74 #include "AliPHOSPIDv1.h"
75 #include "AliPHOSGetter.h"
77 #include "AliPHOSLoader.h"
79 ClassImp(AliPHOSReconstructioner)
81 //____________________________________________________________________________
82 AliPHOSReconstructioner::AliPHOSReconstructioner():TTask("AliPHOSReconstructioner","")
91 fIsInitialized = kFALSE ;
95 //____________________________________________________________________________
96 AliPHOSReconstructioner::AliPHOSReconstructioner(const char* evFoldName,const char * branchName):
97 TTask("AliPHOSReconstructioner",evFoldName)
100 AliRunLoader* rl = AliRunLoader::GetRunLoader(evFoldName);
103 Fatal("AliPHOSReconstructioner","Can not get Run Loader from folder %s.",evFoldName);
105 if (rl->GetAliRun() == 0x0)
110 gAlice = rl->GetAliRun();
113 AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(rl->GetLoader("PHOSLoader"));
116 Error("AliPHOSReconstructioner","Can not get PHOS Loader");
120 TString galicefn = rl->GetFileName();
121 TString method("AliPHOSReconstructioner::AliPHOSReconstructioner(");
122 method = (((method + evFoldName)+",")+branchName)+"): ";
124 fSDigitsBranch= branchName;
126 //P.Skowronski remark
127 // Tasks has default fixed names
128 // other tasks can be added, even runtime
129 // with arbitrary name. See AliDataLoader::
131 cout<<method<<"\n\nCreating SDigitizer\n";
132 fSDigitizer = new AliPHOSSDigitizer(galicefn,GetTitle());
134 gime->PostSDigitizer(fSDigitizer);
136 fDigitsBranch=branchName ;
138 cout<<method<<"\n\nCreating Digitizer\n";
139 fDigitizer = new AliPHOSDigitizer(galicefn,GetTitle()) ;
141 gime->PostDigitizer(fDigitizer);
143 fRecPointBranch=branchName ;
145 cout<<method<<"Creating Clusterizer\n";
146 fClusterizer = new AliPHOSClusterizerv1(galicefn,GetTitle());
148 gime->PostReconstructioner(fClusterizer);
150 fTSBranch=branchName ;
151 fTSMaker = new AliPHOSTrackSegmentMakerv1(galicefn,GetTitle());
153 gime->PostTracker(fTSMaker);
156 fRecPartBranch=branchName ;
158 cout<<method<<"Creating PID\n";
159 fPID = new AliPHOSPIDv1(galicefn,GetTitle());
161 cout<<"\nFINISHED \n\n"<<method;
163 fIsInitialized = kTRUE ;
165 //____________________________________________________________________________
166 void AliPHOSReconstructioner::Exec(Option_t *opt)
168 //check, if the names of branches, which should be made conicide with already
175 //____________________________________________________________________________
176 void AliPHOSReconstructioner:: Clusters2Tracks(Int_t ievent, AliESD *event)
178 // Convert PHOS reconstructed particles into ESD object for event# ievent.
179 // ESD object is returned as an argument event
181 if(!fIsInitialized) Init() ;
183 fClusterizer->SetEventRange(ievent,ievent);
184 fClusterizer->ExecuteTask();
186 fTSMaker ->SetEventRange(ievent,ievent);
187 fTSMaker ->ExecuteTask();
189 fPID ->SetEventRange(ievent,ievent);
190 fPID ->ExecuteTask();
192 AliPHOSGetter *gime = AliPHOSGetter::Instance();
193 TClonesArray *recParticles = gime->RecParticles();
194 Int_t nOfRecParticles = recParticles->GetEntries();
195 for (Int_t recpart=0; recpart<nOfRecParticles; recpart++) {
196 AliESDCaloTrack *ct = new AliESDCaloTrack((AliPHOSRecParticle*)recParticles->At(recpart));
197 event->AddCaloTrack(ct);
201 //____________________________________________________________________________
202 void AliPHOSReconstructioner::Init()
204 // initiliaze Reconstructioner if necessary: we can not do this in default constructor
209 fSDigitsBranch="Default" ;
210 fSDigitizer = new AliPHOSSDigitizer(GetTitle(),fSDigitsBranch.Data()) ;
213 fDigitsBranch="Default" ;
214 fDigitizer = new AliPHOSDigitizer(GetTitle(),fDigitsBranch.Data());
217 fRecPointBranch="Default" ;
218 fClusterizer = new AliPHOSClusterizerv1(GetTitle(),fRecPointBranch.Data());
221 fTSBranch="Default" ;
222 fTSMaker = new AliPHOSTrackSegmentMakerv1(GetTitle(),fTSBranch.Data());
226 fRecPartBranch="Default";
227 fPID = new AliPHOSPIDv1(GetTitle(),fRecPartBranch.Data()) ;
230 fIsInitialized = kTRUE ;
234 //____________________________________________________________________________
235 AliPHOSReconstructioner::~AliPHOSReconstructioner()
237 // Delete data members if any
240 void AliPHOSReconstructioner::Print()const {
241 // Print reconstructioner data
244 message = "-----------------AliPHOSReconstructioner---------------\n" ;
245 message += " Reconstruction of the header file %s\n" ;
246 message += " with the following modules:\n" ;
248 if(fSDigitizer->IsActive()){
249 message += " (+) %s to branch %s\n" ;
251 if(fDigitizer->IsActive()){
252 message += " (+) %s to branch %s\n" ;
255 if(fClusterizer->IsActive()){
256 message += " (+) %s to branch %s\n" ;
259 if(fTSMaker->IsActive()){
260 message += " (+) %s to branch %s\n" ;
263 if(fPID->IsActive()){
264 message += " (+) %s to branch %s\n" ;
266 Info("Print", message.Data(),
268 fSDigitizer->GetName(), fSDigitsBranch.Data(),
269 fDigitizer->GetName(), fDigitsBranch.Data() ,
270 fClusterizer->GetName(), fRecPointBranch.Data(),
271 fTSMaker->GetName(), fTSBranch.Data() ,
272 fPID->GetName(), fRecPartBranch.Data() ) ;