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