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