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