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