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