Added the option to write objects into separate files and improved the cleaning
[u/mrichter/AliRoot.git] / PHOS / Reconstruct.C
CommitLineData
aca467af 1// YS Subatech Mai 2002
2
3//Root
4#include "TString.h"
5
6//AliRoot
8d0f3f77 7#include "STEER/AliRun.h"
aca467af 8#include "PHOS/AliPHOSSDigitizer.h"
9#include "PHOS/AliPHOSDigitizer.h"
8d0f3f77 10#include "PHOS/AliPHOSClusterizerv1.h"
11#include "PHOS/AliPHOSTrackSegmentMakerv1.h"
12#include "PHOS/AliPHOSPIDv1.h"
aca467af 13#include "EMCAL/AliEMCALSDigitizer.h"
14#include "EMCAL/AliEMCALDigitizer.h"
8d0f3f77 15#include "EMCAL/AliEMCALClusterizerv1.h"
aca467af 16
17void Hits2SDigits( Bool_t split=kFALSE, TString fileName = "galice.root") {
18
19 // usage :
20 // 1. write SDigits in the same file as Hits --------------- (OK)
21 //root [0] .L Reconstruct.C++
22 //root [1] SDigits2Digits()
23 // 2. write SDigits in a separate file, one per detector, from Hits --------------- (OK)
24 //root [0] .L Reconstruct.C++
25 //root [1] SDigits2Digits(kTRUE) // SDigits saved in [DET}.SDigits.root (DET=PHOS, EMCAL)
26
8d0f3f77 27 delete gAlice ;
28 gAlice = 0 ;
29
aca467af 30 AliPHOSSDigitizer * sdp = new AliPHOSSDigitizer(fileName) ;
31 if (split)
32 sdp->SetSplitFile() ;
33 sdp->ExecuteTask("deb") ;
34
e9fa1121 35 delete sdp ;
36
8d0f3f77 37 // AliEMCALSDigitizer * sde = new AliEMCALSDigitizer(fileName) ;
38// if (split)
39// sde->SetSplitFile() ;
40// sde->ExecuteTask("deb") ;
aca467af 41
8d0f3f77 42// delete sde ;
aca467af 43
44}
45
46//________________________________________________________________________
47void SDigits2Digits( Bool_t split=kFALSE, TString fileName = "galice.root") {
48
49 // usage :
8d0f3f77 50 // 1. write SDigits in the same file as SDigits --------------- (OK)
aca467af 51 //root [0] .L Reconstruct.C++
8d0f3f77 52 //root [1] SDigits2Digits()
53 // 2. write SDigits in a separate file, one per detector, from SDigits --------------- (OK)
aca467af 54 //root [0] .L Reconstruct.C++
8d0f3f77 55 //root [1] SDigitsDigits(kTRUE) // Digits saved in [DET}.Digits.root (DET=PHOS, EMCAL)
aca467af 56
8d0f3f77 57 delete gAlice ;
58 gAlice = 0 ;
59
e9fa1121 60 // PHOS
8d0f3f77 61 AliPHOSDigitizer * dp = 0 ;
e9fa1121 62
aca467af 63 if (split) {
64 dp = new AliPHOSDigitizer("PHOS.SDigits.root") ;
65 dp->SetSplitFile() ; }
66 else
67 dp = new AliPHOSDigitizer(fileName) ;
68
69 dp->ExecuteTask("deb") ;
70
e9fa1121 71 delete dp ;
72
73 //EMCAL
8d0f3f77 74// AliEMCALDigitizer * de = 0 ;
75
76// if (split) {
77// de = new AliEMCALDigitizer("EMCAL.SDigits.root") ;
78// de->SetSplitFile() ;
79// } else
80// de = new AliEMCALDigitizer(fileName) ;
81
82// de->ExecuteTask("deb") ;
83
84// delete de ;
85}
86
87//________________________________________________________________________
88void Digits2RecPoints( Bool_t split=kFALSE, TString fileName = "galice.root") {
89
90 // usage :
91 // 1. write RecPoints in the same file as Digits --------------- OK
92 //root [0] .L Reconstruct.C++
93 //root [1] Digits2RecPoints()
94 // 2. write RecPoints in a separate file, one per detector, from Digits --------------- OK
95 //root [0] .L Reconstruct.C++
96 //root [1] Digits2RecPoints(kTRUE) // RecPoints saved in [DET}.RecPoints.root (DET=PHOS, EMCAL)
e9fa1121 97
8d0f3f77 98 delete gAlice ;
99 gAlice = 0 ;
100
101// PHOS
102 AliPHOSClusterizer * cp = 0 ;
103
aca467af 104 if (split) {
8d0f3f77 105 cp = new AliPHOSClusterizerv1("PHOS.Digits.root") ;
106 cp->SetSplitFile() ; }
107 else
108 cp = new AliPHOSClusterizerv1(fileName) ;
109
110 cp->ExecuteTask("deb") ;
111
112 delete cp ;
113
114 //EMCAL
115 AliEMCALClusterizerv1 * ce = 0 ;
116
117 if (split) {
118 ce = new AliEMCALClusterizerv1("EMCAL.Digits.root") ;
119 ce->SetSplitFile() ;
aca467af 120 } else
8d0f3f77 121 ce = new AliEMCALClusterizerv1(fileName) ;
122
123 ce->ExecuteTask("deb") ;
124
125 delete ce ;
126}
127
128//________________________________________________________________________
129void RecPoints2TrackSegments( Bool_t split=kFALSE, TString fileName = "galice.root") {
130
131 // usage :
132 // 1. write TrackSegments in the same file as RecPoints --------------- (OK)
133 //root [0] .L Reconstruct.C++
134 //root [1] RecPoints2TrackSegments()
135 // 2. write TrackSegments in a separate file, one per detector, from RecPoints --------------- (Not needed)
136 //root [0] .L Reconstruct.C++
137 //root [1] RecPoints2TrackSegments(kTRUE) // TrackSegments saved in [DET}.RecData.root (DET=PHOS, EMCAL)
138
139 delete gAlice ;
140 gAlice = 0 ;
141
142 AliPHOSTrackSegmentMaker * tmp = 0 ;
143
144 if (split) {
145 tmp = new AliPHOSTrackSegmentMakerv1("PHOS.RecData.root") ;
146 tmp->SetSplitFile() ; }
147 else
148 tmp = new AliPHOSTrackSegmentMakerv1(fileName) ;
149
150 tmp->ExecuteTask("deb") ;
151
152 delete tmp ;
153}
154
155//________________________________________________________________________
156void TrackSegments2RecParticles( Bool_t split=kFALSE, TString fileName = "galice.root") {
157
158 // usage :
159 // 1. write RecParticles in the same file as TrackSegments --------------- (OK)
160 //root [0] .L Reconstruct.C++
161 //root [1] TrackSegments2RecParticles()
162 // 2. write RecParticles in a separate file, one per detector, from TrackSegments --------------- (Not needed)
163 //root [0] .L Reconstruct.C++
164 //root [1] TrackSegments2RecParticles(kTRUE) // RecParticles saved in [DET}.RecData.root (DET=PHOS, EMCAL)
165
166 delete gAlice ;
167 gAlice = 0 ;
168
169 AliPHOSPID * pp = 0 ;
170
171 if (split)
172 pp = new AliPHOSPIDv1("PHOS.RecData.root") ;
173 else
174 pp = new AliPHOSPIDv1(fileName) ;
e9fa1121 175
8d0f3f77 176 pp->ExecuteTask("deb") ;
e9fa1121 177
8d0f3f77 178 delete pp ;
179}
180
181//________________________________________________________________________
182void Digits2RecParticles( Bool_t split=kFALSE, TString fileName = "galice.root") {
183
184 // usage :
185 // 1. write RecPoints, TrackSegments and RecParticles in the same file as Digits --------------- (OK)
186 //root [0] .L Reconstruct.C++
187 //root [1] Digits2RecParticles()
188 // 2. write RecPoints , TrackSegments and RecParticles in a separate file, one per detector, from Digits --------------- (OK)
189 //root [0] .L Reconstruct.C++
190 //root [1] Digits2RecParticles(kTRUE) // TrackSegments saved in [DET}.RecData.root (DET=PHOS, EMCAL)
191
192
193 delete gAlice ;
194 gAlice = 0 ;
195
196 // PHOS
197 AliPHOSClusterizer * cp = 0 ;
198
199 if (split) {
200 cp = new AliPHOSClusterizerv1("PHOS.Digits.root") ;
201 cp->SetSplitFile() ; }
202 else
203 cp = new AliPHOSClusterizerv1(fileName) ;
204
205 cp->ExecuteTask("deb") ;
206
207 if (split)
208 delete cp ;
209
210 AliPHOSTrackSegmentMaker * tmp = 0 ;
211
212 if (split)
213 tmp = new AliPHOSTrackSegmentMakerv1("PHOS.RecData.root") ;
214 else
215 tmp = new AliPHOSTrackSegmentMakerv1(fileName) ;
216
217 tmp->ExecuteTask("deb") ;
218
219 AliPHOSPID * pp = 0 ;
220
221 if (split)
222 pp = new AliPHOSPIDv1("PHOS.RecData.root") ;
223 else
224 pp = new AliPHOSPIDv1(fileName) ;
225
226 pp->ExecuteTask("deb") ;
227
228 delete cp ;
229 delete tmp;
230 delete pp ;
aca467af 231}
232
233//________________________________________________________________________
234void Hits2Digits (Bool_t split=kFALSE, TString fileName = "galice.root") {
235 // usage :
236 // 1. write (S)Digits in the same file as Hits --------------- (OK)
237 //root [0] .L Reconstruct.C++
238 //root [1] Hits2Digits()
239 // 2. write (S)Digits in a separate file, one per detector, from Hits --------------- (OK)
240 //root [0] .L Reconstruct.C++
241 //root [1] Hits2Digits(kTRUE) // SDigits saved in [DET}.SDigits.root (DET=PHOS, EMCAL)
242 // Digits saved in [DET}.Digits.root (DET=PHOS, EMCAL)
243
8d0f3f77 244 delete gAlice ;
245 gAlice = 0 ;
246
e9fa1121 247 //PHOS
248 AliPHOSSDigitizer * sdp = new AliPHOSSDigitizer(fileName) ;
249 if (split)
250 sdp->SetSplitFile() ;
251 sdp->ExecuteTask("deb") ;
252
8d0f3f77 253 if (split)
254 delete sdp ;
e9fa1121 255
8d0f3f77 256 AliPHOSDigitizer * dp = 0 ;
e9fa1121 257
258 if (split) {
259 dp = new AliPHOSDigitizer("PHOS.SDigits.root") ;
260 dp->SetSplitFile() ; }
261 else
262 dp = new AliPHOSDigitizer(fileName) ;
263
264 dp->ExecuteTask("deb") ;
e9fa1121 265
e9fa1121 266 if (split)
8d0f3f77 267 delete dp ;
268
269 if (!split) {
270 delete sdp ;
271 delete dp ;
272 }
e9fa1121 273
8d0f3f77 274// //EMCAL
275// AliEMCALSDigitizer * sde = new AliEMCALSDigitizer(fileName) ;
276// if (split)
277// sde->SetSplitFile() ;
278// sde->ExecuteTask("deb") ;
e9fa1121 279
8d0f3f77 280// delete sde ;
281
282// AliEMCALDigitizer * de = 0 ;
283// if (split) {
284// de = new AliEMCALDigitizer("EMCAL.SDigits.root") ;
285// de->SetSplitFile() ;
286// } else
287// de = new AliEMCALDigitizer(fileName) ;
e9fa1121 288
8d0f3f77 289// de->ExecuteTask("deb") ;
e9fa1121 290
8d0f3f77 291// delete de ;
292
aca467af 293}
e9fa1121 294
8d0f3f77 295
e9fa1121 296