]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSPIDv0.cxx
4f601c2073e8c95d2718e22377fd7322968d7cfb
[u/mrichter/AliRoot.git] / PHOS / AliPHOSPIDv0.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 //_________________________________________________________________________
19 // Implementation version v0 of the PHOS particle identifier 
20 // Particle identification based on the 
21 //     - CPV information, 
22 //     - Preshower information (in MIXT or GPS2 geometries)
23 //     - shower width.
24 //
25 // CPV or Preshower clusters should be closer in PHOS plane than fCpvEmcDistance (in cm).
26 // This parameter can be set by method SetCpvtoEmcDistanceCut(Float_t cut)  
27 //
28 // One can set desirable ID method by the function SetIdentificationMethod(option).
29 // Presently the following options can be used together or separately :
30 //     - "disp": use dispersion cut on shower width 
31 //               (width can be set by method SetDispersionCut(Float_t cut)
32 //     - "ell" : use cut on the axis of the ellipse, drawn around shower 
33 //       (this cut can be changed by SetShowerProfileCut(char* formula), 
34 //        where formula - any function of two variables f(lambda[0],lambda[1]).
35 //        Shower is considered as EM if f() > 0 )
36 // One can visualize current cuts calling method PlotDispersionCuts().    
37 //
38 // use case:
39 //  root [0] AliPHOSPIDv0 * p1 = new AliPHOSPIDv0("galice.root")
40 //  Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
41 //  root [1] p1->SetIdentificationMethod("disp ellipse")
42 //  root [2] p1->ExecuteTask()
43 //  root [3] AliPHOSPIDv0 * p2 = new AliPHOSPIDv0("galice1.root","ts1")
44 //  Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
45 //                // reading headers from file galice1.root and TrackSegments 
46 //                // with title "ts1"
47 //  root [4] p2->SetRecParticlesBranch("rp1")
48 //                // set file name for the branch RecParticles
49 //  root [5] p2->ExecuteTask("deb all time")
50 //                // available options
51 //                // "deb" - prints # of reconstructed particles
52 //                // "deb all" -  prints # and list of RecParticles
53 //                // "time" - prints benchmarking results
54 //                  
55 //*-- Author: Yves Schutz (SUBATECH)  & Gines Martinez (SUBATECH) & 
56 //            Dmitri Peressounko (SUBATECH & Kurchatov Institute)
57 //            Completely redesined by Dmitri Peressounko, March 2001
58
59 // --- ROOT system ---
60 #include "TROOT.h"
61 #include "TTree.h"
62 #include "TFile.h"
63 #include "TF2.h"
64 #include "TFormula.h"
65 #include "TCanvas.h"
66 #include "TFolder.h"
67 #include "TSystem.h"
68 #include "TBenchmark.h"
69 // --- Standard library ---
70
71 #include <iostream.h>
72 #include <iomanip.h>
73
74 // --- AliRoot header files ---
75
76 #include "AliRun.h"
77 #include "AliGenerator.h"
78 #include "AliPHOS.h"
79 #include "AliPHOSPIDv0.h"
80 #include "AliPHOSClusterizerv1.h"
81 #include "AliPHOSTrackSegment.h"
82 #include "AliPHOSTrackSegmentMakerv1.h"
83 #include "AliPHOSRecParticle.h"
84 #include "AliPHOSGeometry.h"
85 #include "AliPHOSGetter.h"
86
87 ClassImp( AliPHOSPIDv0) 
88
89 //____________________________________________________________________________
90 AliPHOSPIDv0::AliPHOSPIDv0():AliPHOSPID()
91
92   // default ctor
93   fFormula           = 0 ;
94   fDispersion        = 0. ; 
95   fCpvEmcDistance    = 0 ; 
96   fTimeGate          = 2.e-9 ;
97   fHeaderFileName    = "" ; 
98   fTrackSegmentsTitle= "" ; 
99   fRecPointsTitle    = "" ; 
100   fRecParticlesTitle = "" ; 
101   fIDOptions         = "dis time" ; 
102   fRecParticlesInRun = 0 ;
103   fClusterizer = 0;
104   fTSMaker = 0;
105 }
106
107 //____________________________________________________________________________
108 AliPHOSPIDv0::AliPHOSPIDv0(const char * headerFile,const char * name, const Bool_t toSplit) : AliPHOSPID(headerFile, name,toSplit)
109
110   //ctor with the indication on where to look for the track segments
111
112   fFormula        = new TFormula("LambdaCuts","(x>1)*(x<2.5)*(y>0)*(y<x)") ;   
113   fDispersion     = 2.0 ; 
114   fCpvEmcDistance = 3.0 ;
115   fTimeGate          = 2.e-9 ;
116  
117   fHeaderFileName     = GetTitle() ; 
118   fTrackSegmentsTitle = GetName() ; 
119   fRecPointsTitle     = GetName() ; 
120   fRecParticlesTitle  = GetName() ; 
121   fIDOptions          = "dis time" ;
122     
123   TString tempo(GetName()) ; 
124   tempo.Append(":") ;
125   tempo.Append(Version()) ; 
126   SetName(tempo) ; 
127   fRecParticlesInRun = 0 ; 
128
129   Init() ;
130
131 }
132
133 //____________________________________________________________________________
134 AliPHOSPIDv0::~AliPHOSPIDv0()
135
136 }
137
138 //____________________________________________________________________________
139 Float_t  AliPHOSPIDv0::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv, Option_t *  Axis)const
140 {
141   // Calculates the distance between the EMC RecPoint and the PPSD RecPoint
142  
143   const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ; 
144   TVector3 vecEmc ;
145   TVector3 vecCpv ;
146   
147   emc->GetLocalPosition(vecEmc) ;
148   cpv->GetLocalPosition(vecCpv) ; 
149   if(emc->GetPHOSMod() == cpv->GetPHOSMod()){ 
150     
151     // Correct to difference in CPV and EMC position due to different distance to center.
152     // we assume, that particle moves from center
153     Float_t dCPV = geom->GetIPtoOuterCoverDistance();
154     Float_t dEMC = geom->GetIPtoCrystalSurface() ;
155     dEMC         = dEMC / dCPV ;
156     vecCpv = dEMC * vecCpv  - vecEmc ; 
157     if (Axis == "X") return vecCpv.X();
158     if (Axis == "Y") return vecCpv.Y();
159     if (Axis == "Z") return vecCpv.Z();
160     if (Axis == "R") return vecCpv.Mag();
161   } 
162  
163   return 100000000 ;
164 }
165
166 //____________________________________________________________________________
167 void  AliPHOSPIDv0::Exec(Option_t * option) 
168 {
169   //Steering method
170   
171   if( strcmp(GetName(), "")== 0 ) 
172     Init() ;
173   
174   if(strstr(option,"tim"))
175     gBenchmark->Start("PHOSPID");
176   
177   if(strstr(option,"print")) {
178     Print("") ; 
179     return ; 
180   }
181
182   AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
183   if(gime->BranchExists("RecParticles") )
184     return ;
185
186 //   gAlice->GetEvent(0) ;
187 //   //check, if the branch with name of this" already exits?
188 //   TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
189 //   TIter next(lob) ; 
190 //   TBranch * branch = 0 ;  
191 //   Bool_t phospidfound = kFALSE, pidfound = kFALSE ; 
192   
193 //   TString taskName(GetName()) ; 
194 //   taskName.Remove(taskName.Index(Version())-1) ;
195
196 //   while ( (branch = (TBranch*)next()) && (!phospidfound || !pidfound) ) {
197 //     if ( (strcmp(branch->GetName(), "PHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) 
198 //       phospidfound = kTRUE ;
199     
200 //     else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) 
201 //       pidfound = kTRUE ; 
202 //   }
203
204 //   if ( phospidfound || pidfound ) {
205 //     cerr << "WARNING: AliPHOSPIDv0::Exec -> RecParticles and/or PIDtMaker branch with name " 
206 //       << taskName.Data() << " already exits" << endl ;
207 //     return ; 
208 //   }       
209   
210   Int_t nevents = gime->MaxEvent() ;       //(Int_t) gAlice->TreeE()->GetEntries() ;
211   Int_t ievent ;
212   
213   for(ievent = 0; ievent < nevents; ievent++){
214     gime->Event(ievent,"R") ;
215     cout << "event " << ievent << " " << gime->EmcRecPoints() << " " << gime->TrackSegments() << endl ;
216     MakeRecParticles() ;
217     
218     WriteRecParticles(ievent);
219     
220     if(strstr(option,"deb"))
221       PrintRecParticles(option) ;
222
223     //increment the total number of rec particles per run 
224     fRecParticlesInRun += gime->RecParticles()->GetEntriesFast() ; 
225
226   }
227   
228   if(strstr(option,"tim")){
229     gBenchmark->Stop("PHOSPID");
230     cout << "AliPHOSPID:" << endl ;
231     cout << "  took " << gBenchmark->GetCpuTime("PHOSPID") << " seconds for PID " 
232          <<  gBenchmark->GetCpuTime("PHOSPID")/nevents << " seconds per event " << endl ;
233     cout << endl ;
234   }
235   
236 }
237 //____________________________________________________________________________
238 void AliPHOSPIDv0::Init()
239 {
240   // Make all memory allocations that are not possible in default constructor
241   // Add the PID task to the list of PHOS tasks
242   
243   if ( strcmp(GetTitle(), "") == 0 )
244     SetTitle("galice.root") ;
245   
246   TString taskName(GetName()) ; 
247   taskName.Remove(taskName.Index(Version())-1) ;
248   
249   AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), taskName.Data(),fToSplit) ; 
250   if ( gime == 0 ) {
251     cerr << "ERROR: AliPHOSPIDv0::Init -> Could not obtain the Getter object !" << endl ; 
252     return ;
253   } 
254    
255   fSplitFile = 0 ;
256   if(fToSplit){
257     //First - extract full path if necessary
258     TString fileName(GetTitle()) ;
259     Ssiz_t islash = fileName.Last('/') ;
260     if(islash<fileName.Length())
261       fileName.Remove(islash+1,fileName.Length()) ;
262     else
263       fileName="" ;
264     fileName+="PHOS.RecData." ;
265     if((strcmp(taskName.Data(),"Default")!=0)&&(strcmp(taskName.Data(),"")!=0)){
266       fileName+=taskName ;
267       fileName+="." ;
268     }
269     fileName+="root" ;
270     fSplitFile = static_cast<TFile*>(gROOT->GetFile(fileName.Data()));   
271     if(!fSplitFile)
272       fSplitFile =  TFile::Open(fileName.Data(),"update") ;
273   }
274
275
276   gime->PostPID(this) ;
277   // create a folder on the white board //YSAlice/WhiteBoard/RecParticles/PHOS/recparticlesName
278   gime->PostRecParticles(taskName.Data() ) ; 
279   
280 }
281
282 //____________________________________________________________________________
283 void  AliPHOSPIDv0::MakeRecParticles(){
284
285   // Makes a RecParticle out of a TrackSegment
286   TString taskName(GetName()) ; 
287   taskName.Remove(taskName.Index(Version())-1) ;
288
289   AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
290   TObjArray * emcRecPoints = gime->EmcRecPoints(taskName) ; 
291   TObjArray * cpvRecPoints = gime->CpvRecPoints(taskName) ; 
292   TClonesArray * trackSegments = gime->TrackSegments(taskName) ; 
293   TClonesArray * recParticles  = gime->RecParticles(taskName) ; 
294   recParticles->Clear();
295   
296   TIter next(trackSegments) ; 
297   AliPHOSTrackSegment * ts ; 
298   Int_t index = 0 ; 
299   AliPHOSRecParticle * rp ; 
300   
301   Bool_t ellips = fIDOptions.Contains("ell",TString::kIgnoreCase ) ;
302   Bool_t disp   = fIDOptions.Contains("dis",TString::kIgnoreCase ) ;
303   Bool_t time   = fIDOptions.Contains("tim",TString::kIgnoreCase ) ;
304   
305   while ( (ts = (AliPHOSTrackSegment *)next()) ) {
306     
307     new( (*recParticles)[index] ) AliPHOSRecParticle() ;
308     rp = (AliPHOSRecParticle *)recParticles->At(index) ; 
309     rp->SetTrackSegment(index) ;
310     rp->SetIndexInList(index) ;
311     
312     AliPHOSEmcRecPoint * emc = 0 ;
313     if(ts->GetEmcIndex()>=0)
314       emc = (AliPHOSEmcRecPoint *) emcRecPoints->At(ts->GetEmcIndex()) ;
315     
316     AliPHOSRecPoint    * cpv = 0 ;
317     if(ts->GetCpvIndex()>=0)
318       cpv = (AliPHOSRecPoint *)   cpvRecPoints->At(ts->GetCpvIndex()) ;
319     
320     //set momentum and energy first
321     Float_t    e = emc->GetEnergy() ;
322     TVector3 dir = GetMomentumDirection(emc,cpv) ; 
323     dir.SetMag(e) ;
324
325     rp->SetMomentum(dir.X(),dir.Y(),dir.Z(),e) ;
326     rp->SetCalcMass(0);
327
328     //now set type (reconstructed) of the particle    
329     Int_t showerprofile = 0;  // 0 narrow and 1 wide
330     
331     if(ellips){
332       Float_t lambda[2] ;
333       emc->GetElipsAxis(lambda) ;
334       if(fFormula->Eval(lambda[0],lambda[1]) <= 0 )
335         showerprofile = 1 ;  // not narrow
336     }
337     
338     if(disp)
339       if(emc->GetDispersion() > fDispersion )
340         showerprofile = 1 ;  // not narrow
341     
342     Int_t slow = 0 ;
343     if(time)
344       if(emc->GetTime() > fTimeGate )
345         slow = 0 ; 
346         
347     // Looking at the CPV detector
348     Int_t cpvdetector= 0 ;  //1 hit and 0 no hit     
349     if(cpv)
350       if(GetDistance(emc, cpv,  "R") < fCpvEmcDistance) 
351         cpvdetector = 1 ;  
352     
353     Int_t type = showerprofile + 2 * slow  + 4 * cpvdetector ;
354     rp->SetType(type) ; 
355     rp->SetProductionVertex(0,0,0,0);
356     rp->SetFirstMother(-1);
357     rp->SetLastMother(-1);
358     rp->SetFirstDaughter(-1);
359     rp->SetLastDaughter(-1);
360     rp->SetPolarisation(0,0,0);
361     index++ ; 
362   }
363   
364 }
365
366 //____________________________________________________________________________
367 void  AliPHOSPIDv0:: Print(Option_t * option) const
368 {
369   // Print the parameters used for the particle type identification
370     cout <<  "=============== AliPHOSPID1 ================" << endl ;
371     cout <<  "Making PID "<< endl ;
372     cout <<  "    Headers file:               " << fHeaderFileName.Data() << endl ;
373     cout <<  "    RecPoints branch title:     " << fRecPointsTitle.Data() << endl ;
374     cout <<  "    TrackSegments Branch title: " << fTrackSegmentsTitle.Data() << endl ;
375     cout <<  "    RecParticles Branch title   " << fRecParticlesTitle.Data() << endl;
376     cout <<  "with parameters: " << endl ;
377     cout <<  "    Maximal EMC - CPV  distance (cm) " << fCpvEmcDistance << endl ;
378     if(fIDOptions.Contains("dis",TString::kIgnoreCase ))
379       cout <<  "                    dispersion cut " << fDispersion << endl ;
380     if(fIDOptions.Contains("ell",TString::kIgnoreCase )){
381       cout << "             Eliptic cuts function: " << endl ;
382       cout << fFormula->GetTitle() << endl ;
383     }
384     if(fIDOptions.Contains("tim",TString::kIgnoreCase ))
385       cout << "             Time Gate uzed: " << fTimeGate <<  endl ;
386     cout <<  "============================================" << endl ;
387 }
388
389 //____________________________________________________________________________
390 void  AliPHOSPIDv0::SetShowerProfileCut(char * formula)
391 {
392   //set shape of the cut on the axis of ellipce, drown around shouer
393   //shower considered "narrow" if Formula(lambda[0],lambda[1]) > 0.
394   if(fFormula) 
395     delete fFormula; 
396   fFormula = new TFormula("Lambda Cut",formula) ;
397 }
398 //____________________________________________________________________________
399 void  AliPHOSPIDv0::WriteRecParticles(Int_t event)
400 {
401  
402   AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; 
403   TString taskName(GetName()) ; 
404   taskName.Remove(taskName.Index(Version())-1) ;
405   TClonesArray * recParticles = gime->RecParticles(taskName) ; 
406   recParticles->Expand(recParticles->GetEntriesFast() ) ;
407
408   TTree * treeR ;
409   
410   if(fToSplit){
411     if(!fSplitFile)
412       return ;
413     fSplitFile->cd() ;
414     char name[10] ;
415     sprintf(name,"%s%d", "TreeR",event) ;
416     treeR = dynamic_cast<TTree*>(fSplitFile->Get(name)); 
417   }
418   else{
419     treeR = gAlice->TreeR();
420   }
421   
422   if(!treeR){
423     gAlice->MakeTree("R", fSplitFile);
424     treeR = gAlice->TreeR() ;
425   }
426
427 //  //Make branch in TreeR for RecParticles 
428 //   char * filename = 0;
429 //   if(gSystem->Getenv("CONFIG_SPLIT_FILE")!=0){   //generating file name
430 //     filename = new char[strlen(gAlice->GetBaseFile())+20] ;
431 //     sprintf(filename,"%s/PHOS.Reco.root",gAlice->GetBaseFile()) ; 
432 //   }
433   
434 //   TDirectory *cwd = gDirectory;
435   
436   //First rp
437   Int_t bufferSize = 32000 ;    
438   TBranch * rpBranch = treeR->Branch("PHOSRP",&recParticles,bufferSize);
439   rpBranch->SetTitle(fRecParticlesTitle);
440 //   if (filename) {
441 //     rpBranch->SetFile(filename);
442 //     TIter next( rpBranch->GetListOfBranches());
443 //     TBranch * sb ;
444 //     while ((sb=(TBranch*)next())) {
445 //       sb->SetFile(filename);
446 //     }   
447 //     cwd->cd();
448 //   }
449   
450   //second, pid
451   Int_t splitlevel = 0 ; 
452   AliPHOSPIDv0 * pid = this ;
453   TBranch * pidBranch = treeR->Branch("AliPHOSPID","AliPHOSPIDv0",&pid,bufferSize,splitlevel);
454   pidBranch->SetTitle(fRecParticlesTitle.Data());
455 //   if (filename) {
456 //     pidBranch->SetFile(filename);
457 //     TIter next( pidBranch->GetListOfBranches());
458 //     TBranch * sb ;
459 //     while ((sb=(TBranch*)next())) {
460 //       sb->SetFile(filename);
461 //     }   
462 //     cwd->cd();
463 //   }    
464   
465   rpBranch->Fill() ;
466   pidBranch->Fill() ;
467   
468   treeR->AutoSave() ; //Write(0,kOverwrite) ;  
469   
470 }
471
472 //____________________________________________________________________________
473 void  AliPHOSPIDv0::PlotDispersionCuts()const
474 {
475   // produces a plot of the dispersion cut
476   TCanvas*  lambdas = new TCanvas("lambdas","Cuts on the ellipse axis",200,10,700,500);
477  
478   if(fIDOptions.Contains("ell",TString::kIgnoreCase ) ){
479     TF2 * ell = new TF2("Elliptic Cuts",fFormula->GetName(),0,3,0,3) ;
480     ell->SetMinimum(0.0000001) ;
481     ell->SetMaximum(0.001) ;
482     ell->SetLineStyle(1) ;
483     ell->SetLineWidth(2) ;
484     ell->Draw() ;
485   }
486   
487   if( fIDOptions.Contains("dis",TString::kIgnoreCase ) ){
488     TF2 * dsp = new TF2("dispersion","(y<x)*(x*x+y*y < [0]*[0])",0,3,0,3) ;
489     dsp->SetParameter(0,fDispersion) ;
490     dsp->SetMinimum(0.0000001) ;
491     dsp->SetMaximum(0.001) ;
492     dsp->SetLineStyle(1) ;
493     dsp->SetLineColor(2) ;
494     dsp->SetLineWidth(2) ;
495     dsp->SetNpx(200) ;
496     dsp->SetNpy(200) ;
497     if(fIDOptions.Contains("ell",TString::kIgnoreCase ) )
498       dsp->Draw("same") ;
499     else
500       dsp->Draw() ;
501   }
502   lambdas->Update();
503 }
504
505 //____________________________________________________________________________
506 TVector3 AliPHOSPIDv0::GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv)const 
507
508   // Calculates the momentum direction:
509   //   1. if only a EMC RecPoint, direction is given by IP and this RecPoint
510   //   2. if a EMC RecPoint and CPV RecPoint, direction is given by the line through the 2 recpoints 
511   //  However because of the poor position resolution of PPSD the direction is always taken as if we were 
512   //  in case 1.
513
514   TVector3 dir(0,0,0) ; 
515   
516   TVector3 emcglobalpos ;
517   TMatrix  dummy ;
518   
519   emc->GetGlobalPosition(emcglobalpos, dummy) ;
520   
521  
522   // The following commented code becomes valid once the PPSD provides 
523   // a reasonable position resolution, at least as good as EMC ! 
524   //   TVector3 ppsdlglobalpos ;
525   //   TVector3 ppsduglobalpos ;
526   //   if( fPpsdLowRecPoint ){ // certainly a photon that has concerted
527   //     fPpsdLowRecPoint->GetGlobalPosition(ppsdlglobalpos, mdummy) ; 
528   //     dir = emcglobalpos -  ppsdlglobalpos ; 
529   //     if( fPpsdUpRecPoint ){ // not looks like a charged       
530   //        fPpsdUpRecPoint->GetGlobalPosition(ppsduglobalpos, mdummy) ; 
531   //        dir = ( dir +  emcglobalpos -  ppsduglobalpos ) * 0.5 ; 
532   //      }
533   //   }
534   //   else { // looks like a neutral
535   //    dir = emcglobalpos ;  
536   //  }
537   
538   dir = emcglobalpos ;  
539   dir.SetZ( -dir.Z() ) ;   // why ?  
540   dir.SetMag(1.) ;
541
542   //account correction to the position of IP
543   Float_t xo,yo,zo ; //Coordinates of the origin
544   gAlice->Generator()->GetOrigin(xo,yo,zo) ;
545   TVector3 origin(xo,yo,zo);
546   dir = dir - origin ;
547
548   return dir ;  
549 }
550 //____________________________________________________________________________
551 void AliPHOSPIDv0::PrintRecParticles(Option_t * option)
552 {
553   // Print table of reconstructed particles
554
555   AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; 
556
557   TString taskName(GetName()) ; 
558   taskName.Remove(taskName.Index(Version())-1) ;
559   TClonesArray * recParticles = gime->RecParticles(taskName) ; 
560   
561   cout << "AliPHOSPIDv0: event "<<gAlice->GetEvNumber()  << endl ;
562   cout << "       found " << recParticles->GetEntriesFast() << " RecParticles " << endl ;
563   
564   if(strstr(option,"all")) {  // printing found TS
565     
566     cout << "  PARTICLE "   
567          << "  Index    "  << endl ;
568       //         << "  X        "     
569       //         << "  Y        " 
570       //         << "  Z        "    
571       //         << " # of primaries "          
572       //         << " Primaries list "    <<  endl;      
573     
574     Int_t index ;
575     for (index = 0 ; index < recParticles->GetEntries() ; index++) {
576       AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) recParticles->At(index) ;       
577       
578       Text_t particle[11];
579       switch(rp->GetType()) {
580       case  AliPHOSFastRecParticle::kNEUTRALEMFAST:
581         strcpy( particle, "NEUTRAL EM FAST");
582         break;
583       case  AliPHOSFastRecParticle::kNEUTRALHAFAST:
584         strcpy(particle, "NEUTRAL HA FAST");
585         break;
586       case  AliPHOSFastRecParticle::kNEUTRALEMSLOW:
587         strcpy(particle, "NEUTRAL EM SLOW");
588         break ;
589       case  AliPHOSFastRecParticle::kNEUTRALHASLOW: 
590         strcpy(particle, "NEUTRAL HA SLOW");
591         break ;
592       case  AliPHOSFastRecParticle::kCHARGEDEMFAST:
593         strcpy(particle, "CHARGED EM FAST") ;
594         break ;
595       case  AliPHOSFastRecParticle::kCHARGEDHAFAST:
596         strcpy(particle, "CHARGED HA FAST") ;
597         break ; 
598       case  AliPHOSFastRecParticle::kCHARGEDEMSLOW:
599         strcpy(particle, "CHARGEDEMSLOW") ;
600         break ;
601       case  AliPHOSFastRecParticle::kCHARGEDHASLOW:
602         strcpy(particle, "CHARGED HA SLOW") ;
603         break ; 
604       }
605       
606       //    Int_t * primaries; 
607       //    Int_t nprimaries;
608       //    primaries = rp->GetPrimaries(nprimaries);
609       
610       cout << setw(10) << particle << "  "
611            << setw(5) <<  rp->GetIndexInList() << " "  ;
612         //         << setw(4) <<  nprimaries << "  ";
613         //      for (Int_t iprimary=0; iprimary<nprimaries; iprimary++)
614         //      cout << setw(4)  <<  primaries[iprimary] << " ";
615       cout << endl;      
616     }
617     cout << "-------------------------------------------" << endl ;
618   }
619   
620 }
621
622
623