Setting of aliases to rawReader done only once. Base decision on cosmic or calib...
[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
962 if(fRawReader) {
963 if(fRawReader->NextEvent()) {
964 if(man->GetRun() > 0) {
21a3aa09 965 AliWarning("Run number is taken from raw-event header! Ignoring settings in AliCDBManager!");
4b71572b 966 }
967 man->SetRun(fRawReader->GetRunNumber());
532fe099 968 GetEventInfo();
4b71572b 969 fRawReader->RewindEvents();
970 }
971 else {
972 if(man->GetRun() > 0) {
973 AliWarning("No raw-data events are found ! Using settings in AliCDBManager !");
974 }
975 else {
976 AliWarning("Neither raw events nor settings in AliCDBManager are found !");
977 return kFALSE;
978 }
979 }
980 }
981 else {
982 AliRunLoader *rl = AliRunLoader::Open(fGAliceFileName.Data());
983 if (!rl) {
984 AliError(Form("No run loader found in file %s", fGAliceFileName.Data()));
6bae477a 985 return kFALSE;
986 }
ec92bee0 987 else {
4b71572b 988 rl->LoadHeader();
989 // read run number from gAlice
990 if(rl->GetHeader()) {
991 man->SetRun(rl->GetHeader()->GetRun());
992 rl->UnloadHeader();
993 delete rl;
ec92bee0 994 }
995 else {
4b71572b 996 AliError("Neither run-loader header nor RawReader objects are found !");
997 delete rl;
ec92bee0 998 return kFALSE;
999 }
4b71572b 1000 }
6bae477a 1001 }
795e4a22 1002
1003 man->Print();
1004
6bae477a 1005 return kTRUE;
1006}
1007
1008//_____________________________________________________________________________
795e4a22 1009void AliReconstruction::SetCDBLock() {
1010 // Set CDB lock: from now on it is forbidden to reset the run number
1011 // or the default storage or to activate any further storage!
1012
1013 AliCDBManager::Instance()->SetLock(1);
1014}
1015
1016//_____________________________________________________________________________
f9fc20b4 1017void AliReconstruction::MatchUpgradeDetector() {
1018 // Translates detector name in a boolean.
1019 // The boolean is used in GetReconstructor to load the
1020 // upgrade reconstructor instead of the standard one.
1021 for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
1022 if(fUpgradeModule.Contains(fgkDetectorName[iDet])) fUpgradeMask[iDet]=kTRUE;
1023 }
1024}
1025//_____________________________________________________________________________
6bae477a 1026Bool_t AliReconstruction::MisalignGeometry(const TString& detectors)
1027{
1028 // Read the alignment objects from CDB.
1029 // Each detector is supposed to have the
1030 // alignment objects in DET/Align/Data CDB path.
1031 // All the detector objects are then collected,
1032 // sorted by geometry level (starting from ALIC) and
1033 // then applied to the TGeo geometry.
1034 // Finally an overlaps check is performed.
1035
1036 // Load alignment data from CDB and fill fAlignObjArray
1037 if(fLoadAlignFromCDB){
6bae477a 1038
25be1e5c 1039 TString detStr = detectors;
1040 TString loadAlObjsListOfDets = "";
1041
ac4a7581 1042 for (Int_t iDet = 0; iDet < kNDetectors; iDet++) {
8cb26cdf 1043 if(!IsSelected(fgkDetectorName[iDet], detStr)) continue;
f12d42ce 1044 if(!strcmp(fgkDetectorName[iDet],"HLT")) continue;
4fbb8e9d 1045
1046 if(AliGeomManager::GetNalignable(fgkDetectorName[iDet]) != 0)
8cb26cdf 1047 {
1048 loadAlObjsListOfDets += fgkDetectorName[iDet];
1049 loadAlObjsListOfDets += " ";
1050 }
25be1e5c 1051 } // end loop over detectors
4fbb8e9d 1052
1053 if(AliGeomManager::GetNalignable("GRP") != 0)
8cb26cdf 1054 loadAlObjsListOfDets.Prepend("GRP "); //add alignment objects for non-sensitive modules
98e303d9 1055 AliGeomManager::ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data());
25be1e5c 1056 }else{
1057 // Check if the array with alignment objects was
1058 // provided by the user. If yes, apply the objects
1059 // to the present TGeo geometry
1060 if (fAlignObjArray) {
1061 if (gGeoManager && gGeoManager->IsClosed()) {
98e303d9 1062 if (AliGeomManager::ApplyAlignObjsToGeom(*fAlignObjArray) == kFALSE) {
25be1e5c 1063 AliError("The misalignment of one or more volumes failed!"
1064 "Compare the list of simulated detectors and the list of detector alignment data!");
1065 return kFALSE;
1066 }
1067 }
1068 else {
1069 AliError("Can't apply the misalignment! gGeoManager doesn't exist or it is still opened!");
6bae477a 1070 return kFALSE;
1071 }
1072 }
6bae477a 1073 }
25be1e5c 1074
4b71572b 1075 if (fAlignObjArray) {
1076 fAlignObjArray->Delete();
1077 delete fAlignObjArray; fAlignObjArray=NULL;
1078 }
a03b0371 1079
6bae477a 1080 return kTRUE;
1081}
596a855f 1082
1083//_____________________________________________________________________________
1084void AliReconstruction::SetGAliceFile(const char* fileName)
1085{
1086// set the name of the galice file
1087
1088 fGAliceFileName = fileName;
1089}
1090
efd2085e 1091//_____________________________________________________________________________
b58710ef 1092void AliReconstruction::SetInput(const char* input)
21a3aa09 1093{
b58710ef 1094 // In case the input string starts with 'mem://', we run in an online mode
1095 // and AliRawReaderDateOnline object is created. In all other cases a raw-data
1096 // file is assumed. One can give as an input:
1097 // mem://: - events taken from DAQ monitoring libs online
1098 // or
1099 // mem://<filename> - emulation of the above mode (via DATE monitoring libs)
4b71572b 1100 if (input) fRawInput = input;
21a3aa09 1101}
1102
1103//_____________________________________________________________________________
975320a0 1104void AliReconstruction::SetOutput(const char* output)
1105{
1106 // Set the output ESD filename
1107 // 'output' is a normalt ROOT url
1108 // The method is used in case of raw-data reco with PROOF
81d57268 1109 if (output) fESDOutput = output;
975320a0 1110}
1111
1112//_____________________________________________________________________________
efd2085e 1113void AliReconstruction::SetOption(const char* detector, const char* option)
1114{
1115// set options for the reconstruction of a detector
1116
1117 TObject* obj = fOptions.FindObject(detector);
1118 if (obj) fOptions.Remove(obj);
1119 fOptions.Add(new TNamed(detector, option));
1120}
1121
596a855f 1122//_____________________________________________________________________________
7e88424f 1123void AliReconstruction::SetRecoParam(const char* detector, AliDetectorRecoParam *par)
1124{
1125 // Set custom reconstruction parameters for a given detector
1126 // Single set of parameters for all the events
a00021a7 1127
1128 // First check if the reco-params are global
1129 if(!strcmp(detector, "GRP")) {
1130 par->SetAsDefault();
ac4a7581 1131 fRecoParam.AddDetRecoParam(kNDetectors,par);
a00021a7 1132 return;
1133 }
1134
ac4a7581 1135 for (Int_t iDet = 0; iDet < kNDetectors; iDet++) {
7e88424f 1136 if(!strcmp(detector, fgkDetectorName[iDet])) {
1137 par->SetAsDefault();
1138 fRecoParam.AddDetRecoParam(iDet,par);
1139 break;
1140 }
1141 }
1142
1143}
1144
1145//_____________________________________________________________________________
61807e09 1146Bool_t AliReconstruction::InitGRP() {
1147 //------------------------------------
1148 // Initialization of the GRP entry
1149 //------------------------------------
1150 AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data");
1151
4b71572b 1152 if (entry) {
44e45fac 1153
1154 TMap* m = dynamic_cast<TMap*>(entry->GetObject()); // old GRP entry
1155
1156 if (m) {
1157 AliInfo("Found a TMap in GRP/GRP/Data, converting it into an AliGRPObject");
1158 m->Print();
1159 fGRPData = new AliGRPObject();
1160 fGRPData->ReadValuesFromMap(m);
1161 }
1162
1163 else {
1164 AliInfo("Found an AliGRPObject in GRP/GRP/Data, reading it");
1165 fGRPData = dynamic_cast<AliGRPObject*>(entry->GetObject()); // new GRP entry
1166 entry->SetOwner(0);
1167 }
1168
f168abba 1169 // FIX ME: The unloading of GRP entry is temporarily disabled
1170 // because ZDC and VZERO are using it in order to initialize
1171 // their reconstructor objects. In the future one has to think
1172 // of propagating AliRunInfo to the reconstructors.
1173 // AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data");
4b71572b 1174 }
61807e09 1175
1176 if (!fGRPData) {
1177 AliError("No GRP entry found in OCDB!");
1178 return kFALSE;
1179 }
1180
44e45fac 1181 TString lhcState = fGRPData->GetLHCState();
1182 if (lhcState==AliGRPObject::GetInvalidString()) {
7e88424f 1183 AliError("GRP/GRP/Data entry: missing value for the LHC state ! Using UNKNOWN");
44e45fac 1184 lhcState = "UNKNOWN";
7e88424f 1185 }
1186
44e45fac 1187 TString beamType = fGRPData->GetBeamType();
1188 if (beamType==AliGRPObject::GetInvalidString()) {
7e88424f 1189 AliError("GRP/GRP/Data entry: missing value for the beam type ! Using UNKNOWN");
44e45fac 1190 beamType = "UNKNOWN";
7e88424f 1191 }
1192
44e45fac 1193 Float_t beamEnergy = fGRPData->GetBeamEnergy();
1194 if (beamEnergy==AliGRPObject::GetInvalidFloat()) {
7e88424f 1195 AliError("GRP/GRP/Data entry: missing value for the beam energy ! Using 0");
44e45fac 1196 beamEnergy = 0;
7e88424f 1197 }
1198
44e45fac 1199 TString runType = fGRPData->GetRunType();
1200 if (runType==AliGRPObject::GetInvalidString()) {
7e88424f 1201 AliError("GRP/GRP/Data entry: missing value for the run type ! Using UNKNOWN");
44e45fac 1202 runType = "UNKNOWN";
7e88424f 1203 }
1204
44e45fac 1205 Int_t activeDetectors = fGRPData->GetDetectorMask();
a5dede5c 1206 if (activeDetectors==AliGRPObject::GetInvalidUInt()) {
7e88424f 1207 AliError("GRP/GRP/Data entry: missing value for the detector mask ! Using 1074790399");
44e45fac 1208 activeDetectors = 1074790399;
7e88424f 1209 }
820b4d9e 1210 AliDebug(1, Form("activeDetectors = %d", activeDetectors));
7e88424f 1211
44e45fac 1212 fRunInfo = new AliRunInfo(lhcState, beamType, beamEnergy, runType, activeDetectors);
44e45fac 1213 fRunInfo->Dump();
1214
7e88424f 1215
1216 // Process the list of active detectors
44e45fac 1217 if (activeDetectors) {
1218 UInt_t detMask = activeDetectors;
820b4d9e 1219 AliDebug(1, Form("Detector List = %s", fRunLocalReconstruction.Data()));
7a317bef 1220 fRunLocalReconstruction = MatchDetectorList(fRunLocalReconstruction,detMask);
820b4d9e 1221 AliDebug(1, Form("Detector List = %s", fRunLocalReconstruction.Data()));
7a317bef 1222 fRunTracking = MatchDetectorList(fRunTracking,detMask);
1223 fFillESD = MatchDetectorList(fFillESD,detMask);
1224 fQADetectors = MatchDetectorList(fQADetectors,detMask);
7b830a3f 1225 AliInfo(Form("fQADetectors=%s",fQADetectors.Data()));
e54c9180 1226 fDeleteRecPoints = MatchDetectorList(fDeleteRecPoints,detMask);
1227 fDeleteDigits = MatchDetectorList(fDeleteDigits,detMask);
7d566c20 1228 fLoadCDB.Form("%s %s %s %s",
1229 fRunLocalReconstruction.Data(),
1230 fRunTracking.Data(),
1231 fFillESD.Data(),
1232 fQADetectors.Data());
7d566c20 1233 fLoadCDB = MatchDetectorList(fLoadCDB,detMask);
d0f84c42 1234 if (!((detMask >> AliDAQ::DetectorID("ITSSPD")) & 0x1) &&
1235 !((detMask >> AliDAQ::DetectorID("ITSSDD")) & 0x1) &&
1236 !((detMask >> AliDAQ::DetectorID("ITSSSD")) & 0x1) ) {
91e2f025 1237 // switch off the vertexer
1f9831ab 1238 AliInfo("SPD,SDD,SSD is not in the list of active detectors. Vertexer and Trackleter are switched off.");
91e2f025 1239 fRunVertexFinder = kFALSE;
1f9831ab 1240 fRunMultFinder = kFALSE;
91e2f025 1241 }
304d7f0b 1242 if (!((detMask >> AliDAQ::DetectorID("TRG")) & 0x1)) {
1243 // switch off the reading of CTP raw-data payload
1244 if (fFillTriggerESD) {
1245 AliInfo("CTP is not in the list of active detectors. CTP data reading switched off.");
1246 fFillTriggerESD = kFALSE;
1247 }
1248 }
7e88424f 1249 }
1250
1251 AliInfo("===================================================================================");
1252 AliInfo(Form("Running local reconstruction for detectors: %s",fRunLocalReconstruction.Data()));
1253 AliInfo(Form("Running tracking for detectors: %s",fRunTracking.Data()));
1254 AliInfo(Form("Filling ESD for detectors: %s",fFillESD.Data()));
ca13fb87 1255 AliInfo(Form("Quality assurance is active for detectors: %s",fQADetectors.Data()));
7d566c20 1256 AliInfo(Form("CDB and reconstruction parameters are loaded for detectors: %s",fLoadCDB.Data()));
7e88424f 1257 AliInfo("===================================================================================");
61807e09 1258
1259 //*** Dealing with the magnetic field map
5a004fb4 1260 if ( TGeoGlobalMagField::Instance()->IsLocked() ) {
1261 if (TGeoGlobalMagField::Instance()->GetField()->TestBit(AliMagF::kOverrideGRP)) {
1262 AliInfo("ExpertMode!!! GRP information will be ignored !");
1263 AliInfo("ExpertMode!!! Running with the externally locked B field !");
1264 }
1265 else {
1266 AliInfo("Destroying existing B field instance!");
1267 delete TGeoGlobalMagField::Instance();
1268 }
1269 }
1270 if ( !TGeoGlobalMagField::Instance()->IsLocked() ) {
61807e09 1271 // Construct the field map out of the information retrieved from GRP.
856024f0 1272 Bool_t ok = kTRUE;
61807e09 1273 // L3
44e45fac 1274 Float_t l3Current = fGRPData->GetL3Current((AliGRPObject::Stats)0);
1275 if (l3Current == AliGRPObject::GetInvalidFloat()) {
1276 AliError("GRP/GRP/Data entry: missing value for the L3 current !");
1277 ok = kFALSE;
1278 }
f7a1cc68 1279
44e45fac 1280 Char_t l3Polarity = fGRPData->GetL3Polarity();
1281 if (l3Polarity == AliGRPObject::GetInvalidChar()) {
1282 AliError("GRP/GRP/Data entry: missing value for the L3 polarity !");
1283 ok = kFALSE;
1284 }
1285
1286 // Dipole
1287 Float_t diCurrent = fGRPData->GetDipoleCurrent((AliGRPObject::Stats)0);
1288 if (diCurrent == AliGRPObject::GetInvalidFloat()) {
1289 AliError("GRP/GRP/Data entry: missing value for the dipole current !");
1290 ok = kFALSE;
1291 }
1292
1293 Char_t diPolarity = fGRPData->GetDipolePolarity();
1294 if (diPolarity == AliGRPObject::GetInvalidChar()) {
1295 AliError("GRP/GRP/Data entry: missing value for the dipole polarity !");
1296 ok = kFALSE;
1297 }
1298
99c7d495 1299 // read special bits for the polarity convention and map type
1300 Int_t polConvention = fGRPData->IsPolarityConventionLHC() ? AliMagF::kConvLHC : AliMagF::kConvDCS2008;
1301 Bool_t uniformB = fGRPData->IsUniformBMap();
61807e09 1302
856024f0 1303 if (ok) {
33fe5eb1 1304 AliMagF* fld = AliMagF::CreateFieldMap(TMath::Abs(l3Current) * (l3Polarity ? -1:1),
1305 TMath::Abs(diCurrent) * (diPolarity ? -1:1),
1306 polConvention,uniformB,beamEnergy, beamType.Data());
1307 if (fld) {
1308 TGeoGlobalMagField::Instance()->SetField( fld );
1309 TGeoGlobalMagField::Instance()->Lock();
1310 AliInfo("Running with the B field constructed out of GRP !");
1311 }
1312 else AliFatal("Failed to create a B field map !");
856024f0 1313 }
f7a1cc68 1314 else AliFatal("B field is neither set nor constructed from GRP ! Exitig...");
61807e09 1315 }
f7a1cc68 1316
f2a195c1 1317 //*** Get the diamond profiles from OCDB
1318 entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexSPD");
1319 if (entry) {
1320 fDiamondProfileSPD = dynamic_cast<AliESDVertex*> (entry->GetObject());
1321 } else {
1322 AliError("No SPD diamond profile found in OCDB!");
1323 }
1324
61807e09 1325 entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertex");
1326 if (entry) {
f2a195c1 1327 fDiamondProfile = dynamic_cast<AliESDVertex*> (entry->GetObject());
61807e09 1328 } else {
1329 AliError("No diamond profile found in OCDB!");
1330 }
1331
1332 entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexTPC");
1333 if (entry) {
f2a195c1 1334 fDiamondProfileTPC = dynamic_cast<AliESDVertex*> (entry->GetObject());
61807e09 1335 } else {
f2a195c1 1336 AliError("No TPC diamond profile found in OCDB!");
61807e09 1337 }
1338
1339 return kTRUE;
1340}
1341
1342//_____________________________________________________________________________
4b71572b 1343Bool_t AliReconstruction::LoadCDB()
1344{
0a035be5 1345 // Load CDB entries for all active detectors.
1346 // By default we load all the entries in <det>/Calib
1347 // folder.
1348
52dd4a8c 1349 AliCodeTimerAuto("",0);
4b71572b 1350
1351 AliCDBManager::Instance()->Get("GRP/CTP/Config");
1352
30d5d647 1353 AliCDBManager::Instance()->Get("GRP/Calib/LHCClockPhase");
1354
7d566c20 1355 TString detStr = fLoadCDB;
ac4a7581 1356 for (Int_t iDet = 0; iDet < kNDetectors; iDet++) {
4b71572b 1357 if (!IsSelected(fgkDetectorName[iDet], detStr)) continue;
1358 AliCDBManager::Instance()->GetAll(Form("%s/Calib/*",fgkDetectorName[iDet]));
b6af2cb6 1359 AliCDBManager::Instance()->GetAll(Form("%s/Trigger/*",fgkDetectorName[iDet]));
4b71572b 1360 }
e122592f 1361
1362 // Temporary fix - one has to define the correct policy in order
1363 // to load the trigger OCDB entries only for the detectors that
1364 // in the trigger or that are needed in order to put correct
1365 // information in ESD
1366 AliCDBManager::Instance()->GetAll("TRIGGER/*/*");
e6608c2e 1367 AliCDBManager::Instance()->GetAll("HLT/*/*");
e122592f 1368
505082ca 1369 AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/Calib/CosmicTriggers");
1370 if (entry) {
1371 fListOfCosmicTriggers = dynamic_cast<THashTable*>(entry->GetObject());
1372 entry->SetOwner(0);
1373 }
1374 //
1375 if (!fListOfCosmicTriggers) {
1376 AliWarning("Can not get list of cosmic triggers from OCDB! Cosmic event specie will rely on aliases if defined");
1377 }
1378
1379
4b71572b 1380 return kTRUE;
1381}
522fdd91 1382//_____________________________________________________________________________
1383Bool_t AliReconstruction::LoadTriggerScalersCDB()
1384{
0a035be5 1385 // Load CTP scalers from OCDB.
1386 // The scalers are checked for consistency.
1387
52dd4a8c 1388 AliCodeTimerAuto("",0);
522fdd91 1389
1390 AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/CTP/Scalers");
4b71572b 1391
522fdd91 1392 if (entry) {
1393
1394 AliInfo("Found an AliTriggerRunScalers in GRP/CTP/Scalers, reading it");
1395 fRunScalers = dynamic_cast<AliTriggerRunScalers*> (entry->GetObject());
1396 entry->SetOwner(0);
c7a22819 1397 if (fRunScalers && (fRunScalers->CorrectScalersOverflow() == 0)) AliInfo("32bit Trigger counters corrected for overflow");
82ebedd6 1398
522fdd91 1399 }
1400 return kTRUE;
1401}
4b71572b 1402//_____________________________________________________________________________
52dd4a8c 1403Bool_t AliReconstruction::LoadCTPTimeParamsCDB()
1404{
0a035be5 1405 // Load CTP timing information (alignment)
1406 // from OCDB.
1407
52dd4a8c 1408 AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
c7ff1a33 1409 if (!entry) return kFALSE;
52dd4a8c 1410
c7ff1a33 1411 AliInfo("Found an AliCTPTimeParams in GRP/CTP/CTPtiming, reading it");
1412 fCTPTimeParams = dynamic_cast<AliCTPTimeParams*> (entry->GetObject());
1413 entry->SetOwner(0);
52dd4a8c 1414
c7ff1a33 1415 AliCDBEntry* entry2 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
1416 if (!entry2) return kFALSE;
1417
1418 AliInfo("Found an AliCTPTimeParams in GRP/CTP/TimeAlign, reading it");
028be258 1419 fCTPTimeAlign = dynamic_cast<AliCTPTimeParams*> (entry2->GetObject());
1420 entry2->SetOwner(0);
c7ff1a33 1421
1422 return kTRUE;
52dd4a8c 1423}
3d84ad67 1424
1425//_____________________________________________________________________________
1426Bool_t AliReconstruction::ReadIntensityInfoCDB()
1427{
1428 // Load LHC DIP data
2af04ffd 1429 AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/LHCData");
1430 AliCDBEntry* entryCTP = AliCDBManager::Instance()->Get("GRP/CTP/Config");
1431 //
bc5c8516 1432 if (!entry || !entryCTP) {
1433 AliError(Form("Failed to extract CDB objects GRP/GRP/LHCData: %p or GRP/CTP/Config: %p",entry,entryCTP));
1434 return kFALSE;
1435 }
2af04ffd 1436 // extract BC masks
1437 enum {kA,kB,kC,kE,kNMasks};
1438 AliTriggerConfiguration* conf = (AliTriggerConfiguration*)entryCTP->GetObject();
1439 const TObjArray& clArr = conf->GetClasses();
1440 TObjArray masks(kNMasks);
1441 TIter next(&clArr);
1442 AliTriggerClass* trClass = 0;
1443 int nFound = 0;
1444 masks.SetOwner(kFALSE);
1445 //
1446 while ( (trClass=(AliTriggerClass*)next()) ) {
1447 TString trName = trClass->GetName();
1448 int ind = trName.Index("-"); // prefix in front of A,B,C,E
1449 if (ind<1) continue; // anomaly
1450 //
1451 trName = trName.Data() + ind;
1452 AliTriggerBCMask* bcMask = trClass->GetBCMask();
1453 if (!bcMask) continue;
1454 UInt_t which = 0;
1455 if (trName.BeginsWith("-A-")) which |= 0x1<<kA;
1456 else if (trName.BeginsWith("-B-")) which |= 0x1<<kB;
1457 else if (trName.BeginsWith("-C-")) which |= 0x1<<kC;
1458 else if (trName.BeginsWith("-E-")) which |= 0x1<<kE;
1459 else if (trName.BeginsWith("-AC-")) which |= (0x1<<kA) | (0x1<<kC);
1460 else if (trName.BeginsWith("-CA-")) which |= (0x1<<kA) | (0x1<<kC);
1461 else { AliWarning(Form("Unknown trigger type %s\n",trClass->GetName())); continue;}
1462 //
1463 for (int ip=kNMasks;ip--;) {
1464 if ( !(which&(0x1<<ip)) || masks[ip] ) continue; // does not match or already done
1465 masks[ip] = (TObject*)bcMask;
1466 nFound++;
1467 }
1468 if (nFound==kNMasks) break;
1469 }
1470 //
1471 AliInfo("Reading mean bunch intensities from GRP/GRP/LHCData");
1472 AliLHCData* dipData = dynamic_cast<AliLHCData*> (entry->GetObject());
1473 //
1474 for (int ib=2;ib--;) {
1475 double intI,intNI;
1476 if (dipData && (dipData->GetMeanIntensity(ib,intI,intNI,&masks)>=0)) {
1477 fBeamInt[ib][0] = intI;
1478 fBeamInt[ib][1] = intNI;
1479 AliInfo(Form("Mean intensity for beam %d: Interacting:%.2e Non-Interacting:%.2e",ib,intI,intNI));
3d84ad67 1480 }
3d84ad67 1481 }
2af04ffd 1482 return kTRUE;
1483 //
3d84ad67 1484}
1485
1486
52dd4a8c 1487//_____________________________________________________________________________
21a3aa09 1488Bool_t AliReconstruction::Run(const char* input)
596a855f 1489{
21a3aa09 1490 // Run Run Run
52dd4a8c 1491 AliCodeTimerAuto("",0);
596a855f 1492
4b71572b 1493 InitRun(input);
1494 if (GetAbort() != TSelector::kContinue) return kFALSE;
1495
1496 TChain *chain = NULL;
1497 if (fRawReader && (chain = fRawReader->GetChain())) {
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 //
1612 ProcessTriggerAliases();
1613 //
002c9d1b 1614}
1615
1616//_____________________________________________________________________________
1617void AliReconstruction::Begin(TTree *)
1618{
1619 // Initialize AlReconstruction before
1620 // going into the event loop
1621 // Should follow the TSelector convention
1622 // i.e. initialize only the object on the client side
52dd4a8c 1623 AliCodeTimerAuto("",0);
d2dfcd12 1624
b4fef0d2 1625 AliReconstruction *reco = NULL;
002c9d1b 1626 if (fInput) {
8fb1f1dc 1627 if ((reco = (AliReconstruction*)fInput->FindObject("AliReconstruction"))) {
002c9d1b 1628 *this = *reco;
002c9d1b 1629 }
1630 AliSysInfo::AddStamp("ReadInputInBegin");
1631 }
1632
6bae477a 1633 // Import ideal TGeo geometry and apply misalignment
49caaca8 1634 if (!AliGeomManager::GetGeometry()) {
6bae477a 1635 TString geom(gSystem->DirName(fGAliceFileName));
1636 geom += "/geometry.root";
98e303d9 1637 AliGeomManager::LoadGeometry(geom.Data());
4b71572b 1638 if (!gGeoManager) {
1639 Abort("LoadGeometry", TSelector::kAbortProcess);
1640 return;
1641 }
281270d3 1642 AliSysInfo::AddStamp("LoadGeom");
ff5970a3 1643 TString detsToCheck=fRunLocalReconstruction;
4b71572b 1644 if(!AliGeomManager::CheckSymNamesLUT(detsToCheck.Data())) {
1645 Abort("CheckSymNamesLUT", TSelector::kAbortProcess);
1646 return;
1647 }
281270d3 1648 AliSysInfo::AddStamp("CheckGeom");
6bae477a 1649 }
8e245d15 1650
7ec0d3df 1651 Bool_t toCDBSnapshot=kFALSE;
1652 TString snapshotFileOut(""); // we could use fSnapshotFileName if we are not interested
1653 // in reading from and writing to a snapshot file at the same time
f3664c51 1654 if(TString(getenv("OCDB_SNAPSHOT_CREATE")) == TString("kTRUE")){
7ec0d3df 1655 toCDBSnapshot=kTRUE;
1656 //fFromCDBSnapshot=kFALSE;
f3664c51 1657 TString snapshotFile(getenv("OCDB_SNAPSHOT_FILENAME"));
7ec0d3df 1658 if(!(snapshotFile.IsNull() || snapshotFile.IsWhitespace()))
1659 snapshotFileOut = snapshotFile;
1660 else
1661 snapshotFileOut="OCDB.root";
1662 }
647d2bb8 1663
917768e3 1664 TString detStr(fLoadAlignData);
1665 if (!toCDBSnapshot) {
5c496970 1666 if (!MisalignGeometry(fLoadAlignData)) {
1667 Abort("MisalignGeometry", TSelector::kAbortProcess);
1668 return;
1669 }
917768e3 1670 } else {
1671 // when creating the snapshot, load the CDB alignment objects without applying them to the geometry
1672 for (Int_t iDet = 0; iDet < kNDetectors; iDet++) {
1673 if (!IsSelected(fgkDetectorName[iDet], detStr)) continue;
1674 if (!strcmp(fgkDetectorName[iDet],"HLT")) continue;
1675 if (AliGeomManager::GetNalignable(fgkDetectorName[iDet]) != 0)
1676 {
1677 TString detAlignPath = fgkDetectorName[iDet];
1678 detAlignPath += "/Align/Data";
1679 AliCDBManager::Instance()->Get(detAlignPath);
1680 }
1681 } // end loop over detectors
1682 if(AliGeomManager::GetNalignable("GRP") != 0)
1683 AliCDBManager::Instance()->Get("GRP/Align/Data");
4b71572b 1684 }
e9ce6cb7 1685
1686 const TMap* cdbCache = AliCDBManager::Instance()->GetEntryCache();
e945e641 1687 if(!toCDBSnapshot) {
1688 if(cdbCache->Contains("GRP/Geometry/Data"))
1689 AliCDBManager::Instance()->UnloadFromCache("GRP/Geometry/Data");
1690 AliCDBManager::Instance()->UnloadFromCache("*/Align/*");
1691 }
281270d3 1692 AliSysInfo::AddStamp("MisalignGeom");
6bae477a 1693
8cb26cdf 1694 if (!InitGRP()) {
1695 Abort("InitGRP", TSelector::kAbortProcess);
1696 return;
1697 }
1698 AliSysInfo::AddStamp("InitGRP");
e9ce6cb7 1699 if(!toCDBSnapshot)
1700 if(cdbCache->Contains("GRP/Calib/CosmicTriggers"))
1701 AliCDBManager::Instance()->UnloadFromCache("GRP/Calib/CosmicTriggers");
8cb26cdf 1702
989744a6 1703 if(!fCDBSnapshotMode || toCDBSnapshot){
647d2bb8 1704 if (!LoadCDB()) {
1705 Abort("LoadCDB", TSelector::kAbortProcess);
1706 return;
1707 }
989744a6 1708 AliSysInfo::AddStamp("LoadCDB");
4b71572b 1709 }
325aa76f 1710
a6dd87ad 1711 if (!LoadTriggerScalersCDB()) {
1712 Abort("LoadTriggerScalersCDB", TSelector::kAbortProcess);
1713 return;
1714 }
1715 AliSysInfo::AddStamp("LoadTriggerScalersCDB");
1716
52dd4a8c 1717 if (!LoadCTPTimeParamsCDB()) {
1718 Abort("LoadCTPTimeParamsCDB", TSelector::kAbortProcess);
1719 return;
1720 }
1721 AliSysInfo::AddStamp("LoadCTPTimeParamsCDB");
a6dd87ad 1722
bd26f597 1723 if (!ReadIntensityInfoCDB()) {
1724 Abort("ReadIntensityInfoCDB", TSelector::kAbortProcess);
1725 return;
1726 }
1727 AliSysInfo::AddStamp("ReadIntensityInfoCDB");
1728
7e88424f 1729 // Read the reconstruction parameters from OCDB
1730 if (!InitRecoParams()) {
002c9d1b 1731 AliWarning("Not all detectors have correct RecoParam objects initialized");
4b71572b 1732 }
1733 AliSysInfo::AddStamp("InitRecoParams");
1734
e0a6e696 1735 if(toCDBSnapshot)
989744a6 1736 {
c022b397 1737 AliCDBManager::Instance()->DumpToSnapshotFile(snapshotFileOut.Data(),kFALSE);
e973a743 1738 exit(0);
989744a6 1739 }
7ec0d3df 1740
fd2b273c 1741 if (fInput && gProof) {
b4fef0d2 1742 if (reco) *reco = *this;
fd2b273c 1743
45a6dee6 1744 gGeoManager->SetName("Geometry");
fd2b273c 1745 gProof->AddInputData(gGeoManager,kTRUE);
002c9d1b 1746 gGeoManager = NULL;
fd2b273c 1747 gProof->AddInputData(const_cast<TMap*>(AliCDBManager::Instance()->GetEntryCache()),kTRUE);
002c9d1b 1748 fInput->Add(new TParameter<Int_t>("RunNumber",AliCDBManager::Instance()->GetRun()));
f7a1cc68 1749 AliMagF *magFieldMap = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
ead7b391 1750 magFieldMap->SetName("MagneticFieldMap");
fd2b273c 1751 gProof->AddInputData(magFieldMap,kTRUE);
42457748 1752 if (fAnalysis) {
1753 fAnalysis->SetName("Analysis");
1754 gProof->AddInputData(fAnalysis,kTRUE);
1755 }
002c9d1b 1756 }
4b71572b 1757
1758}
1759
1760//_____________________________________________________________________________
1761void AliReconstruction::SlaveBegin(TTree*)
1762{
1763 // Initialization related to run-loader,
1764 // vertexer, trackers, recontructors
1765 // In proof mode it is executed on the slave
52dd4a8c 1766 AliCodeTimerAuto("",0);
4b71572b 1767
db4aeca1 1768 TProofOutputFile *outProofFile = NULL;
81d57268 1769 if (fInput) {
1770 if (AliDebugLevel() > 0) fInput->Print();
ef5e52f6 1771 if (AliDebugLevel() > 10) fInput->Dump();
db4aeca1 1772 if (AliReconstruction *reco = (AliReconstruction*)fInput->FindObject("AliReconstruction")) {
1773 *this = *reco;
1774 }
4b71572b 1775 if (TGeoManager *tgeo = (TGeoManager*)fInput->FindObject("Geometry")) {
1776 gGeoManager = tgeo;
1777 AliGeomManager::SetGeometry(tgeo);
7e88424f 1778 }
281270d3 1779 if (TMap *entryCache = (TMap*)fInput->FindObject("CDBEntryCache")) {
1780 Int_t runNumber = -1;
1781 if (TProof::GetParameter(fInput,"RunNumber",runNumber) == 0) {
1782 AliCDBManager *man = AliCDBManager::Instance(entryCache,runNumber);
1783 man->SetCacheFlag(kTRUE);
1784 man->SetLock(kTRUE);
1785 man->Print();
1786 }
4b71572b 1787 }
ead7b391 1788 if (AliMagF *map = (AliMagF*)fInput->FindObject("MagneticFieldMap")) {
ef5e52f6 1789 AliMagF *newMap = new AliMagF(*map);
1790 if (!newMap->LoadParameterization()) {
1791 Abort("AliMagF::LoadParameterization", TSelector::kAbortProcess);
1792 return;
1793 }
1794 TGeoGlobalMagField::Instance()->SetField(newMap);
1795 TGeoGlobalMagField::Instance()->Lock();
4b71572b 1796 }
42457748 1797 if (!fAnalysis) {
1798 // Attempt to get the analysis manager from the input list
1799 fAnalysis = (AliAnalysisManager*)fInput->FindObject("Analysis");
1800 if (fAnalysis) AliInfo("==== Analysis manager retrieved from input list ====");
1801 }
81d57268 1802 if (TNamed *outputFileName = (TNamed*)fInput->FindObject("PROOF_OUTPUTFILE"))
1803 fProofOutputFileName = outputFileName->GetTitle();
1804 if (TNamed *outputLocation = (TNamed*)fInput->FindObject("PROOF_OUTPUTFILE_LOCATION"))
1805 fProofOutputLocation = outputLocation->GetTitle();
1806 if (fInput->FindObject("PROOF_OUTPUTFILE_DATASET"))
1807 fProofOutputDataset = kTRUE;
1808 if (TNamed *archiveList = (TNamed*)fInput->FindObject("PROOF_OUTPUTFILE_ARCHIVE"))
1809 fProofOutputArchive = archiveList->GetTitle();
1810 if (!fProofOutputFileName.IsNull() &&
1811 !fProofOutputLocation.IsNull() &&
1812 fProofOutputArchive.IsNull()) {
1813 if (!fProofOutputDataset) {
1814 outProofFile = new TProofOutputFile(fProofOutputFileName.Data(),"M");
1815 outProofFile->SetOutputFileName(Form("%s%s",fProofOutputLocation.Data(),fProofOutputFileName.Data()));
1816 }
1817 else {
1818 outProofFile = new TProofOutputFile(fProofOutputFileName.Data(),"DROV",fProofOutputLocation.Data());
1819 }
1820 if (AliDebugLevel() > 0) outProofFile->Dump();
db4aeca1 1821 fOutput->Add(outProofFile);
4b71572b 1822 }
002c9d1b 1823 AliSysInfo::AddStamp("ReadInputInSlaveBegin");
7e88424f 1824 }
42457748 1825 // Check if analysis was requested in the reconstruction event loop
1826 if (!fAnalysis) {
1827 // Attempt to connect in-memory singleton
1828 fAnalysis = AliAnalysisManager::GetAnalysisManager();
1829 if (fAnalysis) AliInfo(Form("==== Analysis manager <%s> found in memory ====", fAnalysis->GetName()));
1830 // Check if an analysis macro was specified
1831 if (!fAnalysis && !fAnalysisMacro.IsNull()) {
1832 // Run specified analysis macro
1833 gROOT->ProcessLine(Form(".x %s",fAnalysisMacro.Data()));
1834 fAnalysis = AliAnalysisManager::GetAnalysisManager();
1835 if (!fAnalysis) AliError(Form("No analysis manager produced by analysis macro %s", fAnalysisMacro.Data()));
1836 else AliInfo(Form("==== Analysis manager <%s> produced by analysis macro <%s> ====",
1837 fAnalysis->GetName(), fAnalysisMacro.Data()));
1838 }
1839 }
1840
4b71572b 1841 // get the run loader
1842 if (!InitRunLoader()) {
1843 Abort("InitRunLoader", TSelector::kAbortProcess);
1844 return;
1845 }
1846 AliSysInfo::AddStamp("LoadLoader");
1847
92258ce2 1848 CheckRecoCDBvsSimuCDB();
1849
325aa76f 1850 ftVertexer = new AliVertexerTracks(AliTracker::GetBz());
2257f27e 1851
f08fc9f5 1852 // get trackers
b8cd5251 1853 if (!fRunTracking.IsNull() && !CreateTrackers(fRunTracking)) {
4b71572b 1854 Abort("CreateTrackers", TSelector::kAbortProcess);
1855 return;
1856 }
1857 AliSysInfo::AddStamp("CreateTrackers");
24f7a148 1858
36711aa4 1859 // create the ESD output file and tree
db4aeca1 1860 if (!outProofFile) {
1861 ffile = TFile::Open("AliESDs.root", "RECREATE");
1862 ffile->SetCompressionLevel(2);
1863 if (!ffile->IsOpen()) {
1864 Abort("OpenESDFile", TSelector::kAbortProcess);
1865 return;
1866 }
1867 }
1868 else {
81d57268 1869 AliInfo(Form("Opening output PROOF file: %s/%s",
1870 outProofFile->GetDir(), outProofFile->GetFileName()));
db4aeca1 1871 if (!(ffile = outProofFile->OpenFile("RECREATE"))) {
1872 Abort(Form("Problems opening output PROOF file: %s/%s",
1873 outProofFile->GetDir(), outProofFile->GetFileName()),
1874 TSelector::kAbortProcess);
1875 return;
1876 }
596a855f 1877 }
46698ae4 1878
21a3aa09 1879 ftree = new TTree("esdTree", "Tree with ESD objects");
1880 fesd = new AliESDEvent();
1881 fesd->CreateStdContent();
8b12d288 1882 // add a so far non-std object to the ESD, this will
1883 // become part of the std content
1884 fesd->AddObject(new AliESDHLTDecision);
ddfbc51a 1885
32ba9c61 1886 fesd->WriteToTree(ftree);
1d99986f 1887 if (fWriteESDfriend) {
ee7c441c 1888 ffileF = TFile::Open("AliESDfriends.root", "RECREATE");
03a8000a 1889 ftreeF = new TTree("esdFriendTree", "Tree with ESD Friend objects");
ee7c441c 1890 fesdf = new AliESDfriend();
ddfbc51a 1891 ftreeF->Branch("ESDfriend.","AliESDfriend", &fesdf);
21a3aa09 1892 fesd->AddObject(fesdf);
ee7c441c 1893 ffile->cd();
1d99986f 1894 }
f9604a22 1895 ftree->GetUserInfo()->Add(fesd);
1896
1897 fhlttree = new TTree("HLTesdTree", "Tree with HLT ESD objects");
1898 fhltesd = new AliESDEvent();
1899 fhltesd->CreateStdContent();
7491aea6 1900 // read the ESD template from CDB
1901 // HLT is allowed to put non-std content to its ESD, the non-std
1902 // objects need to be created before invocation of WriteToTree in
1903 // order to create all branches. Initialization is done from an
1904 // ESD layout template in CDB
1905 AliCDBManager* man = AliCDBManager::Instance();
df3fcecb 1906 AliCDBEntry* hltESDConfig = man->Get("HLT/Calib/esdLayout");
7cca01eb 1907 if(!hltESDConfig){
1908 AliError(Form("Error getting \"HLT/Calib/esdLayout\""));
1909 return;
1910 }
df3fcecb 1911 AliESDEvent* pESDLayout=dynamic_cast<AliESDEvent*>(hltESDConfig->GetObject());
1912 if (pESDLayout) {
7491aea6 1913 // init all internal variables from the list of objects
1914 pESDLayout->GetStdContent();
1915
1916 // copy content and create non-std objects
1917 *fhltesd=*pESDLayout;
1918 fhltesd->Reset();
df3fcecb 1919 } else {
1920 AliError(Form("error setting hltEsd layout from \"HLT/Calib/esdLayout\": invalid object type"));
7491aea6 1921 }
1922
f9604a22 1923 fhltesd->WriteToTree(fhlttree);
1924 fhlttree->GetUserInfo()->Add(fhltesd);
5728d3d5 1925
ac4a7581 1926 ProcInfo_t procInfo;
1927 gSystem->GetProcInfo(&procInfo);
73bbf779 1928 AliInfo(Form("Current memory usage %ld %ld", procInfo.fMemResident, procInfo.fMemVirtual));
8661738e 1929
1d26da6d 1930 // PID
1931 fESDpid = new AliESDpid();
1932
325aa76f 1933 //QA
930e6e3e 1934 //Initialize the QA and start of cycle
f1c1204d 1935 if (fRunQA || fRunGlobalQA)
1936 InitQA() ;
aa3c69a9 1937
7167ae53 1938 //Initialize the Plane Efficiency framework
1939 if (fRunPlaneEff && !InitPlaneEff()) {
4b71572b 1940 Abort("InitPlaneEff", TSelector::kAbortProcess);
1941 return;
7167ae53 1942 }
aa3c69a9 1943
14dd053c 1944 if (strcmp(gProgName,"alieve") == 0)
1945 fRunAliEVE = InitAliEVE();
42457748 1946 // If we have an analysis manager, connect the AliRecoInputHandler here
1947 if (fAnalysis) {
1948 if (!dynamic_cast<AliRecoInputHandler*>(fAnalysis->GetInputEventHandler())) {
1949 AliError("Analysis manager used in reconstruction should use AliRecoInputHandler - \
1950 \n ->Replacing with AliRecoInputHandler instance.");
1951 delete fAnalysis->GetInputEventHandler();
1952 }
1953 // Set the event and other data pointers
1954 fRecoHandler = new AliRecoInputHandler();
6ee8a83a 1955// fRecoHandler->Init(ftree, "LOCAL");
42457748 1956 fRecoHandler->SetEvent(fesd);
1957 fRecoHandler->SetESDfriend(fesdf);
1958 fRecoHandler->SetHLTEvent(fhltesd);
1959 fRecoHandler->SetHLTTree(fhlttree);
1960 fAnalysis->SetInputEventHandler(fRecoHandler);
1961 // Enter external loop mode
1962 fAnalysis->SetExternalLoop(kTRUE);
1963 // Initialize analysis
6ee8a83a 1964 fAnalysis->SlaveBegin(ftree);
42457748 1965 fAnalysis->StartAnalysis("local", (TTree*)0);
1966 // Connect ESD tree with the input container
1967 fAnalysis->GetCommonInputContainer()->SetData(ftree);
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 ");
0492edf5 2637 sVersion += ALIROOT_BRANCH;
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 // if(MC)
2872 if (fRunLoader->GetHeader() && fRunLoader->GetHea