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