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