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