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