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" |
23904d16 |
35 | #include "AliPHOSTracker.h" |
a68156e6 |
36 | #include "AliRawReaderFile.h" |
e957fea8 |
37 | |
2e60107f |
38 | |
f444a19f |
39 | ClassImp(AliPHOSReconstructor) |
d15a28e7 |
40 | |
2e60107f |
41 | Bool_t AliPHOSReconstructor::fgDebug = kFALSE ; |
42 | |
d15a28e7 |
43 | //____________________________________________________________________________ |
2e60107f |
44 | AliPHOSReconstructor::AliPHOSReconstructor() |
d15a28e7 |
45 | { |
b2a60966 |
46 | // ctor |
0379a13e |
47 | |
6ad0bfa0 |
48 | } |
49 | |
0379a13e |
50 | //____________________________________________________________________________ |
51 | AliPHOSReconstructor::~AliPHOSReconstructor() |
52 | { |
53 | // dtor |
54 | |
55 | } |
7acf6008 |
56 | |
7acf6008 |
57 | //____________________________________________________________________________ |
dfe0be07 |
58 | void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const |
35293055 |
59 | { |
dfe0be07 |
60 | // method called by AliReconstruction; |
61 | // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track |
62 | // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by |
63 | // the global tracking. |
64 | |
65 | TString headerFile(runLoader->GetFileName()) ; |
9ee4fde2 |
66 | TString branchName(runLoader->GetEventFolder()->GetName()) ; |
a68156e6 |
67 | |
68 | AliPHOSClusterizerv1 clu(headerFile, branchName); |
69 | clu.SetEventRange(0, -1) ; // do all the events |
70 | if ( Debug() ) |
71 | clu.ExecuteTask("deb all") ; |
72 | else |
73 | clu.ExecuteTask("") ; |
74 | |
75 | } |
76 | |
77 | //____________________________________________________________________________ |
3255d660 |
78 | void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const |
a68156e6 |
79 | { |
80 | // method called by AliReconstruction; |
81 | // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track |
82 | // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by |
83 | // the global tracking. |
84 | // Here we reconstruct from Raw Data |
85 | |
86 | rawreader->Reset() ; |
87 | TString headerFile(runLoader->GetFileName()) ; |
88 | TString branchName(runLoader->GetEventFolder()->GetName()) ; |
35293055 |
89 | |
dfe0be07 |
90 | AliPHOSClusterizerv1 clu(headerFile, branchName); |
91 | clu.SetEventRange(0, -1) ; // do all the events |
92 | if ( Debug() ) |
93 | clu.ExecuteTask("deb all") ; |
94 | else |
95 | clu.ExecuteTask("") ; |
0379a13e |
96 | |
35293055 |
97 | } |
7acf6008 |
98 | |
7acf6008 |
99 | //____________________________________________________________________________ |
dfe0be07 |
100 | void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const |
7acf6008 |
101 | { |
23904d16 |
102 | // This function creates AliESDtracks from AliPHOSRecParticles |
103 | // and |
104 | // writes them to the ESD |
bf72996e |
105 | |
23904d16 |
106 | Int_t eventNumber = runLoader->GetEventNumber() ; |
dfe0be07 |
107 | |
0379a13e |
108 | AliPHOSGetter::Instance()->Event(eventNumber, "P") ; |
109 | TClonesArray *recParticles = AliPHOSGetter::Instance()->RecParticles(); |
dfe0be07 |
110 | Int_t nOfRecParticles = recParticles->GetEntries(); |
8013c27e |
111 | esd->SetNumberOfPHOSParticles(nOfRecParticles) ; |
112 | esd->SetFirstPHOSParticle(esd->GetNumberOfTracks()) ; |
113 | |
dfe0be07 |
114 | for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) { |
115 | AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart)); |
116 | if (Debug()) |
117 | rp->Print(); |
118 | AliESDtrack * et = new AliESDtrack() ; |
119 | // fills the ESDtrack |
120 | Double_t xyz[3]; |
8013c27e |
121 | for (Int_t ixyz=0; ixyz<3; ixyz++) |
122 | xyz[ixyz] = rp->GetPos()[ixyz]; |
dfe0be07 |
123 | et->SetPHOSposition(xyz) ; |
124 | et->SetPHOSsignal (rp->Energy()) ; |
125 | et->SetPHOSpid (rp->GetPID()) ; |
fd7be713 |
126 | et->SetLabel (rp->GetPrimaryIndex()); |
dfe0be07 |
127 | // add the track to the esd object |
128 | esd->AddTrack(et); |
129 | delete et; |
7acf6008 |
130 | } |
d7d3b67b |
131 | } |
23904d16 |
132 | |
133 | AliTracker* AliPHOSReconstructor::CreateTracker(AliRunLoader* runLoader) const |
134 | { |
135 | // creates the PHOS tracker |
136 | if (!runLoader) return NULL; |
137 | return new AliPHOSTracker(runLoader); |
138 | } |
139 | |