596a855f |
1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
fc07289e |
3 | * * |
596a855f |
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 | // class for running the reconstruction // |
21 | // // |
22 | // Clusters and tracks are created for all detectors and all events by // |
23 | // typing: // |
24 | // // |
25 | // AliReconstruction rec; // |
26 | // rec.Run(); // |
27 | // // |
28 | // The Run method returns kTRUE in case of successful execution. // |
c71de921 |
29 | // // |
30 | // If the input to the reconstruction are not simulated digits but raw data, // |
31 | // this can be specified by an argument of the Run method or by the method // |
32 | // // |
33 | // rec.SetInput("..."); // |
34 | // // |
35 | // The input formats and the corresponding argument are: // |
36 | // - DDL raw data files: directory name, ends with "/" // |
37 | // - raw data root file: root file name, extension ".root" // |
38 | // - raw data DATE file: DATE file name, any other non-empty string // |
39 | // - MC root files : empty string, default // |
40 | // // |
b26c3770 |
41 | // By default all events are reconstructed. The reconstruction can be // |
42 | // limited to a range of events by giving the index of the first and the // |
43 | // last event as an argument to the Run method or by calling // |
44 | // // |
45 | // rec.SetEventRange(..., ...); // |
46 | // // |
47 | // The index -1 (default) can be used for the last event to indicate no // |
48 | // upper limit of the event range. // |
49 | // // |
973388c2 |
50 | // In case of raw-data reconstruction the user can modify the default // |
51 | // number of events per digits/clusters/tracks file. In case the option // |
52 | // is not used the number is set 1. In case the user provides 0, than // |
53 | // the number of events is equal to the number of events inside the // |
54 | // raw-data file (i.e. one digits/clusters/tracks file): // |
55 | // // |
56 | // rec.SetNumberOfEventsPerFile(...); // |
57 | // // |
58 | // // |
596a855f |
59 | // The name of the galice file can be changed from the default // |
e583c30d |
60 | // "galice.root" by passing it as argument to the AliReconstruction // |
61 | // constructor or by // |
596a855f |
62 | // // |
63 | // rec.SetGAliceFile("..."); // |
64 | // // |
59697224 |
65 | // The local reconstruction can be switched on or off for individual // |
66 | // detectors by // |
596a855f |
67 | // // |
59697224 |
68 | // rec.SetRunLocalReconstruction("..."); // |
596a855f |
69 | // // |
70 | // The argument is a (case sensitive) string with the names of the // |
71 | // detectors separated by a space. The special string "ALL" selects all // |
72 | // available detectors. This is the default. // |
73 | // // |
c71de921 |
74 | // The reconstruction of the primary vertex position can be switched off by // |
75 | // // |
76 | // rec.SetRunVertexFinder(kFALSE); // |
77 | // // |
b8cd5251 |
78 | // The tracking and the creation of ESD tracks can be switched on for // |
79 | // selected detectors by // |
596a855f |
80 | // // |
b8cd5251 |
81 | // rec.SetRunTracking("..."); // |
596a855f |
82 | // // |
c84a5e9e |
83 | // Uniform/nonuniform field tracking switches (default: uniform field) // |
84 | // // |
1d99986f |
85 | // rec.SetUniformFieldTracking(); ( rec.SetUniformFieldTracking(kFALSE); ) // |
c84a5e9e |
86 | // // |
596a855f |
87 | // The filling of additional ESD information can be steered by // |
88 | // // |
89 | // rec.SetFillESD("..."); // |
90 | // // |
b8cd5251 |
91 | // Again, for both methods the string specifies the list of detectors. // |
92 | // The default is "ALL". // |
93 | // // |
94 | // The call of the shortcut method // |
95 | // // |
96 | // rec.SetRunReconstruction("..."); // |
97 | // // |
98 | // is equivalent to calling SetRunLocalReconstruction, SetRunTracking and // |
99 | // SetFillESD with the same detector selecting string as argument. // |
596a855f |
100 | // // |
c71de921 |
101 | // The reconstruction requires digits or raw data as input. For the creation // |
102 | // of digits and raw data have a look at the class AliSimulation. // |
596a855f |
103 | // // |
cd0b062e |
104 | // The input data of a detector can be replaced by the corresponding HLT // |
105 | // data by calling (usual detector string) // |
106 | // SetUseHLTData("..."); // |
107 | // // |
24f7a148 |
108 | // // |
596a855f |
109 | /////////////////////////////////////////////////////////////////////////////// |
110 | |
f7a1cc68 |
111 | #include <TArrayD.h> |
024a7e64 |
112 | #include <TArrayF.h> |
f7a1cc68 |
113 | #include <TArrayS.h> |
114 | #include <TChain.h> |
024a7e64 |
115 | #include <TFile.h> |
f7a1cc68 |
116 | #include <TGeoGlobalMagField.h> |
3103d196 |
117 | #include <TGeoManager.h> |
f7a1cc68 |
118 | #include <TList.h> |
2bdb9d38 |
119 | #include <TLorentzVector.h> |
325aa76f |
120 | #include <TMap.h> |
f7a1cc68 |
121 | #include <TObjArray.h> |
122 | #include <TPRegexp.h> |
123 | #include <TParameter.h> |
124 | #include <TPluginManager.h> |
4b71572b |
125 | #include <TProof.h> |
db4aeca1 |
126 | #include <TProofOutputFile.h> |
f7a1cc68 |
127 | #include <TROOT.h> |
128 | #include <TSystem.h> |
77ba28ba |
129 | #include <THashTable.h> |
6c6f2624 |
130 | #include <TGrid.h> |
131 | #include <TMessage.h> |
596a855f |
132 | |
f7a1cc68 |
133 | #include "AliAlignObj.h" |
134 | #include "AliCDBEntry.h" |
135 | #include "AliCDBManager.h" |
136 | #include "AliCDBStorage.h" |
137 | #include "AliCTPRawStream.h" |
138 | #include "AliCascadeVertexer.h" |
139 | #include "AliCentralTrigger.h" |
87932dab |
140 | #include "AliCodeTimer.h" |
f7a1cc68 |
141 | #include "AliDAQ.h" |
142 | #include "AliDetectorRecoParam.h" |
143 | #include "AliESDCaloCells.h" |
144 | #include "AliESDCaloCluster.h" |
af885e0f |
145 | #include "AliESDEvent.h" |
faffd83e |
146 | #include "AliESDMuonTrack.h" |
f7a1cc68 |
147 | #include "AliESDPmdTrack.h" |
148 | #include "AliESDTagCreator.h" |
2257f27e |
149 | #include "AliESDVertex.h" |
faffd83e |
150 | #include "AliESDcascade.h" |
f7a1cc68 |
151 | #include "AliESDfriend.h" |
faffd83e |
152 | #include "AliESDkink.h" |
596a855f |
153 | #include "AliESDpid.h" |
ff8bb5ae |
154 | #include "AliESDtrack.h" |
f7a1cc68 |
155 | #include "AliESDtrack.h" |
156 | #include "AliEventInfo.h" |
157 | #include "AliGRPObject.h" |
158 | #include "AliGRPRecoParam.h" |
159 | #include "AliGenEventHeader.h" |
25be1e5c |
160 | #include "AliGeomManager.h" |
aa3c69a9 |
161 | #include "AliGlobalQADataMaker.h" |
f7a1cc68 |
162 | #include "AliHeader.h" |
163 | #include "AliLog.h" |
164 | #include "AliMagF.h" |
165 | #include "AliMultiplicity.h" |
166 | #include "AliPID.h" |
167 | #include "AliPlaneEff.h" |
4e25ac79 |
168 | #include "AliQAv1.h" |
f7a1cc68 |
169 | #include "AliQADataMakerRec.h" |
b03591ab |
170 | #include "AliQAManager.h" |
33314186 |
171 | #include "AliRawVEvent.h" |
f7a1cc68 |
172 | #include "AliRawEventHeaderBase.h" |
cd0b062e |
173 | #include "AliRawHLTManager.h" |
f7a1cc68 |
174 | #include "AliRawReaderDate.h" |
175 | #include "AliRawReaderFile.h" |
176 | #include "AliRawReaderRoot.h" |
177 | #include "AliReconstruction.h" |
178 | #include "AliReconstructor.h" |
179 | #include "AliRun.h" |
7e88424f |
180 | #include "AliRunInfo.h" |
f7a1cc68 |
181 | #include "AliRunLoader.h" |
182 | #include "AliSysInfo.h" // memory snapshots |
183 | #include "AliTrackPointArray.h" |
184 | #include "AliTracker.h" |
185 | #include "AliTriggerClass.h" |
186 | #include "AliTriggerCluster.h" |
a6dd87ad |
187 | #include "AliTriggerIR.h" |
f7a1cc68 |
188 | #include "AliTriggerConfiguration.h" |
189 | #include "AliV0vertexer.h" |
190 | #include "AliVertexer.h" |
191 | #include "AliVertexerTracks.h" |
52dd4a8c |
192 | #include "AliTriggerRunScalers.h" |
193 | #include "AliCTPTimeParams.h" |
8b12d288 |
194 | #include "AliESDHLTDecision.h" |
44e45fac |
195 | |
596a855f |
196 | ClassImp(AliReconstruction) |
197 | |
c757bafd |
198 | //_____________________________________________________________________________ |
ac4a7581 |
199 | const char* AliReconstruction::fgkDetectorName[AliReconstruction::kNDetectors] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "ACORDE", "HLT"}; |
c757bafd |
200 | |
596a855f |
201 | //_____________________________________________________________________________ |
4b71572b |
202 | AliReconstruction::AliReconstruction(const char* gAliceFilename) : |
203 | TSelector(), |
2257f27e |
204 | fRunVertexFinder(kTRUE), |
a84e2607 |
205 | fRunVertexFinderTracks(kTRUE), |
1f46a9ae |
206 | fRunHLTTracking(kFALSE), |
e66fbafb |
207 | fRunMuonTracking(kFALSE), |
d1683eef |
208 | fRunV0Finder(kTRUE), |
209 | fRunCascadeFinder(kTRUE), |
c8025cc8 |
210 | fStopOnError(kTRUE), |
1d99986f |
211 | fWriteAlignmentData(kFALSE), |
212 | fWriteESDfriend(kFALSE), |
b647652d |
213 | fFillTriggerESD(kTRUE), |
1d99986f |
214 | |
7f68891d |
215 | fCleanESD(kTRUE), |
a023d8d8 |
216 | fV0DCAmax(3.), |
217 | fV0CsPmin(0.), |
7f68891d |
218 | fDmax(50.), |
219 | fZmax(50.), |
220 | |
1d99986f |
221 | fRunLocalReconstruction("ALL"), |
b8cd5251 |
222 | fRunTracking("ALL"), |
e583c30d |
223 | fFillESD("ALL"), |
7d566c20 |
224 | fLoadCDB(""), |
48ce48d1 |
225 | fUseTrackingErrorsForAlignment(""), |
e583c30d |
226 | fGAliceFileName(gAliceFilename), |
4b71572b |
227 | fRawInput(""), |
975320a0 |
228 | fESDOutput(""), |
81d57268 |
229 | fProofOutputFileName(""), |
230 | fProofOutputLocation(""), |
231 | fProofOutputDataset(kFALSE), |
232 | fProofOutputArchive(""), |
35042093 |
233 | fEquipIdMap(""), |
b26c3770 |
234 | fFirstEvent(0), |
235 | fLastEvent(-1), |
9d705769 |
236 | fNumberOfEventsPerFile((UInt_t)-1), |
b8cd5251 |
237 | fOptions(), |
6bae477a |
238 | fLoadAlignFromCDB(kTRUE), |
239 | fLoadAlignData("ALL"), |
cd0b062e |
240 | fUseHLTData(), |
7e88424f |
241 | fRunInfo(NULL), |
242 | fEventInfo(), |
522fdd91 |
243 | fRunScalers(NULL), |
52dd4a8c |
244 | fCTPTimeParams(NULL), |
e583c30d |
245 | |
246 | fRunLoader(NULL), |
b649205a |
247 | fRawReader(NULL), |
cd0b062e |
248 | fParentRawReader(NULL), |
b8cd5251 |
249 | |
7e88424f |
250 | fRecoParam(), |
251 | |
58e8dc31 |
252 | fSPDTrackleter(NULL), |
253 | |
f2a195c1 |
254 | fDiamondProfileSPD(NULL), |
9178838a |
255 | fDiamondProfile(NULL), |
43c9dae1 |
256 | fDiamondProfileTPC(NULL), |
77ba28ba |
257 | fListOfCosmicTriggers(NULL), |
f2a195c1 |
258 | |
6b6e4472 |
259 | fGRPData(NULL), |
444753c6 |
260 | |
6bae477a |
261 | fAlignObjArray(NULL), |
795e4a22 |
262 | fCDBUri(), |
f1c1204d |
263 | fQARefUri(), |
759c1df1 |
264 | fSpecCDBUri(), |
795e4a22 |
265 | fInitCDBCalled(kFALSE), |
266 | fSetRunNumberFromDataCalled(kFALSE), |
ce43afbe |
267 | fQADetectors("ALL"), |
268 | fQATasks("ALL"), |
7e963665 |
269 | fRunQA(kTRUE), |
6b150027 |
270 | fRunGlobalQA(kTRUE), |
e4a998ed |
271 | fSameQACycle(kFALSE), |
f1c1204d |
272 | fInitQACalled(kFALSE), |
75373542 |
273 | fWriteQAExpertData(kTRUE), |
21a3aa09 |
274 | fRunPlaneEff(kFALSE), |
275 | |
276 | fesd(NULL), |
277 | fhltesd(NULL), |
278 | fesdf(NULL), |
279 | ffile(NULL), |
280 | ftree(NULL), |
281 | fhlttree(NULL), |
21a3aa09 |
282 | ftVertexer(NULL), |
14dd053c |
283 | fIsNewRunLoader(kFALSE), |
4b71572b |
284 | fRunAliEVE(kFALSE), |
285 | fChain(NULL) |
596a855f |
286 | { |
287 | // create reconstruction object with default parameters |
002c9d1b |
288 | gGeoManager = NULL; |
b8cd5251 |
289 | |
ac4a7581 |
290 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 |
291 | fReconstructor[iDet] = NULL; |
292 | fLoader[iDet] = NULL; |
293 | fTracker[iDet] = NULL; |
294 | } |
4e25ac79 |
295 | for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) { |
252f8aa8 |
296 | fQACycles[iDet] = 999999 ; |
297 | fQAWriteExpert[iDet] = kFALSE ; |
298 | } |
299 | |
e47c4c2e |
300 | AliPID pid; |
596a855f |
301 | } |
302 | |
303 | //_____________________________________________________________________________ |
304 | AliReconstruction::AliReconstruction(const AliReconstruction& rec) : |
4b71572b |
305 | TSelector(), |
2257f27e |
306 | fRunVertexFinder(rec.fRunVertexFinder), |
a84e2607 |
307 | fRunVertexFinderTracks(rec.fRunVertexFinderTracks), |
1f46a9ae |
308 | fRunHLTTracking(rec.fRunHLTTracking), |
e66fbafb |
309 | fRunMuonTracking(rec.fRunMuonTracking), |
d1683eef |
310 | fRunV0Finder(rec.fRunV0Finder), |
311 | fRunCascadeFinder(rec.fRunCascadeFinder), |
1d99986f |
312 | fStopOnError(rec.fStopOnError), |
313 | fWriteAlignmentData(rec.fWriteAlignmentData), |
314 | fWriteESDfriend(rec.fWriteESDfriend), |
b647652d |
315 | fFillTriggerESD(rec.fFillTriggerESD), |
1d99986f |
316 | |
7f68891d |
317 | fCleanESD(rec.fCleanESD), |
a023d8d8 |
318 | fV0DCAmax(rec.fV0DCAmax), |
5e5c1aa9 |
319 | fV0CsPmin(rec.fV0CsPmin), |
7f68891d |
320 | fDmax(rec.fDmax), |
321 | fZmax(rec.fZmax), |
322 | |
1d99986f |
323 | fRunLocalReconstruction(rec.fRunLocalReconstruction), |
e583c30d |
324 | fRunTracking(rec.fRunTracking), |
325 | fFillESD(rec.fFillESD), |
7d566c20 |
326 | fLoadCDB(rec.fLoadCDB), |
48ce48d1 |
327 | fUseTrackingErrorsForAlignment(rec.fUseTrackingErrorsForAlignment), |
e583c30d |
328 | fGAliceFileName(rec.fGAliceFileName), |
4b71572b |
329 | fRawInput(rec.fRawInput), |
975320a0 |
330 | fESDOutput(rec.fESDOutput), |
81d57268 |
331 | fProofOutputFileName(rec.fProofOutputFileName), |
332 | fProofOutputLocation(rec.fProofOutputLocation), |
333 | fProofOutputDataset(rec.fProofOutputDataset), |
334 | fProofOutputArchive(rec.fProofOutputArchive), |
35042093 |
335 | fEquipIdMap(rec.fEquipIdMap), |
b26c3770 |
336 | fFirstEvent(rec.fFirstEvent), |
337 | fLastEvent(rec.fLastEvent), |
973388c2 |
338 | fNumberOfEventsPerFile(rec.fNumberOfEventsPerFile), |
b8cd5251 |
339 | fOptions(), |
6bae477a |
340 | fLoadAlignFromCDB(rec.fLoadAlignFromCDB), |
341 | fLoadAlignData(rec.fLoadAlignData), |
2972d4eb |
342 | fUseHLTData(rec.fUseHLTData), |
7e88424f |
343 | fRunInfo(NULL), |
344 | fEventInfo(), |
522fdd91 |
345 | fRunScalers(NULL), |
52dd4a8c |
346 | fCTPTimeParams(NULL), |
e583c30d |
347 | |
348 | fRunLoader(NULL), |
b649205a |
349 | fRawReader(NULL), |
2972d4eb |
350 | fParentRawReader(NULL), |
b8cd5251 |
351 | |
4b71572b |
352 | fRecoParam(rec.fRecoParam), |
7e88424f |
353 | |
58e8dc31 |
354 | fSPDTrackleter(NULL), |
355 | |
f2a195c1 |
356 | fDiamondProfileSPD(rec.fDiamondProfileSPD), |
4b71572b |
357 | fDiamondProfile(rec.fDiamondProfile), |
358 | fDiamondProfileTPC(rec.fDiamondProfileTPC), |
77ba28ba |
359 | fListOfCosmicTriggers(NULL), |
f2a195c1 |
360 | |
6b6e4472 |
361 | fGRPData(NULL), |
444753c6 |
362 | |
6bae477a |
363 | fAlignObjArray(rec.fAlignObjArray), |
ec92bee0 |
364 | fCDBUri(rec.fCDBUri), |
f1c1204d |
365 | fQARefUri(rec.fQARefUri), |
7e963665 |
366 | fSpecCDBUri(), |
795e4a22 |
367 | fInitCDBCalled(rec.fInitCDBCalled), |
368 | fSetRunNumberFromDataCalled(rec.fSetRunNumberFromDataCalled), |
ce43afbe |
369 | fQADetectors(rec.fQADetectors), |
370 | fQATasks(rec.fQATasks), |
aa3c69a9 |
371 | fRunQA(rec.fRunQA), |
372 | fRunGlobalQA(rec.fRunGlobalQA), |
e4a998ed |
373 | fSameQACycle(rec.fSameQACycle), |
f1c1204d |
374 | fInitQACalled(rec.fInitQACalled), |
75373542 |
375 | fWriteQAExpertData(rec.fWriteQAExpertData), |
21a3aa09 |
376 | fRunPlaneEff(rec.fRunPlaneEff), |
377 | |
378 | fesd(NULL), |
379 | fhltesd(NULL), |
380 | fesdf(NULL), |
381 | ffile(NULL), |
382 | ftree(NULL), |
383 | fhlttree(NULL), |
21a3aa09 |
384 | ftVertexer(NULL), |
14dd053c |
385 | fIsNewRunLoader(rec.fIsNewRunLoader), |
4b71572b |
386 | fRunAliEVE(kFALSE), |
387 | fChain(NULL) |
596a855f |
388 | { |
389 | // copy constructor |
390 | |
ec92bee0 |
391 | for (Int_t i = 0; i < rec.fOptions.GetEntriesFast(); i++) { |
efd2085e |
392 | if (rec.fOptions[i]) fOptions.Add(rec.fOptions[i]->Clone()); |
393 | } |
ac4a7581 |
394 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 |
395 | fReconstructor[iDet] = NULL; |
396 | fLoader[iDet] = NULL; |
397 | fTracker[iDet] = NULL; |
b1af1125 |
398 | } |
399 | |
4e25ac79 |
400 | for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) { |
b1af1125 |
401 | fQACycles[iDet] = rec.fQACycles[iDet]; |
252f8aa8 |
402 | fQAWriteExpert[iDet] = rec.fQAWriteExpert[iDet] ; |
403 | } |
b1af1125 |
404 | |
ec92bee0 |
405 | for (Int_t i = 0; i < rec.fSpecCDBUri.GetEntriesFast(); i++) { |
406 | if (rec.fSpecCDBUri[i]) fSpecCDBUri.Add(rec.fSpecCDBUri[i]->Clone()); |
407 | } |
596a855f |
408 | } |
409 | |
410 | //_____________________________________________________________________________ |
411 | AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) |
412 | { |
413 | // assignment operator |
4b71572b |
414 | // Used in PROOF mode |
415 | // Be very careful while modifing it! |
416 | // Simple rules to follow: |
417 | // for persistent data members - use their assignment operators |
418 | // for non-persistent ones - do nothing or take the default values from constructor |
419 | // TSelector members should not be touched |
420 | if(&rec == this) return *this; |
421 | |
4b71572b |
422 | fRunVertexFinder = rec.fRunVertexFinder; |
423 | fRunVertexFinderTracks = rec.fRunVertexFinderTracks; |
424 | fRunHLTTracking = rec.fRunHLTTracking; |
425 | fRunMuonTracking = rec.fRunMuonTracking; |
426 | fRunV0Finder = rec.fRunV0Finder; |
427 | fRunCascadeFinder = rec.fRunCascadeFinder; |
428 | fStopOnError = rec.fStopOnError; |
429 | fWriteAlignmentData = rec.fWriteAlignmentData; |
430 | fWriteESDfriend = rec.fWriteESDfriend; |
431 | fFillTriggerESD = rec.fFillTriggerESD; |
432 | |
433 | fCleanESD = rec.fCleanESD; |
434 | fV0DCAmax = rec.fV0DCAmax; |
435 | fV0CsPmin = rec.fV0CsPmin; |
436 | fDmax = rec.fDmax; |
437 | fZmax = rec.fZmax; |
438 | |
439 | fRunLocalReconstruction = rec.fRunLocalReconstruction; |
440 | fRunTracking = rec.fRunTracking; |
441 | fFillESD = rec.fFillESD; |
7d566c20 |
442 | fLoadCDB = rec.fLoadCDB; |
4b71572b |
443 | fUseTrackingErrorsForAlignment = rec.fUseTrackingErrorsForAlignment; |
444 | fGAliceFileName = rec.fGAliceFileName; |
445 | fRawInput = rec.fRawInput; |
975320a0 |
446 | fESDOutput = rec.fESDOutput; |
81d57268 |
447 | fProofOutputFileName = rec.fProofOutputFileName; |
448 | fProofOutputLocation = rec.fProofOutputLocation; |
449 | fProofOutputDataset = rec.fProofOutputDataset; |
450 | fProofOutputArchive = rec.fProofOutputArchive; |
4b71572b |
451 | fEquipIdMap = rec.fEquipIdMap; |
452 | fFirstEvent = rec.fFirstEvent; |
453 | fLastEvent = rec.fLastEvent; |
454 | fNumberOfEventsPerFile = rec.fNumberOfEventsPerFile; |
455 | |
456 | for (Int_t i = 0; i < rec.fOptions.GetEntriesFast(); i++) { |
457 | if (rec.fOptions[i]) fOptions.Add(rec.fOptions[i]->Clone()); |
458 | } |
459 | |
460 | fLoadAlignFromCDB = rec.fLoadAlignFromCDB; |
461 | fLoadAlignData = rec.fLoadAlignData; |
4b71572b |
462 | fUseHLTData = rec.fUseHLTData; |
463 | |
464 | delete fRunInfo; fRunInfo = NULL; |
465 | if (rec.fRunInfo) fRunInfo = new AliRunInfo(*rec.fRunInfo); |
466 | |
467 | fEventInfo = rec.fEventInfo; |
468 | |
522fdd91 |
469 | delete fRunScalers; fRunScalers = NULL; |
470 | if (rec.fRunScalers) fRunScalers = new AliTriggerRunScalers(*rec.fRunScalers); |
471 | |
52dd4a8c |
472 | delete fCTPTimeParams; fCTPTimeParams = NULL; |
473 | if (rec.fCTPTimeParams) fCTPTimeParams = new AliCTPTimeParams(*rec.fCTPTimeParams); |
474 | |
4b71572b |
475 | fRunLoader = NULL; |
476 | fRawReader = NULL; |
477 | fParentRawReader = NULL; |
478 | |
479 | fRecoParam = rec.fRecoParam; |
480 | |
ac4a7581 |
481 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
4b71572b |
482 | delete fReconstructor[iDet]; fReconstructor[iDet] = NULL; |
483 | delete fLoader[iDet]; fLoader[iDet] = NULL; |
484 | delete fTracker[iDet]; fTracker[iDet] = NULL; |
4b71572b |
485 | } |
b1af1125 |
486 | |
4e25ac79 |
487 | for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) { |
b1af1125 |
488 | fQACycles[iDet] = rec.fQACycles[iDet]; |
252f8aa8 |
489 | fQAWriteExpert[iDet] = rec.fQAWriteExpert[iDet] ; |
490 | } |
58e8dc31 |
491 | |
492 | delete fSPDTrackleter; fSPDTrackleter = NULL; |
252f8aa8 |
493 | |
f2a195c1 |
494 | delete fDiamondProfileSPD; fDiamondProfileSPD = NULL; |
495 | if (rec.fDiamondProfileSPD) fDiamondProfileSPD = new AliESDVertex(*rec.fDiamondProfileSPD); |
4b71572b |
496 | delete fDiamondProfile; fDiamondProfile = NULL; |
497 | if (rec.fDiamondProfile) fDiamondProfile = new AliESDVertex(*rec.fDiamondProfile); |
498 | delete fDiamondProfileTPC; fDiamondProfileTPC = NULL; |
499 | if (rec.fDiamondProfileTPC) fDiamondProfileTPC = new AliESDVertex(*rec.fDiamondProfileTPC); |
4b71572b |
500 | |
77ba28ba |
501 | delete fListOfCosmicTriggers; fListOfCosmicTriggers = NULL; |
502 | if (rec.fListOfCosmicTriggers) fListOfCosmicTriggers = (THashTable*)((rec.fListOfCosmicTriggers)->Clone()); |
503 | |
4b71572b |
504 | delete fGRPData; fGRPData = NULL; |
44e45fac |
505 | // if (rec.fGRPData) fGRPData = (TMap*)((rec.fGRPData)->Clone()); |
506 | if (rec.fGRPData) fGRPData = (AliGRPObject*)((rec.fGRPData)->Clone()); |
4b71572b |
507 | |
508 | delete fAlignObjArray; fAlignObjArray = NULL; |
509 | |
510 | fCDBUri = ""; |
f1c1204d |
511 | fQARefUri = rec.fQARefUri; |
4b71572b |
512 | fSpecCDBUri.Delete(); |
513 | fInitCDBCalled = rec.fInitCDBCalled; |
514 | fSetRunNumberFromDataCalled = rec.fSetRunNumberFromDataCalled; |
515 | fQADetectors = rec.fQADetectors; |
4b71572b |
516 | fQATasks = rec.fQATasks; |
517 | fRunQA = rec.fRunQA; |
518 | fRunGlobalQA = rec.fRunGlobalQA; |
4b71572b |
519 | fSameQACycle = rec.fSameQACycle; |
f1c1204d |
520 | fInitQACalled = rec.fInitQACalled; |
75373542 |
521 | fWriteQAExpertData = rec.fWriteQAExpertData; |
4b71572b |
522 | fRunPlaneEff = rec.fRunPlaneEff; |
523 | |
524 | fesd = NULL; |
525 | fhltesd = NULL; |
526 | fesdf = NULL; |
527 | ffile = NULL; |
528 | ftree = NULL; |
529 | fhlttree = NULL; |
530 | ftVertexer = NULL; |
531 | fIsNewRunLoader = rec.fIsNewRunLoader; |
532 | fRunAliEVE = kFALSE; |
533 | fChain = NULL; |
596a855f |
534 | |
596a855f |
535 | return *this; |
536 | } |
537 | |
538 | //_____________________________________________________________________________ |
539 | AliReconstruction::~AliReconstruction() |
540 | { |
541 | // clean up |
542 | |
e583c30d |
543 | CleanUp(); |
77ba28ba |
544 | if (fListOfCosmicTriggers) { |
545 | fListOfCosmicTriggers->Delete(); |
546 | delete fListOfCosmicTriggers; |
547 | } |
4f3c479a |
548 | delete fGRPData; |
522fdd91 |
549 | delete fRunScalers; |
52dd4a8c |
550 | delete fCTPTimeParams; |
efd2085e |
551 | fOptions.Delete(); |
4b71572b |
552 | if (fAlignObjArray) { |
553 | fAlignObjArray->Delete(); |
554 | delete fAlignObjArray; |
555 | } |
ec92bee0 |
556 | fSpecCDBUri.Delete(); |
e6d66370 |
557 | |
87932dab |
558 | AliCodeTimer::Instance()->Print(); |
596a855f |
559 | } |
560 | |
f1c1204d |
561 | //_____________________________________________________________________________ |
562 | void AliReconstruction::InitQA() |
563 | { |
564 | //Initialize the QA and start of cycle |
52dd4a8c |
565 | AliCodeTimerAuto("",0); |
f1c1204d |
566 | |
567 | if (fInitQACalled) return; |
568 | fInitQACalled = kTRUE; |
569 | |
634696f5 |
570 | AliQAManager * qam = AliQAManager::QAManager(AliQAv1::kRECMODE) ; |
75373542 |
571 | if (fWriteQAExpertData) |
eca4fa66 |
572 | qam->SetWriteExpert() ; |
75373542 |
573 | |
eca4fa66 |
574 | if (qam->IsDefaultStorageSet()) { |
f1c1204d |
575 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
576 | AliWarning("Default QA reference storage has been already set !"); |
577 | AliWarning(Form("Ignoring the default storage declared in AliReconstruction: %s",fQARefUri.Data())); |
578 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
eca4fa66 |
579 | fQARefUri = qam->GetDefaultStorage()->GetURI(); |
f1c1204d |
580 | } else { |
581 | if (fQARefUri.Length() > 0) { |
582 | AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
583 | AliDebug(2, Form("Default QA reference storage is set to: %s", fQARefUri.Data())); |
584 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
585 | } else { |
586 | fQARefUri="local://$ALICE_ROOT/QAref"; |
587 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
588 | AliWarning("Default QA refeference storage not yet set !!!!"); |
589 | AliWarning(Form("Setting it now to: %s", fQARefUri.Data())); |
590 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
591 | |
592 | } |
eca4fa66 |
593 | qam->SetDefaultStorage(fQARefUri); |
f1c1204d |
594 | } |
595 | |
596 | if (fRunQA) { |
eca4fa66 |
597 | qam->SetActiveDetectors(fQADetectors) ; |
4e25ac79 |
598 | for (Int_t det = 0 ; det < AliQAv1::kNDET ; det++) { |
eca4fa66 |
599 | qam->SetCycleLength(AliQAv1::DETECTORINDEX_t(det), fQACycles[det]) ; |
600 | qam->SetWriteExpert(AliQAv1::DETECTORINDEX_t(det)) ; |
f1c1204d |
601 | } |
514cb8c7 |
602 | if (!fRawReader && !fInput && IsInTasks(AliQAv1::kRAWS)) |
4e25ac79 |
603 | fQATasks.ReplaceAll(Form("%d",AliQAv1::kRAWS), "") ; |
eca4fa66 |
604 | qam->SetTasks(fQATasks) ; |
605 | qam->InitQADataMaker(AliCDBManager::Instance()->GetRun()) ; |
f1c1204d |
606 | } |
607 | if (fRunGlobalQA) { |
608 | Bool_t sameCycle = kFALSE ; |
eca4fa66 |
609 | AliQADataMaker *qadm = qam->GetQADataMaker(AliQAv1::kGLOBAL); |
f1c1204d |
610 | AliInfo(Form("Initializing the global QA data maker")); |
514cb8c7 |
611 | if (IsInTasks(AliQAv1::kRECPOINTS)) { |
4e25ac79 |
612 | qadm->StartOfCycle(AliQAv1::kRECPOINTS, AliCDBManager::Instance()->GetRun(), sameCycle) ; |
613 | TObjArray **arr=qadm->Init(AliQAv1::kRECPOINTS); |
f1c1204d |
614 | AliTracker::SetResidualsArray(arr); |
615 | sameCycle = kTRUE ; |
616 | } |
514cb8c7 |
617 | if (IsInTasks(AliQAv1::kESDS)) { |
4e25ac79 |
618 | qadm->StartOfCycle(AliQAv1::kESDS, AliCDBManager::Instance()->GetRun(), sameCycle) ; |
619 | qadm->Init(AliQAv1::kESDS); |
f1c1204d |
620 | } |
f1c1204d |
621 | } |
fc07289e |
622 | AliSysInfo::AddStamp("InitQA") ; |
f1c1204d |
623 | } |
624 | |
fc07289e |
625 | //_____________________________________________________________________________ |
87da0921 |
626 | void AliReconstruction::MergeQA(const char *fileName) |
fc07289e |
627 | { |
628 | //Initialize the QA and start of cycle |
52dd4a8c |
629 | AliCodeTimerAuto("",0) ; |
eca4fa66 |
630 | AliQAManager::QAManager()->Merge(AliCDBManager::Instance()->GetRun(),fileName) ; |
fc07289e |
631 | AliSysInfo::AddStamp("MergeQA") ; |
632 | } |
633 | |
024cf675 |
634 | //_____________________________________________________________________________ |
795e4a22 |
635 | void AliReconstruction::InitCDB() |
024cf675 |
636 | { |
637 | // activate a default CDB storage |
638 | // First check if we have any CDB storage set, because it is used |
639 | // to retrieve the calibration and alignment constants |
52dd4a8c |
640 | AliCodeTimerAuto("",0); |
024cf675 |
641 | |
795e4a22 |
642 | if (fInitCDBCalled) return; |
643 | fInitCDBCalled = kTRUE; |
644 | |
024cf675 |
645 | AliCDBManager* man = AliCDBManager::Instance(); |
ec92bee0 |
646 | if (man->IsDefaultStorageSet()) |
024cf675 |
647 | { |
648 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
ec92bee0 |
649 | AliWarning("Default CDB storage has been already set !"); |
650 | AliWarning(Form("Ignoring the default storage declared in AliReconstruction: %s",fCDBUri.Data())); |
024cf675 |
651 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
795e4a22 |
652 | fCDBUri = man->GetDefaultStorage()->GetURI(); |
ec92bee0 |
653 | } |
654 | else { |
795e4a22 |
655 | if (fCDBUri.Length() > 0) |
656 | { |
657 | AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
658 | AliDebug(2, Form("Default CDB storage is set to: %s", fCDBUri.Data())); |
659 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
52dd4a8c |
660 | man->SetDefaultStorage(fCDBUri); |
661 | } |
662 | else if (!man->GetRaw()){ |
663 | fCDBUri="local://$ALICE_ROOT/OCDB"; |
795e4a22 |
664 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
665 | AliWarning("Default CDB storage not yet set !!!!"); |
666 | AliWarning(Form("Setting it now to: %s", fCDBUri.Data())); |
667 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
52dd4a8c |
668 | man->SetDefaultStorage(fCDBUri); |
669 | } |
670 | else { |
671 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
672 | AliWarning("Default storage will be set after setting the Run Number!!!"); |
673 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
795e4a22 |
674 | } |
ec92bee0 |
675 | } |
676 | |
677 | // Now activate the detector specific CDB storage locations |
c3a7b59a |
678 | for (Int_t i = 0; i < fSpecCDBUri.GetEntriesFast(); i++) { |
679 | TObject* obj = fSpecCDBUri[i]; |
680 | if (!obj) continue; |
b8ec52f6 |
681 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
682 | AliDebug(2, Form("Specific CDB storage for %s is set to: %s",obj->GetName(),obj->GetTitle())); |
683 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
c3a7b59a |
684 | man->SetSpecificStorage(obj->GetName(), obj->GetTitle()); |
ec92bee0 |
685 | } |
002c9d1b |
686 | AliSysInfo::AddStamp("InitCDB"); |
024cf675 |
687 | } |
688 | |
689 | //_____________________________________________________________________________ |
690 | void AliReconstruction::SetDefaultStorage(const char* uri) { |
ec92bee0 |
691 | // Store the desired default CDB storage location |
692 | // Activate it later within the Run() method |
024cf675 |
693 | |
ec92bee0 |
694 | fCDBUri = uri; |
024cf675 |
695 | |
696 | } |
697 | |
f1c1204d |
698 | //_____________________________________________________________________________ |
699 | void AliReconstruction::SetQARefDefaultStorage(const char* uri) { |
700 | // Store the desired default CDB storage location |
701 | // Activate it later within the Run() method |
702 | |
703 | fQARefUri = uri; |
4e25ac79 |
704 | AliQAv1::SetQARefStorage(fQARefUri.Data()) ; |
f1c1204d |
705 | |
706 | } |
00aa02d5 |
707 | //_____________________________________________________________________________ |
c3a7b59a |
708 | void AliReconstruction::SetSpecificStorage(const char* calibType, const char* uri) { |
ec92bee0 |
709 | // Store a detector-specific CDB storage location |
710 | // Activate it later within the Run() method |
024cf675 |
711 | |
c3a7b59a |
712 | AliCDBPath aPath(calibType); |
713 | if(!aPath.IsValid()){ |
714 | // if calibType is not wildcard but it is a valid detector, add "/*" to make it a valid path |
ac4a7581 |
715 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
c3a7b59a |
716 | if(!strcmp(calibType, fgkDetectorName[iDet])) { |
717 | aPath.SetPath(Form("%s/*", calibType)); |
718 | AliInfo(Form("Path for specific storage set to %s", aPath.GetPath().Data())); |
719 | break; |
720 | } |
721 | } |
722 | if(!aPath.IsValid()){ |
723 | AliError(Form("Not a valid path or detector: %s", calibType)); |
724 | return; |
725 | } |
726 | } |
727 | |
53dd3c3d |
728 | // // check that calibType refers to a "valid" detector name |
729 | // Bool_t isDetector = kFALSE; |
ac4a7581 |
730 | // for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
53dd3c3d |
731 | // TString detName = fgkDetectorName[iDet]; |
732 | // if(aPath.GetLevel0() == detName) { |
733 | // isDetector = kTRUE; |
734 | // break; |
735 | // } |
736 | // } |
737 | // |
738 | // if(!isDetector) { |
739 | // AliError(Form("Not a valid detector: %s", aPath.GetLevel0().Data())); |
740 | // return; |
741 | // } |
c3a7b59a |
742 | |
743 | TObject* obj = fSpecCDBUri.FindObject(aPath.GetPath().Data()); |
ec92bee0 |
744 | if (obj) fSpecCDBUri.Remove(obj); |
c3a7b59a |
745 | fSpecCDBUri.Add(new TNamed(aPath.GetPath().Data(), uri)); |
024cf675 |
746 | |
747 | } |
748 | |
6bae477a |
749 | //_____________________________________________________________________________ |
795e4a22 |
750 | Bool_t AliReconstruction::SetRunNumberFromData() |
6bae477a |
751 | { |
752 | // The method is called in Run() in order |
753 | // to set a correct run number. |
754 | // In case of raw data reconstruction the |
755 | // run number is taken from the raw data header |
756 | |
795e4a22 |
757 | if (fSetRunNumberFromDataCalled) return kTRUE; |
758 | fSetRunNumberFromDataCalled = kTRUE; |
759 | |
760 | AliCDBManager* man = AliCDBManager::Instance(); |
4b71572b |
761 | |
762 | if(fRawReader) { |
763 | if(fRawReader->NextEvent()) { |
764 | if(man->GetRun() > 0) { |
21a3aa09 |
765 | AliWarning("Run number is taken from raw-event header! Ignoring settings in AliCDBManager!"); |
4b71572b |
766 | } |
767 | man->SetRun(fRawReader->GetRunNumber()); |
768 | fRawReader->RewindEvents(); |
769 | } |
770 | else { |
771 | if(man->GetRun() > 0) { |
772 | AliWarning("No raw-data events are found ! Using settings in AliCDBManager !"); |
773 | } |
774 | else { |
775 | AliWarning("Neither raw events nor settings in AliCDBManager are found !"); |
776 | return kFALSE; |
777 | } |
778 | } |
779 | } |
780 | else { |
781 | AliRunLoader *rl = AliRunLoader::Open(fGAliceFileName.Data()); |
782 | if (!rl) { |
783 | AliError(Form("No run loader found in file %s", fGAliceFileName.Data())); |
6bae477a |
784 | return kFALSE; |
785 | } |
ec92bee0 |
786 | else { |
4b71572b |
787 | rl->LoadHeader(); |
788 | // read run number from gAlice |
789 | if(rl->GetHeader()) { |
790 | man->SetRun(rl->GetHeader()->GetRun()); |
791 | rl->UnloadHeader(); |
792 | delete rl; |
ec92bee0 |
793 | } |
794 | else { |
4b71572b |
795 | AliError("Neither run-loader header nor RawReader objects are found !"); |
796 | delete rl; |
ec92bee0 |
797 | return kFALSE; |
798 | } |
4b71572b |
799 | } |
6bae477a |
800 | } |
795e4a22 |
801 | |
802 | man->Print(); |
803 | |
6bae477a |
804 | return kTRUE; |
805 | } |
806 | |
795e4a22 |
807 | //_____________________________________________________________________________ |
808 | void AliReconstruction::SetCDBLock() { |
809 | // Set CDB lock: from now on it is forbidden to reset the run number |
810 | // or the default storage or to activate any further storage! |
811 | |
812 | AliCDBManager::Instance()->SetLock(1); |
813 | } |
814 | |
6bae477a |
815 | //_____________________________________________________________________________ |
816 | Bool_t AliReconstruction::MisalignGeometry(const TString& detectors) |
817 | { |
818 | // Read the alignment objects from CDB. |
819 | // Each detector is supposed to have the |
820 | // alignment objects in DET/Align/Data CDB path. |
821 | // All the detector objects are then collected, |
822 | // sorted by geometry level (starting from ALIC) and |
823 | // then applied to the TGeo geometry. |
824 | // Finally an overlaps check is performed. |
825 | |
826 | // Load alignment data from CDB and fill fAlignObjArray |
827 | if(fLoadAlignFromCDB){ |
6bae477a |
828 | |
25be1e5c |
829 | TString detStr = detectors; |
830 | TString loadAlObjsListOfDets = ""; |
831 | |
ac4a7581 |
832 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
8cb26cdf |
833 | if(!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
f12d42ce |
834 | if(!strcmp(fgkDetectorName[iDet],"HLT")) continue; |
4fbb8e9d |
835 | |
836 | if(AliGeomManager::GetNalignable(fgkDetectorName[iDet]) != 0) |
8cb26cdf |
837 | { |
838 | loadAlObjsListOfDets += fgkDetectorName[iDet]; |
839 | loadAlObjsListOfDets += " "; |
840 | } |
25be1e5c |
841 | } // end loop over detectors |
4fbb8e9d |
842 | |
843 | if(AliGeomManager::GetNalignable("GRP") != 0) |
8cb26cdf |
844 | loadAlObjsListOfDets.Prepend("GRP "); //add alignment objects for non-sensitive modules |
98e303d9 |
845 | AliGeomManager::ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data()); |
e30a9b4d |
846 | AliCDBManager::Instance()->UnloadFromCache("*/Align/*"); |
25be1e5c |
847 | }else{ |
848 | // Check if the array with alignment objects was |
849 | // provided by the user. If yes, apply the objects |
850 | // to the present TGeo geometry |
851 | if (fAlignObjArray) { |
852 | if (gGeoManager && gGeoManager->IsClosed()) { |
98e303d9 |
853 | if (AliGeomManager::ApplyAlignObjsToGeom(*fAlignObjArray) == kFALSE) { |
25be1e5c |
854 | AliError("The misalignment of one or more volumes failed!" |
855 | "Compare the list of simulated detectors and the list of detector alignment data!"); |
856 | return kFALSE; |
857 | } |
858 | } |
859 | else { |
860 | AliError("Can't apply the misalignment! gGeoManager doesn't exist or it is still opened!"); |
6bae477a |
861 | return kFALSE; |
862 | } |
863 | } |
6bae477a |
864 | } |
25be1e5c |
865 | |
4b71572b |
866 | if (fAlignObjArray) { |
867 | fAlignObjArray->Delete(); |
868 | delete fAlignObjArray; fAlignObjArray=NULL; |
869 | } |
a03b0371 |
870 | |
6bae477a |
871 | return kTRUE; |
872 | } |
596a855f |
873 | |
874 | //_____________________________________________________________________________ |
875 | void AliReconstruction::SetGAliceFile(const char* fileName) |
876 | { |
877 | // set the name of the galice file |
878 | |
879 | fGAliceFileName = fileName; |
880 | } |
881 | |
21a3aa09 |
882 | //_____________________________________________________________________________ |
b58710ef |
883 | void AliReconstruction::SetInput(const char* input) |
21a3aa09 |
884 | { |
b58710ef |
885 | // In case the input string starts with 'mem://', we run in an online mode |
886 | // and AliRawReaderDateOnline object is created. In all other cases a raw-data |
887 | // file is assumed. One can give as an input: |
888 | // mem://: - events taken from DAQ monitoring libs online |
889 | // or |
890 | // mem://<filename> - emulation of the above mode (via DATE monitoring libs) |
4b71572b |
891 | if (input) fRawInput = input; |
21a3aa09 |
892 | } |
893 | |
975320a0 |
894 | //_____________________________________________________________________________ |
895 | void AliReconstruction::SetOutput(const char* output) |
896 | { |
897 | // Set the output ESD filename |
898 | // 'output' is a normalt ROOT url |
899 | // The method is used in case of raw-data reco with PROOF |
81d57268 |
900 | if (output) fESDOutput = output; |
975320a0 |
901 | } |
902 | |
efd2085e |
903 | //_____________________________________________________________________________ |
904 | void AliReconstruction::SetOption(const char* detector, const char* option) |
905 | { |
906 | // set options for the reconstruction of a detector |
907 | |
908 | TObject* obj = fOptions.FindObject(detector); |
909 | if (obj) fOptions.Remove(obj); |
910 | fOptions.Add(new TNamed(detector, option)); |
911 | } |
912 | |
7e88424f |
913 | //_____________________________________________________________________________ |
914 | void AliReconstruction::SetRecoParam(const char* detector, AliDetectorRecoParam *par) |
915 | { |
916 | // Set custom reconstruction parameters for a given detector |
917 | // Single set of parameters for all the events |
a00021a7 |
918 | |
919 | // First check if the reco-params are global |
920 | if(!strcmp(detector, "GRP")) { |
921 | par->SetAsDefault(); |
ac4a7581 |
922 | fRecoParam.AddDetRecoParam(kNDetectors,par); |
a00021a7 |
923 | return; |
924 | } |
925 | |
ac4a7581 |
926 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
7e88424f |
927 | if(!strcmp(detector, fgkDetectorName[iDet])) { |
928 | par->SetAsDefault(); |
929 | fRecoParam.AddDetRecoParam(iDet,par); |
930 | break; |
931 | } |
932 | } |
933 | |
934 | } |
935 | |
61807e09 |
936 | //_____________________________________________________________________________ |
61807e09 |
937 | Bool_t AliReconstruction::InitGRP() { |
938 | //------------------------------------ |
939 | // Initialization of the GRP entry |
940 | //------------------------------------ |
941 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); |
942 | |
4b71572b |
943 | if (entry) { |
44e45fac |
944 | |
945 | TMap* m = dynamic_cast<TMap*>(entry->GetObject()); // old GRP entry |
946 | |
947 | if (m) { |
948 | AliInfo("Found a TMap in GRP/GRP/Data, converting it into an AliGRPObject"); |
949 | m->Print(); |
950 | fGRPData = new AliGRPObject(); |
951 | fGRPData->ReadValuesFromMap(m); |
952 | } |
953 | |
954 | else { |
955 | AliInfo("Found an AliGRPObject in GRP/GRP/Data, reading it"); |
956 | fGRPData = dynamic_cast<AliGRPObject*>(entry->GetObject()); // new GRP entry |
957 | entry->SetOwner(0); |
958 | } |
959 | |
f168abba |
960 | // FIX ME: The unloading of GRP entry is temporarily disabled |
961 | // because ZDC and VZERO are using it in order to initialize |
962 | // their reconstructor objects. In the future one has to think |
963 | // of propagating AliRunInfo to the reconstructors. |
964 | // AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data"); |
4b71572b |
965 | } |
61807e09 |
966 | |
967 | if (!fGRPData) { |
968 | AliError("No GRP entry found in OCDB!"); |
969 | return kFALSE; |
970 | } |
971 | |
44e45fac |
972 | TString lhcState = fGRPData->GetLHCState(); |
973 | if (lhcState==AliGRPObject::GetInvalidString()) { |
7e88424f |
974 | AliError("GRP/GRP/Data entry: missing value for the LHC state ! Using UNKNOWN"); |
44e45fac |
975 | lhcState = "UNKNOWN"; |
7e88424f |
976 | } |
977 | |
44e45fac |
978 | TString beamType = fGRPData->GetBeamType(); |
979 | if (beamType==AliGRPObject::GetInvalidString()) { |
7e88424f |
980 | AliError("GRP/GRP/Data entry: missing value for the beam type ! Using UNKNOWN"); |
44e45fac |
981 | beamType = "UNKNOWN"; |
7e88424f |
982 | } |
983 | |
44e45fac |
984 | Float_t beamEnergy = fGRPData->GetBeamEnergy(); |
985 | if (beamEnergy==AliGRPObject::GetInvalidFloat()) { |
7e88424f |
986 | AliError("GRP/GRP/Data entry: missing value for the beam energy ! Using 0"); |
44e45fac |
987 | beamEnergy = 0; |
7e88424f |
988 | } |
1e500f25 |
989 | // LHC: "multiply by 120 to get the energy in MeV" |
990 | beamEnergy *= 0.120; |
7e88424f |
991 | |
44e45fac |
992 | TString runType = fGRPData->GetRunType(); |
993 | if (runType==AliGRPObject::GetInvalidString()) { |
7e88424f |
994 | AliError("GRP/GRP/Data entry: missing value for the run type ! Using UNKNOWN"); |
44e45fac |
995 | runType = "UNKNOWN"; |
7e88424f |
996 | } |
997 | |
44e45fac |
998 | Int_t activeDetectors = fGRPData->GetDetectorMask(); |
a5dede5c |
999 | if (activeDetectors==AliGRPObject::GetInvalidUInt()) { |
7e88424f |
1000 | AliError("GRP/GRP/Data entry: missing value for the detector mask ! Using 1074790399"); |
44e45fac |
1001 | activeDetectors = 1074790399; |
7e88424f |
1002 | } |
1003 | |
44e45fac |
1004 | fRunInfo = new AliRunInfo(lhcState, beamType, beamEnergy, runType, activeDetectors); |
44e45fac |
1005 | fRunInfo->Dump(); |
1006 | |
7e88424f |
1007 | |
1008 | // Process the list of active detectors |
44e45fac |
1009 | if (activeDetectors) { |
1010 | UInt_t detMask = activeDetectors; |
7a317bef |
1011 | fRunLocalReconstruction = MatchDetectorList(fRunLocalReconstruction,detMask); |
1012 | fRunTracking = MatchDetectorList(fRunTracking,detMask); |
1013 | fFillESD = MatchDetectorList(fFillESD,detMask); |
1014 | fQADetectors = MatchDetectorList(fQADetectors,detMask); |
7d566c20 |
1015 | fLoadCDB.Form("%s %s %s %s", |
1016 | fRunLocalReconstruction.Data(), |
1017 | fRunTracking.Data(), |
1018 | fFillESD.Data(), |
1019 | fQADetectors.Data()); |
7d566c20 |
1020 | fLoadCDB = MatchDetectorList(fLoadCDB,detMask); |
d0f84c42 |
1021 | if (!((detMask >> AliDAQ::DetectorID("ITSSPD")) & 0x1) && |
1022 | !((detMask >> AliDAQ::DetectorID("ITSSDD")) & 0x1) && |
1023 | !((detMask >> AliDAQ::DetectorID("ITSSSD")) & 0x1) ) { |
91e2f025 |
1024 | // switch off the vertexer |
d0f84c42 |
1025 | AliInfo("SPD,SDD,SSD is not in the list of active detectors. Vertexer switched off."); |
91e2f025 |
1026 | fRunVertexFinder = kFALSE; |
1027 | } |
304d7f0b |
1028 | if (!((detMask >> AliDAQ::DetectorID("TRG")) & 0x1)) { |
1029 | // switch off the reading of CTP raw-data payload |
1030 | if (fFillTriggerESD) { |
1031 | AliInfo("CTP is not in the list of active detectors. CTP data reading switched off."); |
1032 | fFillTriggerESD = kFALSE; |
1033 | } |
1034 | } |
7e88424f |
1035 | } |
1036 | |
1037 | AliInfo("==================================================================================="); |
1038 | AliInfo(Form("Running local reconstruction for detectors: %s",fRunLocalReconstruction.Data())); |
1039 | AliInfo(Form("Running tracking for detectors: %s",fRunTracking.Data())); |
1040 | AliInfo(Form("Filling ESD for detectors: %s",fFillESD.Data())); |
ca13fb87 |
1041 | AliInfo(Form("Quality assurance is active for detectors: %s",fQADetectors.Data())); |
7d566c20 |
1042 | AliInfo(Form("CDB and reconstruction parameters are loaded for detectors: %s",fLoadCDB.Data())); |
7e88424f |
1043 | AliInfo("==================================================================================="); |
61807e09 |
1044 | |
1045 | //*** Dealing with the magnetic field map |
5a004fb4 |
1046 | if ( TGeoGlobalMagField::Instance()->IsLocked() ) { |
1047 | if (TGeoGlobalMagField::Instance()->GetField()->TestBit(AliMagF::kOverrideGRP)) { |
1048 | AliInfo("ExpertMode!!! GRP information will be ignored !"); |
1049 | AliInfo("ExpertMode!!! Running with the externally locked B field !"); |
1050 | } |
1051 | else { |
1052 | AliInfo("Destroying existing B field instance!"); |
1053 | delete TGeoGlobalMagField::Instance(); |
1054 | } |
1055 | } |
1056 | if ( !TGeoGlobalMagField::Instance()->IsLocked() ) { |
61807e09 |
1057 | // Construct the field map out of the information retrieved from GRP. |
856024f0 |
1058 | Bool_t ok = kTRUE; |
61807e09 |
1059 | // L3 |
44e45fac |
1060 | Float_t l3Current = fGRPData->GetL3Current((AliGRPObject::Stats)0); |
1061 | if (l3Current == AliGRPObject::GetInvalidFloat()) { |
1062 | AliError("GRP/GRP/Data entry: missing value for the L3 current !"); |
1063 | ok = kFALSE; |
1064 | } |
f7a1cc68 |
1065 | |
44e45fac |
1066 | Char_t l3Polarity = fGRPData->GetL3Polarity(); |
1067 | if (l3Polarity == AliGRPObject::GetInvalidChar()) { |
1068 | AliError("GRP/GRP/Data entry: missing value for the L3 polarity !"); |
1069 | ok = kFALSE; |
1070 | } |
1071 | |
1072 | // Dipole |
1073 | Float_t diCurrent = fGRPData->GetDipoleCurrent((AliGRPObject::Stats)0); |
1074 | if (diCurrent == AliGRPObject::GetInvalidFloat()) { |
1075 | AliError("GRP/GRP/Data entry: missing value for the dipole current !"); |
1076 | ok = kFALSE; |
1077 | } |
1078 | |
1079 | Char_t diPolarity = fGRPData->GetDipolePolarity(); |
1080 | if (diPolarity == AliGRPObject::GetInvalidChar()) { |
1081 | AliError("GRP/GRP/Data entry: missing value for the dipole polarity !"); |
1082 | ok = kFALSE; |
1083 | } |
1084 | |
99c7d495 |
1085 | // read special bits for the polarity convention and map type |
1086 | Int_t polConvention = fGRPData->IsPolarityConventionLHC() ? AliMagF::kConvLHC : AliMagF::kConvDCS2008; |
1087 | Bool_t uniformB = fGRPData->IsUniformBMap(); |
61807e09 |
1088 | |
856024f0 |
1089 | if (ok) { |
33fe5eb1 |
1090 | AliMagF* fld = AliMagF::CreateFieldMap(TMath::Abs(l3Current) * (l3Polarity ? -1:1), |
1091 | TMath::Abs(diCurrent) * (diPolarity ? -1:1), |
1092 | polConvention,uniformB,beamEnergy, beamType.Data()); |
1093 | if (fld) { |
1094 | TGeoGlobalMagField::Instance()->SetField( fld ); |
1095 | TGeoGlobalMagField::Instance()->Lock(); |
1096 | AliInfo("Running with the B field constructed out of GRP !"); |
1097 | } |
1098 | else AliFatal("Failed to create a B field map !"); |
856024f0 |
1099 | } |
f7a1cc68 |
1100 | else AliFatal("B field is neither set nor constructed from GRP ! Exitig..."); |
61807e09 |
1101 | } |
f7a1cc68 |
1102 | |
f2a195c1 |
1103 | //*** Get the diamond profiles from OCDB |
1104 | entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexSPD"); |
1105 | if (entry) { |
1106 | fDiamondProfileSPD = dynamic_cast<AliESDVertex*> (entry->GetObject()); |
1107 | } else { |
1108 | AliError("No SPD diamond profile found in OCDB!"); |
1109 | } |
1110 | |
61807e09 |
1111 | entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertex"); |
1112 | if (entry) { |
f2a195c1 |
1113 | fDiamondProfile = dynamic_cast<AliESDVertex*> (entry->GetObject()); |
61807e09 |
1114 | } else { |
1115 | AliError("No diamond profile found in OCDB!"); |
1116 | } |
1117 | |
1118 | entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexTPC"); |
1119 | if (entry) { |
f2a195c1 |
1120 | fDiamondProfileTPC = dynamic_cast<AliESDVertex*> (entry->GetObject()); |
61807e09 |
1121 | } else { |
f2a195c1 |
1122 | AliError("No TPC diamond profile found in OCDB!"); |
61807e09 |
1123 | } |
1124 | |
77ba28ba |
1125 | entry = AliCDBManager::Instance()->Get("GRP/Calib/CosmicTriggers"); |
1126 | if (entry) { |
1127 | fListOfCosmicTriggers = dynamic_cast<THashTable*>(entry->GetObject()); |
1128 | entry->SetOwner(0); |
1129 | AliCDBManager::Instance()->UnloadFromCache("GRP/Calib/CosmicTriggers"); |
1130 | } |
1131 | |
1132 | if (!fListOfCosmicTriggers) { |
1133 | AliWarning("Can not get list of cosmic triggers from OCDB! Cosmic event specie will be effectively disabled!"); |
1134 | } |
1135 | |
61807e09 |
1136 | return kTRUE; |
1137 | } |
1138 | |
4b71572b |
1139 | //_____________________________________________________________________________ |
1140 | Bool_t AliReconstruction::LoadCDB() |
1141 | { |
52dd4a8c |
1142 | AliCodeTimerAuto("",0); |
4b71572b |
1143 | |
1144 | AliCDBManager::Instance()->Get("GRP/CTP/Config"); |
1145 | |
7d566c20 |
1146 | TString detStr = fLoadCDB; |
ac4a7581 |
1147 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
4b71572b |
1148 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
1149 | AliCDBManager::Instance()->GetAll(Form("%s/Calib/*",fgkDetectorName[iDet])); |
1150 | } |
e122592f |
1151 | |
1152 | // Temporary fix - one has to define the correct policy in order |
1153 | // to load the trigger OCDB entries only for the detectors that |
1154 | // in the trigger or that are needed in order to put correct |
1155 | // information in ESD |
1156 | AliCDBManager::Instance()->GetAll("TRIGGER/*/*"); |
1157 | |
4b71572b |
1158 | return kTRUE; |
1159 | } |
522fdd91 |
1160 | //_____________________________________________________________________________ |
1161 | Bool_t AliReconstruction::LoadTriggerScalersCDB() |
1162 | { |
52dd4a8c |
1163 | AliCodeTimerAuto("",0); |
522fdd91 |
1164 | |
1165 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/CTP/Scalers"); |
4b71572b |
1166 | |
522fdd91 |
1167 | if (entry) { |
1168 | |
1169 | AliInfo("Found an AliTriggerRunScalers in GRP/CTP/Scalers, reading it"); |
1170 | fRunScalers = dynamic_cast<AliTriggerRunScalers*> (entry->GetObject()); |
1171 | entry->SetOwner(0); |
82ebedd6 |
1172 | if (fRunScalers->CorrectScalersOverflow() == 0) AliInfo("32bit Trigger counters corrected for overflow"); |
1173 | |
522fdd91 |
1174 | } |
1175 | return kTRUE; |
1176 | } |
596a855f |
1177 | //_____________________________________________________________________________ |
52dd4a8c |
1178 | Bool_t AliReconstruction::LoadCTPTimeParamsCDB() |
1179 | { |
1180 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming"); |
1181 | |
1182 | if (entry) { |
1183 | |
1184 | AliInfo("Found an AliCTPTimeParams in GRP/CTP/CTPtiming, reading it"); |
1185 | fCTPTimeParams = dynamic_cast<AliCTPTimeParams*> (entry->GetObject()); |
1186 | entry->SetOwner(0); |
1187 | return kTRUE; |
1188 | } |
1189 | |
1190 | return kFALSE; |
1191 | } |
1192 | //_____________________________________________________________________________ |
21a3aa09 |
1193 | Bool_t AliReconstruction::Run(const char* input) |
596a855f |
1194 | { |
21a3aa09 |
1195 | // Run Run Run |
52dd4a8c |
1196 | AliCodeTimerAuto("",0); |
596a855f |
1197 | |
4b71572b |
1198 | InitRun(input); |
1199 | if (GetAbort() != TSelector::kContinue) return kFALSE; |
1200 | |
1201 | TChain *chain = NULL; |
1202 | if (fRawReader && (chain = fRawReader->GetChain())) { |
2a284cef |
1203 | Long64_t nEntries = (fLastEvent < 0) ? (TChain::kBigNumber) : (fLastEvent - fFirstEvent + 1); |
4b71572b |
1204 | // Proof mode |
1205 | if (gProof) { |
52dd4a8c |
1206 | // Temporary fix for long raw-data runs (until socket timeout handling in PROOF is revised) |
1207 | gProof->Exec("gEnv->SetValue(\"Proof.SocketActivityTimeout\",-1)", kTRUE); |
6c6f2624 |
1208 | |
1209 | if (gGrid) |
1210 | gProof->Exec("TGrid::Connect(\"alien://\")",kTRUE); |
1211 | |
1212 | TMessage::EnableSchemaEvolutionForAll(kTRUE); |
1213 | gProof->Exec("TMessage::EnableSchemaEvolutionForAll(kTRUE)",kTRUE); |
1214 | |
4b71572b |
1215 | gProof->AddInput(this); |
81d57268 |
1216 | |
1217 | if (!ParseOutput()) return kFALSE; |
1218 | |
975320a0 |
1219 | gProof->SetParameter("PROOF_MaxSlavesPerNode", 9999); |
4b71572b |
1220 | chain->SetProof(); |
2a284cef |
1221 | chain->Process("AliReconstruction","",nEntries,fFirstEvent); |
4b71572b |
1222 | } |
1223 | else { |
2a284cef |
1224 | chain->Process(this,"",nEntries,fFirstEvent); |
4b71572b |
1225 | } |
1226 | } |
1227 | else { |
1228 | Begin(NULL); |
1229 | if (GetAbort() != TSelector::kContinue) return kFALSE; |
1230 | SlaveBegin(NULL); |
1231 | if (GetAbort() != TSelector::kContinue) return kFALSE; |
1232 | //******* The loop over events |
44e45fac |
1233 | AliInfo("Starting looping over events"); |
4b71572b |
1234 | Int_t iEvent = 0; |
1235 | while ((iEvent < fRunLoader->GetNumberOfEvents()) || |
1236 | (fRawReader && fRawReader->NextEvent())) { |
1237 | if (!ProcessEvent(iEvent)) { |
930e6e3e |
1238 | Abort("ProcessEvent",TSelector::kAbortFile); |
1239 | return kFALSE; |
4b71572b |
1240 | } |
1241 | iEvent++; |
1242 | } |
1243 | SlaveTerminate(); |
1244 | if (GetAbort() != TSelector::kContinue) return kFALSE; |
1245 | Terminate(); |
1246 | if (GetAbort() != TSelector::kContinue) return kFALSE; |
21a3aa09 |
1247 | } |
21a3aa09 |
1248 | |
1249 | return kTRUE; |
1250 | } |
1251 | |
1252 | //_____________________________________________________________________________ |
4b71572b |
1253 | void AliReconstruction::InitRawReader(const char* input) |
21a3aa09 |
1254 | { |
52dd4a8c |
1255 | AliCodeTimerAuto("",0); |
21a3aa09 |
1256 | |
4b71572b |
1257 | // Init raw-reader and |
21a3aa09 |
1258 | // set the input in case of raw data |
4b71572b |
1259 | if (input) fRawInput = input; |
1260 | fRawReader = AliRawReader::Create(fRawInput.Data()); |
c35f192e |
1261 | if (!fRawReader) { |
1262 | if (fRawInput.IsNull()) { |
1263 | AliInfo("Reconstruction will run over digits"); |
1264 | } |
1265 | else { |
1266 | AliFatal("Can not create raw-data reader ! Exiting..."); |
1267 | } |
1268 | } |
e0027792 |
1269 | |
35042093 |
1270 | if (!fEquipIdMap.IsNull() && fRawReader) |
1271 | fRawReader->LoadEquipmentIdsMap(fEquipIdMap); |
1272 | |
cd0b062e |
1273 | if (!fUseHLTData.IsNull()) { |
1274 | // create the RawReaderHLT which performs redirection of HLT input data for |
1275 | // the specified detectors |
1276 | AliRawReader* pRawReader=AliRawHLTManager::CreateRawReaderHLT(fRawReader, fUseHLTData.Data()); |
1277 | if (pRawReader) { |
1278 | fParentRawReader=fRawReader; |
1279 | fRawReader=pRawReader; |
1280 | } else { |
1281 | AliError(Form("can not create Raw Reader for HLT input %s", fUseHLTData.Data())); |
1282 | } |
1283 | } |
4b71572b |
1284 | AliSysInfo::AddStamp("CreateRawReader"); |
1285 | } |
cd0b062e |
1286 | |
4b71572b |
1287 | //_____________________________________________________________________________ |
1288 | void AliReconstruction::InitRun(const char* input) |
1289 | { |
1290 | // Initialization of raw-reader, |
1291 | // run number, CDB etc. |
52dd4a8c |
1292 | AliCodeTimerAuto("",0); |
4b71572b |
1293 | AliSysInfo::AddStamp("Start"); |
1294 | |
002c9d1b |
1295 | // Initialize raw-reader if any |
4b71572b |
1296 | InitRawReader(input); |
596a855f |
1297 | |
ec92bee0 |
1298 | // Initialize the CDB storage |
795e4a22 |
1299 | InitCDB(); |
ec92bee0 |
1300 | |
6bae477a |
1301 | // Set run number in CDBManager (if it is not already set by the user) |
4b71572b |
1302 | if (!SetRunNumberFromData()) { |
1303 | Abort("SetRunNumberFromData", TSelector::kAbortProcess); |
1304 | return; |
1305 | } |
002c9d1b |
1306 | |
795e4a22 |
1307 | // Set CDB lock: from now on it is forbidden to reset the run number |
1308 | // or the default storage or to activate any further storage! |
1309 | SetCDBLock(); |
1310 | |
002c9d1b |
1311 | } |
1312 | |
1313 | //_____________________________________________________________________________ |
1314 | void AliReconstruction::Begin(TTree *) |
1315 | { |
1316 | // Initialize AlReconstruction before |
1317 | // going into the event loop |
1318 | // Should follow the TSelector convention |
1319 | // i.e. initialize only the object on the client side |
52dd4a8c |
1320 | AliCodeTimerAuto("",0); |
db4aeca1 |
1321 | |
b4fef0d2 |
1322 | AliReconstruction *reco = NULL; |
002c9d1b |
1323 | if (fInput) { |
8fb1f1dc |
1324 | if ((reco = (AliReconstruction*)fInput->FindObject("AliReconstruction"))) { |
002c9d1b |
1325 | *this = *reco; |
002c9d1b |
1326 | } |
1327 | AliSysInfo::AddStamp("ReadInputInBegin"); |
1328 | } |
1329 | |
6bae477a |
1330 | // Import ideal TGeo geometry and apply misalignment |
1331 | if (!gGeoManager) { |
1332 | TString geom(gSystem->DirName(fGAliceFileName)); |
1333 | geom += "/geometry.root"; |
98e303d9 |
1334 | AliGeomManager::LoadGeometry(geom.Data()); |
4b71572b |
1335 | if (!gGeoManager) { |
1336 | Abort("LoadGeometry", TSelector::kAbortProcess); |
1337 | return; |
1338 | } |
281270d3 |
1339 | AliSysInfo::AddStamp("LoadGeom"); |
ff5970a3 |
1340 | TString detsToCheck=fRunLocalReconstruction; |
4b71572b |
1341 | if(!AliGeomManager::CheckSymNamesLUT(detsToCheck.Data())) { |
1342 | Abort("CheckSymNamesLUT", TSelector::kAbortProcess); |
1343 | return; |
1344 | } |
281270d3 |
1345 | AliSysInfo::AddStamp("CheckGeom"); |
6bae477a |
1346 | } |
8e245d15 |
1347 | |
4b71572b |
1348 | if (!MisalignGeometry(fLoadAlignData)) { |
1349 | Abort("MisalignGeometry", TSelector::kAbortProcess); |
1350 | return; |
1351 | } |
1352 | AliCDBManager::Instance()->UnloadFromCache("GRP/Geometry/Data"); |
281270d3 |
1353 | AliSysInfo::AddStamp("MisalignGeom"); |
6bae477a |
1354 | |
8cb26cdf |
1355 | if (!InitGRP()) { |
1356 | Abort("InitGRP", TSelector::kAbortProcess); |
1357 | return; |
1358 | } |
1359 | AliSysInfo::AddStamp("InitGRP"); |
1360 | |
4b71572b |
1361 | if (!LoadCDB()) { |
1362 | Abort("LoadCDB", TSelector::kAbortProcess); |
1363 | return; |
1364 | } |
1365 | AliSysInfo::AddStamp("LoadCDB"); |
325aa76f |
1366 | |
a6dd87ad |
1367 | if (!LoadTriggerScalersCDB()) { |
1368 | Abort("LoadTriggerScalersCDB", TSelector::kAbortProcess); |
1369 | return; |
1370 | } |
1371 | AliSysInfo::AddStamp("LoadTriggerScalersCDB"); |
1372 | |
52dd4a8c |
1373 | if (!LoadCTPTimeParamsCDB()) { |
1374 | Abort("LoadCTPTimeParamsCDB", TSelector::kAbortProcess); |
1375 | return; |
1376 | } |
1377 | AliSysInfo::AddStamp("LoadCTPTimeParamsCDB"); |
a6dd87ad |
1378 | |
7e88424f |
1379 | // Read the reconstruction parameters from OCDB |
1380 | if (!InitRecoParams()) { |
002c9d1b |
1381 | AliWarning("Not all detectors have correct RecoParam objects initialized"); |
4b71572b |
1382 | } |
1383 | AliSysInfo::AddStamp("InitRecoParams"); |
1384 | |
fd2b273c |
1385 | if (fInput && gProof) { |
b4fef0d2 |
1386 | if (reco) *reco = *this; |
fd2b273c |
1387 | |
45a6dee6 |
1388 | gGeoManager->SetName("Geometry"); |
fd2b273c |
1389 | gProof->AddInputData(gGeoManager,kTRUE); |
002c9d1b |
1390 | gGeoManager = NULL; |
fd2b273c |
1391 | gProof->AddInputData(const_cast<TMap*>(AliCDBManager::Instance()->GetEntryCache()),kTRUE); |
002c9d1b |
1392 | fInput->Add(new TParameter<Int_t>("RunNumber",AliCDBManager::Instance()->GetRun())); |
f7a1cc68 |
1393 | AliMagF *magFieldMap = (AliMagF*)TGeoGlobalMagField::Instance()->GetField(); |
ead7b391 |
1394 | magFieldMap->SetName("MagneticFieldMap"); |
fd2b273c |
1395 | gProof->AddInputData(magFieldMap,kTRUE); |
002c9d1b |
1396 | } |
4b71572b |
1397 | |
1398 | } |
1399 | |
1400 | //_____________________________________________________________________________ |
1401 | void AliReconstruction::SlaveBegin(TTree*) |
1402 | { |
1403 | // Initialization related to run-loader, |
1404 | // vertexer, trackers, recontructors |
1405 | // In proof mode it is executed on the slave |
52dd4a8c |
1406 | AliCodeTimerAuto("",0); |
4b71572b |
1407 | |
db4aeca1 |
1408 | TProofOutputFile *outProofFile = NULL; |
81d57268 |
1409 | if (fInput) { |
1410 | if (AliDebugLevel() > 0) fInput->Print(); |
ef5e52f6 |
1411 | if (AliDebugLevel() > 10) fInput->Dump(); |
db4aeca1 |
1412 | if (AliReconstruction *reco = (AliReconstruction*)fInput->FindObject("AliReconstruction")) { |
1413 | *this = *reco; |
1414 | } |
4b71572b |
1415 | if (TGeoManager *tgeo = (TGeoManager*)fInput->FindObject("Geometry")) { |
1416 | gGeoManager = tgeo; |
1417 | AliGeomManager::SetGeometry(tgeo); |
7e88424f |
1418 | } |
281270d3 |
1419 | if (TMap *entryCache = (TMap*)fInput->FindObject("CDBEntryCache")) { |
1420 | Int_t runNumber = -1; |
1421 | if (TProof::GetParameter(fInput,"RunNumber",runNumber) == 0) { |
1422 | AliCDBManager *man = AliCDBManager::Instance(entryCache,runNumber); |
1423 | man->SetCacheFlag(kTRUE); |
1424 | man->SetLock(kTRUE); |
1425 | man->Print(); |
1426 | } |
4b71572b |
1427 | } |
ead7b391 |
1428 | if (AliMagF *map = (AliMagF*)fInput->FindObject("MagneticFieldMap")) { |
ef5e52f6 |
1429 | AliMagF *newMap = new AliMagF(*map); |
1430 | if (!newMap->LoadParameterization()) { |
1431 | Abort("AliMagF::LoadParameterization", TSelector::kAbortProcess); |
1432 | return; |
1433 | } |
1434 | TGeoGlobalMagField::Instance()->SetField(newMap); |
1435 | TGeoGlobalMagField::Instance()->Lock(); |
4b71572b |
1436 | } |
81d57268 |
1437 | if (TNamed *outputFileName = (TNamed*)fInput->FindObject("PROOF_OUTPUTFILE")) |
1438 | fProofOutputFileName = outputFileName->GetTitle(); |
1439 | if (TNamed *outputLocation = (TNamed*)fInput->FindObject("PROOF_OUTPUTFILE_LOCATION")) |
1440 | fProofOutputLocation = outputLocation->GetTitle(); |
1441 | if (fInput->FindObject("PROOF_OUTPUTFILE_DATASET")) |
1442 | fProofOutputDataset = kTRUE; |
1443 | if (TNamed *archiveList = (TNamed*)fInput->FindObject("PROOF_OUTPUTFILE_ARCHIVE")) |
1444 | fProofOutputArchive = archiveList->GetTitle(); |
1445 | if (!fProofOutputFileName.IsNull() && |
1446 | !fProofOutputLocation.IsNull() && |
1447 | fProofOutputArchive.IsNull()) { |
1448 | if (!fProofOutputDataset) { |
1449 | outProofFile = new TProofOutputFile(fProofOutputFileName.Data(),"M"); |
1450 | outProofFile->SetOutputFileName(Form("%s%s",fProofOutputLocation.Data(),fProofOutputFileName.Data())); |
1451 | } |
1452 | else { |
1453 | outProofFile = new TProofOutputFile(fProofOutputFileName.Data(),"DROV",fProofOutputLocation.Data()); |
1454 | } |
1455 | if (AliDebugLevel() > 0) outProofFile->Dump(); |
db4aeca1 |
1456 | fOutput->Add(outProofFile); |
4b71572b |
1457 | } |
002c9d1b |
1458 | AliSysInfo::AddStamp("ReadInputInSlaveBegin"); |
7e88424f |
1459 | } |
325aa76f |
1460 | |
4b71572b |
1461 | // get the run loader |
1462 | if (!InitRunLoader()) { |
1463 | Abort("InitRunLoader", TSelector::kAbortProcess); |
1464 | return; |
1465 | } |
1466 | AliSysInfo::AddStamp("LoadLoader"); |
1467 | |
325aa76f |
1468 | ftVertexer = new AliVertexerTracks(AliTracker::GetBz()); |
2257f27e |
1469 | |
f08fc9f5 |
1470 | // get trackers |
b8cd5251 |
1471 | if (!fRunTracking.IsNull() && !CreateTrackers(fRunTracking)) { |
4b71572b |
1472 | Abort("CreateTrackers", TSelector::kAbortProcess); |
1473 | return; |
1474 | } |
1475 | AliSysInfo::AddStamp("CreateTrackers"); |
24f7a148 |
1476 | |
36711aa4 |
1477 | // create the ESD output file and tree |
db4aeca1 |
1478 | if (!outProofFile) { |
1479 | ffile = TFile::Open("AliESDs.root", "RECREATE"); |
1480 | ffile->SetCompressionLevel(2); |
1481 | if (!ffile->IsOpen()) { |
1482 | Abort("OpenESDFile", TSelector::kAbortProcess); |
1483 | return; |
1484 | } |
1485 | } |
1486 | else { |
81d57268 |
1487 | AliInfo(Form("Opening output PROOF file: %s/%s", |
1488 | outProofFile->GetDir(), outProofFile->GetFileName())); |
db4aeca1 |
1489 | if (!(ffile = outProofFile->OpenFile("RECREATE"))) { |
1490 | Abort(Form("Problems opening output PROOF file: %s/%s", |
1491 | outProofFile->GetDir(), outProofFile->GetFileName()), |
1492 | TSelector::kAbortProcess); |
1493 | return; |
1494 | } |
596a855f |
1495 | } |
46698ae4 |
1496 | |
21a3aa09 |
1497 | ftree = new TTree("esdTree", "Tree with ESD objects"); |
1498 | fesd = new AliESDEvent(); |
1499 | fesd->CreateStdContent(); |
32ba9c61 |
1500 | |
8b12d288 |
1501 | // add a so far non-std object to the ESD, this will |
1502 | // become part of the std content |
1503 | fesd->AddObject(new AliESDHLTDecision); |
1504 | |
32ba9c61 |
1505 | fesd->WriteToTree(ftree); |
1d99986f |
1506 | if (fWriteESDfriend) { |
32ba9c61 |
1507 | // careful: |
1508 | // Since we add the branch manually we must |
1509 | // book and add it after WriteToTree |
1510 | // otherwise it is created twice, |
1511 | // once via writetotree and once here. |
1512 | // The case for AliESDfriend is now |
1513 | // caught also in AlIESDEvent::WriteToTree but |
1514 | // be careful when changing the name (AliESDfriend is not |
1515 | // a TNamed so we had to hardwire it) |
21a3aa09 |
1516 | fesdf = new AliESDfriend(); |
1517 | TBranch *br=ftree->Branch("ESDfriend.","AliESDfriend", &fesdf); |
46698ae4 |
1518 | br->SetFile("AliESDfriends.root"); |
21a3aa09 |
1519 | fesd->AddObject(fesdf); |
1d99986f |
1520 | } |
f9604a22 |
1521 | ftree->GetUserInfo()->Add(fesd); |
1522 | |
1523 | fhlttree = new TTree("HLTesdTree", "Tree with HLT ESD objects"); |
1524 | fhltesd = new AliESDEvent(); |
1525 | fhltesd->CreateStdContent(); |
7491aea6 |
1526 | |
1527 | // read the ESD template from CDB |
1528 | // HLT is allowed to put non-std content to its ESD, the non-std |
1529 | // objects need to be created before invocation of WriteToTree in |
1530 | // order to create all branches. Initialization is done from an |
1531 | // ESD layout template in CDB |
1532 | AliCDBManager* man = AliCDBManager::Instance(); |
1533 | AliCDBPath hltESDConfigPath("HLT/ConfigHLT/esdLayout"); |
1534 | AliCDBEntry* hltESDConfig=NULL; |
1535 | if (man->GetId(hltESDConfigPath)!=NULL && |
1536 | (hltESDConfig=man->Get(hltESDConfigPath))!=NULL) { |
1537 | AliESDEvent* pESDLayout=dynamic_cast<AliESDEvent*>(hltESDConfig->GetObject()); |
1538 | if (pESDLayout) { |
1539 | // init all internal variables from the list of objects |
1540 | pESDLayout->GetStdContent(); |
1541 | |
1542 | // copy content and create non-std objects |
1543 | *fhltesd=*pESDLayout; |
1544 | fhltesd->Reset(); |
1545 | } else { |
1546 | AliError(Form("error setting hltEsd layout from %s: invalid object type", |
1547 | hltESDConfigPath.GetPath().Data())); |
1548 | } |
1549 | } |
1550 | |
f9604a22 |
1551 | fhltesd->WriteToTree(fhlttree); |
1552 | fhlttree->GetUserInfo()->Add(fhltesd); |
5728d3d5 |
1553 | |
ac4a7581 |
1554 | ProcInfo_t procInfo; |
1555 | gSystem->GetProcInfo(&procInfo); |
1556 | AliInfo(Form("Current memory usage %d %d", procInfo.fMemResident, procInfo.fMemVirtual)); |
8661738e |
1557 | |
325aa76f |
1558 | //QA |
930e6e3e |
1559 | //Initialize the QA and start of cycle |
f1c1204d |
1560 | if (fRunQA || fRunGlobalQA) |
1561 | InitQA() ; |
aa3c69a9 |
1562 | |
7167ae53 |
1563 | //Initialize the Plane Efficiency framework |
1564 | if (fRunPlaneEff && !InitPlaneEff()) { |
4b71572b |
1565 | Abort("InitPlaneEff", TSelector::kAbortProcess); |
1566 | return; |
7167ae53 |
1567 | } |
aa3c69a9 |
1568 | |
14dd053c |
1569 | if (strcmp(gProgName,"alieve") == 0) |
1570 | fRunAliEVE = InitAliEVE(); |
1571 | |
4b71572b |
1572 | return; |
21a3aa09 |
1573 | } |
1574 | |
1575 | //_____________________________________________________________________________ |
4b71572b |
1576 | Bool_t AliReconstruction::Process(Long64_t entry) |
1577 | { |
1578 | // run the reconstruction over a single entry |
1579 | // from the chain with raw data |
52dd4a8c |
1580 | AliCodeTimerAuto("",0); |
4b71572b |
1581 | |
1582 | TTree *currTree = fChain->GetTree(); |
33314186 |
1583 | AliRawVEvent *event = NULL; |
4b71572b |
1584 | currTree->SetBranchAddress("rawevent",&event); |
1585 | currTree->GetEntry(entry); |
1586 | fRawReader = new AliRawReaderRoot(event); |
1587 | fStatus = ProcessEvent(fRunLoader->GetNumberOfEvents()); |
1588 | delete fRawReader; |
1589 | fRawReader = NULL; |
1590 | delete event; |
1591 | |
1592 | return fStatus; |
1593 | } |
1594 | |
1595 | //_____________________________________________________________________________ |
1596 | void AliReconstruction::Init(TTree *tree) |
1597 | { |
1598 | if (tree == 0) { |
1599 | AliError("The input tree is not found!"); |
1600 | return; |
1601 | } |
1602 | fChain = tree; |
1603 | } |
1604 | |
1605 | //_____________________________________________________________________________ |
1606 | Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) |
21a3aa09 |
1607 | { |
1608 | // run the reconstruction over a single event |
1609 | // The event loop is steered in Run method |
1610 | |
52dd4a8c |
1611 | AliCodeTimerAuto("",0); |
21a3aa09 |
1612 | |
1613 | if (iEvent >= fRunLoader->GetNumberOfEvents()) { |
1614 | fRunLoader->SetEventNumber(iEvent); |
1615 | fRunLoader->GetHeader()->Reset(fRawReader->GetRunNumber(), |
1616 | iEvent, iEvent); |
21a3aa09 |
1617 | fRunLoader->TreeE()->Fill(); |
4b71572b |
1618 | if (fRawReader && fRawReader->UseAutoSaveESD()) |
1619 | fRunLoader->TreeE()->AutoSave("SaveSelf"); |
21a3aa09 |
1620 | } |
1621 | |
1622 | if ((iEvent < fFirstEvent) || ((fLastEvent >= 0) && (iEvent > fLastEvent))) { |
21a3aa09 |
1623 | return kTRUE; |
1624 | } |
1625 | |
1626 | AliInfo(Form("processing event %d", iEvent)); |
aa3c69a9 |
1627 | |
16447f18 |
1628 | fRunLoader->GetEvent(iEvent); |
1629 | |
7e88424f |
1630 | // Fill Event-info object |
1631 | GetEventInfo(); |
77ba28ba |
1632 | fRecoParam.SetEventSpecie(fRunInfo,fEventInfo,fListOfCosmicTriggers); |
48f5e52d |
1633 | AliInfo(Form("Current event specie: %s",fRecoParam.PrintEventSpecie())); |
7e88424f |
1634 | |
a00021a7 |
1635 | // Set the reco-params |
1636 | { |
1637 | TString detStr = fLoadCDB; |
ac4a7581 |
1638 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
a00021a7 |
1639 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
1640 | AliReconstructor *reconstructor = GetReconstructor(iDet); |
1641 | if (reconstructor && fRecoParam.GetDetRecoParamArray(iDet)) { |
57acd2d2 |
1642 | const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet); |
1643 | reconstructor->SetRecoParam(par); |
3f52d87f |
1644 | reconstructor->SetEventInfo(&fEventInfo); |
57acd2d2 |
1645 | if (fRunQA) { |
eca4fa66 |
1646 | AliQAManager::QAManager()->SetRecoParam(iDet, par) ; |
6252ceeb |
1647 | AliQAManager::QAManager()->SetEventSpecie(AliRecoParam::Convert(par->GetEventSpecie())) ; |
57acd2d2 |
1648 | } |
a00021a7 |
1649 | } |
1650 | } |
3f52d87f |
1651 | const AliDetectorRecoParam *grppar = fRecoParam.GetDetRecoParam(kNDetectors); |
1652 | AliQAManager::QAManager()->SetRecoParam(AliQAv1::kGLOBAL, grppar) ; |
1653 | AliQAManager::QAManager()->SetEventSpecie(AliRecoParam::Convert(grppar->GetEventSpecie())) ; |
a00021a7 |
1654 | } |
1655 | |
ca13fb87 |
1656 | // QA on single raw |
514cb8c7 |
1657 | if (fRunQA && IsInTasks(AliQAv1::kRAWS)) { |
eca4fa66 |
1658 | AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ; |
1659 | AliQAManager::QAManager()->RunOneEvent(fRawReader) ; |
57acd2d2 |
1660 | } |
d506c543 |
1661 | // local single event reconstruction |
b26c3770 |
1662 | if (!fRunLocalReconstruction.IsNull()) { |
d506c543 |
1663 | TString detectors=fRunLocalReconstruction; |
a441bf51 |
1664 | // run HLT event reconstruction first |
d506c543 |
1665 | // ;-( IsSelected changes the string |
1666 | if (IsSelected("HLT", detectors) && |
1667 | !RunLocalEventReconstruction("HLT")) { |
4b71572b |
1668 | if (fStopOnError) {CleanUp(); return kFALSE;} |
a441bf51 |
1669 | } |
1670 | detectors=fRunLocalReconstruction; |
1671 | detectors.ReplaceAll("HLT", ""); |
1672 | if (!RunLocalEventReconstruction(detectors)) { |
13effe3f |
1673 | if (fStopOnError) { |
1674 | CleanUp(); |
1675 | return kFALSE; |
1676 | } |
b26c3770 |
1677 | } |
1678 | } |
1679 | |
21a3aa09 |
1680 | fesd->SetRunNumber(fRunLoader->GetHeader()->GetRun()); |
1681 | fhltesd->SetRunNumber(fRunLoader->GetHeader()->GetRun()); |
1682 | fesd->SetEventNumberInFile(fRunLoader->GetHeader()->GetEventNrInRun()); |
1683 | fhltesd->SetEventNumberInFile(fRunLoader->GetHeader()->GetEventNrInRun()); |
fd2e2210 |
1684 | |
1685 | fesd->SetEventSpecie(fRecoParam.GetEventSpecie()); |
1686 | fhltesd->SetEventSpecie(fRecoParam.GetEventSpecie()); |
46698ae4 |
1687 | |
d6ee376f |
1688 | // Set magnetic field from the tracker |
21a3aa09 |
1689 | fesd->SetMagneticField(AliTracker::GetBz()); |
1690 | fhltesd->SetMagneticField(AliTracker::GetBz()); |
33fe5eb1 |
1691 | // |
1692 | AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField(); |
1693 | if (fld) { // set info needed for field initialization |
1694 | fesd->SetCurrentL3(fld->GetCurrentSol()); |
1695 | fesd->SetCurrentDip(fld->GetCurrentDip()); |
1696 | fesd->SetBeamEnergy(fld->GetBeamEnergy()); |
1697 | fesd->SetBeamType(fld->GetBeamTypeText()); |
1698 | fesd->SetUniformBMap(fld->IsUniform()); |
1699 | fesd->SetBInfoStored(); |
1700 | // |
1701 | fhltesd->SetCurrentL3(fld->GetCurrentSol()); |
1702 | fhltesd->SetCurrentDip(fld->GetCurrentDip()); |
1703 | fhltesd->SetBeamEnergy(fld->GetBeamEnergy()); |
1704 | fhltesd->SetBeamType(fld->GetBeamTypeText()); |
1705 | fhltesd->SetUniformBMap(fld->IsUniform()); |
1706 | fhltesd->SetBInfoStored(); |
1707 | } |
1708 | // |
71f6cda4 |
1709 | // Set most probable pt, for B=0 tracking |
9257a1bd |
1710 | // Get the global reco-params. They are atposition 16 inside the array of detectors in fRecoParam |
ac4a7581 |
1711 | const AliGRPRecoParam *grpRecoParam = dynamic_cast<const AliGRPRecoParam*>(fRecoParam.GetDetRecoParam(kNDetectors)); |
71f6cda4 |
1712 | if (grpRecoParam) AliExternalTrackParam::SetMostProbablePt(grpRecoParam->GetMostProbablePt()); |
46698ae4 |
1713 | |
2e3550da |
1714 | // Fill raw-data error log into the ESD |
21a3aa09 |
1715 | if (fRawReader) FillRawDataErrorLog(iEvent,fesd); |
2e3550da |
1716 | |
2257f27e |
1717 | // vertex finder |
1718 | if (fRunVertexFinder) { |
4b71572b |
1719 | if (!RunVertexFinder(fesd)) { |
1720 | if (fStopOnError) {CleanUp(); return kFALSE;} |
2257f27e |
1721 | } |
1722 | } |
1723 | |
58e8dc31 |
1724 | // For Plane Efficiency: run the SPD trackleter |
1725 | if (fRunPlaneEff && fSPDTrackleter) { |
1726 | if (!RunSPDTrackleting(fesd)) { |
1727 | if (fStopOnError) {CleanUp(); return kFALSE;} |
1728 | } |
1729 | } |
1730 | |
e66fbafb |
1731 | // Muon tracking |
b8cd5251 |
1732 | if (!fRunTracking.IsNull()) { |
e66fbafb |
1733 | if (fRunMuonTracking) { |
21a3aa09 |
1734 | if (!RunMuonTracking(fesd)) { |
4b71572b |
1735 | if (fStopOnError) {CleanUp(); return kFALSE;} |
24f7a148 |
1736 | } |
596a855f |
1737 | } |
1738 | } |
1739 | |
e66fbafb |
1740 | // barrel tracking |
1741 | if (!fRunTracking.IsNull()) { |
4b71572b |
1742 | if (!RunTracking(fesd)) { |
1743 | if (fStopOnError) {CleanUp(); return kFALSE;} |
e66fbafb |
1744 | } |
1745 | } |
21c573b7 |
1746 | |
596a855f |
1747 | // fill ESD |
1748 | if (!fFillESD.IsNull()) { |
d506c543 |
1749 | TString detectors=fFillESD; |
f6806ad3 |
1750 | // run HLT first and on hltesd |
d506c543 |
1751 | // ;-( IsSelected changes the string |
1752 | if (IsSelected("HLT", detectors) && |
1753 | !FillESD(fhltesd, "HLT")) { |
4b71572b |
1754 | if (fStopOnError) {CleanUp(); return kFALSE;} |
f6806ad3 |
1755 | } |
1756 | detectors=fFillESD; |
d5105682 |
1757 | // Temporary fix to avoid problems with HLT that overwrites the offline ESDs |
1758 | if (detectors.Contains("ALL")) { |
1759 | detectors=""; |
ac4a7581 |
1760 | for (Int_t idet=0; idet<kNDetectors; ++idet){ |
d5105682 |
1761 | detectors += fgkDetectorName[idet]; |
1762 | detectors += " "; |
1763 | } |
1764 | } |
f6806ad3 |
1765 | detectors.ReplaceAll("HLT", ""); |
1766 | if (!FillESD(fesd, detectors)) { |
4b71572b |
1767 | if (fStopOnError) {CleanUp(); return kFALSE;} |
596a855f |
1768 | } |
1769 | } |
a5fa6165 |
1770 | |
001397cd |
1771 | // fill Event header information from the RawEventHeader |
21a3aa09 |
1772 | if (fRawReader){FillRawEventHeaderESD(fesd);} |
63314086 |
1773 | if (fRawReader){FillRawEventHeaderESD(fhltesd);} |
596a855f |
1774 | |
1775 | // combined PID |
21a3aa09 |
1776 | AliESDpid::MakePID(fesd); |
596a855f |
1777 | |
b647652d |
1778 | if (fFillTriggerESD) { |
4b71572b |
1779 | if (!FillTriggerESD(fesd)) { |
1780 | if (fStopOnError) {CleanUp(); return kFALSE;} |
b647652d |
1781 | } |
1782 | } |
f7812afc |
1783 | // Always fill scalers |
1784 | if (!FillTriggerScalers(fesd)) { |
1785 | if (fStopOnError) {CleanUp(); return kFALSE;} |
1786 | } |
1787 | |
b647652d |
1788 | |
21a3aa09 |
1789 | ffile->cd(); |
a6ee503a |
1790 | |
3c3709c4 |
1791 | // |
67be5c77 |
1792 | // Propagate track to the beam pipe (if not already done by ITS) |
3c3709c4 |
1793 | // |
21a3aa09 |
1794 | const Int_t ntracks = fesd->GetNumberOfTracks(); |
3c3709c4 |
1795 | const Double_t kRadius = 2.8; //something less than the beam pipe radius |
1796 | |
1797 | TObjArray trkArray; |
1798 | UShort_t *selectedIdx=new UShort_t[ntracks]; |
1799 | |
1800 | for (Int_t itrack=0; itrack<ntracks; itrack++){ |
98a50ff3 |
1801 | const Double_t kMaxStep = 1; //max step over the material |
3c3709c4 |
1802 | Bool_t ok; |
1803 | |
21a3aa09 |
1804 | AliESDtrack *track = fesd->GetTrack(itrack); |
3c3709c4 |
1805 | if (!track) continue; |
1806 | |
1807 | AliExternalTrackParam *tpcTrack = |
1808 | (AliExternalTrackParam *)track->GetTPCInnerParam(); |
bcabd6af |
1809 | ok = kFALSE; |
1810 | if (tpcTrack) |
1811 | ok = AliTracker:: |
52dd4a8c |
1812 | PropagateTrackToBxByBz(tpcTrack,kRadius,track->GetMass(),kMaxStep,kFALSE); |
43c9dae1 |
1813 | |
3c3709c4 |
1814 | if (ok) { |
1815 | Int_t n=trkArray.GetEntriesFast(); |
1816 | selectedIdx[n]=track->GetID(); |
1817 | trkArray.AddLast(tpcTrack); |
1818 | } |
1819 | |
3d65e645 |
1820 | //Tracks refitted by ITS should already be at the SPD vertex |
1821 | if (track->IsOn(AliESDtrack::kITSrefit)) continue; |
1822 | |
1823 | AliTracker:: |
52dd4a8c |
1824 | PropagateTrackToBxByBz(track,kRadius,track->GetMass(),kMaxStep,kFALSE); |
1825 | Double_t x[3]; track->GetXYZ(x); |
1826 | Double_t b[3]; AliTracker::GetBxByBz(x,b); |
1827 | track->RelateToVertexBxByBz(fesd->GetPrimaryVertexSPD(), b, kVeryBig); |
3c3709c4 |
1828 | |
3c3709c4 |
1829 | } |
1830 | |
1831 | // |
1832 | // Improve the reconstructed primary vertex position using the tracks |
1833 | // |
59224b2b |
1834 | Bool_t runVertexFinderTracks = fRunVertexFinderTracks; |
1835 | if(fesd->GetPrimaryVertexSPD()) { |
1836 | TString vtitle = fesd->GetPrimaryVertexSPD()->GetTitle(); |
1837 | if(vtitle.Contains("cosmics")) { |
1838 | runVertexFinderTracks=kFALSE; |
1839 | } |
c060d7fe |
1840 | } |
a00021a7 |
1841 | |
1842 | if (runVertexFinderTracks) { |
3c3709c4 |
1843 | // TPC + ITS primary vertex |
f09c879d |
1844 | ftVertexer->SetITSMode(); |
f2a195c1 |
1845 | ftVertexer->SetConstraintOff(); |
a00021a7 |
1846 | // get cuts for vertexer from AliGRPRecoParam |
1847 | if (grpRecoParam) { |
1848 | Int_t nCutsVertexer = grpRecoParam->GetVertexerTracksNCuts(); |
1849 | Double_t *cutsVertexer = new Double_t[nCutsVertexer]; |
1850 | grpRecoParam->GetVertexerTracksCutsITS(cutsVertexer); |
1851 | ftVertexer->SetCuts(cutsVertexer); |
1852 | delete [] cutsVertexer; cutsVertexer = NULL; |
f2a195c1 |
1853 | if(fDiamondProfile && grpRecoParam->GetVertexerTracksConstraintITS()) |
1854 | ftVertexer->SetVtxStart(fDiamondProfile); |
43c9dae1 |
1855 | } |
21a3aa09 |
1856 | AliESDVertex *pvtx=ftVertexer->FindPrimaryVertex(fesd); |
3c3709c4 |
1857 | if (pvtx) { |
1858 | if (pvtx->GetStatus()) { |
c264b61b |
1859 | fesd->SetPrimaryVertexTracks(pvtx); |
3c3709c4 |
1860 | for (Int_t i=0; i<ntracks; i++) { |
21a3aa09 |
1861 | AliESDtrack *t = fesd->GetTrack(i); |
52dd4a8c |
1862 | Double_t x[3]; t->GetXYZ(x); |
1863 | Double_t b[3]; AliTracker::GetBxByBz(x,b); |
1864 | t->RelateToVertexBxByBz(pvtx, b, kVeryBig); |
3c3709c4 |
1865 | } |
1866 | } |
9bcaa1d7 |
1867 | delete pvtx; pvtx=NULL; |
3c3709c4 |
1868 | } |
1869 | |
1870 | // TPC-only primary vertex |
f09c879d |
1871 | ftVertexer->SetTPCMode(); |
f2a195c1 |
1872 | ftVertexer->SetConstraintOff(); |
a00021a7 |
1873 | // get cuts for vertexer from AliGRPRecoParam |
1874 | if (grpRecoParam) { |
1875 | Int_t nCutsVertexer = grpRecoParam->GetVertexerTracksNCuts(); |
1876 | Double_t *cutsVertexer = new Double_t[nCutsVertexer]; |
1877 | grpRecoParam->GetVertexerTracksCutsTPC(cutsVertexer); |
1878 | ftVertexer->SetCuts(cutsVertexer); |
1879 | delete [] cutsVertexer; cutsVertexer = NULL; |
f2a195c1 |
1880 | if(fDiamondProfileTPC && grpRecoParam->GetVertexerTracksConstraintTPC()) |
1881 | ftVertexer->SetVtxStart(fDiamondProfileTPC); |
43c9dae1 |
1882 | } |
21a3aa09 |
1883 | pvtx=ftVertexer->FindPrimaryVertex(&trkArray,selectedIdx); |
3c3709c4 |
1884 | if (pvtx) { |
1885 | if (pvtx->GetStatus()) { |
21a3aa09 |
1886 | fesd->SetPrimaryVertexTPC(pvtx); |
3d65e645 |
1887 | for (Int_t i=0; i<ntracks; i++) { |
1888 | AliESDtrack *t = fesd->GetTrack(i); |
52dd4a8c |
1889 | Double_t x[3]; t->GetXYZ(x); |
1890 | Double_t b[3]; AliTracker::GetBxByBz(x,b); |
1891 | t->RelateToVertexTPCBxByBz(pvtx, b, kVeryBig); |
3c3709c4 |
1892 | } |
1893 | } |
9bcaa1d7 |
1894 | delete pvtx; pvtx=NULL; |
3c3709c4 |
1895 | } |
1896 | |
1897 | } |
1898 | delete[] selectedIdx; |
1899 | |
21a3aa09 |
1900 | if(fDiamondProfile) fesd->SetDiamond(fDiamondProfile); |
17c86e90 |
1901 | |
c5e3e5d1 |
1902 | |
d1683eef |
1903 | if (fRunV0Finder) { |
1904 | // V0 finding |
1905 | AliV0vertexer vtxer; |
21a3aa09 |
1906 | vtxer.Tracks2V0vertices(fesd); |
5e4ff34d |
1907 | |
d1683eef |
1908 | if (fRunCascadeFinder) { |
1909 | // Cascade finding |
1910 | AliCascadeVertexer cvtxer; |
21a3aa09 |
1911 | cvtxer.V0sTracks2CascadeVertices(fesd); |
d1683eef |
1912 | } |
5e4ff34d |
1913 | } |
1914 | |
596a855f |
1915 | // write ESD |
21a3aa09 |
1916 | if (fCleanESD) CleanESD(fesd); |
854c6476 |
1917 | |
514cb8c7 |
1918 | if (fRunQA && IsInTasks(AliQAv1::kESDS)) { |
eca4fa66 |
1919 | AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ; |
aeb8fc30 |
1920 | AliQAManager::QAManager()->RunOneEvent(fesd, fhltesd) ; |
57acd2d2 |
1921 | } |
bea94759 |
1922 | if (fRunGlobalQA) { |
eca4fa66 |
1923 | AliQADataMaker *qadm = AliQAManager::QAManager()->GetQADataMaker(AliQAv1::kGLOBAL); |
57acd2d2 |
1924 | qadm->SetEventSpecie(fRecoParam.GetEventSpecie()) ; |
514cb8c7 |
1925 | if (qadm && IsInTasks(AliQAv1::kESDS)) |
4e25ac79 |
1926 | qadm->Exec(AliQAv1::kESDS, fesd); |
b03591ab |
1927 | } |
854c6476 |
1928 | |
8b12d288 |
1929 | // copy HLT decision from HLTesd to esd |
1930 | // the most relevant information is stored in a reduced container in the esd, |
1931 | // while the full information can be found in the HLTesd |
1932 | TObject* pHLTSrc=fhltesd->FindListObject(AliESDHLTDecision::Name()); |
1933 | TObject* pHLTTgt=fesd->FindListObject(AliESDHLTDecision::Name()); |
1934 | if (pHLTSrc && pHLTTgt) { |
1935 | pHLTSrc->Copy(*pHLTTgt); |
1936 | } |
1937 | |
1d99986f |
1938 | if (fWriteESDfriend) { |
b090e6a3 |
1939 | // fesdf->~AliESDfriend(); |
1940 | // new (fesdf) AliESDfriend(); // Reset... |
21a3aa09 |
1941 | fesd->GetESDfriend(fesdf); |
1d99986f |
1942 | } |
21a3aa09 |
1943 | ftree->Fill(); |
500d54ab |
1944 | |
2d91a353 |
1945 | // Auto-save the ESD tree in case of prompt reco @P2 |
be103ac8 |
1946 | if (fRawReader && fRawReader->UseAutoSaveESD()) { |
2d91a353 |
1947 | ftree->AutoSave("SaveSelf"); |
be103ac8 |
1948 | TFile *friendfile = (TFile *)(gROOT->GetListOfFiles()->FindObject("AliESDfriends.root")); |
1949 | if (friendfile) friendfile->Save(); |
1950 | } |
2d91a353 |
1951 | |
500d54ab |
1952 | // write HLT ESD |
21a3aa09 |
1953 | fhlttree->Fill(); |
1d99986f |
1954 | |
14dd053c |
1955 | // call AliEVE |
1956 | if (fRunAliEVE) RunAliEVE(); |
1957 | |
21a3aa09 |
1958 | fesd->Reset(); |
1959 | fhltesd->Reset(); |
5728d3d5 |
1960 | if (fWriteESDfriend) { |
21a3aa09 |
1961 | fesdf->~AliESDfriend(); |
1962 | new (fesdf) AliESDfriend(); // Reset... |
5728d3d5 |
1963 | } |
a5fa6165 |
1964 | |
ac4a7581 |
1965 | ProcInfo_t procInfo; |
1966 | gSystem->GetProcInfo(&procInfo); |
1967 | AliInfo(Form("Event %d -> Current memory usage %d %d",iEvent, procInfo.fMemResident, procInfo.fMemVirtual)); |
a5fa6165 |
1968 | |
ca13fb87 |
1969 | fEventInfo.Reset(); |
ac4a7581 |
1970 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
42ec5d3d |
1971 | if (fReconstructor[iDet]) { |
a00021a7 |
1972 | fReconstructor[iDet]->SetRecoParam(NULL); |
42ec5d3d |
1973 | fReconstructor[iDet]->SetEventInfo(NULL); |
1974 | } |
1f26f3e7 |
1975 | if (fTracker[iDet]) fTracker[iDet]->SetEventInfo(NULL); |
ca13fb87 |
1976 | } |
1977 | |
53c8f690 |
1978 | if (fRunQA || fRunGlobalQA) |
eca4fa66 |
1979 | AliQAManager::QAManager()->Increment() ; |
53c8f690 |
1980 | |
ca13fb87 |
1981 | return kTRUE; |
21a3aa09 |
1982 | } |
1983 | |
21a3aa09 |
1984 | //_____________________________________________________________________________ |
4b71572b |
1985 | void AliReconstruction::SlaveTerminate() |
21a3aa09 |
1986 | { |
4b71572b |
1987 | // Finalize the run on the slave side |
21a3aa09 |
1988 | // Called after the exit |
1989 | // from the event loop |
52dd4a8c |
1990 | AliCodeTimerAuto("",0); |
21a3aa09 |
1991 | |
1992 | if (fIsNewRunLoader) { // galice.root didn't exist |
1993 | fRunLoader->WriteHeader("OVERWRITE"); |
1994 | fRunLoader->CdGAFile(); |
1995 | fRunLoader->Write(0, TObject::kOverwrite); |
1996 | } |
1997 | |
f747912b |
1998 | const TMap *cdbMap = AliCDBManager::Instance()->GetStorageMap(); |
1999 | const TList *cdbList = AliCDBManager::Instance()->GetRetrievedIds(); |
2000 | |
2001 | TMap *cdbMapCopy = new TMap(cdbMap->GetEntries()); |
2002 | cdbMapCopy->SetOwner(1); |
2003 | cdbMapCopy->SetName("cdbMap"); |
2004 | TIter iter(cdbMap->GetTable()); |
2005 | |
2006 | TPair* pair = 0; |
2007 | while((pair = dynamic_cast<TPair*> (iter.Next()))){ |
2008 | TObjString* keyStr = dynamic_cast<TObjString*> (pair->Key()); |
2009 | TObjString* valStr = dynamic_cast<TObjString*> (pair->Value()); |
2010 | cdbMapCopy->Add(new TObjString(keyStr->GetName()), new TObjString(valStr->GetName())); |
2011 | } |
2012 | |
2013 | TList *cdbListCopy = new TList(); |
2014 | cdbListCopy->SetOwner(1); |
2015 | cdbListCopy->SetName("cdbList"); |
2016 | |
2017 | TIter iter2(cdbList); |
2018 | |
b940cb9b |
2019 | AliCDBId* id=0; |
e84c88f5 |
2020 | while((id = dynamic_cast<AliCDBId*> (iter2.Next()))){ |
a4970db9 |
2021 | cdbListCopy->Add(new TObjString(id->ToString().Data())); |
f747912b |
2022 | } |
2023 | |
21a3aa09 |
2024 | ftree->GetUserInfo()->Add(cdbMapCopy); |
2025 | ftree->GetUserInfo()->Add(cdbListCopy); |
abe0c04e |
2026 | |
46698ae4 |
2027 | |
21a3aa09 |
2028 | ffile->cd(); |
aa3c69a9 |
2029 | |
a9c0e6db |
2030 | if (fWriteESDfriend) |
21a3aa09 |
2031 | ftree->SetBranchStatus("ESDfriend*",0); |
562dd0b4 |
2032 | // we want to have only one tree version number |
21a3aa09 |
2033 | ftree->Write(ftree->GetName(),TObject::kOverwrite); |
63314086 |
2034 | fhlttree->Write(fhlttree->GetName(),TObject::kOverwrite); |
f3a97c86 |
2035 | |
a7a1e1c7 |
2036 | // Finish with Plane Efficiency evaluation: before of CleanUp !!! |
2037 | if (fRunPlaneEff && !FinishPlaneEff()) { |
2038 | AliWarning("Finish PlaneEff evaluation failed"); |
2039 | } |
2040 | |
930e6e3e |
2041 | // End of cycle for the in-loop |
87da0921 |
2042 | |
2043 | if (fRunQA || fRunGlobalQA) { |
5cbed243 |
2044 | AliQAManager::QAManager()->EndOfCycle() ; |
81d57268 |
2045 | if (fInput && |
2046 | !fProofOutputLocation.IsNull() && |
2047 | fProofOutputArchive.IsNull() && |
2048 | !fProofOutputDataset) { |
2049 | TString qaOutputFile(Form("%sMerged.%s.Data.root", |
2050 | fProofOutputLocation.Data(), |
2051 | AliQAv1::GetQADataFileName())); |
2052 | TProofOutputFile *qaProofFile = new TProofOutputFile(Form("Merged.%s.Data.root", |
2053 | AliQAv1::GetQADataFileName())); |
2054 | qaProofFile->SetOutputFileName(qaOutputFile.Data()); |
2055 | if (AliDebugLevel() > 0) qaProofFile->Dump(); |
2056 | fOutput->Add(qaProofFile); |
2057 | MergeQA(qaProofFile->GetFileName()); |
87da0921 |
2058 | } |
2059 | else { |
2060 | MergeQA(); |
2061 | } |
2062 | } |
2063 | |
4b71572b |
2064 | gROOT->cd(); |
2065 | CleanUp(); |
81d57268 |
2066 | |
2067 | if (fInput) { |
2068 | if (!fProofOutputFileName.IsNull() && |
2069 | !fProofOutputLocation.IsNull() && |
2070 | fProofOutputDataset && |
2071 | !fProofOutputArchive.IsNull()) { |
2072 | TProofOutputFile *zipProofFile = new TProofOutputFile(fProofOutputFileName.Data(), |
2073 | "DROV", |
2074 | fProofOutputLocation.Data()); |
2075 | if (AliDebugLevel() > 0) zipProofFile->Dump(); |
2076 | fOutput->Add(zipProofFile); |
2077 | TString fileList(fProofOutputArchive.Data()); |
2078 | fileList.ReplaceAll(","," "); |
38c18bf1 |
2079 | TString command; |
2080 | #if ROOT_SVN_REVISION >= 30174 |
2081 | command.Form("zip -n root %s/%s %s",zipProofFile->GetDir(kTRUE),zipProofFile->GetFileName(),fileList.Data()); |
2082 | #else |
2083 | command.Form("zip -n root %s/%s %s",zipProofFile->GetDir(),zipProofFile->GetFileName(),fileList.Data()); |
2084 | #endif |
2085 | AliInfo(Form("Executing: %s",command.Data())); |
2086 | gSystem->Exec(command.Data()); |
81d57268 |
2087 | } |
2088 | } |
4b71572b |
2089 | } |
2090 | |
2091 | //_____________________________________________________________________________ |
2092 | void AliReconstruction::Terminate() |
2093 | { |
f3a97c86 |
2094 | // Create tags for the events in the ESD tree (the ESD tree is always present) |
2095 | // In case of empty events the tags will contain dummy values |
52dd4a8c |
2096 | AliCodeTimerAuto("",0); |
4b71572b |
2097 | |
e6d66370 |
2098 | // Do not call the ESD tag creator in case of PROOF-based reconstruction |
2099 | if (!fInput) { |
2100 | AliESDTagCreator *esdtagCreator = new AliESDTagCreator(); |
2101 | esdtagCreator->CreateESDTags(fFirstEvent,fLastEvent,fGRPData, AliQAv1::Instance()->GetQA(), AliQAv1::Instance()->GetEventSpecies(), AliQAv1::kNDET, AliRecoParam::kNSpecies); |
9bcaa1d7 |
2102 | delete esdtagCreator; |
e6d66370 |
2103 | } |
e84c88f5 |
2104 | |
795e4a22 |
2105 | // Cleanup of CDB manager: cache and active storages! |
2106 | AliCDBManager::Instance()->ClearCache(); |
596a855f |
2107 | } |
2108 | |
b26c3770 |
2109 | //_____________________________________________________________________________ |
2110 | Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors) |
2111 | { |
2112 | // run the local reconstruction |
aa3c69a9 |
2113 | |
0f88822a |
2114 | static Int_t eventNr=0; |
52dd4a8c |
2115 | AliCodeTimerAuto("",0) |
b26c3770 |
2116 | |
2117 | TString detStr = detectors; |
ac4a7581 |
2118 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b26c3770 |
2119 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
2120 | AliReconstructor* reconstructor = GetReconstructor(iDet); |
2121 | if (!reconstructor) continue; |
2122 | AliLoader* loader = fLoader[iDet]; |
f6806ad3 |
2123 | // Matthias April 2008: temporary fix to run HLT reconstruction |
2124 | // although the HLT loader is missing |
2125 | if (strcmp(fgkDetectorName[iDet], "HLT")==0) { |
2126 | if (fRawReader) { |
44ed7a66 |
2127 | reconstructor->Reconstruct(fRawReader, NULL); |
f6806ad3 |
2128 | } else { |
44ed7a66 |
2129 | TTree* dummy=NULL; |
2130 | reconstructor->Reconstruct(dummy, NULL); |
f6806ad3 |
2131 | } |
2132 | continue; |
2133 | } |
d76c31f4 |
2134 | if (!loader) { |
2135 | AliWarning(Form("No loader is defined for %s!",fgkDetectorName[iDet])); |
2136 | continue; |
2137 | } |
b26c3770 |
2138 | // conversion of digits |
2139 | if (fRawReader && reconstructor->HasDigitConversion()) { |
2140 | AliInfo(Form("converting raw data digits into root objects for %s", |
2141 | fgkDetectorName[iDet])); |
30bbd491 |
2142 | // AliCodeTimerAuto(Form("converting raw data digits into root objects for %s", |
52dd4a8c |
2143 | // fgkDetectorName[iDet]),0); |
b26c3770 |
2144 | loader->LoadDigits("update"); |
2145 | loader->CleanDigits(); |
2146 | loader->MakeDigitsContainer(); |
2147 | TTree* digitsTree = loader->TreeD(); |
2148 | reconstructor->ConvertDigits(fRawReader, digitsTree); |
2149 | loader->WriteDigits("OVERWRITE"); |
2150 | loader->UnloadDigits(); |
b26c3770 |
2151 | } |
b26c3770 |
2152 | // local reconstruction |
b26c3770 |
2153 | AliInfo(Form("running reconstruction for %s", fgkDetectorName[iDet])); |
52dd4a8c |
2154 | //AliCodeTimerAuto(Form("running reconstruction for %s", fgkDetectorName[iDet]),0); |
b26c3770 |
2155 | loader->LoadRecPoints("update"); |
2156 | loader->CleanRecPoints(); |
2157 | loader->MakeRecPointsContainer(); |
2158 | TTree* clustersTree = loader->TreeR(); |
2159 | if (fRawReader && !reconstructor->HasDigitConversion()) { |
2160 | reconstructor->Reconstruct(fRawReader, clustersTree); |
2161 | } else { |
2162 | loader->LoadDigits("read"); |
2163 | TTree* digitsTree = loader->TreeD(); |
2164 | if (!digitsTree) { |
44ed7a66 |
2165 | AliError(Form("Can't get the %s digits tree", fgkDetectorName[iDet])); |
13effe3f |
2166 | if (fStopOnError) |
2167 | return kFALSE; |
b26c3770 |
2168 | } else { |
44ed7a66 |
2169 | reconstructor->Reconstruct(digitsTree, clustersTree); |
514cb8c7 |
2170 | if (fRunQA && IsInTasks(AliQAv1::kDIGITSR)) { |
eca4fa66 |
2171 | AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ; |
2172 | AliQAManager::QAManager()->RunOneEventInOneDetector(iDet, digitsTree) ; |
44ed7a66 |
2173 | } |
b26c3770 |
2174 | } |
2175 | loader->UnloadDigits(); |
2176 | } |
514cb8c7 |
2177 | if (fRunQA && IsInTasks(AliQAv1::kRECPOINTS)) { |
eca4fa66 |
2178 | AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ; |
2179 | AliQAManager::QAManager()->RunOneEventInOneDetector(iDet, clustersTree) ; |
57acd2d2 |
2180 | } |
eca4fa66 |
2181 | loader->WriteRecPoints("OVERWRITE"); |
2182 | loader->UnloadRecPoints(); |
2183 | AliSysInfo::AddStamp(Form("LRec%s_%d",fgkDetectorName[iDet],eventNr), iDet,1,eventNr); |
a00021a7 |
2184 | } |
13effe3f |
2185 | IsSelected("CTP", detStr); |
a00021a7 |
2186 | if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { |
b26c3770 |
2187 | AliError(Form("the following detectors were not found: %s", |
2188 | detStr.Data())); |
13effe3f |
2189 | if (fStopOnError) |
2190 | return kFALSE; |
b26c3770 |
2191 | } |
0f88822a |
2192 | eventNr++; |
b26c3770 |
2193 | return kTRUE; |
2194 | } |
58e8dc31 |
2195 | //_____________________________________________________________________________ |
2196 | Bool_t AliReconstruction::RunSPDTrackleting(AliESDEvent*& esd) |
2197 | { |
2198 | // run the SPD trackleting (for SPD efficiency purpouses) |
2199 | |
52dd4a8c |
2200 | AliCodeTimerAuto("",0) |
58e8dc31 |
2201 | |
2202 | Double_t vtxPos[3] = {0, 0, 0}; |
2203 | Double_t vtxErr[3] = {0.0, 0.0, 0.0}; |
2204 | /* |
2205 | TArrayF mcVertex(3); |
2206 | // if(MC) |
2207 | if (fRunLoader->GetHeader() && fRunLoader->GetHeader()->GenEventHeader()) { |
2208 | fRunLoader->GetHeader()->GenEventHeader()->PrimaryVertex(mcVertex); |
2209 | for (Int_t i = 0; i < 3; i++) vtxPos[i] = mcVertex[i]; |
2210 | } |
2211 | */ |
2212 | const AliESDVertex *vertex = esd->GetVertex(); |
2213 | if(!vertex){ |
2214 | AliWarning("Vertex not found"); |
2215 | return kFALSE; |
2216 | } |
2217 | vertex->GetXYZ(vtxPos); |
2218 | vertex->GetSigmaXYZ(vtxErr); |
2219 | if (fSPDTrackleter) { |
2220 | AliInfo("running the SPD Trackleter for Plane Efficiency Evaluation"); |
2221 | |
2222 | // load clusters |
2223 | fLoader[0]->LoadRecPoints("read"); |
2224 | TTree* tree = fLoader[0]->TreeR(); |
2225 | if (!tree) { |
2226 | AliError("Can't get the ITS cluster tree"); |
2227 | return kFALSE; |
2228 | } |
2229 | fSPDTrackleter->LoadClusters(tree); |
2230 | fSPDTrackleter->SetVertex(vtxPos, vtxErr); |
2231 | // run trackleting |
2232 | if (fSPDTrackleter->Clusters2Tracks(esd) != 0) { |
2233 | AliError("AliITSTrackleterSPDEff Clusters2Tracks failed"); |
2234 | // fLoader[0]->UnloadRecPoints(); |
2235 | return kFALSE; |
2236 | } |
2237 | //fSPDTrackleter->UnloadRecPoints(); |
2238 | } else { |
2239 | AliWarning("SPDTrackleter not available"); |
2240 | return kFALSE; |
2241 | } |
2242 | return kTRUE; |
2243 | } |
b26c3770 |
2244 | |
596a855f |
2245 | //_____________________________________________________________________________ |
af885e0f |
2246 | Bool_t AliReconstruction::RunVertexFinder(AliESDEvent*& esd) |
596a855f |
2247 | { |
2248 | // run the barrel tracking |
2249 | |
52dd4a8c |
2250 | AliCodeTimerAuto("",0) |
030b532d |
2251 | |
92bffc4d |
2252 | AliVertexer *vertexer = CreateVertexer(); |
2253 | if (!vertexer) return kFALSE; |
2254 | |
2255 | AliInfo("running the ITS vertex finder"); |
2257f27e |
2256 | AliESDVertex* vertex = NULL; |
92bffc4d |
2257 | if (fLoader[0]) { |
2258 | fLoader[0]->LoadRecPoints(); |
2259 | TTree* cltree = fLoader[0]->TreeR(); |
2260 | if (cltree) { |
2261 | if(fDiamondProfileSPD) vertexer->SetVtxStart(fDiamondProfileSPD); |
2262 | vertex = vertexer->FindVertexForCurrentEvent(cltree); |
308c2f7c |
2263 | } |
2264 | else { |
92bffc4d |
2265 | AliError("Can't get the ITS cluster tree"); |
308c2f7c |
2266 | } |
92bffc4d |
2267 | fLoader[0]->UnloadRecPoints(); |
2257f27e |
2268 | } |
92bffc4d |
2269 | else { |
2270 | AliError("Can't get the ITS loader"); |
2271 | } |
2272 | if(!vertex){ |
2273 | AliWarning("Vertex not found"); |
2274 | vertex = new AliESDVertex(); |
2275 | vertex->SetName("default"); |
2276 | } |
2277 | else { |
2278 | vertex->SetName("reconstructed"); |
2257f27e |
2279 | } |
92bffc4d |
2280 | |
2281 | Double_t vtxPos[3]; |
2282 | Double_t vtxErr[3]; |
2283 | vertex->GetXYZ(vtxPos); |
2284 | vertex->GetSigmaXYZ(vtxErr); |
2285 | |
06cc9d95 |
2286 | esd->SetPrimaryVertexSPD(vertex); |
73c51de2 |
2287 | AliESDVertex *vpileup = NULL; |
2288 | Int_t novertices = 0; |
2289 | vpileup = vertexer->GetAllVertices(novertices); |
2290 | if(novertices>1){ |
2291 | for (Int_t kk=1; kk<novertices; kk++)esd->AddPileupVertexSPD(&vpileup[kk]); |
2292 | } |
32e449be |
2293 | // if SPD multiplicity has been determined, it is stored in the ESD |
92bffc4d |
2294 | AliMultiplicity *mult = vertexer->GetMultiplicity(); |
32e449be |
2295 | if(mult)esd->SetMultiplicity(mult); |
2296 | |
ac4a7581 |
2297 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 |
2298 | if (fTracker[iDet]) fTracker[iDet]->SetVertex(vtxPos, vtxErr); |
2299 | } |
2257f27e |
2300 | delete vertex; |
2301 | |
92bffc4d |
2302 | delete vertexer; |
2303 | |
2257f27e |
2304 | return kTRUE; |
2305 | } |
2306 | |
1f46a9ae |
2307 | //_____________________________________________________________________________ |
af885e0f |
2308 | Bool_t AliReconstruction::RunHLTTracking(AliESDEvent*& esd) |
1f46a9ae |
2309 | { |
2310 | // run the HLT barrel tracking |
2311 | |
52dd4a8c |
2312 | AliCodeTimerAuto("",0) |
1f46a9ae |
2313 | |
2314 | if (!fRunLoader) { |
2315 | AliError("Missing runLoader!"); |
2316 | return kFALSE; |
2317 | } |
2318 | |
2319 | AliInfo("running HLT tracking"); |
2320 | |
2321 | // Get a pointer to the HLT reconstructor |
ac4a7581 |
2322 | AliReconstructor *reconstructor = GetReconstructor(kNDetectors-1); |
1f46a9ae |
2323 | if (!reconstructor) return kFALSE; |
2324 | |
2325 | // TPC + ITS |
2326 | for (Int_t iDet = 1; iDet >= 0; iDet--) { |
2327 | TString detName = fgkDetectorName[iDet]; |
2328 | AliDebug(1, Form("%s HLT tracking", detName.Data())); |
2329 | reconstructor->SetOption(detName.Data()); |
d76c31f4 |
2330 | AliTracker *tracker = reconstructor->CreateTracker(); |
1f46a9ae |
2331 | if (!tracker) { |
2332 | AliWarning(Form("couldn't create a HLT tracker for %s", detName.Data())); |
2333 | if (fStopOnError) return kFALSE; |
9dcc06e1 |
2334 | continue; |
1f46a9ae |
2335 | } |
2336 | Double_t vtxPos[3]; |
2337 | Double_t vtxErr[3]={0.005,0.005,0.010}; |
2338 | const AliESDVertex *vertex = esd->GetVertex(); |
2339 | vertex->GetXYZ(vtxPos); |
2340 | tracker->SetVertex(vtxPos,vtxErr); |
2341 | if(iDet != 1) { |
2342 | fLoader[iDet]->LoadRecPoints("read"); |
2343 | TTree* tree = fLoader[iDet]->TreeR(); |
2344 | if (!tree) { |
2345 | AliError(Form("Can't get the %s cluster tree", detName.Data())); |
2346 | return kFALSE; |
2347 | } |
2348 | tracker->LoadClusters(tree); |
2349 | } |
2350 | if (tracker->Clusters2Tracks(esd) != 0) { |
2351 | AliError(Form("HLT %s Clusters2Tracks failed", fgkDetectorName[iDet])); |
2352 | return kFALSE; |
2353 | } |
2354 | if(iDet != 1) { |
2355 | tracker->UnloadClusters(); |
2356 | } |
2357 | delete tracker; |
2358 | } |
2359 | |
1f46a9ae |
2360 | return kTRUE; |
2361 | } |
2362 | |
e66fbafb |
2363 | //_____________________________________________________________________________ |
af885e0f |
2364 | Bool_t AliReconstruction::RunMuonTracking(AliESDEvent*& esd) |
e66fbafb |
2365 | { |
2366 | // run the muon spectrometer tracking |
2367 | |
52dd4a8c |
2368 | AliCodeTimerAuto("",0) |
e66fbafb |
2369 | |
2370 | if (!fRunLoader) { |
2371 | AliError("Missing runLoader!"); |
2372 | return kFALSE; |
2373 | } |
2374 | Int_t iDet = 7; // for MUON |
2375 | |
2376 | AliInfo("is running..."); |
2377 | |
2378 | // Get a pointer to the MUON reconstructor |
2379 | AliReconstructor *reconstructor = GetReconstructor(iDet); |
2380 | if (!reconstructor) return kFALSE; |
2381 | |
2382 | |
2383 | TString detName = fgkDetectorName[iDet]; |
2384 | AliDebug(1, Form("%s tracking", detName.Data())); |
d76c31f4 |
2385 | AliTracker *tracker = reconstructor->CreateTracker(); |
e66fbafb |
2386 | if (!tracker) { |
2387 | AliWarning(Form("couldn't create a tracker for %s", detName.Data())); |
2388 | return kFALSE; |
2389 | } |
2390 | |
e66fbafb |
2391 | // read RecPoints |
761350a6 |
2392 | fLoader[iDet]->LoadRecPoints("read"); |
c1954ee5 |
2393 | |
761350a6 |
2394 | tracker->LoadClusters(fLoader[iDet]->TreeR()); |
2395 | |
2396 | Int_t rv = tracker->Clusters2Tracks(esd); |
2397 | |
e66fbafb |
2398 | fLoader[iDet]->UnloadRecPoints(); |
2399 | |
c1954ee5 |
2400 | tracker->UnloadClusters(); |
2401 | |
e66fbafb |
2402 | delete tracker; |
2403 | |
cb23c6ca |
2404 | if ( rv ) |
2405 | { |
2406 | AliError(Form("%s Clusters2Tracks failed", fgkDetectorName[iDet])); |
2407 | return kFALSE; |
2408 | } |
2409 | |
e66fbafb |
2410 | return kTRUE; |
2411 | } |
2412 | |
2413 | |
2257f27e |
2414 | //_____________________________________________________________________________ |
af885e0f |
2415 | Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd) |
2257f27e |
2416 | { |
2417 | // run the barrel tracking |
0f88822a |
2418 | static Int_t eventNr=0; |
52dd4a8c |
2419 | AliCodeTimerAuto("",0) |
24f7a148 |
2420 | |
815c2b38 |
2421 | AliInfo("running tracking"); |
596a855f |
2422 | |
1f26f3e7 |
2423 | // Set the event info which is used |
2424 | // by the trackers in order to obtain |
2425 | // information about read-out detectors, |
2426 | // trigger etc. |
2427 | AliDebug(1, "Setting event info"); |
2428 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
2429 | if (!fTracker[iDet]) continue; |
2430 | fTracker[iDet]->SetEventInfo(&fEventInfo); |
2431 | } |
2432 | |
91b876d1 |
2433 | //Fill the ESD with the T0 info (will be used by the TOF) |
d76c31f4 |
2434 | if (fReconstructor[11] && fLoader[11]) { |
2435 | fLoader[11]->LoadRecPoints("READ"); |
2436 | TTree *treeR = fLoader[11]->TreeR(); |
89916438 |
2437 | if (treeR) { |
2438 | GetReconstructor(11)->FillESD((TTree *)NULL,treeR,esd); |
2439 | } |
d76c31f4 |
2440 | } |
91b876d1 |
2441 | |
b8cd5251 |
2442 | // pass 1: TPC + ITS inwards |
2443 | for (Int_t iDet = 1; iDet >= 0; iDet--) { |
2444 | if (!fTracker[iDet]) continue; |
2445 | AliDebug(1, Form("%s tracking", fgkDetectorName[iDet])); |
24f7a148 |
2446 | |
b8cd5251 |
2447 | // load clusters |
2448 | fLoader[iDet]->LoadRecPoints("read"); |
6efecea1 |
2449 | AliSysInfo::AddStamp(Form("RLoadCluster%s_%d",fgkDetectorName[iDet],eventNr),iDet,1, eventNr); |
b8cd5251 |
2450 | TTree* tree = fLoader[iDet]->TreeR(); |
2451 | if (!tree) { |
2452 | AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet])); |
24f7a148 |
2453 | return kFALSE; |
2454 | } |
b8cd5251 |
2455 | fTracker[iDet]->LoadClusters(tree); |
6efecea1 |
2456 | AliSysInfo::AddStamp(Form("TLoadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,2, eventNr); |
b8cd5251 |
2457 | // run tracking |
2458 | if (fTracker[iDet]->Clusters2Tracks(esd) != 0) { |
2459 | AliError(Form("%s Clusters2Tracks failed", fgkDetectorName[iDet])); |
24f7a148 |
2460 | return kFALSE; |
2461 | } |
878e1fe1 |
2462 | // preliminary PID in TPC needed by the ITS tracker |
2463 | if (iDet == 1) { |
b26c3770 |
2464 | GetReconstructor(1)->FillESD((TTree*)NULL, (TTree*)NULL, esd); |
878e1fe1 |
2465 | AliESDpid::MakePID(esd); |
0f88822a |
2466 | } |
6efecea1 |
2467 | AliSysInfo::AddStamp(Form("Tracking0%s_%d",fgkDetectorName[iDet],eventNr), iDet,3,eventNr); |
b8cd5251 |
2468 | } |
596a855f |
2469 | |
b8cd5251 |
2470 | // pass 2: ALL backwards |
aa3c69a9 |
2471 | |
ac4a7581 |
2472 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 |
2473 | if (!fTracker[iDet]) continue; |
2474 | AliDebug(1, Form("%s back propagation", fgkDetectorName[iDet])); |
2475 | |
2476 | // load clusters |
2477 | if (iDet > 1) { // all except ITS, TPC |
2478 | TTree* tree = NULL; |
7b61cd9c |
2479 | fLoader[iDet]->LoadRecPoints("read"); |
6efecea1 |
2480 | AliSysInfo::AddStamp(Form("RLoadCluster0%s_%d",fgkDetectorName[iDet],eventNr), iDet,1, eventNr); |
7b61cd9c |
2481 | tree = fLoader[iDet]->TreeR(); |
b8cd5251 |
2482 | if (!tree) { |
eca4fa66 |
2483 | AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet])); |
2484 | return kFALSE; |
24f7a148 |
2485 | } |
0f88822a |
2486 | fTracker[iDet]->LoadClusters(tree); |
6efecea1 |
2487 | AliSysInfo::AddStamp(Form("TLoadCluster0%s_%d",fgkDetectorName[iDet],eventNr), iDet,2, eventNr); |
b8cd5251 |
2488 | } |
24f7a148 |
2489 | |
b8cd5251 |
2490 | // run tracking |
283f39c6 |
2491 | if (iDet>1) // start filling residuals for the "outer" detectors |
eca4fa66 |
2492 | if (fRunGlobalQA) { |
2493 | AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kTRUE); |
2494 | TObjArray ** arr = AliTracker::GetResidualsArray() ; |
c9526f68 |
2495 | if (arr) { |
0a349581 |
2496 | AliRecoParam::EventSpecie_t es=fRecoParam.GetEventSpecie(); |
2497 | TObjArray * elem = arr[AliRecoParam::AConvert(es)]; |
c9526f68 |
2498 | if ( elem && (! elem->At(0)) ) { |
2499 | AliQADataMaker *qadm = AliQAManager::QAManager()->GetQADataMaker(AliQAv1::kGLOBAL); |
2500 | if (qadm) qadm->InitRecPointsForTracker() ; |
2501 | } |
2502 | } |
eca4fa66 |
2503 | } |
b8cd5251 |
2504 | if (fTracker[iDet]->PropagateBack(esd) != 0) { |
2505 | AliError(Form("%s backward propagation failed", fgkDetectorName[iDet])); |
49dfd67a |
2506 | // return kFALSE; |
b8cd5251 |
2507 | } |
24f7a148 |
2508 | |
b8cd5251 |
2509 | // unload clusters |
6e65648b |
2510 | if (iDet > 3) { // all except ITS, TPC, TRD and TOF |
b8cd5251 |
2511 | fTracker[iDet]->UnloadClusters(); |
7b61cd9c |
2512 | fLoader[iDet]->UnloadRecPoints(); |
b8cd5251 |
2513 | } |
8f37df88 |
2514 | // updated PID in TPC needed by the ITS tracker -MI |
2515 | if (iDet == 1) { |
8f37df88 |
2516 | GetReconstructor(1)->FillESD((TTree*)NULL, (TTree*)NULL, esd); |
2517 | AliESDpid::MakePID(esd); |
2518 | } |
6efecea1 |
2519 | AliSysInfo::AddStamp(Form("Tracking1%s_%d",fgkDetectorName[iDet],eventNr), iDet,3, eventNr); |
b8cd5251 |
2520 | } |
283f39c6 |
2521 | //stop filling residuals for the "outer" detectors |
57acd2d2 |
2522 | if (fRunGlobalQA) AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kFALSE); |
596a855f |
2523 | |
b8cd5251 |
2524 | // pass 3: TRD + TPC + ITS refit inwards |
aa3c69a9 |
2525 | |
b8cd5251 |
2526 | for (Int_t iDet = 2; iDet >= 0; iDet--) { |
2527 | if (!fTracker[iDet]) continue; |
2528 | AliDebug(1, Form("%s inward refit", fgkDetectorName[iDet])); |
596a855f |
2529 | |
b8cd5251 |
2530 | // run tracking |
283f39c6 |
2531 | if (iDet<2) // start filling residuals for TPC and ITS |
eca4fa66 |
2532 | if (fRunGlobalQA) { |
2533 | AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kTRUE); |
2534 | TObjArray ** arr = AliTracker::GetResidualsArray() ; |
c9526f68 |
2535 | if (arr) { |
0a349581 |
2536 | AliRecoParam::EventSpecie_t es=fRecoParam.GetEventSpecie(); |
2537 | TObjArray * elem = arr[AliRecoParam::AConvert(es)]; |
c9526f68 |
2538 | if ( elem && (! elem->At(0)) ) { |
2539 | AliQADataMaker *qadm = AliQAManager::QAManager()->GetQADataMaker(AliQAv1::kGLOBAL); |
2540 | if (qadm) qadm->InitRecPointsForTracker() ; |
2541 | } |
2542 | } |
eca4fa66 |
2543 | } |
2544 | |
b8cd5251 |
2545 | if (fTracker[iDet]->RefitInward(esd) != 0) { |
2546 | AliError(Form("%s inward refit failed", fgkDetectorName[iDet])); |
49dfd67a |
2547 | // return kFALSE; |
b8cd5251 |
2548 | } |
db2368d0 |
2549 | // run postprocessing |
2550 | if (fTracker[iDet]->PostProcess(esd) != 0) { |
2551 | AliError(Form("%s postprocessing failed", fgkDetectorName[iDet])); |
2552 | // return kFALSE; |
2553 | } |
6efecea1 |
2554 | AliSysInfo::AddStamp(Form("Tracking2%s_%d",fgkDetectorName[iDet],eventNr), iDet,3, eventNr); |
6e65648b |
2555 | } |
2556 | |
2557 | // write space-points to the ESD in case alignment data output |
2558 | // is switched on |
2559 | if (fWriteAlignmentData) |
2560 | WriteAlignmentData(esd); |
2561 | |
2562 | for (Int_t iDet = 3; iDet >= 0; iDet--) { |
2563 | if (!fTracker[iDet]) continue; |
b8cd5251 |
2564 | // unload clusters |
2565 | fTracker[iDet]->UnloadClusters(); |
6efecea1 |
2566 | AliSysInfo::AddStamp(Form("TUnloadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,4, eventNr); |
b8cd5251 |
2567 | fLoader[iDet]->UnloadRecPoints(); |
6efecea1 |
2568 | AliSysInfo::AddStamp(Form("RUnloadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,5, eventNr); |
b8cd5251 |
2569 | } |
283f39c6 |
2570 | // stop filling residuals for TPC and ITS |
57acd2d2 |
2571 | if (fRunGlobalQA) AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kFALSE); |
854c6476 |
2572 | |
0f88822a |
2573 | eventNr++; |
596a855f |
2574 | return kTRUE; |
2575 | } |
2576 | |
d64bd07d |
2577 | //_____________________________________________________________________________ |
2578 | Bool_t AliReconstruction::CleanESD(AliESDEvent *esd){ |
2579 | // |
2580 | // Remove the data which are not needed for the physics analysis. |
2581 | // |
2582 | |
d64bd07d |
2583 | Int_t nTracks=esd->GetNumberOfTracks(); |
18571674 |
2584 | Int_t nV0s=esd->GetNumberOfV0s(); |
cf37fd88 |
2585 | AliInfo |
2586 | (Form("Number of ESD tracks and V0s before cleaning: %d %d",nTracks,nV0s)); |
d64bd07d |
2587 | |
18571674 |
2588 | Float_t cleanPars[]={fV0DCAmax,fV0CsPmin,fDmax,fZmax}; |
7f68891d |
2589 | Bool_t rc=esd->Clean(cleanPars); |
d64bd07d |
2590 | |
7f68891d |
2591 | nTracks=esd->GetNumberOfTracks(); |
18571674 |
2592 | nV0s=esd->GetNumberOfV0s(); |
cf37fd88 |
2593 | AliInfo |
ae5d5566 |
2594 | (Form("Number of ESD tracks and V0s after cleaning %d %d",nTracks,nV0s)); |
d64bd07d |
2595 | |
7f68891d |
2596 | return rc; |
d64bd07d |
2597 | } |
2598 | |
596a855f |
2599 | //_____________________________________________________________________________ |
af885e0f |
2600 | Bool_t AliReconstruction::FillESD(AliESDEvent*& esd, const TString& detectors) |
596a855f |
2601 | { |
2602 | // fill the event summary data |
2603 | |
52dd4a8c |
2604 | AliCodeTimerAuto("",0) |
0f88822a |
2605 | static Int_t eventNr=0; |
596a855f |
2606 | TString detStr = detectors; |
abe0c04e |
2607 | |
ac4a7581 |
2608 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
abe0c04e |
2609 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
b8cd5251 |
2610 | AliReconstructor* reconstructor = GetReconstructor(iDet); |
2611 | if (!reconstructor) continue; |
4b71572b |
2612 | AliDebug(1, Form("filling ESD for %s", fgkDetectorName[iDet])); |
2613 | TTree* clustersTree = NULL; |
2614 | if (fLoader[iDet]) { |
2615 | fLoader[iDet]->LoadRecPoints("read"); |
2616 | clustersTree = fLoader[iDet]->TreeR(); |
2617 | if (!clustersTree) { |
2618 | AliError(Form("Can't get the %s clusters tree", |
2619 | fgkDetectorName[iDet])); |
2620 | if (fStopOnError) return kFALSE; |
2621 | } |
2622 | } |
2623 | if (fRawReader && !reconstructor->HasDigitConversion()) { |
2624 | reconstructor->FillESD(fRawReader, clustersTree, esd); |
2625 | } else { |
2626 | TTree* digitsTree = NULL; |
d76c31f4 |
2627 | if (fLoader[iDet]) { |
4b71572b |
2628 | fLoader[iDet]->LoadDigits("read"); |
2629 | digitsTree = fLoader[iDet]->TreeD(); |
2630 | if (!digitsTree) { |
2631 | AliError(Form("Can't get the %s digits tree", |
b26c3770 |
2632 | fgkDetectorName[iDet])); |
2633 | if (fStopOnError) return kFALSE; |
2634 | } |
2635 | } |
4b71572b |
2636 | reconstructor->FillESD(digitsTree, clustersTree, esd); |
2637 | if (fLoader[iDet]) fLoader[iDet]->UnloadDigits(); |
2638 | } |
2639 | if (fLoader[iDet]) { |
2640 | fLoader[iDet]->UnloadRecPoints(); |
596a855f |
2641 | } |
2642 | } |
13effe3f |
2643 | |
2644 | IsSelected("CTP", detStr); |
596a855f |
2645 | if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { |
815c2b38 |
2646 | AliError(Form("the following detectors were not found: %s", |
2647 | detStr.Data())); |
596a855f |
2648 | if (fStopOnError) return kFALSE; |
2649 | } |
6efecea1 |
2650 | AliSysInfo::AddStamp(Form("FillESD%d",eventNr), 0,1, eventNr); |
0f88822a |
2651 | eventNr++; |
596a855f |
2652 | return kTRUE; |
2653 | } |
2654 | |
b647652d |
2655 | //_____________________________________________________________________________ |
af885e0f |
2656 | Bool_t AliReconstruction::FillTriggerESD(AliESDEvent*& esd) |
b647652d |
2657 | { |
2658 | // Reads the trigger decision which is |
2659 | // stored in Trigger.root file and fills |
2660 | // the corresponding esd entries |
2661 | |
52dd4a8c |
2662 | AliCodeTimerAuto("",0) |
87932dab |
2663 | |
b647652d |
2664 | AliInfo("Filling trigger information into the ESD"); |
2665 | |
2666 | if (fRawReader) { |
2667 | AliCTPRawStream input(fRawReader); |
2668 | if (!input.Next()) { |
7e88424f |
2669 | AliWarning("No valid CTP (trigger) DDL raw data is found ! The trigger info is taken from the event header!"); |
b647652d |
2670 | } |
2671 | else { |
7e88424f |
2672 | if (esd->GetTriggerMask() != input.GetClassMask()) |
2673 | AliError(Form("Invalid trigger pattern found in CTP raw-data: %llx %llx", |
2674 | input.GetClassMask(),esd->GetTriggerMask())); |
2675 | if (esd->GetOrbitNumber() != input.GetOrbitID()) |
2676 | AliError(Form("Invalid orbit id found in CTP raw-data: %x %x", |
2677 | input.GetOrbitID(),esd->GetOrbitNumber())); |
2678 | if (esd->GetBunchCrossNumber() != input.GetBCID()) |
2679 | AliError(Form("Invalid bunch-crossing id found in CTP raw-data: %x %x", |
2680 | input.GetBCID(),esd->GetBunchCrossNumber())); |
e61ed4b1 |
2681 | AliESDHeader* esdheader = esd->GetHeader(); |
2682 | esdheader->SetL0TriggerInputs(input.GetL0Inputs()); |
2683 | esdheader->SetL1TriggerInputs(input.GetL1Inputs()); |
2684 | esdheader->SetL2TriggerInputs(input.GetL2Inputs()); |
a6dd87ad |
2685 | // IR |
2686 | UInt_t orbit=input.GetOrbitID(); |
2687 | for(Int_t i=0 ; i<input.GetNIRs() ; i++ ) |
2688 | if(TMath::Abs(Int_t(orbit-(input.GetIR(i))->GetOrbit()))<=1){ |
2689 | esdheader->AddTriggerIR(input.GetIR(i)); |
2690 | } |
b647652d |
2691 | } |
b024fd7f |
2692 | } |
f7812afc |
2693 | return kTRUE; |
2694 | } |
2695 | //_____________________________________________________________________________ |
2696 | Bool_t AliReconstruction::FillTriggerScalers(AliESDEvent*& esd) |
2697 | { |
522fdd91 |
2698 | //Scalers |
82ebedd6 |
2699 | //fRunScalers->Print(); |
2700 | if(fRunScalers && fRunScalers->CheckRunScalers()){ |
a6dd87ad |
2701 | AliTimeStamp* timestamp = new AliTimeStamp(esd->GetOrbitNumber(), esd->GetPeriodNumber(), esd->GetBunchCrossNumber()); |
82ebedd6 |
2702 | //AliTimeStamp* timestamp = new AliTimeStamp(10308000, 0, (ULong64_t)486238); |
522fdd91 |
2703 | AliESDHeader* esdheader = fesd->GetHeader(); |
2704 | for(Int_t i=0;i<50;i++){ |
1e78ae8c |
2705 | if((1ull<<i) & esd->GetTriggerMask()){ |
6863d231 |
2706 | AliTriggerScalersESD* scalesd = fRunScalers->GetScalersForEventClass( timestamp, i+1); |
82ebedd6 |
2707 | if(scalesd)esdheader->SetTriggerScalersRecord(scalesd); |
522fdd91 |
2708 | } |
2709 | } |
2710 | } |
b647652d |
2711 | return kTRUE; |
2712 | } |
001397cd |
2713 | //_____________________________________________________________________________ |
af885e0f |
2714 | Bool_t AliReconstruction::FillRawEventHeaderESD(AliESDEvent*& esd) |
001397cd |
2715 | { |
2716 | // |
2717 | // Filling information from RawReader Header |
2718 | // |
2719 | |
151bea4e |
2720 | if (!fRawReader) return kFALSE; |
2721 | |
001397cd |
2722 | AliInfo("Filling information from RawReader Header"); |
151bea4e |
2723 | |
2724 | esd->SetBunchCrossNumber(fRawReader->GetBCID()); |
2725 | esd->SetOrbitNumber(fRawReader->GetOrbitID()); |
2726 | esd->SetPeriodNumber(fRawReader->GetPeriod()); |
2727 | |
2728 | esd->SetTimeStamp(fRawReader->GetTimestamp()); |
2729 | esd->SetEventType(fRawReader->GetType()); |
001397cd |
2730 | |
2731 | return kTRUE; |
2732 | } |
2733 | |
2734 | |
596a855f |
2735 | //_____________________________________________________________________________ |
2736 | Bool_t AliReconstruction::IsSelected(TString detName, TString& detectors) const |
2737 | { |
2738 | // check whether detName is contained in detectors |
2739 | // if yes, it is removed from detectors |
2740 | |
2741 | // check if all detectors are selected |
2742 | if ((detectors.CompareTo("ALL") == 0) || |
2743 | detectors.BeginsWith("ALL ") || |
2744 | detectors.EndsWith(" ALL") || |
2745 | detectors.Contains(" ALL ")) { |
2746 | detectors = "ALL"; |
2747 | return kTRUE; |
2748 | } |
2749 | |
2750 | // search for the given detector |
2751 | Bool_t result = kFALSE; |
2752 | if ((detectors.CompareTo(detName) == 0) || |
2753 | detectors.BeginsWith(detName+" ") || |
2754 | detectors.EndsWith(" "+detName) || |
2755 | detectors.Contains(" "+detName+" ")) { |
2756 | detectors.ReplaceAll(detName, ""); |
2757 | result = kTRUE; |
2758 | } |
2759 | |
2760 | // clean up the detectors string |
2761 | while (detectors.Contains(" ")) detectors.ReplaceAll(" ", " "); |
2762 | while (detectors.BeginsWith(" ")) detectors.Remove(0, 1); |
2763 | while (detectors.EndsWith(" ")) detectors.Remove(detectors.Length()-1, 1); |
2764 | |
2765 | return result; |
2766 | } |
e583c30d |
2767 | |
f08fc9f5 |
2768 | //_____________________________________________________________________________ |
2769 | Bool_t AliReconstruction::InitRunLoader() |
2770 | { |
2771 | // get or create the run loader |
2772 | |
2773 | if (gAlice) delete gAlice; |
2774 | gAlice = NULL; |
2775 | |
52dd4a8c |
2776 | TFile *gafile = TFile::Open(fGAliceFileName.Data()); |
2777 | // if (!gSystem->AccessPathName(fGAliceFileName.Data())) { // galice.root exists |
2778 | if (gafile) { // galice.root exists |
2779 | gafile->Close(); |
2780 | delete gafile; |
2781 | |
b26c3770 |
2782 | // load all base libraries to get the loader classes |
2783 | TString libs = gSystem->GetLibraries(); |
ac4a7581 |
2784 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b26c3770 |
2785 | TString detName = fgkDetectorName[iDet]; |
2786 | if (detName == "HLT") continue; |
2787 | if (libs.Contains("lib" + detName + "base.so")) continue; |
2788 | gSystem->Load("lib" + detName + "base.so"); |
2789 | } |
f08fc9f5 |
2790 | fRunLoader = AliRunLoader::Open(fGAliceFileName.Data()); |
2791 | if (!fRunLoader) { |
2792 | AliError(Form("no run loader found in file %s", fGAliceFileName.Data())); |
2793 | CleanUp(); |
2794 | return kFALSE; |
2795 | } |
325aa76f |
2796 | |
b26c3770 |
2797 | fRunLoader->CdGAFile(); |
325aa76f |
2798 | fRunLoader->LoadgAlice(); |
f08fc9f5 |
2799 | |
6cae184e |
2800 | //PH This is a temporary fix to give access to the kinematics |
2801 | //PH that is needed for the labels of ITS clusters |
f2ee4290 |
2802 | fRunLoader->LoadHeader(); |
6cae184e |
2803 | fRunLoader->LoadKinematics(); |
2804 | |
f08fc9f5 |
2805 | } else { // galice.root does not exist |
2806 | if (!fRawReader) { |
2807 | AliError(Form("the file %s does not exist", fGAliceFileName.Data())); |
f08fc9f5 |
2808 | } |
2809 | fRunLoader = AliRunLoader::Open(fGAliceFileName.Data(), |
2810 | AliConfig::GetDefaultEventFolderName(), |
2811 | "recreate"); |
2812 | if (!fRunLoader) { |
2813 | AliError(Form("could not create run loader in file %s", |
2814 | fGAliceFileName.Data())); |
2815 | CleanUp(); |
2816 | return kFALSE; |
2817 | } |
21a3aa09 |
2818 | fIsNewRunLoader = kTRUE; |
f08fc9f5 |
2819 | fRunLoader->MakeTree("E"); |
21a3aa09 |
2820 | |
973388c2 |
2821 | if (fNumberOfEventsPerFile > 0) |
2822 | fRunLoader->SetNumberOfEventsPerFile(fNumberOfEventsPerFile); |
2823 | else |
21a3aa09 |
2824 | fRunLoader->SetNumberOfEventsPerFile((UInt_t)-1); |
f08fc9f5 |
2825 | } |
2826 | |
2827 | return kTRUE; |
2828 | } |
2829 | |
c757bafd |
2830 | //_____________________________________________________________________________ |
b8cd5251 |
2831 | AliReconstructor* AliReconstruction::GetReconstructor(Int_t iDet) |
c757bafd |
2832 | { |
f08fc9f5 |
2833 | // get the reconstructor object and the loader for a detector |
c757bafd |
2834 | |
7e88424f |
2835 | if (fReconstructor[iDet]) { |
2836 | if (fRecoParam.GetDetRecoParamArray(iDet) && !AliReconstructor::GetRecoParam(iDet)) { |
2837 | const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet); |
2838 | fReconstructor[iDet]->SetRecoParam(par); |
42ec5d3d |
2839 | fReconstructor[iDet]->SetRunInfo(fRunInfo); |
7e88424f |
2840 | } |
2841 | return fReconstructor[iDet]; |
2842 | } |
b8cd5251 |
2843 | |
2844 | // load the reconstructor object |
2845 | TPluginManager* pluginManager = gROOT->GetPluginManager(); |
2846 | TString detName = fgkDetectorName[iDet]; |
2847 | TString recName = "Ali" + detName + "Reconstructor"; |
f0999a9a |
2848 | |
2849 | if (!fIsNewRunLoader && !fRunLoader->GetLoader(detName+"Loader") && (detName != "HLT")) return NULL; |
b8cd5251 |
2850 | |
b8cd5251 |
2851 | AliReconstructor* reconstructor = NULL; |
2852 | // first check if a plugin is defined for the reconstructor |
2853 | TPluginHandler* pluginHandler = |
2854 | pluginManager->FindHandler("AliReconstructor", detName); |
f08fc9f5 |
2855 | // if not, add a plugin for it |
2856 | if (!pluginHandler) { |
b8cd5251 |
2857 | AliDebug(1, Form("defining plugin for %s", recName.Data())); |
b26c3770 |
2858 | TString libs = gSystem->GetLibraries(); |
2859 | if (libs.Contains("lib" + detName + "base.so") || |
2860 | (gSystem->Load("lib" + detName + "base.so") >= 0)) { |
b8cd5251 |
2861 | pluginManager->AddHandler("AliReconstructor", detName, |
2862 | recName, detName + "rec", recName + "()"); |
2863 | } else { |
2864 | pluginManager->AddHandler("AliReconstructor", detName, |
2865 | recName, detName, recName + "()"); |
c757bafd |
2866 | } |
b8cd5251 |
2867 | pluginHandler = pluginManager->FindHandler("AliReconstructor", detName); |
2868 | } |
2869 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { |
2870 | reconstructor = (AliReconstructor*) pluginHandler->ExecPlugin(0); |
c757bafd |
2871 | } |
b8cd5251 |
2872 | if (reconstructor) { |
2873 | TObject* obj = fOptions.FindObject(detName.Data()); |
2874 | if (obj) reconstructor->SetOption(obj->GetTitle()); |
1e500f25 |
2875 | reconstructor->SetRunInfo(fRunInfo); |
d76c31f4 |
2876 | reconstructor->Init(); |
b8cd5251 |
2877 | fReconstructor[iDet] = reconstructor; |
2878 | } |
2879 | |
f08fc9f5 |
2880 | // get or create the loader |
2881 | if (detName != "HLT") { |
2882 | fLoader[iDet] = fRunLoader->GetLoader(detName + "Loader"); |
2883 | if (!fLoader[iDet]) { |
2884 | AliConfig::Instance() |
2885 | ->CreateDetectorFolders(fRunLoader->GetEventFolder(), |
2886 | detName, detName); |
2887 | // first check if a plugin is defined for the loader |
bb0901a4 |
2888 | pluginHandler = |
f08fc9f5 |
2889 | pluginManager->FindHandler("AliLoader", detName); |
2890 | // if not, add a plugin for it |
2891 | if (!pluginHandler) { |
2892 | TString loaderName = "Ali" + detName + "Loader"; |
2893 | AliDebug(1, Form("defining plugin for %s", loaderName.Data())); |
2894 | pluginManager->AddHandler("AliLoader", detName, |
2895 | loaderName, detName + "base", |
2896 | loaderName + "(const char*, TFolder*)"); |
2897 | pluginHandler = pluginManager->FindHandler("AliLoader", detName); |
2898 | } |
2899 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { |
2900 | fLoader[iDet] = |
2901 | (AliLoader*) pluginHandler->ExecPlugin(2, detName.Data(), |
2902 | fRunLoader->GetEventFolder()); |
2903 | } |
2904 | if (!fLoader[iDet]) { // use default loader |
2905 | fLoader[iDet] = new AliLoader(detName, fRunLoader->GetEventFolder()); |
2906 | } |
2907 | if (!fLoader[iDet]) { |
2908 | AliWarning(Form("couldn't get loader for %s", detName.Data())); |
6667b602 |
2909 | if (fStopOnError) return NULL; |
f08fc9f5 |
2910 | } else { |
2911 | fRunLoader->AddLoader(fLoader[iDet]); |
2912 | fRunLoader->CdGAFile(); |
2913 | if (gFile && !gFile->IsWritable()) gFile->ReOpen("UPDATE"); |
2914 | fRunLoader->Write(0, TObject::kOverwrite); |
2915 | } |
2916 | } |
2917 | } |
2918 | |
7e88424f |
2919 | if (fRecoParam.GetDetRecoParamArray(iDet) && !AliReconstructor::GetRecoParam(iDet)) { |
2920 | const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet); |
2921 | reconstructor->SetRecoParam(par); |
42ec5d3d |
2922 | reconstructor->SetRunInfo(fRunInfo); |
7e88424f |
2923 | } |
b8cd5251 |
2924 | return reconstructor; |
c757bafd |
2925 | } |
2926 | |
2257f27e |
2927 | //_____________________________________________________________________________ |
92bffc4d |
2928 | AliVertexer* AliReconstruction::CreateVertexer() |
2257f27e |
2929 | { |
2930 | // create the vertexer |
92bffc4d |
2931 | // Please note that the caller is the owner of the |
2932 | // vertexer |
2257f27e |
2933 | |
92bffc4d |
2934 | AliVertexer* vertexer = NULL; |
b8cd5251 |
2935 | AliReconstructor* itsReconstructor = GetReconstructor(0); |
5ec10f5d |
2936 | if (itsReconstructor && ((fRunLocalReconstruction.Contains("ITS")) || fRunTracking.Contains("ITS"))) { |
92bffc4d |
2937 | vertexer = itsReconstructor->CreateVertexer(); |
2257f27e |
2938 | } |
92bffc4d |
2939 | if (!vertexer) { |
815c2b38 |
2940 | AliWarning("couldn't create a vertexer for ITS"); |
2257f27e |
2941 | } |
2942 | |
92bffc4d |
2943 | return vertexer; |
|