]>
Commit | Line | Data |
---|---|---|
6ddf6724 | 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 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //_________________________________________________________________________ | |
19 | //*-- | |
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 | |
d018ba66 | 25 | // flow (e.g. digits, made from them RecPoints, |
6ddf6724 | 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 | |
d018ba66 | 31 | // TreeR::AliEMCALClusterizer with the same title as the branch containing the RecPoints. // TTree does not support overwriting, therefore one can not produce several |
6ddf6724 | 32 | // branches with the same names and titles - use different titles. |
33 | // | |
34 | // Use case: | |
35 | // | |
36 | // root [0] AliEMCALReconstructioner * r = new AliEMCALReconstructioner("galice.root") | |
37 | // // Set the header file | |
38 | // root [1] r->ExecuteTask() | |
39 | // // Make full chain of reconstruction | |
40 | // | |
41 | // // One can specify the title for each branch | |
42 | // root [2] r->SetBranchFileName("RecPoints","RecPoints1") ; | |
43 | // | |
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("AliEMCALClusterizer","Local max cut 0.02") | |
50 | // // means that will use already generated Digits and produce only RecPoints, | |
d018ba66 | 51 | // // and RecParticles |
6ddf6724 | 52 | // |
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 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
59 | ||
60 | // --- ROOT system --- | |
61 | ||
6ddf6724 | 62 | // --- Standard library --- |
d018ba66 | 63 | #include "Riostream.h" |
6ddf6724 | 64 | |
65 | // --- AliRoot header files --- | |
d018ba66 | 66 | #include "AliRunLoader.h" |
67 | #include "AliESD.h" | |
68 | #include "AliESDCaloTrack.h" | |
6ddf6724 | 69 | #include "AliEMCALReconstructioner.h" |
70 | #include "AliEMCALClusterizerv1.h" | |
71 | #include "AliEMCALDigitizer.h" | |
72 | #include "AliEMCALSDigitizer.h" | |
d018ba66 | 73 | #include "AliEMCALPIDv1.h" |
74 | #include "AliEMCALGetter.h" | |
75 | ||
76 | #include "AliEMCALLoader.h" | |
6ddf6724 | 77 | |
78 | ClassImp(AliEMCALReconstructioner) | |
79 | ||
80 | //____________________________________________________________________________ | |
81 | AliEMCALReconstructioner::AliEMCALReconstructioner():TTask("AliEMCALReconstructioner","") | |
82 | { | |
83 | // ctor | |
6ddf6724 | 84 | fDigitizer = 0 ; |
85 | fClusterizer = 0 ; | |
d018ba66 | 86 | fPID = 0 ; |
6ddf6724 | 87 | fSDigitizer = 0 ; |
6ddf6724 | 88 | |
89 | fIsInitialized = kFALSE ; | |
90 | ||
91 | } | |
92 | ||
93 | //____________________________________________________________________________ | |
d018ba66 | 94 | AliEMCALReconstructioner::AliEMCALReconstructioner(const char* evFoldName,const char * branchName): |
95 | TTask("AliEMCALReconstructioner",evFoldName) | |
6ddf6724 | 96 | { |
97 | // ctor | |
d018ba66 | 98 | AliRunLoader* rl = AliRunLoader::GetRunLoader(evFoldName); |
99 | if (rl == 0x0) | |
100 | { | |
101 | Fatal("AliEMCALReconstructioner","Can not get Run Loader from folder %s.",evFoldName); | |
102 | } | |
103 | if (rl->GetAliRun() == 0x0) | |
104 | { | |
105 | delete gAlice; | |
106 | gAlice = 0x0; | |
107 | rl->LoadgAlice(); | |
108 | gAlice = rl->GetAliRun(); | |
109 | } | |
110 | ||
111 | AliEMCALLoader* gime = dynamic_cast<AliEMCALLoader*>(rl->GetLoader("EMCALLoader")); | |
112 | if (gime == 0x0) | |
113 | { | |
114 | Error("AliEMCALReconstructioner","Can not get EMCAL Loader"); | |
115 | return; | |
116 | } | |
117 | ||
118 | TString galicefn = rl->GetFileName(); | |
119 | TString method("AliEMCALReconstructioner::AliEMCALReconstructioner("); | |
120 | method = (((method + evFoldName)+",")+branchName)+"): "; | |
6ddf6724 | 121 | |
6ddf6724 | 122 | fSDigitsBranch= branchName; |
d018ba66 | 123 | |
124 | //P.Skowronski remark | |
125 | // Tasks has default fixed names | |
126 | // other tasks can be added, even runtime | |
127 | // with arbitrary name. See AliDataLoader:: | |
128 | cout<<"\n\n\n"; | |
129 | cout<<method<<"\n\nCreating SDigitizer\n"; | |
130 | fSDigitizer = new AliEMCALSDigitizer(galicefn,GetTitle()); | |
131 | Add(fSDigitizer); | |
132 | gime->PostSDigitizer(fSDigitizer); | |
133 | ||
134 | fDigitsBranch=branchName ; | |
135 | cout<<"\n\n\n"; | |
136 | cout<<method<<"\n\nCreating Digitizer\n"; | |
137 | fDigitizer = new AliEMCALDigitizer(galicefn,GetTitle()) ; | |
6ddf6724 | 138 | Add(fDigitizer) ; |
d018ba66 | 139 | gime->PostDigitizer(fDigitizer); |
6ddf6724 | 140 | |
141 | fRecPointBranch=branchName ; | |
d018ba66 | 142 | cout<<"\n\n\n"; |
143 | cout<<method<<"Creating Clusterizer\n"; | |
144 | fClusterizer = new AliEMCALClusterizerv1(galicefn,GetTitle()); | |
145 | Add(fClusterizer); | |
146 | gime->PostReconstructioner(fClusterizer); | |
6ddf6724 | 147 | |
d018ba66 | 148 | fRecPartBranch=branchName ; |
149 | cout<<"\n\n\n"; | |
150 | cout<<method<<"Creating PID\n"; | |
151 | fPID = new AliEMCALPIDv1(galicefn,GetTitle()); | |
152 | Add(fPID); | |
153 | cout<<"\nFINISHED \n\n"<<method; | |
6ddf6724 | 154 | |
155 | fIsInitialized = kTRUE ; | |
6ddf6724 | 156 | } |
157 | //____________________________________________________________________________ | |
d018ba66 | 158 | void AliEMCALReconstructioner::Exec(Option_t *opt) |
6ddf6724 | 159 | { |
d018ba66 | 160 | //check, if the names of branches, which should be made conicide with already |
6ddf6724 | 161 | //existing |
d018ba66 | 162 | if (!opt) |
163 | return ; | |
6ddf6724 | 164 | if(!fIsInitialized) |
165 | Init() ; | |
166 | } | |
d018ba66 | 167 | //____________________________________________________________________________ |
168 | void AliEMCALReconstructioner:: Clusters2Tracks(Int_t ievent, AliESD *event) | |
169 | { | |
170 | // Convert EMCAL reconstructed particles into ESD object for event# ievent. | |
171 | // ESD object is returned as an argument event | |
172 | ||
173 | if(!fIsInitialized) Init() ; | |
6ddf6724 | 174 | |
d018ba66 | 175 | fClusterizer->SetEventRange(ievent,ievent); |
176 | fClusterizer->ExecuteTask(); | |
177 | ||
178 | fPID ->SetEventRange(ievent,ievent); | |
179 | fPID ->ExecuteTask(); | |
180 | ||
181 | AliEMCALGetter *gime = AliEMCALGetter::Instance(); | |
182 | TClonesArray *recParticles = gime->RecParticles(); | |
183 | Int_t nOfRecParticles = recParticles->GetEntries(); | |
184 | for (Int_t recpart=0; recpart<nOfRecParticles; recpart++) { | |
185 | AliESDCaloTrack *ct = new AliESDCaloTrack((AliEMCALRecParticle*)recParticles->At(recpart)); | |
186 | event->AddCaloTrack(ct); | |
187 | } | |
188 | ||
189 | } | |
6ddf6724 | 190 | //____________________________________________________________________________ |
191 | void AliEMCALReconstructioner::Init() | |
192 | { | |
193 | // initiliaze Reconstructioner if necessary: we can not do this in default constructor | |
194 | ||
195 | if(!fIsInitialized){ | |
196 | // Initialisation | |
197 | ||
198 | fSDigitsBranch="Default" ; | |
d018ba66 | 199 | fSDigitizer = new AliEMCALSDigitizer(GetTitle(),fSDigitsBranch.Data()) ; |
6ddf6724 | 200 | Add(fSDigitizer) ; |
201 | ||
202 | fDigitsBranch="Default" ; | |
d018ba66 | 203 | fDigitizer = new AliEMCALDigitizer(GetTitle(),fDigitsBranch.Data()); |
6ddf6724 | 204 | Add(fDigitizer) ; |
205 | ||
206 | fRecPointBranch="Default" ; | |
d018ba66 | 207 | fClusterizer = new AliEMCALClusterizerv1(GetTitle(),fRecPointBranch.Data()); |
6ddf6724 | 208 | Add(fClusterizer) ; |
209 | ||
d018ba66 | 210 | fRecPartBranch="Default"; |
211 | fPID = new AliEMCALPIDv1(GetTitle(),fRecPartBranch.Data()) ; | |
212 | Add(fPID) ; | |
6ddf6724 | 213 | |
214 | fIsInitialized = kTRUE ; | |
d018ba66 | 215 | |
6ddf6724 | 216 | } |
217 | } | |
218 | //____________________________________________________________________________ | |
219 | AliEMCALReconstructioner::~AliEMCALReconstructioner() | |
220 | { | |
221 | // Delete data members if any | |
6ddf6724 | 222 | } |
223 | ||
d018ba66 | 224 | void AliEMCALReconstructioner::Print()const { |
6ddf6724 | 225 | // Print reconstructioner data |
226 | ||
d018ba66 | 227 | TString message ; |
228 | message = "-----------------AliEMCALReconstructioner---------------\n" ; | |
229 | message += " Reconstruction of the header file %s\n" ; | |
230 | message += " with the following modules:\n" ; | |
6ddf6724 | 231 | |
232 | if(fSDigitizer->IsActive()){ | |
d018ba66 | 233 | message += " (+) %s to branch %s\n" ; |
6ddf6724 | 234 | } |
235 | if(fDigitizer->IsActive()){ | |
d018ba66 | 236 | message += " (+) %s to branch %s\n" ; |
6ddf6724 | 237 | } |
238 | ||
239 | if(fClusterizer->IsActive()){ | |
d018ba66 | 240 | message += " (+) %s to branch %s\n" ; |
241 | } | |
242 | ||
243 | if(fPID->IsActive()){ | |
244 | message += " (+) %s to branch %s\n" ; | |
245 | } | |
246 | Info("Print", message.Data(), | |
247 | GetTitle(), | |
248 | fSDigitizer->GetName(), fSDigitsBranch.Data(), | |
249 | fDigitizer->GetName(), fDigitsBranch.Data() , | |
250 | fClusterizer->GetName(), fRecPointBranch.Data(), | |
251 | fPID->GetName(), fRecPartBranch.Data() ) ; | |
6ddf6724 | 252 | } |