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