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" |
a68156e6 |
34 | #include "AliRawReaderFile.h" |
f6019cda |
35 | |
36 | ClassImp(AliEMCALReconstructor) |
37 | |
38 | //____________________________________________________________________________ |
39 | AliEMCALReconstructor::AliEMCALReconstructor() : fDebug(kFALSE) |
40 | { |
41 | // ctor |
42 | |
43 | } |
44 | |
45 | |
46 | //____________________________________________________________________________ |
47 | AliEMCALReconstructor::~AliEMCALReconstructor() |
48 | { |
49 | // dtor |
50 | } |
51 | |
52 | //____________________________________________________________________________ |
53 | void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader) const |
54 | { |
55 | // method called by AliReconstruction; |
56 | // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track |
57 | // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by |
58 | // the global tracking. |
59 | |
60 | TString headerFile(runLoader->GetFileName()) ; |
b4975670 |
61 | TString branchName(runLoader->GetEventFolder()->GetName() ) ; |
f6019cda |
62 | |
63 | AliEMCALClusterizerv1 clu(headerFile, branchName); |
64 | clu.SetEventRange(0, -1) ; // do all the events |
65 | if ( Debug() ) |
66 | clu.ExecuteTask("deb all") ; |
67 | else |
68 | clu.ExecuteTask("") ; |
69 | |
f6019cda |
70 | } |
71 | |
a68156e6 |
72 | //____________________________________________________________________________ |
73 | void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReaderFile* rawreader) const |
74 | { |
75 | // method called by AliReconstruction; |
76 | // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track |
77 | // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by |
78 | // the global tracking. |
79 | // Here we reconstruct from Raw Data |
80 | |
81 | rawreader->Reset() ; |
82 | TString headerFile(runLoader->GetFileName()) ; |
83 | TString branchName(runLoader->GetEventFolder()->GetName()) ; |
84 | |
85 | AliEMCALClusterizerv1 clu(headerFile, branchName); |
86 | clu.SetEventRange(0, -1) ; // do all the events |
87 | if ( Debug() ) |
88 | clu.ExecuteTask("deb all") ; |
89 | else |
90 | clu.ExecuteTask("") ; |
91 | |
92 | } |
93 | |
f6019cda |
94 | //____________________________________________________________________________ |
95 | void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const |
96 | { |
97 | // Called by AliReconstruct after Reconstruct() and global tracking and vertxing |
98 | //Creates the tracksegments and Recparticles |
99 | |
b4975670 |
100 | Int_t eventNumber = runLoader->GetEventNumber() ; |
101 | |
1963b290 |
102 | TString headerFile(runLoader->GetFileName()) ; |
103 | TString branchName(runLoader->GetEventFolder()->GetName()) ; |
104 | |
105 | AliEMCALPIDv1 pid(headerFile, branchName); |
106 | |
107 | |
108 | // do current event; the loop over events is done by AliReconstruction::Run() |
109 | pid.SetEventRange(eventNumber, eventNumber) ; |
110 | if ( Debug() ) |
111 | pid.ExecuteTask("deb all") ; |
112 | else |
113 | pid.ExecuteTask("") ; |
114 | |
f6019cda |
115 | // Creates AliESDtrack from AliEMCALRecParticles |
116 | AliEMCALGetter::Instance()->Event(eventNumber, "P") ; |
117 | TClonesArray *recParticles = AliEMCALGetter::Instance()->RecParticles(); |
118 | Int_t nOfRecParticles = recParticles->GetEntries(); |
b4975670 |
119 | esd->SetNumberOfEMCALParticles(nOfRecParticles) ; |
120 | esd->SetFirstEMCALParticle(esd->GetNumberOfTracks()) ; |
f6019cda |
121 | for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) { |
122 | AliEMCALRecParticle * rp = dynamic_cast<AliEMCALRecParticle*>(recParticles->At(recpart)); |
123 | if (Debug()) |
124 | rp->Print(); |
125 | AliESDtrack * et = new AliESDtrack() ; |
126 | // fills the ESDtrack |
127 | Double_t xyz[3]; |
128 | for (Int_t ixyz=0; ixyz<3; ixyz++) |
129 | xyz[ixyz] = rp->GetPos()[ixyz]; |
b4975670 |
130 | et->SetEMCALposition(xyz) ; |
131 | et->SetEMCALsignal (rp->Energy()) ; |
132 | et->SetEMCALpid (rp->GetPID()) ; |
f6019cda |
133 | // add the track to the esd object |
134 | esd->AddTrack(et); |
135 | delete et; |
136 | } |
137 | } |