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