]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSReconstructor.cxx
Added GetPrimary method to retrieve the primary particle associated to the SDigits...
[u/mrichter/AliRoot.git] / PHOS / AliPHOSReconstructor.cxx
CommitLineData
d15a28e7 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
d15a28e7 18//_________________________________________________________________________
a3dfe79c 19//*--
dfe0be07 20//*-- Yves Schutz (SUBATECH)
21// Reconstruction class. Redesigned from the old AliReconstructionner class and
22// derived from STEER/AliReconstructor.
23//
d15a28e7 24// --- ROOT system ---
25
d15a28e7 26// --- Standard library ---
364de5c6 27
d15a28e7 28// --- AliRoot header files ---
35293055 29#include "AliESD.h"
f444a19f 30#include "AliPHOSReconstructor.h"
7acf6008 31#include "AliPHOSClusterizerv1.h"
7acf6008 32#include "AliPHOSTrackSegmentMakerv1.h"
33#include "AliPHOSPIDv1.h"
35293055 34#include "AliPHOSGetter.h"
e957fea8 35
d15a28e7 36
f444a19f 37ClassImp(AliPHOSReconstructor)
d15a28e7 38
d15a28e7 39//____________________________________________________________________________
dfe0be07 40 AliPHOSReconstructor::AliPHOSReconstructor() : fDebug(kFALSE)
d15a28e7 41{
b2a60966 42 // ctor
0379a13e 43
6ad0bfa0 44}
45
0379a13e 46//____________________________________________________________________________
47 AliPHOSReconstructor::~AliPHOSReconstructor()
48{
49 // dtor
50
51}
7acf6008 52
7acf6008 53//____________________________________________________________________________
dfe0be07 54void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const
35293055 55{
dfe0be07 56 // method called by AliReconstruction;
57 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
58 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
59 // the global tracking.
60
61 TString headerFile(runLoader->GetFileName()) ;
9ee4fde2 62 TString branchName(runLoader->GetEventFolder()->GetName()) ;
35293055 63
dfe0be07 64 AliPHOSClusterizerv1 clu(headerFile, branchName);
65 clu.SetEventRange(0, -1) ; // do all the events
66 if ( Debug() )
67 clu.ExecuteTask("deb all") ;
68 else
69 clu.ExecuteTask("") ;
0379a13e 70
35293055 71}
7acf6008 72
7acf6008 73//____________________________________________________________________________
dfe0be07 74void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
7acf6008 75{
dfe0be07 76 // Called by AliReconstruct after Reconstruct() and global tracking and vertxing
77 //Creates the tracksegments and Recparticles
78
bf72996e 79 Int_t eventNumber = runLoader->GetEventNumber() ;
80
dfe0be07 81 TString headerFile(runLoader->GetFileName()) ;
bf72996e 82 TString branchName(runLoader->GetEventFolder()->GetName()) ;
dfe0be07 83
0379a13e 84 AliPHOSTrackSegmentMakerv1 tsm(headerFile, branchName);
8013c27e 85 tsm.SetESD(esd) ;
0379a13e 86 AliPHOSPIDv1 pid(headerFile, branchName);
dfe0be07 87
dfe0be07 88 // do current event; the loop over events is done by AliReconstruction::Run()
0379a13e 89 tsm.SetEventRange(eventNumber, eventNumber) ;
90 pid.SetEventRange(eventNumber, eventNumber) ;
dfe0be07 91 if ( Debug() ) {
0379a13e 92 tsm.ExecuteTask("deb all") ;
93 pid.ExecuteTask("deb all") ;
7acf6008 94 }
dfe0be07 95 else {
0379a13e 96 tsm.ExecuteTask("") ;
97 pid.ExecuteTask("") ;
7acf6008 98 }
dfe0be07 99
100 // Creates AliESDtrack from AliPHOSRecParticles
0379a13e 101 AliPHOSGetter::Instance()->Event(eventNumber, "P") ;
102 TClonesArray *recParticles = AliPHOSGetter::Instance()->RecParticles();
dfe0be07 103 Int_t nOfRecParticles = recParticles->GetEntries();
8013c27e 104 esd->SetNumberOfPHOSParticles(nOfRecParticles) ;
105 esd->SetFirstPHOSParticle(esd->GetNumberOfTracks()) ;
106
dfe0be07 107 for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
108 AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
109 if (Debug())
110 rp->Print();
111 AliESDtrack * et = new AliESDtrack() ;
112 // fills the ESDtrack
113 Double_t xyz[3];
8013c27e 114 for (Int_t ixyz=0; ixyz<3; ixyz++)
115 xyz[ixyz] = rp->GetPos()[ixyz];
dfe0be07 116 et->SetPHOSposition(xyz) ;
117 et->SetPHOSsignal (rp->Energy()) ;
118 et->SetPHOSpid (rp->GetPID()) ;
119 // add the track to the esd object
120 esd->AddTrack(et);
121 delete et;
7acf6008 122 }
d7d3b67b 123}