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