AliMiniHeader structure and executables addMiniHeader and printMiniHeader removed
[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
6ad0bfa0 43}
44
7acf6008 45
7acf6008 46//____________________________________________________________________________
dfe0be07 47void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const
35293055 48{
dfe0be07 49 // method called by AliReconstruction;
50 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
51 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
52 // the global tracking.
53
54 TString headerFile(runLoader->GetFileName()) ;
55 TString branchName("Default") ;
35293055 56
dfe0be07 57 AliPHOSClusterizerv1 clu(headerFile, branchName);
58 clu.SetEventRange(0, -1) ; // do all the events
59 if ( Debug() )
60 clu.ExecuteTask("deb all") ;
61 else
62 clu.ExecuteTask("") ;
35293055 63}
7acf6008 64
7acf6008 65//____________________________________________________________________________
dfe0be07 66void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
7acf6008 67{
dfe0be07 68 // Called by AliReconstruct after Reconstruct() and global tracking and vertxing
69 //Creates the tracksegments and Recparticles
70
71 TString headerFile(runLoader->GetFileName()) ;
72 TString branchName("Default") ;
73
74 AliPHOSTrackSegmentMakerv1 tsMaker(headerFile, branchName);
75 AliPHOSPIDv1 pID(headerFile, branchName);
76
77 AliPHOSGetter *gime = AliPHOSGetter::Instance( (runLoader->GetFileName()).Data() ) ;
78 Int_t eventNumber = gime->EventNumber();
79 // do current event; the loop over events is done by AliReconstruction::Run()
80 tsMaker.SetEventRange(eventNumber, eventNumber) ;
81 pID.SetEventRange(eventNumber, eventNumber) ;
82 if ( Debug() ) {
83 tsMaker.ExecuteTask("deb all") ;
84 pID.ExecuteTask("deb all") ;
7acf6008 85 }
dfe0be07 86 else {
87 tsMaker.ExecuteTask("") ;
88 pID.ExecuteTask("") ;
7acf6008 89 }
dfe0be07 90
91 // Creates AliESDtrack from AliPHOSRecParticles
92 gime->Event(eventNumber, "P") ;
93 TClonesArray *recParticles = gime->RecParticles();
94 Int_t nOfRecParticles = recParticles->GetEntries();
95 for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
96 AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
97 if (Debug())
98 rp->Print();
99 AliESDtrack * et = new AliESDtrack() ;
100 // fills the ESDtrack
101 Double_t xyz[3];
102 for (Int_t ixyz=0; ixyz<3; ixyz++) xyz[ixyz] = rp->GetPos()[ixyz];
103 et->SetPHOSposition(xyz) ;
104 et->SetPHOSsignal (rp->Energy()) ;
105 et->SetPHOSpid (rp->GetPID()) ;
106 // add the track to the esd object
107 esd->AddTrack(et);
108 delete et;
7acf6008 109 }
d7d3b67b 110}