Introduced a new time information (fastest track making the digit) to be used to...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALReconstructor.cxx
CommitLineData
f6019cda 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//*--
20//*-- Yves Schutz (SUBATECH)
21// Reconstruction class. Redesigned from the old AliReconstructionner class and
22// derived from STEER/AliReconstructor.
23//
24// --- ROOT system ---
25
26// --- Standard library ---
27
28// --- AliRoot header files ---
29#include "AliESD.h"
30#include "AliEMCALReconstructor.h"
31#include "AliEMCALClusterizerv1.h"
32#include "AliEMCALPIDv1.h"
33#include "AliEMCALGetter.h"
34
35ClassImp(AliEMCALReconstructor)
36
37//____________________________________________________________________________
38 AliEMCALReconstructor::AliEMCALReconstructor() : fDebug(kFALSE)
39{
40 // ctor
41
42}
43
44
45//____________________________________________________________________________
46AliEMCALReconstructor::~AliEMCALReconstructor()
47{
48 // dtor
49}
50
51//____________________________________________________________________________
52void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader) const
53{
54 // method called by AliReconstruction;
55 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
56 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
57 // the global tracking.
58
59 TString headerFile(runLoader->GetFileName()) ;
b4975670 60 TString branchName(runLoader->GetEventFolder()->GetName() ) ;
f6019cda 61
62 AliEMCALClusterizerv1 clu(headerFile, branchName);
63 clu.SetEventRange(0, -1) ; // do all the events
64 if ( Debug() )
65 clu.ExecuteTask("deb all") ;
66 else
67 clu.ExecuteTask("") ;
68
f6019cda 69}
70
71//____________________________________________________________________________
72void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
73{
74 // Called by AliReconstruct after Reconstruct() and global tracking and vertxing
75 //Creates the tracksegments and Recparticles
76
b4975670 77 Int_t eventNumber = runLoader->GetEventNumber() ;
78
f6019cda 79 TString headerFile(runLoader->GetFileName()) ;
b4975670 80 TString branchName(runLoader->GetEventFolder()->GetName()) ;
f6019cda 81
82 AliEMCALPIDv1 pid(headerFile, branchName);
83
b4975670 84
f6019cda 85 // do current event; the loop over events is done by AliReconstruction::Run()
f6019cda 86 pid.SetEventRange(eventNumber, eventNumber) ;
87 if ( Debug() )
b4975670 88 pid.ExecuteTask("deb all") ;
f6019cda 89 else
90 pid.ExecuteTask("") ;
b4975670 91
f6019cda 92 // Creates AliESDtrack from AliEMCALRecParticles
93 AliEMCALGetter::Instance()->Event(eventNumber, "P") ;
94 TClonesArray *recParticles = AliEMCALGetter::Instance()->RecParticles();
95 Int_t nOfRecParticles = recParticles->GetEntries();
b4975670 96 esd->SetNumberOfEMCALParticles(nOfRecParticles) ;
97 esd->SetFirstEMCALParticle(esd->GetNumberOfTracks()) ;
f6019cda 98 for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
99 AliEMCALRecParticle * rp = dynamic_cast<AliEMCALRecParticle*>(recParticles->At(recpart));
100 if (Debug())
101 rp->Print();
102 AliESDtrack * et = new AliESDtrack() ;
103 // fills the ESDtrack
104 Double_t xyz[3];
105 for (Int_t ixyz=0; ixyz<3; ixyz++)
106 xyz[ixyz] = rp->GetPos()[ixyz];
b4975670 107 et->SetEMCALposition(xyz) ;
108 et->SetEMCALsignal (rp->Energy()) ;
109 et->SetEMCALpid (rp->GetPID()) ;
f6019cda 110 // add the track to the esd object
111 esd->AddTrack(et);
112 delete et;
113 }
114}