]>
Commit | Line | Data |
---|---|---|
1 | /************************************************************************** | |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // 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. // | |
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 | // // | |
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 | // // | |
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 | // // | |
59 | // The name of the galice file can be changed from the default // | |
60 | // "galice.root" by passing it as argument to the AliReconstruction // | |
61 | // constructor or by // | |
62 | // // | |
63 | // rec.SetGAliceFile("..."); // | |
64 | // // | |
65 | // The local reconstruction can be switched on or off for individual // | |
66 | // detectors by // | |
67 | // // | |
68 | // rec.SetRunLocalReconstruction("..."); // | |
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 | // // | |
74 | // The reconstruction of the primary vertex position can be switched off by // | |
75 | // // | |
76 | // rec.SetRunVertexFinder(kFALSE); // | |
77 | // // | |
78 | // The tracking and the creation of ESD tracks can be switched on for // | |
79 | // selected detectors by // | |
80 | // // | |
81 | // rec.SetRunTracking("..."); // | |
82 | // // | |
83 | // Uniform/nonuniform field tracking switches (default: uniform field) // | |
84 | // // | |
85 | // rec.SetUniformFieldTracking(); ( rec.SetUniformFieldTracking(kFALSE); ) // | |
86 | // // | |
87 | // The filling of additional ESD information can be steered by // | |
88 | // // | |
89 | // rec.SetFillESD("..."); // | |
90 | // // | |
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. // | |
100 | // // | |
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. // | |
103 | // // | |
104 | // The input data of a detector can be replaced by the corresponding HLT // | |
105 | // data by calling (usual detector string) // | |
106 | // SetUseHLTData("..."); // | |
107 | // // | |
108 | // For debug purposes the method SetCheckPointLevel can be used. If the // | |
109 | // argument is greater than 0, files with ESD events will be written after // | |
110 | // selected steps of the reconstruction for each event: // | |
111 | // level 1: after tracking and after filling of ESD (final) // | |
112 | // level 2: in addition after each tracking step // | |
113 | // level 3: in addition after the filling of ESD for each detector // | |
114 | // If a final check point file exists for an event, this event will be // | |
115 | // skipped in the reconstruction. The tracking and the filling of ESD for // | |
116 | // a detector will be skipped as well, if the corresponding check point // | |
117 | // file exists. The ESD event will then be loaded from the file instead. // | |
118 | // // | |
119 | /////////////////////////////////////////////////////////////////////////////// | |
120 | ||
121 | #include <TArrayF.h> | |
122 | #include <TFile.h> | |
123 | #include <TList.h> | |
124 | #include <TSystem.h> | |
125 | #include <TROOT.h> | |
126 | #include <TPluginManager.h> | |
127 | #include <TGeoManager.h> | |
128 | #include <TLorentzVector.h> | |
129 | #include <TArrayS.h> | |
130 | #include <TArrayD.h> | |
131 | #include <TObjArray.h> | |
132 | ||
133 | #include "AliReconstruction.h" | |
134 | #include "AliCodeTimer.h" | |
135 | #include "AliReconstructor.h" | |
136 | #include "AliLog.h" | |
137 | #include "AliRunLoader.h" | |
138 | #include "AliRun.h" | |
139 | #include "AliRawReaderFile.h" | |
140 | #include "AliRawReaderDate.h" | |
141 | #include "AliRawReaderRoot.h" | |
142 | #include "AliRawEventHeaderBase.h" | |
143 | #include "AliESDEvent.h" | |
144 | #include "AliESDMuonTrack.h" | |
145 | #include "AliESDfriend.h" | |
146 | #include "AliESDVertex.h" | |
147 | #include "AliESDcascade.h" | |
148 | #include "AliESDkink.h" | |
149 | #include "AliESDtrack.h" | |
150 | #include "AliESDCaloCluster.h" | |
151 | #include "AliESDCaloCells.h" | |
152 | #include "AliMultiplicity.h" | |
153 | #include "AliTracker.h" | |
154 | #include "AliVertexer.h" | |
155 | #include "AliVertexerTracks.h" | |
156 | #include "AliV0vertexer.h" | |
157 | #include "AliCascadeVertexer.h" | |
158 | #include "AliHeader.h" | |
159 | #include "AliGenEventHeader.h" | |
160 | #include "AliPID.h" | |
161 | #include "AliESDpid.h" | |
162 | #include "AliESDtrack.h" | |
163 | #include "AliESDPmdTrack.h" | |
164 | ||
165 | #include "AliESDTagCreator.h" | |
166 | #include "AliAODTagCreator.h" | |
167 | ||
168 | #include "AliGeomManager.h" | |
169 | #include "AliTrackPointArray.h" | |
170 | #include "AliCDBManager.h" | |
171 | #include "AliCDBStorage.h" | |
172 | #include "AliCDBEntry.h" | |
173 | #include "AliAlignObj.h" | |
174 | ||
175 | #include "AliCentralTrigger.h" | |
176 | #include "AliTriggerConfiguration.h" | |
177 | #include "AliTriggerClass.h" | |
178 | #include "AliCTPRawStream.h" | |
179 | ||
180 | #include "AliQADataMakerRec.h" | |
181 | #include "AliGlobalQADataMaker.h" | |
182 | #include "AliQA.h" | |
183 | #include "AliQADataMakerSteer.h" | |
184 | ||
185 | #include "AliPlaneEff.h" | |
186 | ||
187 | #include "AliSysInfo.h" // memory snapshots | |
188 | #include "AliRawHLTManager.h" | |
189 | ||
190 | ||
191 | ClassImp(AliReconstruction) | |
192 | ||
193 | ||
194 | //_____________________________________________________________________________ | |
195 | const char* AliReconstruction::fgkDetectorName[AliReconstruction::fgkNDetectors] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "ACORDE", "HLT"}; | |
196 | ||
197 | //_____________________________________________________________________________ | |
198 | AliReconstruction::AliReconstruction(const char* gAliceFilename, | |
199 | const char* name, const char* title) : | |
200 | TNamed(name, title), | |
201 | ||
202 | fUniformField(kTRUE), | |
203 | fRunVertexFinder(kTRUE), | |
204 | fRunVertexFinderTracks(kTRUE), | |
205 | fRunHLTTracking(kFALSE), | |
206 | fRunMuonTracking(kFALSE), | |
207 | fRunV0Finder(kTRUE), | |
208 | fRunCascadeFinder(kTRUE), | |
209 | fStopOnError(kFALSE), | |
210 | fWriteAlignmentData(kFALSE), | |
211 | fWriteESDfriend(kFALSE), | |
212 | fWriteAOD(kFALSE), | |
213 | fFillTriggerESD(kTRUE), | |
214 | ||
215 | fCleanESD(kTRUE), | |
216 | fV0DCAmax(3.), | |
217 | fV0CsPmin(0.), | |
218 | fDmax(50.), | |
219 | fZmax(50.), | |
220 | ||
221 | fRunLocalReconstruction("ALL"), | |
222 | fRunTracking("ALL"), | |
223 | fFillESD("ALL"), | |
224 | fUseTrackingErrorsForAlignment(""), | |
225 | fGAliceFileName(gAliceFilename), | |
226 | fInput(""), | |
227 | fEquipIdMap(""), | |
228 | fFirstEvent(0), | |
229 | fLastEvent(-1), | |
230 | fNumberOfEventsPerFile(1), | |
231 | fCheckPointLevel(0), | |
232 | fOptions(), | |
233 | fLoadAlignFromCDB(kTRUE), | |
234 | fLoadAlignData("ALL"), | |
235 | fESDPar(""), | |
236 | fUseHLTData(), | |
237 | ||
238 | fRunLoader(NULL), | |
239 | fRawReader(NULL), | |
240 | fParentRawReader(NULL), | |
241 | ||
242 | fVertexer(NULL), | |
243 | fDiamondProfile(NULL), | |
244 | fDiamondProfileTPC(NULL), | |
245 | fMeanVertexConstraint(kTRUE), | |
246 | ||
247 | fGRPData(NULL), | |
248 | ||
249 | fAlignObjArray(NULL), | |
250 | fCDBUri(), | |
251 | fSpecCDBUri(), | |
252 | fInitCDBCalled(kFALSE), | |
253 | fSetRunNumberFromDataCalled(kFALSE), | |
254 | fRunQA(kTRUE), | |
255 | fRunGlobalQA(kTRUE), | |
256 | fInLoopQA(kFALSE), | |
257 | fSameQACycle(kFALSE), | |
258 | ||
259 | fRunPlaneEff(kFALSE), | |
260 | ||
261 | fesd(NULL), | |
262 | fhltesd(NULL), | |
263 | fesdf(NULL), | |
264 | ffile(NULL), | |
265 | ftree(NULL), | |
266 | fhlttree(NULL), | |
267 | ffileOld(NULL), | |
268 | ftreeOld(NULL), | |
269 | fhlttreeOld(NULL), | |
270 | ftVertexer(NULL), | |
271 | fIsNewRunLoader(kFALSE) | |
272 | { | |
273 | // create reconstruction object with default parameters | |
274 | ||
275 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
276 | fReconstructor[iDet] = NULL; | |
277 | fLoader[iDet] = NULL; | |
278 | fTracker[iDet] = NULL; | |
279 | fQADataMaker[iDet] = NULL; | |
280 | fQACycles[iDet] = 999999; | |
281 | } | |
282 | fQADataMaker[fgkNDetectors]=NULL; //Global QA | |
283 | AliPID pid; | |
284 | } | |
285 | ||
286 | //_____________________________________________________________________________ | |
287 | AliReconstruction::AliReconstruction(const AliReconstruction& rec) : | |
288 | TNamed(rec), | |
289 | ||
290 | fUniformField(rec.fUniformField), | |
291 | fRunVertexFinder(rec.fRunVertexFinder), | |
292 | fRunVertexFinderTracks(rec.fRunVertexFinderTracks), | |
293 | fRunHLTTracking(rec.fRunHLTTracking), | |
294 | fRunMuonTracking(rec.fRunMuonTracking), | |
295 | fRunV0Finder(rec.fRunV0Finder), | |
296 | fRunCascadeFinder(rec.fRunCascadeFinder), | |
297 | fStopOnError(rec.fStopOnError), | |
298 | fWriteAlignmentData(rec.fWriteAlignmentData), | |
299 | fWriteESDfriend(rec.fWriteESDfriend), | |
300 | fWriteAOD(rec.fWriteAOD), | |
301 | fFillTriggerESD(rec.fFillTriggerESD), | |
302 | ||
303 | fCleanESD(rec.fCleanESD), | |
304 | fV0DCAmax(rec.fV0DCAmax), | |
305 | fV0CsPmin(rec.fV0CsPmin), | |
306 | fDmax(rec.fDmax), | |
307 | fZmax(rec.fZmax), | |
308 | ||
309 | fRunLocalReconstruction(rec.fRunLocalReconstruction), | |
310 | fRunTracking(rec.fRunTracking), | |
311 | fFillESD(rec.fFillESD), | |
312 | fUseTrackingErrorsForAlignment(rec.fUseTrackingErrorsForAlignment), | |
313 | fGAliceFileName(rec.fGAliceFileName), | |
314 | fInput(rec.fInput), | |
315 | fEquipIdMap(rec.fEquipIdMap), | |
316 | fFirstEvent(rec.fFirstEvent), | |
317 | fLastEvent(rec.fLastEvent), | |
318 | fNumberOfEventsPerFile(rec.fNumberOfEventsPerFile), | |
319 | fCheckPointLevel(0), | |
320 | fOptions(), | |
321 | fLoadAlignFromCDB(rec.fLoadAlignFromCDB), | |
322 | fLoadAlignData(rec.fLoadAlignData), | |
323 | fESDPar(rec.fESDPar), | |
324 | fUseHLTData(rec.fUseHLTData), | |
325 | ||
326 | fRunLoader(NULL), | |
327 | fRawReader(NULL), | |
328 | fParentRawReader(NULL), | |
329 | ||
330 | fVertexer(NULL), | |
331 | fDiamondProfile(NULL), | |
332 | fDiamondProfileTPC(NULL), | |
333 | fMeanVertexConstraint(rec.fMeanVertexConstraint), | |
334 | ||
335 | fGRPData(NULL), | |
336 | ||
337 | fAlignObjArray(rec.fAlignObjArray), | |
338 | fCDBUri(rec.fCDBUri), | |
339 | fSpecCDBUri(), | |
340 | fInitCDBCalled(rec.fInitCDBCalled), | |
341 | fSetRunNumberFromDataCalled(rec.fSetRunNumberFromDataCalled), | |
342 | fRunQA(rec.fRunQA), | |
343 | fRunGlobalQA(rec.fRunGlobalQA), | |
344 | fInLoopQA(rec.fInLoopQA), | |
345 | fSameQACycle(rec.fSameQACycle), | |
346 | fRunPlaneEff(rec.fRunPlaneEff), | |
347 | ||
348 | fesd(NULL), | |
349 | fhltesd(NULL), | |
350 | fesdf(NULL), | |
351 | ffile(NULL), | |
352 | ftree(NULL), | |
353 | fhlttree(NULL), | |
354 | ffileOld(NULL), | |
355 | ftreeOld(NULL), | |
356 | fhlttreeOld(NULL), | |
357 | ftVertexer(NULL), | |
358 | fIsNewRunLoader(rec.fIsNewRunLoader) | |
359 | { | |
360 | // copy constructor | |
361 | ||
362 | for (Int_t i = 0; i < rec.fOptions.GetEntriesFast(); i++) { | |
363 | if (rec.fOptions[i]) fOptions.Add(rec.fOptions[i]->Clone()); | |
364 | } | |
365 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
366 | fReconstructor[iDet] = NULL; | |
367 | fLoader[iDet] = NULL; | |
368 | fTracker[iDet] = NULL; | |
369 | fQADataMaker[iDet] = NULL; | |
370 | fQACycles[iDet] = rec.fQACycles[iDet]; | |
371 | } | |
372 | fQADataMaker[fgkNDetectors]=NULL; //Global QA | |
373 | for (Int_t i = 0; i < rec.fSpecCDBUri.GetEntriesFast(); i++) { | |
374 | if (rec.fSpecCDBUri[i]) fSpecCDBUri.Add(rec.fSpecCDBUri[i]->Clone()); | |
375 | } | |
376 | } | |
377 | ||
378 | //_____________________________________________________________________________ | |
379 | AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) | |
380 | { | |
381 | // assignment operator | |
382 | ||
383 | this->~AliReconstruction(); | |
384 | new(this) AliReconstruction(rec); | |
385 | return *this; | |
386 | } | |
387 | ||
388 | //_____________________________________________________________________________ | |
389 | AliReconstruction::~AliReconstruction() | |
390 | { | |
391 | // clean up | |
392 | ||
393 | CleanUp(); | |
394 | fOptions.Delete(); | |
395 | fSpecCDBUri.Delete(); | |
396 | ||
397 | AliCodeTimer::Instance()->Print(); | |
398 | } | |
399 | ||
400 | //_____________________________________________________________________________ | |
401 | void AliReconstruction::InitCDB() | |
402 | { | |
403 | // activate a default CDB storage | |
404 | // First check if we have any CDB storage set, because it is used | |
405 | // to retrieve the calibration and alignment constants | |
406 | ||
407 | if (fInitCDBCalled) return; | |
408 | fInitCDBCalled = kTRUE; | |
409 | ||
410 | AliCDBManager* man = AliCDBManager::Instance(); | |
411 | if (man->IsDefaultStorageSet()) | |
412 | { | |
413 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
414 | AliWarning("Default CDB storage has been already set !"); | |
415 | AliWarning(Form("Ignoring the default storage declared in AliReconstruction: %s",fCDBUri.Data())); | |
416 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
417 | fCDBUri = man->GetDefaultStorage()->GetURI(); | |
418 | } | |
419 | else { | |
420 | if (fCDBUri.Length() > 0) | |
421 | { | |
422 | AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
423 | AliDebug(2, Form("Default CDB storage is set to: %s", fCDBUri.Data())); | |
424 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
425 | } else { | |
426 | fCDBUri="local://$ALICE_ROOT"; | |
427 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
428 | AliWarning("Default CDB storage not yet set !!!!"); | |
429 | AliWarning(Form("Setting it now to: %s", fCDBUri.Data())); | |
430 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
431 | ||
432 | } | |
433 | man->SetDefaultStorage(fCDBUri); | |
434 | } | |
435 | ||
436 | // Now activate the detector specific CDB storage locations | |
437 | for (Int_t i = 0; i < fSpecCDBUri.GetEntriesFast(); i++) { | |
438 | TObject* obj = fSpecCDBUri[i]; | |
439 | if (!obj) continue; | |
440 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
441 | AliDebug(2, Form("Specific CDB storage for %s is set to: %s",obj->GetName(),obj->GetTitle())); | |
442 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
443 | man->SetSpecificStorage(obj->GetName(), obj->GetTitle()); | |
444 | } | |
445 | ||
446 | } | |
447 | ||
448 | //_____________________________________________________________________________ | |
449 | void AliReconstruction::SetDefaultStorage(const char* uri) { | |
450 | // Store the desired default CDB storage location | |
451 | // Activate it later within the Run() method | |
452 | ||
453 | fCDBUri = uri; | |
454 | ||
455 | } | |
456 | ||
457 | //_____________________________________________________________________________ | |
458 | void AliReconstruction::SetSpecificStorage(const char* calibType, const char* uri) { | |
459 | // Store a detector-specific CDB storage location | |
460 | // Activate it later within the Run() method | |
461 | ||
462 | AliCDBPath aPath(calibType); | |
463 | if(!aPath.IsValid()){ | |
464 | // if calibType is not wildcard but it is a valid detector, add "/*" to make it a valid path | |
465 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
466 | if(!strcmp(calibType, fgkDetectorName[iDet])) { | |
467 | aPath.SetPath(Form("%s/*", calibType)); | |
468 | AliInfo(Form("Path for specific storage set to %s", aPath.GetPath().Data())); | |
469 | break; | |
470 | } | |
471 | } | |
472 | if(!aPath.IsValid()){ | |
473 | AliError(Form("Not a valid path or detector: %s", calibType)); | |
474 | return; | |
475 | } | |
476 | } | |
477 | ||
478 | // // check that calibType refers to a "valid" detector name | |
479 | // Bool_t isDetector = kFALSE; | |
480 | // for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
481 | // TString detName = fgkDetectorName[iDet]; | |
482 | // if(aPath.GetLevel0() == detName) { | |
483 | // isDetector = kTRUE; | |
484 | // break; | |
485 | // } | |
486 | // } | |
487 | // | |
488 | // if(!isDetector) { | |
489 | // AliError(Form("Not a valid detector: %s", aPath.GetLevel0().Data())); | |
490 | // return; | |
491 | // } | |
492 | ||
493 | TObject* obj = fSpecCDBUri.FindObject(aPath.GetPath().Data()); | |
494 | if (obj) fSpecCDBUri.Remove(obj); | |
495 | fSpecCDBUri.Add(new TNamed(aPath.GetPath().Data(), uri)); | |
496 | ||
497 | } | |
498 | ||
499 | //_____________________________________________________________________________ | |
500 | Bool_t AliReconstruction::SetRunNumberFromData() | |
501 | { | |
502 | // The method is called in Run() in order | |
503 | // to set a correct run number. | |
504 | // In case of raw data reconstruction the | |
505 | // run number is taken from the raw data header | |
506 | ||
507 | if (fSetRunNumberFromDataCalled) return kTRUE; | |
508 | fSetRunNumberFromDataCalled = kTRUE; | |
509 | ||
510 | AliCDBManager* man = AliCDBManager::Instance(); | |
511 | ||
512 | if(man->GetRun() > 0) { | |
513 | AliWarning("Run number is taken from raw-event header! Ignoring settings in AliCDBManager!"); | |
514 | } | |
515 | ||
516 | if (!fRunLoader) { | |
517 | AliError("No run loader is found !"); | |
518 | return kFALSE; | |
519 | } | |
520 | // read run number from gAlice | |
521 | if(fRunLoader->GetAliRun()) | |
522 | AliCDBManager::Instance()->SetRun(fRunLoader->GetHeader()->GetRun()); | |
523 | else { | |
524 | if(fRawReader) { | |
525 | if(fRawReader->NextEvent()) { | |
526 | AliCDBManager::Instance()->SetRun(fRawReader->GetRunNumber()); | |
527 | fRawReader->RewindEvents(); | |
528 | } | |
529 | else { | |
530 | if(man->GetRun() > 0) { | |
531 | AliWarning("No raw events is found ! Using settings in AliCDBManager !"); | |
532 | man->Print(); | |
533 | return kTRUE; | |
534 | } | |
535 | else { | |
536 | AliWarning("Neither raw events nor settings in AliCDBManager are found !"); | |
537 | return kFALSE; | |
538 | } | |
539 | } | |
540 | } | |
541 | else { | |
542 | AliError("Neither gAlice nor RawReader objects are found !"); | |
543 | return kFALSE; | |
544 | } | |
545 | } | |
546 | ||
547 | man->Print(); | |
548 | ||
549 | return kTRUE; | |
550 | } | |
551 | ||
552 | //_____________________________________________________________________________ | |
553 | void AliReconstruction::SetCDBLock() { | |
554 | // Set CDB lock: from now on it is forbidden to reset the run number | |
555 | // or the default storage or to activate any further storage! | |
556 | ||
557 | AliCDBManager::Instance()->SetLock(1); | |
558 | } | |
559 | ||
560 | //_____________________________________________________________________________ | |
561 | Bool_t AliReconstruction::MisalignGeometry(const TString& detectors) | |
562 | { | |
563 | // Read the alignment objects from CDB. | |
564 | // Each detector is supposed to have the | |
565 | // alignment objects in DET/Align/Data CDB path. | |
566 | // All the detector objects are then collected, | |
567 | // sorted by geometry level (starting from ALIC) and | |
568 | // then applied to the TGeo geometry. | |
569 | // Finally an overlaps check is performed. | |
570 | ||
571 | // Load alignment data from CDB and fill fAlignObjArray | |
572 | if(fLoadAlignFromCDB){ | |
573 | ||
574 | TString detStr = detectors; | |
575 | TString loadAlObjsListOfDets = ""; | |
576 | ||
577 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
578 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; | |
579 | loadAlObjsListOfDets += fgkDetectorName[iDet]; | |
580 | loadAlObjsListOfDets += " "; | |
581 | } // end loop over detectors | |
582 | loadAlObjsListOfDets.Prepend("GRP "); //add alignment objects for non-sensitive modules | |
583 | AliGeomManager::ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data()); | |
584 | }else{ | |
585 | // Check if the array with alignment objects was | |
586 | // provided by the user. If yes, apply the objects | |
587 | // to the present TGeo geometry | |
588 | if (fAlignObjArray) { | |
589 | if (gGeoManager && gGeoManager->IsClosed()) { | |
590 | if (AliGeomManager::ApplyAlignObjsToGeom(*fAlignObjArray) == kFALSE) { | |
591 | AliError("The misalignment of one or more volumes failed!" | |
592 | "Compare the list of simulated detectors and the list of detector alignment data!"); | |
593 | return kFALSE; | |
594 | } | |
595 | } | |
596 | else { | |
597 | AliError("Can't apply the misalignment! gGeoManager doesn't exist or it is still opened!"); | |
598 | return kFALSE; | |
599 | } | |
600 | } | |
601 | } | |
602 | ||
603 | delete fAlignObjArray; fAlignObjArray=0; | |
604 | ||
605 | return kTRUE; | |
606 | } | |
607 | ||
608 | //_____________________________________________________________________________ | |
609 | void AliReconstruction::SetGAliceFile(const char* fileName) | |
610 | { | |
611 | // set the name of the galice file | |
612 | ||
613 | fGAliceFileName = fileName; | |
614 | } | |
615 | ||
616 | //_____________________________________________________________________________ | |
617 | void AliReconstruction::SetInput(const char* input) | |
618 | { | |
619 | // In case the input string starts with 'mem://', we run in an online mode | |
620 | // and AliRawReaderDateOnline object is created. In all other cases a raw-data | |
621 | // file is assumed. One can give as an input: | |
622 | // mem://: - events taken from DAQ monitoring libs online | |
623 | // or | |
624 | // mem://<filename> - emulation of the above mode (via DATE monitoring libs) | |
625 | fInput = input; | |
626 | } | |
627 | ||
628 | //_____________________________________________________________________________ | |
629 | void AliReconstruction::SetOption(const char* detector, const char* option) | |
630 | { | |
631 | // set options for the reconstruction of a detector | |
632 | ||
633 | TObject* obj = fOptions.FindObject(detector); | |
634 | if (obj) fOptions.Remove(obj); | |
635 | fOptions.Add(new TNamed(detector, option)); | |
636 | } | |
637 | ||
638 | //_____________________________________________________________________________ | |
639 | Bool_t AliReconstruction::Run(const char* input) | |
640 | { | |
641 | // Run Run Run | |
642 | AliCodeTimerAuto(""); | |
643 | ||
644 | if (!InitRun(input)) return kFALSE; | |
645 | ||
646 | Bool_t runAliEVE = kFALSE; | |
647 | if (strcmp(gProgName,"alieve") == 0) runAliEVE = kTRUE; | |
648 | ||
649 | if (runAliEVE) { | |
650 | TString macroStr; | |
651 | macroStr.Form("%s/EVE/macros/alieve_online.C",gSystem->ExpandPathName("$ALICE_ROOT")); | |
652 | AliInfo(Form("Loading AliEVE macro: %s",macroStr.Data())); | |
653 | if (gROOT->LoadMacro(macroStr.Data()) != 0) | |
654 | runAliEVE = kFALSE; | |
655 | else | |
656 | gROOT->ProcessLine("if (!gAliEveEvent) {gAliEveEvent = new AliEveEventManager();gAliEveEvent->SetAutoLoad(kTRUE);gAliEveEvent->AddNewEventCommand(\"alieve_online()\");gEve->AddEvent(gAliEveEvent);};"); | |
657 | } | |
658 | ||
659 | //******* The loop over events | |
660 | Int_t iEvent = 0; | |
661 | while ((iEvent < fRunLoader->GetNumberOfEvents()) || | |
662 | (fRawReader && fRawReader->NextEvent())) { | |
663 | if (!RunEvent(iEvent)) return kFALSE; | |
664 | iEvent++; | |
665 | ||
666 | if (runAliEVE) { | |
667 | AliInfo("Running AliEVE..."); | |
668 | gROOT->ProcessLine(Form("gAliEveEvent->SetEvent((AliRunLoader*)%p,(AliRawReader*)%p,(AliESDEvent*)%p);",fRunLoader,fRawReader,fesd)); | |
669 | gROOT->ProcessLine("gAliEveEvent->StartStopAutoLoadTimer();"); | |
670 | gSystem->Run(); | |
671 | } | |
672 | } | |
673 | ||
674 | if (!FinishRun()) return kFALSE; | |
675 | ||
676 | return kTRUE; | |
677 | } | |
678 | ||
679 | //_____________________________________________________________________________ | |
680 | Bool_t AliReconstruction::InitRun(const char* input) | |
681 | { | |
682 | // Initialize all the stuff before | |
683 | // going into the event loop | |
684 | // If the second argument is given, the first one is ignored and | |
685 | // the reconstruction works in an online mode | |
686 | AliCodeTimerAuto(""); | |
687 | ||
688 | // Overwrite the previous setting | |
689 | if (input) fInput = input; | |
690 | ||
691 | // set the input in case of raw data | |
692 | fRawReader = AliRawReader::Create(fInput.Data()); | |
693 | if (!fRawReader) | |
694 | AliInfo("Reconstruction will run over digits"); | |
695 | ||
696 | if (!fEquipIdMap.IsNull() && fRawReader) | |
697 | fRawReader->LoadEquipmentIdsMap(fEquipIdMap); | |
698 | ||
699 | if (!fUseHLTData.IsNull()) { | |
700 | // create the RawReaderHLT which performs redirection of HLT input data for | |
701 | // the specified detectors | |
702 | AliRawReader* pRawReader=AliRawHLTManager::CreateRawReaderHLT(fRawReader, fUseHLTData.Data()); | |
703 | if (pRawReader) { | |
704 | fParentRawReader=fRawReader; | |
705 | fRawReader=pRawReader; | |
706 | } else { | |
707 | AliError(Form("can not create Raw Reader for HLT input %s", fUseHLTData.Data())); | |
708 | } | |
709 | } | |
710 | ||
711 | AliSysInfo::AddStamp("Start"); | |
712 | // get the run loader | |
713 | if (!InitRunLoader()) return kFALSE; | |
714 | AliSysInfo::AddStamp("LoadLoader"); | |
715 | ||
716 | // Initialize the CDB storage | |
717 | InitCDB(); | |
718 | ||
719 | AliSysInfo::AddStamp("LoadCDB"); | |
720 | ||
721 | // Set run number in CDBManager (if it is not already set by the user) | |
722 | if (!SetRunNumberFromData()) if (fStopOnError) return kFALSE; | |
723 | ||
724 | // Set CDB lock: from now on it is forbidden to reset the run number | |
725 | // or the default storage or to activate any further storage! | |
726 | SetCDBLock(); | |
727 | ||
728 | // Import ideal TGeo geometry and apply misalignment | |
729 | if (!gGeoManager) { | |
730 | TString geom(gSystem->DirName(fGAliceFileName)); | |
731 | geom += "/geometry.root"; | |
732 | AliGeomManager::LoadGeometry(geom.Data()); | |
733 | if (!gGeoManager) if (fStopOnError) return kFALSE; | |
734 | } | |
735 | ||
736 | if (!MisalignGeometry(fLoadAlignData)) if (fStopOnError) return kFALSE; | |
737 | AliSysInfo::AddStamp("LoadGeom"); | |
738 | ||
739 | //QA | |
740 | AliQADataMakerSteer qas ; | |
741 | if (fRunQA && fRawReader) { | |
742 | qas.Run(fRunLocalReconstruction, fRawReader) ; | |
743 | fSameQACycle = kTRUE ; | |
744 | } | |
745 | // checking the QA of previous steps | |
746 | //CheckQA() ; | |
747 | ||
748 | /* | |
749 | // local reconstruction | |
750 | if (!fRunLocalReconstruction.IsNull()) { | |
751 | if (!RunLocalReconstruction(fRunLocalReconstruction)) { | |
752 | if (fStopOnError) {CleanUp(); return kFALSE;} | |
753 | } | |
754 | } | |
755 | */ | |
756 | ||
757 | // get vertexer | |
758 | if (fRunVertexFinder && !CreateVertexer()) { | |
759 | if (fStopOnError) { | |
760 | CleanUp(); | |
761 | return kFALSE; | |
762 | } | |
763 | } | |
764 | AliSysInfo::AddStamp("Vertexer"); | |
765 | ||
766 | // get trackers | |
767 | if (!fRunTracking.IsNull() && !CreateTrackers(fRunTracking)) { | |
768 | if (fStopOnError) { | |
769 | CleanUp(); | |
770 | return kFALSE; | |
771 | } | |
772 | } | |
773 | AliSysInfo::AddStamp("LoadTrackers"); | |
774 | ||
775 | // get the possibly already existing ESD file and tree | |
776 | fesd = new AliESDEvent(); fhltesd = new AliESDEvent(); | |
777 | if (!gSystem->AccessPathName("AliESDs.root")){ | |
778 | gSystem->CopyFile("AliESDs.root", "AliESDs.old.root", kTRUE); | |
779 | ffileOld = TFile::Open("AliESDs.old.root"); | |
780 | if (ffileOld && ffileOld->IsOpen()) { | |
781 | ftreeOld = (TTree*) ffileOld->Get("esdTree"); | |
782 | if (ftreeOld)fesd->ReadFromTree(ftreeOld); | |
783 | fhlttreeOld = (TTree*) ffileOld->Get("HLTesdTree"); | |
784 | if (fhlttreeOld) fhltesd->ReadFromTree(fhlttreeOld); | |
785 | } | |
786 | } | |
787 | ||
788 | // create the ESD output file and tree | |
789 | ffile = TFile::Open("AliESDs.root", "RECREATE"); | |
790 | ffile->SetCompressionLevel(2); | |
791 | if (!ffile->IsOpen()) { | |
792 | AliError("opening AliESDs.root failed"); | |
793 | if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;} | |
794 | } | |
795 | ||
796 | ftree = new TTree("esdTree", "Tree with ESD objects"); | |
797 | fesd = new AliESDEvent(); | |
798 | fesd->CreateStdContent(); | |
799 | fesd->WriteToTree(ftree); | |
800 | ||
801 | fhlttree = new TTree("HLTesdTree", "Tree with HLT ESD objects"); | |
802 | fhltesd = new AliESDEvent(); | |
803 | fhltesd->CreateStdContent(); | |
804 | fhltesd->WriteToTree(fhlttree); | |
805 | ||
806 | /* CKB Why? | |
807 | delete esd; delete hltesd; | |
808 | esd = NULL; hltesd = NULL; | |
809 | */ | |
810 | // create the branch with ESD additions | |
811 | ||
812 | ||
813 | ||
814 | if (fWriteESDfriend) { | |
815 | fesdf = new AliESDfriend(); | |
816 | TBranch *br=ftree->Branch("ESDfriend.","AliESDfriend", &fesdf); | |
817 | br->SetFile("AliESDfriends.root"); | |
818 | fesd->AddObject(fesdf); | |
819 | } | |
820 | ||
821 | // Get the GRP CDB entry | |
822 | AliCDBEntry* entryGRP = AliCDBManager::Instance()->Get("GRP/GRP/Data"); | |
823 | ||
824 | if (entryGRP) | |
825 | fGRPData = dynamic_cast<TMap*> (entryGRP->GetObject()); | |
826 | ||
827 | if (!fGRPData) | |
828 | AliError("No GRP entry found in OCDB!"); | |
829 | ||
830 | // Get the diamond profile from OCDB | |
831 | AliCDBEntry* entry = AliCDBManager::Instance() | |
832 | ->Get("GRP/Calib/MeanVertex"); | |
833 | ||
834 | if(entry) { | |
835 | fDiamondProfile = dynamic_cast<AliESDVertex*> (entry->GetObject()); | |
836 | } else { | |
837 | AliError("No diamond profile found in OCDB!"); | |
838 | } | |
839 | ||
840 | entry = 0; | |
841 | entry = AliCDBManager::Instance() | |
842 | ->Get("GRP/Calib/MeanVertexTPC"); | |
843 | ||
844 | if(entry) { | |
845 | fDiamondProfileTPC = dynamic_cast<AliESDVertex*> (entry->GetObject()); | |
846 | } else { | |
847 | AliError("No diamond profile found in OCDB!"); | |
848 | } | |
849 | ||
850 | ftVertexer = new AliVertexerTracks(AliTracker::GetBz()); | |
851 | if(fDiamondProfile && fMeanVertexConstraint) ftVertexer->SetVtxStart(fDiamondProfile); | |
852 | ||
853 | if (fRawReader) fRawReader->RewindEvents(); | |
854 | ||
855 | ProcInfo_t ProcInfo; | |
856 | gSystem->GetProcInfo(&ProcInfo); | |
857 | AliInfo(Form("Current memory usage %d %d", ProcInfo.fMemResident, ProcInfo.fMemVirtual)); | |
858 | ||
859 | ||
860 | //Initialize the QA and start of cycle for out-of-cycle QA | |
861 | if (fRunQA) { | |
862 | TString detStr(fFillESD); | |
863 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
864 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; | |
865 | AliQADataMakerRec *qadm = GetQADataMaker(iDet); | |
866 | if (!qadm) continue; | |
867 | AliInfo(Form("Initializing the QA data maker for %s", | |
868 | fgkDetectorName[iDet])); | |
869 | qadm->Init(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun()); | |
870 | qadm->Init(AliQA::kESDS, AliCDBManager::Instance()->GetRun()); | |
871 | if (!fInLoopQA) { | |
872 | qadm->StartOfCycle(AliQA::kRECPOINTS, fSameQACycle); | |
873 | qadm->StartOfCycle(AliQA::kESDS,"same"); | |
874 | } | |
875 | } | |
876 | if (fRunGlobalQA) { | |
877 | AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL); | |
878 | AliInfo(Form("Initializing the global QA data maker")); | |
879 | TObjArray *arr= | |
880 | qadm->Init(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun()); | |
881 | AliTracker::SetResidualsArray(arr); | |
882 | qadm->Init(AliQA::kESDS, AliCDBManager::Instance()->GetRun()); | |
883 | if (!fInLoopQA) { | |
884 | qadm->StartOfCycle(AliQA::kRECPOINTS, fSameQACycle); | |
885 | qadm->StartOfCycle(AliQA::kESDS, "same"); | |
886 | } | |
887 | } | |
888 | if (!fInLoopQA) | |
889 | fSameQACycle = kTRUE; | |
890 | } | |
891 | ||
892 | //Initialize the Plane Efficiency framework | |
893 | if (fRunPlaneEff && !InitPlaneEff()) { | |
894 | if(fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;} | |
895 | } | |
896 | ||
897 | return kTRUE; | |
898 | } | |
899 | ||
900 | //_____________________________________________________________________________ | |
901 | Bool_t AliReconstruction::RunEvent(Int_t iEvent) | |
902 | { | |
903 | // run the reconstruction over a single event | |
904 | // The event loop is steered in Run method | |
905 | ||
906 | AliCodeTimerAuto(""); | |
907 | ||
908 | if (iEvent >= fRunLoader->GetNumberOfEvents()) { | |
909 | fRunLoader->SetEventNumber(iEvent); | |
910 | fRunLoader->GetHeader()->Reset(fRawReader->GetRunNumber(), | |
911 | iEvent, iEvent); | |
912 | //?? fRunLoader->MakeTree("H"); | |
913 | fRunLoader->TreeE()->Fill(); | |
914 | } | |
915 | ||
916 | if ((iEvent < fFirstEvent) || ((fLastEvent >= 0) && (iEvent > fLastEvent))) { | |
917 | // copy old ESD to the new one | |
918 | if (ftreeOld) { | |
919 | fesd->ReadFromTree(ftreeOld); | |
920 | ftreeOld->GetEntry(iEvent); | |
921 | ftree->Fill(); | |
922 | } | |
923 | if (fhlttreeOld) { | |
924 | fhltesd->ReadFromTree(fhlttreeOld); | |
925 | fhlttreeOld->GetEntry(iEvent); | |
926 | fhlttree->Fill(); | |
927 | } | |
928 | return kTRUE; | |
929 | } | |
930 | ||
931 | AliInfo(Form("processing event %d", iEvent)); | |
932 | ||
933 | //Start of cycle for the in-loop QA | |
934 | if (fInLoopQA) { | |
935 | if (fRunQA) { | |
936 | TString detStr(fFillESD); | |
937 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
938 | if (!IsSelected(fgkDetectorName[iDet], detStr)) | |
939 | continue; | |
940 | AliQADataMakerRec *qadm = GetQADataMaker(iDet); | |
941 | if (!qadm) | |
942 | continue; | |
943 | qadm->StartOfCycle(AliQA::kRECPOINTS, fSameQACycle); | |
944 | qadm->StartOfCycle(AliQA::kESDS, "same") ; | |
945 | } | |
946 | if (fRunGlobalQA) { | |
947 | AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL); | |
948 | qadm->StartOfCycle(AliQA::kRECPOINTS, fSameQACycle); | |
949 | qadm->StartOfCycle(AliQA::kESDS, "same"); | |
950 | } | |
951 | } | |
952 | } | |
953 | ||
954 | fRunLoader->GetEvent(iEvent); | |
955 | ||
956 | char aFileName[256]; | |
957 | sprintf(aFileName, "ESD_%d.%d_final.root", | |
958 | fRunLoader->GetHeader()->GetRun(), | |
959 | fRunLoader->GetHeader()->GetEventNrInRun()); | |
960 | if (!gSystem->AccessPathName(aFileName)) return kTRUE; | |
961 | ||
962 | // local single event reconstruction | |
963 | if (!fRunLocalReconstruction.IsNull()) { | |
964 | TString detectors=fRunLocalReconstruction; | |
965 | // run HLT event reconstruction first | |
966 | // ;-( IsSelected changes the string | |
967 | if (IsSelected("HLT", detectors) && | |
968 | !RunLocalEventReconstruction("HLT")) { | |
969 | if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;} | |
970 | } | |
971 | detectors=fRunLocalReconstruction; | |
972 | detectors.ReplaceAll("HLT", ""); | |
973 | if (!RunLocalEventReconstruction(detectors)) { | |
974 | if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;} | |
975 | } | |
976 | } | |
977 | ||
978 | fesd->SetRunNumber(fRunLoader->GetHeader()->GetRun()); | |
979 | fhltesd->SetRunNumber(fRunLoader->GetHeader()->GetRun()); | |
980 | fesd->SetEventNumberInFile(fRunLoader->GetHeader()->GetEventNrInRun()); | |
981 | fhltesd->SetEventNumberInFile(fRunLoader->GetHeader()->GetEventNrInRun()); | |
982 | ||
983 | // Set magnetic field from the tracker | |
984 | fesd->SetMagneticField(AliTracker::GetBz()); | |
985 | fhltesd->SetMagneticField(AliTracker::GetBz()); | |
986 | ||
987 | ||
988 | ||
989 | // Fill raw-data error log into the ESD | |
990 | if (fRawReader) FillRawDataErrorLog(iEvent,fesd); | |
991 | ||
992 | // vertex finder | |
993 | if (fRunVertexFinder) { | |
994 | if (!ReadESD(fesd, "vertex")) { | |
995 | if (!RunVertexFinder(fesd)) { | |
996 | if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;} | |
997 | } | |
998 | if (fCheckPointLevel > 0) WriteESD(fesd, "vertex"); | |
999 | } | |
1000 | } | |
1001 | ||
1002 | // Muon tracking | |
1003 | if (!fRunTracking.IsNull()) { | |
1004 | if (fRunMuonTracking) { | |
1005 | if (!RunMuonTracking(fesd)) { | |
1006 | if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;} | |
1007 | } | |
1008 | } | |
1009 | } | |
1010 | ||
1011 | // barrel tracking | |
1012 | if (!fRunTracking.IsNull()) { | |
1013 | if (!ReadESD(fesd, "tracking")) { | |
1014 | if (!RunTracking(fesd)) { | |
1015 | if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;} | |
1016 | } | |
1017 | if (fCheckPointLevel > 0) WriteESD(fesd, "tracking"); | |
1018 | } | |
1019 | } | |
1020 | ||
1021 | // fill ESD | |
1022 | if (!fFillESD.IsNull()) { | |
1023 | TString detectors=fFillESD; | |
1024 | // run HLT first and on hltesd | |
1025 | // ;-( IsSelected changes the string | |
1026 | if (IsSelected("HLT", detectors) && | |
1027 | !FillESD(fhltesd, "HLT")) { | |
1028 | if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;} | |
1029 | } | |
1030 | detectors=fFillESD; | |
1031 | detectors.ReplaceAll("HLT", ""); | |
1032 | if (!FillESD(fesd, detectors)) { | |
1033 | if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;} | |
1034 | } | |
1035 | } | |
1036 | ||
1037 | // fill Event header information from the RawEventHeader | |
1038 | if (fRawReader){FillRawEventHeaderESD(fesd);} | |
1039 | ||
1040 | // combined PID | |
1041 | AliESDpid::MakePID(fesd); | |
1042 | if (fCheckPointLevel > 1) WriteESD(fesd, "PID"); | |
1043 | ||
1044 | if (fFillTriggerESD) { | |
1045 | if (!ReadESD(fesd, "trigger")) { | |
1046 | if (!FillTriggerESD(fesd)) { | |
1047 | if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;} | |
1048 | } | |
1049 | if (fCheckPointLevel > 1) WriteESD(fesd, "trigger"); | |
1050 | } | |
1051 | } | |
1052 | ||
1053 | ffile->cd(); | |
1054 | ||
1055 | // | |
1056 | // Propagate track to the beam pipe (if not already done by ITS) | |
1057 | // | |
1058 | const Int_t ntracks = fesd->GetNumberOfTracks(); | |
1059 | const Double_t kBz = fesd->GetMagneticField(); | |
1060 | const Double_t kRadius = 2.8; //something less than the beam pipe radius | |
1061 | ||
1062 | TObjArray trkArray; | |
1063 | UShort_t *selectedIdx=new UShort_t[ntracks]; | |
1064 | ||
1065 | for (Int_t itrack=0; itrack<ntracks; itrack++){ | |
1066 | const Double_t kMaxStep = 5; //max step over the material | |
1067 | Bool_t ok; | |
1068 | ||
1069 | AliESDtrack *track = fesd->GetTrack(itrack); | |
1070 | if (!track) continue; | |
1071 | ||
1072 | AliExternalTrackParam *tpcTrack = | |
1073 | (AliExternalTrackParam *)track->GetTPCInnerParam(); | |
1074 | ok = kFALSE; | |
1075 | if (tpcTrack) | |
1076 | ok = AliTracker:: | |
1077 | PropagateTrackTo(tpcTrack,kRadius,track->GetMass(),kMaxStep,kTRUE); | |
1078 | ||
1079 | ||
1080 | ||
1081 | if (ok) { | |
1082 | Int_t n=trkArray.GetEntriesFast(); | |
1083 | selectedIdx[n]=track->GetID(); | |
1084 | trkArray.AddLast(tpcTrack); | |
1085 | } | |
1086 | ||
1087 | if (track->GetX() < kRadius) continue; | |
1088 | ||
1089 | ok = AliTracker:: | |
1090 | PropagateTrackTo(track,kRadius,track->GetMass(),kMaxStep,kTRUE); | |
1091 | if (ok) { | |
1092 | track->RelateToVertex(fesd->GetPrimaryVertexSPD(), kBz, kRadius); | |
1093 | } | |
1094 | } | |
1095 | ||
1096 | // | |
1097 | // Improve the reconstructed primary vertex position using the tracks | |
1098 | // | |
1099 | TObject *obj = fOptions.FindObject("ITS"); | |
1100 | if (obj) { | |
1101 | TString optITS = obj->GetTitle(); | |
1102 | if (optITS.Contains("cosmics") || optITS.Contains("COSMICS")) | |
1103 | fRunVertexFinderTracks=kFALSE; | |
1104 | } | |
1105 | if (fRunVertexFinderTracks) { | |
1106 | // TPC + ITS primary vertex | |
1107 | ftVertexer->SetITSrefitRequired(); | |
1108 | if(fDiamondProfile && fMeanVertexConstraint) { | |
1109 | ftVertexer->SetVtxStart(fDiamondProfile); | |
1110 | } else { | |
1111 | ftVertexer->SetConstraintOff(); | |
1112 | } | |
1113 | AliESDVertex *pvtx=ftVertexer->FindPrimaryVertex(fesd); | |
1114 | if (pvtx) { | |
1115 | if (pvtx->GetStatus()) { | |
1116 | fesd->SetPrimaryVertex(pvtx); | |
1117 | for (Int_t i=0; i<ntracks; i++) { | |
1118 | AliESDtrack *t = fesd->GetTrack(i); | |
1119 | t->RelateToVertex(pvtx, kBz, kRadius); | |
1120 | } | |
1121 | } | |
1122 | } | |
1123 | ||
1124 | // TPC-only primary vertex | |
1125 | ftVertexer->SetITSrefitNotRequired(); | |
1126 | if(fDiamondProfileTPC && fMeanVertexConstraint) { | |
1127 | ftVertexer->SetVtxStart(fDiamondProfileTPC); | |
1128 | } else { | |
1129 | ftVertexer->SetConstraintOff(); | |
1130 | } | |
1131 | pvtx=ftVertexer->FindPrimaryVertex(&trkArray,selectedIdx); | |
1132 | if (pvtx) { | |
1133 | if (pvtx->GetStatus()) { | |
1134 | fesd->SetPrimaryVertexTPC(pvtx); | |
1135 | Int_t nsel=trkArray.GetEntriesFast(); | |
1136 | for (Int_t i=0; i<nsel; i++) { | |
1137 | AliExternalTrackParam *t = | |
1138 | (AliExternalTrackParam *)trkArray.UncheckedAt(i); | |
1139 | t->PropagateToDCA(pvtx, kBz, kRadius); | |
1140 | } | |
1141 | } | |
1142 | } | |
1143 | ||
1144 | } | |
1145 | delete[] selectedIdx; | |
1146 | ||
1147 | if(fDiamondProfile) fesd->SetDiamond(fDiamondProfile); | |
1148 | ||
1149 | ||
1150 | if (fRunV0Finder) { | |
1151 | // V0 finding | |
1152 | AliV0vertexer vtxer; | |
1153 | vtxer.Tracks2V0vertices(fesd); | |
1154 | ||
1155 | if (fRunCascadeFinder) { | |
1156 | // Cascade finding | |
1157 | AliCascadeVertexer cvtxer; | |
1158 | cvtxer.V0sTracks2CascadeVertices(fesd); | |
1159 | } | |
1160 | } | |
1161 | ||
1162 | // write ESD | |
1163 | if (fCleanESD) CleanESD(fesd); | |
1164 | ||
1165 | if (fRunQA) { | |
1166 | if (fRunGlobalQA) { | |
1167 | AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL); | |
1168 | if (qadm) qadm->Exec(AliQA::kESDS, fesd); | |
1169 | } | |
1170 | } | |
1171 | ||
1172 | if (fWriteESDfriend) { | |
1173 | fesdf->~AliESDfriend(); | |
1174 | new (fesdf) AliESDfriend(); // Reset... | |
1175 | fesd->GetESDfriend(fesdf); | |
1176 | } | |
1177 | ftree->Fill(); | |
1178 | ||
1179 | // write HLT ESD | |
1180 | fhlttree->Fill(); | |
1181 | ||
1182 | if (fCheckPointLevel > 0) WriteESD(fesd, "final"); | |
1183 | fesd->Reset(); | |
1184 | fhltesd->Reset(); | |
1185 | if (fWriteESDfriend) { | |
1186 | fesdf->~AliESDfriend(); | |
1187 | new (fesdf) AliESDfriend(); // Reset... | |
1188 | } | |
1189 | ||
1190 | ProcInfo_t ProcInfo; | |
1191 | gSystem->GetProcInfo(&ProcInfo); | |
1192 | AliInfo(Form("Event %d -> Current memory usage %d %d",iEvent, ProcInfo.fMemResident, ProcInfo.fMemVirtual)); | |
1193 | ||
1194 | ||
1195 | // End of cycle for the in-loop QA | |
1196 | if (fInLoopQA) { | |
1197 | if (fRunQA) { | |
1198 | RunQA(fFillESD.Data(), fesd); | |
1199 | TString detStr(fFillESD); | |
1200 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
1201 | if (!IsSelected(fgkDetectorName[iDet], detStr)) | |
1202 | continue; | |
1203 | AliQADataMakerRec * qadm = GetQADataMaker(iDet); | |
1204 | if (!qadm) | |
1205 | continue; | |
1206 | qadm->EndOfCycle(AliQA::kRECPOINTS); | |
1207 | qadm->EndOfCycle(AliQA::kESDS); | |
1208 | qadm->Finish(); | |
1209 | } | |
1210 | } | |
1211 | if (fRunGlobalQA) { | |
1212 | AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL); | |
1213 | if (qadm) { | |
1214 | qadm->EndOfCycle(AliQA::kRECPOINTS); | |
1215 | qadm->EndOfCycle(AliQA::kESDS); | |
1216 | qadm->Finish(); | |
1217 | } | |
1218 | } | |
1219 | } | |
1220 | ||
1221 | return kTRUE; | |
1222 | } | |
1223 | ||
1224 | //_____________________________________________________________________________ | |
1225 | Bool_t AliReconstruction::FinishRun() | |
1226 | { | |
1227 | // Finalize the run | |
1228 | // Called after the exit | |
1229 | // from the event loop | |
1230 | AliCodeTimerAuto(""); | |
1231 | ||
1232 | if (fIsNewRunLoader) { // galice.root didn't exist | |
1233 | fRunLoader->WriteHeader("OVERWRITE"); | |
1234 | fRunLoader->CdGAFile(); | |
1235 | fRunLoader->Write(0, TObject::kOverwrite); | |
1236 | } | |
1237 | ||
1238 | ftree->GetUserInfo()->Add(fesd); | |
1239 | fhlttree->GetUserInfo()->Add(fhltesd); | |
1240 | ||
1241 | const TMap *cdbMap = AliCDBManager::Instance()->GetStorageMap(); | |
1242 | const TList *cdbList = AliCDBManager::Instance()->GetRetrievedIds(); | |
1243 | ||
1244 | TMap *cdbMapCopy = new TMap(cdbMap->GetEntries()); | |
1245 | cdbMapCopy->SetOwner(1); | |
1246 | cdbMapCopy->SetName("cdbMap"); | |
1247 | TIter iter(cdbMap->GetTable()); | |
1248 | ||
1249 | TPair* pair = 0; | |
1250 | while((pair = dynamic_cast<TPair*> (iter.Next()))){ | |
1251 | TObjString* keyStr = dynamic_cast<TObjString*> (pair->Key()); | |
1252 | TObjString* valStr = dynamic_cast<TObjString*> (pair->Value()); | |
1253 | cdbMapCopy->Add(new TObjString(keyStr->GetName()), new TObjString(valStr->GetName())); | |
1254 | } | |
1255 | ||
1256 | TList *cdbListCopy = new TList(); | |
1257 | cdbListCopy->SetOwner(1); | |
1258 | cdbListCopy->SetName("cdbList"); | |
1259 | ||
1260 | TIter iter2(cdbList); | |
1261 | ||
1262 | AliCDBId* id=0; | |
1263 | while((id = dynamic_cast<AliCDBId*> (iter2.Next()))){ | |
1264 | cdbListCopy->Add(new TObjString(id->ToString().Data())); | |
1265 | } | |
1266 | ||
1267 | ftree->GetUserInfo()->Add(cdbMapCopy); | |
1268 | ftree->GetUserInfo()->Add(cdbListCopy); | |
1269 | ||
1270 | ||
1271 | if(fESDPar.Contains("ESD.par")){ | |
1272 | AliInfo("Attaching ESD.par to Tree"); | |
1273 | TNamed *fn = CopyFileToTNamed(fESDPar.Data(),"ESD.par"); | |
1274 | ftree->GetUserInfo()->Add(fn); | |
1275 | } | |
1276 | ||
1277 | ||
1278 | ffile->cd(); | |
1279 | ||
1280 | if (fWriteESDfriend) | |
1281 | ftree->SetBranchStatus("ESDfriend*",0); | |
1282 | // we want to have only one tree version number | |
1283 | ftree->Write(ftree->GetName(),TObject::kOverwrite); | |
1284 | fhlttree->Write(); | |
1285 | ||
1286 | // Finish with Plane Efficiency evaluation: before of CleanUp !!! | |
1287 | if (fRunPlaneEff && !FinishPlaneEff()) { | |
1288 | AliWarning("Finish PlaneEff evaluation failed"); | |
1289 | } | |
1290 | ||
1291 | gROOT->cd(); | |
1292 | CleanUp(ffile, ffileOld); | |
1293 | ||
1294 | if (fWriteAOD) { | |
1295 | AliWarning("AOD creation not supported anymore during reconstruction. See ANALYSIS/AliAnalysisTaskESDfilter.cxx instead."); | |
1296 | } | |
1297 | ||
1298 | // Create tags for the events in the ESD tree (the ESD tree is always present) | |
1299 | // In case of empty events the tags will contain dummy values | |
1300 | AliESDTagCreator *esdtagCreator = new AliESDTagCreator(); | |
1301 | esdtagCreator->CreateESDTags(fFirstEvent,fLastEvent,fGRPData); | |
1302 | if (fWriteAOD) { | |
1303 | AliWarning("AOD tag creation not supported anymore during reconstruction."); | |
1304 | } | |
1305 | ||
1306 | //Finish QA and end of cycle for out-of-loop QA | |
1307 | if (!fInLoopQA) { | |
1308 | if (fRunQA) { | |
1309 | AliQADataMakerSteer qas; | |
1310 | qas.Run(fRunLocalReconstruction.Data(), AliQA::kRECPOINTS, fSameQACycle); | |
1311 | //qas.Reset() ; | |
1312 | qas.Run(fRunTracking.Data(), AliQA::kESDS, fSameQACycle); | |
1313 | if (fRunGlobalQA) { | |
1314 | AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL); | |
1315 | if (qadm) { | |
1316 | qadm->EndOfCycle(AliQA::kRECPOINTS); | |
1317 | qadm->EndOfCycle(AliQA::kESDS); | |
1318 | qadm->Finish(); | |
1319 | } | |
1320 | } | |
1321 | } | |
1322 | } | |
1323 | ||
1324 | // Cleanup of CDB manager: cache and active storages! | |
1325 | AliCDBManager::Instance()->ClearCache(); | |
1326 | ||
1327 | return kTRUE; | |
1328 | } | |
1329 | ||
1330 | ||
1331 | //_____________________________________________________________________________ | |
1332 | Bool_t AliReconstruction::RunLocalReconstruction(const TString& /*detectors*/) | |
1333 | { | |
1334 | // run the local reconstruction | |
1335 | static Int_t eventNr=0; | |
1336 | AliCodeTimerAuto("") | |
1337 | ||
1338 | // AliCDBManager* man = AliCDBManager::Instance(); | |
1339 | // Bool_t origCache = man->GetCacheFlag(); | |
1340 | ||
1341 | // TString detStr = detectors; | |
1342 | // for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
1343 | // if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; | |
1344 | // AliReconstructor* reconstructor = GetReconstructor(iDet); | |
1345 | // if (!reconstructor) continue; | |
1346 | // if (reconstructor->HasLocalReconstruction()) continue; | |
1347 | ||
1348 | // AliCodeTimerStart(Form("running reconstruction for %s", fgkDetectorName[iDet])); | |
1349 | // AliInfo(Form("running reconstruction for %s", fgkDetectorName[iDet])); | |
1350 | ||
1351 | // AliCodeTimerStart(Form("Loading calibration data from OCDB for %s", fgkDetectorName[iDet])); | |
1352 | // AliInfo(Form("Loading calibration data from OCDB for %s", fgkDetectorName[iDet])); | |
1353 | ||
1354 | // man->SetCacheFlag(kTRUE); | |
1355 | // TString calibPath = Form("%s/Calib/*", fgkDetectorName[iDet]); | |
1356 | // man->GetAll(calibPath); // entries are cached! | |
1357 | ||
1358 | // AliCodeTimerStop(Form("Loading calibration data from OCDB for %s", fgkDetectorName[iDet])); | |
1359 | ||
1360 | // if (fRawReader) { | |
1361 | // fRawReader->RewindEvents(); | |
1362 | // reconstructor->Reconstruct(fRunLoader, fRawReader); | |
1363 | // } else { | |
1364 | // reconstructor->Reconstruct(fRunLoader); | |
1365 | // } | |
1366 | ||
1367 | // AliCodeTimerStop(Form("running reconstruction for %s", fgkDetectorName[iDet])); | |
1368 | // AliSysInfo::AddStamp(Form("LRec%s_%d",fgkDetectorName[iDet],eventNr)); | |
1369 | ||
1370 | // // unload calibration data | |
1371 | // man->UnloadFromCache(calibPath); | |
1372 | // //man->ClearCache(); | |
1373 | // } | |
1374 | ||
1375 | // man->SetCacheFlag(origCache); | |
1376 | ||
1377 | // if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { | |
1378 | // AliError(Form("the following detectors were not found: %s", | |
1379 | // detStr.Data())); | |
1380 | // if (fStopOnError) return kFALSE; | |
1381 | // } | |
1382 | ||
1383 | eventNr++; | |
1384 | return kTRUE; | |
1385 | } | |
1386 | ||
1387 | //_____________________________________________________________________________ | |
1388 | Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors) | |
1389 | { | |
1390 | // run the local reconstruction | |
1391 | ||
1392 | static Int_t eventNr=0; | |
1393 | AliCodeTimerAuto("") | |
1394 | ||
1395 | TString detStr = detectors; | |
1396 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
1397 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; | |
1398 | AliReconstructor* reconstructor = GetReconstructor(iDet); | |
1399 | if (!reconstructor) continue; | |
1400 | AliLoader* loader = fLoader[iDet]; | |
1401 | // Matthias April 2008: temporary fix to run HLT reconstruction | |
1402 | // although the HLT loader is missing | |
1403 | if (strcmp(fgkDetectorName[iDet], "HLT")==0) { | |
1404 | if (fRawReader) { | |
1405 | reconstructor->Reconstruct(fRawReader, NULL); | |
1406 | } else { | |
1407 | TTree* dummy=NULL; | |
1408 | reconstructor->Reconstruct(dummy, NULL); | |
1409 | } | |
1410 | continue; | |
1411 | } | |
1412 | if (!loader) { | |
1413 | AliWarning(Form("No loader is defined for %s!",fgkDetectorName[iDet])); | |
1414 | continue; | |
1415 | } | |
1416 | // conversion of digits | |
1417 | if (fRawReader && reconstructor->HasDigitConversion()) { | |
1418 | AliInfo(Form("converting raw data digits into root objects for %s", | |
1419 | fgkDetectorName[iDet])); | |
1420 | AliCodeTimerAuto(Form("converting raw data digits into root objects for %s", | |
1421 | fgkDetectorName[iDet])); | |
1422 | loader->LoadDigits("update"); | |
1423 | loader->CleanDigits(); | |
1424 | loader->MakeDigitsContainer(); | |
1425 | TTree* digitsTree = loader->TreeD(); | |
1426 | reconstructor->ConvertDigits(fRawReader, digitsTree); | |
1427 | loader->WriteDigits("OVERWRITE"); | |
1428 | loader->UnloadDigits(); | |
1429 | } | |
1430 | // local reconstruction | |
1431 | AliInfo(Form("running reconstruction for %s", fgkDetectorName[iDet])); | |
1432 | AliCodeTimerAuto(Form("running reconstruction for %s", fgkDetectorName[iDet])); | |
1433 | loader->LoadRecPoints("update"); | |
1434 | loader->CleanRecPoints(); | |
1435 | loader->MakeRecPointsContainer(); | |
1436 | TTree* clustersTree = loader->TreeR(); | |
1437 | if (fRawReader && !reconstructor->HasDigitConversion()) { | |
1438 | reconstructor->Reconstruct(fRawReader, clustersTree); | |
1439 | } else { | |
1440 | loader->LoadDigits("read"); | |
1441 | TTree* digitsTree = loader->TreeD(); | |
1442 | if (!digitsTree) { | |
1443 | AliError(Form("Can't get the %s digits tree", fgkDetectorName[iDet])); | |
1444 | if (fStopOnError) return kFALSE; | |
1445 | } else { | |
1446 | reconstructor->Reconstruct(digitsTree, clustersTree); | |
1447 | } | |
1448 | loader->UnloadDigits(); | |
1449 | } | |
1450 | ||
1451 | // In-loop QA for local reconstrucion | |
1452 | if (fRunQA && fInLoopQA) { | |
1453 | AliQADataMakerRec * qadm = GetQADataMaker(iDet); | |
1454 | if (qadm) { | |
1455 | //AliCodeTimerStart | |
1456 | //(Form("Running QA data maker for %s", fgkDetectorName[iDet])); | |
1457 | //AliInfo | |
1458 | //(Form("Running QA data maker for %s", fgkDetectorName[iDet])); | |
1459 | ||
1460 | qadm->Exec(AliQA::kRECPOINTS, clustersTree) ; | |
1461 | ||
1462 | //AliCodeTimerStop | |
1463 | //(Form("Running QA data maker for %s", fgkDetectorName[iDet])); | |
1464 | } | |
1465 | } | |
1466 | ||
1467 | loader->WriteRecPoints("OVERWRITE"); | |
1468 | loader->UnloadRecPoints(); | |
1469 | AliSysInfo::AddStamp(Form("LRec%s_%d",fgkDetectorName[iDet],eventNr), iDet,1,eventNr); | |
1470 | } | |
1471 | ||
1472 | if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { | |
1473 | AliError(Form("the following detectors were not found: %s", | |
1474 | detStr.Data())); | |
1475 | if (fStopOnError) return kFALSE; | |
1476 | } | |
1477 | eventNr++; | |
1478 | return kTRUE; | |
1479 | } | |
1480 | ||
1481 | //_____________________________________________________________________________ | |
1482 | Bool_t AliReconstruction::RunVertexFinder(AliESDEvent*& esd) | |
1483 | { | |
1484 | // run the barrel tracking | |
1485 | ||
1486 | AliCodeTimerAuto("") | |
1487 | ||
1488 | AliESDVertex* vertex = NULL; | |
1489 | Double_t vtxPos[3] = {0, 0, 0}; | |
1490 | Double_t vtxErr[3] = {0.07, 0.07, 0.1}; | |
1491 | TArrayF mcVertex(3); | |
1492 | if (fRunLoader->GetHeader() && fRunLoader->GetHeader()->GenEventHeader()) { | |
1493 | fRunLoader->GetHeader()->GenEventHeader()->PrimaryVertex(mcVertex); | |
1494 | for (Int_t i = 0; i < 3; i++) vtxPos[i] = mcVertex[i]; | |
1495 | } | |
1496 | ||
1497 | if (fVertexer) { | |
1498 | if(fDiamondProfile) fVertexer->SetVtxStart(fDiamondProfile); | |
1499 | AliInfo("running the ITS vertex finder"); | |
1500 | if (fLoader[0]) fLoader[0]->LoadRecPoints(); | |
1501 | vertex = fVertexer->FindVertexForCurrentEvent(fRunLoader->GetEventNumber()); | |
1502 | if (fLoader[0]) fLoader[0]->UnloadRecPoints(); | |
1503 | if(!vertex){ | |
1504 | AliWarning("Vertex not found"); | |
1505 | vertex = new AliESDVertex(); | |
1506 | vertex->SetName("default"); | |
1507 | } | |
1508 | else { | |
1509 | vertex->SetName("reconstructed"); | |
1510 | } | |
1511 | ||
1512 | } else { | |
1513 | AliInfo("getting the primary vertex from MC"); | |
1514 | vertex = new AliESDVertex(vtxPos, vtxErr); | |
1515 | } | |
1516 | ||
1517 | if (vertex) { | |
1518 | vertex->GetXYZ(vtxPos); | |
1519 | vertex->GetSigmaXYZ(vtxErr); | |
1520 | } else { | |
1521 | AliWarning("no vertex reconstructed"); | |
1522 | vertex = new AliESDVertex(vtxPos, vtxErr); | |
1523 | } | |
1524 | esd->SetPrimaryVertexSPD(vertex); | |
1525 | // if SPD multiplicity has been determined, it is stored in the ESD | |
1526 | AliMultiplicity *mult = fVertexer->GetMultiplicity(); | |
1527 | if(mult)esd->SetMultiplicity(mult); | |
1528 | ||
1529 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
1530 | if (fTracker[iDet]) fTracker[iDet]->SetVertex(vtxPos, vtxErr); | |
1531 | } | |
1532 | delete vertex; | |
1533 | ||
1534 | return kTRUE; | |
1535 | } | |
1536 | ||
1537 | //_____________________________________________________________________________ | |
1538 | Bool_t AliReconstruction::RunHLTTracking(AliESDEvent*& esd) | |
1539 | { | |
1540 | // run the HLT barrel tracking | |
1541 | ||
1542 | AliCodeTimerAuto("") | |
1543 | ||
1544 | if (!fRunLoader) { | |
1545 | AliError("Missing runLoader!"); | |
1546 | return kFALSE; | |
1547 | } | |
1548 | ||
1549 | AliInfo("running HLT tracking"); | |
1550 | ||
1551 | // Get a pointer to the HLT reconstructor | |
1552 | AliReconstructor *reconstructor = GetReconstructor(fgkNDetectors-1); | |
1553 | if (!reconstructor) return kFALSE; | |
1554 | ||
1555 | // TPC + ITS | |
1556 | for (Int_t iDet = 1; iDet >= 0; iDet--) { | |
1557 | TString detName = fgkDetectorName[iDet]; | |
1558 | AliDebug(1, Form("%s HLT tracking", detName.Data())); | |
1559 | reconstructor->SetOption(detName.Data()); | |
1560 | AliTracker *tracker = reconstructor->CreateTracker(); | |
1561 | if (!tracker) { | |
1562 | AliWarning(Form("couldn't create a HLT tracker for %s", detName.Data())); | |
1563 | if (fStopOnError) return kFALSE; | |
1564 | continue; | |
1565 | } | |
1566 | Double_t vtxPos[3]; | |
1567 | Double_t vtxErr[3]={0.005,0.005,0.010}; | |
1568 | const AliESDVertex *vertex = esd->GetVertex(); | |
1569 | vertex->GetXYZ(vtxPos); | |
1570 | tracker->SetVertex(vtxPos,vtxErr); | |
1571 | if(iDet != 1) { | |
1572 | fLoader[iDet]->LoadRecPoints("read"); | |
1573 | TTree* tree = fLoader[iDet]->TreeR(); | |
1574 | if (!tree) { | |
1575 | AliError(Form("Can't get the %s cluster tree", detName.Data())); | |
1576 | return kFALSE; | |
1577 | } | |
1578 | tracker->LoadClusters(tree); | |
1579 | } | |
1580 | if (tracker->Clusters2Tracks(esd) != 0) { | |
1581 | AliError(Form("HLT %s Clusters2Tracks failed", fgkDetectorName[iDet])); | |
1582 | return kFALSE; | |
1583 | } | |
1584 | if(iDet != 1) { | |
1585 | tracker->UnloadClusters(); | |
1586 | } | |
1587 | delete tracker; | |
1588 | } | |
1589 | ||
1590 | return kTRUE; | |
1591 | } | |
1592 | ||
1593 | //_____________________________________________________________________________ | |
1594 | Bool_t AliReconstruction::RunMuonTracking(AliESDEvent*& esd) | |
1595 | { | |
1596 | // run the muon spectrometer tracking | |
1597 | ||
1598 | AliCodeTimerAuto("") | |
1599 | ||
1600 | if (!fRunLoader) { | |
1601 | AliError("Missing runLoader!"); | |
1602 | return kFALSE; | |
1603 | } | |
1604 | Int_t iDet = 7; // for MUON | |
1605 | ||
1606 | AliInfo("is running..."); | |
1607 | ||
1608 | // Get a pointer to the MUON reconstructor | |
1609 | AliReconstructor *reconstructor = GetReconstructor(iDet); | |
1610 | if (!reconstructor) return kFALSE; | |
1611 | ||
1612 | ||
1613 | TString detName = fgkDetectorName[iDet]; | |
1614 | AliDebug(1, Form("%s tracking", detName.Data())); | |
1615 | AliTracker *tracker = reconstructor->CreateTracker(); | |
1616 | if (!tracker) { | |
1617 | AliWarning(Form("couldn't create a tracker for %s", detName.Data())); | |
1618 | return kFALSE; | |
1619 | } | |
1620 | ||
1621 | // read RecPoints | |
1622 | fLoader[iDet]->LoadRecPoints("read"); | |
1623 | ||
1624 | tracker->LoadClusters(fLoader[iDet]->TreeR()); | |
1625 | ||
1626 | Int_t rv = tracker->Clusters2Tracks(esd); | |
1627 | ||
1628 | if ( rv ) | |
1629 | { | |
1630 | AliError(Form("%s Clusters2Tracks failed", fgkDetectorName[iDet])); | |
1631 | return kFALSE; | |
1632 | } | |
1633 | ||
1634 | fLoader[iDet]->UnloadRecPoints(); | |
1635 | ||
1636 | tracker->UnloadClusters(); | |
1637 | ||
1638 | delete tracker; | |
1639 | ||
1640 | return kTRUE; | |
1641 | } | |
1642 | ||
1643 | ||
1644 | //_____________________________________________________________________________ | |
1645 | Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd) | |
1646 | { | |
1647 | // run the barrel tracking | |
1648 | static Int_t eventNr=0; | |
1649 | AliCodeTimerAuto("") | |
1650 | ||
1651 | AliInfo("running tracking"); | |
1652 | ||
1653 | //Fill the ESD with the T0 info (will be used by the TOF) | |
1654 | if (fReconstructor[11] && fLoader[11]) { | |
1655 | fLoader[11]->LoadRecPoints("READ"); | |
1656 | TTree *treeR = fLoader[11]->TreeR(); | |
1657 | GetReconstructor(11)->FillESD((TTree *)NULL,treeR,esd); | |
1658 | } | |
1659 | ||
1660 | // pass 1: TPC + ITS inwards | |
1661 | for (Int_t iDet = 1; iDet >= 0; iDet--) { | |
1662 | if (!fTracker[iDet]) continue; | |
1663 | AliDebug(1, Form("%s tracking", fgkDetectorName[iDet])); | |
1664 | ||
1665 | // load clusters | |
1666 | fLoader[iDet]->LoadRecPoints("read"); | |
1667 | AliSysInfo::AddStamp(Form("RLoadCluster%s_%d",fgkDetectorName[iDet],eventNr),iDet,1, eventNr); | |
1668 | TTree* tree = fLoader[iDet]->TreeR(); | |
1669 | if (!tree) { | |
1670 | AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet])); | |
1671 | return kFALSE; | |
1672 | } | |
1673 | fTracker[iDet]->LoadClusters(tree); | |
1674 | AliSysInfo::AddStamp(Form("TLoadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,2, eventNr); | |
1675 | // run tracking | |
1676 | if (fTracker[iDet]->Clusters2Tracks(esd) != 0) { | |
1677 | AliError(Form("%s Clusters2Tracks failed", fgkDetectorName[iDet])); | |
1678 | return kFALSE; | |
1679 | } | |
1680 | if (fCheckPointLevel > 1) { | |
1681 | WriteESD(esd, Form("%s.tracking", fgkDetectorName[iDet])); | |
1682 | } | |
1683 | // preliminary PID in TPC needed by the ITS tracker | |
1684 | if (iDet == 1) { | |
1685 | GetReconstructor(1)->FillESD((TTree*)NULL, (TTree*)NULL, esd); | |
1686 | AliESDpid::MakePID(esd); | |
1687 | } | |
1688 | AliSysInfo::AddStamp(Form("Tracking0%s_%d",fgkDetectorName[iDet],eventNr), iDet,3,eventNr); | |
1689 | } | |
1690 | ||
1691 | // pass 2: ALL backwards | |
1692 | ||
1693 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
1694 | if (!fTracker[iDet]) continue; | |
1695 | AliDebug(1, Form("%s back propagation", fgkDetectorName[iDet])); | |
1696 | ||
1697 | // load clusters | |
1698 | if (iDet > 1) { // all except ITS, TPC | |
1699 | TTree* tree = NULL; | |
1700 | fLoader[iDet]->LoadRecPoints("read"); | |
1701 | AliSysInfo::AddStamp(Form("RLoadCluster0%s_%d",fgkDetectorName[iDet],eventNr), iDet,1, eventNr); | |
1702 | tree = fLoader[iDet]->TreeR(); | |
1703 | if (!tree) { | |
1704 | AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet])); | |
1705 | return kFALSE; | |
1706 | } | |
1707 | fTracker[iDet]->LoadClusters(tree); | |
1708 | AliSysInfo::AddStamp(Form("TLoadCluster0%s_%d",fgkDetectorName[iDet],eventNr), iDet,2, eventNr); | |
1709 | } | |
1710 | ||
1711 | // run tracking | |
1712 | if (iDet>1) // start filling residuals for the "outer" detectors | |
1713 | if (fRunGlobalQA) AliTracker::SetFillResiduals(kTRUE); | |
1714 | ||
1715 | if (fTracker[iDet]->PropagateBack(esd) != 0) { | |
1716 | AliError(Form("%s backward propagation failed", fgkDetectorName[iDet])); | |
1717 | // return kFALSE; | |
1718 | } | |
1719 | if (fCheckPointLevel > 1) { | |
1720 | WriteESD(esd, Form("%s.back", fgkDetectorName[iDet])); | |
1721 | } | |
1722 | ||
1723 | // unload clusters | |
1724 | if (iDet > 2) { // all except ITS, TPC, TRD | |
1725 | fTracker[iDet]->UnloadClusters(); | |
1726 | fLoader[iDet]->UnloadRecPoints(); | |
1727 | } | |
1728 | // updated PID in TPC needed by the ITS tracker -MI | |
1729 | if (iDet == 1) { | |
1730 | GetReconstructor(1)->FillESD((TTree*)NULL, (TTree*)NULL, esd); | |
1731 | AliESDpid::MakePID(esd); | |
1732 | } | |
1733 | AliSysInfo::AddStamp(Form("Tracking1%s_%d",fgkDetectorName[iDet],eventNr), iDet,3, eventNr); | |
1734 | } | |
1735 | //stop filling residuals for the "outer" detectors | |
1736 | if (fRunGlobalQA) AliTracker::SetFillResiduals(kFALSE); | |
1737 | ||
1738 | // write space-points to the ESD in case alignment data output | |
1739 | // is switched on | |
1740 | if (fWriteAlignmentData) | |
1741 | WriteAlignmentData(esd); | |
1742 | ||
1743 | // pass 3: TRD + TPC + ITS refit inwards | |
1744 | ||
1745 | for (Int_t iDet = 2; iDet >= 0; iDet--) { | |
1746 | if (!fTracker[iDet]) continue; | |
1747 | AliDebug(1, Form("%s inward refit", fgkDetectorName[iDet])); | |
1748 | ||
1749 | // run tracking | |
1750 | if (iDet<2) // start filling residuals for TPC and ITS | |
1751 | if (fRunGlobalQA) AliTracker::SetFillResiduals(kTRUE); | |
1752 | ||
1753 | if (fTracker[iDet]->RefitInward(esd) != 0) { | |
1754 | AliError(Form("%s inward refit failed", fgkDetectorName[iDet])); | |
1755 | // return kFALSE; | |
1756 | } | |
1757 | // run postprocessing | |
1758 | if (fTracker[iDet]->PostProcess(esd) != 0) { | |
1759 | AliError(Form("%s postprocessing failed", fgkDetectorName[iDet])); | |
1760 | // return kFALSE; | |
1761 | } | |
1762 | if (fCheckPointLevel > 1) { | |
1763 | WriteESD(esd, Form("%s.refit", fgkDetectorName[iDet])); | |
1764 | } | |
1765 | AliSysInfo::AddStamp(Form("Tracking2%s_%d",fgkDetectorName[iDet],eventNr), iDet,3, eventNr); | |
1766 | // unload clusters | |
1767 | fTracker[iDet]->UnloadClusters(); | |
1768 | AliSysInfo::AddStamp(Form("TUnloadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,4, eventNr); | |
1769 | fLoader[iDet]->UnloadRecPoints(); | |
1770 | AliSysInfo::AddStamp(Form("RUnloadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,5, eventNr); | |
1771 | } | |
1772 | // stop filling residuals for TPC and ITS | |
1773 | if (fRunGlobalQA) AliTracker::SetFillResiduals(kFALSE); | |
1774 | ||
1775 | eventNr++; | |
1776 | return kTRUE; | |
1777 | } | |
1778 | ||
1779 | //_____________________________________________________________________________ | |
1780 | Bool_t AliReconstruction::CleanESD(AliESDEvent *esd){ | |
1781 | // | |
1782 | // Remove the data which are not needed for the physics analysis. | |
1783 | // | |
1784 | ||
1785 | Int_t nTracks=esd->GetNumberOfTracks(); | |
1786 | Int_t nV0s=esd->GetNumberOfV0s(); | |
1787 | AliInfo | |
1788 | (Form("Number of ESD tracks and V0s before cleaning: %d %d",nTracks,nV0s)); | |
1789 | ||
1790 | Float_t cleanPars[]={fV0DCAmax,fV0CsPmin,fDmax,fZmax}; | |
1791 | Bool_t rc=esd->Clean(cleanPars); | |
1792 | ||
1793 | nTracks=esd->GetNumberOfTracks(); | |
1794 | nV0s=esd->GetNumberOfV0s(); | |
1795 | AliInfo | |
1796 | (Form("Number of ESD tracks and V0s after cleaning %d %d",nTracks,nV0s)); | |
1797 | ||
1798 | return rc; | |
1799 | } | |
1800 | ||
1801 | //_____________________________________________________________________________ | |
1802 | Bool_t AliReconstruction::FillESD(AliESDEvent*& esd, const TString& detectors) | |
1803 | { | |
1804 | // fill the event summary data | |
1805 | ||
1806 | AliCodeTimerAuto("") | |
1807 | static Int_t eventNr=0; | |
1808 | TString detStr = detectors; | |
1809 | ||
1810 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
1811 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; | |
1812 | AliReconstructor* reconstructor = GetReconstructor(iDet); | |
1813 | if (!reconstructor) continue; | |
1814 | if (!ReadESD(esd, fgkDetectorName[iDet])) { | |
1815 | AliDebug(1, Form("filling ESD for %s", fgkDetectorName[iDet])); | |
1816 | TTree* clustersTree = NULL; | |
1817 | if (fLoader[iDet]) { | |
1818 | fLoader[iDet]->LoadRecPoints("read"); | |
1819 | clustersTree = fLoader[iDet]->TreeR(); | |
1820 | if (!clustersTree) { | |
1821 | AliError(Form("Can't get the %s clusters tree", | |
1822 | fgkDetectorName[iDet])); | |
1823 | if (fStopOnError) return kFALSE; | |
1824 | } | |
1825 | } | |
1826 | if (fRawReader && !reconstructor->HasDigitConversion()) { | |
1827 | reconstructor->FillESD(fRawReader, clustersTree, esd); | |
1828 | } else { | |
1829 | TTree* digitsTree = NULL; | |
1830 | if (fLoader[iDet]) { | |
1831 | fLoader[iDet]->LoadDigits("read"); | |
1832 | digitsTree = fLoader[iDet]->TreeD(); | |
1833 | if (!digitsTree) { | |
1834 | AliError(Form("Can't get the %s digits tree", | |
1835 | fgkDetectorName[iDet])); | |
1836 | if (fStopOnError) return kFALSE; | |
1837 | } | |
1838 | } | |
1839 | reconstructor->FillESD(digitsTree, clustersTree, esd); | |
1840 | if (fLoader[iDet]) fLoader[iDet]->UnloadDigits(); | |
1841 | } | |
1842 | if (fLoader[iDet]) { | |
1843 | fLoader[iDet]->UnloadRecPoints(); | |
1844 | } | |
1845 | ||
1846 | if (fCheckPointLevel > 2) WriteESD(esd, fgkDetectorName[iDet]); | |
1847 | } | |
1848 | } | |
1849 | ||
1850 | if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { | |
1851 | AliError(Form("the following detectors were not found: %s", | |
1852 | detStr.Data())); | |
1853 | if (fStopOnError) return kFALSE; | |
1854 | } | |
1855 | AliSysInfo::AddStamp(Form("FillESD%d",eventNr), 0,1, eventNr); | |
1856 | eventNr++; | |
1857 | return kTRUE; | |
1858 | } | |
1859 | ||
1860 | //_____________________________________________________________________________ | |
1861 | Bool_t AliReconstruction::FillTriggerESD(AliESDEvent*& esd) | |
1862 | { | |
1863 | // Reads the trigger decision which is | |
1864 | // stored in Trigger.root file and fills | |
1865 | // the corresponding esd entries | |
1866 | ||
1867 | AliCodeTimerAuto("") | |
1868 | ||
1869 | AliInfo("Filling trigger information into the ESD"); | |
1870 | ||
1871 | AliCentralTrigger *aCTP = NULL; | |
1872 | ||
1873 | if (fRawReader) { | |
1874 | AliCTPRawStream input(fRawReader); | |
1875 | if (!input.Next()) { | |
1876 | AliError("No valid CTP (trigger) DDL raw data is found ! The trigger information is not stored in the ESD !"); | |
1877 | return kFALSE; | |
1878 | } | |
1879 | esd->SetTriggerMask(input.GetClassMask()); | |
1880 | esd->SetTriggerCluster(input.GetClusterMask()); | |
1881 | ||
1882 | aCTP = new AliCentralTrigger(); | |
1883 | TString configstr(""); | |
1884 | if (!aCTP->LoadConfiguration(configstr)) { // Load CTP config from OCDB | |
1885 | AliError("No trigger configuration found in OCDB! The trigger classes information will no be stored in ESD!"); | |
1886 | delete aCTP; | |
1887 | return kFALSE; | |
1888 | } | |
1889 | } | |
1890 | else { | |
1891 | AliRunLoader *runloader = AliRunLoader::GetRunLoader(); | |
1892 | if (runloader) { | |
1893 | if (!runloader->LoadTrigger()) { | |
1894 | aCTP = runloader->GetTrigger(); | |
1895 | esd->SetTriggerMask(aCTP->GetClassMask()); | |
1896 | esd->SetTriggerCluster(aCTP->GetClusterMask()); | |
1897 | } | |
1898 | else { | |
1899 | AliWarning("No trigger can be loaded! The trigger information is not stored in the ESD !"); | |
1900 | return kFALSE; | |
1901 | } | |
1902 | } | |
1903 | else { | |
1904 | AliError("No run loader is available! The trigger information is not stored in the ESD !"); | |
1905 | return kFALSE; | |
1906 | } | |
1907 | } | |
1908 | ||
1909 | // Now fill the trigger class names into AliESDRun object | |
1910 | AliTriggerConfiguration *config = aCTP->GetConfiguration(); | |
1911 | if (!config) { | |
1912 | AliError("No trigger configuration has been found! The trigger classes information will no be stored in ESD!"); | |
1913 | if (fRawReader) delete aCTP; | |
1914 | return kFALSE; | |
1915 | } | |
1916 | ||
1917 | const TObjArray& classesArray = config->GetClasses(); | |
1918 | Int_t nclasses = classesArray.GetEntriesFast(); | |
1919 | for( Int_t j=0; j<nclasses; j++ ) { | |
1920 | AliTriggerClass* trclass = (AliTriggerClass*)classesArray.At( j ); | |
1921 | Int_t trindex = (Int_t)TMath::Log2(trclass->GetMask()); | |
1922 | esd->SetTriggerClass(trclass->GetName(),trindex); | |
1923 | } | |
1924 | ||
1925 | if (fRawReader) delete aCTP; | |
1926 | return kTRUE; | |
1927 | } | |
1928 | ||
1929 | ||
1930 | ||
1931 | ||
1932 | ||
1933 | //_____________________________________________________________________________ | |
1934 | Bool_t AliReconstruction::FillRawEventHeaderESD(AliESDEvent*& esd) | |
1935 | { | |
1936 | // | |
1937 | // Filling information from RawReader Header | |
1938 | // | |
1939 | ||
1940 | AliInfo("Filling information from RawReader Header"); | |
1941 | esd->SetBunchCrossNumber(0); | |
1942 | esd->SetOrbitNumber(0); | |
1943 | esd->SetPeriodNumber(0); | |
1944 | esd->SetTimeStamp(0); | |
1945 | esd->SetEventType(0); | |
1946 | const AliRawEventHeaderBase * eventHeader = fRawReader->GetEventHeader(); | |
1947 | if (eventHeader){ | |
1948 | ||
1949 | const UInt_t *id = eventHeader->GetP("Id"); | |
1950 | esd->SetBunchCrossNumber((id)[1]&0x00000fff); | |
1951 | esd->SetOrbitNumber((((id)[0]<<20)&0xf00000)|(((id)[1]>>12)&0xfffff)); | |
1952 | esd->SetPeriodNumber(((id)[0]>>4)&0x0fffffff); | |
1953 | ||
1954 | esd->SetTimeStamp((eventHeader->Get("Timestamp"))); | |
1955 | esd->SetEventType((eventHeader->Get("Type"))); | |
1956 | } | |
1957 | ||
1958 | return kTRUE; | |
1959 | } | |
1960 | ||
1961 | ||
1962 | //_____________________________________________________________________________ | |
1963 | Bool_t AliReconstruction::IsSelected(TString detName, TString& detectors) const | |
1964 | { | |
1965 | // check whether detName is contained in detectors | |
1966 | // if yes, it is removed from detectors | |
1967 | ||
1968 | // check if all detectors are selected | |
1969 | if ((detectors.CompareTo("ALL") == 0) || | |
1970 | detectors.BeginsWith("ALL ") || | |
1971 | detectors.EndsWith(" ALL") || | |
1972 | detectors.Contains(" ALL ")) { | |
1973 | detectors = "ALL"; | |
1974 | return kTRUE; | |
1975 | } | |
1976 | ||
1977 | // search for the given detector | |
1978 | Bool_t result = kFALSE; | |
1979 | if ((detectors.CompareTo(detName) == 0) || | |
1980 | detectors.BeginsWith(detName+" ") || | |
1981 | detectors.EndsWith(" "+detName) || | |
1982 | detectors.Contains(" "+detName+" ")) { | |
1983 | detectors.ReplaceAll(detName, ""); | |
1984 | result = kTRUE; | |
1985 | } | |
1986 | ||
1987 | // clean up the detectors string | |
1988 | while (detectors.Contains(" ")) detectors.ReplaceAll(" ", " "); | |
1989 | while (detectors.BeginsWith(" ")) detectors.Remove(0, 1); | |
1990 | while (detectors.EndsWith(" ")) detectors.Remove(detectors.Length()-1, 1); | |
1991 | ||
1992 | return result; | |
1993 | } | |
1994 | ||
1995 | //_____________________________________________________________________________ | |
1996 | Bool_t AliReconstruction::InitRunLoader() | |
1997 | { | |
1998 | // get or create the run loader | |
1999 | ||
2000 | if (gAlice) delete gAlice; | |
2001 | gAlice = NULL; | |
2002 | ||
2003 | if (!gSystem->AccessPathName(fGAliceFileName.Data())) { // galice.root exists | |
2004 | // load all base libraries to get the loader classes | |
2005 | TString libs = gSystem->GetLibraries(); | |
2006 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
2007 | TString detName = fgkDetectorName[iDet]; | |
2008 | if (detName == "HLT") continue; | |
2009 | if (libs.Contains("lib" + detName + "base.so")) continue; | |
2010 | gSystem->Load("lib" + detName + "base.so"); | |
2011 | } | |
2012 | fRunLoader = AliRunLoader::Open(fGAliceFileName.Data()); | |
2013 | if (!fRunLoader) { | |
2014 | AliError(Form("no run loader found in file %s", fGAliceFileName.Data())); | |
2015 | CleanUp(); | |
2016 | return kFALSE; | |
2017 | } | |
2018 | fRunLoader->CdGAFile(); | |
2019 | if (gFile->GetKey(AliRunLoader::GetGAliceName())) { | |
2020 | if (fRunLoader->LoadgAlice() == 0) { | |
2021 | gAlice = fRunLoader->GetAliRun(); | |
2022 | AliTracker::SetFieldMap(gAlice->Field(),fUniformField); | |
2023 | } | |
2024 | } | |
2025 | if (!gAlice && !fRawReader) { | |
2026 | AliError(Form("no gAlice object found in file %s", | |
2027 | fGAliceFileName.Data())); | |
2028 | CleanUp(); | |
2029 | return kFALSE; | |
2030 | } | |
2031 | ||
2032 | //PH This is a temporary fix to give access to the kinematics | |
2033 | //PH that is needed for the labels of ITS clusters | |
2034 | fRunLoader->LoadHeader(); | |
2035 | fRunLoader->LoadKinematics(); | |
2036 | ||
2037 | } else { // galice.root does not exist | |
2038 | if (!fRawReader) { | |
2039 | AliError(Form("the file %s does not exist", fGAliceFileName.Data())); | |
2040 | CleanUp(); | |
2041 | return kFALSE; | |
2042 | } | |
2043 | fRunLoader = AliRunLoader::Open(fGAliceFileName.Data(), | |
2044 | AliConfig::GetDefaultEventFolderName(), | |
2045 | "recreate"); | |
2046 | if (!fRunLoader) { | |
2047 | AliError(Form("could not create run loader in file %s", | |
2048 | fGAliceFileName.Data())); | |
2049 | CleanUp(); | |
2050 | return kFALSE; | |
2051 | } | |
2052 | fIsNewRunLoader = kTRUE; | |
2053 | fRunLoader->MakeTree("E"); | |
2054 | ||
2055 | if (fNumberOfEventsPerFile > 0) | |
2056 | fRunLoader->SetNumberOfEventsPerFile(fNumberOfEventsPerFile); | |
2057 | else | |
2058 | fRunLoader->SetNumberOfEventsPerFile((UInt_t)-1); | |
2059 | } | |
2060 | ||
2061 | return kTRUE; | |
2062 | } | |
2063 | ||
2064 | //_____________________________________________________________________________ | |
2065 | AliReconstructor* AliReconstruction::GetReconstructor(Int_t iDet) | |
2066 | { | |
2067 | // get the reconstructor object and the loader for a detector | |
2068 | ||
2069 | if (fReconstructor[iDet]) return fReconstructor[iDet]; | |
2070 | ||
2071 | // load the reconstructor object | |
2072 | TPluginManager* pluginManager = gROOT->GetPluginManager(); | |
2073 | TString detName = fgkDetectorName[iDet]; | |
2074 | TString recName = "Ali" + detName + "Reconstructor"; | |
2075 | ||
2076 | if (!fIsNewRunLoader && !fRunLoader->GetLoader(detName+"Loader") && (detName != "HLT")) return NULL; | |
2077 | ||
2078 | AliReconstructor* reconstructor = NULL; | |
2079 | // first check if a plugin is defined for the reconstructor | |
2080 | TPluginHandler* pluginHandler = | |
2081 | pluginManager->FindHandler("AliReconstructor", detName); | |
2082 | // if not, add a plugin for it | |
2083 | if (!pluginHandler) { | |
2084 | AliDebug(1, Form("defining plugin for %s", recName.Data())); | |
2085 | TString libs = gSystem->GetLibraries(); | |
2086 | if (libs.Contains("lib" + detName + "base.so") || | |
2087 | (gSystem->Load("lib" + detName + "base.so") >= 0)) { | |
2088 | pluginManager->AddHandler("AliReconstructor", detName, | |
2089 | recName, detName + "rec", recName + "()"); | |
2090 | } else { | |
2091 | pluginManager->AddHandler("AliReconstructor", detName, | |
2092 | recName, detName, recName + "()"); | |
2093 | } | |
2094 | pluginHandler = pluginManager->FindHandler("AliReconstructor", detName); | |
2095 | } | |
2096 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { | |
2097 | reconstructor = (AliReconstructor*) pluginHandler->ExecPlugin(0); | |
2098 | } | |
2099 | if (reconstructor) { | |
2100 | TObject* obj = fOptions.FindObject(detName.Data()); | |
2101 | if (obj) reconstructor->SetOption(obj->GetTitle()); | |
2102 | reconstructor->Init(); | |
2103 | fReconstructor[iDet] = reconstructor; | |
2104 | } | |
2105 | ||
2106 | // get or create the loader | |
2107 | if (detName != "HLT") { | |
2108 | fLoader[iDet] = fRunLoader->GetLoader(detName + "Loader"); | |
2109 | if (!fLoader[iDet]) { | |
2110 | AliConfig::Instance() | |
2111 | ->CreateDetectorFolders(fRunLoader->GetEventFolder(), | |
2112 | detName, detName); | |
2113 | // first check if a plugin is defined for the loader | |
2114 | pluginHandler = | |
2115 | pluginManager->FindHandler("AliLoader", detName); | |
2116 | // if not, add a plugin for it | |
2117 | if (!pluginHandler) { | |
2118 | TString loaderName = "Ali" + detName + "Loader"; | |
2119 | AliDebug(1, Form("defining plugin for %s", loaderName.Data())); | |
2120 | pluginManager->AddHandler("AliLoader", detName, | |
2121 | loaderName, detName + "base", | |
2122 | loaderName + "(const char*, TFolder*)"); | |
2123 | pluginHandler = pluginManager->FindHandler("AliLoader", detName); | |
2124 | } | |
2125 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { | |
2126 | fLoader[iDet] = | |
2127 | (AliLoader*) pluginHandler->ExecPlugin(2, detName.Data(), | |
2128 | fRunLoader->GetEventFolder()); | |
2129 | } | |
2130 | if (!fLoader[iDet]) { // use default loader | |
2131 | fLoader[iDet] = new AliLoader(detName, fRunLoader->GetEventFolder()); | |
2132 | } | |
2133 | if (!fLoader[iDet]) { | |
2134 | AliWarning(Form("couldn't get loader for %s", detName.Data())); | |
2135 | if (fStopOnError) return NULL; | |
2136 | } else { | |
2137 | fRunLoader->AddLoader(fLoader[iDet]); | |
2138 | fRunLoader->CdGAFile(); | |
2139 | if (gFile && !gFile->IsWritable()) gFile->ReOpen("UPDATE"); | |
2140 | fRunLoader->Write(0, TObject::kOverwrite); | |
2141 | } | |
2142 | } | |
2143 | } | |
2144 | ||
2145 | return reconstructor; | |
2146 | } | |
2147 | ||
2148 | //_____________________________________________________________________________ | |
2149 | Bool_t AliReconstruction::CreateVertexer() | |
2150 | { | |
2151 | // create the vertexer | |
2152 | ||
2153 | fVertexer = NULL; | |
2154 | AliReconstructor* itsReconstructor = GetReconstructor(0); | |
2155 | if (itsReconstructor) { | |
2156 | fVertexer = itsReconstructor->CreateVertexer(); | |
2157 | } | |
2158 | if (!fVertexer) { | |
2159 | AliWarning("couldn't create a vertexer for ITS"); | |
2160 | if (fStopOnError) return kFALSE; | |
2161 | } | |
2162 | ||
2163 | return kTRUE; | |
2164 | } | |
2165 | ||
2166 | //_____________________________________________________________________________ | |
2167 | Bool_t AliReconstruction::CreateTrackers(const TString& detectors) | |
2168 | { | |
2169 | // create the trackers | |
2170 | ||
2171 | TString detStr = detectors; | |
2172 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
2173 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; | |
2174 | AliReconstructor* reconstructor = GetReconstructor(iDet); | |
2175 | if (!reconstructor) continue; | |
2176 | TString detName = fgkDetectorName[iDet]; | |
2177 | if (detName == "HLT") { | |
2178 | fRunHLTTracking = kTRUE; | |
2179 | continue; | |
2180 | } | |
2181 | if (detName == "MUON") { | |
2182 | fRunMuonTracking = kTRUE; | |
2183 | continue; | |
2184 | } | |
2185 | ||
2186 | ||
2187 | fTracker[iDet] = reconstructor->CreateTracker(); | |
2188 | if (!fTracker[iDet] && (iDet < 7)) { | |
2189 | AliWarning(Form("couldn't create a tracker for %s", detName.Data())); | |
2190 | if (fStopOnError) return kFALSE; | |
2191 | } | |
2192 | AliSysInfo::AddStamp(Form("LTracker%s",fgkDetectorName[iDet]), iDet,0); | |
2193 | } | |
2194 | ||
2195 | return kTRUE; | |
2196 | } | |
2197 | ||
2198 | //_____________________________________________________________________________ | |
2199 | void AliReconstruction::CleanUp(TFile* file, TFile* fileOld) | |
2200 | { | |
2201 | // delete trackers and the run loader and close and delete the file | |
2202 | ||
2203 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
2204 | delete fReconstructor[iDet]; | |
2205 | fReconstructor[iDet] = NULL; | |
2206 | fLoader[iDet] = NULL; | |
2207 | delete fTracker[iDet]; | |
2208 | fTracker[iDet] = NULL; | |
2209 | // delete fQADataMaker[iDet]; | |
2210 | // fQADataMaker[iDet] = NULL; | |
2211 | } | |
2212 | delete fVertexer; | |
2213 | fVertexer = NULL; | |
2214 | ||
2215 | if (ftVertexer) delete ftVertexer; | |
2216 | ftVertexer = NULL; | |
2217 | ||
2218 | if(!(AliCDBManager::Instance()->GetCacheFlag())) { | |
2219 | delete fDiamondProfile; | |
2220 | fDiamondProfile = NULL; | |
2221 | delete fDiamondProfileTPC; | |
2222 | fDiamondProfileTPC = NULL; | |
2223 | delete fGRPData; | |
2224 | fGRPData = NULL; | |
2225 | } | |
2226 | ||
2227 | ||
2228 | delete fRunLoader; | |
2229 | fRunLoader = NULL; | |
2230 | delete fRawReader; | |
2231 | fRawReader = NULL; | |
2232 | if (fParentRawReader) delete fParentRawReader; | |
2233 | fParentRawReader=NULL; | |
2234 | ||
2235 | if (file) { | |
2236 | file->Close(); | |
2237 | delete file; | |
2238 | } | |
2239 | ||
2240 | if (fileOld) { | |
2241 | fileOld->Close(); | |
2242 | delete fileOld; | |
2243 | gSystem->Unlink("AliESDs.old.root"); | |
2244 | } | |
2245 | ||
2246 | } | |
2247 | ||
2248 | //_____________________________________________________________________________ | |
2249 | ||
2250 | Bool_t AliReconstruction::ReadESD(AliESDEvent*& esd, const char* recStep) const | |
2251 | { | |
2252 | // read the ESD event from a file | |
2253 | ||
2254 | if (!esd) return kFALSE; | |
2255 | char fileName[256]; | |
2256 | sprintf(fileName, "ESD_%d.%d_%s.root", | |
2257 | esd->GetRunNumber(), esd->GetEventNumberInFile(), recStep); | |
2258 | if (gSystem->AccessPathName(fileName)) return kFALSE; | |
2259 | ||
2260 | AliInfo(Form("reading ESD from file %s", fileName)); | |
2261 | AliDebug(1, Form("reading ESD from file %s", fileName)); | |
2262 | TFile* file = TFile::Open(fileName); | |
2263 | if (!file || !file->IsOpen()) { | |
2264 | AliError(Form("opening %s failed", fileName)); | |
2265 | delete file; | |
2266 | return kFALSE; | |
2267 | } | |
2268 | ||
2269 | gROOT->cd(); | |
2270 | delete esd; | |
2271 | esd = (AliESDEvent*) file->Get("ESD"); | |
2272 | file->Close(); | |
2273 | delete file; | |
2274 | return kTRUE; | |
2275 | ||
2276 | } | |
2277 | ||
2278 | ||
2279 | ||
2280 | //_____________________________________________________________________________ | |
2281 | void AliReconstruction::WriteESD(AliESDEvent* esd, const char* recStep) const | |
2282 | { | |
2283 | // write the ESD event to a file | |
2284 | ||
2285 | if (!esd) return; | |
2286 | char fileName[256]; | |
2287 | sprintf(fileName, "ESD_%d.%d_%s.root", | |
2288 | esd->GetRunNumber(), esd->GetEventNumberInFile(), recStep); | |
2289 | ||
2290 | AliDebug(1, Form("writing ESD to file %s", fileName)); | |
2291 | TFile* file = TFile::Open(fileName, "recreate"); | |
2292 | if (!file || !file->IsOpen()) { | |
2293 | AliError(Form("opening %s failed", fileName)); | |
2294 | } else { | |
2295 | esd->Write("ESD"); | |
2296 | file->Close(); | |
2297 | } | |
2298 | delete file; | |
2299 | } | |
2300 | ||
2301 | ||
2302 | void AliReconstruction::WriteAlignmentData(AliESDEvent* esd) | |
2303 | { | |
2304 | // Write space-points which are then used in the alignment procedures | |
2305 | // For the moment only ITS, TRD and TPC | |
2306 | ||
2307 | // Load TOF clusters | |
2308 | if (fTracker[3]){ | |
2309 | fLoader[3]->LoadRecPoints("read"); | |
2310 | TTree* tree = fLoader[3]->TreeR(); | |
2311 | if (!tree) { | |
2312 | AliError(Form("Can't get the %s cluster tree", fgkDetectorName[3])); | |
2313 | return; | |
2314 | } | |
2315 | fTracker[3]->LoadClusters(tree); | |
2316 | } | |
2317 | Int_t ntracks = esd->GetNumberOfTracks(); | |
2318 | for (Int_t itrack = 0; itrack < ntracks; itrack++) | |
2319 | { | |
2320 | AliESDtrack *track = esd->GetTrack(itrack); | |
2321 | Int_t nsp = 0; | |
2322 | Int_t idx[200]; | |
2323 | for (Int_t iDet = 3; iDet >= 0; iDet--) | |
2324 | nsp += track->GetNcls(iDet); | |
2325 | if (nsp) { | |
2326 | AliTrackPointArray *sp = new AliTrackPointArray(nsp); | |
2327 | track->SetTrackPointArray(sp); | |
2328 | Int_t isptrack = 0; | |
2329 | for (Int_t iDet = 3; iDet >= 0; iDet--) { | |
2330 | AliTracker *tracker = fTracker[iDet]; | |
2331 | if (!tracker) continue; | |
2332 | Int_t nspdet = track->GetNcls(iDet); | |
2333 | if (nspdet <= 0) continue; | |
2334 | track->GetClusters(iDet,idx); | |
2335 | AliTrackPoint p; | |
2336 | Int_t isp = 0; | |
2337 | Int_t isp2 = 0; | |
2338 | while (isp2 < nspdet) { | |
2339 | Bool_t isvalid; | |
2340 | TString dets = fgkDetectorName[iDet]; | |
2341 | if ((fUseTrackingErrorsForAlignment.CompareTo(dets) == 0) || | |
2342 | fUseTrackingErrorsForAlignment.BeginsWith(dets+" ") || | |
2343 | fUseTrackingErrorsForAlignment.EndsWith(" "+dets) || | |
2344 | fUseTrackingErrorsForAlignment.Contains(" "+dets+" ")) { | |
2345 | isvalid = tracker->GetTrackPointTrackingError(idx[isp2],p,track); | |
2346 | } else { | |
2347 | isvalid = tracker->GetTrackPoint(idx[isp2],p); | |
2348 | } | |
2349 | isp2++; | |
2350 | const Int_t kNTPCmax = 159; | |
2351 | if (iDet==1 && isp2>kNTPCmax) break; // to be fixed | |
2352 | if (!isvalid) continue; | |
2353 | sp->AddPoint(isptrack,&p); isptrack++; isp++; | |
2354 | } | |
2355 | } | |
2356 | } | |
2357 | } | |
2358 | if (fTracker[3]){ | |
2359 | fTracker[3]->UnloadClusters(); | |
2360 | fLoader[3]->UnloadRecPoints(); | |
2361 | } | |
2362 | } | |
2363 | ||
2364 | //_____________________________________________________________________________ | |
2365 | void AliReconstruction::FillRawDataErrorLog(Int_t iEvent, AliESDEvent* esd) | |
2366 | { | |
2367 | // The method reads the raw-data error log | |
2368 | // accumulated within the rawReader. | |
2369 | // It extracts the raw-data errors related to | |
2370 | // the current event and stores them into | |
2371 | // a TClonesArray inside the esd object. | |
2372 | ||
2373 | if (!fRawReader) return; | |
2374 | ||
2375 | for(Int_t i = 0; i < fRawReader->GetNumberOfErrorLogs(); i++) { | |
2376 | ||
2377 | AliRawDataErrorLog *log = fRawReader->GetErrorLog(i); | |
2378 | if (!log) continue; | |
2379 | if (iEvent != log->GetEventNumber()) continue; | |
2380 | ||
2381 | esd->AddRawDataErrorLog(log); | |
2382 | } | |
2383 | ||
2384 | } | |
2385 | ||
2386 | TNamed* AliReconstruction::CopyFileToTNamed(TString fPath,TString fName){ | |
2387 | // Dump a file content into a char in TNamed | |
2388 | ifstream in; | |
2389 | in.open(fPath.Data(),ios::in | ios::binary|ios::ate); | |
2390 | Int_t kBytes = (Int_t)in.tellg(); | |
2391 | printf("Size: %d \n",kBytes); | |
2392 | TNamed *fn = 0; | |
2393 | if(in.good()){ | |
2394 | char* memblock = new char [kBytes]; | |
2395 | in.seekg (0, ios::beg); | |
2396 | in.read (memblock, kBytes); | |
2397 | in.close(); | |
2398 | TString fData(memblock,kBytes); | |
2399 | fn = new TNamed(fName,fData); | |
2400 | printf("fData Size: %d \n",fData.Sizeof()); | |
2401 | printf("fName Size: %d \n",fName.Sizeof()); | |
2402 | printf("fn Size: %d \n",fn->Sizeof()); | |
2403 | delete[] memblock; | |
2404 | } | |
2405 | else{ | |
2406 | AliInfo(Form("Could not Open %s\n",fPath.Data())); | |
2407 | } | |
2408 | ||
2409 | return fn; | |
2410 | } | |
2411 | ||
2412 | void AliReconstruction::TNamedToFile(TTree* fTree, TString fName){ | |
2413 | // This is not really needed in AliReconstruction at the moment | |
2414 | // but can serve as a template | |
2415 | ||
2416 | TList *fList = fTree->GetUserInfo(); | |
2417 | TNamed *fn = (TNamed*)fList->FindObject(fName.Data()); | |
2418 | printf("fn Size: %d \n",fn->Sizeof()); | |
2419 | ||
2420 | TString fTmp(fn->GetName()); // to be 100% sure in principle fName also works | |
2421 | const char* cdata = fn->GetTitle(); | |
2422 | printf("fTmp Size %d\n",fTmp.Sizeof()); | |
2423 | ||
2424 | int size = fn->Sizeof()-fTmp.Sizeof()-sizeof(UChar_t)-sizeof(Int_t); // see dfinition of TString::SizeOf()... | |
2425 | printf("calculated size %d\n",size); | |
2426 | ofstream out(fName.Data(),ios::out | ios::binary); | |
2427 | out.write(cdata,size); | |
2428 | out.close(); | |
2429 | ||
2430 | } | |
2431 | ||
2432 | //_____________________________________________________________________________ | |
2433 | AliQADataMakerRec * AliReconstruction::GetQADataMaker(Int_t iDet) | |
2434 | { | |
2435 | // get the quality assurance data maker object and the loader for a detector | |
2436 | ||
2437 | if (fQADataMaker[iDet]) | |
2438 | return fQADataMaker[iDet]; | |
2439 | ||
2440 | AliQADataMakerRec * qadm = NULL; | |
2441 | if (iDet == fgkNDetectors) { //Global QA | |
2442 | qadm = new AliGlobalQADataMaker(); | |
2443 | fQADataMaker[iDet] = qadm; | |
2444 | return qadm; | |
2445 | } | |
2446 | ||
2447 | // load the QA data maker object | |
2448 | TPluginManager* pluginManager = gROOT->GetPluginManager(); | |
2449 | TString detName = fgkDetectorName[iDet]; | |
2450 | TString qadmName = "Ali" + detName + "QADataMakerRec"; | |
2451 | if (!fIsNewRunLoader && !fRunLoader->GetLoader(detName+"Loader") && (detName != "HLT")) | |
2452 | return NULL; | |
2453 | ||
2454 | // first check if a plugin is defined for the quality assurance data maker | |
2455 | TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMakerRec", detName); | |
2456 | // if not, add a plugin for it | |
2457 | if (!pluginHandler) { | |
2458 | AliDebug(1, Form("defining plugin for %s", qadmName.Data())); | |
2459 | TString libs = gSystem->GetLibraries(); | |
2460 | if (libs.Contains("lib" + detName + "base.so") || | |
2461 | (gSystem->Load("lib" + detName + "base.so") >= 0)) { | |
2462 | pluginManager->AddHandler("AliQADataMakerRec", detName, | |
2463 | qadmName, detName + "qadm", qadmName + "()"); | |
2464 | } else { | |
2465 | pluginManager->AddHandler("AliQADataMakerRec", detName, | |
2466 | qadmName, detName, qadmName + "()"); | |
2467 | } | |
2468 | pluginHandler = pluginManager->FindHandler("AliQADataMakerRec", detName); | |
2469 | } | |
2470 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { | |
2471 | qadm = (AliQADataMakerRec *) pluginHandler->ExecPlugin(0); | |
2472 | } | |
2473 | ||
2474 | fQADataMaker[iDet] = qadm; | |
2475 | ||
2476 | return qadm; | |
2477 | } | |
2478 | ||
2479 | //_____________________________________________________________________________ | |
2480 | Bool_t AliReconstruction::RunQA(const char* detectors, AliESDEvent *& esd) | |
2481 | { | |
2482 | // run the Quality Assurance data producer | |
2483 | ||
2484 | AliCodeTimerAuto("") | |
2485 | TString detStr = detectors; | |
2486 | for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
2487 | if (!IsSelected(fgkDetectorName[iDet], detStr)) | |
2488 | continue; | |
2489 | AliQADataMakerRec * qadm = GetQADataMaker(iDet); | |
2490 | if (!qadm) | |
2491 | continue; | |
2492 | AliCodeTimerStart(Form("running quality assurance data maker for %s", fgkDetectorName[iDet])); | |
2493 | AliInfo(Form("running quality assurance data maker for %s", fgkDetectorName[iDet])); | |
2494 | ||
2495 | qadm->Exec(AliQA::kESDS, esd) ; | |
2496 | qadm->Increment() ; | |
2497 | ||
2498 | AliCodeTimerStop(Form("running quality assurance data maker for %s", fgkDetectorName[iDet])); | |
2499 | } | |
2500 | if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { | |
2501 | AliError(Form("the following detectors were not found: %s", | |
2502 | detStr.Data())); | |
2503 | if (fStopOnError) | |
2504 | return kFALSE; | |
2505 | } | |
2506 | ||
2507 | return kTRUE; | |
2508 | ||
2509 | } | |
2510 | ||
2511 | //_____________________________________________________________________________ | |
2512 | void AliReconstruction::CheckQA() | |
2513 | { | |
2514 | // check the QA of SIM for this run and remove the detectors | |
2515 | // with status Fatal | |
2516 | ||
2517 | TString newRunLocalReconstruction ; | |
2518 | TString newRunTracking ; | |
2519 | TString newFillESD ; | |
2520 | ||
2521 | for (Int_t iDet = 0; iDet < AliQA::kNDET; iDet++) { | |
2522 | TString detName(AliQA::GetDetName(iDet)) ; | |
2523 | AliQA * qa = AliQA::Instance(AliQA::DETECTORINDEX_t(iDet)) ; | |
2524 | if ( qa->IsSet(AliQA::DETECTORINDEX_t(iDet), AliQA::kSIM, AliQA::kFATAL)) { | |
2525 | AliInfo(Form("QA status for %s in Hits and/or SDIGITS and/or Digits was Fatal; No reconstruction performed", detName.Data())) ; | |
2526 | } else { | |
2527 | if ( fRunLocalReconstruction.Contains(AliQA::GetDetName(iDet)) || | |
2528 | fRunLocalReconstruction.Contains("ALL") ) { | |
2529 | newRunLocalReconstruction += detName ; | |
2530 | newRunLocalReconstruction += " " ; | |
2531 | } | |
2532 | if ( fRunTracking.Contains(AliQA::GetDetName(iDet)) || | |
2533 | fRunTracking.Contains("ALL") ) { | |
2534 | newRunTracking += detName ; | |
2535 | newRunTracking += " " ; | |
2536 | } | |
2537 | if ( fFillESD.Contains(AliQA::GetDetName(iDet)) || | |
2538 | fFillESD.Contains("ALL") ) { | |
2539 | newFillESD += detName ; | |
2540 | newFillESD += " " ; | |
2541 | } | |
2542 | } | |
2543 | } | |
2544 | fRunLocalReconstruction = newRunLocalReconstruction ; | |
2545 | fRunTracking = newRunTracking ; | |
2546 | fFillESD = newFillESD ; | |
2547 | } | |
2548 | ||
2549 | //_____________________________________________________________________________ | |
2550 | Int_t AliReconstruction::GetDetIndex(const char* detector) | |
2551 | { | |
2552 | // return the detector index corresponding to detector | |
2553 | Int_t index = -1 ; | |
2554 | for (index = 0; index < fgkNDetectors ; index++) { | |
2555 | if ( strcmp(detector, fgkDetectorName[index]) == 0 ) | |
2556 | break ; | |
2557 | } | |
2558 | return index ; | |
2559 | } | |
2560 | //_____________________________________________________________________________ | |
2561 | Bool_t AliReconstruction::FinishPlaneEff() { | |
2562 | // | |
2563 | // Here execute all the necessary operationis, at the end of the tracking phase, | |
2564 | // in case that evaluation of PlaneEfficiencies was required for some detector. | |
2565 | // E.g., write into a DataBase file the PlaneEfficiency which have been evaluated. | |
2566 | // | |
2567 | // This Preliminary version works only FOR ITS !!!!! | |
2568 | // other detectors (TOF,TRD, etc. have to develop their specific codes) | |
2569 | // | |
2570 | // Input: none | |
2571 | // Return: kTRUE if all operations have been done properly, kFALSE otherwise | |
2572 | // | |
2573 | Bool_t ret=kFALSE; | |
2574 | //for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
2575 | for (Int_t iDet = 0; iDet < 1; iDet++) { // for the time being only ITS | |
2576 | //if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; | |
2577 | if(fTracker[iDet]) { | |
2578 | AliPlaneEff *planeeff=fTracker[iDet]->GetPlaneEff(); | |
2579 | ret=planeeff->WriteIntoCDB(); | |
2580 | if(planeeff->GetCreateHistos()) { | |
2581 | TString name="PlaneEffHisto"; | |
2582 | name+=fgkDetectorName[iDet]; | |
2583 | name+=".root"; | |
2584 | ret*=planeeff->WriteHistosToFile(name,"RECREATE"); | |
2585 | } | |
2586 | } | |
2587 | } | |
2588 | return ret; | |
2589 | } | |
2590 | //_____________________________________________________________________________ | |
2591 | Bool_t AliReconstruction::InitPlaneEff() { | |
2592 | // | |
2593 | // Here execute all the necessary operations, before of the tracking phase, | |
2594 | // for the evaluation of PlaneEfficiencies, in case required for some detectors. | |
2595 | // E.g., read from a DataBase file a first evaluation of the PlaneEfficiency | |
2596 | // which should be updated/recalculated. | |
2597 | // | |
2598 | // This Preliminary version will work only FOR ITS !!!!! | |
2599 | // other detectors (TOF,TRD, etc. have to develop their specific codes) | |
2600 | // | |
2601 | // Input: none | |
2602 | // Return: kTRUE if all operations have been done properly, kFALSE otherwise | |
2603 | // | |
2604 | AliWarning(Form("Implementation of this method not yet done !! Method return kTRUE")); | |
2605 | return kTRUE; | |
2606 | } |