Minor correction needed on Sun
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGetter.cxx
CommitLineData
4ae78bb1 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:
19 29.05.2001 Yuri Kharlov:
20 Everywhere reading the treese TTree->GetEvent(i)
21 is replaced by reading the branches TBranch->GetEntry(0)
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
31// different set of parameters.
32//
33// An example of how to use (see also class AliPHOSAnalyser):
34// AliPHOSGetter * gime = AliPHOSGetter::GetInstance("galice.root","test") ;
35// for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
36// AliPHOSRecParticle * part = gime->RecParticle(1) ;
37// ................
38// please->GetEvent(event) ; // reads new event from galice.root
39//
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 AliPHOSIndexToObject and make
44//*-- systematic usage of TFolders without changing the interface
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 "AliPHOSGetter.h"
63#include "AliPHOS.h"
64#include "AliPHOSDigitizer.h"
65#include "AliPHOSSDigitizer.h"
66#include "AliPHOSClusterizer.h"
67#include "AliPHOSClusterizerv1.h"
68#include "AliPHOSTrackSegmentMaker.h"
69#include "AliPHOSTrackSegmentMakerv1.h"
70#include "AliPHOSTrackSegment.h"
71#include "AliPHOSPID.h"
72#include "AliPHOSPIDv1.h"
73#include "AliPHOSGeometry.h"
74
75ClassImp(AliPHOSGetter)
76
77 AliPHOSGetter * AliPHOSGetter::fgObjGetter = 0 ;
78
79//____________________________________________________________________________
80AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle )
81{
82 //Initialize all lists
83
84 fHeaderFile = headerFile ;
b0bba0af 85 fBranchTitle = branchTitle ;
4ae78bb1 86 fSDigitsTitle = branchTitle ;
87 fDigitsTitle = branchTitle ;
88 fRecPointsTitle = branchTitle ;
89 fRecParticlesTitle = branchTitle ;
90 fTrackSegmentsTitle = branchTitle ;
91
92 fPrimaries = new TObjArray(1) ;
93
b0bba0af 94 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
518b8b75 95
eb9763ac 96 //open headers file
97 TFile * file = (TFile*) gROOT->GetFile(fHeaderFile.Data() ) ;
4ae78bb1 98
eb9763ac 99 if(file == 0){ //if file was not opened yet, read gAlice
100 if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
101 file = TFile::Open(fHeaderFile.Data(),"update") ;
102 else
103 file = new TFile(fHeaderFile.Data(),"update") ;
104
105 if (!file->IsOpen()) {
106 cerr << "ERROR : AliPHOSGetter::AliPHOSGetter -> Cannot open " << fHeaderFile.Data() << endl ;
107 abort() ;
108 }
109
110 gAlice = (AliRun *) file->Get("gAlice") ;
111
112 if (!gAlice) {
113 cerr << "ERROR : AliPHOSGetter::AliPHOSGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
114 abort() ;
115 }
4ae78bb1 116 }
117 }
b0bba0af 118 fDebug=0;
4ae78bb1 119}
4ae78bb1 120//____________________________________________________________________________
81bb1a45 121AliPHOSGetter::~AliPHOSGetter(){
122 //Here we remove all TFolders and TTasks with current title and file name
123 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
124
125 if(aliceF){
126 //Hits: the hierarchy is //YSALICE/WhiteBoard/Hits/PHOS/...
127 TFolder * hitsF = (TFolder*)aliceF->FindObject("WhiteBoard/Hits/PHOS") ;
128 if(hitsF){
129 TObject * h = hitsF->FindObject("hits") ;
130 hitsF->Remove(h) ;
131 }
132
133 //SDigits: the hierarchy is //YSALICE/WhiteBoard/SDigits/PHOS/...
134 TFolder * sdigitsF = (TFolder*)aliceF->FindObject("WhiteBoard/SDigits/PHOS") ;
135 if(sdigitsF){
136 TCollection* l = sdigitsF->GetListOfFolders() ;
137 TIter it(l) ;
138 TObject * sf ;
139 while((sf = it.Next()) )
140 sdigitsF->RecursiveRemove(sf) ;
141 }
142 }
143}
144//____________________________________________________________________________
4ae78bb1 145void AliPHOSGetter::CreateWhiteBoard() const
146{
147 // Posts a few item to the white board (folders)
148
149 // -- the geometry
b0bba0af 150 if(!PostGeometry() ) abort() ;
4ae78bb1 151
4ae78bb1 152}
153
154//____________________________________________________________________________
155AliPHOSGetter * AliPHOSGetter::GetInstance()
156{
157 // Returns the pointer of the unique instance already defined
158
159 AliPHOSGetter * rv = 0 ;
160 if ( fgObjGetter )
161 rv = fgObjGetter ;
162 else
163 cout << "AliPHOSGetter::GetInstance ERROR: not yet initialized" << endl ;
164
165 return rv ;
166}
167
168//____________________________________________________________________________
169AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile,
170 const char* branchTitle)
171{
172 // Creates and returns the pointer of the unique instance
173 // Must be called only when the environment has changed
174
b0bba0af 175 if ( fgObjGetter )
176 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
177 (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
178 return fgObjGetter ;
179 else
81bb1a45 180 fgObjGetter->~AliPHOSGetter() ; // delete it if already exists another version
b0bba0af 181
4ae78bb1 182 fgObjGetter = new AliPHOSGetter(headerFile,branchTitle) ;
183
184 // Posts a few item to the white board (folders)
185 fgObjGetter->CreateWhiteBoard() ;
b0bba0af 186
4ae78bb1 187 return fgObjGetter ;
188
189}
190
191//____________________________________________________________________________
192 const AliPHOS * AliPHOSGetter::PHOS() const
193{
194 // returns the PHOS object
195 return ( (AliPHOS*)gAlice->GetDetector("PHOS") );
196}
197
198//____________________________________________________________________________
199 const AliPHOSGeometry * AliPHOSGetter::PHOSGeometry() const
200{
201 // retrieves the geometr from the folder
202
203 TString path("YSAlice/WhiteBoard/Geometry/PHOS/") ;
204 path += PHOS()->GetTitle() ;
205 return (AliPHOSGeometry*)gROOT->FindObjectAny(path.Data()) ;
206}
207
208//____________________________________________________________________________
b0bba0af 209Bool_t AliPHOSGetter::PostGeometry() const
210{ //--------Geometry --------------
211
212 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
213
214 // the hierarchy is //YSALICE/WhiteBoard/Geometry/PHOS/
215 TFolder * geomF = (TFolder*)aliceF->FindObject("WhiteBoard/Geometry/PHOS") ;
216 if ( !geomF ) {
217 cerr << "ERROR: AliPHOSGetter::Post G -> Folder WhiteBoard/Geometry/PHOS/" << " not found!" << endl;
218 return kFALSE ;
219 }
220 else {
221 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance(PHOS()->GetTitle(),"") ;
222 geomF->Add((TObject*)geom) ;
223 }
224 return kTRUE;
225}
226//____________________________________________________________________________
227Bool_t AliPHOSGetter::PostHits(void) const
228{ //------- Hits ----------------------
dbad285c 229
b0bba0af 230 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
231
232 // the hierarchy is //YSALICE/WhiteBoard/SDigits/PHOS/Hits
233 TFolder * hitsF = (TFolder*)aliceF->FindObject("WhiteBoard/Hits/PHOS") ;
234 if ( !hitsF ) {
235 cerr << "ERROR: AliPHOSGetter::Post H -> Folder WhiteBoard/Hits/PHOS/" << " not found!" << endl;
236 return kFALSE ;
237 }
238
239 TObject * h = hitsF->FindObject("Hits") ;
240
241 if(!h){
242 TClonesArray *hits= new TClonesArray("AliPHOSHit",1000) ;
243 hits->SetName("Hits") ;
244 hitsF->Add(hits) ;
245 }
246
247 return kTRUE;
248}
249//____________________________________________________________________________
250TClonesArray ** AliPHOSGetter::HitsRef(void) const
251{ //------- Hits ----------------------
4ae78bb1 252
253 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
b0bba0af 254
255 // the hierarchy is //YSALICE/WhiteBoard/SDigits/PHOS/Hits
256 TFolder * hitsF = (TFolder*)aliceF->FindObject("WhiteBoard/Hits/PHOS") ;
257 if ( !hitsF ) {
258 cerr << "ERROR: AliPHOSGetter::Post H -> Folder WhiteBoard/Hits/PHOS/" << " not found!" << endl;
259 return 0;
260 }
4ae78bb1 261
b0bba0af 262 TObject * h = hitsF->FindObject("Hits") ;
263 if(!h)
264 return 0 ;
265 else
266 return (TClonesArray **) hitsF->GetListOfFolders()->GetObjectRef(h) ;
267
268}
269//____________________________________________________________________________
270Bool_t AliPHOSGetter::PostSDigits(const char * name, const char * headerFile) const
271{ //---------- SDigits -------------------------
272
273 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
274
275 // the hierarchy is //YSALICE/WhiteBoard/SDigits/PHOS/headerFile/sdigitsname
276 // because you can have sdigits from several hit files for mixing
277
278 TFolder * sdigitsF = (TFolder*)aliceF->FindObject("WhiteBoard/SDigits/PHOS") ;
279 TString subdir(headerFile) ;
280 TFolder * sdigitsF2 = (sdigitsF2=(TFolder*)sdigitsF->FindObject(subdir)) ;
281 if ( !sdigitsF2 )
282 sdigitsF2 = sdigitsF->AddFolder(subdir, "");
283
284 TObject * sd = sdigitsF2->FindObject(name );
285 if ( sd ) {
286 if (fDebug)
287 cerr <<"INFO: AliPHOSGetter::Post S -> Folder " << subdir
288 << " already exists!" << endl ;
289 }else{
4ae78bb1 290 TClonesArray * sdigits = new TClonesArray("AliPHOSDigit",1000) ;
b0bba0af 291 sdigits->SetName(name) ;
292 sdigitsF2->Add(sdigits) ;
293 }
294
295 return kTRUE;
296}
297//____________________________________________________________________________
298TClonesArray ** AliPHOSGetter::SDigitsRef(const char * name, const char * file) const
299{ //------- Hits ----------------------
4ae78bb1 300
b0bba0af 301 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
302
303 // the hierarchy is //YSALICE/WhiteBoard/SDigits/PHOS/Hits
304 TFolder * sdisF = (TFolder*)aliceF->FindObject("WhiteBoard/SDigits/PHOS") ;
305 if ( !sdisF ) {
306 cerr << "ERROR: AliPHOSGetter::SDRef -> Folder WhiteBoard/SDigits/PHOS/" << " not found!" << endl;
307 return 0;
308 }
309 TFolder * fileF ;
310 if(file)
311 fileF = (TFolder *) sdisF->FindObject(file) ;
312 else
313 fileF = (TFolder *) sdisF->FindObject(fHeaderFile) ;
314
315 if(!fileF)
316 abort() ;
317
318 TObject * dis = fileF->FindObject(name) ;
319 if(!dis)
320 return 0 ;
321 else
322 return (TClonesArray **) fileF->GetListOfFolders()->GetObjectRef(dis) ;
323
324}
325
326//____________________________________________________________________________
327Bool_t AliPHOSGetter::PostSDigitizer(AliPHOSSDigitizer * sdigitizer) const
328{ //---------- SDigitizer -------------------------
329
330 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
331
332 // the hierarchy is //YSALICE/tasks/Digitizer/PHOS/sdigitsname
333 TTask * sdigitsF = (TTask*)aliceF->FindObject("tasks/SDigitizer") ;
334 if ( !sdigitsF ) {
335 cerr << "ERROR: AliPHOSGetter::Post Ser -> Task tasks/SDigitizer" << " not found!" << endl;
336 return kFALSE ;
337 }
338 TTask * phos = (TTask*)sdigitsF->GetListOfTasks()->FindObject("PHOS") ;
339 if ( !phos ) {
340 cerr <<"ERROR: AliPHOSGetter::Post Ser -> tasks/SDigitizer/PHOS" << " not found!" << endl;
341 return kFALSE ;
342 }
343 AliPHOSSDigitizer * phossd = (AliPHOSSDigitizer *) phos->GetListOfTasks()->FindObject( sdigitizer->GetName() );
344 if (phossd) {
345 if (fDebug)
346 cout << "INFO: AliPHOSGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
347 phos->GetListOfTasks()->Remove(phossd) ;
348 }
349 phos->Add(sdigitizer) ;
350 return kTRUE;
351
352}
353//____________________________________________________________________________
354AliPHOSSDigitizer ** AliPHOSGetter::SDigitizerRef(const char * name) const
355{
356
357 TString path("tasks/SDigitizer") ;
4ae78bb1 358
b0bba0af 359 TFolder * aliceF = (TFolder*)gROOT ->FindObjectAny("YSAlice") ;
360 TTask * aliceT = (TTask*) aliceF->FindObject(path) ;
4ae78bb1 361
b0bba0af 362 if (!aliceT) {
363 cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << path << " not found!" << endl ;
364 abort() ;
365 }
4ae78bb1 366
b0bba0af 367 TTask * phosT = (TTask*) aliceT->GetListOfTasks()->FindObject("PHOS") ;
368 if (!phosT) {
369 cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << path << "/PHOS not found!" << endl ;
370 abort() ;
371 }
372 TList * l = phosT->GetListOfTasks() ;
373
374 TTask * task = (TTask*)l->FindObject(name) ;
375
376 return (AliPHOSSDigitizer **) l->GetObjectRef(task) ;
377
378}
379
380
381//____________________________________________________________________________
382Bool_t AliPHOSGetter::PostSDigitizer(const char * name, const char * file) const
383{ //---------- SDigitizer -------------------------
384
385 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
386
387 // the hierarchy is //YSALICE/tasks/Digitizer/PHOS/sdigitsname
388 TTask * sdigitsF = (TTask*)aliceF->FindObject("tasks/SDigitizer") ;
389 if ( !sdigitsF ) {
390 cerr << "ERROR: AliPHOSGetter::Post Ser -> Task tasks/SDigitizer" << " not found!" << endl;
391 return kFALSE ;
392 }
393 TTask * phos = (TTask*)sdigitsF->GetListOfTasks()->FindObject("PHOS") ;
394 if ( !phos ) {
395 cerr <<"ERROR: AliPHOSGetter::Post Ser -> tasks/SDigitizer/PHOS" << " not found!" << endl;
396 return kFALSE ;
397 }
398 TString sdname(name) ;
399 sdname.Append(":") ;
400 sdname.Append(file);
401 AliPHOSSDigitizer * phossd = (AliPHOSSDigitizer *) phos->GetListOfTasks()->FindObject( sdname );
402 if (!phossd) {
403 phossd = new AliPHOSSDigitizer() ;
404 //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
405 phossd->SetName(sdname) ;
406 phossd->SetTitle(file) ;
407 phos->Add(phossd) ;
408 }
409 return kTRUE;
410
411}
412//____________________________________________________________________________
413Bool_t AliPHOSGetter::PostDigits(const char * name) const
414{ //---------- Digits -------------------------
415
416 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
417
418 // the hierarchy is //YSALICE/WhiteBoard/Digits/PHOS/digitsname
419 TFolder * digitsF = (TFolder*)aliceF->FindObject("WhiteBoard/Digits/PHOS") ;
420 if ( !digitsF ) {
421 cerr << "ERROR: AliPHOSGetter::Post D -> Folder WhiteBoard/Digits/PHOS/" << " not found!" << endl;
422 return kFALSE ;
423 }
424 digitsF->SetTitle("") ;
425 TObject* dig = digitsF->FindObject( name ) ;
426 if ( !dig ) {
427 TClonesArray * digits = new TClonesArray("AliPHOSDigit",1000) ;
428 digits->SetName(name) ;
429 digitsF->Add(digits) ;
430 }
431 return kTRUE;
432}
433//____________________________________________________________________________
434TClonesArray ** AliPHOSGetter::DigitsRef(const char * name) const
435{
436
437 TFolder * digitsF = (TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/Digits/PHOS") ;
438
439 if ( !digitsF ) {
440 cerr << "ERROR: AliPHOSGetter::DRef -> Folder WhiteBoard/Digits/PHOS/" << " not found!" << endl;
441 return 0;
442 }
443
444 TObject * d = digitsF->FindObject(name) ;
445 if(!d)
446 return 0 ;
447 else
448 return (TClonesArray **) digitsF->GetListOfFolders()->GetObjectRef(d) ;
449
450}
451
452
453//____________________________________________________________________________
454Bool_t AliPHOSGetter::PostDigitizer(AliPHOSDigitizer * digitizer) const
455{ //---------- Digitizer -------------------------
456
457 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
458
459 // the hierarchy is //YSALICE/tasks/Digitizer/PHOS/digitsname
460 TTask * digitsF = (TTask*)aliceF->FindObject("tasks/Digitizer") ;
461 if ( !digitsF ) {
462 cerr << "ERROR: AliPHOSGetter::Post Der -> Task tasks/Digitizer" << " not found!" << endl;
463 return kFALSE ;
464 }
465 TTask * phos = (TTask*)digitsF->GetListOfTasks()->FindObject("PHOS") ;
466 if ( !phos ) {
467 cerr <<"ERROR: AliPHOSGetter::Post Der -> tasks/Digitizer/PHOS" << " not found!" << endl;
468 return kFALSE ;
469 } else {
470 AliPHOSDigitizer * phosd = (AliPHOSDigitizer*)phos->GetListOfTasks()->FindObject(digitizer->GetName()) ;
471 if (phosd) {
472 phosd->Delete() ;
473 phos->GetListOfTasks()->Remove(phosd) ;
4ae78bb1 474 }
b0bba0af 475 phos->Add((TTask*)digitizer) ;
476 return kTRUE;
477 }
478}
479//____________________________________________________________________________
480Bool_t AliPHOSGetter::PostDigitizer(const char * name) const
481{ //---------- Digitizer -------------------------
482
483 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
484
485 // the hierarchy is //YSALICE/tasks/Digitizer/PHOS/digitsname
486 TTask * digitsF = (TTask*)aliceF->FindObject("tasks/Digitizer") ;
487 if ( !digitsF ) {
488 cerr << "ERROR: AliPHOSGetter::Post Der -> Task tasks/Digitizer" << " not found!" << endl;
489 return kFALSE ;
490 }
491 TTask * phos = (TTask*)digitsF->GetListOfTasks()->FindObject("PHOS") ;
492 if ( !phos ) {
493 cerr <<"ERROR: AliPHOSGetter::Post Der -> tasks/Digitizer/PHOS" << " not found!" << endl;
494 return kFALSE ;
495 }
496
497 AliPHOSDigitizer * phosd = (AliPHOSDigitizer*)phos->GetListOfTasks()->FindObject(name) ;
498 if (!phosd) {
499 phosd = new AliPHOSDigitizer() ;
500 phosd->SetName(fDigitsTitle) ;
501 phosd->SetTitle(fHeaderFile) ;
502 phos->Add(phosd) ;
503 }
504 return kTRUE;
505}
506
507//____________________________________________________________________________
508AliPHOSDigitizer ** AliPHOSGetter::DigitizerRef(const char * name) const
509{
510
511 TString path("tasks/Digitizer") ;
512
513 TFolder * aliceF = (TFolder*)gROOT ->FindObjectAny("YSAlice") ;
514 TTask * aliceT = (TTask*) aliceF->FindObject(path) ;
515
516 if (!aliceT) {
517 cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << path << " not found!" << endl ;
518 abort() ;
519 }
520
521 TTask * phosT = (TTask*) aliceT->GetListOfTasks()->FindObject("PHOS") ;
522 if (!phosT) {
523 cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << path << "/PHOS not found!" << endl ;
524 abort() ;
525 }
526 TList * l = phosT->GetListOfTasks() ;
527
528 TTask * task = (TTask*)l->FindObject(name) ;
529
530 return (AliPHOSDigitizer **) l->GetObjectRef(task) ;
531
532}
533
534//____________________________________________________________________________
535Bool_t AliPHOSGetter::PostRecPoints(const char * name) const
536{ // -------------- RecPoints -------------------------------------------
537
538 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
539
540 // the hierarchy is //YSALICE/WhiteBoard/RecPoints/PHOS/emc/recpointsname
541 TFolder * emcrpF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/emc") ;
542
543 if ( !emcrpF ) {
544 cerr << "ERROR: AliPHOSGetter::Post R -> Folder WhiteBoard/RecPoints/PHOS/emc"
545 << " not found!" << endl;
546 return kFALSE ;
547 }
548 emcrpF->SetTitle("") ;
549 TObject * erp = emcrpF->FindObject(name ) ;
550 if ( !erp ) {
551 TObjArray * emcrp = new TObjArray(100) ;
552 emcrp->SetName(name) ;
553 emcrpF->Add(emcrp) ;
554 }
555
556 TFolder * cpvrpF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/cpv") ;
557
558 if ( !cpvrpF ) {
559 cerr << "ERROR: AliPHOSGetter::Post R -> Folder WhiteBoard/RecPoints/PHOS/cpv"
560 << " not found!" << endl;
561 return kFALSE ;
562 }
563 cpvrpF->SetTitle("") ;
564 TObject * crp = cpvrpF->FindObject( name ) ;
565 if ( !crp ) {
566 TObjArray * cpvrp = new TObjArray(100) ;
567 cpvrp->SetName(name) ;
568 cpvrpF->Add(cpvrp) ;
569 }
570 return kTRUE;
571}
572
573//____________________________________________________________________________
574TObjArray ** AliPHOSGetter::EmcRecPointsRef(const char * name) const
575{ // -------------- RecPoints -------------------------------------------
576
577 TFolder * emcrpF = (TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/RecPoints/PHOS/emc") ;
578
579 if ( !emcrpF ) {
580 cerr << "ERROR: AliPHOSGetter::EmcRecPointsRef -> Folder WhiteBoard/RecPoints/PHOS/emc"
581 << " not found!" << endl;
582 return 0 ;
583 }
584
585 TObject * erp = emcrpF->FindObject(name ) ;
586 if ( !erp ) {
587 return 0 ;
588 }
589 return (TObjArray **) emcrpF->GetListOfFolders()->GetObjectRef(erp) ;
590
591}
592//____________________________________________________________________________
593TObjArray ** AliPHOSGetter::CpvRecPointsRef(const char * name) const
594{ // -------------- RecPoints -------------------------------------------
595
596 TFolder * cpvrpF = (TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/RecPoints/PHOS/cpv") ;
597
598 if ( !cpvrpF ) {
599 cerr << "ERROR: AliPHOSGetter::CpvRecPointsRef -> Folder WhiteBoard/RecPoints/PHOS/cpv"
600 << " not found!" << endl;
601 return 0 ;
602 }
603 TObject * crp = cpvrpF->FindObject(name ) ;
604 if ( !crp ) {
605 return 0 ;
606 }
607 return (TObjArray **) cpvrpF->GetListOfFolders()->GetObjectRef(crp) ;
608
609}
610
611//____________________________________________________________________________
612Bool_t AliPHOSGetter::PostClusterizer(AliPHOSClusterizer * clu) const
613{ // ------------------ AliPHOSClusterizer ------------------------
614
615 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
616
617 // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/recpointsname
618 TTask * reF = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ;
619 if ( !reF ) {
620 cerr << "ERROR: AliPHOSGetter::Post Rer -> Task tasks/Reconstructioner" << " not found!" << endl;
621 return kFALSE ;
622 }
623
624 TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ;
625
626 if ( !phos ) {
627 cerr <<"ERROR: AliPHOSGetter::Post Rer -> tasks/Reconstructioner/PHOS" << " not found!" << endl;
628 return kFALSE ;
629 } else {
630 AliPHOSClusterizer * phoscl = (AliPHOSClusterizer*)phos->GetListOfTasks()->FindObject(clu->GetName()) ;
631 if (phoscl) {
632 if (fDebug)
633 cout << "INFO: AliPHOSGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
634 phos->GetListOfTasks()->Remove(phoscl) ;
4ae78bb1 635 }
b0bba0af 636 phos->Add(clu) ;
637 return kTRUE;
638 }
639}
640
641//____________________________________________________________________________
642AliPHOSClusterizer ** AliPHOSGetter::ClusterizerRef(const char * name) const
643{ // ------------------ AliPHOSClusterizer ------------------------
4ae78bb1 644
b0bba0af 645 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
646
647 // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/recpointsname
648 TTask * reF = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ;
649 if ( !reF ) {
650 cerr << "ERROR: AliPHOSGetter::Post Rer -> Task tasks/Reconstructioner" << " not found!" << endl;
651 return kFALSE ;
652 }
653
654 TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ;
655
656 if ( !phos ) {
657 cerr <<"ERROR: AliPHOSGetter::Post Rer -> tasks/Reconstructioner/PHOS" << " not found!" << endl;
658 return 0 ;
659 }
660 TList * l = phos->GetListOfTasks() ;
661 TIter it(l) ;
662 TTask * task ;
663 TTask * clu = 0 ;
664 TString cluname(name) ;
665 cluname+=":clu-" ;
666 while((task = (TTask *)it.Next()) ){
667 TString taskname(task->GetName()) ;
668 if(taskname.BeginsWith(cluname)){
669 clu = task ;
670 break ;
4ae78bb1 671 }
b0bba0af 672 }
673
674 if(clu)
675 return (AliPHOSClusterizer **) l->GetObjectRef(clu) ;
676 else
677 return 0 ;
678}
679
680//____________________________________________________________________________
681Bool_t AliPHOSGetter::PostClusterizer(const char * name) const
682{ // ------------------ AliPHOSClusterizer ------------------------
683
684 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
685
686 // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/recpointsname
687 TTask * reF = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ;
688 if ( !reF ) {
689 cerr << "ERROR: AliPHOSGetter::Post Rer -> Task tasks/Reconstructioner" << " not found!" << endl;
690 return kFALSE ;
691 }
692
693 TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ;
694
695 if ( !phos ) {
696 cerr <<"ERROR: AliPHOSGetter::Post Rer -> tasks/Reconstructioner/PHOS" << " not found!" << endl;
697 return kFALSE ;
698 }
699 AliPHOSClusterizer * phoscl = new AliPHOSClusterizerv1() ;
700 TString clun(name) ;
701 clun+=":clu-v1" ;
702 phoscl->SetName(clun) ;
703 phos->Add(phoscl) ;
704 return kTRUE;
705
706}
707//____________________________________________________________________________
708Bool_t AliPHOSGetter::PostTrackSegments(const char * name) const
709{ // ---------------TrackSegments -----------------------------------
710
711 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
712 // the hierarchy is //YSALICE/WhiteBoard/TrackSegments/PHOS/tracksegmentsname
713 TFolder * tracksegmentsF = (TFolder*)aliceF->FindObject("WhiteBoard/TrackSegments/PHOS") ;
714 tracksegmentsF->SetTitle("") ;
715 if ( !tracksegmentsF) {
716 cerr << "ERROR: AliPHOSGetter::Post T -> Folder WhiteBoard/TrackSegments/PHOS" << " not found!" << endl;
717 return kFALSE ;
718 }
719 TObject * tss = tracksegmentsF->FindObject(name ) ;
720 if (!tss) {
721 TClonesArray * ts = new TClonesArray("AliPHOSTrackSegment",100) ;
722 ts->SetName(name) ;
723 tracksegmentsF->Add(ts) ;
724 }
725 return kTRUE;
726}
727
728//____________________________________________________________________________
729TClonesArray ** AliPHOSGetter::TrackSegmentsRef(const char * name) const
730{ // ---------------TrackSegments -----------------------------------
731
732 TFolder * phosF = (TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/TrackSegments/PHOS") ;
733 if ( !phosF) {
734 cerr << "ERROR: AliPHOSGetter::TrackSegmentsRef -> Folder WhiteBoard/TrackSegments/PHOS" << " not found!" << endl;
735 return 0 ;
736 }
737
738 TObject * tss = phosF->FindObject(name) ;
739 if (!tss) {
740 return 0 ;
741 }
742 return (TClonesArray **) phosF->GetListOfFolders()->GetObjectRef(tss) ;
743}
744
745//____________________________________________________________________________
746Bool_t AliPHOSGetter::PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsmaker) const
747{ //------------Track Segment Maker ------------------------------
748
749 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
750
751 // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/tracksegmentsname
752 TTask * reF = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ;
753 if ( !reF ) {
754 cerr << "ERROR: AliPHOSGetter::Post Ter -> Task tasks/Reconstructioner" << " not found!" << endl;
755 return kFALSE ;
756 }
757 TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ;
758 if ( !phos ) {
759 cerr <<"ERROR: AliPHOSGetter::Post Ter -> tasks/Reconstructioner/PHOS" << " not found!" << endl;
760 return kFALSE ;
761 }
762
763 AliPHOSTrackSegmentMaker * phosts =
764 (AliPHOSTrackSegmentMaker*)phos->GetListOfTasks()->FindObject(tsmaker->GetName()) ;
765 if (phosts) {
766 phosts->Delete() ;
767 phos->GetListOfTasks()->Remove(phosts) ;
768 }
769 phos->Add(tsmaker) ;
770 return kTRUE;
771
772}
773//____________________________________________________________________________
774Bool_t AliPHOSGetter::PostTrackSegmentMaker(const char * name) const
775{ //------------Track Segment Maker ------------------------------
776
777 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
778
779 // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/tracksegmentsname
780 TTask * reF = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ;
781 if ( !reF ) {
782 cerr << "ERROR: AliPHOSGetter::Post Ter -> Task tasks/Reconstructioner" << " not found!" << endl;
783 return kFALSE ;
784 }
785 TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ;
786 if ( !phos ) {
787 cerr <<"ERROR: AliPHOSGetter::Post Ter -> tasks/Reconstructioner/PHOS" << " not found!" << endl;
788 return kFALSE ;
789 }
790 AliPHOSTrackSegmentMaker * phosts =
791 (AliPHOSTrackSegmentMaker*)phos->GetListOfTasks()->FindObject(name) ;
792 if (!phosts) {
793 phosts = new AliPHOSTrackSegmentMakerv1() ;
794 TString tsn(name);
795 tsn+=":tsm-v1" ;
796 phosts->SetName(tsn) ;
797 phos->Add(phosts) ;
798 }
799 return kTRUE;
800
801}
802//____________________________________________________________________________
803AliPHOSTrackSegmentMaker ** AliPHOSGetter::TSMakerRef(const char * name) const
804{ //------------Track Segment Maker ------------------------------
805
806 TTask * reF = (TTask*)gROOT->FindObjectAny("YSAlice/tasks/Reconstructioner") ;
807 if ( !reF ) {
808 cerr << "ERROR: AliPHOSGetter::TrackSegmentMakerRef -> Task tasks/Reconstructioner"
809 << " not found!" << endl;
810 return 0 ;
811 }
812
813 TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ;
814 if ( !phos ) {
815 cerr << "ERROR: AliPHOSGetter::TrackSegmentMakerRef -> Task tasks/Reconstructioner/PHOS"
816 << " not found!" << endl;
817 return 0 ;
818 }
819 TList * l = phos->GetListOfTasks() ;
820 TIter it(l) ;
821 TTask * task ;
822 TTask * tsm = 0 ;
823 TString tsmname(name) ;
824 tsmname+=":tsm-" ;
825 while((task = (TTask *)it.Next()) ){
826 TString taskname(task->GetName()) ;
827 if(taskname.BeginsWith(tsmname)){
828 tsm = task ;
829 break ;
4ae78bb1 830 }
b0bba0af 831 }
832
833 if(tsm)
834 return (AliPHOSTrackSegmentMaker **) l->GetObjectRef(tsm) ;
835 else
836 return 0 ;
837
838}
839
840//____________________________________________________________________________
841Bool_t AliPHOSGetter::PostRecParticles(const char * name) const
842{ // -------------------- RecParticles ------------------------
843
844 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
845
846 // the hierarchy is //YSALICE/WhiteBoard/RecParticles/PHOS/recparticlesname
847 TFolder * recparticlesF = (TFolder*)aliceF->FindObject("WhiteBoard/RecParticles/PHOS") ;
848 recparticlesF->SetTitle("") ;
849 if ( !recparticlesF) {
850 cerr << "ERROR: AliPHOSGetter::Post P -> Folder WhiteBoard/RecParticles/PHOS" << " not found!" << endl;
851 return kFALSE ;
852 }
853 TObject * rps = recparticlesF->FindObject( name ) ;
854 if ( !rps ) {
855 TClonesArray * rp = new TClonesArray("AliPHOSRecParticle",100) ;
856 rp->SetName(name) ;
857 recparticlesF->Add(rp) ;
858 }
859 return kTRUE;
860}
861//____________________________________________________________________________
862TClonesArray ** AliPHOSGetter::RecParticlesRef(const char * name) const
863{ // ---------------TrackSegments -----------------------------------
864
865 TFolder * tsF = (TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/RecParticles/PHOS") ;
866 if ( !tsF) {
867 cerr << "ERROR: AliPHOSGetter::RecParticlesRef -> Folder WhiteBoard/RecParticles/PHOS" << " not found!" << endl;
868 return 0 ;
869 }
870 TObject * tss = tsF->FindObject(name ) ;
871 if (!tss) {
872 return 0 ;
873 }
874 return (TClonesArray **) tsF->GetListOfFolders()->GetObjectRef(tss) ;
875}
876
877//____________________________________________________________________________
878Bool_t AliPHOSGetter::PostPID(AliPHOSPID * pid) const
879{
880 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
881
882 // ------------AliPHOS PID -----------------------------
883 // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/recparticlesname
884 TTask * reF = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ;
885 if ( !reF ) {
886 cerr << "ERROR: AliPHOSGetter::Post Per -> Task tasks/Reconstructioner" << " not found!" << endl;
887 return kFALSE ;
888 }
889 TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ;
890 if ( !phos ) {
891 cerr <<"ERROR: AliPHOSGetter::Post Per -> tasks/Reconstructioner/PHOS" << " not found!" << endl;
892 return kFALSE ;
4ae78bb1 893 }
b0bba0af 894 AliPHOSPID * phospid = (AliPHOSPID*)phos->GetListOfTasks()->FindObject(pid->GetName()) ;
895 if (phospid) {
896 if (fDebug)
897 cout << "INFO: AliPHOSGetter::Post Per -> Task " << pid->GetName()
898 << " already exists" << endl ;
899 phos->GetListOfTasks()->Remove(phospid) ;
900 }
901
902 phos->Add(pid) ;
903 return kTRUE;
904}
905//____________________________________________________________________________
906Bool_t AliPHOSGetter::PostPID(const char * name) const
907{
908 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
909
910 // ------------AliPHOS PID -----------------------------
911 // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/recparticlesname
912 TTask * reF = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ;
913 if ( !reF ) {
914 cerr << "ERROR: AliPHOSGetter::Post Per -> Task tasks/Reconstructioner" << " not found!" << endl;
915 return kFALSE ;
916 }
917 TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ;
918 if ( !phos ) {
919 cerr <<"ERROR: AliPHOSGetter::Post Per -> tasks/Reconstructioner/PHOS" << " not found!" << endl;
920 return kFALSE ;
921 }
4ae78bb1 922
b0bba0af 923 TList * l = phos->GetListOfTasks() ;
924 TIter it(l) ;
925 TString pidname(name) ;
926 pidname+=":pid" ;
927 TTask * task ;
928 while((task = (TTask *)it.Next()) ){
929 TString taskname(task->GetName()) ;
930 if(taskname.BeginsWith(pidname))
931 return kTRUE ;
932 }
933
934 AliPHOSPIDv1 * phospid = new AliPHOSPIDv1() ;
935 pidname+="-v1" ;
936 phospid->SetName(pidname) ;
937 phos->Add(phospid) ;
938
939 return kTRUE;
940}
941//____________________________________________________________________________
942AliPHOSPID ** AliPHOSGetter::PIDRef(const char * name) const
943{ //------------PID ------------------------------
944
945 TTask * reF = (TTask*)gROOT->FindObjectAny("YSAlice/tasks/Reconstructioner") ;
946 if ( !reF ) {
947 cerr << "ERROR: AliPHOSGetter::PIDRef -> Task tasks/Reconstructioner"
948 << " not found!" << endl;
949 return 0 ;
950 }
951
952 TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ;
953
954 if ( !phos ) {
955 cerr << "ERROR: AliPHOSGetter::PIDRef -> Task tasks/Reconstructioner/PHOS"
956 << " not found!" << endl;
957 return 0 ;
958 }
959 TList * l = phos->GetListOfTasks() ;
960 TIter it(l) ;
961 TTask * task ;
962 TTask * pid = 0 ;
963 TString pidname(name) ;
964 pidname+=":pid-" ;
965 while((task = (TTask *)it.Next()) ){
966 TString taskname(task->GetName()) ;
967 if(taskname.BeginsWith(pidname)){
968 pid = task ;
969 break ;
970 }
4ae78bb1 971 }
b0bba0af 972
973 if(pid)
974 return (AliPHOSPID **) l->GetObjectRef(pid) ;
975 else
976 return 0 ;
977
978}
979
980//____________________________________________________________________________
981Bool_t AliPHOSGetter::PostQA( const char * name) const
982{
983 TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ;
984
985 // ------------------ QA ---------------------------------
986 // the hierarchy is //YSALICE/WhiteBoard/Alarms/PHOS/
987
988 TFolder * alarmsF = new TFolder() ;
989 TString alarmsName ;
990 if (name)
991 alarmsName = name ;
992 else
993 alarmsName = "Alarm with no name" ;
994 alarmsF->SetName( alarmsName.Data() ) ;
995 alarmsF->SetTitle("") ;
996 TFolder * qaaF = (TFolder*)aliceF->FindObject("WhiteBoard/QAAlarms") ;
997 if ( !qaaF) {
998 cerr << "ERROR: AliPHOSGetter::Post QA -> Folder WhiteBoard/QAAlarms/" << " not found!" << endl;
999 return kFALSE;
1000 }
1001 if ( qaaF->FindObject( alarmsName.Data() ) )
1002 qaaF->RecursiveRemove( qaaF->FindObject( alarmsName.Data() ) ) ;
1003
1004 qaaF->Add(alarmsF) ;
1005
1006 return kTRUE;
4ae78bb1 1007}
1008
1009//____________________________________________________________________________
1010const TParticle * AliPHOSGetter::Primary(Int_t index) const
1011{
1012 // Return primary particle numbered by <index>
1013
1014 if(index < 0)
1015 return 0 ;
1016
1017 Int_t primaryIndex = index % 10000000 ;
1018 Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ;
1019
1020 if ( primaryList > 0 ) {
1021 cout << " Getter does not support currently Mixing of primary " << endl ;
1022 cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
1023 return 0;
1024 }
1025
1026 return gAlice->Particle(primaryIndex) ;
1027
1028}
1029
1030//____________________________________________________________________________
1031void AliPHOSGetter::ReadTreeD()
1032{
1033 // Read the digit tree gAlice->TreeD()
1034 if(gAlice->TreeD()== 0){
1035 cerr << "ERROR: AliPHOSGetter::ReadTreeD: can not read TreeD " << endl ;
1036 return ;
1037 }
1038
1039 TObjArray * lob = (TObjArray*)gAlice->TreeD()->GetListOfBranches() ;
1040 TIter next(lob) ;
1041 TBranch * branch = 0 ;
1042 TBranch * digitsbranch = 0 ;
1043 TBranch * digitizerbranch = 0 ;
1044 Bool_t phosfound = kFALSE, digitizerfound = kFALSE ;
1045
1046 while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) {
1047 if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1048 digitsbranch = branch ;
1049 phosfound = kTRUE ;
1050 }
1051 else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1052 digitizerbranch = branch ;
1053 digitizerfound = kTRUE ;
1054 }
1055 }
1056
1057 if ( !phosfound || !digitizerfound ) {
81bb1a45 1058 cout << "WARNING: AliPHOSGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
b0bba0af 1059 << fDigitsTitle << endl ;
4ae78bb1 1060 return ;
1061 }
1062
b0bba0af 1063 //read digits
1064 if(!Digits(fDigitsTitle) )
1065 PostDigits(fDigitsTitle);
1066 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1067 digitsbranch->GetEntry(0) ;
4ae78bb1 1068
b0bba0af 1069
1070 // read the Digitizer
1071 if(!Digitizer(fDigitsTitle))
1072 PostDigitizer(fDigitsTitle) ;
1073 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
4ae78bb1 1074 digitizerbranch->GetEntry(0) ;
b0bba0af 1075
4ae78bb1 1076
1077}
1078
1079//____________________________________________________________________________
1080void AliPHOSGetter::ReadTreeH()
1081{
1082 // Read the first entry of PHOS branch in hit tree gAlice->TreeH()
1083
1084 if(gAlice->TreeH()== 0){
1085 cerr << "ERROR: AliPHOSGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1086 return ;
1087 }
1088
b0bba0af 1089 TBranch * hitsbranch = (TBranch*)gAlice->TreeH()->GetBranch("PHOS") ;
4ae78bb1 1090 if ( !hitsbranch ) {
81bb1a45 1091 cout << "WARNING: AliPHOSGetter::ReadTreeH -> Cannot find branch PHOS" << endl ;
b0bba0af 1092 return ;
4ae78bb1 1093 }
b0bba0af 1094 if(!Hits())
1095 PostHits() ;
1096
1097 hitsbranch->SetAddress(HitsRef()) ;
1098
1099 hitsbranch->GetEntry(0) ;
1100
4ae78bb1 1101}
1102
1103//____________________________________________________________________________
b0bba0af 1104void AliPHOSGetter::Track(Int_t itrack)
1105{
1106 // Read the first entry of PHOS branch in hit tree gAlice->TreeH()
1107
1108 if(gAlice->TreeH()== 0){
1109 cerr << "ERROR: AliPHOSGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1110 return ;
1111 }
1112
1113 TBranch * hitsbranch = (TBranch*)gAlice->TreeH()->GetListOfBranches()->FindObject("PHOS") ;
1114 if ( !hitsbranch ) {
81bb1a45 1115 cout << "WARNING: AliPHOSGetter::ReadTreeH -> Cannot find branch PHOS" << endl ;
b0bba0af 1116 return ;
1117 }
1118 if(!Hits())
1119 PostHits() ;
1120 hitsbranch->SetAddress(HitsRef()) ;
1121 hitsbranch->GetEntry(itrack) ;
1122
1123
1124}
1125//____________________________________________________________________________
4ae78bb1 1126void AliPHOSGetter::ReadTreeQA()
1127{
1128 // Read the digit tree gAlice->TreeQA()
1129 // so far only PHOS knows about this Tree
1130
1131 if(PHOS()->TreeQA()== 0){
1132 cerr << "ERROR: AliPHOSGetter::ReadTreeQA: can not read TreeQA " << endl ;
1133 return ;
1134 }
1135
1136 TBranch * qabranch = PHOS()->TreeQA()->GetBranch("PHOS") ;
1137 if (!qabranch) {
81bb1a45 1138 cout << "WARNING: AliPHOSGetter::ReadTreeQA -> Cannot find QA Alarms for PHOS" << endl ;
4ae78bb1 1139 return ;
1140 }
b0bba0af 1141
1142 // Post the QA Alarms
1143 PostQA("PHOS") ;
4ae78bb1 1144 TFolder * alarmsF = Alarms() ;
1145 alarmsF->Clear() ;
1146 qabranch->SetAddress(&alarmsF) ;
1147 qabranch->GetEntry(0) ;
1148
1149}
1150
1151//____________________________________________________________________________
1152void AliPHOSGetter::ReadTreeR()
1153{
1154 // Read the reconstrunction tree gAlice->TreeR()
1155
1156 if(gAlice->TreeR()== 0){
1157 cout << "ERROR: AliPHOSGetter::ReadTreeR: can not read TreeR " << endl ;
b0bba0af 1158 return ;
4ae78bb1 1159 }
b0bba0af 1160
4ae78bb1 1161 // RecPoints
1162 TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
1163 TIter next(lob) ;
1164 TBranch * branch = 0 ;
1165 TBranch * emcbranch = 0 ;
1166 TBranch * cpvbranch = 0 ;
1167 TBranch * clusterizerbranch = 0 ;
1168 Bool_t phosemcrpfound = kFALSE, phoscpvrpfound = kFALSE, clusterizerfound = kFALSE ;
1169
b0bba0af 1170 while ( (branch = (TBranch*)next()) && (!phosemcrpfound || !phoscpvrpfound || !clusterizerfound) )
1171 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
1172 if ( strcmp(branch->GetName(), "PHOSEmcRP")==0) {
1173 emcbranch = branch ;
1174 phosemcrpfound = kTRUE ;
1175 }
1176 else if ( strcmp(branch->GetName(), "PHOSCpvRP")==0) {
1177 cpvbranch = branch ;
1178 phoscpvrpfound = kTRUE ;
1179 }
1180 else if(strcmp(branch->GetName(), "AliPHOSClusterizer")==0){
1181 clusterizerbranch = branch ;
1182 clusterizerfound = kTRUE ;
1183 }
4ae78bb1 1184 }
4ae78bb1 1185
b0bba0af 1186 if ( !phosemcrpfound ) {
81bb1a45 1187 cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find EmcRecPoints with title "
b0bba0af 1188 << fRecPointsTitle << endl ;
4ae78bb1 1189 return ;
1190 }
b0bba0af 1191 if ( !phoscpvrpfound ) {
81bb1a45 1192 cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find CpvRecPoints with title "
b0bba0af 1193 << fRecPointsTitle << endl ;
1194 return ;
1195 }
1196 if ( !clusterizerfound ) {
81bb1a45 1197 cout << "WARNING: AliPHOSGetter::ReadTreeR -> Can not find Clusterizer with title "
b0bba0af 1198 << fRecPointsTitle << endl ;
1199 return ;
1200 }
1201
1202 // Read and Post the RecPoints
1203 if(!EmcRecPoints(fRecPointsTitle) )
1204 PostRecPoints(fRecPointsTitle) ;
1205 emcbranch->SetAddress(EmcRecPointsRef(fRecPointsTitle)) ;
1206 emcbranch->GetEntry(0) ;
1207
1208 cpvbranch->SetAddress(CpvRecPointsRef(fRecPointsTitle)) ;
1209 cpvbranch->GetEntry(0) ;
1210
1211 if(!Clusterizer(fRecPointsTitle) )
1212 PostClusterizer(fRecPointsTitle) ;
1213 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
4ae78bb1 1214 clusterizerbranch->GetEntry(0) ;
1215
b0bba0af 1216
1217 //------------------- TrackSegments ---------------------
4ae78bb1 1218 next.Reset() ;
1219 TBranch * tsbranch = 0 ;
1220 TBranch * tsmakerbranch = 0 ;
1221 Bool_t phostsfound = kFALSE, tsmakerfound = kFALSE ;
b0bba0af 1222
1223 while ( (branch = (TBranch*)next()) && (!phostsfound || !tsmakerfound) )
1224 if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
1225 if ( strcmp(branch->GetName(), "PHOSTS")==0){
1226 tsbranch = branch ;
1227 phostsfound = kTRUE ;
1228 }
1229 else if(strcmp(branch->GetName(), "AliPHOSTrackSegmentMaker")==0) {
1230 tsmakerbranch = branch ;
1231 tsmakerfound = kTRUE ;
1232 }
4ae78bb1 1233 }
b0bba0af 1234
4ae78bb1 1235 if ( !phostsfound || !tsmakerfound ) {
81bb1a45 1236 cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
b0bba0af 1237 << fTrackSegmentsTitle << endl ;
4ae78bb1 1238 return ;
1239 }
b0bba0af 1240
1241 // Read and Post the TrackSegments
1242 if(!TrackSegments(fTrackSegmentsTitle))
1243 PostTrackSegments(fTrackSegmentsTitle) ;
1244 tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1245 tsbranch->GetEntry(0) ;
1246
1247 // Read and Post the TrackSegment Maker
1248 if(!TrackSegmentMaker(fTrackSegmentsTitle))
1249 PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1250 tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
4ae78bb1 1251 tsmakerbranch->GetEntry(0) ;
b0bba0af 1252
1253
1254 //------------ RecParticles ----------------------------
4ae78bb1 1255 next.Reset() ;
1256 TBranch * rpabranch = 0 ;
1257 TBranch * pidbranch = 0 ;
1258 Bool_t phosrpafound = kFALSE, pidfound = kFALSE ;
1259
b0bba0af 1260 while ( (branch = (TBranch*)next()) && (!phosrpafound || !pidfound) )
1261 if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1262 if ( strcmp(branch->GetName(), "PHOSRP")==0) {
1263 rpabranch = branch ;
1264 phosrpafound = kTRUE ;
1265 }
1266 else if (strcmp(branch->GetName(), "AliPHOSPID")==0) {
1267 pidbranch = branch ;
1268 pidfound = kTRUE ;
1269 }
4ae78bb1 1270 }
b0bba0af 1271
4ae78bb1 1272 if ( !phosrpafound || !pidfound ) {
81bb1a45 1273 cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
b0bba0af 1274 << fRecParticlesTitle << endl ;
4ae78bb1 1275 return ;
1276 }
b0bba0af 1277
1278 // Read and Post the RecParticles
1279 if(!RecParticles(fRecParticlesTitle))
1280 PostRecParticles(fRecParticlesTitle) ;
1281 rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1282 rpabranch->GetEntry(0) ;
1283
1284 // Read and Post the PID
1285 if(!PID(fRecParticlesTitle))
1286 PostPID(fRecParticlesTitle) ;
1287 pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
4ae78bb1 1288 pidbranch->GetEntry(0) ;
4ae78bb1 1289
4ae78bb1 1290
1291}
1292
1293//____________________________________________________________________________
b0bba0af 1294void AliPHOSGetter::ReadTreeS(Int_t event)
4ae78bb1 1295{
1296 // Read the summable digits tree gAlice->TreeS()
b0bba0af 1297
1298 // loop over all opened files and read their SDigits to the White Board
1299 TFolder * phosF = (TFolder *)gROOT->FindObjectAny("YSAlice/WhiteBoard/SDigits/PHOS") ;
1300 TCollection * folderslist = phosF->GetListOfFolders() ;
1301
1302 //Add current file to list if it is not there yet
1303 if ( (fHeaderFile != "aliroot") && ( !folderslist->Contains(fHeaderFile) ) ){
1304 phosF->AddFolder(fHeaderFile, "");
1305 folderslist = phosF->GetListOfFolders() ;
1306 }
1307
1308 TIter next(folderslist) ;
1309 TFolder * folder = 0 ;
1310 TFile * file;
1311 TTree * treeS = 0;
1312 while ( (folder = (TFolder*)next()) ) {
1313 if(fHeaderFile.CompareTo(folder->GetName()) == 0 )
1314 treeS=gAlice->TreeS() ;
1315 else{
1316 file = (TFile*)gROOT->GetFile(folder->GetName());
1317 file->cd() ;
1318
1319 // Get SDigits Tree header from file
1320 TString treeName("TreeS") ;
1321 treeName += event ;
1322 treeS = (TTree*)gDirectory->Get(treeName.Data());
1323 }
1324 if(treeS==0){
1325 cerr << "ERROR: AliPHOSGetter::ReadTreeS There is no SDigit Tree" << endl;
1326 return ;
1327 }
1328
1329 //set address of the SDigits and SDigitizer
1330 TBranch * sdigitsBranch = 0;
1331 TBranch * sdigitizerBranch = 0;
1332 TBranch * branch = 0 ;
1333 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
1334 TIter next(lob) ;
1335 Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ;
1336
1337 while ( (branch = (TBranch*)next()) && (!phosfound || !sdigitizerfound) ) {
1338 if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1339 phosfound = kTRUE ;
1340 sdigitsBranch = branch ;
1341 }
1342
1343 else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1344 sdigitizerfound = kTRUE ;
1345 sdigitizerBranch = branch ;
1346 }
1347 }
1348 if ( !phosfound || !sdigitizerfound ) {
81bb1a45 1349 cout << "WARNING: AliPHOSDigitizer::ReadSDigits -> Digits and/or Digitizer branch with name " << GetName()
b0bba0af 1350 << " not found" << endl ;
1351 return ;
1352 }
1353
1354 if ( !folder->FindObject(fSDigitsTitle) )
1355 PostSDigits(fSDigitsTitle,folder->GetName()) ;
1356 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
1357 sdigitsBranch->GetEntry(0) ;
1358
1359 TString sdname(fSDigitsTitle) ;
1360 sdname+=":" ;
1361 sdname+=folder->GetName() ;
1362 if(!SDigitizer(sdname) )
1363 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
1364 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1365 sdigitizerBranch->GetEntry(0) ;
1366
1367 }
1368
1369 // After SDigits have been read from all files, return to the first one
1370
1371 next.Reset();
1372 folder = (TFolder*)next();
1373 if(folder){
1374 file = (TFile*)gROOT->GetFile(folder->GetName());
1375 file ->cd() ;
4ae78bb1 1376 }
1377
b0bba0af 1378}
1379//____________________________________________________________________________
1380void AliPHOSGetter::ReadTreeS(TTree * treeS, Int_t input)
1381{ // Read the summable digits fron treeS()
1382
1383 TString filename("mergefile") ;
1384 filename+= input ;
1385 TFolder * phosF =(TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/SDigits/PHOS") ;
1386 TFolder * folder=(TFolder*)phosF->FindObject(filename) ;
1387 //set address of the SDigits and SDigitizer
1388 TBranch * sdigitsBranch = 0;
1389 TBranch * sdigitizerBranch = 0;
1390 TBranch * branch = 0 ;
1391 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
4ae78bb1 1392 TIter next(lob) ;
4ae78bb1 1393 Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ;
1394
1395 while ( (branch = (TBranch*)next()) && (!phosfound || !sdigitizerfound) ) {
b0bba0af 1396 if ( strcmp(branch->GetName(), "PHOS")==0) {
4ae78bb1 1397 phosfound = kTRUE ;
b0bba0af 1398 sdigitsBranch = branch ;
4ae78bb1 1399 }
b0bba0af 1400
1401 else if ( strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) {
4ae78bb1 1402 sdigitizerfound = kTRUE ;
b0bba0af 1403 sdigitizerBranch = branch ;
4ae78bb1 1404 }
1405 }
4ae78bb1 1406 if ( !phosfound || !sdigitizerfound ) {
81bb1a45 1407 cout << "WARNING: AliPHOSGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
4ae78bb1 1408 return ;
1409 }
4ae78bb1 1410
b0bba0af 1411 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
1412 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
4ae78bb1 1413
b0bba0af 1414 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
1415
1416 TString sdname(sdigitsBranch->GetTitle()) ;
1417 sdname+=":" ;
1418 sdname+=filename ;
1419 if(!SDigitizer(sdigitsBranch->GetTitle()) )
1420 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
1421 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1422
1423 sdigitsBranch->GetEntry(0) ;
1424 sdigitizerBranch->GetEntry(0) ;
1425
1426}
4ae78bb1 1427
4ae78bb1 1428
1429//____________________________________________________________________________
1430void AliPHOSGetter::ReadPrimaries()
1431{
1432 // Reads specific branches of primaries
1433
1434 fNPrimaries = gAlice->GetNtrack();
1435
1436 // //Check, is it necessary to open new files
1437 // TArrayI* events = fDigitizer->GetCurrentEvents() ;
1438 // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
1439// Int_t input ;
1440// for(input = 0; input < filenames->GetEntriesFast(); input++){
1441
1442// TObjString * filename = (TObjString *) filenames->At(input) ;
1443
1444// //Test, if this file already open
1445// TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
1446// if(file == 0)
1447// file = new TFile( filename->GetString()) ;
1448// file->cd() ;
1449
1450// // Get Kine Tree from file
1451// // char treeName[20];
1452// // sprintf(treeName,"TreeK%d",events->At(input));
1453// // TTree * treeK = (TTree*)gDirectory->Get(treeName);
1454// // if (treeK)
1455// // treeK->SetBranchAddress("Particles", &fParticleBuffer);
1456// // else
1457// // cout << "AliPHOSGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
1458
1459// // // Create the particle stack
1460// // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
1461// // // Build the pointer list
1462// // if(fParticleMap) { <----
1463// // fParticleMap->Clear();
1464// // fParticleMap->Expand(treeK->GetEntries());
1465// // } else
1466// // fParticleMap = new TObjArray(treeK->GetEntries());
1467
1468// // From gAlice->Particle(i)
1469
1470
1471// // if(!(*fParticleMap)[i]) {
1472// // Int_t nentries = fParticles->GetEntries();
1473
1474// // // algorithmic way of getting entry index
1475// // // (primary particles are filled after secondaries)
1476// // Int_t entry;
1477// // if (i<fHeader.GetNprimary())
1478// // entry = i+fHeader.GetNsecondary();
1479// // else
1480// // entry = i-fHeader.GetNprimary();
1481
1482// // // only check the algorithmic way and give
1483// // // the fatal error if it is wrong
1484// // if (entry != fParticleFileMap[i]) {
1485// // Fatal("Particle",
1486// // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
1487// // entry, fParticleFileMap[i]);
1488// // }
1489
1490// // fTreeK->GetEntry(fParticleFileMap[i]);
1491// // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
1492// // fParticleMap->AddAt((*fParticles)[nentries],i);
1493// // }
1494// // return (TParticle *) (*fParticleMap)[i];
1495
1496
1497
1498// }
1499
1500
1501// //scan over opened files and read corresponding TreeK##
1502
1503 return ;
1504}
1505//____________________________________________________________________________
b0bba0af 1506void AliPHOSGetter::Event(Int_t event, const char* opt)
4ae78bb1 1507{
1508 // Reads the content of all Tree's S, D and R
1509
1510 if ( event > gAlice->TreeE()->GetEntries() ) {
b0bba0af 1511 cerr << "ERROR: AliPHOSGetter::Event -> There are only "
1512 << gAlice->TreeE()->GetEntries() << " events in this file" << endl ;
4ae78bb1 1513 return ;
1514 }
1515
1516 gAlice->GetEvent(event) ;
dbad285c 1517
b0bba0af 1518 if(strstr(opt,"H") )
1519 ReadTreeH() ;
1520
1521 if(strstr(opt,"S") )
1522 ReadTreeS(event) ;
1523
1524 if( strstr(opt,"D") )
1525 ReadTreeD() ;
1526
1527 if( strstr(opt,"R") )
1528 ReadTreeR() ;
1529
1530 if( strstr(opt,"Q") )
1531 ReadTreeQA() ;
1532
1533 if( strstr(opt,"P") )
1534 ReadPrimaries() ;
1535
4ae78bb1 1536}
1537
1538//____________________________________________________________________________
1539const TObject * AliPHOSGetter::ReturnO(TString what, TString name, TString file) const
1540{
1541 // get the object named "what" from the folder
1542 // folders are named like //YSAlice/WhiteBoard/what/PHOS/name
1543
1544 if ( file.IsNull() )
1545 file = fHeaderFile ;
1546 TString path("WhiteBoard/") ;
1547 if ( name.IsNull() ) {
1548 if ( what.CompareTo("Hits") == 0 ) {
1549 path += what ;
1550 path += "/PHOS/";
1551 path += what ;
1552 }
1553 else if ( what.CompareTo("SDigits") == 0 ) {
1554 path += what ;
1555 path += "/PHOS/";
1556 path += file ;
1557 path += "/" ;
1558 path += fSDigitsTitle ;
1559 }
1560 else if ( what.CompareTo("Digits") == 0 ){
1561 path += what ;
1562 path += "/PHOS/";
1563 path += fDigitsTitle ;
1564 }
1565 else if ( what.CompareTo("EmcRecPoints") == 0 ) {
1566 path += "RecPoints/PHOS/";
1567 path += "emc/" ;
1568 path += fRecPointsTitle ;
1569 }
1570 else if ( what.CompareTo("CpvRecPoints") == 0 ) {
1571 path += "RecPoints/PHOS/";
1572 path += "cpv/" ;
1573 path += fRecPointsTitle ;
1574 }
1575 else if ( what.CompareTo("TrackSegments") == 0 ) {
1576 path += "TrackSegments/PHOS/";
1577 path += fTrackSegmentsTitle ;
1578 }
1579 else if ( what.CompareTo("RecParticles") == 0 ) {
1580 path += "RecParticles/PHOS/";
1581 path += fRecParticlesTitle ;
1582 }
1583 else if ( what.CompareTo("Alarms") == 0 ) {
1584 path += "QAAlarms/PHOS";
1585 }
1586 }
1587 else {
1588 if ( what.CompareTo("SDigits") == 0 ) {
1589 path += what ;
1590 path += "/PHOS/";
1591 path += file ;
1592 path += "/" ;
1593 path += name ;
1594 }
1595 else if ( what.CompareTo("Digits") == 0 ) {
1596 path += what ;
1597 path += "/PHOS/";
1598 path += name ;
1599 }
1600 else if ( what.CompareTo("EmcRecPoints") == 0 ) {
1601 path += "RecPoints/PHOS/";
1602 path += "emc/" ;
1603 path += name ;
1604 }
1605 else if ( what.CompareTo("CpvRecPoints") == 0 ) {
1606 path += "RecPoints/PHOS/";
1607 path += "cpv/" ;
1608 path += name ;
1609 }
1610 else if ( what.CompareTo("TrackSegments") == 0 ) {
1611 path += "TrackSegments/PHOS/";
1612 path += name ;
1613 }
1614 else if ( what.CompareTo("RecParticles") == 0 ) {
1615 path += "RecParticles/PHOS/";
1616 path += name ;
1617 }
1618 else if ( what.CompareTo("Alarms") == 0 ) {
1619 path += "QAAlarms/PHOS/";
1620 path += name ;
1621 }
1622 }
1623 path.Prepend("YSAlice/") ;
1624 TObject * phosO = (TObject*)gROOT->FindObjectAny(path) ;
1625 if (!phosO) {
b0bba0af 1626 if(fDebug)
1627 cerr << "ERROR : AliPHOSGetter::ReturnO -> Object " << path << " not found!" << endl ;
1628 return 0 ;
4ae78bb1 1629 }
1630 return phosO ;
1631}
1632
1633//____________________________________________________________________________
1634const TTask * AliPHOSGetter::ReturnT(TString what, TString name) const
1635{
1636 // get the TTask named "what" from the folder
1637 // folders are named like //YSAlice/Tasks/what/PHOS/name
1638
1639 TString path("tasks") ;
1640
1641 if ( what.CompareTo("SDigitizer") == 0 )
1642 path += "/SDigitizer" ;
1643 else if ( what.CompareTo("Digitizer") == 0 )
1644 path += "/Digitizer" ;
1645 else if ( what.CompareTo("Clusterizer") == 0 )
1646 path += "/Reconstructioner" ;
1647 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
1648 path += "/Reconstructioner" ;
1649 else if ( what.CompareTo("PID") == 0 )
1650 path += "/Reconstructioner" ;
eb9763ac 1651 else if ( what.CompareTo("QATasks") == 0 )
1652 path += "/QA" ;
4ae78bb1 1653
dbad285c 1654 TFolder * aliceF = (TFolder*)gROOT ->FindObjectAny("YSAlice") ;
1655 TTask * aliceT = (TTask*) aliceF->FindObject(path) ;
4ae78bb1 1656
1657 if (!aliceT) {
1658 cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << path << " not found!" << endl ;
1659 abort() ;
1660 }
1661
dbad285c 1662 TTask * phosT = (TTask*) aliceT->GetListOfTasks()->FindObject("PHOS") ;
4ae78bb1 1663 if (!phosT) {
1664 cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << path << "/PHOS not found!" << endl ;
1665 abort() ;
1666 }
1667 TList * l = phosT->GetListOfTasks() ;
1668
1669 if (what.CompareTo("SDigitizer") == 0) {
1670 if ( name.IsNull() )
1671 name = fSDigitsTitle ;
1672 } else if (what.CompareTo("Digitizer") == 0){
1673 if ( name.IsNull() )
1674 name = fDigitsTitle ;
1675 } else if (what.CompareTo("Clusterizer") == 0){
1676 if ( name.IsNull() )
1677 name = fRecPointsTitle ;
b0bba0af 1678 name.Append(":clu") ;
4ae78bb1 1679 }
1680 else if (what.CompareTo("TrackSegmentMaker") == 0){
1681 if ( name.IsNull() )
1682 name = fTrackSegmentsTitle ;
b0bba0af 1683 name.Append(":tsm") ;
4ae78bb1 1684 }
1685 else if (what.CompareTo("PID") == 0){
1686 if ( name.IsNull() )
1687 name = fRecParticlesTitle ;
b0bba0af 1688 name.Append(":pid") ;
4ae78bb1 1689 }
b0bba0af 1690 else if (what.CompareTo("QATasks") == 0){
eb9763ac 1691 if ( name.IsNull() )
1692 return phosT ;
1693 }
4ae78bb1 1694
b0bba0af 1695 TIter it(l) ;
1696 TTask * task = 0 ;
1697 while((task = (TTask *)it.Next()) ){
1698 TString taskname(task->GetName()) ;
1699 if(taskname.BeginsWith(name))
1700 return task ;
1701 }
1702
1703 if(fDebug)
81bb1a45 1704 cout << "WARNING: AliPHOSGetter::ReturnT -> Task " << path << "/" << name << " not found!" << endl ;
b0bba0af 1705 return 0 ;
4ae78bb1 1706}