Introduced a new time information (fastest track making the digit) to be used to...
[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
2e60107f 36
f444a19f 37ClassImp(AliPHOSReconstructor)
d15a28e7 38
2e60107f 39Bool_t AliPHOSReconstructor::fgDebug = kFALSE ;
40
d15a28e7 41//____________________________________________________________________________
2e60107f 42 AliPHOSReconstructor::AliPHOSReconstructor()
d15a28e7 43{
b2a60966 44 // ctor
0379a13e 45
6ad0bfa0 46}
47
0379a13e 48//____________________________________________________________________________
49 AliPHOSReconstructor::~AliPHOSReconstructor()
50{
51 // dtor
52
53}
7acf6008 54
7acf6008 55//____________________________________________________________________________
dfe0be07 56void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const
35293055 57{
dfe0be07 58 // method called by AliReconstruction;
59 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
60 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
61 // the global tracking.
62
63 TString headerFile(runLoader->GetFileName()) ;
9ee4fde2 64 TString branchName(runLoader->GetEventFolder()->GetName()) ;
35293055 65
dfe0be07 66 AliPHOSClusterizerv1 clu(headerFile, branchName);
67 clu.SetEventRange(0, -1) ; // do all the events
68 if ( Debug() )
69 clu.ExecuteTask("deb all") ;
70 else
71 clu.ExecuteTask("") ;
0379a13e 72
35293055 73}
7acf6008 74
7acf6008 75//____________________________________________________________________________
dfe0be07 76void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
7acf6008 77{
dfe0be07 78 // Called by AliReconstruct after Reconstruct() and global tracking and vertxing
79 //Creates the tracksegments and Recparticles
80
bf72996e 81 Int_t eventNumber = runLoader->GetEventNumber() ;
82
dfe0be07 83 TString headerFile(runLoader->GetFileName()) ;
bf72996e 84 TString branchName(runLoader->GetEventFolder()->GetName()) ;
dfe0be07 85
0379a13e 86 AliPHOSTrackSegmentMakerv1 tsm(headerFile, branchName);
8013c27e 87 tsm.SetESD(esd) ;
0379a13e 88 AliPHOSPIDv1 pid(headerFile, branchName);
dfe0be07 89
dfe0be07 90 // do current event; the loop over events is done by AliReconstruction::Run()
0379a13e 91 tsm.SetEventRange(eventNumber, eventNumber) ;
92 pid.SetEventRange(eventNumber, eventNumber) ;
dfe0be07 93 if ( Debug() ) {
0379a13e 94 tsm.ExecuteTask("deb all") ;
95 pid.ExecuteTask("deb all") ;
7acf6008 96 }
dfe0be07 97 else {
0379a13e 98 tsm.ExecuteTask("") ;
99 pid.ExecuteTask("") ;
7acf6008 100 }
dfe0be07 101
102 // Creates AliESDtrack from AliPHOSRecParticles
0379a13e 103 AliPHOSGetter::Instance()->Event(eventNumber, "P") ;
104 TClonesArray *recParticles = AliPHOSGetter::Instance()->RecParticles();
dfe0be07 105 Int_t nOfRecParticles = recParticles->GetEntries();
8013c27e 106 esd->SetNumberOfPHOSParticles(nOfRecParticles) ;
107 esd->SetFirstPHOSParticle(esd->GetNumberOfTracks()) ;
108
dfe0be07 109 for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
110 AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
111 if (Debug())
112 rp->Print();
113 AliESDtrack * et = new AliESDtrack() ;
114 // fills the ESDtrack
115 Double_t xyz[3];
8013c27e 116 for (Int_t ixyz=0; ixyz<3; ixyz++)
117 xyz[ixyz] = rp->GetPos()[ixyz];
dfe0be07 118 et->SetPHOSposition(xyz) ;
119 et->SetPHOSsignal (rp->Energy()) ;
120 et->SetPHOSpid (rp->GetPID()) ;
121 // add the track to the esd object
122 esd->AddTrack(et);
123 delete et;
7acf6008 124 }
d7d3b67b 125}