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