]>
Commit | Line | Data |
---|---|---|
ffa6d63b | 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 | /* $Log: | |
d75bea67 | 19 | 29.05.2001 Yuri Kharlov: |
20 | Everywhere reading the treese TTree->GetEvent(i) | |
21 | is replaced by reading the branches TBranch->GetEntry(0) | |
ffa6d63b | 22 | */ |
23 | ||
24 | //_________________________________________________________________________ | |
25 | // A singleton. This class should be used in the analysis stage to get | |
26 | // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles, | |
27 | // instead of directly reading them from galice.root file. This container | |
28 | // ensures, that one reads Digits, made of these particular digits, RecPoints, | |
29 | // made of these particular RecPoints, TrackSegments and RecParticles. | |
30 | // This becomes non trivial if there are several identical branches, produced with | |
d75bea67 | 31 | // different set of parameters. |
ffa6d63b | 32 | // |
33 | // An example of how to use (see also class AliEMCALAnalyser): | |
34 | // AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ; | |
d75bea67 | 35 | // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++) |
36 | // AliEMCALRecParticle * part = gime->RecParticle(1) ; | |
ffa6d63b | 37 | // ................ |
38 | // please->GetEvent(event) ; // reads new event from galice.root | |
39 | // | |
d75bea67 | 40 | //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) |
41 | //*-- Completely redesigned by Dmitri Peressounko March 2001 | |
42 | // | |
43 | //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make | |
44 | //*-- systematic usage of TFolders without changing the interface | |
ffa6d63b | 45 | ////////////////////////////////////////////////////////////////////////////// |
46 | ||
47 | ||
48 | // --- ROOT system --- | |
49 | ||
50 | #include "TFile.h" | |
51 | #include "TTree.h" | |
52 | #include "TROOT.h" | |
53 | #include "TObjString.h" | |
54 | #include "TFolder.h" | |
55 | ||
56 | // --- Standard library --- | |
57 | #include <iostream.h> | |
58 | ||
59 | // --- AliRoot header files --- | |
60 | ||
61 | #include "AliRun.h" | |
62 | #include "AliConfig.h" | |
63 | #include "AliEMCALGetter.h" | |
472319e5 | 64 | #include "AliEMCALHit.h" |
ffa6d63b | 65 | #include "AliEMCALv1.h" |
66 | #include "AliEMCALDigitizer.h" | |
67 | #include "AliEMCALSDigitizer.h" | |
f07cab21 | 68 | #include "AliEMCALClusterizer.h" |
69 | #include "AliEMCALClusterizerv1.h" | |
d75bea67 | 70 | //#include "AliEMCALTrackSegmentMaker.h" |
71 | //#include "AliEMCALTrackSegmentMakerv1.h" | |
72 | //#include "AliEMCALTrackSegment.h" | |
73 | //#include "AliEMCALPID.h" | |
74 | //#include "AliEMCALPIDv1.h" | |
ffa6d63b | 75 | #include "AliEMCALGeometry.h" |
76 | ||
77 | ClassImp(AliEMCALGetter) | |
78 | ||
79 | AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ; | |
52ea052c | 80 | TFile * AliEMCALGetter::fFile = 0 ; |
ffa6d63b | 81 | |
82 | //____________________________________________________________________________ | |
472319e5 | 83 | AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Option_t * rw) |
ffa6d63b | 84 | { |
85 | //Initialize all lists | |
86 | ||
54b82aa4 | 87 | fDebug = 0 ; |
88 | ||
ffa6d63b | 89 | fHeaderFile = headerFile ; |
90 | fBranchTitle = branchTitle ; | |
91 | fSDigitsTitle = branchTitle ; | |
92 | fDigitsTitle = branchTitle ; | |
f07cab21 | 93 | fRecPointsTitle = branchTitle ; |
d75bea67 | 94 | //fRecParticlesTitle = branchTitle ; |
95 | //fTrackSegmentsTitle = branchTitle ; | |
ffa6d63b | 96 | |
97 | fPrimaries = new TObjArray(1) ; | |
d75bea67 | 98 | |
99 | fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules")); | |
ffa6d63b | 100 | fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits")); |
101 | fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits")); | |
102 | fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data")); | |
f07cab21 | 103 | fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData")); |
d75bea67 | 104 | //fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA")); |
ffa6d63b | 105 | fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ; |
106 | ||
28b243ad | 107 | fFailed = kFALSE ; |
57125971 | 108 | |
ffa6d63b | 109 | if ( fHeaderFile != "aliroot" ) { // to call the getter without a file |
110 | ||
111 | //open headers file | |
4dcdb968 | 112 | fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ; |
ed215ae7 | 113 | if(!fFile){ //if file was not opened yet, read gAlice |
4505bd46 | 114 | if ( fHeaderFile.Contains("_") ) { |
115 | cerr << "AliPHOSGetter::AliPHOSGetter -> Invalid file name (_ not allowed) " << fHeaderFile.Data() << endl ; | |
116 | abort() ; | |
117 | } | |
ba298680 | 118 | fFile = TFile::Open(fHeaderFile.Data(),rw) ; |
ffa6d63b | 119 | |
4dcdb968 | 120 | if (!fFile->IsOpen()) { |
ffa6d63b | 121 | cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ; |
28b243ad | 122 | fFailed = kTRUE ; |
123 | return ; | |
ffa6d63b | 124 | } |
12eac0c2 | 125 | gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ; |
ffa6d63b | 126 | } |
d75bea67 | 127 | } |
6c58180f | 128 | |
ffa6d63b | 129 | |
d75bea67 | 130 | if (!gAlice) { |
131 | cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ; | |
28b243ad | 132 | fFailed = kTRUE ; |
133 | return ; | |
d75bea67 | 134 | } |
135 | if (!EMCAL()) { | |
136 | if (fDebug) | |
137 | cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ; | |
ba298680 | 138 | if (gAlice->GetDetector("EMCAL")) { |
139 | AliConfig * conf = AliConfig::Instance() ; | |
140 | conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ; | |
141 | conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ; | |
142 | } | |
143 | else | |
144 | cerr << "ERROR: AliEMCALGetter -> detector EMCAL not found" << endl ; | |
ffa6d63b | 145 | } |
d75bea67 | 146 | |
147 | fDebug=0; | |
ffa6d63b | 148 | } |
149 | //____________________________________________________________________________ | |
ba298680 | 150 | AliEMCALGetter::~AliEMCALGetter() |
151 | { | |
ededcd8c | 152 | if (fPrimaries) { |
153 | fPrimaries->Delete() ; | |
154 | delete fPrimaries ; | |
155 | } | |
d489fb96 | 156 | |
157 | TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ; | |
158 | TCollection * folderslist = emcalF->GetListOfFolders() ; | |
159 | TIter next(folderslist) ; | |
160 | TFolder * folder = 0 ; | |
161 | while ( (folder = static_cast<TFolder*>(next())) ) | |
162 | emcalF->Remove(folder) ; | |
163 | ||
4dcdb968 | 164 | delete fFile ; |
ba298680 | 165 | fFile = 0 ; |
65549808 | 166 | |
167 | fgObjGetter = 0 ; | |
168 | ||
ffa6d63b | 169 | } |
170 | ||
171 | //____________________________________________________________________________ | |
172 | void AliEMCALGetter::CreateWhiteBoard() const | |
173 | { | |
174 | ||
175 | } | |
176 | ||
65549808 | 177 | //____________________________________________________________________________ |
178 | void AliEMCALGetter::CloseFile() | |
179 | { | |
b134c32f | 180 | delete gAlice ; |
181 | gAlice = 0 ; | |
65549808 | 182 | } |
183 | ||
ffa6d63b | 184 | //____________________________________________________________________________ |
0c87da39 | 185 | const TFolder * AliEMCALGetter::Folder(const TString what) const { |
186 | ||
187 | // returns the EMCAL folder required by what | |
188 | // what = hits, sdigits, digits | |
189 | ||
190 | if ( what == "hits" ) | |
191 | return dynamic_cast<const TFolder *>(fHitsFolder->FindObject("EMCAL")) ; | |
192 | else if ( what == "sdigits" ) | |
193 | return dynamic_cast<const TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ; | |
194 | else if ( what == "digits" ) | |
195 | return dynamic_cast<const TFolder *>(fDigitsFolder->FindObject("EMCAL")) ; | |
196 | else { | |
197 | cerr << "ERROR: AliEMCALGetter::GetFolder -> " << what.Data() << " illegal option (hits, sdigits, digits) " << endl ; | |
198 | return 0 ; | |
199 | } | |
200 | } | |
201 | //____________________________________________________________________________ | |
ffa6d63b | 202 | AliEMCALGetter * AliEMCALGetter::GetInstance() |
203 | { | |
204 | // Returns the pointer of the unique instance already defined | |
205 | ||
b134c32f | 206 | if ( fgObjGetter ) { |
207 | fFile->cd() ; | |
208 | return fgObjGetter ; | |
209 | } | |
210 | else { | |
211 | // cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ; | |
212 | return 0 ; | |
213 | } | |
ffa6d63b | 214 | } |
215 | ||
216 | //____________________________________________________________________________ | |
217 | AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile, | |
472319e5 | 218 | const char* branchTitle, const Option_t * rw) |
ffa6d63b | 219 | { |
220 | // Creates and returns the pointer of the unique instance | |
221 | // Must be called only when the environment has changed | |
222 | ||
65549808 | 223 | if ( fgObjGetter && fFile->IsOpen()) // an instance exists and the file is still open |
ffa6d63b | 224 | if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) && |
52ea052c | 225 | (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0)) { |
52ea052c | 226 | fFile->cd() ; |
6c58180f | 227 | return fgObjGetter ; |
52ea052c | 228 | } |
65549808 | 229 | else // another file than the existing one is required, scratch the getter |
ededcd8c | 230 | fgObjGetter->~AliEMCALGetter() ; // delete it already exists another version |
6c58180f | 231 | |
472319e5 | 232 | fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ; |
d489fb96 | 233 | |
234 | if (fgObjGetter->HasFailed() ) | |
235 | fgObjGetter = 0 ; | |
ffa6d63b | 236 | |
1ed27eeb | 237 | fFile->cd() ; |
ffa6d63b | 238 | return fgObjGetter ; |
239 | ||
240 | } | |
241 | ||
242 | //____________________________________________________________________________ | |
d75bea67 | 243 | const AliEMCALv1 * AliEMCALGetter::EMCAL() |
ffa6d63b | 244 | { |
245 | // returns the EMCAL object | |
d75bea67 | 246 | AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ; |
ffa6d63b | 247 | if (!emcal) |
d75bea67 | 248 | if (fDebug) |
ffa6d63b | 249 | cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ; |
250 | return emcal ; | |
251 | } | |
252 | ||
253 | //____________________________________________________________________________ | |
f07cab21 | 254 | AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() |
ffa6d63b | 255 | { |
256 | AliEMCALGeometry * rv = 0 ; | |
257 | if (EMCAL() ) | |
d75bea67 | 258 | rv = EMCAL()->GetGeometry() ; |
ffa6d63b | 259 | return rv ; |
260 | } | |
261 | ||
262 | //____________________________________________________________________________ | |
263 | Bool_t AliEMCALGetter::PostHits(void) const | |
264 | { //------- Hits ---------------------- | |
265 | ||
266 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits | |
267 | ||
268 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ; | |
269 | if ( !emcalFolder ) { | |
d75bea67 | 270 | if (fDebug) { |
ffa6d63b | 271 | cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl; |
272 | cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl; | |
d75bea67 | 273 | } |
ffa6d63b | 274 | emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ; |
275 | } | |
276 | TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ; | |
277 | hits->SetName("Hits") ; | |
278 | emcalFolder->Add(hits) ; | |
279 | ||
280 | return kTRUE; | |
281 | } | |
282 | ||
283 | //____________________________________________________________________________ | |
472319e5 | 284 | TObject ** AliEMCALGetter::HitsRef(void) const |
ffa6d63b | 285 | { //------- Hits ---------------------- |
286 | ||
287 | ||
288 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits | |
289 | if ( !fHitsFolder ) { | |
290 | cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl; | |
291 | return 0; | |
292 | } | |
293 | ||
294 | TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ; | |
295 | if ( !emcalFolder ) { | |
296 | cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl; | |
297 | return 0; | |
298 | } | |
299 | ||
300 | TObject * h = emcalFolder->FindObject("Hits") ; | |
301 | if(!h) { | |
302 | cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ; | |
303 | return 0 ; | |
304 | } | |
305 | else | |
472319e5 | 306 | return emcalFolder->GetListOfFolders()->GetObjectRef(h) ; |
ffa6d63b | 307 | } |
308 | ||
309 | //____________________________________________________________________________ | |
310 | Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const | |
311 | { //---------- SDigits ------------------------- | |
312 | ||
313 | ||
314 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname | |
315 | // because you can have sdigits from several hit files for mixing | |
316 | ||
317 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; | |
318 | if ( !emcalFolder ) { | |
d75bea67 | 319 | if (fDebug) { |
ffa6d63b | 320 | cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl; |
321 | cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl; | |
d75bea67 | 322 | } |
ffa6d63b | 323 | emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; |
324 | } | |
325 | TString subdir(headerFile) ; | |
35014875 | 326 | subdir.ReplaceAll("/", "_") ; |
ffa6d63b | 327 | TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ; |
328 | if ( !emcalSubFolder ) | |
329 | emcalSubFolder = emcalFolder->AddFolder(subdir, ""); | |
330 | ||
331 | TObject * sd = emcalSubFolder->FindObject(name); | |
332 | if ( sd ) { | |
d75bea67 | 333 | if (fDebug) |
ffa6d63b | 334 | cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir |
335 | << " already exists!" << endl ; | |
336 | }else{ | |
d75bea67 | 337 | TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ; |
ffa6d63b | 338 | sdigits->SetName(name) ; |
339 | emcalSubFolder->Add(sdigits) ; | |
340 | } | |
341 | ||
342 | return kTRUE; | |
343 | } | |
344 | //____________________________________________________________________________ | |
472319e5 | 345 | TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const |
ffa6d63b | 346 | { //------- SDigits ---------------------- |
347 | ||
348 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits | |
349 | ||
350 | if ( !fSDigitsFolder ) { | |
351 | cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl; | |
352 | return 0; | |
353 | } | |
354 | ||
355 | TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ; | |
356 | if ( !emcalFolder ) { | |
357 | cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl; | |
358 | return 0; | |
359 | } | |
360 | ||
361 | TFolder * emcalSubFolder = 0 ; | |
362 | if(file) | |
363 | emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ; | |
364 | else | |
365 | emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ; | |
366 | ||
367 | if(!emcalSubFolder) { | |
368 | cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl; | |
369 | return 0; | |
370 | } | |
371 | ||
372 | TObject * dis = emcalSubFolder->FindObject(name) ; | |
373 | if(!dis) | |
374 | return 0 ; | |
375 | else | |
472319e5 | 376 | return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ; |
ffa6d63b | 377 | |
378 | } | |
379 | ||
380 | //____________________________________________________________________________ | |
381 | Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const | |
382 | { //---------- SDigitizer ------------------------- | |
383 | ||
384 | // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname | |
385 | ||
386 | ||
387 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; | |
388 | ||
389 | if ( !sd ) { | |
390 | cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; | |
391 | return kFALSE ; | |
392 | } | |
393 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; | |
394 | if ( !emcal ) { | |
d75bea67 | 395 | if (fDebug) { |
ffa6d63b | 396 | cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl; |
397 | cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl; | |
d75bea67 | 398 | } |
ffa6d63b | 399 | emcal = new TTask("EMCAL", "") ; |
400 | sd->Add(emcal) ; | |
401 | } | |
402 | AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() )); | |
403 | if (emcalsd) { | |
d75bea67 | 404 | if (fDebug) |
ffa6d63b | 405 | cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ; |
406 | emcal->GetListOfTasks()->Remove(emcalsd) ; | |
407 | } | |
408 | emcal->Add(sdigitizer) ; | |
409 | return kTRUE; | |
410 | ||
411 | } | |
412 | ||
413 | //____________________________________________________________________________ | |
472319e5 | 414 | TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const |
ffa6d63b | 415 | { |
416 | ||
417 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; | |
418 | if ( !sd ) { | |
419 | cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; | |
420 | abort(); | |
421 | } | |
422 | ||
423 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; | |
424 | if ( !emcal ) { | |
425 | cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl; | |
426 | abort(); | |
427 | } | |
428 | ||
429 | TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ; | |
430 | ||
472319e5 | 431 | return emcal->GetListOfTasks()->GetObjectRef(task) ; |
ffa6d63b | 432 | |
433 | } | |
434 | ||
435 | //____________________________________________________________________________ | |
436 | Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const | |
437 | { //---------- SDigitizer ------------------------- | |
438 | ||
439 | // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname | |
440 | ||
441 | ||
442 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; | |
443 | if ( !sd ) { | |
444 | cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; | |
445 | return kFALSE ; | |
446 | } | |
447 | ||
448 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; | |
449 | if ( !emcal ) { | |
d75bea67 | 450 | if (fDebug) { |
ffa6d63b | 451 | cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl; |
452 | cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl; | |
d75bea67 | 453 | } |
ffa6d63b | 454 | emcal = new TTask("EMCAL", "") ; |
455 | sd->Add(emcal) ; | |
456 | } | |
457 | ||
458 | TString sdname(name) ; | |
459 | sdname.Append(":") ; | |
460 | sdname.Append(file); | |
54b82aa4 | 461 | sdname.ReplaceAll("/","_") ; |
ffa6d63b | 462 | AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname )); |
463 | if (!emcalsd) { | |
464 | emcalsd = new AliEMCALSDigitizer() ; | |
6c58180f | 465 | //Note, we can not call constructor with parameters: it will call Getter and screw up everething |
ffa6d63b | 466 | emcalsd->SetName(sdname) ; |
467 | emcalsd->SetTitle(file) ; | |
468 | emcal->Add(emcalsd) ; | |
469 | } | |
470 | return kTRUE; | |
471 | ||
472 | } | |
473 | ||
474 | //____________________________________________________________________________ | |
475 | Bool_t AliEMCALGetter::PostDigits(const char * name) const | |
476 | { //---------- Digits ------------------------- | |
477 | ||
478 | // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name | |
479 | ||
480 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ; | |
481 | ||
482 | if ( !emcalFolder ) { | |
d75bea67 | 483 | if (fDebug) { |
ffa6d63b | 484 | cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl; |
485 | cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl; | |
d75bea67 | 486 | } |
ffa6d63b | 487 | emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ; |
488 | } | |
489 | ||
490 | TObject* dig = emcalFolder->FindObject( name ) ; | |
491 | if ( !dig ) { | |
492 | TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ; | |
493 | digits->SetName(name) ; | |
494 | emcalFolder->Add(digits) ; | |
495 | } | |
496 | return kTRUE; | |
497 | } | |
498 | ||
499 | //____________________________________________________________________________ | |
472319e5 | 500 | TObject ** AliEMCALGetter::DigitsRef(const char * name) const |
ffa6d63b | 501 | { //------- Digits ---------------------- |
502 | ||
503 | // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name | |
504 | ||
505 | if ( !fDigitsFolder ) { | |
506 | cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl; | |
507 | return 0; | |
508 | } | |
509 | ||
510 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ; | |
511 | if ( !emcalFolder ) { | |
512 | cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl; | |
513 | return 0; | |
514 | } | |
515 | ||
516 | TObject * d = emcalFolder->FindObject(name) ; | |
517 | if(!d) | |
518 | return 0 ; | |
519 | else | |
472319e5 | 520 | return emcalFolder->GetListOfFolders()->GetObjectRef(d) ; |
ffa6d63b | 521 | |
522 | } | |
523 | ||
524 | //____________________________________________________________________________ | |
525 | Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const | |
526 | { //---------- Digitizer ------------------------- | |
527 | ||
528 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; | |
529 | ||
530 | if ( !sd ) { | |
531 | cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl; | |
532 | return kFALSE ; | |
533 | } | |
534 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; | |
535 | if ( !emcal ) { | |
d75bea67 | 536 | if (fDebug) { |
ffa6d63b | 537 | cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl; |
538 | cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl; | |
d75bea67 | 539 | } |
ffa6d63b | 540 | emcal = new TTask("EMCAL", "") ; |
541 | sd->Add(emcal) ; | |
542 | } | |
543 | ||
544 | AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ; | |
545 | if (emcald) { | |
546 | emcald->Delete() ; | |
547 | emcal->GetListOfTasks()->Remove(emcald) ; | |
548 | } | |
549 | emcal->Add(digitizer) ; | |
550 | return kTRUE; | |
551 | } | |
552 | ||
553 | //____________________________________________________________________________ | |
554 | Bool_t AliEMCALGetter::PostDigitizer(const char * name) const | |
555 | { //---------- Digitizer ------------------------- | |
556 | ||
557 | // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname | |
558 | ||
559 | TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; | |
560 | if ( !d ) { | |
561 | cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl; | |
562 | return kFALSE ; | |
563 | } | |
564 | ||
565 | TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ; | |
566 | if ( !emcal ) { | |
d75bea67 | 567 | if (fDebug) { |
ffa6d63b | 568 | cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl; |
569 | cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl; | |
d75bea67 | 570 | } |
ffa6d63b | 571 | emcal = new TTask("EMCAL", "") ; |
572 | d->Add(emcal) ; | |
573 | } | |
574 | ||
575 | AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ; | |
576 | if (!emcald) { | |
577 | emcald = new AliEMCALDigitizer() ; | |
578 | emcald->SetName(fDigitsTitle) ; | |
579 | emcald->SetTitle(fHeaderFile) ; | |
580 | emcal->Add(emcald) ; | |
581 | } | |
582 | return kTRUE; | |
583 | } | |
584 | ||
585 | //____________________________________________________________________________ | |
472319e5 | 586 | TObject ** AliEMCALGetter::DigitizerRef(const char * name) const |
ffa6d63b | 587 | { |
588 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; | |
589 | if ( !sd ) { | |
92f521a9 | 590 | cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder->GetName() << "/Digitizer not found!" << endl; |
ffa6d63b | 591 | abort(); |
592 | } | |
593 | ||
594 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; | |
595 | if ( !emcal ) { | |
92f521a9 | 596 | cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder->GetName() << "/Digitizer/EMCAL" << endl; |
ffa6d63b | 597 | abort(); |
598 | } | |
599 | ||
600 | TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ; | |
601 | ||
472319e5 | 602 | return emcal->GetListOfTasks()->GetObjectRef(task) ; |
ffa6d63b | 603 | |
604 | } | |
605 | ||
d75bea67 | 606 | //____________________________________________________________________________ |
d75bea67 | 607 | Bool_t AliEMCALGetter::PostRecPoints(const char * name) const |
608 | { // -------------- RecPoints ------------------------------------------- | |
609 | ||
f07cab21 | 610 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name |
611 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name | |
d75bea67 | 612 | |
613 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ; | |
614 | ||
615 | if ( !emcalFolder ) { | |
616 | if (fDebug) { | |
617 | cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; | |
618 | cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl; | |
619 | } | |
620 | emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; | |
621 | } | |
622 | ||
f07cab21 | 623 | // Tower RecPoints |
624 | TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ; | |
625 | if ( !emcalRPoTowerFolder ) { | |
d75bea67 | 626 | if (fDebug) { |
f07cab21 | 627 | cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl; |
628 | cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl; | |
d75bea67 | 629 | } |
f07cab21 | 630 | emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ; |
d75bea67 | 631 | } |
632 | ||
633 | TObject * erp = emcalFolder->FindObject( name ) ; | |
634 | if ( !erp ) { | |
f07cab21 | 635 | TObjArray * towerrp = new TObjArray(100) ; |
636 | towerrp->SetName(name) ; | |
637 | emcalRPoTowerFolder->Add(towerrp) ; | |
d75bea67 | 638 | } |
639 | ||
f07cab21 | 640 | // Pre Shower RecPoints |
641 | TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ; | |
642 | if ( !emcalRPoPreShoFolder ) { | |
d75bea67 | 643 | if (fDebug) { |
f07cab21 | 644 | cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl; |
645 | cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl; | |
d75bea67 | 646 | } |
f07cab21 | 647 | emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ; |
d75bea67 | 648 | } |
649 | ||
f07cab21 | 650 | TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ; |
d75bea67 | 651 | if ( !crp ) { |
f07cab21 | 652 | TObjArray * preshorp = new TObjArray(100) ; |
653 | preshorp->SetName(name) ; | |
654 | emcalRPoPreShoFolder->Add(preshorp) ; | |
d75bea67 | 655 | } |
656 | return kTRUE; | |
657 | } | |
658 | ||
659 | //____________________________________________________________________________ | |
f07cab21 | 660 | TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const |
d75bea67 | 661 | { // -------------- RecPoints ------------------------------------------- |
662 | ||
f07cab21 | 663 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name |
d75bea67 | 664 | |
665 | if ( !fRecoFolder ) { | |
f07cab21 | 666 | cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl; |
52ea052c | 667 | abort() ; |
d75bea67 | 668 | } |
669 | ||
f07cab21 | 670 | TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; |
671 | if ( !towerFolder ) { | |
672 | cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl; | |
52ea052c | 673 | abort() ; |
d75bea67 | 674 | } |
675 | ||
676 | ||
f07cab21 | 677 | TObject * trp = towerFolder->FindObject(name ) ; |
678 | if ( !trp ) { | |
52ea052c | 679 | cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Object " << name << " not found!" << endl ; |
680 | abort() ; | |
d75bea67 | 681 | } |
f07cab21 | 682 | return towerFolder->GetListOfFolders()->GetObjectRef(trp) ; |
d75bea67 | 683 | |
684 | } | |
685 | ||
686 | //____________________________________________________________________________ | |
f07cab21 | 687 | TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const |
d75bea67 | 688 | { // -------------- RecPoints ------------------------------------------- |
689 | ||
f07cab21 | 690 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name |
d75bea67 | 691 | |
692 | if ( !fRecoFolder ) { | |
f07cab21 | 693 | cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl; |
52ea052c | 694 | abort() ; |
d75bea67 | 695 | } |
696 | ||
f07cab21 | 697 | TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ; |
698 | if ( !preshoFolder ) { | |
699 | cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl; | |
52ea052c | 700 | abort() ; |
d75bea67 | 701 | } |
702 | ||
f07cab21 | 703 | TObject * prp = preshoFolder->FindObject(name ) ; |
704 | if ( !prp ) { | |
52ea052c | 705 | cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Object " << name << " not found! " << endl ; |
706 | abort() ; | |
d75bea67 | 707 | } |
f07cab21 | 708 | return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ; |
d75bea67 | 709 | |
710 | } | |
711 | ||
712 | //____________________________________________________________________________ | |
ea4de7a2 | 713 | Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const |
d75bea67 | 714 | { // ------------------ AliEMCALClusterizer ------------------------ |
715 | ||
716 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname | |
717 | ||
718 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
719 | ||
720 | if ( !tasks ) { | |
721 | cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
722 | return kFALSE ; | |
723 | } | |
724 | ||
725 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
726 | if ( !emcal ) { | |
727 | if (fDebug) { | |
728 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl; | |
729 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; | |
730 | } | |
731 | emcal = new TTask("EMCAL", "") ; | |
732 | tasks->Add(emcal) ; | |
733 | } | |
734 | ||
ea4de7a2 | 735 | AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ; |
d75bea67 | 736 | if (emcalcl) { |
737 | if (fDebug) | |
738 | cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ; | |
739 | emcalcl->Delete() ; | |
740 | emcal->GetListOfTasks()->Remove(emcalcl) ; | |
741 | } | |
742 | emcal->Add(clu) ; | |
743 | return kTRUE; | |
744 | } | |
745 | ||
746 | //____________________________________________________________________________ | |
472319e5 | 747 | TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const |
d75bea67 | 748 | { // ------------------ AliEMCALClusterizer ------------------------ |
749 | ||
750 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
751 | ||
752 | if ( !tasks ) { | |
92f521a9 | 753 | cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
52ea052c | 754 | abort() ; |
d75bea67 | 755 | } |
756 | ||
757 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
758 | if ( !emcal ) { | |
92f521a9 | 759 | cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl; |
52ea052c | 760 | abort() ; |
d75bea67 | 761 | } |
762 | ||
763 | TList * l = emcal->GetListOfTasks() ; | |
764 | TIter it(l) ; | |
765 | TTask * task ; | |
766 | TTask * clu = 0 ; | |
767 | TString cluname(name) ; | |
768 | cluname+=":clu-" ; | |
769 | while((task = static_cast<TTask *>(it.Next()) )){ | |
770 | TString taskname(task->GetName()) ; | |
771 | if(taskname.BeginsWith(cluname)){ | |
772 | clu = task ; | |
773 | break ; | |
774 | } | |
775 | } | |
776 | ||
777 | if(clu) | |
472319e5 | 778 | return l->GetObjectRef(clu) ; |
52ea052c | 779 | else { |
780 | cerr << "ERROR: AliEMCALGetter::Post RerRef -> task " << task->GetName() << " not found! " << endl ; | |
781 | abort() ; | |
782 | } | |
d75bea67 | 783 | } |
784 | ||
785 | //____________________________________________________________________________ | |
786 | Bool_t AliEMCALGetter::PostClusterizer(const char * name) const | |
787 | { // ------------------ AliEMCALClusterizer ------------------------ | |
788 | ||
789 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname | |
790 | ||
791 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
792 | ||
793 | if ( !tasks ) { | |
92f521a9 | 794 | cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
d75bea67 | 795 | return kFALSE ; |
796 | } | |
797 | ||
798 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
799 | if ( !emcal ) { | |
800 | if (fDebug) { | |
801 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; | |
802 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; | |
803 | } | |
804 | emcal = new TTask("EMCAL", "") ; | |
805 | tasks->Add(emcal) ; | |
806 | } | |
807 | ||
b134c32f | 808 | TList * l = emcal->GetListOfTasks() ; |
809 | TIter it(l) ; | |
d75bea67 | 810 | TString clun(name) ; |
b134c32f | 811 | clun+=":clu" ; |
812 | TTask * task ; | |
813 | while((task = static_cast<TTask *>(it.Next()) )){ | |
814 | TString taskname(task->GetName()) ; | |
815 | if(taskname.BeginsWith(clun)) | |
816 | return kTRUE ; | |
817 | } | |
818 | ||
819 | AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ; | |
d75bea67 | 820 | emcal->Add(emcalcl) ; |
821 | return kTRUE; | |
822 | ||
823 | } | |
824 | ||
825 | //____________________________________________________________________________ | |
f07cab21 | 826 | /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const |
d75bea67 | 827 | { // ---------------TrackSegments ----------------------------------- |
828 | ||
829 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name | |
830 | ||
831 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ; | |
832 | ||
833 | if ( !emcalFolder ) { | |
834 | if (fDebug) { | |
835 | cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; | |
836 | cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl; | |
837 | } | |
838 | emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; | |
839 | } | |
840 | ||
841 | TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ; | |
842 | if ( !emcalTSFolder ) { | |
843 | if (fDebug) { | |
844 | cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl; | |
845 | cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl; | |
846 | } | |
847 | emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ; | |
848 | } | |
849 | ||
850 | TObject * tss = emcalTSFolder->FindObject( name ) ; | |
851 | if (!tss) { | |
852 | TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ; | |
853 | ts->SetName(name) ; | |
854 | emcalTSFolder->Add(ts) ; | |
855 | } | |
856 | return kTRUE; | |
857 | } | |
858 | ||
859 | //____________________________________________________________________________ | |
472319e5 | 860 | TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const |
d75bea67 | 861 | { // ---------------TrackSegments ----------------------------------- |
862 | ||
863 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name | |
864 | ||
865 | if ( !fRecoFolder ) { | |
866 | cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl; | |
52ea052c | 867 | abort() ; |
d75bea67 | 868 | } |
869 | ||
870 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; | |
871 | if ( !emcalFolder ) { | |
872 | cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl; | |
52ea052c | 873 | abort(); |
d75bea67 | 874 | } |
875 | ||
876 | TObject * tss = emcalFolder->FindObject(name) ; | |
877 | if (!tss) { | |
52ea052c | 878 | cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> object " << name << " not found! " << endl ; |
879 | abort() ; | |
d75bea67 | 880 | } |
472319e5 | 881 | return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ; |
d75bea67 | 882 | } |
883 | ||
884 | //____________________________________________________________________________ | |
885 | Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const | |
886 | { //------------Track Segment Maker ------------------------------ | |
887 | ||
888 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname | |
889 | ||
890 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
891 | ||
892 | if ( !tasks ) { | |
893 | cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
894 | return kFALSE ; | |
895 | } | |
896 | ||
897 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
898 | if ( !emcal ) { | |
899 | if (fDebug) { | |
900 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; | |
901 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; | |
902 | } | |
903 | emcal = new TTask("EMCAL", "") ; | |
904 | tasks->Add(emcal) ; | |
905 | } | |
906 | ||
907 | AliEMCALTrackSegmentMaker * emcalts = | |
908 | dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ; | |
909 | if (emcalts) { | |
910 | emcalts->Delete() ; | |
911 | emcal->GetListOfTasks()->Remove(emcalts) ; | |
912 | } | |
913 | emcal->Add(tsmaker) ; | |
914 | return kTRUE; | |
915 | ||
916 | } | |
917 | //____________________________________________________________________________ | |
918 | Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const | |
919 | { //------------Track Segment Maker ------------------------------ | |
920 | ||
921 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname | |
922 | ||
923 | ||
924 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
925 | ||
926 | if ( !tasks ) { | |
927 | cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
928 | return kFALSE ; | |
929 | } | |
930 | ||
931 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
932 | if ( !emcal ) { | |
933 | if (fDebug) { | |
934 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; | |
92f521a9 | 935 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl; |
d75bea67 | 936 | } |
937 | emcal = new TTask("EMCAL", "") ; | |
938 | tasks->Add(emcal) ; | |
939 | } | |
940 | ||
941 | AliEMCALTrackSegmentMaker * emcalts = | |
942 | dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ; | |
943 | if (!emcalts) { | |
944 | emcalts = new AliEMCALTrackSegmentMakerv1() ; | |
945 | TString tsn(name); | |
946 | tsn+=":tsm-v1" ; | |
947 | emcalts->SetName(tsn) ; | |
948 | emcal->Add(emcalts) ; | |
949 | } | |
950 | return kTRUE; | |
951 | ||
952 | } | |
953 | ||
954 | //____________________________________________________________________________ | |
472319e5 | 955 | TObject ** AliEMCALGetter::TSMakerRef(const char * name) const |
d75bea67 | 956 | { //------------Track Segment Maker ------------------------------ |
957 | ||
958 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
959 | ||
960 | if ( !tasks ) { | |
92f521a9 | 961 | cerr << "ERROR: AliEMCALGetter::TSLakerRef TerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
52ea052c | 962 | abort() ; |
d75bea67 | 963 | } |
964 | ||
965 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
966 | if ( !emcal ) { | |
92f521a9 | 967 | cerr <<"WARNING: AliEMCALGetter::TSMakerRef TerRef -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl; |
52ea052c | 968 | abort() ; |
d75bea67 | 969 | } |
970 | ||
971 | TList * l = emcal->GetListOfTasks() ; | |
972 | TIter it(l) ; | |
973 | TTask * task ; | |
974 | TTask * tsm = 0 ; | |
975 | TString tsmname(name) ; | |
976 | tsmname+=":tsm-" ; | |
977 | while((task = static_cast<TTask *>(it.Next()) )){ | |
978 | TString taskname(task->GetName()) ; | |
979 | if(taskname.BeginsWith(tsmname)){ | |
980 | tsm = task ; | |
981 | break ; | |
982 | } | |
983 | } | |
984 | ||
985 | if(tsm) | |
472319e5 | 986 | return l->GetObjectRef(tsm) ; |
52ea052c | 987 | else { |
988 | cerr << "ERROR: AliEMCALGetter::TSLakerRef -> task " << task->GetName() << " not found! " << endl ; | |
989 | abort() ; | |
990 | } | |
d75bea67 | 991 | } |
992 | ||
993 | //____________________________________________________________________________ | |
994 | Bool_t AliEMCALGetter::PostRecParticles(const char * name) const | |
995 | { // -------------------- RecParticles ------------------------ | |
996 | ||
997 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name | |
998 | ||
999 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ; | |
1000 | ||
1001 | if ( !emcalFolder ) { | |
1002 | if (fDebug) { | |
1003 | cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; | |
1004 | cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl; | |
1005 | } | |
1006 | emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; | |
1007 | } | |
1008 | ||
1009 | TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ; | |
1010 | if ( !emcalRPaFolder ) { | |
1011 | if (fDebug) { | |
1012 | cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl; | |
1013 | cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl; | |
1014 | } | |
1015 | emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ; | |
1016 | } | |
1017 | ||
1018 | TObject * rps = emcalRPaFolder->FindObject( name ) ; | |
1019 | if ( !rps ) { | |
1020 | TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ; | |
1021 | rp->SetName(name) ; | |
1022 | emcalRPaFolder->Add(rp) ; | |
1023 | } | |
1024 | return kTRUE; | |
1025 | } | |
1026 | ||
1027 | //____________________________________________________________________________ | |
472319e5 | 1028 | TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const |
d75bea67 | 1029 | { // ---------------TrackSegments ----------------------------------- |
1030 | ||
1031 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name | |
1032 | ||
1033 | if ( !fRecoFolder ) { | |
1034 | cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl; | |
52ea052c | 1035 | abort() ; |
d75bea67 | 1036 | } |
1037 | ||
1038 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ; | |
1039 | if ( !emcalFolder ) { | |
1040 | cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl; | |
52ea052c | 1041 | abort() ; |
d75bea67 | 1042 | } |
1043 | ||
52ea052c | 1044 | TObject * tss = emcalFolder->FindObject(name) ; |
d75bea67 | 1045 | if (!tss) { |
52ea052c | 1046 | cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> object " << name << " not found! " << endl ; |
1047 | abort() ; | |
d75bea67 | 1048 | } |
472319e5 | 1049 | return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ; |
d75bea67 | 1050 | } |
1051 | ||
1052 | //____________________________________________________________________________ | |
1053 | Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const | |
1054 | { // ------------AliEMCAL PID ----------------------------- | |
1055 | ||
1056 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
1057 | ||
1058 | if ( !tasks ) { | |
92f521a9 | 1059 | cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
d75bea67 | 1060 | return kFALSE ; |
1061 | } | |
1062 | ||
1063 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
1064 | if ( !emcal ) { | |
1065 | if (fDebug) { | |
92f521a9 | 1066 | cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl; |
1067 | cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl; | |
d75bea67 | 1068 | } |
1069 | emcal = new TTask("EMCAL", "") ; | |
1070 | tasks->Add(emcal) ; | |
1071 | } | |
1072 | ||
1073 | AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ; | |
1074 | if (emcalpid) { | |
1075 | if (fDebug) | |
1076 | cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName() | |
1077 | << " already exists" << endl ; | |
1078 | emcal->GetListOfTasks()->Remove(emcalpid) ; | |
1079 | } | |
1080 | ||
1081 | emcal->Add(pid) ; | |
1082 | return kTRUE; | |
1083 | } | |
1084 | ||
1085 | //____________________________________________________________________________ | |
1086 | Bool_t AliEMCALGetter::PostPID(const char * name) const | |
1087 | { | |
1088 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname | |
1089 | ||
1090 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
1091 | ||
1092 | if ( !tasks ) { | |
92f521a9 | 1093 | cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
d75bea67 | 1094 | return kFALSE ; |
1095 | } | |
1096 | ||
1097 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
1098 | if ( !emcal ) { | |
1099 | if (fDebug) { | |
92f521a9 | 1100 | cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl; |
1101 | cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl; | |
d75bea67 | 1102 | } |
1103 | emcal = new TTask("EMCAL", "") ; | |
1104 | tasks->Add(emcal) ; | |
1105 | } | |
1106 | ||
1107 | TList * l = emcal->GetListOfTasks() ; | |
1108 | TIter it(l) ; | |
1109 | TString pidname(name) ; | |
1110 | pidname+=":pid" ; | |
1111 | TTask * task ; | |
1112 | while((task = static_cast<TTask *>(it.Next()) )){ | |
1113 | TString taskname(task->GetName()) ; | |
1114 | if(taskname.BeginsWith(pidname)) | |
1115 | return kTRUE ; | |
1116 | } | |
1117 | ||
1118 | AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ; | |
1119 | pidname+="-v1" ; | |
1120 | emcalpid->SetName(pidname) ; | |
1121 | emcal->Add(emcalpid) ; | |
1122 | ||
1123 | return kTRUE; | |
1124 | } | |
1125 | ||
1126 | //____________________________________________________________________________ | |
472319e5 | 1127 | TObject ** AliEMCALGetter::PIDRef(const char * name) const |
d75bea67 | 1128 | { //------------PID ------------------------------ |
1129 | ||
1130 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
1131 | ||
1132 | if ( !tasks ) { | |
92f521a9 | 1133 | cerr << "ERROR: AliEMCALGetter::PIDRef PerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
52ea052c | 1134 | abort() ; |
d75bea67 | 1135 | } |
1136 | ||
1137 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
1138 | if ( !emcal ) { | |
92f521a9 | 1139 | cerr <<"WARNING: AliEMCALGetter::PIDRef PerRef -> //" << fTasksFolder->GetName() << "/ReconstructionerEMCAL not found!" << endl; |
52ea052c | 1140 | abort() ; |
d75bea67 | 1141 | } |
1142 | ||
1143 | TList * l = emcal->GetListOfTasks() ; | |
1144 | TIter it(l) ; | |
1145 | TTask * task ; | |
1146 | TTask * pid = 0 ; | |
1147 | TString pidname(name) ; | |
1148 | pidname+=":pid-" ; | |
1149 | while((task = static_cast<TTask *>(it.Next()) )){ | |
1150 | TString taskname(task->GetName()) ; | |
1151 | if(taskname.BeginsWith(pidname)){ | |
1152 | pid = task ; | |
1153 | break ; | |
1154 | } | |
1155 | } | |
1156 | ||
1157 | if(pid) | |
472319e5 | 1158 | return l->GetObjectRef(pid) ; |
52ea052c | 1159 | else { |
1160 | cerr << "ERROR: AliEMCALGetter::PIDRef -> task " << task->GetName() << " not found! " << endl ; | |
1161 | abort() ; | |
1162 | } | |
d75bea67 | 1163 | } |
1164 | ||
1165 | //____________________________________________________________________________ | |
1166 | Bool_t AliEMCALGetter::PostQA(void) const | |
1167 | { // ------------------ QA --------------------------------- | |
1168 | ||
1169 | // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName | |
1170 | ||
1171 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ; | |
1172 | if ( !emcalFolder ) { | |
1173 | if (fDebug) { | |
1174 | cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl; | |
1175 | cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl; | |
1176 | } | |
1177 | emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ; | |
1178 | } | |
1179 | ||
1180 | return kTRUE; | |
1181 | } | |
1182 | ||
1183 | //____________________________________________________________________________ | |
472319e5 | 1184 | TObject ** AliEMCALGetter::AlarmsRef(void) const |
d75bea67 | 1185 | { //------- Alarms ---------------------- |
1186 | ||
1187 | ||
1188 | // the hierarchy is //Folders/Run/Conditions/QA/EMCAL | |
1189 | if ( !fQAFolder ) { | |
52ea052c | 1190 | cerr << "ERROR: AliEMCALGetter::AlarmsRef QRef -> Folder //" << fQAFolder << " not found!" << endl; |
1191 | abort() ; | |
d75bea67 | 1192 | } |
1193 | ||
1194 | TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ; | |
1195 | if ( !emcalFolder ) { | |
52ea052c | 1196 | cerr << "ERROR: AliEMCALGetter::AlarmsRef QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl; |
1197 | abort() ; | |
d75bea67 | 1198 | } |
1199 | ||
472319e5 | 1200 | return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ; |
d75bea67 | 1201 | } |
1202 | */ | |
ffa6d63b | 1203 | //____________________________________________________________________________ |
1204 | const TParticle * AliEMCALGetter::Primary(Int_t index) const | |
1205 | { | |
1206 | // Return primary particle numbered by <index> | |
f07cab21 | 1207 | |
ffa6d63b | 1208 | if(index < 0) |
1209 | return 0 ; | |
1210 | ||
1211 | Int_t primaryIndex = index % 10000000 ; | |
1212 | Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ; | |
1213 | ||
1214 | if ( primaryList > 0 ) { | |
d75bea67 | 1215 | if (fDebug) { |
ffa6d63b | 1216 | cout << " Getter does not support currently Mixing of primary " << endl ; |
1217 | cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ; | |
d75bea67 | 1218 | } |
ffa6d63b | 1219 | return 0; |
1220 | } | |
1221 | ||
1222 | return gAlice->Particle(primaryIndex) ; | |
1223 | ||
1224 | } | |
1225 | ||
1226 | //____________________________________________________________________________ | |
1227 | void AliEMCALGetter::ReadTreeD() | |
1228 | { | |
1229 | // Read the digit tree gAlice->TreeD() | |
1230 | if(gAlice->TreeD()== 0){ | |
1231 | cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ; | |
1232 | return ; | |
1233 | } | |
d75bea67 | 1234 | |
ffa6d63b | 1235 | TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ; |
1236 | TIter next(lob) ; | |
1237 | TBranch * branch = 0 ; | |
1238 | TBranch * digitsbranch = 0 ; | |
1239 | TBranch * digitizerbranch = 0 ; | |
1240 | Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ; | |
1241 | ||
1242 | while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) { | |
1243 | if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { | |
1244 | digitsbranch = branch ; | |
1245 | emcalfound = kTRUE ; | |
1246 | } | |
1247 | else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { | |
1248 | digitizerbranch = branch ; | |
1249 | digitizerfound = kTRUE ; | |
1250 | } | |
1251 | } | |
1252 | ||
1253 | if ( !emcalfound || !digitizerfound ) { | |
d75bea67 | 1254 | if (fDebug) |
ffa6d63b | 1255 | cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name " |
1256 | << fDigitsTitle << endl ; | |
1257 | return ; | |
1258 | } | |
1259 | ||
1260 | //read digits | |
1261 | if(!Digits(fDigitsTitle) ) | |
1262 | PostDigits(fDigitsTitle); | |
1263 | digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ; | |
1264 | digitsbranch->GetEntry(0) ; | |
1265 | ||
1266 | ||
1267 | // read the Digitizer | |
1268 | if(!Digitizer(fDigitsTitle)) | |
1269 | PostDigitizer(fDigitsTitle) ; | |
b134c32f | 1270 | |
92f521a9 | 1271 | digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ; |
1272 | digitizerbranch->GetEntry(0) ; | |
ffa6d63b | 1273 | |
1274 | ||
1275 | } | |
1276 | ||
1277 | //____________________________________________________________________________ | |
1278 | void AliEMCALGetter::ReadTreeH() | |
1279 | { | |
1280 | // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() | |
1281 | ||
1282 | if(gAlice->TreeH()== 0){ | |
1283 | cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ; | |
1284 | return ; | |
1285 | } | |
1286 | ||
1287 | TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ; | |
1288 | if ( !hitsbranch ) { | |
d75bea67 | 1289 | if (fDebug) |
ffa6d63b | 1290 | cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ; |
1291 | return ; | |
1292 | } | |
1293 | if(!Hits()) | |
1294 | PostHits() ; | |
472319e5 | 1295 | |
1296 | if (hitsbranch->GetEntries() > 1 ) { | |
1297 | TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ; | |
1298 | TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ; | |
1299 | hitsbranch->SetAddress(&tempo) ; | |
1300 | Int_t index = 0 ; | |
1301 | Int_t i = 0 ; | |
1302 | for (i = 0 ; i < hitsbranch->GetEntries() ; i++) { | |
1303 | hitsbranch->GetEntry(i) ; | |
1304 | Int_t j = 0 ; | |
1305 | for ( j = 0 ; j < tempo->GetEntries() ; j++) { | |
1306 | const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ; | |
1307 | new((*hits)[index]) AliEMCALHit( *hit ) ; | |
1308 | index++ ; | |
1309 | } | |
1310 | } | |
1311 | delete tempo ; | |
1312 | } | |
1313 | else { | |
ffa6d63b | 1314 | hitsbranch->SetAddress(HitsRef()) ; |
ffa6d63b | 1315 | hitsbranch->GetEntry(0) ; |
472319e5 | 1316 | } |
ffa6d63b | 1317 | } |
1318 | ||
1319 | //____________________________________________________________________________ | |
1320 | void AliEMCALGetter::Track(Int_t itrack) | |
1321 | { | |
1322 | // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() | |
1323 | ||
1324 | if(gAlice->TreeH()== 0){ | |
1325 | cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ; | |
1326 | return ; | |
1327 | } | |
1328 | ||
1329 | TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ; | |
1330 | if ( !hitsbranch ) { | |
d75bea67 | 1331 | if (fDebug) |
ffa6d63b | 1332 | cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ; |
1333 | return ; | |
1334 | } | |
1335 | if(!Hits()) | |
1336 | PostHits() ; | |
1337 | hitsbranch->SetAddress(HitsRef()) ; | |
1338 | hitsbranch->GetEntry(itrack) ; | |
1339 | ||
f07cab21 | 1340 | |
ffa6d63b | 1341 | } |
1342 | //____________________________________________________________________________ | |
f07cab21 | 1343 | // void AliEMCALGetter::ReadTreeQA() |
1344 | //{ | |
d75bea67 | 1345 | // Read the digit tree gAlice->TreeQA() |
1346 | // so far only EMCAL knows about this Tree | |
1347 | ||
f07cab21 | 1348 | // if(EMCAL()->TreeQA()== 0){ |
1349 | // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ; | |
1350 | // return ; | |
1351 | // } | |
d75bea67 | 1352 | |
f07cab21 | 1353 | // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ; |
1354 | // if (!qabranch) { | |
1355 | // if (fDebug) | |
1356 | // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ; | |
1357 | // return ; | |
1358 | // } | |
d75bea67 | 1359 | |
f07cab21 | 1360 | // if(!Alarms()) |
1361 | // PostQA() ; | |
d75bea67 | 1362 | |
f07cab21 | 1363 | // qabranch->SetAddress(AlarmsRef()) ; |
d75bea67 | 1364 | |
f07cab21 | 1365 | // qabranch->GetEntry(0) ; |
d75bea67 | 1366 | |
1367 | // PostQA("EMCAL") ; | |
1368 | // TFolder * alarmsF = Alarms() ; | |
1369 | // alarmsF->Clear() ; | |
1370 | // qabranch->SetAddress(&alarmsF) ; | |
1371 | // qabranch->GetEntry(0) ; | |
1372 | ||
f07cab21 | 1373 | //} |
1374 | ||
d75bea67 | 1375 | //____________________________________________________________________________ |
1376 | void AliEMCALGetter::ReadTreeR() | |
1377 | { | |
f07cab21 | 1378 | // Read the reconstrunction tree gAlice->TreeR() |
d75bea67 | 1379 | |
1380 | if(gAlice->TreeR()== 0){ | |
1381 | cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ; | |
1382 | return ; | |
1383 | } | |
1384 | ||
1385 | // RecPoints | |
1386 | TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ; | |
1387 | TIter next(lob) ; | |
1388 | TBranch * branch = 0 ; | |
f07cab21 | 1389 | TBranch * towerbranch = 0 ; |
1390 | TBranch * preshobranch = 0 ; | |
d75bea67 | 1391 | TBranch * clusterizerbranch = 0 ; |
f07cab21 | 1392 | Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ; |
d75bea67 | 1393 | |
f07cab21 | 1394 | while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) ) |
d75bea67 | 1395 | if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) { |
f07cab21 | 1396 | if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) { |
1397 | towerbranch = branch ; | |
1398 | emcaltowerrpfound = kTRUE ; | |
d75bea67 | 1399 | } |
f07cab21 | 1400 | else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) { |
1401 | preshobranch = branch ; | |
1402 | emcalpreshorpfound = kTRUE ; | |
d75bea67 | 1403 | } |
1404 | else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){ | |
1405 | clusterizerbranch = branch ; | |
1406 | clusterizerfound = kTRUE ; | |
1407 | } | |
1408 | } | |
1409 | ||
f07cab21 | 1410 | if ( !emcaltowerrpfound ) { |
d75bea67 | 1411 | if (fDebug) |
f07cab21 | 1412 | cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title " |
d75bea67 | 1413 | << fRecPointsTitle << endl ; |
1414 | return ; | |
1415 | } | |
f07cab21 | 1416 | if ( !emcalpreshorpfound ) { |
d75bea67 | 1417 | if (fDebug) |
f07cab21 | 1418 | cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title " |
d75bea67 | 1419 | << fRecPointsTitle << endl ; |
1420 | return ; | |
1421 | } | |
1422 | if ( !clusterizerfound ) { | |
1423 | if (fDebug) | |
1424 | cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title " | |
1425 | << fRecPointsTitle << endl ; | |
1426 | return ; | |
1427 | } | |
1428 | ||
1429 | // Read and Post the RecPoints | |
f07cab21 | 1430 | if(!TowerRecPoints(fRecPointsTitle) ) |
d75bea67 | 1431 | PostRecPoints(fRecPointsTitle) ; |
f07cab21 | 1432 | towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ; |
1433 | towerbranch->GetEntry(0) ; | |
d75bea67 | 1434 | |
f07cab21 | 1435 | preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ; |
1436 | preshobranch->GetEntry(0) ; | |
d75bea67 | 1437 | |
1438 | if(!Clusterizer(fRecPointsTitle) ) | |
1439 | PostClusterizer(fRecPointsTitle) ; | |
92f521a9 | 1440 | |
1441 | clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ; | |
1442 | clusterizerbranch->GetEntry(0) ; | |
d75bea67 | 1443 | |
1444 | ||
1445 | //------------------- TrackSegments --------------------- | |
f07cab21 | 1446 | // next.Reset() ; |
1447 | // TBranch * tsbranch = 0 ; | |
1448 | // TBranch * tsmakerbranch = 0 ; | |
1449 | // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ; | |
d75bea67 | 1450 | |
f07cab21 | 1451 | // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) ) |
1452 | // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) { | |
1453 | // if ( strcmp(branch->GetName(), "EMCALTS")==0){ | |
1454 | // tsbranch = branch ; | |
1455 | // emcaltsfound = kTRUE ; | |
1456 | // } | |
1457 | // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) { | |
1458 | // tsmakerbranch = branch ; | |
1459 | // tsmakerfound = kTRUE ; | |
1460 | // } | |
1461 | // } | |
1462 | ||
1463 | // if ( !emcaltsfound || !tsmakerfound ) { | |
1464 | // if (fDebug) | |
1465 | // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name " | |
1466 | // << fTrackSegmentsTitle << endl ; | |
1467 | // return ; | |
1468 | // } | |
1469 | ||
1470 | // // Read and Post the TrackSegments | |
1471 | // if(!TrackSegments(fTrackSegmentsTitle)) | |
1472 | // PostTrackSegments(fTrackSegmentsTitle) ; | |
1473 | // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ; | |
1474 | // tsbranch->GetEntry(0) ; | |
1475 | ||
1476 | // // Read and Post the TrackSegment Maker | |
1477 | // if(!TrackSegmentMaker(fTrackSegmentsTitle)) | |
1478 | // PostTrackSegmentMaker(fTrackSegmentsTitle) ; | |
92f521a9 | 1479 | // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ; |
1480 | // tsmakerbranch->GetEntry(0) ; | |
f07cab21 | 1481 | |
1482 | ||
1483 | // //------------ RecParticles ---------------------------- | |
1484 | // next.Reset() ; | |
1485 | // TBranch * rpabranch = 0 ; | |
1486 | // TBranch * pidbranch = 0 ; | |
1487 | // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ; | |
1488 | ||
1489 | // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) ) | |
1490 | // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) { | |
1491 | // if ( strcmp(branch->GetName(), "EMCALRP")==0) { | |
1492 | // rpabranch = branch ; | |
1493 | // emcalrpafound = kTRUE ; | |
1494 | // } | |
1495 | // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) { | |
1496 | // pidbranch = branch ; | |
1497 | // pidfound = kTRUE ; | |
1498 | // } | |
1499 | // } | |
1500 | ||
1501 | // if ( !emcalrpafound || !pidfound ) { | |
1502 | // if (fDebug) | |
1503 | // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name " | |
1504 | // << fRecParticlesTitle << endl ; | |
1505 | // return ; | |
1506 | // } | |
1507 | ||
1508 | // // Read and Post the RecParticles | |
1509 | // if(!RecParticles(fRecParticlesTitle)) | |
1510 | // PostRecParticles(fRecParticlesTitle) ; | |
1511 | // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ; | |
1512 | // rpabranch->GetEntry(0) ; | |
1513 | ||
1514 | // // Read and Post the PID | |
1515 | // if(!PID(fRecParticlesTitle)) | |
1516 | // PostPID(fRecParticlesTitle) ; | |
92f521a9 | 1517 | // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ; |
1518 | // pidbranch->GetEntry(0) ; | |
d75bea67 | 1519 | |
1520 | ||
1521 | } | |
f07cab21 | 1522 | |
d75bea67 | 1523 | //____________________________________________________________________________ |
ffa6d63b | 1524 | void AliEMCALGetter::ReadTreeS(Int_t event) |
1525 | { | |
1526 | // Read the summable digits tree gAlice->TreeS() | |
1527 | ||
1528 | // loop over all opened files and read their SDigits to the White Board | |
1529 | TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ; | |
1530 | if (!emcalF) | |
1531 | emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; | |
1532 | TCollection * folderslist = emcalF->GetListOfFolders() ; | |
1533 | ||
1534 | //Add current file to list if it is not there yet | |
4e5c8d4c | 1535 | |
1536 | TString subdir(fHeaderFile) ; | |
1537 | subdir.ReplaceAll("/","_") ; | |
1538 | ||
1539 | if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){ | |
1540 | emcalF->AddFolder(subdir, ""); | |
ffa6d63b | 1541 | } |
54b82aa4 | 1542 | |
ffa6d63b | 1543 | TIter next(folderslist) ; |
1544 | TFolder * folder = 0 ; | |
1545 | TFile * file; | |
1546 | TTree * treeS = 0; | |
1547 | while ( (folder = static_cast<TFolder*>(next())) ) { | |
4e5c8d4c | 1548 | TString fileName(folder->GetName()) ; |
1549 | fileName.ReplaceAll("_","/") ; | |
1550 | if(fHeaderFile.CompareTo(fileName) == 0 ) | |
d75bea67 | 1551 | treeS=gAlice->TreeS() ; |
ffa6d63b | 1552 | else{ |
4e5c8d4c | 1553 | file = static_cast<TFile*>(gROOT->GetFile(fileName)); |
ffa6d63b | 1554 | file->cd() ; |
1555 | ||
1556 | // Get SDigits Tree header from file | |
1557 | TString treeName("TreeS") ; | |
1558 | treeName += event ; | |
1559 | treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data())); | |
1560 | } | |
1561 | if(treeS==0){ | |
1562 | cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl; | |
1563 | return ; | |
1564 | } | |
54b82aa4 | 1565 | |
ffa6d63b | 1566 | //set address of the SDigits and SDigitizer |
1567 | TBranch * sdigitsBranch = 0; | |
1568 | TBranch * sdigitizerBranch = 0; | |
1569 | TBranch * branch = 0 ; | |
1570 | TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ; | |
1571 | TIter next(lob) ; | |
1572 | Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; | |
1573 | ||
1574 | while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) { | |
d75bea67 | 1575 | if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { |
ffa6d63b | 1576 | emcalfound = kTRUE ; |
1577 | sdigitsBranch = branch ; | |
d75bea67 | 1578 | } |
ffa6d63b | 1579 | |
1580 | else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { | |
1581 | sdigitizerfound = kTRUE ; | |
1582 | sdigitizerBranch = branch ; | |
ffa6d63b | 1583 | } |
1584 | } | |
1585 | if ( !emcalfound || !sdigitizerfound ) { | |
d75bea67 | 1586 | if (fDebug) |
472319e5 | 1587 | cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle |
ffa6d63b | 1588 | << " not found" << endl ; |
1589 | return ; | |
1590 | } | |
1591 | ||
1592 | if ( !folder->FindObject(fSDigitsTitle) ) | |
d75bea67 | 1593 | PostSDigits(fSDigitsTitle,folder->GetName()) ; |
ffa6d63b | 1594 | sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ; |
ffa6d63b | 1595 | sdigitsBranch->GetEntry(0) ; |
1596 | ||
1597 | TString sdname(fSDigitsTitle) ; | |
ffa6d63b | 1598 | sdname+=":" ; |
1599 | sdname+=folder->GetName() ; | |
1600 | if(!SDigitizer(sdname) ) | |
1601 | PostSDigitizer(fSDigitsTitle,folder->GetName()) ; | |
b134c32f | 1602 | |
92f521a9 | 1603 | sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; |
1604 | sdigitizerBranch->GetEntry(0) ; | |
ffa6d63b | 1605 | |
1606 | } | |
1607 | ||
1608 | // After SDigits have been read from all files, return to the first one | |
1609 | ||
1610 | next.Reset(); | |
1611 | folder = static_cast<TFolder*>(next()); | |
1612 | if(folder){ | |
4e5c8d4c | 1613 | TString fileName(folder->GetName()) ; |
1614 | fileName.ReplaceAll("_","/") ; | |
1615 | file = static_cast<TFile*>(gROOT->GetFile(fileName)); | |
ffa6d63b | 1616 | file ->cd() ; |
1617 | } | |
1618 | ||
1619 | } | |
1620 | //____________________________________________________________________________ | |
1621 | void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input) | |
1622 | { // Read the summable digits fron treeS() | |
1623 | ||
1624 | ||
1625 | TString filename("mergefile") ; | |
1626 | filename+= input ; | |
1627 | ||
1628 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; | |
1629 | if ( !emcalFolder ) { | |
1630 | emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; | |
1631 | } | |
1632 | TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ; | |
1633 | //set address of the SDigits and SDigitizer | |
1634 | TBranch * sdigitsBranch = 0; | |
1635 | TBranch * sdigitizerBranch = 0; | |
1636 | TBranch * branch = 0 ; | |
1637 | TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ; | |
1638 | TIter next(lob) ; | |
1639 | Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; | |
1640 | ||
1641 | while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) { | |
1642 | if ( strcmp(branch->GetName(), "EMCAL")==0) { | |
1643 | emcalfound = kTRUE ; | |
1644 | sdigitsBranch = branch ; | |
1645 | } | |
1646 | ||
1647 | else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) { | |
1648 | sdigitizerfound = kTRUE ; | |
1649 | sdigitizerBranch = branch ; | |
1650 | } | |
1651 | } | |
1652 | if ( !emcalfound || !sdigitizerfound ) { | |
d75bea67 | 1653 | if (fDebug) |
ffa6d63b | 1654 | cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ; |
1655 | return ; | |
1656 | } | |
1657 | ||
1658 | if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) ) | |
1659 | PostSDigits(sdigitsBranch->GetTitle(),filename) ; | |
1660 | ||
1661 | sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ; | |
d75bea67 | 1662 | sdigitsBranch->GetEntry(0) ; |
ffa6d63b | 1663 | |
1664 | TString sdname(sdigitsBranch->GetTitle()) ; | |
1665 | sdname+=":" ; | |
1666 | sdname+=filename ; | |
1667 | if(!SDigitizer(sdigitsBranch->GetTitle()) ) | |
1668 | PostSDigitizer(sdigitsBranch->GetTitle(),filename) ; | |
d75bea67 | 1669 | |
ffa6d63b | 1670 | sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; |
ffa6d63b | 1671 | sdigitizerBranch->GetEntry(0) ; |
1672 | ||
1673 | } | |
1674 | ||
1675 | ||
1676 | //____________________________________________________________________________ | |
1677 | void AliEMCALGetter::ReadPrimaries() | |
1678 | { | |
1679 | // Reads specific branches of primaries | |
1680 | ||
1681 | fNPrimaries = gAlice->GetNtrack(); | |
1682 | ||
1683 | // //Check, is it necessary to open new files | |
1684 | // TArrayI* events = fDigitizer->GetCurrentEvents() ; | |
1685 | // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ; | |
1686 | // Int_t input ; | |
1687 | // for(input = 0; input < filenames->GetEntriesFast(); input++){ | |
1688 | ||
1689 | // TObjString * filename = (TObjString *) filenames->At(input) ; | |
1690 | ||
1691 | // //Test, if this file already open | |
1692 | // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ; | |
1693 | // if(file == 0) | |
1694 | // file = new TFile( filename->GetString()) ; | |
1695 | // file->cd() ; | |
1696 | ||
1697 | // // Get Kine Tree from file | |
1698 | // // char treeName[20]; | |
1699 | // // sprintf(treeName,"TreeK%d",events->At(input)); | |
1700 | // // TTree * treeK = (TTree*)gDirectory->Get(treeName); | |
1701 | // // if (treeK) | |
1702 | // // treeK->SetBranchAddress("Particles", &fParticleBuffer); | |
1703 | // // else | |
1704 | // // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl; | |
1705 | ||
1706 | // // // Create the particle stack | |
1707 | // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000); | |
1708 | // // // Build the pointer list | |
1709 | // // if(fParticleMap) { <---- | |
1710 | // // fParticleMap->Clear(); | |
1711 | // // fParticleMap->Expand(treeK->GetEntries()); | |
1712 | // // } else | |
1713 | // // fParticleMap = new TObjArray(treeK->GetEntries()); | |
1714 | ||
1715 | // // From gAlice->Particle(i) | |
1716 | ||
1717 | ||
1718 | // // if(!(*fParticleMap)[i]) { | |
1719 | // // Int_t nentries = fParticles->GetEntries(); | |
1720 | ||
1721 | // // // algorithmic way of getting entry index | |
1722 | // // // (primary particles are filled after secondaries) | |
1723 | // // Int_t entry; | |
1724 | // // if (i<fHeader.GetNprimary()) | |
1725 | // // entry = i+fHeader.GetNsecondary(); | |
1726 | // // else | |
1727 | // // entry = i-fHeader.GetNprimary(); | |
1728 | ||
1729 | // // // only check the algorithmic way and give | |
1730 | // // // the fatal error if it is wrong | |
1731 | // // if (entry != fParticleFileMap[i]) { | |
1732 | // // Fatal("Particle", | |
1733 | // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d", | |
1734 | // // entry, fParticleFileMap[i]); | |
1735 | // // } | |
1736 | ||
1737 | // // fTreeK->GetEntry(fParticleFileMap[i]); | |
1738 | // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer); | |
1739 | // // fParticleMap->AddAt((*fParticles)[nentries],i); | |
1740 | // // } | |
1741 | // // return (TParticle *) (*fParticleMap)[i]; | |
1742 | ||
1743 | ||
1744 | ||
1745 | // } | |
1746 | ||
1747 | ||
1748 | // //scan over opened files and read corresponding TreeK## | |
1749 | ||
1750 | return ; | |
1751 | } | |
1752 | //____________________________________________________________________________ | |
1753 | void AliEMCALGetter::Event(const Int_t event, const char* opt) | |
1754 | { | |
1755 | // Reads the content of all Tree's S, D and R | |
1756 | ||
1757 | if (event >= gAlice->TreeE()->GetEntries() ) { | |
1758 | cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ; | |
1759 | return ; | |
1760 | } | |
1761 | gAlice->GetEvent(event) ; | |
1762 | ||
1763 | if(strstr(opt,"H") ) | |
d75bea67 | 1764 | ReadTreeH() ; |
ffa6d63b | 1765 | |
1766 | if(strstr(opt,"S") ) | |
d75bea67 | 1767 | ReadTreeS(event) ; |
ffa6d63b | 1768 | |
1769 | if( strstr(opt,"D") ) | |
1770 | ReadTreeD() ; | |
1771 | ||
f07cab21 | 1772 | if( strstr(opt,"R") ) |
1773 | ReadTreeR() ; | |
ffa6d63b | 1774 | |
d75bea67 | 1775 | // if( strstr(opt,"Q") ) |
1776 | // ReadTreeQA() ; | |
ffa6d63b | 1777 | |
d75bea67 | 1778 | // if( strstr(opt,"P") || (strcmp(opt,"")==0) ) |
1779 | // ReadPrimaries() ; | |
ffa6d63b | 1780 | |
1781 | } | |
1782 | ||
1783 | //____________________________________________________________________________ | |
472319e5 | 1784 | TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const |
ffa6d63b | 1785 | { |
1786 | // get the object named "what" from the folder | |
1787 | // folders are named like //Folders | |
1788 | ||
1789 | if ( file.IsNull() ) | |
1790 | file = fHeaderFile ; | |
1791 | ||
1792 | TFolder * folder = 0 ; | |
1793 | TObject * emcalO = 0 ; | |
1794 | ||
1795 | // if ( name.IsNull() ) { | |
1796 | if ( what.CompareTo("Hits") == 0 ) { | |
1797 | folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ; | |
1798 | if (folder) | |
1799 | emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ; | |
1800 | } | |
1801 | else if ( what.CompareTo("SDigits") == 0 ) { | |
4e5c8d4c | 1802 | file.ReplaceAll("/","_") ; |
ffa6d63b | 1803 | TString path = "EMCAL/" + file ; |
1804 | folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ; | |
1805 | if (folder) { | |
d75bea67 | 1806 | if (name.IsNull()) |
ffa6d63b | 1807 | name = fSDigitsTitle ; |
1808 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1809 | } | |
1810 | } | |
1811 | else if ( what.CompareTo("Digits") == 0 ){ | |
1812 | folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ; | |
1813 | if (folder) { | |
1814 | if (name.IsNull()) | |
1815 | name = fDigitsTitle ; | |
1816 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1817 | } | |
1818 | } | |
f07cab21 | 1819 | else if ( what.CompareTo("TowerRecPoints") == 0 ) { |
1820 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; | |
d75bea67 | 1821 | if (folder) { |
1822 | if (name.IsNull()) | |
1823 | name = fRecPointsTitle ; | |
1824 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1825 | } | |
1826 | } | |
f07cab21 | 1827 | else if ( what.CompareTo("PreShoRecPoints") == 0 ) { |
1828 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ; | |
d75bea67 | 1829 | if (folder) { |
1830 | if (name.IsNull()) | |
1831 | name = fRecPointsTitle ; | |
1832 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1833 | } | |
1834 | } | |
f07cab21 | 1835 | /* |
d75bea67 | 1836 | else if ( what.CompareTo("TrackSegments") == 0 ) { |
1837 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; | |
1838 | if (folder) { | |
1839 | if (name.IsNull()) | |
1840 | name = fTrackSegmentsTitle ; | |
1841 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1842 | } | |
1843 | } | |
1844 | else if ( what.CompareTo("RecParticles") == 0 ) { | |
1845 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ; | |
1846 | if (folder) { | |
1847 | if (name.IsNull()) | |
1848 | name = fRecParticlesTitle ; | |
1849 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1850 | } | |
1851 | } | |
1852 | else if ( what.CompareTo("Alarms") == 0 ){ | |
1853 | if (name.IsNull() ) | |
1854 | emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ; | |
1855 | else { | |
1856 | folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ; | |
1857 | if (!folder) | |
1858 | emcalO = 0 ; | |
1859 | else | |
1860 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1861 | } | |
1862 | } | |
1863 | */ | |
ffa6d63b | 1864 | if (!emcalO) { |
d75bea67 | 1865 | if(fDebug) |
f07cab21 | 1866 | cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ; |
ffa6d63b | 1867 | return 0 ; |
1868 | } | |
1869 | return emcalO ; | |
1870 | } | |
1871 | ||
1872 | //____________________________________________________________________________ | |
1873 | const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const | |
1874 | { | |
1875 | // get the TTask named "what" from the folder | |
1876 | // folders are named like //Folders/Tasks/what/EMCAL/name | |
1877 | ||
1878 | TString search(what) ; | |
f07cab21 | 1879 | if ( what.CompareTo("Clusterizer") == 0 ) |
d75bea67 | 1880 | search = "Reconstructioner" ; |
1881 | else if ( what.CompareTo("TrackSegmentMaker") == 0 ) | |
1882 | search = "Reconstructioner" ; | |
1883 | else if ( what.CompareTo("PID") == 0 ) | |
1884 | search = "Reconstructioner" ; | |
1885 | else if ( what.CompareTo("QATasks") == 0 ) | |
1886 | search = "QA" ; | |
f07cab21 | 1887 | |
ffa6d63b | 1888 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ; |
1889 | ||
1890 | if (!tasks) { | |
1891 | cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ; | |
1892 | return 0 ; | |
1893 | } | |
1894 | ||
1895 | TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
1896 | if (!emcalT) { | |
1897 | cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ; | |
1898 | return 0 ; | |
1899 | } | |
1900 | ||
1901 | TList * list = emcalT->GetListOfTasks() ; | |
1902 | ||
1903 | if (what.CompareTo("SDigitizer") == 0) { | |
1904 | if ( name.IsNull() ) | |
1905 | name = fSDigitsTitle ; | |
1906 | } else if (what.CompareTo("Digitizer") == 0){ | |
1907 | if ( name.IsNull() ) | |
1908 | name = fDigitsTitle ; | |
f07cab21 | 1909 | } else if (what.CompareTo("Clusterizer") == 0){ |
d75bea67 | 1910 | if ( name.IsNull() ) |
1911 | name = fRecPointsTitle ; | |
1912 | name.Append(":clu") ; | |
1913 | } | |
f07cab21 | 1914 | // else if (what.CompareTo("TrackSegmentMaker") == 0){ |
1915 | // if ( name.IsNull() ) | |
1916 | // name = fTrackSegmentsTitle ; | |
1917 | // name.Append(":tsm") ; | |
1918 | // } | |
1919 | // else if (what.CompareTo("PID") == 0){ | |
1920 | // if ( name.IsNull() ) | |
1921 | // name = fRecParticlesTitle ; | |
1922 | // name.Append(":pid") ; | |
1923 | // } | |
1924 | // else if (what.CompareTo("QATasks") == 0){ | |
1925 | // if ( name.IsNull() ) | |
1926 | // return emcalT ; | |
1927 | // } | |
ffa6d63b | 1928 | |
1929 | TIter it(list) ; | |
1930 | TTask * task = 0 ; | |
1931 | while((task = static_cast<TTask *>(it.Next()) )){ | |
1932 | TString taskname(task->GetName()) ; | |
54b82aa4 | 1933 | if(taskname.BeginsWith(name)){ |
1934 | return task ;} | |
ffa6d63b | 1935 | } |
1936 | ||
d75bea67 | 1937 | if(fDebug) |
ffa6d63b | 1938 | cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ; |
1939 | return 0 ; | |
1940 | } | |
65549808 | 1941 | |
1942 | ||
1943 | //____________________________________________________________________________ | |
1944 | void AliEMCALGetter::RemoveTask(TString opt, TString name) const | |
1945 | { | |
1946 | // remove a task from the folder | |
1947 | // path is fTasksFolder/SDigitizer/PHOS/name | |
1948 | ||
1949 | TTask * task = 0 ; | |
1950 | TTask * emcal = 0 ; | |
1951 | TList * lofTasks = 0 ; | |
1952 | ||
b134c32f | 1953 | if (opt == "S") { // SDigitizer |
65549808 | 1954 | task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; |
1955 | if (!task) | |
1956 | return ; | |
1957 | } | |
1958 | ||
b134c32f | 1959 | else if (opt == "D") { // Digitizer |
65549808 | 1960 | task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; |
1961 | if (!task) | |
1962 | return ; | |
1963 | } | |
b134c32f | 1964 | else if (opt == "C") { // Clusterizer |
1965 | task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
1966 | if (!task) | |
1967 | return ; | |
1968 | } | |
65549808 | 1969 | else { |
b134c32f | 1970 | cerr << "WARNING: AliEMCALGetter::RemoveTask -> Unknown option " << opt.Data() << endl ; |
65549808 | 1971 | return ; |
1972 | } | |
b134c32f | 1973 | |
65549808 | 1974 | emcal = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ; |
1975 | if (!emcal) | |
1976 | return ; | |
1977 | lofTasks = emcal->GetListOfTasks() ; | |
1978 | if (!lofTasks) | |
1979 | return ; | |
1980 | TObject * obj = lofTasks->FindObject(name) ; | |
1981 | if (obj) | |
1982 | lofTasks->Remove(obj) ; | |
1983 | } | |
b134c32f | 1984 | |
65549808 | 1985 | //____________________________________________________________________________ |
1986 | void AliEMCALGetter::RemoveObjects(TString opt, TString name) const | |
1987 | { | |
1988 | // remove SDigits from the folder | |
1989 | // path is fSDigitsFolder/fHeaderFileName/name | |
1990 | ||
1991 | TFolder * emcal = 0 ; | |
1992 | TFolder * emcalmain = 0 ; | |
1993 | ||
b134c32f | 1994 | if (opt == "H") { // Hits |
65549808 | 1995 | emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ; |
1996 | if (!emcal) | |
1997 | return ; | |
1998 | name = "Hits" ; | |
1999 | } | |
2000 | ||
b134c32f | 2001 | else if ( opt == "S") { // SDigits |
65549808 | 2002 | emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; |
2003 | if (!emcalmain) | |
2004 | return ; | |
2005 | emcal = dynamic_cast<TFolder*>(emcalmain->FindObject(fHeaderFile)) ; | |
2006 | if (!emcal) | |
2007 | return ; | |
2008 | } | |
2009 | ||
b134c32f | 2010 | else if (opt == "D") { // Digits |
65549808 | 2011 | emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ; |
2012 | if (!emcal) | |
2013 | return ; | |
2014 | } | |
b134c32f | 2015 | |
2016 | else if (opt == "RT") { // Tower RecPoints | |
2017 | emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; | |
2018 | if (!emcal) | |
2019 | return ; | |
2020 | } | |
2021 | ||
2022 | else if (opt == "RP") { // Preshower RecPoints | |
2023 | emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ; | |
2024 | if (!emcal) | |
2025 | return ; | |
2026 | } | |
2027 | ||
65549808 | 2028 | else { |
2029 | cerr << "WARNING: AliEMCALGetter::RemoveObjects -> Unknown option " << opt.Data() << endl ; | |
2030 | return ; | |
2031 | } | |
2032 | ||
2033 | TObjArray * ar = dynamic_cast<TObjArray*>(emcal->FindObject(name)) ; | |
2034 | if (ar) { | |
2035 | emcal->Remove(ar) ; | |
2036 | ar->Delete() ; | |
2037 | delete ar ; | |
2038 | } | |
2039 | ||
2040 | if (opt == "S") | |
2041 | emcalmain->Remove(emcal) ; | |
2042 | ||
2043 | } | |
2044 | ||
2045 | //____________________________________________________________________________ | |
2046 | void AliEMCALGetter::RemoveSDigits() const | |
2047 | { | |
2048 | TFolder * emcal= dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; | |
2049 | if (!emcal) | |
2050 | return ; | |
2051 | ||
2052 | emcal->SetOwner() ; | |
2053 | emcal->Clear() ; | |
2054 | } |