Introducing the AliEMCALReconstructor class driving from AliReconstructor
[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()) ;
60 TString branchName("Default") ;
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
69 AliEMCALGetter::Instance()->EmcalLoader()->CleanReconstructioner();
70}
71
72//____________________________________________________________________________
73void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
74{
75 // Called by AliReconstruct after Reconstruct() and global tracking and vertxing
76 //Creates the tracksegments and Recparticles
77
78 TString headerFile(runLoader->GetFileName()) ;
79 TString branchName("Default") ;
80
81 AliEMCALPIDv1 pid(headerFile, branchName);
82
83 Int_t eventNumber = runLoader->GetEventNumber() ;
84 // do current event; the loop over events is done by AliReconstruction::Run()
85 Info("FillESD 1", "%d", eventNumber) ;
86 pid.SetEventRange(eventNumber, eventNumber) ;
87 if ( Debug() )
88 pid.ExecuteTask("deb all") ;
89 else
90 pid.ExecuteTask("") ;
91
92 // Creates AliESDtrack from AliEMCALRecParticles
93 AliEMCALGetter::Instance()->Event(eventNumber, "P") ;
94 TClonesArray *recParticles = AliEMCALGetter::Instance()->RecParticles();
95 Int_t nOfRecParticles = recParticles->GetEntries();
96 for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
97 AliEMCALRecParticle * rp = dynamic_cast<AliEMCALRecParticle*>(recParticles->At(recpart));
98 if (Debug())
99 rp->Print();
100 AliESDtrack * et = new AliESDtrack() ;
101 // fills the ESDtrack
102 Double_t xyz[3];
103 for (Int_t ixyz=0; ixyz<3; ixyz++)
104 xyz[ixyz] = rp->GetPos()[ixyz];
105 //et->SetEMCALposition(xyz) ;
106 //et->SetEMCALsignal (rp->Energy()) ;
107 //et->SetEMCALpid (rp->GetPID()) ;
108 // add the track to the esd object
109 esd->AddTrack(et);
110 delete et;
111 }
112}