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