]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALReconstructor.cxx
update of Jenn and Marco
[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 ---
f6019cda 29#include "AliEMCALReconstructor.h"
5dee926e 30
31#include "AliESD.h"
32#include "AliRunLoader.h"
33#include "AliEMCALLoader.h"
f6019cda 34#include "AliEMCALClusterizerv1.h"
5dee926e 35#include "AliEMCALRecPoint.h"
a68156e6 36#include "AliRawReaderFile.h"
f6019cda 37
38ClassImp(AliEMCALReconstructor)
39
40//____________________________________________________________________________
41 AliEMCALReconstructor::AliEMCALReconstructor() : fDebug(kFALSE)
42{
43 // ctor
44
45}
46
47
48//____________________________________________________________________________
49AliEMCALReconstructor::~AliEMCALReconstructor()
50{
51 // dtor
52}
53
54//____________________________________________________________________________
55void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader) const
56{
57 // method called by AliReconstruction;
58 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
59 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
60 // the global tracking.
61
62 TString headerFile(runLoader->GetFileName()) ;
b4975670 63 TString branchName(runLoader->GetEventFolder()->GetName() ) ;
f6019cda 64
65 AliEMCALClusterizerv1 clu(headerFile, branchName);
66 clu.SetEventRange(0, -1) ; // do all the events
67 if ( Debug() )
68 clu.ExecuteTask("deb all") ;
69 else
70 clu.ExecuteTask("") ;
71
f6019cda 72}
73
a68156e6 74//____________________________________________________________________________
5dee926e 75void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const
a68156e6 76{
77 // method called by AliReconstruction;
78 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
79 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
80 // the global tracking.
81 // Here we reconstruct from Raw Data
82
83 rawreader->Reset() ;
84 TString headerFile(runLoader->GetFileName()) ;
85 TString branchName(runLoader->GetEventFolder()->GetName()) ;
86
87 AliEMCALClusterizerv1 clu(headerFile, branchName);
88 clu.SetEventRange(0, -1) ; // do all the events
89 if ( Debug() )
90 clu.ExecuteTask("deb all") ;
91 else
92 clu.ExecuteTask("") ;
93
94}
95
f6019cda 96//____________________________________________________________________________
97void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
98{
99 // Called by AliReconstruct after Reconstruct() and global tracking and vertxing
f6019cda 100
b4975670 101 Int_t eventNumber = runLoader->GetEventNumber() ;
102
1963b290 103 TString headerFile(runLoader->GetFileName()) ;
104 TString branchName(runLoader->GetEventFolder()->GetName()) ;
105
5dee926e 106 // PID is not implemented. Skipping for now
107 //AliEMCALPIDv1 pid(headerFile, branchName);
1963b290 108
109 // do current event; the loop over events is done by AliReconstruction::Run()
5dee926e 110 /*
1963b290 111 pid.SetEventRange(eventNumber, eventNumber) ;
112 if ( Debug() )
113 pid.ExecuteTask("deb all") ;
114 else
115 pid.ExecuteTask("") ;
5dee926e 116 */
117
118 // Creates AliESDtrack from AliEMCALRecPoints
119 AliRunLoader *rl = AliRunLoader::GetRunLoader();
120 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
121 rl->LoadRecPoints();
122 rl->GetEvent(eventNumber);
123 TObjArray *clusters = emcalLoader->RecPoints();
124 Int_t nClusters = clusters->GetEntries();
125 esd->SetNumberOfEMCALParticles(nClusters) ;
b4975670 126 esd->SetFirstEMCALParticle(esd->GetNumberOfTracks()) ;
5dee926e 127 for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) {
128 const AliEMCALRecPoint * clust = emcalLoader->RecPoint(iClust);
f6019cda 129 if (Debug())
5dee926e 130 clust->Print();
f6019cda 131 AliESDtrack * et = new AliESDtrack() ;
132 // fills the ESDtrack
133 Double_t xyz[3];
5dee926e 134 TVector3 gpos;
135 clust->GetGlobalPosition(gpos);
f6019cda 136 for (Int_t ixyz=0; ixyz<3; ixyz++)
5dee926e 137 xyz[ixyz] = gpos[ixyz];
b4975670 138 et->SetEMCALposition(xyz) ;
5dee926e 139 et->SetEMCALsignal (clust->GetEnergy()) ;
f6019cda 140 // add the track to the esd object
141 esd->AddTrack(et);
142 delete et;
143 }
144}