]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSGetter.cxx
enable to read TreeQA
[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   fSDigitsTitle       = branchTitle ; 
86   fDigitsTitle        = branchTitle ; 
87   fRecPointsTitle     = branchTitle ; 
88   fRecParticlesTitle  = branchTitle ; 
89   fTrackSegmentsTitle = branchTitle ; 
90
91   fPrimaries = new TObjArray(1) ;
92
93   if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
94
95     //open headers file
96     TFile * file = (TFile*) gROOT->GetFile(fHeaderFile.Data() ) ;
97     
98     if(file == 0){    //if file was not opened yet, read gAlice
99       if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
100         file =  TFile::Open(fHeaderFile.Data(),"update") ;
101       else
102         file = new TFile(fHeaderFile.Data(),"update") ;
103       
104       if (!file->IsOpen()) {
105         cerr << "ERROR : AliPHOSGetter::AliPHOSGetter -> Cannot open " << fHeaderFile.Data() << endl ; 
106         abort() ; 
107       }
108       
109       gAlice = (AliRun *) file->Get("gAlice") ;
110       
111       if (!gAlice) {
112         cerr << "ERROR : AliPHOSGetter::AliPHOSGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ; 
113         abort() ; 
114       }
115     }
116   }
117   ReadTreeQA() ;
118   fDebug="";
119 }
120 //____________________________________________________________________________ 
121 void AliPHOSGetter::CreateWhiteBoard() const
122 {
123   // Posts a few item to the white board (folders)
124   
125   // -- the geometry
126   Post(fHeaderFile, "G") ; 
127   
128   // -- the hits
129   Post(fHeaderFile, "H") ; 
130     
131 }
132
133 //____________________________________________________________________________ 
134 AliPHOSGetter * AliPHOSGetter::GetInstance()
135 {
136   // Returns the pointer of the unique instance already defined
137   
138   AliPHOSGetter * rv = 0 ;
139   if ( fgObjGetter )
140     rv = fgObjGetter ;
141   else
142     cout << "AliPHOSGetter::GetInstance ERROR: not yet initialized" << endl ;
143
144   return rv ;
145 }
146
147 //____________________________________________________________________________ 
148 AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile,
149                                            const char* branchTitle)
150 {
151   // Creates and returns the pointer of the unique instance
152   // Must be called only when the environment has changed 
153
154
155   if ( fgObjGetter )      // delete it if already exists
156     delete fgObjGetter ; 
157
158   fgObjGetter = new AliPHOSGetter(headerFile,branchTitle) ; 
159   
160   // Posts a few item to the white board (folders)
161   fgObjGetter->CreateWhiteBoard() ;
162
163   // Get the first event into the arrays posted on the white board
164   // branchTitle = 0, means simulation run and no event yet 
165   if (branchTitle) 
166     fgObjGetter->Event(0) ;
167
168   return fgObjGetter ; 
169   
170 }
171
172 //____________________________________________________________________________ 
173  const  AliPHOS * AliPHOSGetter::PHOS() const 
174 {
175   // returns the PHOS object 
176   return ( (AliPHOS*)gAlice->GetDetector("PHOS") ); 
177 }  
178
179 //____________________________________________________________________________ 
180   const AliPHOSGeometry *  AliPHOSGetter::PHOSGeometry() const 
181 {
182   // retrieves the geometr from the folder
183
184   TString path("YSAlice/WhiteBoard/Geometry/PHOS/") ;
185   path += PHOS()->GetTitle() ;
186   return (AliPHOSGeometry*)gROOT->FindObjectAny(path.Data()) ; 
187 }
188
189 //____________________________________________________________________________ 
190 void AliPHOSGetter::Post(const char * headerFile, const char * opt, const char * name, const Int_t event) const 
191 {
192   // Adds a new folder for summable digits 
193
194   TString foldertitle ; 
195   if ( event >= 0 ) 
196     foldertitle += event ; 
197   else 
198     foldertitle = "" ; 
199
200   TFolder * aliceF  = (TFolder*)gROOT->FindObjectAny("YSAlice") ; 
201  
202   if ( strcmp(opt, "G") == 0 ) { // Geometry
203     // the hierarchy is //YSALICE/WhiteBoard/Geometry/PHOS/
204     AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance(PHOS()->GetTitle(),"") ;  
205     TFolder * geomF  = (TFolder*)aliceF->FindObject("WhiteBoard/Geometry/PHOS") ; 
206     if ( !geomF ) {
207       cerr << "ERROR: AliPHOSGetter::Post G -> Folder WhiteBoard/Geometry/PHOS/" << " not found!" << endl;
208       abort() ; 
209     }    
210     else 
211       geomF->Add((TObject*)geom) ; 
212    
213   } else if ( strcmp(opt, "H") == 0 ) { // Hits
214     // the hierarchy is //YSALICE/WhiteBoard/SDigits/PHOS/Hits
215     TClonesArray * hits = new TClonesArray("AliPHOSHit",1000) ;
216     hits->SetName("Hits") ; 
217     TFolder * hitsF  = (TFolder*)aliceF->FindObject("WhiteBoard/Hits/PHOS") ; 
218     if ( !hitsF ) {
219       cerr << "ERROR: AliPHOSGetter::Post H -> Folder WhiteBoard/Hits/PHOS/" << " not found!" << endl;
220       abort() ; 
221     }    
222     else 
223       hitsF->Add(hits) ; 
224
225   } else if ( strcmp(opt, "S") == 0 ) { // summable digits
226     // the hierarchy is //YSALICE/WhiteBoard/SDigits/PHOS/headerFile/sdigitsname
227     // because you can have sdigits from several hit files for mixing
228     TClonesArray * sdigits = new TClonesArray("AliPHOSDigit",1000) ;
229     TString sdigitsName ; 
230     if (name) 
231       sdigitsName = name ;
232     else 
233       sdigitsName = "SDigits" ; 
234     sdigits->SetName( sdigitsName.Data() ) ; 
235     TFolder * sdigitsF  = (TFolder*)aliceF->FindObject("WhiteBoard/SDigits/PHOS") ;
236     TFolder * sdigitsF2 = 0 ; 
237     TString subdir(headerFile) ;
238     if ( !(sdigitsF2=(TFolder*)sdigitsF->FindObject(subdir)) ) 
239       sdigitsF2 = sdigitsF->AddFolder(subdir, foldertitle); 
240     else {
241       if ( sdigitsF2->FindObject( sdigitsName.Data() ) ) {
242         if (fDebug.Contains("S"))
243           cerr <<"INFO: AliPHOSGetter::Post S -> Folder " << subdir << ", " << foldertitle
244                << " already exists!" << endl ;  
245         return ; 
246       }
247     }
248     if ( !sdigitsF2 ) {
249       cerr << "ERROR: AliPHOSGetter::Post S -> Folder WhiteBoard/SDigits/PHOS/" << subdir << " not created!" << endl;
250       abort() ; 
251     }
252     else 
253       sdigitsF2->Add(sdigits) ;
254
255   } else if ( strcmp(opt, "Ser") == 0 ) { // sdigizer
256     // the hierarchy is //YSALICE/tasks/Digitizer/PHOS/sdigitsname
257     AliPHOSSDigitizer * sdigitizer = new AliPHOSSDigitizer() ; 
258     TString sdigitsName ; 
259     if (name) 
260       sdigitsName = name ;
261     else 
262       sdigitsName = "SDigitizer" ;
263     sdigitizer->SetName( sdigitsName.Data() ) ; 
264     TTask * sdigitsF  = (TTask*)aliceF->FindObject("tasks/SDigitizer") ; 
265     if ( !sdigitsF ) {
266       cerr << "ERROR: AliPHOSGetter::Post Ser -> Task tasks/SDigitizer" << " not found!" << endl;
267       abort() ; 
268     }        
269     TTask * phos = (TTask*)sdigitsF->GetListOfTasks()->FindObject("PHOS") ; 
270     if ( !phos )  {
271       cerr <<"ERROR: AliPHOSGetter::Post Ser -> tasks/SDigitizer/PHOS" << " not found!" << endl; 
272       abort() ; 
273     } else {
274       AliPHOSSDigitizer * phossd = (AliPHOSSDigitizer*)phos->GetListOfTasks()->FindObject(sdigitsName.Data()) ; 
275       if (phossd) { 
276         if (fDebug.Contains("Ser"))
277           cout << "INFO: AliPHOSGetter::Post Ser -> Task " << sdigitsName.Data() << " already exists" << endl ; 
278         return ; 
279       } else 
280         phos->Add(sdigitizer) ;
281     } 
282
283   } else if ( strcmp(opt, "D") == 0 ) { // digits
284     // the hierarchy is //YSALICE/WhiteBoard/Digits/PHOS/digitsname
285     TClonesArray * digits  = new TClonesArray("AliPHOSDigit",20000) ;
286     TString digitsName ; 
287     if (name) 
288       digitsName = name ;
289     else 
290       digitsName = "Digits" ;   
291     digits->SetName( digitsName.Data() ) ; 
292     TFolder * digitsF  = (TFolder*)aliceF->FindObject("WhiteBoard/Digits/PHOS") ;
293     if ( !digitsF ) {
294       cerr << "ERROR: AliPHOSGetter::Post D -> Folder WhiteBoard/Digits/PHOS/" << " not found!" << endl;
295       abort() ; 
296     }    
297     digitsF->SetTitle(foldertitle) ; 
298     if ( digitsF->FindObject( digitsName.Data() ) ) {
299       if (fDebug.Contains("D"))
300         cerr <<"INFO: AliPHOSGetter::Post D -> Object " << digitsName.Data() 
301              << " already exists!" << endl ;  
302       return ; 
303     } 
304     else 
305       digitsF->Add(digits) ;  
306
307   } else if ( strcmp(opt, "Der") == 0 ) { // sdigizer
308     // the hierarchy is //YSALICE/tasks/Digitizer/PHOS/digitsname
309     AliPHOSDigitizer * digitizer = new AliPHOSDigitizer() ; 
310     TString digitsName ; 
311     if (name) 
312       digitsName = name ;
313     else 
314       digitsName = "Digitizer" ;
315     digitizer->SetName( digitsName.Data() ) ; 
316     TTask * digitsF  = (TTask*)aliceF->FindObject("tasks/Digitizer") ; 
317     if ( !digitsF ) {
318       cerr << "ERROR: AliPHOSGetter::Post Der -> Task tasks/Digitizer" << " not found!" << endl;
319       abort() ; 
320     }        
321     TTask * phos = (TTask*)digitsF->GetListOfTasks()->FindObject("PHOS") ; 
322     if ( !phos )  {
323       cerr <<"ERROR: AliPHOSGetter::Post Der -> tasks/Digitizer/PHOS" << " not found!" << endl; 
324       abort() ; 
325     } else {
326       AliPHOSDigitizer * phosd = (AliPHOSDigitizer*)phos->GetListOfTasks()->FindObject(digitsName.Data()) ; 
327       if (phosd) { 
328         if (fDebug.Contains("Der"))
329           cout << "INFO: AliPHOSGetter::Post Der -> Task " << digitsName.Data() << " already exists" << endl ; 
330         return ; 
331       } else 
332         phos->Add(digitizer) ;
333     }
334  
335   } else if ( strcmp(opt, "R") == 0 ) { // RecPoints
336     // the hierarchy is //YSALICE/WhiteBoard/RecPoints/PHOS/emc/recpointsname
337     //                  //YSALICE/WhiteBoard/RecPoints/PHOS/cpv/recpointsname
338     TObjArray * emcrp  = new TObjArray(100) ;
339     TObjArray * cpvrp  = new TObjArray(100) ;
340     TString recpointsName ; 
341     if (name) 
342       recpointsName = name ;
343     else       
344       recpointsName = "RecPoints" ;     
345     emcrp->SetName( recpointsName.Data() ) ; 
346     cpvrp->SetName( recpointsName.Data() ) ; 
347     TFolder * emcrpF  = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/emc") ; 
348     TFolder * cpvrpF  = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/cpv") ;
349     emcrpF->SetTitle(foldertitle) ; 
350     cpvrpF->SetTitle(foldertitle) ; 
351     if ( !emcrpF || !cpvrpF ) {
352       cerr << "ERROR: AliPHOSGetter::Post R -> Folder WhiteBoard/RecPoints/PHOS/emc(cpv)" << " not found!" << endl;
353       abort() ; 
354     }    
355     // TString title("PHOS Digits") ; 
356     if ( emcrpF->FindObject( recpointsName.Data() ) ||  cpvrpF->FindObject( recpointsName.Data() ) ) {
357       if (fDebug.Contains("R"))
358         cerr <<"INFO: AliPHOSGetter::Post R -> Object " << recpointsName.Data() 
359              << " already exists!" << endl ;  
360       return ; 
361     } 
362     else {
363       emcrpF->Add(emcrp) ;  
364       cpvrpF->Add(cpvrp) ;
365     }  
366
367   } else if ( strcmp(opt, "Rer") == 0 ) { // clusterizer
368     // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/recpointsname
369     AliPHOSClusterizer * clusterizer; 
370     if ( strstr(name, "clu-v1") != 0 )   
371       clusterizer = new AliPHOSClusterizerv1() ;
372     else {
373       cerr << "ERROR: AliPHOSGetter::Post Rer -> " << name << " unknown clusterizer version" << endl ;  
374       abort() ; 
375     }
376     TString recpointsName ; 
377     if (name) 
378       recpointsName = name ;
379     else 
380       recpointsName = "Clusterizer" ;
381     clusterizer->SetName( recpointsName.Data() ) ; 
382     TTask * reF  = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ; 
383     if ( !reF ) {
384       cerr << "ERROR: AliPHOSGetter::Post Rer -> Task tasks/Reconstructioner" << " not found!" << endl;
385       abort() ; 
386     }        
387     TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ; 
388     if ( !phos )  {
389       cerr <<"ERROR: AliPHOSGetter::Post Rer -> tasks/Reconstructioner/PHOS" << " not found!" << endl; 
390       abort() ; 
391     } else {
392        AliPHOSClusterizer * phoscl = (AliPHOSClusterizer*)phos->GetListOfTasks()->FindObject(recpointsName.Data()) ; 
393       if (phoscl) { 
394         if (fDebug.Contains("Rer"))
395           cout << "INFO: AliPHOSGetter::Post Rer -> Task " << recpointsName.Data() << " already exists" << endl ; 
396         return ; 
397       } else 
398         phos->Add(clusterizer) ;
399     }
400
401   } else if ( strcmp(opt, "T") == 0 ) { //TrackSegments
402     // the hierarchy is //YSALICE/WhiteBoard/TrackSegments/PHOS/tracksegmentsname
403
404     TClonesArray * tracksegments  = new TClonesArray("AliPHOSTrackSegment", 200) ;
405     TString tracksegmentsName ; 
406     if (name) 
407       tracksegmentsName = name ;
408     else       
409       tracksegmentsName = "TrackSegments" ;     
410     tracksegments->SetName( tracksegmentsName.Data() ) ; 
411     TFolder * tracksegmentsF  = (TFolder*)aliceF->FindObject("WhiteBoard/TrackSegments/PHOS") ; 
412     tracksegmentsF->SetTitle(foldertitle) ;  
413     if ( !tracksegmentsF) {
414       cerr << "ERROR: AliPHOSGetter::Post T -> Folder WhiteBoard/TrackSegments/PHOS" << " not found!" << endl;
415       abort() ; 
416     }    
417     if ( tracksegmentsF->FindObject( tracksegmentsName.Data() ) ) {
418       if (fDebug.Contains("T"))
419         cerr <<"INFO: AliPHOSGetter::Post T -> Object " << tracksegmentsName.Data() 
420              << " already exists!" << endl ;  
421       return ; 
422     } 
423     else 
424       tracksegmentsF->Add(tracksegments) ;  
425
426   } else if ( strcmp(opt, "Ter") == 0 ) { // TrackSegmentsMaker
427     // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/tracksegmentsname
428     AliPHOSTrackSegmentMaker * tracksegmentmaker ; 
429     if ( strstr(name, "tsm-v1") != 0 )   
430       tracksegmentmaker = new AliPHOSTrackSegmentMakerv1() ;
431     else {
432       cerr << "ERROR: AliPHOSGetter::Post Ter -> " << name << " unknown track segment maker version" << endl ;  
433       abort() ; 
434     }
435     TString tracksegmentsName ; 
436     if (name) 
437       tracksegmentsName = name ;
438     else 
439       tracksegmentsName = "TrackSegmentMaker" ;
440     tracksegmentmaker->SetName( tracksegmentsName.Data() ) ; 
441     TTask * reF  = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ; 
442     if ( !reF ) {
443       cerr << "ERROR: AliPHOSGetter::Post Ter -> Task tasks/Reconstructioner" << " not found!" << endl;
444       abort() ; 
445     }        
446     TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ; 
447     if ( !phos )  {
448       cerr <<"ERROR: AliPHOSGetter::Post Ter -> tasks/Reconstructioner/PHOS" << " not found!" << endl; 
449       abort() ; 
450     } else {
451        AliPHOSTrackSegmentMaker * phosts = (AliPHOSTrackSegmentMaker*)phos->GetListOfTasks()->FindObject(tracksegmentsName.Data()) ; 
452       if (phosts) { 
453         if (fDebug.Contains("Ter"))
454           cout << "INFO: AliPHOSGetter::Post Ter -> Task " << tracksegmentsName.Data() << " already exists" << endl ; 
455         return ; 
456       } else 
457         phos->Add(tracksegmentmaker) ;
458     }
459   
460   } else if ( strcmp(opt, "P") == 0 ) { // RecParticles
461     // the hierarchy is //YSALICE/WhiteBoard/RecParticles/PHOS/recparticlesname
462
463     TClonesArray * recparticles  = new TClonesArray("AliPHOSRecParticle", 200) ;
464     TString recparticlesName ; 
465     if (name) 
466       recparticlesName = name ;
467     else       
468       recparticlesName = "RecParticles" ;       
469     recparticles->SetName( recparticlesName.Data() ) ; 
470     TFolder * recparticlesF  = (TFolder*)aliceF->FindObject("WhiteBoard/RecParticles/PHOS") ; 
471     recparticlesF->SetTitle(foldertitle) ;  
472     if ( !recparticlesF) {
473       cerr << "ERROR: AliPHOSGetter::Post P -> Folder WhiteBoard/RecParticles/PHOS" << " not found!" << endl;
474       abort() ; 
475     }    
476     if ( recparticlesF->FindObject( recparticlesName.Data() ) ) {
477       if (fDebug.Contains("P"))
478         cerr <<"INFO: AliPHOSGetter::Post P -> Object " << recparticlesName.Data() 
479              << " already exists!" << endl ;  
480       return ; 
481     } 
482     else 
483       recparticlesF->Add(recparticles) ;  
484
485   } else if ( strcmp(opt, "Per") == 0 ) { // PID Maker
486     // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/recparticlesname
487     AliPHOSPID * pid ; 
488     if ( strstr(name, "pid-v1") != 0 )   
489       pid = new AliPHOSPIDv1() ;
490     else {
491       cerr << "ERROR: AliPHOSGetter::Post Per -> " << name << " unknown PID maker version" << endl ;  
492       abort() ; 
493     }
494     TString recparticlesName ; 
495     if (name) 
496       recparticlesName = name ;
497     else 
498       recparticlesName = "PID" ;
499     pid->SetName( recparticlesName.Data() ) ; 
500     TTask * reF  = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ; 
501     if ( !reF ) {
502       cerr << "ERROR: AliPHOSGetter::Post Per -> Task tasks/Reconstructioner" << " not found!" << endl;
503       abort() ; 
504     }        
505     TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ; 
506     if ( !phos )  {
507       cerr <<"ERROR: AliPHOSGetter::Post Per -> tasks/Reconstructioner/PHOS" << " not found!" << endl; 
508       abort() ; 
509     } else {
510        AliPHOSPID * phospid = (AliPHOSPID*)phos->GetListOfTasks()->FindObject(recparticlesName.Data()) ; 
511       if (phospid) { 
512         if (fDebug.Contains("Per"))
513           cout << "INFO: AliPHOSGetter::Post Per -> Task " << recparticlesName.Data() << " already exists" << endl ; 
514         return ; 
515       } else 
516         phos->Add(pid) ;
517     }
518   } 
519   else if ( strcmp(opt, "QA") == 0 ) { // Alarms
520     // the hierarchy is //YSALICE/WhiteBoard/Alarms/PHOS/
521
522     TFolder * alarmsF  = new TFolder() ;
523     TString alarmsName ; 
524     if (name) 
525       alarmsName = name ;
526     else       
527       alarmsName = "Alarm with no name" ;       
528     alarmsF->SetName( alarmsName.Data() ) ; 
529     alarmsF->SetTitle(foldertitle) ;  
530     TFolder * qaaF  = (TFolder*)aliceF->FindObject("WhiteBoard/QAAlarms") ; 
531     if ( !qaaF) {
532       cerr << "ERROR: AliPHOSGetter::Post QA -> Folder WhiteBoard/QAAlarms/" << " not found!" << endl;
533       return ; 
534     }    
535     if ( qaaF->FindObject( alarmsName.Data() ) ) 
536       qaaF->RecursiveRemove(  qaaF->FindObject( alarmsName.Data() ) ) ; 
537     
538     qaaF->Add(alarmsF) ;  
539
540   }
541 }
542
543 //____________________________________________________________________________ 
544 const TParticle * AliPHOSGetter::Primary(Int_t index) const
545 {
546   // Return primary particle numbered by <index>
547
548   if(index < 0) 
549     return 0 ;
550   
551   Int_t primaryIndex = index % 10000000 ; 
552   Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.)  ;
553   
554   if ( primaryList > 0  ) {
555     cout << " Getter does not support currently Mixing of primary " << endl ;
556     cout << "   can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
557     return 0;
558   }
559   
560   return gAlice->Particle(primaryIndex) ;
561   
562 }
563
564 //____________________________________________________________________________ 
565 void AliPHOSGetter::ReadTreeD()
566 {
567   // Read the digit tree gAlice->TreeD()  
568   if(gAlice->TreeD()== 0){
569     cerr <<   "ERROR: AliPHOSGetter::ReadTreeD: can not read TreeD " << endl ;
570   return ;
571   }
572   
573   TObjArray * lob = (TObjArray*)gAlice->TreeD()->GetListOfBranches() ;
574   TIter next(lob) ; 
575   TBranch * branch = 0 ; 
576   TBranch * digitsbranch = 0 ; 
577   TBranch * digitizerbranch = 0 ; 
578   Bool_t phosfound = kFALSE, digitizerfound = kFALSE ; 
579   
580   while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) {
581     if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
582       digitsbranch = branch ; 
583       phosfound = kTRUE ;
584     }
585     else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
586       digitizerbranch = branch ; 
587       digitizerfound = kTRUE ; 
588     }
589   }
590
591   if ( !phosfound || !digitizerfound ) {
592     cout << "WARNING: AliPHOSGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name " << fDigitsTitle << endl ;
593     return ; 
594   }   
595  
596
597  // Post the Digits
598   if (EventNumber() == 0)
599     Post(fHeaderFile, "D", fDigitsTitle) ; 
600   
601    // Post the Digitizer
602   if (EventNumber() == 0)
603     Post(fHeaderFile, "Der", fDigitsTitle) ; 
604
605   TClonesArray * digits = Digits(fDigitsTitle) ; 
606   digits->Clear() ; 
607   digitsbranch   ->SetAddress(&digits) ;
608
609   AliPHOSDigitizer * digitizer = Digitizer(fDigitsTitle) ;
610   digitizerbranch->SetAddress(&digitizer) ;
611
612   digitsbranch   ->GetEntry(0) ;
613   digitizerbranch->GetEntry(0) ;
614   
615 }
616
617 //____________________________________________________________________________ 
618 void AliPHOSGetter::ReadTreeH()
619 {
620   // Read the first entry of PHOS branch in hit tree gAlice->TreeH()
621
622   if(gAlice->TreeH()== 0){
623     cerr <<   "ERROR: AliPHOSGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
624     return ;
625   }
626   
627   TBranch * hitsbranch = (TBranch*)gAlice->TreeH()->GetListOfBranches()->FindObject("PHOS") ;
628   if ( !hitsbranch ) {
629     cout << "WARNING:  AliPHOSGetter::ReadTreeH -> Cannot find branch PHOS" << endl ; 
630   } else {
631     TClonesArray * hits = Hits() ; 
632     hits->Clear() ; 
633     hitsbranch->SetAddress(&hits) ;
634     hitsbranch->GetEntry(0) ;
635   }
636 }
637
638 //____________________________________________________________________________ 
639 void AliPHOSGetter::ReadTreeQA()
640 {
641   // Read the digit tree gAlice->TreeQA()
642   // so far only PHOS knows about this Tree  
643
644   if(PHOS()->TreeQA()== 0){
645     cerr <<   "ERROR: AliPHOSGetter::ReadTreeQA: can not read TreeQA " << endl ;
646     return ;
647   }
648   
649   TBranch * qabranch = PHOS()->TreeQA()->GetBranch("PHOS") ; 
650   if (!qabranch) { 
651     cout << "WARNING: AliPHOSGetter::ReadTreeQA -> Cannot find QA Alarms for PHOS" << endl ;
652     return ; 
653   }   
654
655  // Post the QA Alarms
656   Post(fHeaderFile, "QA", "PHOS") ; 
657   TFolder * alarmsF = Alarms() ; 
658   alarmsF->Clear() ; 
659   qabranch->SetAddress(&alarmsF) ;
660   qabranch->GetEntry(0) ;
661   
662 }
663
664 //____________________________________________________________________________ 
665 void AliPHOSGetter::ReadTreeR()
666 {
667   // Read the reconstrunction tree gAlice->TreeR()
668
669   if(gAlice->TreeR()== 0){
670     cout <<   "ERROR: AliPHOSGetter::ReadTreeR: can not read TreeR " << endl ;
671    return ;
672   }
673   // RecPoints 
674   TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
675   TIter next(lob) ; 
676   TBranch * branch = 0 ; 
677   TBranch * emcbranch = 0 ; 
678   TBranch * cpvbranch = 0 ; 
679   TBranch * clusterizerbranch = 0 ; 
680   Bool_t phosemcrpfound = kFALSE, phoscpvrpfound = kFALSE, clusterizerfound = kFALSE ; 
681   
682   while ( (branch = (TBranch*)next()) && (!phosemcrpfound || !phoscpvrpfound || !clusterizerfound) ) {
683     if ( (strcmp(branch->GetName(), "PHOSEmcRP")==0) && (strcmp(branch->GetTitle(), fRecPointsTitle)==0) ) {
684       emcbranch = branch ; 
685       phosemcrpfound = kTRUE ;
686     }
687     else if ( (strcmp(branch->GetName(), "PHOSCpvRP")==0) && (strcmp(branch->GetTitle(), fRecPointsTitle)==0) ) {
688       cpvbranch = branch ; 
689       phoscpvrpfound = kTRUE ;
690     }
691     else if ( (strcmp(branch->GetName(), "AliPHOSClusterizer")==0) && (strcmp(branch->GetTitle(), fRecPointsTitle)==0) ) {
692       clusterizerbranch = branch ; 
693       clusterizerfound = kTRUE ; 
694     }
695   }
696
697   if ( !phosemcrpfound || !phoscpvrpfound || !clusterizerfound ) {
698     cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find RecPoints and/or Clusterizer with name " << fRecPointsTitle << endl ;
699     return ; 
700   }   
701  
702  // Post the RecPoints
703   if (EventNumber() == 0)
704     Post(fHeaderFile, "R", fRecPointsTitle) ; 
705
706   // Post the Clusterizer
707   //  Need the version first
708   AliPHOSClusterizer * clusterizer = 0 ; 
709   clusterizerbranch->SetAddress(&clusterizer) ;
710   clusterizerbranch->GetEntry(0) ;
711   TString clusterizerName(fRecPointsTitle) ; 
712   clusterizerName.Append(clusterizer->Version()) ; 
713   if (EventNumber() == 0)
714     Post(fHeaderFile, "Rer", clusterizerName) ; 
715
716   TObjArray * emcRecPoints = EmcRecPoints(fRecPointsTitle) ;
717   emcRecPoints->Delete() ; 
718   emcbranch->SetAddress(&emcRecPoints) ;
719
720   TObjArray * cpvRecPoints = CpvRecPoints(fRecPointsTitle) ;
721   cpvRecPoints->Delete() ; 
722   cpvbranch->SetAddress(&cpvRecPoints) ;
723
724   delete clusterizer ;
725   clusterizer = Clusterizer(clusterizerName) ;
726   clusterizerbranch->SetAddress(&clusterizer) ;
727
728   emcbranch        ->GetEntry(0) ;
729   cpvbranch        ->GetEntry(0) ;
730   clusterizerbranch->GetEntry(0) ;
731  
732   // TrackSegments
733   next.Reset() ; 
734   TBranch * tsbranch = 0 ; 
735   TBranch * tsmakerbranch = 0 ; 
736   Bool_t phostsfound = kFALSE, tsmakerfound = kFALSE ; 
737   
738   while ( (branch = (TBranch*)next()) && (!phostsfound || !tsmakerfound) ) {
739     if ( (strcmp(branch->GetName(), "PHOSTS")==0) && (strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) ) {
740       tsbranch = branch ; 
741       phostsfound = kTRUE ;
742     }
743     else if ( (strcmp(branch->GetName(), "AliPHOSTrackSegmentMaker")==0) && (strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) ) {
744       tsmakerbranch = branch ; 
745       tsmakerfound  = kTRUE ; 
746     }
747   }
748
749   if ( !phostsfound || !tsmakerfound ) {
750     cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name " << fTrackSegmentsTitle << endl ;
751     return ; 
752   } 
753
754  // Post the TrackSegments
755   if (EventNumber() == 0)
756     Post(fHeaderFile, "T", fTrackSegmentsTitle) ; 
757
758   // Post the TrackSegment Maker
759   //  Need the version first
760   AliPHOSTrackSegmentMaker * tsmaker = 0 ; 
761   tsmakerbranch->SetAddress(&tsmaker) ;
762   tsmakerbranch->GetEntry(0) ;
763   TString tsmakerName(fTrackSegmentsTitle) ; 
764   tsmakerName.Append(tsmaker->Version()) ; 
765   if (EventNumber() == 0)
766     Post(fHeaderFile, "Ter", tsmakerName) ; 
767
768   TClonesArray * tracksegments = TrackSegments(fTrackSegmentsTitle) ;
769   tracksegments->Clear() ; 
770   tsbranch->SetAddress(&tracksegments) ;
771  
772   delete tsmaker ;
773   tsmaker = TrackSegmentMaker(tsmakerName) ; 
774   tsmakerbranch->SetAddress(&tsmaker) ;
775
776   tsmakerbranch    ->GetEntry(0) ;
777   tsbranch         ->GetEntry(0) ;
778    
779   // RecParticles
780   next.Reset() ; 
781   TBranch * rpabranch = 0 ; 
782   TBranch * pidbranch = 0 ; 
783   Bool_t phosrpafound = kFALSE, pidfound = kFALSE ; 
784   
785   while ( (branch = (TBranch*)next()) && (!phosrpafound || !pidfound) ) {
786     if ( (strcmp(branch->GetName(), "PHOSRP")==0) && (strcmp(branch->GetTitle(), fRecParticlesTitle)==0) ) {
787       rpabranch = branch ; 
788       phosrpafound = kTRUE ;
789     }
790     else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), fRecParticlesTitle)==0) ) {
791       pidbranch = branch ; 
792       pidfound  = kTRUE ; 
793     }
794   }
795
796   if ( !phosrpafound || !pidfound ) {
797     cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name " << fRecParticlesTitle << endl ;
798     return ; 
799   } 
800
801   // Post the RecParticles
802   if (EventNumber() == 0)
803     Post(fHeaderFile, "P", fRecParticlesTitle) ; 
804
805   // Post the PID
806   //  Need the version first
807   AliPHOSPID * pid = 0 ; 
808   pidbranch->SetAddress(&pid) ;
809   pidbranch->GetEntry(0) ;
810   TString pidName(fRecParticlesTitle) ; 
811   pidName.Append(pid->Version()) ; 
812   if (EventNumber() == 0)
813     Post(fHeaderFile, "Per", pidName) ; 
814
815   TClonesArray * recParticles = RecParticles(fRecParticlesTitle) ; 
816   recParticles->Clear() ; 
817   rpabranch->SetAddress(&recParticles) ;
818
819   delete pid ;
820   pid = PID(pidName) ; 
821   pidbranch->SetAddress(&pid) ;
822   
823   pidbranch        ->GetEntry(0) ;
824   rpabranch        ->GetEntry(0) ;
825   
826 }
827
828 //____________________________________________________________________________ 
829 void AliPHOSGetter::ReadTreeS()
830 {
831   // Read the summable digits tree gAlice->TreeS()  
832
833   if(gAlice->TreeS()== 0){
834     cerr <<   "ERROR: AliPHOSGetter::ReadTreeS -> Cannot find TreeS " << endl ;
835     return ;
836   }
837   
838   TObjArray * lob = (TObjArray*)gAlice->TreeS()->GetListOfBranches() ;
839   TIter next(lob) ; 
840   TBranch * branch = 0 ; 
841   TBranch * sdigitsbranch = 0 ; 
842   TBranch * sdigitizerbranch = 0 ; 
843   Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ; 
844   
845   while ( (branch = (TBranch*)next()) && (!phosfound || !sdigitizerfound) ) {
846     if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
847       sdigitsbranch = branch ; 
848       phosfound = kTRUE ;
849     }
850     else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
851       sdigitizerbranch = branch ; 
852       sdigitizerfound = kTRUE ; 
853     }
854   }
855
856   if ( !phosfound || !sdigitizerfound ) {
857     cout << "WARNING: AliPHOSGetter::ReadTreeS -> Cannot find SDigits and/or SDigitizer with name " << fSDigitsTitle << endl ;
858     return ; 
859   }   
860
861   // -- the SDigits 
862   if (EventNumber() == 0)
863     Post(fHeaderFile, "S", fSDigitsTitle) ; 
864
865   // Post the SDigitizer
866   if (EventNumber() == 0)
867     Post(fHeaderFile, "Ser", fSDigitsTitle) ; 
868   
869   TClonesArray * sdigits = SDigits(fSDigitsTitle) ; 
870   sdigits->Clear() ; 
871   sdigitsbranch->SetAddress(&sdigits) ;
872
873   AliPHOSSDigitizer * sdigitizer = SDigitizer(fSDigitsTitle) ;
874   sdigitizerbranch->SetAddress(&sdigitizer) ;
875
876   sdigitsbranch->GetEvent(0) ;
877   sdigitizerbranch->GetEvent(0) ;
878     
879 }
880
881 //____________________________________________________________________________ 
882 void AliPHOSGetter::ReadPrimaries()
883 {
884   // Reads specific branches of primaries
885   
886   fNPrimaries = gAlice->GetNtrack();
887   
888   //   //Check, is it necessary to open new files
889   //   TArrayI* events = fDigitizer->GetCurrentEvents() ; 
890   //   TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
891 //   Int_t input ;
892 //   for(input = 0; input < filenames->GetEntriesFast(); input++){
893
894 //     TObjString * filename = (TObjString *) filenames->At(input) ;
895
896 //     //Test, if this file already open
897 //     TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
898 //     if(file == 0)
899 //       file = new TFile( filename->GetString()) ;
900 //     file->cd() ;
901     
902 //     // Get Kine Tree from file
903 // //     char treeName[20];
904 // //     sprintf(treeName,"TreeK%d",events->At(input));
905 // //     TTree * treeK = (TTree*)gDirectory->Get(treeName);
906 // //     if (treeK) 
907 // //       treeK->SetBranchAddress("Particles", &fParticleBuffer);
908 // //     else    
909 // //       cout << "AliPHOSGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
910
911 // //     // Create the particle stack
912 // //     if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
913 // //     // Build the pointer list
914 // //     if(fParticleMap) {     <----
915 // //       fParticleMap->Clear();
916 // //       fParticleMap->Expand(treeK->GetEntries());
917 // //     } else
918 // //       fParticleMap = new TObjArray(treeK->GetEntries());
919     
920 //     // From gAlice->Particle(i) 
921
922
923 // //   if(!(*fParticleMap)[i]) {
924 // //     Int_t nentries = fParticles->GetEntries();
925     
926 // //     // algorithmic way of getting entry index
927 // //     // (primary particles are filled after secondaries)
928 // //     Int_t entry;
929 // //     if (i<fHeader.GetNprimary())
930 // //       entry = i+fHeader.GetNsecondary();
931 // //     else 
932 // //       entry = i-fHeader.GetNprimary();
933       
934 // //     // only check the algorithmic way and give
935 // //     // the fatal error if it is wrong
936 // //     if (entry != fParticleFileMap[i]) {
937 // //       Fatal("Particle",
938 // //         "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
939 // //   entry, fParticleFileMap[i]); 
940 // //     }  
941       
942 // //     fTreeK->GetEntry(fParticleFileMap[i]);
943 // //     new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
944 // //     fParticleMap->AddAt((*fParticles)[nentries],i);
945 // //   }
946 // //   return (TParticle *) (*fParticleMap)[i];
947
948    
949     
950 //   }
951
952
953 //   //scan over opened files and read corresponding TreeK##
954
955   return ;
956 }
957 //____________________________________________________________________________ 
958 void AliPHOSGetter::Event(Int_t event)
959 {
960   // Reads the content of all Tree's S, D and R
961   
962   if ( event > gAlice->TreeE()->GetEntries() ) {
963     cerr << "ERROR: AliPHOSGetter::Event -> There are only " << gAlice->TreeE()->GetEntries() << " events in this file" << endl ; 
964     return ;
965   }
966   
967   gAlice->GetEvent(event) ;
968   gAlice->SetEvent(event) ;
969
970   ReadTreeH() ;
971   ReadTreeS() ;
972   ReadTreeD() ;
973   ReadTreeR() ;
974   ReadPrimaries() ;
975 }
976
977 //____________________________________________________________________________ 
978 const TObject * AliPHOSGetter::ReturnO(TString what, TString name, TString file) const 
979 {
980   // get the object named "what" from the folder
981   // folders are named like //YSAlice/WhiteBoard/what/PHOS/name
982
983   if ( file.IsNull() ) 
984     file = fHeaderFile ; 
985   TString path("WhiteBoard/") ;
986   if ( name.IsNull() ) {
987     if ( what.CompareTo("Hits") == 0 ) {
988       path += what ; 
989       path += "/PHOS/"; 
990       path += what ; 
991     }
992     else if ( what.CompareTo("SDigits") == 0 ) { 
993       path += what ; 
994       path += "/PHOS/"; 
995       path += file ; 
996       path += "/" ; 
997       path += fSDigitsTitle ; 
998     }
999     else if ( what.CompareTo("Digits") == 0 ){
1000       path += what ; 
1001       path += "/PHOS/"; 
1002       path += fDigitsTitle ;
1003     } 
1004     else if ( what.CompareTo("EmcRecPoints") == 0 ) {
1005       path += "RecPoints/PHOS/";  
1006       path += "emc/" ; 
1007       path += fRecPointsTitle ; 
1008     }
1009     else if ( what.CompareTo("CpvRecPoints") == 0 ) {
1010       path += "RecPoints/PHOS/";  
1011       path += "cpv/" ; 
1012       path += fRecPointsTitle ; 
1013     }
1014     else if ( what.CompareTo("TrackSegments") == 0 ) {
1015       path += "TrackSegments/PHOS/";  
1016       path += fTrackSegmentsTitle ; 
1017     }  
1018     else if ( what.CompareTo("RecParticles") == 0 ) {
1019       path += "RecParticles/PHOS/";  
1020       path += fRecParticlesTitle ; 
1021     }  
1022      else if ( what.CompareTo("Alarms") == 0 ) {
1023       path += "QAAlarms/PHOS";   
1024     }  
1025   } 
1026   else {
1027     if ( what.CompareTo("SDigits") == 0 ) { 
1028       path += what ; 
1029       path += "/PHOS/"; 
1030       path += file ; 
1031       path += "/" ; 
1032       path += name ;
1033     } 
1034     else if ( what.CompareTo("Digits") == 0 ) {
1035       path += what ; 
1036       path += "/PHOS/"; 
1037       path += name ; 
1038     }
1039     else if ( what.CompareTo("EmcRecPoints") == 0 ) {
1040       path += "RecPoints/PHOS/";  
1041       path += "emc/" ; 
1042       path += name ; 
1043     }
1044     else if ( what.CompareTo("CpvRecPoints") == 0 ) {
1045       path += "RecPoints/PHOS/";  
1046       path += "cpv/" ; 
1047       path += name ; 
1048     }  
1049     else if ( what.CompareTo("TrackSegments") == 0 ) {
1050       path += "TrackSegments/PHOS/";  
1051       path += name ; 
1052     } 
1053     else if ( what.CompareTo("RecParticles") == 0 ) {
1054       path += "RecParticles/PHOS/";  
1055       path += name ; 
1056     } 
1057     else if ( what.CompareTo("Alarms") == 0 ) {
1058       path += "QAAlarms/PHOS/";  
1059       path += name ; 
1060     } 
1061   }
1062   path.Prepend("YSAlice/") ;
1063   TObject * phosO  = (TObject*)gROOT->FindObjectAny(path) ; 
1064   if (!phosO) {
1065     cerr << "ERROR : AliPHOSGetter::ReturnO -> Object " << path << " not found!" << endl ; 
1066     abort() ;
1067   }
1068   return phosO ;
1069 }
1070   
1071 //____________________________________________________________________________ 
1072 const TTask * AliPHOSGetter::ReturnT(TString what, TString name) const 
1073 {
1074   // get the TTask named "what" from the folder
1075   // folders are named like //YSAlice/Tasks/what/PHOS/name
1076
1077   TString path("tasks") ;
1078  
1079   if ( what.CompareTo("SDigitizer") == 0 ) 
1080     path += "/SDigitizer" ;
1081   else if ( what.CompareTo("Digitizer") == 0 ) 
1082     path += "/Digitizer" ; 
1083   else if ( what.CompareTo("Clusterizer") == 0 ) 
1084     path += "/Reconstructioner" ; 
1085   else if ( what.CompareTo("TrackSegmentMaker") == 0 ) 
1086     path += "/Reconstructioner" ; 
1087   else if ( what.CompareTo("PID") == 0 ) 
1088     path += "/Reconstructioner" ; 
1089   else if ( what.CompareTo("QATasks") == 0 ) 
1090     path += "/QA" ; 
1091
1092   TFolder * aliceF  = (TFolder*)gROOT ->FindObjectAny("YSAlice") ; 
1093   TTask   * aliceT  = (TTask*)  aliceF->FindObject(path) ; 
1094
1095   if (!aliceT) {
1096     cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << path << " not found!" << endl ;  
1097     abort() ;
1098   }
1099
1100   TTask   * phosT   = (TTask*)  aliceT->GetListOfTasks()->FindObject("PHOS") ; 
1101   if (!phosT) { 
1102     cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << path << "/PHOS not found!" << endl ;  
1103     abort() ;
1104   }
1105   TList * l = phosT->GetListOfTasks() ; 
1106  
1107   if (what.CompareTo("SDigitizer") == 0) {  
1108     if ( name.IsNull() )
1109       name =  fSDigitsTitle ; 
1110   } else  if (what.CompareTo("Digitizer") == 0){ 
1111     if ( name.IsNull() )
1112       name =  fDigitsTitle ;
1113   } else  if (what.CompareTo("Clusterizer") == 0){ 
1114     if ( name.IsNull() )
1115       name =  fRecPointsTitle ;
1116   }
1117   else  if (what.CompareTo("TrackSegmentMaker") == 0){ 
1118     if ( name.IsNull() )
1119       name =  fTrackSegmentsTitle ;
1120   }
1121   else  if (what.CompareTo("PID") == 0){ 
1122     if ( name.IsNull() )
1123       name =  fRecParticlesTitle ;
1124   }
1125     else  if (what.CompareTo("QATasks") == 0){ 
1126     if ( name.IsNull() )
1127       return phosT ;
1128   }
1129
1130   TTask * task = (TTask*)l->FindObject(name) ; 
1131
1132   if (!task)
1133     cout << "WARNING: AliPHOSGetter::ReturnT -> Task " << path << "/" << name << " not found!" << endl ; 
1134   
1135   return task ;
1136 }