]>
Commit | Line | Data |
---|---|---|
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> | |
30b916f7 | 205 | #include <unistd.h> |
206 | #include <sys/resource.h> | |
596a855f | 207 | ClassImp(AliReconstruction) |
208 | ||
c757bafd | 209 | //_____________________________________________________________________________ |
30b916f7 | 210 | const char* AliReconstruction::fgkStopEvFName = "_stopEvent_"; |
820b4d9e | 211 | const char* AliReconstruction::fgkDetectorName[AliReconstruction::kNDetectors] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "ACORDE" |
212 | // #ifdef MFT_UPGRADE | |
213 | // , "MFT" | |
214 | // #endif | |
215 | , "MFT" // AU | |
216 | , "HLT" | |
217 | }; | |
c757bafd | 218 | |
596a855f | 219 | //_____________________________________________________________________________ |
4b71572b | 220 | AliReconstruction::AliReconstruction(const char* gAliceFilename) : |
221 | TSelector(), | |
2257f27e | 222 | fRunVertexFinder(kTRUE), |
a84e2607 | 223 | fRunVertexFinderTracks(kTRUE), |
1f46a9ae | 224 | fRunHLTTracking(kFALSE), |
e66fbafb | 225 | fRunMuonTracking(kFALSE), |
d1683eef | 226 | fRunV0Finder(kTRUE), |
227 | fRunCascadeFinder(kTRUE), | |
1f9831ab | 228 | fRunMultFinder(kTRUE), |
c8025cc8 | 229 | fStopOnError(kTRUE), |
1d99986f | 230 | fWriteAlignmentData(kFALSE), |
231 | fWriteESDfriend(kFALSE), | |
b647652d | 232 | fFillTriggerESD(kTRUE), |
1d99986f | 233 | |
7f68891d | 234 | fCleanESD(kTRUE), |
a023d8d8 | 235 | fV0DCAmax(3.), |
236 | fV0CsPmin(0.), | |
7f68891d | 237 | fDmax(50.), |
238 | fZmax(50.), | |
239 | ||
1d99986f | 240 | fRunLocalReconstruction("ALL"), |
b8cd5251 | 241 | fRunTracking("ALL"), |
e583c30d | 242 | fFillESD("ALL"), |
e54c9180 | 243 | fDeleteRecPoints(""), |
244 | fDeleteDigits(""), | |
7d566c20 | 245 | fLoadCDB(""), |
48ce48d1 | 246 | fUseTrackingErrorsForAlignment(""), |
e583c30d | 247 | fGAliceFileName(gAliceFilename), |
4b71572b | 248 | fRawInput(""), |
975320a0 | 249 | fESDOutput(""), |
81d57268 | 250 | fProofOutputFileName(""), |
251 | fProofOutputLocation(""), | |
252 | fProofOutputDataset(kFALSE), | |
253 | fProofOutputArchive(""), | |
35042093 | 254 | fEquipIdMap(""), |
b26c3770 | 255 | fFirstEvent(0), |
256 | fLastEvent(-1), | |
9d705769 | 257 | fNumberOfEventsPerFile((UInt_t)-1), |
fc01854a | 258 | fFractionFriends(0.04), |
b8cd5251 | 259 | fOptions(), |
6bae477a | 260 | fLoadAlignFromCDB(kTRUE), |
261 | fLoadAlignData("ALL"), | |
cd0b062e | 262 | fUseHLTData(), |
7e88424f | 263 | fRunInfo(NULL), |
264 | fEventInfo(), | |
522fdd91 | 265 | fRunScalers(NULL), |
52dd4a8c | 266 | fCTPTimeParams(NULL), |
c7ff1a33 | 267 | fCTPTimeAlign(NULL), |
e583c30d | 268 | |
269 | fRunLoader(NULL), | |
b649205a | 270 | fRawReader(NULL), |
cd0b062e | 271 | fParentRawReader(NULL), |
b8cd5251 | 272 | |
7e88424f | 273 | fRecoParam(), |
274 | ||
58e8dc31 | 275 | fSPDTrackleter(NULL), |
276 | ||
f2a195c1 | 277 | fDiamondProfileSPD(NULL), |
9178838a | 278 | fDiamondProfile(NULL), |
43c9dae1 | 279 | fDiamondProfileTPC(NULL), |
77ba28ba | 280 | fListOfCosmicTriggers(NULL), |
f2a195c1 | 281 | |
6b6e4472 | 282 | fGRPData(NULL), |
444753c6 | 283 | |
6bae477a | 284 | fAlignObjArray(NULL), |
795e4a22 | 285 | fCDBUri(), |
f1c1204d | 286 | fQARefUri(), |
759c1df1 | 287 | fSpecCDBUri(), |
795e4a22 | 288 | fInitCDBCalled(kFALSE), |
647d2bb8 | 289 | fFromCDBSnapshot(kFALSE), |
69e8e906 | 290 | fSnapshotFileName(""), |
795e4a22 | 291 | fSetRunNumberFromDataCalled(kFALSE), |
ce43afbe | 292 | fQADetectors("ALL"), |
293 | fQATasks("ALL"), | |
7e963665 | 294 | fRunQA(kTRUE), |
6b150027 | 295 | fRunGlobalQA(kTRUE), |
e4a998ed | 296 | fSameQACycle(kFALSE), |
f1c1204d | 297 | fInitQACalled(kFALSE), |
75373542 | 298 | fWriteQAExpertData(kTRUE), |
21a3aa09 | 299 | fRunPlaneEff(kFALSE), |
300 | ||
301 | fesd(NULL), | |
302 | fhltesd(NULL), | |
303 | fesdf(NULL), | |
304 | ffile(NULL), | |
ee7c441c | 305 | ffileF(NULL), |
21a3aa09 | 306 | ftree(NULL), |
ee7c441c | 307 | ftreeF(NULL), |
21a3aa09 | 308 | fhlttree(NULL), |
21a3aa09 | 309 | ftVertexer(NULL), |
14dd053c | 310 | fIsNewRunLoader(kFALSE), |
4b71572b | 311 | fRunAliEVE(kFALSE), |
f00558b6 | 312 | fChain(NULL), |
313 | fNall(0), | |
314 | fNspecie(0), | |
315 | fSspecie(0), | |
316 | fNhighPt(0), | |
f9fc20b4 | 317 | fShighPt(0), |
42457748 | 318 | fUpgradeModule(""), |
319 | fAnalysisMacro(), | |
320 | fAnalysis(0), | |
764daca3 | 321 | fRecoHandler(0), |
30b916f7 | 322 | fDeclTriggerClasses(""), |
323 | fStopped(kFALSE), | |
324 | fMaxRSS(0), | |
325 | fMaxVMEM(0) | |
596a855f | 326 | { |
327 | // create reconstruction object with default parameters | |
002c9d1b | 328 | gGeoManager = NULL; |
b8cd5251 | 329 | |
ac4a7581 | 330 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 331 | fReconstructor[iDet] = NULL; |
f9fc20b4 | 332 | fUpgradeMask[iDet]=kFALSE; |
b8cd5251 | 333 | fLoader[iDet] = NULL; |
334 | fTracker[iDet] = NULL; | |
335 | } | |
4e25ac79 | 336 | for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) { |
252f8aa8 | 337 | fQACycles[iDet] = 999999 ; |
338 | fQAWriteExpert[iDet] = kFALSE ; | |
339 | } | |
3d84ad67 | 340 | fBeamInt[0][0]=fBeamInt[0][1]=fBeamInt[1][0]=fBeamInt[1][1] = -1; |
341 | ||
e47c4c2e | 342 | AliPID pid; |
596a855f | 343 | } |
344 | ||
345 | //_____________________________________________________________________________ | |
346 | AliReconstruction::AliReconstruction(const AliReconstruction& rec) : | |
4b71572b | 347 | TSelector(), |
2257f27e | 348 | fRunVertexFinder(rec.fRunVertexFinder), |
a84e2607 | 349 | fRunVertexFinderTracks(rec.fRunVertexFinderTracks), |
1f46a9ae | 350 | fRunHLTTracking(rec.fRunHLTTracking), |
e66fbafb | 351 | fRunMuonTracking(rec.fRunMuonTracking), |
d1683eef | 352 | fRunV0Finder(rec.fRunV0Finder), |
353 | fRunCascadeFinder(rec.fRunCascadeFinder), | |
1f9831ab | 354 | fRunMultFinder(rec.fRunMultFinder), |
1d99986f | 355 | fStopOnError(rec.fStopOnError), |
356 | fWriteAlignmentData(rec.fWriteAlignmentData), | |
357 | fWriteESDfriend(rec.fWriteESDfriend), | |
b647652d | 358 | fFillTriggerESD(rec.fFillTriggerESD), |
1d99986f | 359 | |
7f68891d | 360 | fCleanESD(rec.fCleanESD), |
a023d8d8 | 361 | fV0DCAmax(rec.fV0DCAmax), |
5e5c1aa9 | 362 | fV0CsPmin(rec.fV0CsPmin), |
7f68891d | 363 | fDmax(rec.fDmax), |
364 | fZmax(rec.fZmax), | |
365 | ||
1d99986f | 366 | fRunLocalReconstruction(rec.fRunLocalReconstruction), |
e583c30d | 367 | fRunTracking(rec.fRunTracking), |
368 | fFillESD(rec.fFillESD), | |
e54c9180 | 369 | fDeleteRecPoints(""), |
370 | fDeleteDigits(""), | |
7d566c20 | 371 | fLoadCDB(rec.fLoadCDB), |
48ce48d1 | 372 | fUseTrackingErrorsForAlignment(rec.fUseTrackingErrorsForAlignment), |
e583c30d | 373 | fGAliceFileName(rec.fGAliceFileName), |
4b71572b | 374 | fRawInput(rec.fRawInput), |
975320a0 | 375 | fESDOutput(rec.fESDOutput), |
81d57268 | 376 | fProofOutputFileName(rec.fProofOutputFileName), |
377 | fProofOutputLocation(rec.fProofOutputLocation), | |
378 | fProofOutputDataset(rec.fProofOutputDataset), | |
379 | fProofOutputArchive(rec.fProofOutputArchive), | |
35042093 | 380 | fEquipIdMap(rec.fEquipIdMap), |
b26c3770 | 381 | fFirstEvent(rec.fFirstEvent), |
382 | fLastEvent(rec.fLastEvent), | |
973388c2 | 383 | fNumberOfEventsPerFile(rec.fNumberOfEventsPerFile), |
fc01854a | 384 | fFractionFriends(rec.fFractionFriends), |
b8cd5251 | 385 | fOptions(), |
6bae477a | 386 | fLoadAlignFromCDB(rec.fLoadAlignFromCDB), |
387 | fLoadAlignData(rec.fLoadAlignData), | |
2972d4eb | 388 | fUseHLTData(rec.fUseHLTData), |
7e88424f | 389 | fRunInfo(NULL), |
390 | fEventInfo(), | |
522fdd91 | 391 | fRunScalers(NULL), |
52dd4a8c | 392 | fCTPTimeParams(NULL), |
c7ff1a33 | 393 | fCTPTimeAlign(NULL), |
e583c30d | 394 | |
395 | fRunLoader(NULL), | |
b649205a | 396 | fRawReader(NULL), |
2972d4eb | 397 | fParentRawReader(NULL), |
b8cd5251 | 398 | |
4b71572b | 399 | fRecoParam(rec.fRecoParam), |
7e88424f | 400 | |
58e8dc31 | 401 | fSPDTrackleter(NULL), |
402 | ||
f2a195c1 | 403 | fDiamondProfileSPD(rec.fDiamondProfileSPD), |
4b71572b | 404 | fDiamondProfile(rec.fDiamondProfile), |
405 | fDiamondProfileTPC(rec.fDiamondProfileTPC), | |
77ba28ba | 406 | fListOfCosmicTriggers(NULL), |
f2a195c1 | 407 | |
6b6e4472 | 408 | fGRPData(NULL), |
444753c6 | 409 | |
6bae477a | 410 | fAlignObjArray(rec.fAlignObjArray), |
ec92bee0 | 411 | fCDBUri(rec.fCDBUri), |
f1c1204d | 412 | fQARefUri(rec.fQARefUri), |
7e963665 | 413 | fSpecCDBUri(), |
795e4a22 | 414 | fInitCDBCalled(rec.fInitCDBCalled), |
647d2bb8 | 415 | fFromCDBSnapshot(rec.fFromCDBSnapshot), |
69e8e906 | 416 | fSnapshotFileName(rec.fSnapshotFileName), |
795e4a22 | 417 | fSetRunNumberFromDataCalled(rec.fSetRunNumberFromDataCalled), |
ce43afbe | 418 | fQADetectors(rec.fQADetectors), |
419 | fQATasks(rec.fQATasks), | |
aa3c69a9 | 420 | fRunQA(rec.fRunQA), |
421 | fRunGlobalQA(rec.fRunGlobalQA), | |
e4a998ed | 422 | fSameQACycle(rec.fSameQACycle), |
f1c1204d | 423 | fInitQACalled(rec.fInitQACalled), |
75373542 | 424 | fWriteQAExpertData(rec.fWriteQAExpertData), |
21a3aa09 | 425 | fRunPlaneEff(rec.fRunPlaneEff), |
426 | ||
427 | fesd(NULL), | |
428 | fhltesd(NULL), | |
429 | fesdf(NULL), | |
430 | ffile(NULL), | |
ee7c441c | 431 | ffileF(NULL), |
21a3aa09 | 432 | ftree(NULL), |
ee7c441c | 433 | ftreeF(NULL), |
21a3aa09 | 434 | fhlttree(NULL), |
21a3aa09 | 435 | ftVertexer(NULL), |
14dd053c | 436 | fIsNewRunLoader(rec.fIsNewRunLoader), |
4b71572b | 437 | fRunAliEVE(kFALSE), |
f00558b6 | 438 | fChain(NULL), |
439 | fNall(0), | |
440 | fNspecie(0), | |
441 | fSspecie(0), | |
442 | fNhighPt(0), | |
f9fc20b4 | 443 | fShighPt(0), |
42457748 | 444 | fUpgradeModule(""), |
445 | fAnalysisMacro(rec.fAnalysisMacro), | |
446 | fAnalysis(0), | |
764daca3 | 447 | fRecoHandler(0), |
30b916f7 | 448 | fDeclTriggerClasses(rec.fDeclTriggerClasses), |
449 | fStopped(kFALSE), | |
450 | fMaxRSS(0), | |
451 | fMaxVMEM(0) | |
596a855f | 452 | { |
453 | // copy constructor | |
454 | ||
ec92bee0 | 455 | for (Int_t i = 0; i < rec.fOptions.GetEntriesFast(); i++) { |
efd2085e | 456 | if (rec.fOptions[i]) fOptions.Add(rec.fOptions[i]->Clone()); |
457 | } | |
ac4a7581 | 458 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 459 | fReconstructor[iDet] = NULL; |
f9fc20b4 | 460 | fUpgradeMask[iDet] = kFALSE; |
b8cd5251 | 461 | fLoader[iDet] = NULL; |
462 | fTracker[iDet] = NULL; | |
b1af1125 | 463 | } |
464 | ||
4e25ac79 | 465 | for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) { |
b1af1125 | 466 | fQACycles[iDet] = rec.fQACycles[iDet]; |
252f8aa8 | 467 | fQAWriteExpert[iDet] = rec.fQAWriteExpert[iDet] ; |
468 | } | |
b1af1125 | 469 | |
ec92bee0 | 470 | for (Int_t i = 0; i < rec.fSpecCDBUri.GetEntriesFast(); i++) { |
471 | if (rec.fSpecCDBUri[i]) fSpecCDBUri.Add(rec.fSpecCDBUri[i]->Clone()); | |
472 | } | |
3d84ad67 | 473 | |
474 | for (int i=2;i--;) for (int j=2;j--;) fBeamInt[i][j] = rec.fBeamInt[i][j]; | |
475 | ||
596a855f | 476 | } |
477 | ||
478 | //_____________________________________________________________________________ | |
479 | AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) | |
480 | { | |
481 | // assignment operator | |
4b71572b | 482 | // Used in PROOF mode |
483 | // Be very careful while modifing it! | |
484 | // Simple rules to follow: | |
485 | // for persistent data members - use their assignment operators | |
486 | // for non-persistent ones - do nothing or take the default values from constructor | |
487 | // TSelector members should not be touched | |
488 | if(&rec == this) return *this; | |
489 | ||
4b71572b | 490 | fRunVertexFinder = rec.fRunVertexFinder; |
491 | fRunVertexFinderTracks = rec.fRunVertexFinderTracks; | |
492 | fRunHLTTracking = rec.fRunHLTTracking; | |
493 | fRunMuonTracking = rec.fRunMuonTracking; | |
494 | fRunV0Finder = rec.fRunV0Finder; | |
495 | fRunCascadeFinder = rec.fRunCascadeFinder; | |
1f9831ab | 496 | fRunMultFinder = rec.fRunMultFinder; |
4b71572b | 497 | fStopOnError = rec.fStopOnError; |
498 | fWriteAlignmentData = rec.fWriteAlignmentData; | |
499 | fWriteESDfriend = rec.fWriteESDfriend; | |
500 | fFillTriggerESD = rec.fFillTriggerESD; | |
501 | ||
502 | fCleanESD = rec.fCleanESD; | |
503 | fV0DCAmax = rec.fV0DCAmax; | |
504 | fV0CsPmin = rec.fV0CsPmin; | |
505 | fDmax = rec.fDmax; | |
506 | fZmax = rec.fZmax; | |
507 | ||
508 | fRunLocalReconstruction = rec.fRunLocalReconstruction; | |
509 | fRunTracking = rec.fRunTracking; | |
510 | fFillESD = rec.fFillESD; | |
e54c9180 | 511 | fDeleteRecPoints = rec.fDeleteRecPoints; |
512 | fDeleteDigits = rec.fDeleteDigits; | |
7d566c20 | 513 | fLoadCDB = rec.fLoadCDB; |
4b71572b | 514 | fUseTrackingErrorsForAlignment = rec.fUseTrackingErrorsForAlignment; |
515 | fGAliceFileName = rec.fGAliceFileName; | |
516 | fRawInput = rec.fRawInput; | |
975320a0 | 517 | fESDOutput = rec.fESDOutput; |
81d57268 | 518 | fProofOutputFileName = rec.fProofOutputFileName; |
519 | fProofOutputLocation = rec.fProofOutputLocation; | |
520 | fProofOutputDataset = rec.fProofOutputDataset; | |
521 | fProofOutputArchive = rec.fProofOutputArchive; | |
4b71572b | 522 | fEquipIdMap = rec.fEquipIdMap; |
523 | fFirstEvent = rec.fFirstEvent; | |
524 | fLastEvent = rec.fLastEvent; | |
525 | fNumberOfEventsPerFile = rec.fNumberOfEventsPerFile; | |
fc01854a | 526 | fFractionFriends = rec.fFractionFriends; |
4b71572b | 527 | |
528 | for (Int_t i = 0; i < rec.fOptions.GetEntriesFast(); i++) { | |
529 | if (rec.fOptions[i]) fOptions.Add(rec.fOptions[i]->Clone()); | |
530 | } | |
531 | ||
532 | fLoadAlignFromCDB = rec.fLoadAlignFromCDB; | |
533 | fLoadAlignData = rec.fLoadAlignData; | |
4b71572b | 534 | fUseHLTData = rec.fUseHLTData; |
535 | ||
536 | delete fRunInfo; fRunInfo = NULL; | |
537 | if (rec.fRunInfo) fRunInfo = new AliRunInfo(*rec.fRunInfo); | |
538 | ||
539 | fEventInfo = rec.fEventInfo; | |
540 | ||
522fdd91 | 541 | delete fRunScalers; fRunScalers = NULL; |
542 | if (rec.fRunScalers) fRunScalers = new AliTriggerRunScalers(*rec.fRunScalers); | |
543 | ||
52dd4a8c | 544 | delete fCTPTimeParams; fCTPTimeParams = NULL; |
545 | if (rec.fCTPTimeParams) fCTPTimeParams = new AliCTPTimeParams(*rec.fCTPTimeParams); | |
c7ff1a33 | 546 | delete fCTPTimeAlign; fCTPTimeAlign = NULL; |
547 | if (rec.fCTPTimeAlign) fCTPTimeAlign = new AliCTPTimeParams(*rec.fCTPTimeAlign); | |
52dd4a8c | 548 | |
4b71572b | 549 | fRunLoader = NULL; |
550 | fRawReader = NULL; | |
551 | fParentRawReader = NULL; | |
552 | ||
553 | fRecoParam = rec.fRecoParam; | |
554 | ||
ac4a7581 | 555 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
f9fc20b4 | 556 | fUpgradeMask[iDet] = kFALSE; |
4b71572b | 557 | delete fReconstructor[iDet]; fReconstructor[iDet] = NULL; |
558 | delete fLoader[iDet]; fLoader[iDet] = NULL; | |
559 | delete fTracker[iDet]; fTracker[iDet] = NULL; | |
4b71572b | 560 | } |
b1af1125 | 561 | |
4e25ac79 | 562 | for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) { |
b1af1125 | 563 | fQACycles[iDet] = rec.fQACycles[iDet]; |
252f8aa8 | 564 | fQAWriteExpert[iDet] = rec.fQAWriteExpert[iDet] ; |
565 | } | |
58e8dc31 | 566 | |
567 | delete fSPDTrackleter; fSPDTrackleter = NULL; | |
252f8aa8 | 568 | |
f2a195c1 | 569 | delete fDiamondProfileSPD; fDiamondProfileSPD = NULL; |
570 | if (rec.fDiamondProfileSPD) fDiamondProfileSPD = new AliESDVertex(*rec.fDiamondProfileSPD); | |
4b71572b | 571 | delete fDiamondProfile; fDiamondProfile = NULL; |
572 | if (rec.fDiamondProfile) fDiamondProfile = new AliESDVertex(*rec.fDiamondProfile); | |
573 | delete fDiamondProfileTPC; fDiamondProfileTPC = NULL; | |
574 | if (rec.fDiamondProfileTPC) fDiamondProfileTPC = new AliESDVertex(*rec.fDiamondProfileTPC); | |
4b71572b | 575 | |
77ba28ba | 576 | delete fListOfCosmicTriggers; fListOfCosmicTriggers = NULL; |
577 | if (rec.fListOfCosmicTriggers) fListOfCosmicTriggers = (THashTable*)((rec.fListOfCosmicTriggers)->Clone()); | |
578 | ||
4b71572b | 579 | delete fGRPData; fGRPData = NULL; |
44e45fac | 580 | // if (rec.fGRPData) fGRPData = (TMap*)((rec.fGRPData)->Clone()); |
581 | if (rec.fGRPData) fGRPData = (AliGRPObject*)((rec.fGRPData)->Clone()); | |
4b71572b | 582 | |
583 | delete fAlignObjArray; fAlignObjArray = NULL; | |
584 | ||
585 | fCDBUri = ""; | |
f1c1204d | 586 | fQARefUri = rec.fQARefUri; |
4b71572b | 587 | fSpecCDBUri.Delete(); |
588 | fInitCDBCalled = rec.fInitCDBCalled; | |
647d2bb8 | 589 | fFromCDBSnapshot = rec.fFromCDBSnapshot; |
69e8e906 | 590 | fSnapshotFileName = rec.fSnapshotFileName; |
4b71572b | 591 | fSetRunNumberFromDataCalled = rec.fSetRunNumberFromDataCalled; |
592 | fQADetectors = rec.fQADetectors; | |
4b71572b | 593 | fQATasks = rec.fQATasks; |
594 | fRunQA = rec.fRunQA; | |
595 | fRunGlobalQA = rec.fRunGlobalQA; | |
4b71572b | 596 | fSameQACycle = rec.fSameQACycle; |
f1c1204d | 597 | fInitQACalled = rec.fInitQACalled; |
75373542 | 598 | fWriteQAExpertData = rec.fWriteQAExpertData; |
4b71572b | 599 | fRunPlaneEff = rec.fRunPlaneEff; |
3d84ad67 | 600 | for (int i=2;i--;) for (int j=2;j--;) fBeamInt[i][j] = rec.fBeamInt[i][j]; |
4b71572b | 601 | fesd = NULL; |
602 | fhltesd = NULL; | |
603 | fesdf = NULL; | |
604 | ffile = NULL; | |
ee7c441c | 605 | ffileF = NULL; |
4b71572b | 606 | ftree = NULL; |
ee7c441c | 607 | ftreeF = NULL; |
4b71572b | 608 | fhlttree = NULL; |
609 | ftVertexer = NULL; | |
610 | fIsNewRunLoader = rec.fIsNewRunLoader; | |
611 | fRunAliEVE = kFALSE; | |
612 | fChain = NULL; | |
f00558b6 | 613 | fNall = 0; |
614 | fNspecie = 0; | |
615 | fSspecie = 0; | |
616 | fNhighPt = 0; | |
617 | fShighPt = 0; | |
f9fc20b4 | 618 | fUpgradeModule=""; |
42457748 | 619 | fAnalysisMacro = rec.fAnalysisMacro; |
620 | fAnalysis = 0; | |
621 | fRecoHandler = 0; | |
764daca3 | 622 | fDeclTriggerClasses = rec.fDeclTriggerClasses; |
596a855f | 623 | |
596a855f | 624 | return *this; |
625 | } | |
626 | ||
627 | //_____________________________________________________________________________ | |
628 | AliReconstruction::~AliReconstruction() | |
629 | { | |
630 | // clean up | |
631 | ||
e583c30d | 632 | CleanUp(); |
77ba28ba | 633 | if (fListOfCosmicTriggers) { |
634 | fListOfCosmicTriggers->Delete(); | |
635 | delete fListOfCosmicTriggers; | |
636 | } | |
4f3c479a | 637 | delete fGRPData; |
522fdd91 | 638 | delete fRunScalers; |
52dd4a8c | 639 | delete fCTPTimeParams; |
c7ff1a33 | 640 | delete fCTPTimeAlign; |
efd2085e | 641 | fOptions.Delete(); |
4b71572b | 642 | if (fAlignObjArray) { |
643 | fAlignObjArray->Delete(); | |
644 | delete fAlignObjArray; | |
645 | } | |
ec92bee0 | 646 | fSpecCDBUri.Delete(); |
ddfbc51a | 647 | |
87932dab | 648 | AliCodeTimer::Instance()->Print(); |
596a855f | 649 | } |
650 | ||
f1c1204d | 651 | //_____________________________________________________________________________ |
652 | void AliReconstruction::InitQA() | |
653 | { | |
654 | //Initialize the QA and start of cycle | |
52dd4a8c | 655 | AliCodeTimerAuto("",0); |
f1c1204d | 656 | |
657 | if (fInitQACalled) return; | |
658 | fInitQACalled = kTRUE; | |
659 | ||
92664bc8 | 660 | if (fGRPData) AliQADataMaker::SetCloningRequest( fGRPData->GetQATrigClasses(), fGRPData->GetQACloningRequest()); |
661 | ||
662 | ||
634696f5 | 663 | AliQAManager * qam = AliQAManager::QAManager(AliQAv1::kRECMODE) ; |
75373542 | 664 | if (fWriteQAExpertData) |
eca4fa66 | 665 | qam->SetWriteExpert() ; |
75373542 | 666 | |
eca4fa66 | 667 | if (qam->IsDefaultStorageSet()) { |
f1c1204d | 668 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
669 | AliWarning("Default QA reference storage has been already set !"); | |
670 | AliWarning(Form("Ignoring the default storage declared in AliReconstruction: %s",fQARefUri.Data())); | |
671 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
eca4fa66 | 672 | fQARefUri = qam->GetDefaultStorage()->GetURI(); |
f1c1204d | 673 | } else { |
674 | if (fQARefUri.Length() > 0) { | |
675 | AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
676 | AliDebug(2, Form("Default QA reference storage is set to: %s", fQARefUri.Data())); | |
677 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
678 | } else { | |
679 | fQARefUri="local://$ALICE_ROOT/QAref"; | |
680 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
681 | AliWarning("Default QA refeference storage not yet set !!!!"); | |
682 | AliWarning(Form("Setting it now to: %s", fQARefUri.Data())); | |
683 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
684 | ||
685 | } | |
eca4fa66 | 686 | qam->SetDefaultStorage(fQARefUri); |
f1c1204d | 687 | } |
688 | ||
689 | if (fRunQA) { | |
eca4fa66 | 690 | qam->SetActiveDetectors(fQADetectors) ; |
4e25ac79 | 691 | for (Int_t det = 0 ; det < AliQAv1::kNDET ; det++) { |
eca4fa66 | 692 | qam->SetCycleLength(AliQAv1::DETECTORINDEX_t(det), fQACycles[det]) ; |
693 | qam->SetWriteExpert(AliQAv1::DETECTORINDEX_t(det)) ; | |
f1c1204d | 694 | } |
514cb8c7 | 695 | if (!fRawReader && !fInput && IsInTasks(AliQAv1::kRAWS)) |
4e25ac79 | 696 | fQATasks.ReplaceAll(Form("%d",AliQAv1::kRAWS), "") ; |
eca4fa66 | 697 | qam->SetTasks(fQATasks) ; |
698 | qam->InitQADataMaker(AliCDBManager::Instance()->GetRun()) ; | |
f1c1204d | 699 | } |
700 | if (fRunGlobalQA) { | |
701 | Bool_t sameCycle = kFALSE ; | |
eca4fa66 | 702 | AliQADataMaker *qadm = qam->GetQADataMaker(AliQAv1::kGLOBAL); |
f1c1204d | 703 | AliInfo(Form("Initializing the global QA data maker")); |
514cb8c7 | 704 | if (IsInTasks(AliQAv1::kRECPOINTS)) { |
4e25ac79 | 705 | qadm->StartOfCycle(AliQAv1::kRECPOINTS, AliCDBManager::Instance()->GetRun(), sameCycle) ; |
706 | TObjArray **arr=qadm->Init(AliQAv1::kRECPOINTS); | |
f1c1204d | 707 | AliTracker::SetResidualsArray(arr); |
708 | sameCycle = kTRUE ; | |
709 | } | |
514cb8c7 | 710 | if (IsInTasks(AliQAv1::kESDS)) { |
4e25ac79 | 711 | qadm->StartOfCycle(AliQAv1::kESDS, AliCDBManager::Instance()->GetRun(), sameCycle) ; |
712 | qadm->Init(AliQAv1::kESDS); | |
f1c1204d | 713 | } |
f1c1204d | 714 | } |
fc07289e | 715 | AliSysInfo::AddStamp("InitQA") ; |
f1c1204d | 716 | } |
717 | ||
fc07289e | 718 | //_____________________________________________________________________________ |
87da0921 | 719 | void AliReconstruction::MergeQA(const char *fileName) |
fc07289e | 720 | { |
721 | //Initialize the QA and start of cycle | |
52dd4a8c | 722 | AliCodeTimerAuto("",0) ; |
eca4fa66 | 723 | AliQAManager::QAManager()->Merge(AliCDBManager::Instance()->GetRun(),fileName) ; |
fc07289e | 724 | AliSysInfo::AddStamp("MergeQA") ; |
725 | } | |
726 | ||
024cf675 | 727 | //_____________________________________________________________________________ |
795e4a22 | 728 | void AliReconstruction::InitCDB() |
024cf675 | 729 | { |
730 | // activate a default CDB storage | |
731 | // First check if we have any CDB storage set, because it is used | |
732 | // to retrieve the calibration and alignment constants | |
52dd4a8c | 733 | AliCodeTimerAuto("",0); |
024cf675 | 734 | |
795e4a22 | 735 | if (fInitCDBCalled) return; |
736 | fInitCDBCalled = kTRUE; | |
737 | ||
024cf675 | 738 | AliCDBManager* man = AliCDBManager::Instance(); |
ec92bee0 | 739 | if (man->IsDefaultStorageSet()) |
024cf675 | 740 | { |
741 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
ec92bee0 | 742 | AliWarning("Default CDB storage has been already set !"); |
743 | AliWarning(Form("Ignoring the default storage declared in AliReconstruction: %s",fCDBUri.Data())); | |
024cf675 | 744 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
795e4a22 | 745 | fCDBUri = man->GetDefaultStorage()->GetURI(); |
ec92bee0 | 746 | } |
747 | else { | |
795e4a22 | 748 | if (fCDBUri.Length() > 0) |
749 | { | |
750 | AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
751 | AliDebug(2, Form("Default CDB storage is set to: %s", fCDBUri.Data())); | |
752 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
52dd4a8c | 753 | man->SetDefaultStorage(fCDBUri); |
754 | } | |
755 | else if (!man->GetRaw()){ | |
756 | fCDBUri="local://$ALICE_ROOT/OCDB"; | |
795e4a22 | 757 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
758 | AliWarning("Default CDB storage not yet set !!!!"); | |
759 | AliWarning(Form("Setting it now to: %s", fCDBUri.Data())); | |
760 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
52dd4a8c | 761 | man->SetDefaultStorage(fCDBUri); |
762 | } | |
763 | else { | |
764 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
765 | AliWarning("Default storage will be set after setting the Run Number!!!"); | |
766 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
795e4a22 | 767 | } |
ec92bee0 | 768 | } |
769 | ||
770 | // Now activate the detector specific CDB storage locations | |
c3a7b59a | 771 | for (Int_t i = 0; i < fSpecCDBUri.GetEntriesFast(); i++) { |
772 | TObject* obj = fSpecCDBUri[i]; | |
773 | if (!obj) continue; | |
b8ec52f6 | 774 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
775 | AliDebug(2, Form("Specific CDB storage for %s is set to: %s",obj->GetName(),obj->GetTitle())); | |
776 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
c3a7b59a | 777 | man->SetSpecificStorage(obj->GetName(), obj->GetTitle()); |
ec92bee0 | 778 | } |
002c9d1b | 779 | AliSysInfo::AddStamp("InitCDB"); |
024cf675 | 780 | } |
781 | ||
782 | //_____________________________________________________________________________ | |
783 | void AliReconstruction::SetDefaultStorage(const char* uri) { | |
ec92bee0 | 784 | // Store the desired default CDB storage location |
785 | // Activate it later within the Run() method | |
024cf675 | 786 | |
ec92bee0 | 787 | fCDBUri = uri; |
024cf675 | 788 | |
789 | } | |
790 | ||
f1c1204d | 791 | //_____________________________________________________________________________ |
792 | void AliReconstruction::SetQARefDefaultStorage(const char* uri) { | |
793 | // Store the desired default CDB storage location | |
794 | // Activate it later within the Run() method | |
795 | ||
796 | fQARefUri = uri; | |
4e25ac79 | 797 | AliQAv1::SetQARefStorage(fQARefUri.Data()) ; |
f1c1204d | 798 | |
799 | } | |
00aa02d5 | 800 | //_____________________________________________________________________________ |
c3a7b59a | 801 | void AliReconstruction::SetSpecificStorage(const char* calibType, const char* uri) { |
ec92bee0 | 802 | // Store a detector-specific CDB storage location |
803 | // Activate it later within the Run() method | |
024cf675 | 804 | |
c3a7b59a | 805 | AliCDBPath aPath(calibType); |
806 | if(!aPath.IsValid()){ | |
807 | // if calibType is not wildcard but it is a valid detector, add "/*" to make it a valid path | |
ac4a7581 | 808 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
c3a7b59a | 809 | if(!strcmp(calibType, fgkDetectorName[iDet])) { |
810 | aPath.SetPath(Form("%s/*", calibType)); | |
811 | AliInfo(Form("Path for specific storage set to %s", aPath.GetPath().Data())); | |
812 | break; | |
813 | } | |
814 | } | |
815 | if(!aPath.IsValid()){ | |
816 | AliError(Form("Not a valid path or detector: %s", calibType)); | |
817 | return; | |
818 | } | |
819 | } | |
820 | ||
53dd3c3d | 821 | // // check that calibType refers to a "valid" detector name |
822 | // Bool_t isDetector = kFALSE; | |
ac4a7581 | 823 | // for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
53dd3c3d | 824 | // TString detName = fgkDetectorName[iDet]; |
825 | // if(aPath.GetLevel0() == detName) { | |
826 | // isDetector = kTRUE; | |
827 | // break; | |
828 | // } | |
829 | // } | |
830 | // | |
831 | // if(!isDetector) { | |
832 | // AliError(Form("Not a valid detector: %s", aPath.GetLevel0().Data())); | |
833 | // return; | |
834 | // } | |
c3a7b59a | 835 | |
836 | TObject* obj = fSpecCDBUri.FindObject(aPath.GetPath().Data()); | |
ec92bee0 | 837 | if (obj) fSpecCDBUri.Remove(obj); |
c3a7b59a | 838 | fSpecCDBUri.Add(new TNamed(aPath.GetPath().Data(), uri)); |
024cf675 | 839 | |
840 | } | |
841 | ||
6bae477a | 842 | //_____________________________________________________________________________ |
795e4a22 | 843 | Bool_t AliReconstruction::SetRunNumberFromData() |
6bae477a | 844 | { |
845 | // The method is called in Run() in order | |
846 | // to set a correct run number. | |
847 | // In case of raw data reconstruction the | |
848 | // run number is taken from the raw data header | |
849 | ||
795e4a22 | 850 | if (fSetRunNumberFromDataCalled) return kTRUE; |
851 | fSetRunNumberFromDataCalled = kTRUE; | |
852 | ||
853 | AliCDBManager* man = AliCDBManager::Instance(); | |
4b71572b | 854 | |
855 | if(fRawReader) { | |
856 | if(fRawReader->NextEvent()) { | |
857 | if(man->GetRun() > 0) { | |
21a3aa09 | 858 | AliWarning("Run number is taken from raw-event header! Ignoring settings in AliCDBManager!"); |
4b71572b | 859 | } |
860 | man->SetRun(fRawReader->GetRunNumber()); | |
861 | fRawReader->RewindEvents(); | |
862 | } | |
863 | else { | |
864 | if(man->GetRun() > 0) { | |
865 | AliWarning("No raw-data events are found ! Using settings in AliCDBManager !"); | |
866 | } | |
867 | else { | |
868 | AliWarning("Neither raw events nor settings in AliCDBManager are found !"); | |
869 | return kFALSE; | |
870 | } | |
871 | } | |
872 | } | |
873 | else { | |
874 | AliRunLoader *rl = AliRunLoader::Open(fGAliceFileName.Data()); | |
875 | if (!rl) { | |
876 | AliError(Form("No run loader found in file %s", fGAliceFileName.Data())); | |
6bae477a | 877 | return kFALSE; |
878 | } | |
ec92bee0 | 879 | else { |
4b71572b | 880 | rl->LoadHeader(); |
881 | // read run number from gAlice | |
882 | if(rl->GetHeader()) { | |
883 | man->SetRun(rl->GetHeader()->GetRun()); | |
884 | rl->UnloadHeader(); | |
885 | delete rl; | |
ec92bee0 | 886 | } |
887 | else { | |
4b71572b | 888 | AliError("Neither run-loader header nor RawReader objects are found !"); |
889 | delete rl; | |
ec92bee0 | 890 | return kFALSE; |
891 | } | |
4b71572b | 892 | } |
6bae477a | 893 | } |
795e4a22 | 894 | |
895 | man->Print(); | |
896 | ||
6bae477a | 897 | return kTRUE; |
898 | } | |
899 | ||
795e4a22 | 900 | //_____________________________________________________________________________ |
901 | void AliReconstruction::SetCDBLock() { | |
902 | // Set CDB lock: from now on it is forbidden to reset the run number | |
903 | // or the default storage or to activate any further storage! | |
904 | ||
905 | AliCDBManager::Instance()->SetLock(1); | |
906 | } | |
907 | ||
f9fc20b4 | 908 | //_____________________________________________________________________________ |
909 | void AliReconstruction::MatchUpgradeDetector() { | |
910 | // Translates detector name in a boolean. | |
911 | // The boolean is used in GetReconstructor to load the | |
912 | // upgrade reconstructor instead of the standard one. | |
913 | for(Int_t iDet = 0; iDet < kNDetectors; iDet++) { | |
914 | if(fUpgradeModule.Contains(fgkDetectorName[iDet])) fUpgradeMask[iDet]=kTRUE; | |
915 | } | |
916 | } | |
6bae477a | 917 | //_____________________________________________________________________________ |
918 | Bool_t AliReconstruction::MisalignGeometry(const TString& detectors) | |
919 | { | |
920 | // Read the alignment objects from CDB. | |
921 | // Each detector is supposed to have the | |
922 | // alignment objects in DET/Align/Data CDB path. | |
923 | // All the detector objects are then collected, | |
924 | // sorted by geometry level (starting from ALIC) and | |
925 | // then applied to the TGeo geometry. | |
926 | // Finally an overlaps check is performed. | |
927 | ||
928 | // Load alignment data from CDB and fill fAlignObjArray | |
929 | if(fLoadAlignFromCDB){ | |
6bae477a | 930 | |
25be1e5c | 931 | TString detStr = detectors; |
932 | TString loadAlObjsListOfDets = ""; | |
933 | ||
ac4a7581 | 934 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
8cb26cdf | 935 | if(!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
f12d42ce | 936 | if(!strcmp(fgkDetectorName[iDet],"HLT")) continue; |
4fbb8e9d | 937 | |
938 | if(AliGeomManager::GetNalignable(fgkDetectorName[iDet]) != 0) | |
8cb26cdf | 939 | { |
940 | loadAlObjsListOfDets += fgkDetectorName[iDet]; | |
941 | loadAlObjsListOfDets += " "; | |
942 | } | |
25be1e5c | 943 | } // end loop over detectors |
4fbb8e9d | 944 | |
945 | if(AliGeomManager::GetNalignable("GRP") != 0) | |
8cb26cdf | 946 | loadAlObjsListOfDets.Prepend("GRP "); //add alignment objects for non-sensitive modules |
98e303d9 | 947 | AliGeomManager::ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data()); |
25be1e5c | 948 | }else{ |
949 | // Check if the array with alignment objects was | |
950 | // provided by the user. If yes, apply the objects | |
951 | // to the present TGeo geometry | |
952 | if (fAlignObjArray) { | |
953 | if (gGeoManager && gGeoManager->IsClosed()) { | |
98e303d9 | 954 | if (AliGeomManager::ApplyAlignObjsToGeom(*fAlignObjArray) == kFALSE) { |
25be1e5c | 955 | AliError("The misalignment of one or more volumes failed!" |
956 | "Compare the list of simulated detectors and the list of detector alignment data!"); | |
957 | return kFALSE; | |
958 | } | |
959 | } | |
960 | else { | |
961 | AliError("Can't apply the misalignment! gGeoManager doesn't exist or it is still opened!"); | |
6bae477a | 962 | return kFALSE; |
963 | } | |
964 | } | |
6bae477a | 965 | } |
25be1e5c | 966 | |
4b71572b | 967 | if (fAlignObjArray) { |
968 | fAlignObjArray->Delete(); | |
969 | delete fAlignObjArray; fAlignObjArray=NULL; | |
970 | } | |
a03b0371 | 971 | |
6bae477a | 972 | return kTRUE; |
973 | } | |
596a855f | 974 | |
975 | //_____________________________________________________________________________ | |
976 | void AliReconstruction::SetGAliceFile(const char* fileName) | |
977 | { | |
978 | // set the name of the galice file | |
979 | ||
980 | fGAliceFileName = fileName; | |
981 | } | |
982 | ||
21a3aa09 | 983 | //_____________________________________________________________________________ |
b58710ef | 984 | void AliReconstruction::SetInput(const char* input) |
21a3aa09 | 985 | { |
b58710ef | 986 | // In case the input string starts with 'mem://', we run in an online mode |
987 | // and AliRawReaderDateOnline object is created. In all other cases a raw-data | |
988 | // file is assumed. One can give as an input: | |
989 | // mem://: - events taken from DAQ monitoring libs online | |
990 | // or | |
991 | // mem://<filename> - emulation of the above mode (via DATE monitoring libs) | |
4b71572b | 992 | if (input) fRawInput = input; |
21a3aa09 | 993 | } |
994 | ||
975320a0 | 995 | //_____________________________________________________________________________ |
996 | void AliReconstruction::SetOutput(const char* output) | |
997 | { | |
998 | // Set the output ESD filename | |
999 | // 'output' is a normalt ROOT url | |
1000 | // The method is used in case of raw-data reco with PROOF | |
81d57268 | 1001 | if (output) fESDOutput = output; |
975320a0 | 1002 | } |
1003 | ||
efd2085e | 1004 | //_____________________________________________________________________________ |
1005 | void AliReconstruction::SetOption(const char* detector, const char* option) | |
1006 | { | |
1007 | // set options for the reconstruction of a detector | |
1008 | ||
1009 | TObject* obj = fOptions.FindObject(detector); | |
1010 | if (obj) fOptions.Remove(obj); | |
1011 | fOptions.Add(new TNamed(detector, option)); | |
1012 | } | |
1013 | ||
7e88424f | 1014 | //_____________________________________________________________________________ |
1015 | void AliReconstruction::SetRecoParam(const char* detector, AliDetectorRecoParam *par) | |
1016 | { | |
1017 | // Set custom reconstruction parameters for a given detector | |
1018 | // Single set of parameters for all the events | |
a00021a7 | 1019 | |
1020 | // First check if the reco-params are global | |
1021 | if(!strcmp(detector, "GRP")) { | |
1022 | par->SetAsDefault(); | |
ac4a7581 | 1023 | fRecoParam.AddDetRecoParam(kNDetectors,par); |
a00021a7 | 1024 | return; |
1025 | } | |
1026 | ||
ac4a7581 | 1027 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
7e88424f | 1028 | if(!strcmp(detector, fgkDetectorName[iDet])) { |
1029 | par->SetAsDefault(); | |
1030 | fRecoParam.AddDetRecoParam(iDet,par); | |
1031 | break; | |
1032 | } | |
1033 | } | |
1034 | ||
1035 | } | |
1036 | ||
61807e09 | 1037 | //_____________________________________________________________________________ |
61807e09 | 1038 | Bool_t AliReconstruction::InitGRP() { |
1039 | //------------------------------------ | |
1040 | // Initialization of the GRP entry | |
1041 | //------------------------------------ | |
1042 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); | |
1043 | ||
4b71572b | 1044 | if (entry) { |
44e45fac | 1045 | |
1046 | TMap* m = dynamic_cast<TMap*>(entry->GetObject()); // old GRP entry | |
1047 | ||
1048 | if (m) { | |
1049 | AliInfo("Found a TMap in GRP/GRP/Data, converting it into an AliGRPObject"); | |
1050 | m->Print(); | |
1051 | fGRPData = new AliGRPObject(); | |
1052 | fGRPData->ReadValuesFromMap(m); | |
1053 | } | |
1054 | ||
1055 | else { | |
1056 | AliInfo("Found an AliGRPObject in GRP/GRP/Data, reading it"); | |
1057 | fGRPData = dynamic_cast<AliGRPObject*>(entry->GetObject()); // new GRP entry | |
1058 | entry->SetOwner(0); | |
1059 | } | |
1060 | ||
f168abba | 1061 | // FIX ME: The unloading of GRP entry is temporarily disabled |
1062 | // because ZDC and VZERO are using it in order to initialize | |
1063 | // their reconstructor objects. In the future one has to think | |
1064 | // of propagating AliRunInfo to the reconstructors. | |
1065 | // AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data"); | |
4b71572b | 1066 | } |
61807e09 | 1067 | |
1068 | if (!fGRPData) { | |
1069 | AliError("No GRP entry found in OCDB!"); | |
1070 | return kFALSE; | |
1071 | } | |
1072 | ||
44e45fac | 1073 | TString lhcState = fGRPData->GetLHCState(); |
1074 | if (lhcState==AliGRPObject::GetInvalidString()) { | |
7e88424f | 1075 | AliError("GRP/GRP/Data entry: missing value for the LHC state ! Using UNKNOWN"); |
44e45fac | 1076 | lhcState = "UNKNOWN"; |
7e88424f | 1077 | } |
1078 | ||
44e45fac | 1079 | TString beamType = fGRPData->GetBeamType(); |
1080 | if (beamType==AliGRPObject::GetInvalidString()) { | |
7e88424f | 1081 | AliError("GRP/GRP/Data entry: missing value for the beam type ! Using UNKNOWN"); |
44e45fac | 1082 | beamType = "UNKNOWN"; |
7e88424f | 1083 | } |
1084 | ||
44e45fac | 1085 | Float_t beamEnergy = fGRPData->GetBeamEnergy(); |
1086 | if (beamEnergy==AliGRPObject::GetInvalidFloat()) { | |
7e88424f | 1087 | AliError("GRP/GRP/Data entry: missing value for the beam energy ! Using 0"); |
44e45fac | 1088 | beamEnergy = 0; |
7e88424f | 1089 | } |
1090 | ||
44e45fac | 1091 | TString runType = fGRPData->GetRunType(); |
1092 | if (runType==AliGRPObject::GetInvalidString()) { | |
7e88424f | 1093 | AliError("GRP/GRP/Data entry: missing value for the run type ! Using UNKNOWN"); |
44e45fac | 1094 | runType = "UNKNOWN"; |
7e88424f | 1095 | } |
1096 | ||
44e45fac | 1097 | Int_t activeDetectors = fGRPData->GetDetectorMask(); |
a5dede5c | 1098 | if (activeDetectors==AliGRPObject::GetInvalidUInt()) { |
7e88424f | 1099 | AliError("GRP/GRP/Data entry: missing value for the detector mask ! Using 1074790399"); |
44e45fac | 1100 | activeDetectors = 1074790399; |
7e88424f | 1101 | } |
820b4d9e | 1102 | AliDebug(1, Form("activeDetectors = %d", activeDetectors)); |
7e88424f | 1103 | |
44e45fac | 1104 | fRunInfo = new AliRunInfo(lhcState, beamType, beamEnergy, runType, activeDetectors); |
44e45fac | 1105 | fRunInfo->Dump(); |
1106 | ||
7e88424f | 1107 | |
1108 | // Process the list of active detectors | |
44e45fac | 1109 | if (activeDetectors) { |
1110 | UInt_t detMask = activeDetectors; | |
820b4d9e | 1111 | AliDebug(1, Form("Detector List = %s", fRunLocalReconstruction.Data())); |
7a317bef | 1112 | fRunLocalReconstruction = MatchDetectorList(fRunLocalReconstruction,detMask); |
820b4d9e | 1113 | AliDebug(1, Form("Detector List = %s", fRunLocalReconstruction.Data())); |
7a317bef | 1114 | fRunTracking = MatchDetectorList(fRunTracking,detMask); |
1115 | fFillESD = MatchDetectorList(fFillESD,detMask); | |
1116 | fQADetectors = MatchDetectorList(fQADetectors,detMask); | |
e54c9180 | 1117 | fDeleteRecPoints = MatchDetectorList(fDeleteRecPoints,detMask); |
1118 | fDeleteDigits = MatchDetectorList(fDeleteDigits,detMask); | |
7d566c20 | 1119 | fLoadCDB.Form("%s %s %s %s", |
1120 | fRunLocalReconstruction.Data(), | |
1121 | fRunTracking.Data(), | |
1122 | fFillESD.Data(), | |
1123 | fQADetectors.Data()); | |
7d566c20 | 1124 | fLoadCDB = MatchDetectorList(fLoadCDB,detMask); |
d0f84c42 | 1125 | if (!((detMask >> AliDAQ::DetectorID("ITSSPD")) & 0x1) && |
1126 | !((detMask >> AliDAQ::DetectorID("ITSSDD")) & 0x1) && | |
1127 | !((detMask >> AliDAQ::DetectorID("ITSSSD")) & 0x1) ) { | |
91e2f025 | 1128 | // switch off the vertexer |
1f9831ab | 1129 | AliInfo("SPD,SDD,SSD is not in the list of active detectors. Vertexer and Trackleter are switched off."); |
91e2f025 | 1130 | fRunVertexFinder = kFALSE; |
1f9831ab | 1131 | fRunMultFinder = kFALSE; |
91e2f025 | 1132 | } |
304d7f0b | 1133 | if (!((detMask >> AliDAQ::DetectorID("TRG")) & 0x1)) { |
1134 | // switch off the reading of CTP raw-data payload | |
1135 | if (fFillTriggerESD) { | |
1136 | AliInfo("CTP is not in the list of active detectors. CTP data reading switched off."); | |
1137 | fFillTriggerESD = kFALSE; | |
1138 | } | |
1139 | } | |
7e88424f | 1140 | } |
1141 | ||
1142 | AliInfo("==================================================================================="); | |
1143 | AliInfo(Form("Running local reconstruction for detectors: %s",fRunLocalReconstruction.Data())); | |
1144 | AliInfo(Form("Running tracking for detectors: %s",fRunTracking.Data())); | |
1145 | AliInfo(Form("Filling ESD for detectors: %s",fFillESD.Data())); | |
ca13fb87 | 1146 | AliInfo(Form("Quality assurance is active for detectors: %s",fQADetectors.Data())); |
7d566c20 | 1147 | AliInfo(Form("CDB and reconstruction parameters are loaded for detectors: %s",fLoadCDB.Data())); |
7e88424f | 1148 | AliInfo("==================================================================================="); |
61807e09 | 1149 | |
1150 | //*** Dealing with the magnetic field map | |
5a004fb4 | 1151 | if ( TGeoGlobalMagField::Instance()->IsLocked() ) { |
1152 | if (TGeoGlobalMagField::Instance()->GetField()->TestBit(AliMagF::kOverrideGRP)) { | |
1153 | AliInfo("ExpertMode!!! GRP information will be ignored !"); | |
1154 | AliInfo("ExpertMode!!! Running with the externally locked B field !"); | |
1155 | } | |
1156 | else { | |
1157 | AliInfo("Destroying existing B field instance!"); | |
1158 | delete TGeoGlobalMagField::Instance(); | |
1159 | } | |
1160 | } | |
1161 | if ( !TGeoGlobalMagField::Instance()->IsLocked() ) { | |
61807e09 | 1162 | // Construct the field map out of the information retrieved from GRP. |
856024f0 | 1163 | Bool_t ok = kTRUE; |
61807e09 | 1164 | // L3 |
44e45fac | 1165 | Float_t l3Current = fGRPData->GetL3Current((AliGRPObject::Stats)0); |
1166 | if (l3Current == AliGRPObject::GetInvalidFloat()) { | |
1167 | AliError("GRP/GRP/Data entry: missing value for the L3 current !"); | |
1168 | ok = kFALSE; | |
1169 | } | |
f7a1cc68 | 1170 | |
44e45fac | 1171 | Char_t l3Polarity = fGRPData->GetL3Polarity(); |
1172 | if (l3Polarity == AliGRPObject::GetInvalidChar()) { | |
1173 | AliError("GRP/GRP/Data entry: missing value for the L3 polarity !"); | |
1174 | ok = kFALSE; | |
1175 | } | |
1176 | ||
1177 | // Dipole | |
1178 | Float_t diCurrent = fGRPData->GetDipoleCurrent((AliGRPObject::Stats)0); | |
1179 | if (diCurrent == AliGRPObject::GetInvalidFloat()) { | |
1180 | AliError("GRP/GRP/Data entry: missing value for the dipole current !"); | |
1181 | ok = kFALSE; | |
1182 | } | |
1183 | ||
1184 | Char_t diPolarity = fGRPData->GetDipolePolarity(); | |
1185 | if (diPolarity == AliGRPObject::GetInvalidChar()) { | |
1186 | AliError("GRP/GRP/Data entry: missing value for the dipole polarity !"); | |
1187 | ok = kFALSE; | |
1188 | } | |
1189 | ||
99c7d495 | 1190 | // read special bits for the polarity convention and map type |
1191 | Int_t polConvention = fGRPData->IsPolarityConventionLHC() ? AliMagF::kConvLHC : AliMagF::kConvDCS2008; | |
1192 | Bool_t uniformB = fGRPData->IsUniformBMap(); | |
61807e09 | 1193 | |
856024f0 | 1194 | if (ok) { |
33fe5eb1 | 1195 | AliMagF* fld = AliMagF::CreateFieldMap(TMath::Abs(l3Current) * (l3Polarity ? -1:1), |
1196 | TMath::Abs(diCurrent) * (diPolarity ? -1:1), | |
1197 | polConvention,uniformB,beamEnergy, beamType.Data()); | |
1198 | if (fld) { | |
1199 | TGeoGlobalMagField::Instance()->SetField( fld ); | |
1200 | TGeoGlobalMagField::Instance()->Lock(); | |
1201 | AliInfo("Running with the B field constructed out of GRP !"); | |
1202 | } | |
1203 | else AliFatal("Failed to create a B field map !"); | |
856024f0 | 1204 | } |
f7a1cc68 | 1205 | else AliFatal("B field is neither set nor constructed from GRP ! Exitig..."); |
61807e09 | 1206 | } |
f7a1cc68 | 1207 | |
f2a195c1 | 1208 | //*** Get the diamond profiles from OCDB |
1209 | entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexSPD"); | |
1210 | if (entry) { | |
1211 | fDiamondProfileSPD = dynamic_cast<AliESDVertex*> (entry->GetObject()); | |
1212 | } else { | |
1213 | AliError("No SPD diamond profile found in OCDB!"); | |
1214 | } | |
1215 | ||
61807e09 | 1216 | entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertex"); |
1217 | if (entry) { | |
f2a195c1 | 1218 | fDiamondProfile = dynamic_cast<AliESDVertex*> (entry->GetObject()); |
61807e09 | 1219 | } else { |
1220 | AliError("No diamond profile found in OCDB!"); | |
1221 | } | |
1222 | ||
1223 | entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexTPC"); | |
1224 | if (entry) { | |
f2a195c1 | 1225 | fDiamondProfileTPC = dynamic_cast<AliESDVertex*> (entry->GetObject()); |
61807e09 | 1226 | } else { |
f2a195c1 | 1227 | AliError("No TPC diamond profile found in OCDB!"); |
61807e09 | 1228 | } |
1229 | ||
77ba28ba | 1230 | entry = AliCDBManager::Instance()->Get("GRP/Calib/CosmicTriggers"); |
1231 | if (entry) { | |
1232 | fListOfCosmicTriggers = dynamic_cast<THashTable*>(entry->GetObject()); | |
1233 | entry->SetOwner(0); | |
77ba28ba | 1234 | } |
1235 | ||
1236 | if (!fListOfCosmicTriggers) { | |
1237 | AliWarning("Can not get list of cosmic triggers from OCDB! Cosmic event specie will be effectively disabled!"); | |
1238 | } | |
1239 | ||
61807e09 | 1240 | return kTRUE; |
1241 | } | |
1242 | ||
4b71572b | 1243 | //_____________________________________________________________________________ |
1244 | Bool_t AliReconstruction::LoadCDB() | |
1245 | { | |
0a035be5 | 1246 | // Load CDB entries for all active detectors. |
1247 | // By default we load all the entries in <det>/Calib | |
1248 | // folder. | |
1249 | ||
52dd4a8c | 1250 | AliCodeTimerAuto("",0); |
4b71572b | 1251 | |
1252 | AliCDBManager::Instance()->Get("GRP/CTP/Config"); | |
1253 | ||
30d5d647 | 1254 | AliCDBManager::Instance()->Get("GRP/Calib/LHCClockPhase"); |
1255 | ||
7d566c20 | 1256 | TString detStr = fLoadCDB; |
ac4a7581 | 1257 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
4b71572b | 1258 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
1259 | AliCDBManager::Instance()->GetAll(Form("%s/Calib/*",fgkDetectorName[iDet])); | |
b6af2cb6 | 1260 | AliCDBManager::Instance()->GetAll(Form("%s/Trigger/*",fgkDetectorName[iDet])); |
4b71572b | 1261 | } |
e122592f | 1262 | |
1263 | // Temporary fix - one has to define the correct policy in order | |
1264 | // to load the trigger OCDB entries only for the detectors that | |
1265 | // in the trigger or that are needed in order to put correct | |
1266 | // information in ESD | |
1267 | AliCDBManager::Instance()->GetAll("TRIGGER/*/*"); | |
1268 | ||
4b71572b | 1269 | return kTRUE; |
1270 | } | |
522fdd91 | 1271 | //_____________________________________________________________________________ |
1272 | Bool_t AliReconstruction::LoadTriggerScalersCDB() | |
1273 | { | |
0a035be5 | 1274 | // Load CTP scalers from OCDB. |
1275 | // The scalers are checked for consistency. | |
1276 | ||
52dd4a8c | 1277 | AliCodeTimerAuto("",0); |
522fdd91 | 1278 | |
1279 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/CTP/Scalers"); | |
4b71572b | 1280 | |
522fdd91 | 1281 | if (entry) { |
1282 | ||
1283 | AliInfo("Found an AliTriggerRunScalers in GRP/CTP/Scalers, reading it"); | |
1284 | fRunScalers = dynamic_cast<AliTriggerRunScalers*> (entry->GetObject()); | |
1285 | entry->SetOwner(0); | |
c7a22819 | 1286 | if (fRunScalers && (fRunScalers->CorrectScalersOverflow() == 0)) AliInfo("32bit Trigger counters corrected for overflow"); |
82ebedd6 | 1287 | |
522fdd91 | 1288 | } |
1289 | return kTRUE; | |
1290 | } | |
596a855f | 1291 | //_____________________________________________________________________________ |
52dd4a8c | 1292 | Bool_t AliReconstruction::LoadCTPTimeParamsCDB() |
1293 | { | |
0a035be5 | 1294 | // Load CTP timing information (alignment) |
1295 | // from OCDB. | |
1296 | ||
52dd4a8c | 1297 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming"); |
c7ff1a33 | 1298 | if (!entry) return kFALSE; |
52dd4a8c | 1299 | |
c7ff1a33 | 1300 | AliInfo("Found an AliCTPTimeParams in GRP/CTP/CTPtiming, reading it"); |
1301 | fCTPTimeParams = dynamic_cast<AliCTPTimeParams*> (entry->GetObject()); | |
1302 | entry->SetOwner(0); | |
52dd4a8c | 1303 | |
c7ff1a33 | 1304 | AliCDBEntry* entry2 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign"); |
1305 | if (!entry2) return kFALSE; | |
1306 | ||
1307 | AliInfo("Found an AliCTPTimeParams in GRP/CTP/TimeAlign, reading it"); | |
028be258 | 1308 | fCTPTimeAlign = dynamic_cast<AliCTPTimeParams*> (entry2->GetObject()); |
1309 | entry2->SetOwner(0); | |
c7ff1a33 | 1310 | |
1311 | return kTRUE; | |
52dd4a8c | 1312 | } |
3d84ad67 | 1313 | |
1314 | //_____________________________________________________________________________ | |
1315 | Bool_t AliReconstruction::ReadIntensityInfoCDB() | |
1316 | { | |
1317 | // Load LHC DIP data | |
2af04ffd | 1318 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/LHCData"); |
1319 | AliCDBEntry* entryCTP = AliCDBManager::Instance()->Get("GRP/CTP/Config"); | |
1320 | // | |
bc5c8516 | 1321 | if (!entry || !entryCTP) { |
1322 | AliError(Form("Failed to extract CDB objects GRP/GRP/LHCData: %p or GRP/CTP/Config: %p",entry,entryCTP)); | |
1323 | return kFALSE; | |
1324 | } | |
2af04ffd | 1325 | // extract BC masks |
1326 | enum {kA,kB,kC,kE,kNMasks}; | |
1327 | AliTriggerConfiguration* conf = (AliTriggerConfiguration*)entryCTP->GetObject(); | |
1328 | const TObjArray& clArr = conf->GetClasses(); | |
1329 | TObjArray masks(kNMasks); | |
1330 | TIter next(&clArr); | |
1331 | AliTriggerClass* trClass = 0; | |
1332 | int nFound = 0; | |
1333 | masks.SetOwner(kFALSE); | |
1334 | // | |
1335 | while ( (trClass=(AliTriggerClass*)next()) ) { | |
1336 | TString trName = trClass->GetName(); | |
1337 | int ind = trName.Index("-"); // prefix in front of A,B,C,E | |
1338 | if (ind<1) continue; // anomaly | |
1339 | // | |
1340 | trName = trName.Data() + ind; | |
1341 | AliTriggerBCMask* bcMask = trClass->GetBCMask(); | |
1342 | if (!bcMask) continue; | |
1343 | UInt_t which = 0; | |
1344 | if (trName.BeginsWith("-A-")) which |= 0x1<<kA; | |
1345 | else if (trName.BeginsWith("-B-")) which |= 0x1<<kB; | |
1346 | else if (trName.BeginsWith("-C-")) which |= 0x1<<kC; | |
1347 | else if (trName.BeginsWith("-E-")) which |= 0x1<<kE; | |
1348 | else if (trName.BeginsWith("-AC-")) which |= (0x1<<kA) | (0x1<<kC); | |
1349 | else if (trName.BeginsWith("-CA-")) which |= (0x1<<kA) | (0x1<<kC); | |
1350 | else { AliWarning(Form("Unknown trigger type %s\n",trClass->GetName())); continue;} | |
1351 | // | |
1352 | for (int ip=kNMasks;ip--;) { | |
1353 | if ( !(which&(0x1<<ip)) || masks[ip] ) continue; // does not match or already done | |
1354 | masks[ip] = (TObject*)bcMask; | |
1355 | nFound++; | |
1356 | } | |
1357 | if (nFound==kNMasks) break; | |
1358 | } | |
1359 | // | |
1360 | AliInfo("Reading mean bunch intensities from GRP/GRP/LHCData"); | |
1361 | AliLHCData* dipData = dynamic_cast<AliLHCData*> (entry->GetObject()); | |
1362 | // | |
1363 | for (int ib=2;ib--;) { | |
1364 | double intI,intNI; | |
1365 | if (dipData && (dipData->GetMeanIntensity(ib,intI,intNI,&masks)>=0)) { | |
1366 | fBeamInt[ib][0] = intI; | |
1367 | fBeamInt[ib][1] = intNI; | |
1368 | AliInfo(Form("Mean intensity for beam %d: Interacting:%.2e Non-Interacting:%.2e",ib,intI,intNI)); | |
3d84ad67 | 1369 | } |
3d84ad67 | 1370 | } |
2af04ffd | 1371 | return kTRUE; |
1372 | // | |
3d84ad67 | 1373 | } |
1374 | ||
1375 | ||
52dd4a8c | 1376 | //_____________________________________________________________________________ |
21a3aa09 | 1377 | Bool_t AliReconstruction::Run(const char* input) |
596a855f | 1378 | { |
21a3aa09 | 1379 | // Run Run Run |
52dd4a8c | 1380 | AliCodeTimerAuto("",0); |
596a855f | 1381 | |
4b71572b | 1382 | InitRun(input); |
1383 | if (GetAbort() != TSelector::kContinue) return kFALSE; | |
1384 | ||
1385 | TChain *chain = NULL; | |
1386 | if (fRawReader && (chain = fRawReader->GetChain())) { | |
2a284cef | 1387 | Long64_t nEntries = (fLastEvent < 0) ? (TChain::kBigNumber) : (fLastEvent - fFirstEvent + 1); |
4b71572b | 1388 | // Proof mode |
1389 | if (gProof) { | |
52dd4a8c | 1390 | // Temporary fix for long raw-data runs (until socket timeout handling in PROOF is revised) |
1391 | gProof->Exec("gEnv->SetValue(\"Proof.SocketActivityTimeout\",-1)", kTRUE); | |
6c6f2624 | 1392 | |
1393 | if (gGrid) | |
1394 | gProof->Exec("TGrid::Connect(\"alien://\")",kTRUE); | |
1395 | ||
1396 | TMessage::EnableSchemaEvolutionForAll(kTRUE); | |
1397 | gProof->Exec("TMessage::EnableSchemaEvolutionForAll(kTRUE)",kTRUE); | |
1398 | ||
4b71572b | 1399 | gProof->AddInput(this); |
81d57268 | 1400 | |
1401 | if (!ParseOutput()) return kFALSE; | |
1402 | ||
975320a0 | 1403 | gProof->SetParameter("PROOF_MaxSlavesPerNode", 9999); |
4b71572b | 1404 | chain->SetProof(); |
2a284cef | 1405 | chain->Process("AliReconstruction","",nEntries,fFirstEvent); |
4b71572b | 1406 | } |
1407 | else { | |
2a284cef | 1408 | chain->Process(this,"",nEntries,fFirstEvent); |
4b71572b | 1409 | } |
1410 | } | |
1411 | else { | |
1412 | Begin(NULL); | |
1413 | if (GetAbort() != TSelector::kContinue) return kFALSE; | |
1414 | SlaveBegin(NULL); | |
1415 | if (GetAbort() != TSelector::kContinue) return kFALSE; | |
1416 | //******* The loop over events | |
44e45fac | 1417 | AliInfo("Starting looping over events"); |
4b71572b | 1418 | Int_t iEvent = 0; |
1419 | while ((iEvent < fRunLoader->GetNumberOfEvents()) || | |
1420 | (fRawReader && fRawReader->NextEvent())) { | |
30b916f7 | 1421 | // |
1422 | // check if process has enough resources | |
1423 | if (!HasEnoughResources(iEvent)) break; | |
4b71572b | 1424 | if (!ProcessEvent(iEvent)) { |
930e6e3e | 1425 | Abort("ProcessEvent",TSelector::kAbortFile); |
1426 | return kFALSE; | |
4b71572b | 1427 | } |
1428 | iEvent++; | |
1429 | } | |
1430 | SlaveTerminate(); | |
1431 | if (GetAbort() != TSelector::kContinue) return kFALSE; | |
1432 | Terminate(); | |
1433 | if (GetAbort() != TSelector::kContinue) return kFALSE; | |
21a3aa09 | 1434 | } |
21a3aa09 | 1435 | |
1436 | return kTRUE; | |
1437 | } | |
1438 | ||
1439 | //_____________________________________________________________________________ | |
4b71572b | 1440 | void AliReconstruction::InitRawReader(const char* input) |
21a3aa09 | 1441 | { |
4b71572b | 1442 | // Init raw-reader and |
21a3aa09 | 1443 | // set the input in case of raw data |
0a035be5 | 1444 | |
1445 | AliCodeTimerAuto("",0); | |
1446 | ||
4b71572b | 1447 | if (input) fRawInput = input; |
1448 | fRawReader = AliRawReader::Create(fRawInput.Data()); | |
c35f192e | 1449 | if (!fRawReader) { |
1450 | if (fRawInput.IsNull()) { | |
1451 | AliInfo("Reconstruction will run over digits"); | |
1452 | } | |
1453 | else { | |
1454 | AliFatal("Can not create raw-data reader ! Exiting..."); | |
1455 | } | |
1456 | } | |
e0027792 | 1457 | |
35042093 | 1458 | if (!fEquipIdMap.IsNull() && fRawReader) |
1459 | fRawReader->LoadEquipmentIdsMap(fEquipIdMap); | |
1460 | ||
cd0b062e | 1461 | if (!fUseHLTData.IsNull()) { |
1462 | // create the RawReaderHLT which performs redirection of HLT input data for | |
1463 | // the specified detectors | |
1464 | AliRawReader* pRawReader=AliRawHLTManager::CreateRawReaderHLT(fRawReader, fUseHLTData.Data()); | |
1465 | if (pRawReader) { | |
1466 | fParentRawReader=fRawReader; | |
1467 | fRawReader=pRawReader; | |
1468 | } else { | |
1469 | AliError(Form("can not create Raw Reader for HLT input %s", fUseHLTData.Data())); | |
1470 | } | |
1471 | } | |
4b71572b | 1472 | AliSysInfo::AddStamp("CreateRawReader"); |
1473 | } | |
cd0b062e | 1474 | |
4b71572b | 1475 | //_____________________________________________________________________________ |
1476 | void AliReconstruction::InitRun(const char* input) | |
1477 | { | |
1478 | // Initialization of raw-reader, | |
1479 | // run number, CDB etc. | |
52dd4a8c | 1480 | AliCodeTimerAuto("",0); |
4b71572b | 1481 | AliSysInfo::AddStamp("Start"); |
1482 | ||
002c9d1b | 1483 | // Initialize raw-reader if any |
4b71572b | 1484 | InitRawReader(input); |
596a855f | 1485 | |
ec92bee0 | 1486 | // Initialize the CDB storage |
795e4a22 | 1487 | InitCDB(); |
ec92bee0 | 1488 | |
6bae477a | 1489 | // Set run number in CDBManager (if it is not already set by the user) |
4b71572b | 1490 | if (!SetRunNumberFromData()) { |
1491 | Abort("SetRunNumberFromData", TSelector::kAbortProcess); | |
1492 | return; | |
1493 | } | |
002c9d1b | 1494 | |
795e4a22 | 1495 | // Set CDB lock: from now on it is forbidden to reset the run number |
1496 | // or the default storage or to activate any further storage! | |
1497 | SetCDBLock(); | |
1498 | ||
002c9d1b | 1499 | } |
1500 | ||
1501 | //_____________________________________________________________________________ | |
1502 | void AliReconstruction::Begin(TTree *) | |
1503 | { | |
1504 | // Initialize AlReconstruction before | |
1505 | // going into the event loop | |
1506 | // Should follow the TSelector convention | |
1507 | // i.e. initialize only the object on the client side | |
52dd4a8c | 1508 | AliCodeTimerAuto("",0); |
db4aeca1 | 1509 | |
b4fef0d2 | 1510 | AliReconstruction *reco = NULL; |
002c9d1b | 1511 | if (fInput) { |
8fb1f1dc | 1512 | if ((reco = (AliReconstruction*)fInput->FindObject("AliReconstruction"))) { |
002c9d1b | 1513 | *this = *reco; |
002c9d1b | 1514 | } |
1515 | AliSysInfo::AddStamp("ReadInputInBegin"); | |
1516 | } | |
1517 | ||
6bae477a | 1518 | // Import ideal TGeo geometry and apply misalignment |
1519 | if (!gGeoManager) { | |
1520 | TString geom(gSystem->DirName(fGAliceFileName)); | |
1521 | geom += "/geometry.root"; | |
98e303d9 | 1522 | AliGeomManager::LoadGeometry(geom.Data()); |
4b71572b | 1523 | if (!gGeoManager) { |
1524 | Abort("LoadGeometry", TSelector::kAbortProcess); | |
1525 | return; | |
1526 | } | |
281270d3 | 1527 | AliSysInfo::AddStamp("LoadGeom"); |
ff5970a3 | 1528 | TString detsToCheck=fRunLocalReconstruction; |
4b71572b | 1529 | if(!AliGeomManager::CheckSymNamesLUT(detsToCheck.Data())) { |
1530 | Abort("CheckSymNamesLUT", TSelector::kAbortProcess); | |
1531 | return; | |
1532 | } | |
281270d3 | 1533 | AliSysInfo::AddStamp("CheckGeom"); |
6bae477a | 1534 | } |
8e245d15 | 1535 | |
7ec0d3df | 1536 | Bool_t loadedFromSnapshot=kFALSE; |
1537 | Bool_t toCDBSnapshot=kFALSE; | |
1538 | TString snapshotFileOut(""); // we could use fSnapshotFileName if we are not interested | |
1539 | // in reading from and writing to a snapshot file at the same time | |
1540 | if(TString(gSystem->Getenv("OCDB_SNAPSHOT_CREATE")) == TString("kTRUE")){ | |
1541 | toCDBSnapshot=kTRUE; | |
1542 | //fFromCDBSnapshot=kFALSE; | |
1543 | TString snapshotFile(gSystem->Getenv("OCDB_SNAPSHOT_FILENAME")); | |
1544 | if(!(snapshotFile.IsNull() || snapshotFile.IsWhitespace())) | |
1545 | snapshotFileOut = snapshotFile; | |
1546 | else | |
1547 | snapshotFileOut="OCDB.root"; | |
1548 | } | |
647d2bb8 | 1549 | if(fFromCDBSnapshot){ |
1550 | AliDebug(2,"Initializing from a CDB snapshot"); | |
7ec0d3df | 1551 | loadedFromSnapshot = AliCDBManager::Instance()->InitFromSnapshot(fSnapshotFileName.Data()); |
647d2bb8 | 1552 | } |
1553 | ||
4b71572b | 1554 | if (!MisalignGeometry(fLoadAlignData)) { |
1555 | Abort("MisalignGeometry", TSelector::kAbortProcess); | |
1556 | return; | |
1557 | } | |
1558 | AliCDBManager::Instance()->UnloadFromCache("GRP/Geometry/Data"); | |
e0a6e696 | 1559 | if(!toCDBSnapshot) AliCDBManager::Instance()->UnloadFromCache("*/Align/*"); |
281270d3 | 1560 | AliSysInfo::AddStamp("MisalignGeom"); |
6bae477a | 1561 | |
8cb26cdf | 1562 | if (!InitGRP()) { |
1563 | Abort("InitGRP", TSelector::kAbortProcess); | |
1564 | return; | |
1565 | } | |
1566 | AliSysInfo::AddStamp("InitGRP"); | |
e0a6e696 | 1567 | if(!toCDBSnapshot) AliCDBManager::Instance()->UnloadFromCache("GRP/Calib/CosmicTriggers"); |
8cb26cdf | 1568 | |
7ec0d3df | 1569 | if(!loadedFromSnapshot){ |
647d2bb8 | 1570 | if (!LoadCDB()) { |
1571 | Abort("LoadCDB", TSelector::kAbortProcess); | |
1572 | return; | |
1573 | } | |
1574 | AliSysInfo::AddStamp("LoadCDB"); | |
4b71572b | 1575 | } |
325aa76f | 1576 | |
a6dd87ad | 1577 | if (!LoadTriggerScalersCDB()) { |
1578 | Abort("LoadTriggerScalersCDB", TSelector::kAbortProcess); | |
1579 | return; | |
1580 | } | |
1581 | AliSysInfo::AddStamp("LoadTriggerScalersCDB"); | |
1582 | ||
52dd4a8c | 1583 | if (!LoadCTPTimeParamsCDB()) { |
1584 | Abort("LoadCTPTimeParamsCDB", TSelector::kAbortProcess); | |
1585 | return; | |
1586 | } | |
1587 | AliSysInfo::AddStamp("LoadCTPTimeParamsCDB"); | |
a6dd87ad | 1588 | |
bd26f597 | 1589 | if (!ReadIntensityInfoCDB()) { |
1590 | Abort("ReadIntensityInfoCDB", TSelector::kAbortProcess); | |
1591 | return; | |
1592 | } | |
1593 | AliSysInfo::AddStamp("ReadIntensityInfoCDB"); | |
1594 | ||
7e88424f | 1595 | // Read the reconstruction parameters from OCDB |
1596 | if (!InitRecoParams()) { | |
002c9d1b | 1597 | AliWarning("Not all detectors have correct RecoParam objects initialized"); |
4b71572b | 1598 | } |
1599 | AliSysInfo::AddStamp("InitRecoParams"); | |
1600 | ||
e0a6e696 | 1601 | if(toCDBSnapshot) |
7ec0d3df | 1602 | AliCDBManager::Instance()->DumpToSnapshotFile(snapshotFileOut.Data()); |
e0a6e696 | 1603 | AliCDBManager::Instance()->UnloadFromCache("*/Align/*"); |
1604 | AliCDBManager::Instance()->UnloadFromCache("GRP/Calib/CosmicTriggers"); | |
7ec0d3df | 1605 | |
fd2b273c | 1606 | if (fInput && gProof) { |
b4fef0d2 | 1607 | if (reco) *reco = *this; |
fd2b273c | 1608 | |
45a6dee6 | 1609 | gGeoManager->SetName("Geometry"); |
fd2b273c | 1610 | gProof->AddInputData(gGeoManager,kTRUE); |
002c9d1b | 1611 | gGeoManager = NULL; |
fd2b273c | 1612 | gProof->AddInputData(const_cast<TMap*>(AliCDBManager::Instance()->GetEntryCache()),kTRUE); |
002c9d1b | 1613 | fInput->Add(new TParameter<Int_t>("RunNumber",AliCDBManager::Instance()->GetRun())); |
f7a1cc68 | 1614 | AliMagF *magFieldMap = (AliMagF*)TGeoGlobalMagField::Instance()->GetField(); |
ead7b391 | 1615 | magFieldMap->SetName("MagneticFieldMap"); |
fd2b273c | 1616 | gProof->AddInputData(magFieldMap,kTRUE); |
42457748 | 1617 | if (fAnalysis) { |
1618 | fAnalysis->SetName("Analysis"); | |
1619 | gProof->AddInputData(fAnalysis,kTRUE); | |
1620 | } | |
002c9d1b | 1621 | } |
4b71572b | 1622 | |
1623 | } | |
1624 | ||
1625 | //_____________________________________________________________________________ | |
1626 | void AliReconstruction::SlaveBegin(TTree*) | |
1627 | { | |
1628 | // Initialization related to run-loader, | |
1629 | // vertexer, trackers, recontructors | |
1630 | // In proof mode it is executed on the slave | |
52dd4a8c | 1631 | AliCodeTimerAuto("",0); |
4b71572b | 1632 | |
db4aeca1 | 1633 | TProofOutputFile *outProofFile = NULL; |
81d57268 | 1634 | if (fInput) { |
1635 | if (AliDebugLevel() > 0) fInput->Print(); | |
ef5e52f6 | 1636 | if (AliDebugLevel() > 10) fInput->Dump(); |
db4aeca1 | 1637 | if (AliReconstruction *reco = (AliReconstruction*)fInput->FindObject("AliReconstruction")) { |
1638 | *this = *reco; | |
1639 | } | |
4b71572b | 1640 | if (TGeoManager *tgeo = (TGeoManager*)fInput->FindObject("Geometry")) { |
1641 | gGeoManager = tgeo; | |
1642 | AliGeomManager::SetGeometry(tgeo); | |
7e88424f | 1643 | } |
281270d3 | 1644 | if (TMap *entryCache = (TMap*)fInput->FindObject("CDBEntryCache")) { |
1645 | Int_t runNumber = -1; | |
1646 | if (TProof::GetParameter(fInput,"RunNumber",runNumber) == 0) { | |
1647 | AliCDBManager *man = AliCDBManager::Instance(entryCache,runNumber); | |
1648 | man->SetCacheFlag(kTRUE); | |
1649 | man->SetLock(kTRUE); | |
1650 | man->Print(); | |
1651 | } | |
4b71572b | 1652 | } |
ead7b391 | 1653 | if (AliMagF *map = (AliMagF*)fInput->FindObject("MagneticFieldMap")) { |
ef5e52f6 | 1654 | AliMagF *newMap = new AliMagF(*map); |
1655 | if (!newMap->LoadParameterization()) { | |
1656 | Abort("AliMagF::LoadParameterization", TSelector::kAbortProcess); | |
1657 | return; | |
1658 | } | |
1659 | TGeoGlobalMagField::Instance()->SetField(newMap); | |
1660 | TGeoGlobalMagField::Instance()->Lock(); | |
4b71572b | 1661 | } |
42457748 | 1662 | if (!fAnalysis) { |
1663 | // Attempt to get the analysis manager from the input list | |
1664 | fAnalysis = (AliAnalysisManager*)fInput->FindObject("Analysis"); | |
1665 | if (fAnalysis) AliInfo("==== Analysis manager retrieved from input list ===="); | |
1666 | } | |
81d57268 | 1667 | if (TNamed *outputFileName = (TNamed*)fInput->FindObject("PROOF_OUTPUTFILE")) |
1668 | fProofOutputFileName = outputFileName->GetTitle(); | |
1669 | if (TNamed *outputLocation = (TNamed*)fInput->FindObject("PROOF_OUTPUTFILE_LOCATION")) | |
1670 | fProofOutputLocation = outputLocation->GetTitle(); | |
1671 | if (fInput->FindObject("PROOF_OUTPUTFILE_DATASET")) | |
1672 | fProofOutputDataset = kTRUE; | |
1673 | if (TNamed *archiveList = (TNamed*)fInput->FindObject("PROOF_OUTPUTFILE_ARCHIVE")) | |
1674 | fProofOutputArchive = archiveList->GetTitle(); | |
1675 | if (!fProofOutputFileName.IsNull() && | |
1676 | !fProofOutputLocation.IsNull() && | |
1677 | fProofOutputArchive.IsNull()) { | |
1678 | if (!fProofOutputDataset) { | |
1679 | outProofFile = new TProofOutputFile(fProofOutputFileName.Data(),"M"); | |
1680 | outProofFile->SetOutputFileName(Form("%s%s",fProofOutputLocation.Data(),fProofOutputFileName.Data())); | |
1681 | } | |
1682 | else { | |
1683 | outProofFile = new TProofOutputFile(fProofOutputFileName.Data(),"DROV",fProofOutputLocation.Data()); | |
1684 | } | |
1685 | if (AliDebugLevel() > 0) outProofFile->Dump(); | |
db4aeca1 | 1686 | fOutput->Add(outProofFile); |
4b71572b | 1687 | } |
002c9d1b | 1688 | AliSysInfo::AddStamp("ReadInputInSlaveBegin"); |
7e88424f | 1689 | } |
42457748 | 1690 | // Check if analysis was requested in the reconstruction event loop |
1691 | if (!fAnalysis) { | |
1692 | // Attempt to connect in-memory singleton | |
1693 | fAnalysis = AliAnalysisManager::GetAnalysisManager(); | |
1694 | if (fAnalysis) AliInfo(Form("==== Analysis manager <%s> found in memory ====", fAnalysis->GetName())); | |
1695 | // Check if an analysis macro was specified | |
1696 | if (!fAnalysis && !fAnalysisMacro.IsNull()) { | |
1697 | // Run specified analysis macro | |
1698 | gROOT->ProcessLine(Form(".x %s",fAnalysisMacro.Data())); | |
1699 | fAnalysis = AliAnalysisManager::GetAnalysisManager(); | |
1700 | if (!fAnalysis) AliError(Form("No analysis manager produced by analysis macro %s", fAnalysisMacro.Data())); | |
1701 | else AliInfo(Form("==== Analysis manager <%s> produced by analysis macro <%s> ====", | |
1702 | fAnalysis->GetName(), fAnalysisMacro.Data())); | |
1703 | } | |
1704 | } | |
1705 | ||
4b71572b | 1706 | // get the run loader |
1707 | if (!InitRunLoader()) { | |
1708 | Abort("InitRunLoader", TSelector::kAbortProcess); | |
1709 | return; | |
1710 | } | |
1711 | AliSysInfo::AddStamp("LoadLoader"); | |
1712 | ||
325aa76f | 1713 | ftVertexer = new AliVertexerTracks(AliTracker::GetBz()); |
2257f27e | 1714 | |
f08fc9f5 | 1715 | // get trackers |
b8cd5251 | 1716 | if (!fRunTracking.IsNull() && !CreateTrackers(fRunTracking)) { |
4b71572b | 1717 | Abort("CreateTrackers", TSelector::kAbortProcess); |
1718 | return; | |
1719 | } | |
1720 | AliSysInfo::AddStamp("CreateTrackers"); | |
24f7a148 | 1721 | |
36711aa4 | 1722 | // create the ESD output file and tree |
db4aeca1 | 1723 | if (!outProofFile) { |
1724 | ffile = TFile::Open("AliESDs.root", "RECREATE"); | |
1725 | ffile->SetCompressionLevel(2); | |
1726 | if (!ffile->IsOpen()) { | |
1727 | Abort("OpenESDFile", TSelector::kAbortProcess); | |
1728 | return; | |
1729 | } | |
1730 | } | |
1731 | else { | |
81d57268 | 1732 | AliInfo(Form("Opening output PROOF file: %s/%s", |
1733 | outProofFile->GetDir(), outProofFile->GetFileName())); | |
db4aeca1 | 1734 | if (!(ffile = outProofFile->OpenFile("RECREATE"))) { |
1735 | Abort(Form("Problems opening output PROOF file: %s/%s", | |
1736 | outProofFile->GetDir(), outProofFile->GetFileName()), | |
1737 | TSelector::kAbortProcess); | |
1738 | return; | |
1739 | } | |
596a855f | 1740 | } |
46698ae4 | 1741 | |
21a3aa09 | 1742 | ftree = new TTree("esdTree", "Tree with ESD objects"); |
1743 | fesd = new AliESDEvent(); | |
1744 | fesd->CreateStdContent(); | |
8b12d288 | 1745 | // add a so far non-std object to the ESD, this will |
1746 | // become part of the std content | |
1747 | fesd->AddObject(new AliESDHLTDecision); | |
ddfbc51a | 1748 | |
32ba9c61 | 1749 | fesd->WriteToTree(ftree); |
1d99986f | 1750 | if (fWriteESDfriend) { |
ee7c441c | 1751 | ffileF = TFile::Open("AliESDfriends.root", "RECREATE"); |
03a8000a | 1752 | ftreeF = new TTree("esdFriendTree", "Tree with ESD Friend objects"); |
ee7c441c | 1753 | fesdf = new AliESDfriend(); |
ddfbc51a | 1754 | ftreeF->Branch("ESDfriend.","AliESDfriend", &fesdf); |
21a3aa09 | 1755 | fesd->AddObject(fesdf); |
ee7c441c | 1756 | ffile->cd(); |
1d99986f | 1757 | } |
f9604a22 | 1758 | ftree->GetUserInfo()->Add(fesd); |
1759 | ||
1760 | fhlttree = new TTree("HLTesdTree", "Tree with HLT ESD objects"); | |
1761 | fhltesd = new AliESDEvent(); | |
1762 | fhltesd->CreateStdContent(); | |
7491aea6 | 1763 | // read the ESD template from CDB |
1764 | // HLT is allowed to put non-std content to its ESD, the non-std | |
1765 | // objects need to be created before invocation of WriteToTree in | |
1766 | // order to create all branches. Initialization is done from an | |
1767 | // ESD layout template in CDB | |
1768 | AliCDBManager* man = AliCDBManager::Instance(); | |
1769 | AliCDBPath hltESDConfigPath("HLT/ConfigHLT/esdLayout"); | |
1770 | AliCDBEntry* hltESDConfig=NULL; | |
1771 | if (man->GetId(hltESDConfigPath)!=NULL && | |
1772 | (hltESDConfig=man->Get(hltESDConfigPath))!=NULL) { | |
1773 | AliESDEvent* pESDLayout=dynamic_cast<AliESDEvent*>(hltESDConfig->GetObject()); | |
1774 | if (pESDLayout) { | |
1775 | // init all internal variables from the list of objects | |
1776 | pESDLayout->GetStdContent(); | |
1777 | ||
1778 | // copy content and create non-std objects | |
1779 | *fhltesd=*pESDLayout; | |
1780 | fhltesd->Reset(); | |
1781 | } else { | |
1782 | AliError(Form("error setting hltEsd layout from %s: invalid object type", | |
1783 | hltESDConfigPath.GetPath().Data())); | |
1784 | } | |
1785 | } | |
1786 | ||
f9604a22 | 1787 | fhltesd->WriteToTree(fhlttree); |
1788 | fhlttree->GetUserInfo()->Add(fhltesd); | |
5728d3d5 | 1789 | |
ac4a7581 | 1790 | ProcInfo_t procInfo; |
1791 | gSystem->GetProcInfo(&procInfo); | |
73bbf779 | 1792 | AliInfo(Form("Current memory usage %ld %ld", procInfo.fMemResident, procInfo.fMemVirtual)); |
8661738e | 1793 | |
325aa76f | 1794 | //QA |
930e6e3e | 1795 | //Initialize the QA and start of cycle |
f1c1204d | 1796 | if (fRunQA || fRunGlobalQA) |
1797 | InitQA() ; | |
aa3c69a9 | 1798 | |
7167ae53 | 1799 | //Initialize the Plane Efficiency framework |
1800 | if (fRunPlaneEff && !InitPlaneEff()) { | |
4b71572b | 1801 | Abort("InitPlaneEff", TSelector::kAbortProcess); |
1802 | return; | |
7167ae53 | 1803 | } |
aa3c69a9 | 1804 | |
14dd053c | 1805 | if (strcmp(gProgName,"alieve") == 0) |
1806 | fRunAliEVE = InitAliEVE(); | |
42457748 | 1807 | // If we have an analysis manager, connect the AliRecoInputHandler here |
1808 | if (fAnalysis) { | |
1809 | if (!dynamic_cast<AliRecoInputHandler*>(fAnalysis->GetInputEventHandler())) { | |
1810 | AliError("Analysis manager used in reconstruction should use AliRecoInputHandler - \ | |
1811 | \n ->Replacing with AliRecoInputHandler instance."); | |
1812 | delete fAnalysis->GetInputEventHandler(); | |
1813 | } | |
1814 | // Set the event and other data pointers | |
1815 | fRecoHandler = new AliRecoInputHandler(); | |
1816 | fRecoHandler->Init(ftree, "LOCAL"); | |
1817 | fRecoHandler->SetEvent(fesd); | |
1818 | fRecoHandler->SetESDfriend(fesdf); | |
1819 | fRecoHandler->SetHLTEvent(fhltesd); | |
1820 | fRecoHandler->SetHLTTree(fhlttree); | |
1821 | fAnalysis->SetInputEventHandler(fRecoHandler); | |
1822 | // Enter external loop mode | |
1823 | fAnalysis->SetExternalLoop(kTRUE); | |
1824 | // Initialize analysis | |
1825 | fAnalysis->StartAnalysis("local", (TTree*)0); | |
1826 | // Connect ESD tree with the input container | |
1827 | fAnalysis->GetCommonInputContainer()->SetData(ftree); | |
1828 | } | |
4b71572b | 1829 | return; |
21a3aa09 | 1830 | } |
1831 | ||
1832 | //_____________________________________________________________________________ | |
4b71572b | 1833 | Bool_t AliReconstruction::Process(Long64_t entry) |
1834 | { | |
1835 | // run the reconstruction over a single entry | |
1836 | // from the chain with raw data | |
52dd4a8c | 1837 | AliCodeTimerAuto("",0); |
4b71572b | 1838 | |
1839 | TTree *currTree = fChain->GetTree(); | |
33314186 | 1840 | AliRawVEvent *event = NULL; |
4b71572b | 1841 | currTree->SetBranchAddress("rawevent",&event); |
1842 | currTree->GetEntry(entry); | |
1843 | fRawReader = new AliRawReaderRoot(event); | |
30b916f7 | 1844 | // check if process has enough resources |
1845 | if (!HasEnoughResources(entry)) return kFALSE; | |
42457748 | 1846 | fStatus = ProcessEvent(fRunLoader->GetNumberOfEvents()); |
4b71572b | 1847 | delete fRawReader; |
1848 | fRawReader = NULL; | |
1849 | delete event; | |
1850 | ||
1851 | return fStatus; | |
1852 | } | |
1853 | ||
1854 | //_____________________________________________________________________________ | |
1855 | void AliReconstruction::Init(TTree *tree) | |
1856 | { | |
0a035be5 | 1857 | // Implementation of TSelector::Init() |
1858 | // method | |
4b71572b | 1859 | if (tree == 0) { |
1860 | AliError("The input tree is not found!"); | |
1861 | return; | |
1862 | } | |
1863 | fChain = tree; | |
1864 | } | |
1865 | ||
1866 | //_____________________________________________________________________________ | |
1867 | Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) | |
21a3aa09 | 1868 | { |
1869 | // run the reconstruction over a single event | |
1870 | // The event loop is steered in Run method | |
1871 | ||
10d100d4 | 1872 | |
470f88b0 | 1873 | static Long_t oldMres=0; |
1874 | static Long_t oldMvir=0; | |
1875 | static Float_t oldCPU=0; | |
d97f1dbe | 1876 | static Long_t aveDMres=0; |
1877 | static Long_t aveDMvir=0; | |
1878 | static Float_t aveDCPU=0; | |
470f88b0 | 1879 | |
52dd4a8c | 1880 | AliCodeTimerAuto("",0); |
21a3aa09 | 1881 | |
0a035be5 | 1882 | AliESDpid pid; |
ddfbc51a | 1883 | |
8d25d294 | 1884 | AliSysInfo::AddStamp(Form("StartEv_%d",iEvent), 0,0,iEvent); |
1885 | ||
21a3aa09 | 1886 | if (iEvent >= fRunLoader->GetNumberOfEvents()) { |
1887 | fRunLoader->SetEventNumber(iEvent); | |
4018c387 | 1888 | if (fRawReader) |
1889 | fRunLoader->GetHeader()->Reset(fRawReader->GetRunNumber(), | |
1890 | iEvent, iEvent); | |
21a3aa09 | 1891 | fRunLoader->TreeE()->Fill(); |
5b3ea9c5 | 1892 | |
396f89bc | 1893 | if (fRawReader && fRawReader->UseAutoSaveESD()) |
4b71572b | 1894 | fRunLoader->TreeE()->AutoSave("SaveSelf"); |
21a3aa09 | 1895 | } |
1896 | ||
1897 | if ((iEvent < fFirstEvent) || ((fLastEvent >= 0) && (iEvent > fLastEvent))) { | |
21a3aa09 | 1898 | return kTRUE; |
1899 | } | |
ddfbc51a | 1900 | |
1901 | ||
16447f18 | 1902 | fRunLoader->GetEvent(iEvent); |
1903 | ||
7e88424f | 1904 | // Fill Event-info object |
1905 | GetEventInfo(); | |
77ba28ba | 1906 | fRecoParam.SetEventSpecie(fRunInfo,fEventInfo,fListOfCosmicTriggers); |
d97f1dbe | 1907 | |
1908 | ProcInfo_t procInfo; | |
1909 | if(iEvent==fFirstEvent) { | |
1910 | gSystem->GetProcInfo(&procInfo); | |
1911 | oldMres=procInfo.fMemResident; | |
1912 | oldMvir=procInfo.fMemVirtual; | |
1913 | oldCPU=procInfo.fCpuUser+procInfo.fCpuSys; | |
1914 | } | |
470f88b0 | 1915 | AliInfo(Form("================================= Processing event %d of type %-10s ==================================", iEvent,fRecoParam.PrintEventSpecie())); |
7e88424f | 1916 | |
8d25d294 | 1917 | AliSysInfo::AddStamp(Form("StartReco_%d",iEvent), 0,0,iEvent); |
1918 | ||
a00021a7 | 1919 | // Set the reco-params |
1920 | { | |
1921 | TString detStr = fLoadCDB; | |
ac4a7581 | 1922 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
a00021a7 | 1923 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
1924 | AliReconstructor *reconstructor = GetReconstructor(iDet); | |
1925 | if (reconstructor && fRecoParam.GetDetRecoParamArray(iDet)) { | |
57acd2d2 | 1926 | const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet); |
1927 | reconstructor->SetRecoParam(par); | |
0a035be5 | 1928 | reconstructor->GetPidSettings(&pid); |
10d100d4 | 1929 | reconstructor->SetEventInfo(&fEventInfo); |
57acd2d2 | 1930 | if (fRunQA) { |
c3c10397 | 1931 | AliQAManager::QAManager()->SetEventInfo(&fEventInfo) ; |
eca4fa66 | 1932 | AliQAManager::QAManager()->SetRecoParam(iDet, par) ; |
619aafe6 | 1933 | if (par) AliQAManager::QAManager()->SetEventSpecie(AliRecoParam::Convert(par->GetEventSpecie())) ; |
57acd2d2 | 1934 | } |
a00021a7 | 1935 | } |
1936 | } | |
92664bc8 | 1937 | // |
1938 | if (fRunQA || fRunGlobalQA) AliQADataMaker::SetEventTrigClasses(fEventInfo.GetTriggerClasses()); // RS: select which histo clones are to be filled | |
1939 | // | |
9dad1020 | 1940 | if (fRunQA) { |
1941 | const AliDetectorRecoParam *grppar = fRecoParam.GetDetRecoParam(kNDetectors); | |
1942 | AliQAManager::QAManager()->SetRecoParam(AliQAv1::kGLOBAL, grppar) ; | |
1943 | AliQAManager::QAManager()->SetEventSpecie(AliRecoParam::Convert(grppar->GetEventSpecie())) ; | |
1944 | } | |
a00021a7 | 1945 | } |
1946 | ||
ca13fb87 | 1947 | // QA on single raw |
514cb8c7 | 1948 | if (fRunQA && IsInTasks(AliQAv1::kRAWS)) { |
eca4fa66 | 1949 | AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ; |
1950 | AliQAManager::QAManager()->RunOneEvent(fRawReader) ; | |
8d25d294 | 1951 | AliSysInfo::AddStamp(Form("RawQA_%d",iEvent), 0,0,iEvent); |
57acd2d2 | 1952 | } |
d506c543 | 1953 | // local single event reconstruction |
b26c3770 | 1954 | if (!fRunLocalReconstruction.IsNull()) { |
d506c543 | 1955 | TString detectors=fRunLocalReconstruction; |
a441bf51 | 1956 | // run HLT event reconstruction first |
d506c543 | 1957 | // ;-( IsSelected changes the string |
1958 | if (IsSelected("HLT", detectors) && | |
1959 | !RunLocalEventReconstruction("HLT")) { | |
4b71572b | 1960 | if (fStopOnError) {CleanUp(); return kFALSE;} |
a441bf51 | 1961 | } |
1962 | detectors=fRunLocalReconstruction; | |
1963 | detectors.ReplaceAll("HLT", ""); | |
1964 | if (!RunLocalEventReconstruction(detectors)) { | |
13effe3f | 1965 | if (fStopOnError) { |
1966 | CleanUp(); | |
1967 | return kFALSE; | |
1968 | } | |
b26c3770 | 1969 | } |
1970 | } | |
1971 | ||
6b3a883f | 1972 | |
1973 | // fill Event header information from the RawEventHeader | |
1974 | if (fRawReader){FillRawEventHeaderESD(fesd);} | |
1975 | if (fRawReader){FillRawEventHeaderESD(fhltesd);} | |
1976 | ||
21a3aa09 | 1977 | fesd->SetRunNumber(fRunLoader->GetHeader()->GetRun()); |
1978 | fhltesd->SetRunNumber(fRunLoader->GetHeader()->GetRun()); | |
7b649c02 | 1979 | |
1980 | ((AliESDRun*)fesd->GetESDRun())->SetDetectorsInDAQ(fRunInfo->GetDetectorMask()); | |
1981 | ((AliESDRun*)fhltesd->GetESDRun())->SetDetectorsInDAQ(fRunInfo->GetDetectorMask()); | |
1982 | ((AliESDRun*)fesd->GetESDRun())->SetDetectorsInReco(AliDAQ::DetectorPatternOffline(fFillESD.Data())); | |
1983 | ((AliESDRun*)fhltesd->GetESDRun())->SetDetectorsInReco(AliDAQ::DetectorPatternOffline(fFillESD.Data())); | |
1984 | ||
21a3aa09 | 1985 | fesd->SetEventNumberInFile(fRunLoader->GetHeader()->GetEventNrInRun()); |
1986 | fhltesd->SetEventNumberInFile(fRunLoader->GetHeader()->GetEventNrInRun()); | |
fd2e2210 | 1987 | |
1988 | fesd->SetEventSpecie(fRecoParam.GetEventSpecie()); | |
1989 | fhltesd->SetEventSpecie(fRecoParam.GetEventSpecie()); | |
46698ae4 | 1990 | |
d6ee376f | 1991 | // Set magnetic field from the tracker |
21a3aa09 | 1992 | fesd->SetMagneticField(AliTracker::GetBz()); |
1993 | fhltesd->SetMagneticField(AliTracker::GetBz()); | |
33fe5eb1 | 1994 | // |
3d84ad67 | 1995 | AliESDRun *esdRun,*esdRunH; |
1996 | esdRun = (AliESDRun*)fesd->GetESDRun(); | |
1997 | esdRunH = (AliESDRun*)fhltesd->GetESDRun(); | |
1998 | esdRun->SetBeamEnergyIsSqrtSHalfGeV(); | |
1999 | esdRunH->SetBeamEnergyIsSqrtSHalfGeV(); | |
2000 | // | |
2001 | for (int ib=2;ib--;) for (int it=2;it--;) { | |
2002 | esdRun->SetMeanIntensity(ib,it, fBeamInt[ib][it]); | |
2003 | esdRunH->SetMeanIntensity(ib,it, fBeamInt[ib][it]); | |
2004 | } | |
c587bcde | 2005 | // |
91460b26 | 2006 | fesd->SetBeamEnergy(fGRPData->GetBeamEnergy()); |
2007 | fesd->SetBeamType(fGRPData->GetBeamType().Data()); | |
2008 | fesd->SetBeamParticle(fGRPData->GetSingleBeamType(0).Atoi(),0); | |
2009 | fesd->SetBeamParticle(fGRPData->GetSingleBeamType(1).Atoi(),1); | |
2010 | fhltesd->SetBeamEnergy(fGRPData->GetBeamEnergy()); | |
2011 | fhltesd->SetBeamType(fGRPData->GetBeamType().Data()); | |
2012 | fhltesd->SetBeamParticle(fGRPData->GetSingleBeamType(0).Atoi(),0); | |
2013 | fhltesd->SetBeamParticle(fGRPData->GetSingleBeamType(1).Atoi(),1); | |
2014 | // | |
33fe5eb1 | 2015 | AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField(); |
2016 | if (fld) { // set info needed for field initialization | |
2017 | fesd->SetCurrentL3(fld->GetCurrentSol()); | |
2018 | fesd->SetCurrentDip(fld->GetCurrentDip()); | |
33fe5eb1 | 2019 | fesd->SetUniformBMap(fld->IsUniform()); |
2020 | fesd->SetBInfoStored(); | |
2021 | // | |
2022 | fhltesd->SetCurrentL3(fld->GetCurrentSol()); | |
2023 | fhltesd->SetCurrentDip(fld->GetCurrentDip()); | |
33fe5eb1 | 2024 | fhltesd->SetUniformBMap(fld->IsUniform()); |
2025 | fhltesd->SetBInfoStored(); | |
2026 | } | |
2027 | // | |
71f6cda4 | 2028 | // Set most probable pt, for B=0 tracking |
9257a1bd | 2029 | // Get the global reco-params. They are atposition 16 inside the array of detectors in fRecoParam |
ac4a7581 | 2030 | const AliGRPRecoParam *grpRecoParam = dynamic_cast<const AliGRPRecoParam*>(fRecoParam.GetDetRecoParam(kNDetectors)); |
71f6cda4 | 2031 | if (grpRecoParam) AliExternalTrackParam::SetMostProbablePt(grpRecoParam->GetMostProbablePt()); |
46698ae4 | 2032 | |
2e3550da | 2033 | // Fill raw-data error log into the ESD |
21a3aa09 | 2034 | if (fRawReader) FillRawDataErrorLog(iEvent,fesd); |
2e3550da | 2035 | |
8d25d294 | 2036 | AliSysInfo::AddStamp(Form("FillHeadErrs_%d",iEvent), 0,0,iEvent); |
2037 | ||
2257f27e | 2038 | // vertex finder |
2039 | if (fRunVertexFinder) { | |
4b71572b | 2040 | if (!RunVertexFinder(fesd)) { |
2041 | if (fStopOnError) {CleanUp(); return kFALSE;} | |
2257f27e | 2042 | } |
8d25d294 | 2043 | AliSysInfo::AddStamp(Form("VtxFinder_%d",iEvent), 0,0,iEvent); |
2257f27e | 2044 | } |
2045 | ||
58e8dc31 | 2046 | // For Plane Efficiency: run the SPD trackleter |
2047 | if (fRunPlaneEff && fSPDTrackleter) { | |
2048 | if (!RunSPDTrackleting(fesd)) { | |
2049 | if (fStopOnError) {CleanUp(); return kFALSE;} | |
2050 | } | |
8d25d294 | 2051 | AliSysInfo::AddStamp(Form("TrackletEff_%d",iEvent), 0,0,iEvent); |
58e8dc31 | 2052 | } |
2053 | ||
e66fbafb | 2054 | // Muon tracking |
b8cd5251 | 2055 | if (!fRunTracking.IsNull()) { |
e66fbafb | 2056 | if (fRunMuonTracking) { |
21a3aa09 | 2057 | if (!RunMuonTracking(fesd)) { |
4b71572b | 2058 | if (fStopOnError) {CleanUp(); return kFALSE;} |
24f7a148 | 2059 | } |
596a855f | 2060 | } |
8d25d294 | 2061 | AliSysInfo::AddStamp(Form("TrackingMUON_%d",iEvent), 0,0,iEvent); |
596a855f | 2062 | } |
2063 | ||
e66fbafb | 2064 | // barrel tracking |
2065 | if (!fRunTracking.IsNull()) { | |
0a035be5 | 2066 | if (!RunTracking(fesd,pid)) { |
4b71572b | 2067 | if (fStopOnError) {CleanUp(); return kFALSE;} |
e66fbafb | 2068 | } |
2069 | } | |
21c573b7 | 2070 | |
596a855f | 2071 | // fill ESD |
2072 | if (!fFillESD.IsNull()) { | |
d506c543 | 2073 | TString detectors=fFillESD; |
f6806ad3 | 2074 | // run HLT first and on hltesd |
d506c543 | 2075 | // ;-( IsSelected changes the string |
2076 | if (IsSelected("HLT", detectors) && | |
2077 | !FillESD(fhltesd, "HLT")) { | |
4b71572b | 2078 | if (fStopOnError) {CleanUp(); return kFALSE;} |
f6806ad3 | 2079 | } |
2080 | detectors=fFillESD; | |
d5105682 | 2081 | // Temporary fix to avoid problems with HLT that overwrites the offline ESDs |
2082 | if (detectors.Contains("ALL")) { | |
2083 | detectors=""; | |
ac4a7581 | 2084 | for (Int_t idet=0; idet<kNDetectors; ++idet){ |
d5105682 | 2085 | detectors += fgkDetectorName[idet]; |
2086 | detectors += " "; | |
2087 | } | |
2088 | } | |
f6806ad3 | 2089 | detectors.ReplaceAll("HLT", ""); |
2090 | if (!FillESD(fesd, detectors)) { | |
4b71572b | 2091 | if (fStopOnError) {CleanUp(); return kFALSE;} |
596a855f | 2092 | } |
2093 | } | |
f7812afc | 2094 | |
b647652d | 2095 | |
21a3aa09 | 2096 | ffile->cd(); |
a6ee503a | 2097 | |
3c3709c4 | 2098 | // |
67be5c77 | 2099 | // Propagate track to the beam pipe (if not already done by ITS) |
3c3709c4 | 2100 | // |
21a3aa09 | 2101 | const Int_t ntracks = fesd->GetNumberOfTracks(); |
3c3709c4 | 2102 | const Double_t kRadius = 2.8; //something less than the beam pipe radius |
2103 | ||
2104 | TObjArray trkArray; | |
30b916f7 | 2105 | UShort_t selectedIdx[ntracks]; |
3c3709c4 | 2106 | |
2107 | for (Int_t itrack=0; itrack<ntracks; itrack++){ | |
98a50ff3 | 2108 | const Double_t kMaxStep = 1; //max step over the material |
3c3709c4 | 2109 | Bool_t ok; |
2110 | ||
21a3aa09 | 2111 | AliESDtrack *track = fesd->GetTrack(itrack); |
3c3709c4 | 2112 | if (!track) continue; |
2113 | ||
2114 | AliExternalTrackParam *tpcTrack = | |
2115 | (AliExternalTrackParam *)track->GetTPCInnerParam(); | |
bcabd6af | 2116 | ok = kFALSE; |
2117 | if (tpcTrack) | |
2118 | ok = AliTracker:: | |
52dd4a8c | 2119 | PropagateTrackToBxByBz(tpcTrack,kRadius,track->GetMass(),kMaxStep,kFALSE); |
43c9dae1 | 2120 | |
3c3709c4 | 2121 | if (ok) { |
2122 | Int_t n=trkArray.GetEntriesFast(); | |
2123 | selectedIdx[n]=track->GetID(); | |
2124 | trkArray.AddLast(tpcTrack); | |
2125 | } | |
2126 | ||
3d65e645 | 2127 | //Tracks refitted by ITS should already be at the SPD vertex |
2128 | if (track->IsOn(AliESDtrack::kITSrefit)) continue; | |
2129 | ||
2130 | AliTracker:: | |
52dd4a8c | 2131 | PropagateTrackToBxByBz(track,kRadius,track->GetMass(),kMaxStep,kFALSE); |
2132 | Double_t x[3]; track->GetXYZ(x); | |
2133 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
2134 | track->RelateToVertexBxByBz(fesd->GetPrimaryVertexSPD(), b, kVeryBig); | |
3c3709c4 | 2135 | |
3c3709c4 | 2136 | } |
8d25d294 | 2137 | AliSysInfo::AddStamp(Form("RelToSPDVtx_%d",iEvent), 0,0,iEvent); |
3c3709c4 | 2138 | // |
2139 | // Improve the reconstructed primary vertex position using the tracks | |
2140 | // | |
59224b2b | 2141 | Bool_t runVertexFinderTracks = fRunVertexFinderTracks; |
2142 | if(fesd->GetPrimaryVertexSPD()) { | |
2143 | TString vtitle = fesd->GetPrimaryVertexSPD()->GetTitle(); | |
2144 | if(vtitle.Contains("cosmics")) { | |
2145 | runVertexFinderTracks=kFALSE; | |
2146 | } | |
c060d7fe | 2147 | } |
a00021a7 | 2148 | |
2149 | if (runVertexFinderTracks) { | |
3c3709c4 | 2150 | // TPC + ITS primary vertex |
f09c879d | 2151 | ftVertexer->SetITSMode(); |
f2a195c1 | 2152 | ftVertexer->SetConstraintOff(); |
a00021a7 | 2153 | // get cuts for vertexer from AliGRPRecoParam |
1c7554f9 | 2154 | Bool_t constrSPD=kFALSE; |
a00021a7 | 2155 | if (grpRecoParam) { |
2156 | Int_t nCutsVertexer = grpRecoParam->GetVertexerTracksNCuts(); | |
2157 | Double_t *cutsVertexer = new Double_t[nCutsVertexer]; | |
8eaa1a42 | 2158 | grpRecoParam->GetVertexerTracksCutsITS(cutsVertexer,nCutsVertexer); |
2159 | ftVertexer->SetCuts(cutsVertexer,nCutsVertexer); | |
a00021a7 | 2160 | delete [] cutsVertexer; cutsVertexer = NULL; |
1c7554f9 | 2161 | if(grpRecoParam->GetVertexerTracksConstraintITS()) { |
2162 | if(fDiamondProfile && fDiamondProfile->GetXRes()<kRadius){ | |
2163 | ftVertexer->SetVtxStart(fDiamondProfile); // apply constraint only if sigmax is smaller than the beam pipe radius | |
2164 | }else{ | |
2165 | if(fDiamondProfileSPD && fDiamondProfileSPD->GetXRes()<kRadius){ | |
2166 | ftVertexer->SetVtxStart(fDiamondProfileSPD); | |
2167 | constrSPD=kTRUE; | |
2168 | } | |
2169 | } | |
dd15203b | 2170 | } |
43c9dae1 | 2171 | } |
21a3aa09 | 2172 | AliESDVertex *pvtx=ftVertexer->FindPrimaryVertex(fesd); |
3c3709c4 | 2173 | if (pvtx) { |
1c7554f9 | 2174 | if(constrSPD){ |
2175 | TString title=pvtx->GetTitle(); | |
2176 | title.Append("SPD"); | |
2177 | pvtx->SetTitle(title); | |
2178 | } | |
3c3709c4 | 2179 | if (pvtx->GetStatus()) { |
c264b61b | 2180 | fesd->SetPrimaryVertexTracks(pvtx); |
3c3709c4 | 2181 | for (Int_t i=0; i<ntracks; i++) { |
21a3aa09 | 2182 | AliESDtrack *t = fesd->GetTrack(i); |
52dd4a8c | 2183 | Double_t x[3]; t->GetXYZ(x); |
2184 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
2185 | t->RelateToVertexBxByBz(pvtx, b, kVeryBig); | |
3c3709c4 | 2186 | } |
2187 | } | |
9bcaa1d7 | 2188 | delete pvtx; pvtx=NULL; |
3c3709c4 | 2189 | } |
8d25d294 | 2190 | AliSysInfo::AddStamp(Form("VtxTrk_%d",iEvent), 0,0,iEvent); |
3c3709c4 | 2191 | |
2192 | // TPC-only primary vertex | |
f09c879d | 2193 | ftVertexer->SetTPCMode(); |
f2a195c1 | 2194 | ftVertexer->SetConstraintOff(); |
a00021a7 | 2195 | // get cuts for vertexer from AliGRPRecoParam |
2196 | if (grpRecoParam) { | |
2197 | Int_t nCutsVertexer = grpRecoParam->GetVertexerTracksNCuts(); | |
2198 | Double_t *cutsVertexer = new Double_t[nCutsVertexer]; | |
8eaa1a42 | 2199 | grpRecoParam->GetVertexerTracksCutsTPC(cutsVertexer,nCutsVertexer); |
2200 | ftVertexer->SetCuts(cutsVertexer,nCutsVertexer); | |
a00021a7 | 2201 | delete [] cutsVertexer; cutsVertexer = NULL; |
dd15203b | 2202 | if(fDiamondProfileTPC && grpRecoParam->GetVertexerTracksConstraintTPC()) { |
2203 | if(fDiamondProfileTPC->GetXRes()<kRadius) ftVertexer->SetVtxStart(fDiamondProfileTPC); // apply constraint only if sigmax is smaller than the beam pipe radius | |
2204 | } | |
43c9dae1 | 2205 | } |
21a3aa09 | 2206 | pvtx=ftVertexer->FindPrimaryVertex(&trkArray,selectedIdx); |
3c3709c4 | 2207 | if (pvtx) { |
2208 | if (pvtx->GetStatus()) { | |
21a3aa09 | 2209 | fesd->SetPrimaryVertexTPC(pvtx); |
3d65e645 | 2210 | for (Int_t i=0; i<ntracks; i++) { |
2211 | AliESDtrack *t = fesd->GetTrack(i); | |
52dd4a8c | 2212 | Double_t x[3]; t->GetXYZ(x); |
2213 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
2214 | t->RelateToVertexTPCBxByBz(pvtx, b, kVeryBig); | |
3c3709c4 | 2215 | } |
2216 | } | |
9bcaa1d7 | 2217 | delete pvtx; pvtx=NULL; |
3c3709c4 | 2218 | } |
8d25d294 | 2219 | AliSysInfo::AddStamp(Form("VtxTPC_%d",iEvent), 0,0,iEvent); |
3c3709c4 | 2220 | |
2221 | } | |
30b916f7 | 2222 | |
1c7554f9 | 2223 | if(fDiamondProfile && fDiamondProfile->GetXRes()<kRadius) fesd->SetDiamond(fDiamondProfile); |
2224 | else fesd->SetDiamond(fDiamondProfileSPD); | |
c5e3e5d1 | 2225 | |
d1683eef | 2226 | if (fRunV0Finder) { |
2227 | // V0 finding | |
2228 | AliV0vertexer vtxer; | |
61a14552 | 2229 | // get cuts for V0vertexer from AliGRPRecoParam |
2230 | if (grpRecoParam) { | |
2231 | Int_t nCutsV0vertexer = grpRecoParam->GetVertexerV0NCuts(); | |
30b916f7 | 2232 | Double_t cutsV0vertexer[nCutsV0vertexer]; |
61a14552 | 2233 | grpRecoParam->GetVertexerV0Cuts(cutsV0vertexer); |
2234 | vtxer.SetCuts(cutsV0vertexer); | |
61a14552 | 2235 | } |
21a3aa09 | 2236 | vtxer.Tracks2V0vertices(fesd); |
8d25d294 | 2237 | AliSysInfo::AddStamp(Form("V0Finder_%d",iEvent), 0,0,iEvent); |
5e4ff34d | 2238 | |
d1683eef | 2239 | if (fRunCascadeFinder) { |
2240 | // Cascade finding | |
2241 | AliCascadeVertexer cvtxer; | |
61a14552 | 2242 | // get cuts for CascadeVertexer from AliGRPRecoParam |
2243 | if (grpRecoParam) { | |
2244 | Int_t nCutsCascadeVertexer = grpRecoParam->GetVertexerCascadeNCuts(); | |
30b916f7 | 2245 | Double_t cutsCascadeVertexer[nCutsCascadeVertexer]; |
61a14552 | 2246 | grpRecoParam->GetVertexerCascadeCuts(cutsCascadeVertexer); |
2247 | cvtxer.SetCuts(cutsCascadeVertexer); | |
61a14552 | 2248 | } |
21a3aa09 | 2249 | cvtxer.V0sTracks2CascadeVertices(fesd); |
8d25d294 | 2250 | AliSysInfo::AddStamp(Form("CascadeFinder_%d",iEvent), 0,0,iEvent); |
d1683eef | 2251 | } |
5e4ff34d | 2252 | } |
c8122432 | 2253 | |
50f012a8 | 2254 | // AdC+FN |
2255 | if (fReconstructor[3]) | |
2256 | GetReconstructor(3)->FillEventTimeWithTOF(fesd,&pid); | |
2257 | ||
2258 | // combined PID | |
2259 | pid.MakePID(fesd); | |
2260 | ||
2261 | if (fFillTriggerESD) { | |
2262 | if (!FillTriggerESD(fesd)) { | |
2263 | if (fStopOnError) {CleanUp(); return kFALSE;} | |
2264 | } | |
2265 | } | |
2266 | // Always fill scalers | |
2267 | if (!FillTriggerScalers(fesd)) { | |
2268 | if (fStopOnError) {CleanUp(); return kFALSE;} | |
2269 | } | |
2270 | ||
8d25d294 | 2271 | AliSysInfo::AddStamp(Form("FillVaria_%d",iEvent), 0,0,iEvent); |
2272 | ||
c8122432 | 2273 | // write ESD |
8d25d294 | 2274 | if (fCleanESD) { |
2275 | CleanESD(fesd); | |
2276 | AliSysInfo::AddStamp(Form("CleanESD_%d",iEvent), 0,0,iEvent); | |
2277 | } | |
c8122432 | 2278 | // |
1f9831ab | 2279 | // RS run updated trackleter: since we want to mark the clusters used by tracks and also mark the |
2280 | // tracks interpreted as primary, this step should be done in the very end, when full | |
2281 | // ESD info is available (particulalry, V0s) | |
2282 | // vertex finder | |
c8122432 | 2283 | if (fRunMultFinder) { |
2284 | if (!RunMultFinder(fesd)) { | |
2285 | if (fStopOnError) {CleanUp(); return kFALSE;} | |
2286 | } | |
8d25d294 | 2287 | AliSysInfo::AddStamp(Form("MultFinder_%d",iEvent), 0,0,iEvent); |
c8122432 | 2288 | } |
854c6476 | 2289 | |
514cb8c7 | 2290 | if (fRunQA && IsInTasks(AliQAv1::kESDS)) { |
eca4fa66 | 2291 | AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ; |
aeb8fc30 | 2292 | AliQAManager::QAManager()->RunOneEvent(fesd, fhltesd) ; |
8d25d294 | 2293 | AliSysInfo::AddStamp(Form("RunQA_%d",iEvent), 0,0,iEvent); |
57acd2d2 | 2294 | } |
bea94759 | 2295 | if (fRunGlobalQA) { |
eca4fa66 | 2296 | AliQADataMaker *qadm = AliQAManager::QAManager()->GetQADataMaker(AliQAv1::kGLOBAL); |
4018c387 | 2297 | if (qadm) |
57acd2d2 | 2298 | qadm->SetEventSpecie(fRecoParam.GetEventSpecie()) ; |
514cb8c7 | 2299 | if (qadm && IsInTasks(AliQAv1::kESDS)) |
4e25ac79 | 2300 | qadm->Exec(AliQAv1::kESDS, fesd); |
8d25d294 | 2301 | AliSysInfo::AddStamp(Form("RunGlobQA_%d",iEvent), 0,0,iEvent); |
b03591ab | 2302 | } |
854c6476 | 2303 | |
8b12d288 | 2304 | // copy HLT decision from HLTesd to esd |
2305 | // the most relevant information is stored in a reduced container in the esd, | |
2306 | // while the full information can be found in the HLTesd | |
2307 | TObject* pHLTSrc=fhltesd->FindListObject(AliESDHLTDecision::Name()); | |
2308 | TObject* pHLTTgt=fesd->FindListObject(AliESDHLTDecision::Name()); | |
2309 | if (pHLTSrc && pHLTTgt) { | |
2310 | pHLTSrc->Copy(*pHLTTgt); | |
2311 | } | |
3ba71cb5 | 2312 | // |
2313 | // Perform analysis of this event if requested | |
2314 | // RS: Should be done before WriteESDfriend, since the latter may clean the esdfriend | |
2315 | if (fAnalysis) { | |
2316 | fRecoHandler->BeginEvent(iEvent); | |
2317 | fAnalysis->ExecAnalysis(); | |
2318 | fRecoHandler->FinishEvent(); | |
8d25d294 | 2319 | AliSysInfo::AddStamp(Form("Analysis_%d",iEvent), 0,0,iEvent); |
3ba71cb5 | 2320 | } |
2321 | // | |
30b916f7 | 2322 | if (fWriteESDfriend) { |
ddfbc51a | 2323 | fesd->GetESDfriend(fesdf); |
2324 | AliSysInfo::AddStamp(Form("CreateFriend_%d",iEvent), 0,0,iEvent); | |
2325 | ||
30b916f7 | 2326 | } |
2327 | // | |
e546b023 | 2328 | ftree->Fill(); |
e546b023 | 2329 | AliSysInfo::AddStamp(Form("ESDFill_%d",iEvent), 0,0,iEvent); |
ddfbc51a | 2330 | // |
e546b023 | 2331 | if (fWriteESDfriend) { |
ddfbc51a | 2332 | WriteESDfriend(); |
2333 | AliSysInfo::AddStamp(Form("WriteFriend_%d",iEvent), 0,0,iEvent); | |
2334 | } | |
2335 | // | |
2336 | // | |
2337 | // Auto-save the ESD tree in case of prompt reco @P2 | |
2338 | if (fRawReader && fRawReader->UseAutoSaveESD()) { | |
2339 | ftree->AutoSave("SaveSelf"); | |
2340 | if (fWriteESDfriend) ftreeF->AutoSave("SaveSelf"); | |
30b916f7 | 2341 | } |
500d54ab | 2342 | // write HLT ESD |
21a3aa09 | 2343 | fhlttree->Fill(); |
1d99986f | 2344 | |
14dd053c | 2345 | // call AliEVE |
2346 | if (fRunAliEVE) RunAliEVE(); | |
0c4df52e | 2347 | // |
21a3aa09 | 2348 | fesd->Reset(); |
2349 | fhltesd->Reset(); | |
5728d3d5 | 2350 | if (fWriteESDfriend) { |
ddfbc51a | 2351 | fesdf->~AliESDfriend(); |
2352 | new (fesdf) AliESDfriend(); // Reset... | |
5728d3d5 | 2353 | } |
a5fa6165 | 2354 | |
ac4a7581 | 2355 | gSystem->GetProcInfo(&procInfo); |
d97f1dbe | 2356 | Long_t dMres=(procInfo.fMemResident-oldMres)/1024; |
2357 | Long_t dMvir=(procInfo.fMemVirtual-oldMvir)/1024; | |
2358 | Float_t dCPU=procInfo.fCpuUser+procInfo.fCpuSys-oldCPU; | |
2359 | aveDMres+=(dMres-aveDMres)/(iEvent-fFirstEvent+1); | |
2360 | aveDMvir+=(dMvir-aveDMvir)/(iEvent-fFirstEvent+1); | |
2361 | aveDCPU+=(dCPU-aveDCPU)/(iEvent-fFirstEvent+1); | |
73bbf779 | 2362 | AliInfo(Form("======================= End Event %d: Res %ld(%3ld <%3ld>) Vir %ld(%3ld <%3ld>) CPU %5.2f <%5.2f> ===================", |
d97f1dbe | 2363 | iEvent, procInfo.fMemResident/1024, dMres, aveDMres, procInfo.fMemVirtual/1024, dMvir, aveDMvir, dCPU, aveDCPU)); |
470f88b0 | 2364 | oldMres=procInfo.fMemResident; |
2365 | oldMvir=procInfo.fMemVirtual; | |
2366 | oldCPU=procInfo.fCpuUser+procInfo.fCpuSys; | |
a5fa6165 | 2367 | |
ca13fb87 | 2368 | fEventInfo.Reset(); |
ac4a7581 | 2369 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
42ec5d3d | 2370 | if (fReconstructor[iDet]) { |
a00021a7 | 2371 | fReconstructor[iDet]->SetRecoParam(NULL); |
42ec5d3d | 2372 | fReconstructor[iDet]->SetEventInfo(NULL); |
2373 | } | |
1f26f3e7 | 2374 | if (fTracker[iDet]) fTracker[iDet]->SetEventInfo(NULL); |
ca13fb87 | 2375 | } |
2376 | ||
53c8f690 | 2377 | if (fRunQA || fRunGlobalQA) |
eca4fa66 | 2378 | AliQAManager::QAManager()->Increment() ; |
ddfbc51a | 2379 | |
e54c9180 | 2380 | DeleteRecPoints(fDeleteRecPoints); |
2381 | DeleteDigits(fDeleteDigits); | |
ddfbc51a | 2382 | // |
e54c9180 | 2383 | return kTRUE; |
21a3aa09 | 2384 | } |
2385 | ||
21a3aa09 | 2386 | //_____________________________________________________________________________ |
4b71572b | 2387 | void AliReconstruction::SlaveTerminate() |
21a3aa09 | 2388 | { |
4b71572b | 2389 | // Finalize the run on the slave side |
21a3aa09 | 2390 | // Called after the exit |
2391 | // from the event loop | |
52dd4a8c | 2392 | AliCodeTimerAuto("",0); |
42457748 | 2393 | // If analysis was done during reconstruction, we need to call SlaveTerminate for it |
2394 | if (fAnalysis) { | |
2395 | fAnalysis->PackOutput(fOutput); | |
2396 | fAnalysis->SetSkipTerminate(kTRUE); | |
2397 | fAnalysis->Terminate(); | |
2398 | } | |
21a3aa09 | 2399 | |
2400 | if (fIsNewRunLoader) { // galice.root didn't exist | |
2401 | fRunLoader->WriteHeader("OVERWRITE"); | |
5b3ea9c5 | 2402 | fRunLoader->WriteTrigger("OVERWRITE"); |
21a3aa09 | 2403 | fRunLoader->CdGAFile(); |
2404 | fRunLoader->Write(0, TObject::kOverwrite); | |
2405 | } | |
2406 | ||
f747912b | 2407 | const TMap *cdbMap = AliCDBManager::Instance()->GetStorageMap(); |
2408 | const TList *cdbList = AliCDBManager::Instance()->GetRetrievedIds(); | |
2409 | ||
2410 | TMap *cdbMapCopy = new TMap(cdbMap->GetEntries()); | |
2411 | cdbMapCopy->SetOwner(1); | |
2412 | cdbMapCopy->SetName("cdbMap"); | |
2413 | TIter iter(cdbMap->GetTable()); | |
2414 | ||
2415 | TPair* pair = 0; | |
2416 | while((pair = dynamic_cast<TPair*> (iter.Next()))){ | |
2417 | TObjString* keyStr = dynamic_cast<TObjString*> (pair->Key()); | |
c7a22819 | 2418 | TObjString* valStr = dynamic_cast<TObjString*> (pair->Value()); |
2419 | if (keyStr && valStr) | |
2420 | cdbMapCopy->Add(new TObjString(keyStr->GetName()), new TObjString(valStr->GetName())); | |
f747912b | 2421 | } |
2422 | ||
2423 | TList *cdbListCopy = new TList(); | |
2424 | cdbListCopy->SetOwner(1); | |
2425 | cdbListCopy->SetName("cdbList"); | |
2426 | ||
2427 | TIter iter2(cdbList); | |
2428 | ||
b940cb9b | 2429 | AliCDBId* id=0; |
e84c88f5 | 2430 | while((id = dynamic_cast<AliCDBId*> (iter2.Next()))){ |
a4970db9 | 2431 | cdbListCopy->Add(new TObjString(id->ToString().Data())); |
f747912b | 2432 | } |
2433 | ||
21a3aa09 | 2434 | ftree->GetUserInfo()->Add(cdbMapCopy); |
2435 | ftree->GetUserInfo()->Add(cdbListCopy); | |
abe0c04e | 2436 | |
27aa8455 | 2437 | // Add the AliRoot version that created this file |
2438 | TString sVersion("aliroot "); | |
2439 | sVersion += ALIROOT_SVN_BRANCH; | |
2440 | sVersion += ":"; | |
2441 | sVersion += ALIROOT_SVN_REVISION; | |
2442 | sVersion += "; root "; | |
2443 | sVersion += ROOT_SVN_BRANCH; | |
2444 | sVersion += ":"; | |
2445 | sVersion += ROOT_SVN_REVISION; | |
2446 | sVersion += "; metadata "; | |
2447 | sVersion += gSystem->Getenv("PRODUCTION_METADATA"); | |
2448 | ||
2449 | ||
2450 | TNamed * alirootVersion = new TNamed("alirootVersion",sVersion.Data()); | |
2451 | ftree->GetUserInfo()->Add(alirootVersion); // The list becomes owner of alirootVersion | |
46698ae4 | 2452 | |
21a3aa09 | 2453 | ffile->cd(); |
aa3c69a9 | 2454 | |
562dd0b4 | 2455 | // we want to have only one tree version number |
21a3aa09 | 2456 | ftree->Write(ftree->GetName(),TObject::kOverwrite); |
63314086 | 2457 | fhlttree->Write(fhlttree->GetName(),TObject::kOverwrite); |
f3a97c86 | 2458 | |
ee7c441c | 2459 | if (fWriteESDfriend) { |
2460 | ffileF->cd(); | |
2461 | ftreeF->Write(ftreeF->GetName(),TObject::kOverwrite); | |
2462 | } | |
2463 | ||
a7a1e1c7 | 2464 | // Finish with Plane Efficiency evaluation: before of CleanUp !!! |
2465 | if (fRunPlaneEff && !FinishPlaneEff()) { | |
2466 | AliWarning("Finish PlaneEff evaluation failed"); | |
2467 | } | |
2468 | ||
323a7f87 | 2469 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
0d45a46a | 2470 | if (fReconstructor[iDet]) fReconstructor[iDet]->Terminate(); |
323a7f87 | 2471 | } |
930e6e3e | 2472 | // End of cycle for the in-loop |
87da0921 | 2473 | |
2474 | if (fRunQA || fRunGlobalQA) { | |
5cbed243 | 2475 | AliQAManager::QAManager()->EndOfCycle() ; |
81d57268 | 2476 | if (fInput && |
2477 | !fProofOutputLocation.IsNull() && | |
2478 | fProofOutputArchive.IsNull() && | |
2479 | !fProofOutputDataset) { | |
2480 | TString qaOutputFile(Form("%sMerged.%s.Data.root", | |
2481 | fProofOutputLocation.Data(), | |
2482 | AliQAv1::GetQADataFileName())); | |
2483 | TProofOutputFile *qaProofFile = new TProofOutputFile(Form("Merged.%s.Data.root", | |
2484 | AliQAv1::GetQADataFileName())); | |
2485 | qaProofFile->SetOutputFileName(qaOutputFile.Data()); | |
2486 | if (AliDebugLevel() > 0) qaProofFile->Dump(); | |
2487 | fOutput->Add(qaProofFile); | |
2488 | MergeQA(qaProofFile->GetFileName()); | |
87da0921 | 2489 | } |
2490 | else { | |
2491 | MergeQA(); | |
2492 | } | |
2493 | } | |
2494 | ||
4b71572b | 2495 | gROOT->cd(); |
2496 | CleanUp(); | |
81d57268 | 2497 | |
2498 | if (fInput) { | |
2499 | if (!fProofOutputFileName.IsNull() && | |
2500 | !fProofOutputLocation.IsNull() && | |
2501 | fProofOutputDataset && | |
2502 | !fProofOutputArchive.IsNull()) { | |
2503 | TProofOutputFile *zipProofFile = new TProofOutputFile(fProofOutputFileName.Data(), | |
2504 | "DROV", | |
2505 | fProofOutputLocation.Data()); | |
2506 | if (AliDebugLevel() > 0) zipProofFile->Dump(); | |
2507 | fOutput->Add(zipProofFile); | |
2508 | TString fileList(fProofOutputArchive.Data()); | |
2509 | fileList.ReplaceAll(","," "); | |
38c18bf1 | 2510 | TString command; |
2511 | #if ROOT_SVN_REVISION >= 30174 | |
2512 | command.Form("zip -n root %s/%s %s",zipProofFile->GetDir(kTRUE),zipProofFile->GetFileName(),fileList.Data()); | |
2513 | #else | |
2514 | command.Form("zip -n root %s/%s %s",zipProofFile->GetDir(),zipProofFile->GetFileName(),fileList.Data()); | |
2515 | #endif | |
2516 | AliInfo(Form("Executing: %s",command.Data())); | |
2517 | gSystem->Exec(command.Data()); | |
81d57268 | 2518 | } |
2519 | } | |
4b71572b | 2520 | } |
2521 | ||
2522 | //_____________________________________________________________________________ | |
2523 | void AliReconstruction::Terminate() | |
2524 | { | |
f3a97c86 | 2525 | // Create tags for the events in the ESD tree (the ESD tree is always present) |
2526 | // In case of empty events the tags will contain dummy values | |
52dd4a8c | 2527 | AliCodeTimerAuto("",0); |
4b71572b | 2528 | |
ddfbc51a | 2529 | // Do not call the ESD tag creator in case of PROOF-based reconstruction |
e6d66370 | 2530 | if (!fInput) { |
2531 | AliESDTagCreator *esdtagCreator = new AliESDTagCreator(); | |
2532 | esdtagCreator->CreateESDTags(fFirstEvent,fLastEvent,fGRPData, AliQAv1::Instance()->GetQA(), AliQAv1::Instance()->GetEventSpecies(), AliQAv1::kNDET, AliRecoParam::kNSpecies); | |
9bcaa1d7 | 2533 | delete esdtagCreator; |
e6d66370 | 2534 | } |
e84c88f5 | 2535 | |
795e4a22 | 2536 | // Cleanup of CDB manager: cache and active storages! |
2537 | AliCDBManager::Instance()->ClearCache(); | |
596a855f | 2538 | } |
2539 | ||
b26c3770 | 2540 | //_____________________________________________________________________________ |
2541 | Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors) | |
2542 | { | |
2543 | // run the local reconstruction | |
aa3c69a9 | 2544 | |
0f88822a | 2545 | static Int_t eventNr=0; |
52dd4a8c | 2546 | AliCodeTimerAuto("",0) |
b26c3770 | 2547 | |
2548 | TString detStr = detectors; | |
9533b54d | 2549 | // execute HLT reconstruction first since other detector reconstruction |
2550 | // might depend on HLT data | |
2551 | // key 'HLT' is removed from detStr by IsSelected | |
2552 | if (!IsSelected("HLT", detStr)) { | |
2553 | AliReconstructor* reconstructor = GetReconstructor(kNDetectors-1); | |
2554 | if (reconstructor) { | |
2555 | // there is no AliLoader for HLT, see | |
2556 | // https://savannah.cern.ch/bugs/?35473 | |
2557 | AliInfo("running reconstruction for HLT"); | |
f6806ad3 | 2558 | if (fRawReader) { |
820b4d9e | 2559 | AliInfo("reconstructor->Reconstruct(fRawReader, NULL)"); |
44ed7a66 | 2560 | reconstructor->Reconstruct(fRawReader, NULL); |
820b4d9e | 2561 | } |
2562 | else { | |
2563 | AliInfo("reconstructor->Reconstruct(dummy, NULL)"); | |
44ed7a66 | 2564 | TTree* dummy=NULL; |
2565 | reconstructor->Reconstruct(dummy, NULL); | |
f6806ad3 | 2566 | } |
f6806ad3 | 2567 | } |
8d25d294 | 2568 | AliSysInfo::AddStamp(Form("LRecHLT_%d",eventNr), -1,1,eventNr); |
9533b54d | 2569 | } |
820b4d9e | 2570 | |
2571 | AliInfo(Form("kNDetectors = %d",kNDetectors)); | |
2572 | ||
9533b54d | 2573 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
2574 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; | |
820b4d9e | 2575 | AliDebug(1, Form("Detector: %s", fgkDetectorName[iDet])); |
9533b54d | 2576 | AliReconstructor* reconstructor = GetReconstructor(iDet); |
2577 | if (!reconstructor) continue; | |
2578 | AliLoader* loader = fLoader[iDet]; | |
d76c31f4 | 2579 | if (!loader) { |
2580 | AliWarning(Form("No loader is defined for %s!",fgkDetectorName[iDet])); | |
2581 | continue; | |
2582 | } | |
b26c3770 | 2583 | // conversion of digits |
2584 | if (fRawReader && reconstructor->HasDigitConversion()) { | |
2585 | AliInfo(Form("converting raw data digits into root objects for %s", | |
2586 | fgkDetectorName[iDet])); | |
30bbd491 | 2587 | // AliCodeTimerAuto(Form("converting raw data digits into root objects for %s", |
52dd4a8c | 2588 | // fgkDetectorName[iDet]),0); |
b26c3770 | 2589 | loader->LoadDigits("update"); |
2590 | loader->CleanDigits(); | |
2591 | loader->MakeDigitsContainer(); | |
2592 | TTree* digitsTree = loader->TreeD(); | |
2593 | reconstructor->ConvertDigits(fRawReader, digitsTree); | |
2594 | loader->WriteDigits("OVERWRITE"); | |
2595 | loader->UnloadDigits(); | |
b26c3770 | 2596 | } |
b26c3770 | 2597 | // local reconstruction |
b26c3770 | 2598 | AliInfo(Form("running reconstruction for %s", fgkDetectorName[iDet])); |
52dd4a8c | 2599 | //AliCodeTimerAuto(Form("running reconstruction for %s", fgkDetectorName[iDet]),0); |
820b4d9e | 2600 | AliDebug(1, "Loading Rec Points"); |
b26c3770 | 2601 | loader->LoadRecPoints("update"); |
820b4d9e | 2602 | AliDebug(1, "Cleaning Rec Points"); |
b26c3770 | 2603 | loader->CleanRecPoints(); |
820b4d9e | 2604 | AliDebug(1, "Making Rec Points Container"); |
b26c3770 | 2605 | loader->MakeRecPointsContainer(); |
2606 | TTree* clustersTree = loader->TreeR(); | |
2607 | if (fRawReader && !reconstructor->HasDigitConversion()) { | |
2608 | reconstructor->Reconstruct(fRawReader, clustersTree); | |
820b4d9e | 2609 | } |
2610 | else { | |
2611 | AliDebug(1, "Loading Digits"); | |
b26c3770 | 2612 | loader->LoadDigits("read"); |
2613 | TTree* digitsTree = loader->TreeD(); | |
820b4d9e | 2614 | AliDebug(1, Form("Digits Tree = %p",digitsTree)); |
b26c3770 | 2615 | if (!digitsTree) { |
44ed7a66 | 2616 | AliError(Form("Can't get the %s digits tree", fgkDetectorName[iDet])); |
13effe3f | 2617 | if (fStopOnError) |
2618 | return kFALSE; | |
820b4d9e | 2619 | } |
2620 | else { | |
2621 | AliDebug(1, "Digits -> Clusters"); | |
44ed7a66 | 2622 | reconstructor->Reconstruct(digitsTree, clustersTree); |
514cb8c7 | 2623 | if (fRunQA && IsInTasks(AliQAv1::kDIGITSR)) { |
eca4fa66 | 2624 | AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ; |
2625 | AliQAManager::QAManager()->RunOneEventInOneDetector(iDet, digitsTree) ; | |
44ed7a66 | 2626 | } |
b26c3770 | 2627 | } |
2628 | loader->UnloadDigits(); | |
2629 | } | |
92664bc8 | 2630 | if (fRunQA && IsInTasks(AliQAv1::kRECPOINTS)) { |
eca4fa66 | 2631 | AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ; |
92664bc8 | 2632 | AliQAManager::QAManager()->RunOneEventInOneDetector(iDet, clustersTree) ; |
57acd2d2 | 2633 | } |
eca4fa66 | 2634 | loader->WriteRecPoints("OVERWRITE"); |
2635 | loader->UnloadRecPoints(); | |
2636 | AliSysInfo::AddStamp(Form("LRec%s_%d",fgkDetectorName[iDet],eventNr), iDet,1,eventNr); | |
a00021a7 | 2637 | } |
c7a22819 | 2638 | if (!IsSelected("CTP", detStr)) AliDebug(10,"No CTP"); |
a00021a7 | 2639 | if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { |
b26c3770 | 2640 | AliError(Form("the following detectors were not found: %s", |
2641 | detStr.Data())); | |
13effe3f | 2642 | if (fStopOnError) |
2643 | return kFALSE; | |
b26c3770 | 2644 | } |
0f88822a | 2645 | eventNr++; |
b26c3770 | 2646 | return kTRUE; |
2647 | } | |
58e8dc31 | 2648 | //_____________________________________________________________________________ |
2649 | Bool_t AliReconstruction::RunSPDTrackleting(AliESDEvent*& esd) | |
2650 | { | |
2651 | // run the SPD trackleting (for SPD efficiency purpouses) | |
2652 | ||
52dd4a8c | 2653 | AliCodeTimerAuto("",0) |
58e8dc31 | 2654 | |
2655 | Double_t vtxPos[3] = {0, 0, 0}; | |
2656 | Double_t vtxErr[3] = {0.0, 0.0, 0.0}; | |
2657 | /* | |
09b62f0a | 2658 | TArrayF m |
2659 | / | |
2660 | cVertex(3); | |
58e8dc31 | 2661 | // if(MC) |
2662 | if (fRunLoader->GetHeader() && fRunLoader->GetHeader()->GenEventHeader()) { | |
2663 | fRunLoader->GetHeader()->GenEventHeader()->PrimaryVertex(mcVertex); | |
2664 | for (Int_t i = 0; i < 3; i++) vtxPos[i] = mcVertex[i]; | |
2665 | } | |
2666 | */ | |
2667 | const AliESDVertex *vertex = esd->GetVertex(); | |
2668 | if(!vertex){ | |
2669 | AliWarning("Vertex not found"); | |
2670 | return kFALSE; | |
2671 | } | |
2672 | vertex->GetXYZ(vtxPos); | |
2673 | vertex->GetSigmaXYZ(vtxErr); | |
2674 | if (fSPDTrackleter) { | |
2675 | AliInfo("running the SPD Trackleter for Plane Efficiency Evaluation"); | |
2676 | ||
2677 | // load clusters | |
2678 | fLoader[0]->LoadRecPoints("read"); | |
2679 | TTree* tree = fLoader[0]->TreeR(); | |
2680 | if (!tree) { | |
2681 | AliError("Can't get the ITS cluster tree"); | |
2682 | return kFALSE; | |
2683 | } | |
2684 | fSPDTrackleter->LoadClusters(tree); | |
2685 | fSPDTrackleter->SetVertex(vtxPos, vtxErr); | |
2686 | // run trackleting | |
2687 | if (fSPDTrackleter->Clusters2Tracks(esd) != 0) { | |
84290fcc | 2688 | AliWarning("AliITSTrackleterSPDEff Clusters2Tracks failed"); |
58e8dc31 | 2689 | // fLoader[0]->UnloadRecPoints(); |
2690 | return kFALSE; | |
2691 | } | |
2692 | //fSPDTrackleter->UnloadRecPoints(); | |
2693 | } else { | |
2694 | AliWarning("SPDTrackleter not available"); | |
2695 | return kFALSE; | |
2696 | } | |
2697 | return kTRUE; | |
2698 | } | |
b26c3770 | 2699 | |
596a855f | 2700 | //_____________________________________________________________________________ |
af885e0f | 2701 | Bool_t AliReconstruction::RunVertexFinder(AliESDEvent*& esd) |
596a855f | 2702 | { |
2703 | // run the barrel tracking | |
2704 | ||
52dd4a8c | 2705 | AliCodeTimerAuto("",0) |
030b532d | 2706 | |
92bffc4d | 2707 | AliVertexer *vertexer = CreateVertexer(); |
2708 | if (!vertexer) return kFALSE; | |
2709 | ||
3c99b88f | 2710 | AliInfo(Form("running the ITS vertex finder: %s",vertexer->ClassName())); |
2257f27e | 2711 | AliESDVertex* vertex = NULL; |
92bffc4d | 2712 | if (fLoader[0]) { |
2713 | fLoader[0]->LoadRecPoints(); | |
2714 | TTree* cltree = fLoader[0]->TreeR(); | |
2715 | if (cltree) { | |
2716 | if(fDiamondProfileSPD) vertexer->SetVtxStart(fDiamondProfileSPD); | |
2717 | vertex = vertexer->FindVertexForCurrentEvent(cltree); | |
308c2f7c | 2718 | } |
2719 | else { | |
92bffc4d | 2720 | AliError("Can't get the ITS cluster tree"); |
308c2f7c | 2721 | } |
92bffc4d | 2722 | fLoader[0]->UnloadRecPoints(); |
2257f27e | 2723 | } |
92bffc4d | 2724 | else { |
2725 | AliError("Can't get the ITS loader"); | |
2726 | } | |
2727 | if(!vertex){ | |
2728 | AliWarning("Vertex not found"); | |
2729 | vertex = new AliESDVertex(); | |
2730 | vertex->SetName("default"); | |
2731 | } | |
2732 | else { | |
2733 | vertex->SetName("reconstructed"); | |
2257f27e | 2734 | } |
92bffc4d | 2735 | |
2736 | Double_t vtxPos[3]; | |
2737 | Double_t vtxErr[3]; | |
2738 | vertex->GetXYZ(vtxPos); | |
2739 | vertex->GetSigmaXYZ(vtxErr); | |
2740 | ||
06cc9d95 | 2741 | esd->SetPrimaryVertexSPD(vertex); |
73c51de2 | 2742 | AliESDVertex *vpileup = NULL; |
2743 | Int_t novertices = 0; | |
2744 | vpileup = vertexer->GetAllVertices(novertices); | |
2745 | if(novertices>1){ | |
2746 | for (Int_t kk=1; kk<novertices; kk++)esd->AddPileupVertexSPD(&vpileup[kk]); | |
2747 | } | |
1f9831ab | 2748 | /* |
32e449be | 2749 | // if SPD multiplicity has been determined, it is stored in the ESD |
92bffc4d | 2750 | AliMultiplicity *mult = vertexer->GetMultiplicity(); |
32e449be | 2751 | if(mult)esd->SetMultiplicity(mult); |
1f9831ab | 2752 | */ |
ac4a7581 | 2753 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 2754 | if (fTracker[iDet]) fTracker[iDet]->SetVertex(vtxPos, vtxErr); |
2755 | } | |
2257f27e | 2756 | delete vertex; |
2757 | ||
92bffc4d | 2758 | delete vertexer; |
2759 | ||
2257f27e | 2760 | return kTRUE; |
2761 | } | |
2762 | ||
1f9831ab | 2763 | //_____________________________________________________________________________ |
2764 | Bool_t AliReconstruction::RunMultFinder(AliESDEvent*& esd) | |
2765 | { | |
2766 | // run the trackleter for multiplicity study | |
2767 | ||
2768 | AliCodeTimerAuto("",0) | |
2769 | ||
2770 | AliTrackleter *trackleter = CreateMultFinder(); | |
2771 | if (!trackleter) return kFALSE; | |
2772 | ||
2773 | AliInfo(Form("running the ITS multiplicity finder: %s",trackleter->ClassName())); | |
2774 | ||
2775 | if (fLoader[0]) { | |
2776 | fLoader[0]->LoadRecPoints(); | |
2777 | TTree* cltree = fLoader[0]->TreeR(); | |
2778 | if (cltree) { | |
2779 | trackleter->Reconstruct(esd,cltree); | |
2780 | AliMultiplicity *mult = trackleter->GetMultiplicity(); | |
2781 | if(mult) esd->SetMultiplicity(mult); | |
2782 | } | |
2783 | else { | |
2784 | AliError("Can't get the ITS cluster tree"); | |
2785 | } | |
2786 | fLoader[0]->UnloadRecPoints(); | |
2787 | } | |
2788 | else { | |
2789 | AliError("Can't get the ITS loader"); | |
2790 | } | |
2791 | ||
2792 | delete trackleter; | |
2793 | ||
2794 | return kTRUE; | |
2795 | } | |
2796 | ||
1f46a9ae | 2797 | //_____________________________________________________________________________ |
af885e0f | 2798 | Bool_t AliReconstruction::RunHLTTracking(AliESDEvent*& esd) |
1f46a9ae | 2799 | { |
2800 | // run the HLT barrel tracking | |
2801 | ||
52dd4a8c | 2802 | AliCodeTimerAuto("",0) |
1f46a9ae | 2803 | |
2804 | if (!fRunLoader) { | |
2805 | AliError("Missing runLoader!"); | |
2806 | return kFALSE; | |
2807 | } | |
2808 | ||
2809 | AliInfo("running HLT tracking"); | |
2810 | ||
2811 | // Get a pointer to the HLT reconstructor | |
ac4a7581 | 2812 | AliReconstructor *reconstructor = GetReconstructor(kNDetectors-1); |
1f46a9ae | 2813 | if (!reconstructor) return kFALSE; |
2814 | ||
2815 | // TPC + ITS | |
2816 | for (Int_t iDet = 1; iDet >= 0; iDet--) { | |
2817 | TString detName = fgkDetectorName[iDet]; | |
2818 | AliDebug(1, Form("%s HLT tracking", detName.Data())); | |
2819 | reconstructor->SetOption(detName.Data()); | |
d76c31f4 | 2820 | AliTracker *tracker = reconstructor->CreateTracker(); |
1f46a9ae | 2821 | if (!tracker) { |
2822 | AliWarning(Form("couldn't create a HLT tracker for %s", detName.Data())); | |
2823 | if (fStopOnError) return kFALSE; | |
9dcc06e1 | 2824 | continue; |
1f46a9ae | 2825 | } |
2826 | Double_t vtxPos[3]; | |
2827 | Double_t vtxErr[3]={0.005,0.005,0.010}; | |
2828 | const AliESDVertex *vertex = esd->GetVertex(); | |
2829 | vertex->GetXYZ(vtxPos); | |
2830 | tracker->SetVertex(vtxPos,vtxErr); | |
2831 | if(iDet != 1) { | |
2832 | fLoader[iDet]->LoadRecPoints("read"); | |
2833 | TTree* tree = fLoader[iDet]->TreeR(); | |
2834 | if (!tree) { | |
2835 | AliError(Form("Can't get the %s cluster tree", detName.Data())); | |
2836 | return kFALSE; | |
2837 | } | |
2838 | tracker->LoadClusters(tree); | |
2839 | } | |
2840 | if (tracker->Clusters2Tracks(esd) != 0) { | |
2841 | AliError(Form("HLT %s Clusters2Tracks failed", fgkDetectorName[iDet])); | |
2842 | return kFALSE; | |
2843 | } | |
2844 | if(iDet != 1) { | |
2845 | tracker->UnloadClusters(); | |
2846 | } | |
2847 | delete tracker; | |
2848 | } | |
2849 | ||
1f46a9ae | 2850 | return kTRUE; |
2851 | } | |
2852 | ||
e66fbafb | 2853 | //_____________________________________________________________________________ |
af885e0f | 2854 | Bool_t AliReconstruction::RunMuonTracking(AliESDEvent*& esd) |
e66fbafb | 2855 | { |
2856 | // run the muon spectrometer tracking | |
2857 | ||
52dd4a8c | 2858 | AliCodeTimerAuto("",0) |
e66fbafb | 2859 | |
2860 | if (!fRunLoader) { | |
2861 | AliError("Missing runLoader!"); | |
2862 | return kFALSE; | |
2863 | } | |
cfeca9e2 | 2864 | Int_t iDet = GetDetIndex("MUON"); // for MUON |
e66fbafb | 2865 | |
2866 | // Get a pointer to the MUON reconstructor | |
2867 | AliReconstructor *reconstructor = GetReconstructor(iDet); | |
2868 | if (!reconstructor) return kFALSE; | |
2869 | ||
2870 | ||
2871 | TString detName = fgkDetectorName[iDet]; | |
2872 | AliDebug(1, Form("%s tracking", detName.Data())); | |
d76c31f4 | 2873 | AliTracker *tracker = reconstructor->CreateTracker(); |
e66fbafb | 2874 | if (!tracker) { |
2875 | AliWarning(Form("couldn't create a tracker for %s", detName.Data())); | |
2876 | return kFALSE; | |
2877 | } | |
2878 | ||
e66fbafb | 2879 | // read RecPoints |
761350a6 | 2880 | fLoader[iDet]->LoadRecPoints("read"); |
c1954ee5 | 2881 | |
761350a6 | 2882 | tracker->LoadClusters(fLoader[iDet]->TreeR()); |
2883 | ||
2884 | Int_t rv = tracker->Clusters2Tracks(esd); | |
2885 | ||
e66fbafb | 2886 | fLoader[iDet]->UnloadRecPoints(); |
2887 | ||
c1954ee5 | 2888 | tracker->UnloadClusters(); |
2889 | ||
cb23c6ca | 2890 | if ( rv ) |
2891 | { | |
2892 | AliError(Form("%s Clusters2Tracks failed", fgkDetectorName[iDet])); | |
2893 | return kFALSE; | |
2894 | } | |
2895 | ||
e66fbafb | 2896 | return kTRUE; |
2897 | } | |
2898 | ||
2899 | ||
2257f27e | 2900 | //_____________________________________________________________________________ |
10d100d4 | 2901 | Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd,AliESDpid &PID) |
2257f27e | 2902 | { |
2903 | // run the barrel tracking | |
0f88822a | 2904 | static Int_t eventNr=0; |
52dd4a8c | 2905 | AliCodeTimerAuto("",0) |
24f7a148 | 2906 | |
815c2b38 | 2907 | AliInfo("running tracking"); |
596a855f | 2908 | |
1f26f3e7 | 2909 | // Set the event info which is used |
2910 | // by the trackers in order to obtain | |
2911 | // information about read-out detectors, | |
2912 | // trigger etc. | |
2913 | AliDebug(1, "Setting event info"); | |
2914 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { | |
2915 | if (!fTracker[iDet]) continue; | |
2916 | fTracker[iDet]->SetEventInfo(&fEventInfo); | |
2917 | } | |
2918 | ||
91b876d1 | 2919 | //Fill the ESD with the T0 info (will be used by the TOF) |
d76c31f4 | 2920 | if (fReconstructor[11] && fLoader[11]) { |
2921 | fLoader[11]->LoadRecPoints("READ"); | |
2922 | TTree *treeR = fLoader[11]->TreeR(); | |
89916438 | 2923 | if (treeR) { |
2924 | GetReconstructor(11)->FillESD((TTree *)NULL,treeR,esd); | |
2925 | } | |
d76c31f4 | 2926 | } |
91b876d1 | 2927 | |
b8cd5251 | 2928 | // pass 1: TPC + ITS inwards |
2929 | for (Int_t iDet = 1; iDet >= 0; iDet--) { | |
2930 | if (!fTracker[iDet]) continue; | |
2931 | AliDebug(1, Form("%s tracking", fgkDetectorName[iDet])); | |
24f7a148 | 2932 | |
b8cd5251 | 2933 | // load clusters |
2934 | fLoader[iDet]->LoadRecPoints("read"); | |
6efecea1 | 2935 | AliSysInfo::AddStamp(Form("RLoadCluster%s_%d",fgkDetectorName[iDet],eventNr),iDet,1, eventNr); |
b8cd5251 | 2936 | TTree* tree = fLoader[iDet]->TreeR(); |
2937 | if (!tree) { | |
2938 | AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet])); | |
24f7a148 | 2939 | return kFALSE; |
2940 | } | |
b8cd5251 | 2941 | fTracker[iDet]->LoadClusters(tree); |
6efecea1 | 2942 | AliSysInfo::AddStamp(Form("TLoadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,2, eventNr); |
b8cd5251 | 2943 | // run tracking |
2944 | if (fTracker[iDet]->Clusters2Tracks(esd) != 0) { | |
2945 | AliError(Form("%s Clusters2Tracks failed", fgkDetectorName[iDet])); | |
24f7a148 | 2946 | return kFALSE; |
2947 | } | |
8d25d294 | 2948 | AliSysInfo::AddStamp(Form("Tracking0%s_%d",fgkDetectorName[iDet],eventNr), iDet,3,eventNr); |
878e1fe1 | 2949 | // preliminary PID in TPC needed by the ITS tracker |
2950 | if (iDet == 1) { | |
b26c3770 | 2951 | GetReconstructor(1)->FillESD((TTree*)NULL, (TTree*)NULL, esd); |
10d100d4 | 2952 | PID.MakePID(esd,kTRUE); |
8d25d294 | 2953 | AliSysInfo::AddStamp(Form("MakePID0%s_%d",fgkDetectorName[iDet],eventNr), iDet,4,eventNr); |
0f88822a | 2954 | } |
b8cd5251 | 2955 | } |
596a855f | 2956 | |
b8cd5251 | 2957 | // pass 2: ALL backwards |
aa3c69a9 | 2958 | |
ac4a7581 | 2959 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 2960 | if (!fTracker[iDet]) continue; |
2961 | AliDebug(1, Form("%s back propagation", fgkDetectorName[iDet])); | |
2962 | ||
2963 | // load clusters | |
2964 | if (iDet > 1) { // all except ITS, TPC | |
2965 | TTree* tree = NULL; | |
7b61cd9c | 2966 | fLoader[iDet]->LoadRecPoints("read"); |
6efecea1 | 2967 | AliSysInfo::AddStamp(Form("RLoadCluster0%s_%d",fgkDetectorName[iDet],eventNr), iDet,1, eventNr); |
7b61cd9c | 2968 | tree = fLoader[iDet]->TreeR(); |
b8cd5251 | 2969 | if (!tree) { |
eca4fa66 | 2970 | AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet])); |
2971 | return kFALSE; | |
24f7a148 | 2972 | } |
0f88822a | 2973 | fTracker[iDet]->LoadClusters(tree); |
6efecea1 | 2974 | AliSysInfo::AddStamp(Form("TLoadCluster0%s_%d",fgkDetectorName[iDet],eventNr), iDet,2, eventNr); |
b8cd5251 | 2975 | } |
24f7a148 | 2976 | |
b8cd5251 | 2977 | // run tracking |
283f39c6 | 2978 | if (iDet>1) // start filling residuals for the "outer" detectors |
eca4fa66 | 2979 | if (fRunGlobalQA) { |
2980 | AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kTRUE); | |
2981 | TObjArray ** arr = AliTracker::GetResidualsArray() ; | |
c9526f68 | 2982 | if (arr) { |
0a349581 | 2983 | AliRecoParam::EventSpecie_t es=fRecoParam.GetEventSpecie(); |
2984 | TObjArray * elem = arr[AliRecoParam::AConvert(es)]; | |
c9526f68 | 2985 | if ( elem && (! elem->At(0)) ) { |
2986 | AliQADataMaker *qadm = AliQAManager::QAManager()->GetQADataMaker(AliQAv1::kGLOBAL); | |
2987 | if (qadm) qadm->InitRecPointsForTracker() ; | |
2988 | } | |
2989 | } | |
8d25d294 | 2990 | // AliSysInfo::AddStamp(Form("QAInitResid%s_%d",fgkDetectorName[iDet],eventNr), iDet,0, eventNr); |
eca4fa66 | 2991 | } |
b8cd5251 | 2992 | if (fTracker[iDet]->PropagateBack(esd) != 0) { |
2993 | AliError(Form("%s backward propagation failed", fgkDetectorName[iDet])); | |
49dfd67a | 2994 | // return kFALSE; |
b8cd5251 | 2995 | } |
8d25d294 | 2996 | AliSysInfo::AddStamp(Form("Tracking1%s_%d",fgkDetectorName[iDet],eventNr), iDet,3, eventNr); |
24f7a148 | 2997 | |
b8cd5251 | 2998 | // unload clusters |
6e65648b | 2999 | if (iDet > 3) { // all except ITS, TPC, TRD and TOF |
b8cd5251 | 3000 | fTracker[iDet]->UnloadClusters(); |
7b61cd9c | 3001 | fLoader[iDet]->UnloadRecPoints(); |
b8cd5251 | 3002 | } |
8f37df88 | 3003 | // updated PID in TPC needed by the ITS tracker -MI |
3004 | if (iDet == 1) { | |
10d100d4 | 3005 | //GetReconstructor(1)->FillESD((TTree*)NULL, (TTree*)NULL, esd); |
3006 | //AliESDpid::MakePID(esd); | |
3007 | PID.MakePID(esd,kTRUE); | |
8d25d294 | 3008 | AliSysInfo::AddStamp(Form("MakePID1%s_%d",fgkDetectorName[iDet],eventNr), iDet,4,eventNr); |
8f37df88 | 3009 | } |
8d25d294 | 3010 | |
b8cd5251 | 3011 | } |
283f39c6 | 3012 | //stop filling residuals for the "outer" detectors |
57acd2d2 | 3013 | if (fRunGlobalQA) AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kFALSE); |
596a855f | 3014 | |
b8cd5251 | 3015 | // pass 3: TRD + TPC + ITS refit inwards |
aa3c69a9 | 3016 | |
b8cd5251 | 3017 | for (Int_t iDet = 2; iDet >= 0; iDet--) { |
3018 | if (!fTracker[iDet]) continue; | |
3019 | AliDebug(1, Form("%s inward refit", fgkDetectorName[iDet])); | |
596a855f | 3020 | |
b8cd5251 | 3021 | // run tracking |
283f39c6 | 3022 | if (iDet<2) // start filling residuals for TPC and ITS |
eca4fa66 | 3023 | if (fRunGlobalQA) { |
3024 | AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kTRUE); | |
3025 | TObjArray ** arr = AliTracker::GetResidualsArray() ; | |
c9526f68 | 3026 | if (arr) { |
0a349581 | 3027 | AliRecoParam::EventSpecie_t es=fRecoParam.GetEventSpecie(); |
3028 | TObjArray * elem = arr[AliRecoParam::AConvert(es)]; | |
c9526f68 | 3029 | if ( elem && (! elem->At(0)) ) { |
3030 | AliQADataMaker *qadm = AliQAManager::QAManager()->GetQADataMaker(AliQAv1::kGLOBAL); | |
3031 | if (qadm) qadm->InitRecPointsForTracker() ; | |
3032 | } | |
3033 | } | |
eca4fa66 | 3034 | } |
3035 | ||
b8cd5251 | 3036 | if (fTracker[iDet]->RefitInward(esd) != 0) { |
3037 | AliError(Form("%s inward refit failed", fgkDetectorName[iDet])); | |
49dfd67a | 3038 | // return kFALSE; |
b8cd5251 | 3039 | } |
db2368d0 | 3040 | // run postprocessing |
3041 | if (fTracker[iDet]->PostProcess(esd) != 0) { | |
3042 | AliError(Form("%s postprocessing failed", fgkDetectorName[iDet])); | |
3043 | // return kFALSE; | |
3044 | } | |
6efecea1 | 3045 | AliSysInfo::AddStamp(Form("Tracking2%s_%d",fgkDetectorName[iDet],eventNr), iDet,3, eventNr); |
6e65648b | 3046 | } |
3047 | ||
3048 | // write space-points to the ESD in case alignment data output | |
3049 | // is switched on | |
8d25d294 | 3050 | if (fWriteAlignmentData) { |
6e65648b | 3051 | WriteAlignmentData(esd); |
8d25d294 | 3052 | AliSysInfo::AddStamp(Form("WrtAlignData_%d",eventNr), 0,0, eventNr); |
3053 | } | |
3054 | ||
6e65648b | 3055 | for (Int_t iDet = 3; iDet >= 0; iDet--) { |
3056 | if (!fTracker[iDet]) continue; | |
b8cd5251 | 3057 | // unload clusters |
3058 | fTracker[iDet]->UnloadClusters(); | |
6efecea1 | 3059 | AliSysInfo::AddStamp(Form("TUnloadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,4, eventNr); |
b8cd5251 | 3060 | fLoader[iDet]->UnloadRecPoints(); |
6efecea1 | 3061 | AliSysInfo::AddStamp(Form("RUnloadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,5, eventNr); |
b8cd5251 | 3062 | } |
283f39c6 | 3063 | // stop filling residuals for TPC and ITS |
57acd2d2 | 3064 | if (fRunGlobalQA) AliTracker::SetFillResiduals(fRecoParam.GetEventSpecie(), kFALSE); |
854c6476 | 3065 | |
0f88822a | 3066 | eventNr++; |
596a855f | 3067 | return kTRUE; |
3068 | } | |
3069 | ||
d64bd07d | 3070 | //_____________________________________________________________________________ |
3071 | Bool_t AliReconstruction::CleanESD(AliESDEvent *esd){ | |
3072 | // | |
3073 | // Remove the data which are not needed for the physics analysis. | |
3074 | // | |
3075 | ||
d64bd07d | 3076 | Int_t nTracks=esd->GetNumberOfTracks(); |
18571674 | 3077 | Int_t nV0s=esd->GetNumberOfV0s(); |
cf37fd88 | 3078 | AliInfo |
3079 | (Form("Number of ESD tracks and V0s before cleaning: %d %d",nTracks,nV0s)); | |
d64bd07d | 3080 | |
18571674 | 3081 | Float_t cleanPars[]={fV0DCAmax,fV0CsPmin,fDmax,fZmax}; |
7f68891d | 3082 | Bool_t rc=esd->Clean(cleanPars); |
d64bd07d | 3083 | |
7f68891d | 3084 | nTracks=esd->GetNumberOfTracks(); |
18571674 | 3085 | nV0s=esd->GetNumberOfV0s(); |
cf37fd88 | 3086 | AliInfo |
ae5d5566 | 3087 | (Form("Number of ESD tracks and V0s after cleaning %d %d",nTracks,nV0s)); |
d64bd07d | 3088 | |
7f68891d | 3089 | return rc; |
d64bd07d | 3090 | } |
3091 | ||
596a855f | 3092 | //_____________________________________________________________________________ |
af885e0f | 3093 | Bool_t AliReconstruction::FillESD(AliESDEvent*& esd, const TString& detectors) |
596a855f | 3094 | { |
3095 | // fill the event summary data | |
3096 | ||
52dd4a8c | 3097 | AliCodeTimerAuto("",0) |
0f88822a | 3098 | static Int_t eventNr=0; |
596a855f | 3099 | TString detStr = detectors; |
abe0c04e | 3100 | |
f1640d23 | 3101 | AliSysInfo::AddStamp(Form("FillESDb%d",eventNr), -19,-19, eventNr); |
ac4a7581 | 3102 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
abe0c04e | 3103 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
b8cd5251 | 3104 | AliReconstructor* reconstructor = GetReconstructor(iDet); |
3105 | if (!reconstructor) continue; | |
4b71572b | 3106 | AliDebug(1, Form("filling ESD for %s", fgkDetectorName[iDet])); |
3107 | TTree* clustersTree = NULL; | |
3108 | if (fLoader[iDet]) { | |
3109 | fLoader[iDet]->LoadRecPoints("read"); | |
3110 | clustersTree = fLoader[iDet]->TreeR(); | |
3111 | if (!clustersTree) { | |
3112 | AliError(Form("Can't get the %s clusters tree", | |
3113 | fgkDetectorName[iDet])); | |
3114 | if (fStopOnError) return kFALSE; | |
3115 | } | |
3116 | } | |
3117 | if (fRawReader && !reconstructor->HasDigitConversion()) { | |
3118 | reconstructor->FillESD(fRawReader, clustersTree, esd); | |
3119 | } else { | |
3120 | TTree* digitsTree = NULL; | |
d76c31f4 | 3121 | if (fLoader[iDet]) { |
4b71572b | 3122 | fLoader[iDet]->LoadDigits("read"); |
3123 | digitsTree = fLoader[iDet]->TreeD(); | |
3124 | if (!digitsTree) { | |
3125 | AliError(Form("Can't get the %s digits tree", | |
b26c3770 | 3126 | fgkDetectorName[iDet])); |
3127 | if (fStopOnError) return kFALSE; | |
3128 | } | |
3129 | } | |
4b71572b | 3130 | reconstructor->FillESD(digitsTree, clustersTree, esd); |
3131 | if (fLoader[iDet]) fLoader[iDet]->UnloadDigits(); | |
3132 | } | |
3133 | if (fLoader[iDet]) { | |
3134 | fLoader[iDet]->UnloadRecPoints(); | |
596a855f | 3135 | } |
3136 | } | |
13effe3f | 3137 | |
c7a22819 | 3138 | if (!IsSelected("CTP", detStr)) AliDebug(10,"No CTP"); |
596a855f | 3139 | if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { |
815c2b38 | 3140 | AliError(Form("the following detectors were not found: %s", |
3141 | detStr.Data())); | |
596a855f | 3142 | if (fStopOnError) return kFALSE; |
3143 | } | |
f1640d23 | 3144 | AliSysInfo::AddStamp(Form("FillESDe%d",eventNr), -20,-20, eventNr); |
0f88822a | 3145 | eventNr++; |
596a855f | 3146 | return kTRUE; |
3147 | } | |
3148 | ||
b647652d | 3149 | //_____________________________________________________________________________ |
af885e0f | 3150 | Bool_t AliReconstruction::FillTriggerESD(AliESDEvent*& esd) |
b647652d | 3151 | { |
3152 | // Reads the trigger decision which is | |
3153 | // stored in Trigger.root file and fills | |
3154 | // the corresponding esd entries | |
3155 | ||
52dd4a8c | 3156 | AliCodeTimerAuto("",0) |
87932dab | 3157 | |
b647652d | 3158 | AliInfo("Filling trigger information into the ESD"); |
3159 | ||
3160 | if (fRawReader) { | |
3161 | AliCTPRawStream input(fRawReader); | |
3162 | if (!input.Next()) { | |
7e88424f | 3163 | AliWarning("No valid CTP (trigger) DDL raw data is found ! The trigger info is taken from the event header!"); |
b647652d | 3164 | } |
3165 | else { | |
7e88424f | 3166 | if (esd->GetTriggerMask() != input.GetClassMask()) |
3167 | AliError(Form("Invalid trigger pattern found in CTP raw-data: %llx %llx", | |
3168 | input.GetClassMask(),esd->GetTriggerMask())); | |
3169 | if (esd->GetOrbitNumber() != input.GetOrbitID()) | |
3170 | AliError(Form("Invalid orbit id found in CTP raw-data: %x %x", | |
3171 | input.GetOrbitID(),esd->GetOrbitNumber())); | |
3172 | if (esd->GetBunchCrossNumber() != input.GetBCID()) | |
3173 | AliError(Form("Invalid bunch-crossing id found in CTP raw-data: %x %x", | |
3174 | input.GetBCID(),esd->GetBunchCrossNumber())); | |
e61ed4b1 | 3175 | AliESDHeader* esdheader = esd->GetHeader(); |
3176 | esdheader->SetL0TriggerInputs(input.GetL0Inputs()); | |
3177 | esdheader->SetL1TriggerInputs(input.GetL1Inputs()); | |
3178 | esdheader->SetL2TriggerInputs(input.GetL2Inputs()); | |
a6dd87ad | 3179 | // IR |
6ac1d1f4 | 3180 | // UInt_t orbit=input.GetOrbitID(); |
96bf4ffc | 3181 | for(Int_t i=0 ; i<input.GetNIRs() ; i++ ) { |
3182 | esdheader->AddTriggerIR(input.GetIR(i)); | |
3183 | } | |
5b3ea9c5 | 3184 | AliCentralTrigger* rlCTP = fRunLoader->GetTrigger(); |
173b7e07 | 3185 | if (rlCTP) { |
3186 | rlCTP->SetL0TriggerInputs(input.GetL0Inputs()); | |
3187 | rlCTP->SetL1TriggerInputs(input.GetL1Inputs()); | |
3188 | rlCTP->SetL2TriggerInputs(input.GetL2Inputs()); | |
3189 | } | |
b647652d | 3190 | } |
5b3ea9c5 | 3191 | if (fIsNewRunLoader) fRunLoader->TreeCT()->Fill(); |
b024fd7f | 3192 | } |
f7812afc | 3193 | return kTRUE; |
3194 | } | |
3195 | //_____________________________________________________________________________ | |
3196 | Bool_t AliReconstruction::FillTriggerScalers(AliESDEvent*& esd) | |
3197 | { | |
522fdd91 | 3198 | //Scalers |
82ebedd6 | 3199 | //fRunScalers->Print(); |
3200 | if(fRunScalers && fRunScalers->CheckRunScalers()){ | |
a6dd87ad | 3201 | AliTimeStamp* timestamp = new AliTimeStamp(esd->GetOrbitNumber(), esd->GetPeriodNumber(), esd->GetBunchCrossNumber()); |
82ebedd6 | 3202 | //AliTimeStamp* timestamp = new AliTimeStamp(10308000, 0, (ULong64_t)486238); |
522fdd91 | 3203 | AliESDHeader* esdheader = fesd->GetHeader(); |
3204 | for(Int_t i=0;i<50;i++){ | |
1e78ae8c | 3205 | if((1ull<<i) & esd->GetTriggerMask()){ |
6863d231 | 3206 | AliTriggerScalersESD* scalesd = fRunScalers->GetScalersForEventClass( timestamp, i+1); |
82ebedd6 | 3207 | if(scalesd)esdheader->SetTriggerScalersRecord(scalesd); |
522fdd91 | 3208 | } |
3209 | } | |
09b62f0a | 3210 | const AliTriggerScalersRecordESD* scalrecEvent = fRunScalers->GetScalersDeltaForEvent( timestamp); |
3211 | const AliTriggerScalersRecordESD* scalrecRun = fRunScalers->GetScalersDeltaForRun(); | |
3212 | if (scalrecEvent) esdheader->SetTriggerScalersDeltaEvent(scalrecEvent); | |
3213 | if (scalrecRun) esdheader->SetTriggerScalersDeltaRun(scalrecRun); | |
522fdd91 | 3214 | } |
b647652d | 3215 | return kTRUE; |
3216 | } | |
001397cd | 3217 | //_____________________________________________________________________________ |
af885e0f | 3218 | Bool_t AliReconstruction::FillRawEventHeaderESD(AliESDEvent*& esd) |
001397cd | 3219 | { |
3220 | // | |
3221 | // Filling information from RawReader Header | |
3222 | // | |
3223 | ||
151bea4e | 3224 | if (!fRawReader) return kFALSE; |
3225 | ||
001397cd | 3226 | AliInfo("Filling information from RawReader Header"); |
151bea4e | 3227 | |
3228 | esd->SetBunchCrossNumber(fRawReader->GetBCID()); | |
3229 | esd->SetOrbitNumber(fRawReader->GetOrbitID()); | |
3230 | esd->SetPeriodNumber(fRawReader->GetPeriod()); | |
3231 | ||
3232 | esd->SetTimeStamp(fRawReader->GetTimestamp()); | |
3233 | esd->SetEventType(fRawReader->GetType()); | |
001397cd | 3234 | |
3235 | return kTRUE; | |
3236 | } | |
3237 | ||
3238 | ||
596a855f | 3239 | //_____________________________________________________________________________ |
3240 | Bool_t AliReconstruction::IsSelected(TString detName, TString& detectors) const | |
3241 | { | |
3242 | // check whether detName is contained in detectors | |
3243 | // if yes, it is removed from detectors | |
3244 | ||
3245 | // check if all detectors are selected | |
3246 | if ((detectors.CompareTo("ALL") == 0) || | |
3247 | detectors.BeginsWith("ALL ") || | |
3248 | detectors.EndsWith(" ALL") || | |
3249 | detectors.Contains(" ALL ")) { | |
3250 | detectors = "ALL"; | |
3251 | return kTRUE; | |
3252 | } | |
3253 | ||
3254 | // search for the given detector | |
3255 | Bool_t result = kFALSE; | |
3256 | if ((detectors.CompareTo(detName) == 0) || | |
3257 | detectors.BeginsWith(detName+" ") || | |
3258 | detectors.EndsWith(" "+detName) || | |
3259 | detectors.Contains(" "+detName+" ")) { | |
3260 | detectors.ReplaceAll(detName, ""); | |
3261 | result = kTRUE; | |
3262 | } | |
3263 | ||
3264 | // clean up the detectors string | |
3265 | while (detectors.Contains(" ")) detectors.ReplaceAll(" ", " "); | |
3266 | while (detectors.BeginsWith(" ")) detectors.Remove(0, 1); | |
3267 | while (detectors.EndsWith(" ")) detectors.Remove(detectors.Length()-1, 1); | |
3268 | ||
3269 | return result; | |
3270 | } | |
e583c30d | 3271 | |
f08fc9f5 | 3272 | //_____________________________________________________________________________ |
3273 | Bool_t AliReconstruction::InitRunLoader() | |
3274 | { | |
3275 | // get or create the run loader | |
3276 | ||
3277 | if (gAlice) delete gAlice; | |
3278 | gAlice = NULL; | |
3279 | ||
52dd4a8c | 3280 | TFile *gafile = TFile::Open(fGAliceFileName.Data()); |
3281 | // if (!gSystem->AccessPathName(fGAliceFileName.Data())) { // galice.root exists | |
3282 | if (gafile) { // galice.root exists | |
3283 | gafile->Close(); | |
3284 | delete gafile; | |
3285 | ||
b26c3770 | 3286 | // load all base libraries to get the loader classes |
3287 | TString libs = gSystem->GetLibraries(); | |
ac4a7581 | 3288 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b26c3770 | 3289 | TString detName = fgkDetectorName[iDet]; |
3290 | if (detName == "HLT") continue; | |
3291 | if (libs.Contains("lib" + detName + "base.so")) continue; | |
3292 | gSystem->Load("lib" + detName + "base.so"); | |
3293 | } | |
f08fc9f5 | 3294 | fRunLoader = AliRunLoader::Open(fGAliceFileName.Data()); |
3295 | if (!fRunLoader) { | |
3296 | AliError(Form("no run loader found in file %s", fGAliceFileName.Data())); | |
3297 | CleanUp(); | |
3298 | return kFALSE; | |
3299 | } | |
325aa76f | 3300 | |
b26c3770 | 3301 | fRunLoader->CdGAFile(); |
325aa76f | 3302 | fRunLoader->LoadgAlice(); |
f08fc9f5 | 3303 | |
6cae184e | 3304 | //PH This is a temporary fix to give access to the kinematics |
3305 | //PH that is needed for the labels of ITS clusters | |
f2ee4290 | 3306 | fRunLoader->LoadHeader(); |
6cae184e | 3307 | fRunLoader->LoadKinematics(); |
3308 | ||
f08fc9f5 | 3309 | } else { // galice.root does not exist |
3310 | if (!fRawReader) { | |
3311 | AliError(Form("the file %s does not exist", fGAliceFileName.Data())); | |
f08fc9f5 | 3312 | } |
3313 | fRunLoader = AliRunLoader::Open(fGAliceFileName.Data(), | |
3314 | AliConfig::GetDefaultEventFolderName(), | |
3315 | "recreate"); | |
3316 | if (!fRunLoader) { | |
3317 | AliError(Form("could not create run loader in file %s", | |
3318 | fGAliceFileName.Data())); | |
3319 | CleanUp(); | |
3320 | return kFALSE; | |
3321 | } | |
21a3aa09 | 3322 | fIsNewRunLoader = kTRUE; |
f08fc9f5 | 3323 | fRunLoader->MakeTree("E"); |
5b3ea9c5 | 3324 | fRunLoader->MakeTree("GG"); |
21a3aa09 | 3325 | |
973388c2 | 3326 | if (fNumberOfEventsPerFile > 0) |
3327 | fRunLoader->SetNumberOfEventsPerFile(fNumberOfEventsPerFile); | |
3328 | else | |
21a3aa09 | 3329 | fRunLoader->SetNumberOfEventsPerFile((UInt_t)-1); |
f08fc9f5 | 3330 | } |
3331 | ||
3332 | return kTRUE; | |
3333 | } | |
3334 | ||
c757bafd | 3335 | //_____________________________________________________________________________ |
b8cd5251 | 3336 | AliReconstructor* AliReconstruction::GetReconstructor(Int_t iDet) |
c757bafd | 3337 | { |
f08fc9f5 | 3338 | // get the reconstructor object and the loader for a detector |
c757bafd | 3339 | |
7e88424f | 3340 | if (fReconstructor[iDet]) { |
3341 | if (fRecoParam.GetDetRecoParamArray(iDet) && !AliReconstructor::GetRecoParam(iDet)) { | |
3342 | const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet); | |
3343 | fReconstructor[iDet]->SetRecoParam(par); | |
42ec5d3d | 3344 | fReconstructor[iDet]->SetRunInfo(fRunInfo); |
7e88424f | 3345 | } |
3346 | return fReconstructor[iDet]; | |
3347 | } | |
b8cd5251 | 3348 | |
3349 | // load the reconstructor object | |
3350 | TPluginManager* pluginManager = gROOT->GetPluginManager(); | |
3351 | TString detName = fgkDetectorName[iDet]; | |
3352 | TString recName = "Ali" + detName + "Reconstructor"; | |
f0999a9a | 3353 | |
3354 | if (!fIsNewRunLoader && !fRunLoader->GetLoader(detName+"Loader") && (detName != "HLT")) return NULL; | |
b8cd5251 | 3355 | |
b8cd5251 | 3356 | AliReconstructor* reconstructor = NULL; |
3357 | // first check if a plugin is defined for the reconstructor | |
3358 | TPluginHandler* pluginHandler = | |
3359 | pluginManager->FindHandler("AliReconstructor", detName); | |
f08fc9f5 | 3360 | // if not, add a plugin for it |
3361 | if (!pluginHandler) { | |
b8cd5251 | 3362 | AliDebug(1, Form("defining plugin for %s", recName.Data())); |
b26c3770 | 3363 | TString libs = gSystem->GetLibraries(); |
3364 | if (libs.Contains("lib" + detName + "base.so") || | |
3365 | (gSystem->Load("lib" + detName + "base.so") >= 0)) { | |
b8cd5251 | 3366 | pluginManager->AddHandler("AliReconstructor", detName, |
3367 | recName, detName + "rec", recName + "()"); | |
3368 | } else { | |
3369 | pluginManager->AddHandler("AliReconstructor", detName, | |
3370 | recName, detName, recName + "()"); | |
c757bafd | 3371 | } |
b8cd5251 | 3372 | pluginHandler = pluginManager->FindHandler("AliReconstructor", detName); |
3373 | } | |
3374 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { | |
3375 | reconstructor = (AliReconstructor*) pluginHandler->ExecPlugin(0); | |
c757bafd | 3376 | } |
f9fc20b4 | 3377 | |
3378 | // check if the upgrade reconstructor should be used instead of the standard one | |
3379 | if(fUpgradeMask[iDet]) { | |
3380 | if(reconstructor) delete reconstructor; | |
3381 | TClass *cl = new TClass(Form("Ali%sUpgradeReconstructor",fgkDetectorName[iDet])); | |
3382 | reconstructor = (AliReconstructor*)(cl->New()); | |
3383 | } | |
3384 | ||
b8cd5251 | 3385 | if (reconstructor) { |
3386 | TObject* obj = fOptions.FindObject(detName.Data()); | |
3387 | if (obj) reconstructor->SetOption(obj->GetTitle()); | |
1e500f25 | 3388 | reconstructor->SetRunInfo(fRunInfo); |
d76c31f4 | 3389 | reconstructor->Init(); |
b8cd5251 | 3390 | fReconstructor[iDet] = reconstructor; |
3391 | } | |
3392 | ||
f08fc9f5 | 3393 | // get or create the loader |
3394 | if (detName != "HLT") { | |
3395 | fLoader[iDet] = fRunLoader->GetLoader(detName + "Loader"); | |
3396 | if (!fLoader[iDet]) { | |
3397 | AliConfig::Instance() | |
3398 | ->CreateDetectorFolders(fRunLoader->GetEventFolder(), | |
3399 | detName, detName); | |
3400 | // first check if a plugin is defined for the loader | |
bb0901a4 | 3401 | pluginHandler = |
f08fc9f5 | 3402 | pluginManager->FindHandler("AliLoader", detName); |
3403 | // if not, add a plugin for it | |
3404 | if (!pluginHandler) { | |
3405 | TString loaderName = "Ali" + detName + "Loader"; | |
3406 | AliDebug(1, Form("defining plugin for %s", loaderName.Data())); | |
3407 | pluginManager->AddHandler("AliLoader", detName, | |
3408 | loaderName, detName + "base", | |
3409 | loaderName + "(const char*, TFolder*)"); | |
3410 | pluginHandler = pluginManager->FindHandler("AliLoader", detName); | |
3411 | } | |
3412 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { | |
3413 | fLoader[iDet] = | |
3414 | (AliLoader*) pluginHandler->ExecPlugin(2, detName.Data(), | |
3415 | fRunLoader->GetEventFolder()); | |
3416 | } | |
3417 | if (!fLoader[iDet]) { // use default loader | |
3418 | fLoader[iDet] = new AliLoader(detName, fRunLoader->GetEventFolder()); | |
3419 | } | |
3420 | if (!fLoader[iDet]) { | |
3421 | AliWarning(Form("couldn't get loader for %s", detName.Data())); | |
6667b602 | 3422 | if (fStopOnError) return NULL; |
f08fc9f5 | 3423 | } else { |
3424 | fRunLoader->AddLoader(fLoader[iDet]); | |
3425 | fRunLoader->CdGAFile(); | |
3426 | if (gFile && !gFile->IsWritable()) gFile->ReOpen("UPDATE"); | |
3427 | fRunLoader->Write(0, TObject::kOverwrite); | |
3428 | } | |
3429 | } | |
3430 | } | |
3431 | ||
7e88424f | 3432 | if (fRecoParam.GetDetRecoParamArray(iDet) && !AliReconstructor::GetRecoParam(iDet)) { |
3433 | const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet); | |
c7a22819 | 3434 | if (reconstructor) { |
3435 | reconstructor->SetRecoParam(par); | |
3436 | reconstructor->SetRunInfo(fRunInfo); | |
3437 | } | |
7e88424f | 3438 | } |
b8cd5251 | 3439 | return reconstructor; |
c757bafd | 3440 | } |
3441 | ||
2257f27e | 3442 | //_____________________________________________________________________________ |
92bffc4d | 3443 | AliVertexer* AliReconstruction::CreateVertexer() |
2257f27e | 3444 | { |
3445 | // create the vertexer | |
92bffc4d | 3446 | // Please note that the caller is the owner of the |
3447 | // vertexer | |
2257f27e | 3448 | |
92bffc4d | 3449 | AliVertexer* vertexer = NULL; |
b8cd5251 | 3450 | AliReconstructor* itsReconstructor = GetReconstructor(0); |
903b1262 | 3451 | if (itsReconstructor && ((fRunLocalReconstruction.Contains("ITS")) || |
3452 | fRunTracking.Contains("ITS") || fFillESD.Contains("ITS") )) { | |
92bffc4d | 3453 | vertexer = itsReconstructor->CreateVertexer(); |
2257f27e | 3454 | } |
92bffc4d | 3455 | if (!vertexer) { |
815c2b38 | 3456 | AliWarning("couldn't create a vertexer for ITS"); |
2257f27e | 3457 | } |
3458 | ||
92bffc4d | 3459 | return vertexer; |
2257f27e | 3460 | } |
3461 | ||
1f9831ab | 3462 | //_____________________________________________________________________________ |
3463 | AliTrackleter* AliReconstruction::CreateMultFinder() | |
3464 | { | |
3465 | // create the ITS trackleter for mult. estimation | |
3466 | // Please note that the caller is the owner of the | |
3467 | // trackleter | |
3468 | ||
3469 | AliTrackleter* trackleter = NULL; | |
3470 | AliReconstructor* itsReconstructor = GetReconstructor(0); | |
903b1262 | 3471 | if (itsReconstructor && ((fRunLocalReconstruction.Contains("ITS")) || |
3472 | fRunTracking.Contains("ITS") || fFillESD.Contains("ITS") )) { | |
1f9831ab | 3473 | trackleter = itsReconstructor->CreateMultFinder(); |
3474 | } | |
a0ef2c64 | 3475 | else { |
3476 | AliWarning("ITS is not in reconstruction, switching off RunMultFinder"); | |
3477 | fRunMultFinder = kFALSE; | |
1f9831ab | 3478 | } |
3479 | ||
3480 | return trackleter; | |
3481 | } | |
3482 | ||
24f7a148 | 3483 | //_____________________________________________________________________________ |
b8cd5251 | 3484 | Bool_t AliReconstruction::CreateTrackers(const TString& detectors) |
24f7a148 | 3485 | { |
f08fc9f5 | 3486 | // create the trackers |
44e45fac | 3487 | AliInfo("Creating trackers"); |
24f7a148 | 3488 | |
b8cd5251 | 3489 | TString detStr = detectors; |
ac4a7581 | 3490 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 3491 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
3492 | AliReconstructor* reconstructor = GetReconstructor(iDet); | |
3493 | if (!reconstructor) continue; | |
3494 | TString detName = fgkDetectorName[iDet]; | |
1f46a9ae | 3495 | if (detName == "HLT") { |
3496 | fRunHLTTracking = kTRUE; | |
3497 | continue; | |
3498 | } | |
e66fbafb | 3499 | if (detName == "MUON") { |
3500 | fRunMuonTracking = kTRUE; | |
3501 | continue; | |
3502 | } | |
3503 | ||
d76c31f4 | 3504 | fTracker[iDet] = reconstructor->CreateTracker(); |
f08fc9f5 | 3505 | if (!fTracker[iDet] && (iDet < 7)) { |
3506 | AliWarning(Form("couldn't create a tracker for %s", detName.Data())); | |
8250d5f5 | 3507 | if (fStopOnError) return kFALSE; |
3508 | } | |
6efecea1 | 3509 | AliSysInfo::AddStamp(Form("LTracker%s",fgkDetectorName[iDet]), iDet,0); |
8250d5f5 | 3510 | } |
3511 | ||
24f7a148 | 3512 | return kTRUE; |
3513 | } | |
3514 | ||
e583c30d | 3515 | //_____________________________________________________________________________ |
4b71572b | 3516 | void AliReconstruction::CleanUp() |
e583c30d | 3517 | { |
3518 | // delete trackers and the run loader and close and delete the file | |
92664bc8 | 3519 | /* |
ac4a7581 | 3520 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 3521 | delete fReconstructor[iDet]; |
3522 | fReconstructor[iDet] = NULL; | |
3523 | fLoader[iDet] = NULL; | |
3524 | delete fTracker[iDet]; | |
3525 | fTracker[iDet] = NULL; | |
3526 | } | |
92664bc8 | 3527 | */ |
3528 | ||
4b71572b | 3529 | delete fRunInfo; |
7e88424f | 3530 | fRunInfo = NULL; |
3531 | ||
58e8dc31 | 3532 | delete fSPDTrackleter; |
3533 | fSPDTrackleter = NULL; | |
3534 | ||
4b71572b | 3535 | delete ftVertexer; |
21a3aa09 | 3536 | ftVertexer = NULL; |
795e4a22 | 3537 | |
e583c30d | 3538 | delete fRunLoader; |
3539 | fRunLoader = NULL; | |
b649205a | 3540 | delete fRawReader; |
3541 | fRawReader = NULL; | |
4b71572b | 3542 | delete fParentRawReader; |
cd0b062e | 3543 | fParentRawReader=NULL; |
e583c30d | 3544 | |
4b71572b | 3545 | if (ffile) { |
3546 | ffile->Close(); | |
3547 | delete ffile; | |
3548 | ffile = NULL; | |
24f7a148 | 3549 | } |
87da0921 | 3550 | |
bf76b847 | 3551 | if (AliQAManager::QAManager()) |
3552 | AliQAManager::QAManager()->ShowQA() ; | |
42457748 | 3553 | // AliQAManager::Destroy() ; |
3554 | delete fAnalysis; | |
0c4df52e | 3555 | fAnalysis = NULL; |
24f7a148 | 3556 | } |
f3a97c86 | 3557 | |
af885e0f | 3558 | void AliReconstruction::WriteAlignmentData(AliESDEvent* esd) |
98937d93 | 3559 | { |
3560 | // Write space-points which are then used in the alignment procedures | |
6e65648b | 3561 | // For the moment only ITS, TPC, TRD and TOF |
98937d93 | 3562 | |
98937d93 | 3563 | Int_t ntracks = esd->GetNumberOfTracks(); |
3564 | for (Int_t itrack = 0; itrack < ntracks; itrack++) | |
3565 | { | |
3566 | AliESDtrack *track = esd->GetTrack(itrack); | |
3567 | Int_t nsp = 0; | |
ef7253ac | 3568 | Int_t idx[200]; |
76741755 | 3569 | for (Int_t i=0; i<200; ++i) idx[i] = -1; //PH avoid uninitialized values |
81aa7a0d | 3570 | for (Int_t iDet = 5; iDet >= 0; iDet--) {// TOF, TRD, TPC, ITS clusters |
0ad488b0 | 3571 | nsp += (iDet==GetDetIndex("TRD")) ? track->GetTRDntracklets():track->GetNcls(iDet); |
6e65648b | 3572 | |
0ad488b0 | 3573 | if (iDet==GetDetIndex("ITS")) { // ITS "extra" clusters |
6e65648b | 3574 | track->GetClusters(iDet,idx); |
3575 | for (Int_t i=6; i<12; i++) if(idx[i] >= 0) nsp++; | |
3576 | } | |
3577 | } | |
3578 | ||
98937d93 | 3579 | if (nsp) { |
ddfbc51a | 3580 | AliTrackPointArray *sp = new AliTrackPointArray(nsp); |
98937d93 | 3581 | track->SetTrackPointArray(sp); |
3582 | Int_t isptrack = 0; | |
81aa7a0d | 3583 | for (Int_t iDet = 5; iDet >= 0; iDet--) { |
98937d93 | 3584 | AliTracker *tracker = fTracker[iDet]; |
3585 | if (!tracker) continue; | |
0ad488b0 | 3586 | Int_t nspdet = (iDet==GetDetIndex("TRD")) ? track->GetTRDtracklets(idx):track->GetClusters(iDet,idx); |
6e65648b | 3587 | |
0ad488b0 | 3588 | if (iDet==GetDetIndex("ITS")) // ITS "extra" clusters |
6e65648b | 3589 | for (Int_t i=6; i<12; i++) if(idx[i] >= 0) nspdet++; |
3590 | ||
98937d93 | 3591 | if (nspdet <= 0) continue; |
98937d93 | 3592 | AliTrackPoint p; |
3593 | Int_t isp = 0; | |
3594 | Int_t isp2 = 0; | |
4ed6fb1c | 3595 | while (isp2 < nspdet) { |
f3c6e4c9 | 3596 | Bool_t isvalid=kTRUE; |
3597 | ||
3598 | Int_t index=idx[isp++]; | |
3599 | if (index < 0) continue; | |
3600 | ||
c12b6e44 | 3601 | TString dets = fgkDetectorName[iDet]; |
3602 | if ((fUseTrackingErrorsForAlignment.CompareTo(dets) == 0) || | |
3603 | fUseTrackingErrorsForAlignment.BeginsWith(dets+" ") || | |
3604 | fUseTrackingErrorsForAlignment.EndsWith(" "+dets) || | |
3605 | fUseTrackingErrorsForAlignment.Contains(" "+dets+" ")) { | |
f3c6e4c9 | 3606 | isvalid = tracker->GetTrackPointTrackingError(index,p,track); |
48ce48d1 | 3607 | } else { |
f3c6e4c9 | 3608 | isvalid = tracker->GetTrackPoint(index,p); |
48ce48d1 | 3609 | } |
3610 | isp2++; | |
98937d93 | 3611 | if (!isvalid) continue; |
0ad488b0 | 3612 | if (iDet==GetDetIndex("ITS") && (isp-1)>=6) p.SetExtra(); |
f3c6e4c9 | 3613 | sp->AddPoint(isptrack,&p); isptrack++; |
98937d93 | 3614 | } |
98937d93 | 3615 | } |
3616 | } | |
3617 | } | |
98937d93 | 3618 | } |
2e3550da | 3619 | |
3620 | //_____________________________________________________________________________ | |
af885e0f | 3621 | void AliReconstruction::FillRawDataErrorLog(Int_t iEvent, AliESDEvent* esd) |
2e3550da | 3622 | { |
3623 | // The method reads the raw-data error log | |
3624 | // accumulated within the rawReader. | |
3625 | // It extracts the raw-data errors related to | |
3626 | // the current event and stores them into | |
3627 | // a TClonesArray inside the esd object. | |
3628 | ||
3629 | if (!fRawReader) return; | |
3630 | ||
3631 | for(Int_t i = 0; i < fRawReader->GetNumberOfErrorLogs(); i++) { | |
3632 | ||
3633 | AliRawDataErrorLog *log = fRawReader->GetErrorLog(i); | |
3634 | if (!log) continue; | |
3635 | if (iEvent != log->GetEventNumber()) continue; | |
3636 | ||
3637 | esd->AddRawDataErrorLog(log); | |
3638 | } | |
3639 | ||
3640 | } | |
46698ae4 | 3641 | |
8661738e | 3642 | //_____________________________________________________________________________ |
0a035be5 | 3643 | // void AliReconstruction::CheckQA() |
3644 | // { | |
8661738e | 3645 | // check the QA of SIM for this run and remove the detectors |
3646 | // with status Fatal | |
3647 | ||
57acd2d2 | 3648 | // TString newRunLocalReconstruction ; |
3649 | // TString newRunTracking ; | |
3650 | // TString newFillESD ; | |
3651 | // | |
4e25ac79 | 3652 | // for (Int_t iDet = 0; iDet < AliQAv1::kNDET; iDet++) { |
3653 | // TString detName(AliQAv1::GetDetName(iDet)) ; | |
3654 | // AliQAv1 * qa = AliQAv1::Instance(AliQAv1::DETECTORINDEX_t(iDet)) ; | |
3655 | // if ( qa->IsSet(AliQAv1::DETECTORINDEX_t(iDet), AliQAv1::kSIM, specie, AliQAv1::kFATAL)) { | |
57acd2d2 | 3656 | // AliInfo(Form("QA status for %s %s in Hits and/or SDIGITS and/or Digits was Fatal; No reconstruction performed", |
3657 | // detName.Data(), AliRecoParam::GetEventSpecieName(es))) ; | |
3658 | // } else { | |
4e25ac79 | 3659 | // if ( fRunLocalReconstruction.Contains(AliQAv1::GetDetName(iDet)) || |
57acd2d2 | 3660 | // fRunLocalReconstruction.Contains("ALL") ) { |
3661 | // newRunLocalReconstruction += detName ; | |
3662 | // newRunLocalReconstruction += " " ; | |
3663 | // } | |
4e25ac79 | 3664 | // if ( fRunTracking.Contains(AliQAv1::GetDetName(iDet)) || |
57acd2d2 | 3665 | // fRunTracking.Contains("ALL") ) { |
3666 | // newRunTracking += detName ; | |
3667 | // newRunTracking += " " ; | |
3668 | // } | |
4e25ac79 | 3669 | // if ( fFillESD.Contains(AliQAv1::GetDetName(iDet)) || |
57acd2d2 | 3670 | // fFillESD.Contains("ALL") ) { |
3671 | // newFillESD += detName ; | |
3672 | // newFillESD += " " ; | |
3673 | // } | |
3674 | // } | |
3675 | // } | |
3676 | // fRunLocalReconstruction = newRunLocalReconstruction ; | |
3677 | // fRunTracking = newRunTracking ; | |
3678 | // fFillESD = newFillESD ; | |
0a035be5 | 3679 | // } |
5b188f2f | 3680 | |
3681 | //_____________________________________________________________________________ | |
3682 | Int_t AliReconstruction::GetDetIndex(const char* detector) | |
3683 | { | |
3684 | // return the detector index corresponding to detector | |
3685 | Int_t index = -1 ; | |
ac4a7581 | 3686 | for (index = 0; index < kNDetectors ; index++) { |
5b188f2f | 3687 | if ( strcmp(detector, fgkDetectorName[index]) == 0 ) |
3688 | break ; | |
3689 | } | |
3690 | return index ; | |
3691 | } | |
7167ae53 | 3692 | //_____________________________________________________________________________ |
3693 | Bool_t AliReconstruction::FinishPlaneEff() { | |
3694 | // | |
3695 | // Here execute all the necessary operationis, at the end of the tracking phase, | |
d7f8fd68 | 3696 | // in case that evaluation of PlaneEfficiencies was required for some detector. |
3697 | // E.g., write into a DataBase file the PlaneEfficiency which have been evaluated. | |
7167ae53 | 3698 | // |
3699 | // This Preliminary version works only FOR ITS !!!!! | |
3700 | // other detectors (TOF,TRD, etc. have to develop their specific codes) | |
3701 | // | |
3702 | // Input: none | |
d7f8fd68 | 3703 | // Return: kTRUE if all operations have been done properly, kFALSE otherwise |
7167ae53 | 3704 | // |
3705 | Bool_t ret=kFALSE; | |
5ee13eb5 | 3706 | TString detStr = fLoadCDB; |
58e8dc31 | 3707 | //for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) { |
d7f8fd68 | 3708 | for (Int_t iDet = 0; iDet < 1; iDet++) { // for the time being only ITS |
5ee13eb5 | 3709 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
58e8dc31 | 3710 | if(fTracker[iDet] && fTracker[iDet]->GetPlaneEff()) { |
d7f8fd68 | 3711 | AliPlaneEff *planeeff=fTracker[iDet]->GetPlaneEff(); |
3712 | TString name=planeeff->GetName(); | |
3713 | name+=".root"; | |
3714 | TFile* pefile = TFile::Open(name, "RECREATE"); | |
3715 | ret=(Bool_t)planeeff->Write(); | |
3716 | pefile->Close(); | |
5fbd4fd6 | 3717 | if(planeeff->GetCreateHistos()) { |
d7f8fd68 | 3718 | TString hname=planeeff->GetName(); |
3719 | hname+="Histo.root"; | |
3720 | ret*=planeeff->WriteHistosToFile(hname,"RECREATE"); | |
5fbd4fd6 | 3721 | } |
3722 | } | |
58e8dc31 | 3723 | if(fSPDTrackleter) { |
3724 | AliPlaneEff *planeeff=fSPDTrackleter->GetPlaneEff(); | |
3725 | TString name="AliITSPlaneEffSPDtracklet.root"; | |
3726 | TFile* pefile = TFile::Open(name, "RECREATE"); | |
3727 | ret=(Bool_t)planeeff->Write(); | |
3728 | pefile->Close(); | |
3729 | AliESDEvent *dummy=NULL; | |
3730 | ret=(Bool_t)fSPDTrackleter->PostProcess(dummy); // take care of writing other files | |
3731 | } | |
7167ae53 | 3732 | } |
3733 | return ret; | |
3734 | } | |
3735 | //_____________________________________________________________________________ | |
3736 | Bool_t AliReconstruction::InitPlaneEff() { | |
3737 | // | |
3738 | // Here execute all the necessary operations, before of the tracking phase, | |
3739 | // for the evaluation of PlaneEfficiencies, in case required for some detectors. | |
58e8dc31 | 3740 | // E.g., read from a DataBase file a first evaluation of the PlaneEfficiency |
7167ae53 | 3741 | // which should be updated/recalculated. |
3742 | // | |
3743 | // This Preliminary version will work only FOR ITS !!!!! | |
3744 | // other detectors (TOF,TRD, etc. have to develop their specific codes) | |
3745 | // | |
3746 | // Input: none | |
3747 | // Return: kTRUE if all operations have been done properly, kFALSE otherwise | |
3748 | // | |
58e8dc31 | 3749 | |
3750 | fSPDTrackleter = NULL; | |
b8604b34 | 3751 | TString detStr = fLoadCDB; |
3752 | if (IsSelected(fgkDetectorName[0], detStr)) { | |
3753 | AliReconstructor* itsReconstructor = GetReconstructor(0); | |
3754 | if (itsReconstructor) { | |
3755 | fSPDTrackleter = itsReconstructor->CreateTrackleter(); // this is NULL unless required in RecoParam | |
3756 | } | |
3757 | if (fSPDTrackleter) { | |
3758 | AliInfo("Trackleter for SPD has been created"); | |
3759 | } | |
58e8dc31 | 3760 | } |
7167ae53 | 3761 | return kTRUE; |
7520312d | 3762 | } |
14dd053c | 3763 | |
3764 | //_____________________________________________________________________________ | |
3765 | Bool_t AliReconstruction::InitAliEVE() | |
3766 | { | |
3767 | // This method should be called only in case | |
3768 | // AliReconstruction is run | |
3769 | // within the alieve environment. | |
3770 | // It will initialize AliEVE in a way | |
3771 | // so that it can visualize event processed | |
3772 | // by AliReconstruction. | |
3773 | // The return flag shows whenever the | |
3774 | // AliEVE initialization was successful or not. | |
3775 | ||
5239ebd6 | 3776 | TString macroStr(gSystem->Getenv("ALIEVE_ONLINE_MACRO")); |
3777 | ||
3778 | if (macroStr.IsNull()) | |
3779 | macroStr.Form("%s/EVE/macros/alieve_online.C",gSystem->ExpandPathName("$ALICE_ROOT")); | |
3780 | ||
3781 | AliInfo(Form("Loading AliEVE macro: %s",macroStr.Data())); | |
3782 | ||
14dd053c | 3783 | if (gROOT->LoadMacro(macroStr.Data()) != 0) return kFALSE; |
3784 | ||
6a840f1e | 3785 | gROOT->ProcessLine("if (!AliEveEventManager::GetMaster()){new AliEveEventManager();AliEveEventManager::GetMaster()->AddNewEventCommand(\"alieve_online_on_new_event()\");gEve->AddEvent(AliEveEventManager::GetMaster());};"); |
de33999e | 3786 | gROOT->ProcessLine("alieve_online_init()"); |
14dd053c | 3787 | |
3788 | return kTRUE; | |
3789 | } | |
3790 | ||
3791 | //_____________________________________________________________________________ | |
3792 | void AliReconstruction::RunAliEVE() | |
3793 | { | |
3794 | // Runs AliEVE visualisation of | |
3795 | // the current event. | |
3796 | // Should be executed only after | |
3797 | // successful initialization of AliEVE. | |
3798 | ||
3799 | AliInfo("Running AliEVE..."); | |
72c084a0 | 3800 | gROOT->ProcessLine(Form("AliEveEventManager::GetMaster()->SetEvent((AliRunLoader*)%p,(AliRawReader*)%p,(AliESDEvent*)%p,(AliESDfriend*)%p);",fRunLoader,fRawReader,fesd,fesdf)); |
14dd053c | 3801 | gSystem->Run(); |
3802 | } | |
ce43afbe | 3803 | |
3804 | //_____________________________________________________________________________ | |
3805 | Bool_t AliReconstruction::SetRunQA(TString detAndAction) | |
3806 | { | |
3807 | // Allows to run QA for a selected set of detectors | |
44ed7a66 | 3808 | // and a selected set of tasks among RAWS, DIGITSR, RECPOINTS and ESDS |
ce43afbe | 3809 | // all selected detectors run the same selected tasks |
3810 | ||
3811 | if (!detAndAction.Contains(":")) { | |
3812 | AliError( Form("%s is a wrong syntax, use \"DetectorList:ActionList\" \n", detAndAction.Data()) ) ; | |
3813 | fRunQA = kFALSE ; | |
3814 | return kFALSE ; | |
3815 | } | |
3816 | Int_t colon = detAndAction.Index(":") ; | |
3817 | fQADetectors = detAndAction(0, colon) ; | |
59b1e631 | 3818 | fQATasks = detAndAction(colon+1, detAndAction.Sizeof() ) ; |
ce43afbe | 3819 | if (fQATasks.Contains("ALL") ) { |
44ed7a66 | 3820 | fQATasks = Form("%d %d %d %d", AliQAv1::kRAWS, AliQAv1::kDIGITSR, AliQAv1::kRECPOINTS, AliQAv1::kESDS) ; |
ce43afbe | 3821 | } else { |
3822 | fQATasks.ToUpper() ; | |
3823 | TString tempo("") ; | |
3824 | if ( fQATasks.Contains("RAW") ) | |
4e25ac79 | 3825 | tempo = Form("%d ", AliQAv1::kRAWS) ; |
44ed7a66 | 3826 | if ( fQATasks.Contains("DIGIT") ) |
3827 | tempo += Form("%d ", AliQAv1::kDIGITSR) ; | |
ce43afbe | 3828 | if ( fQATasks.Contains("RECPOINT") ) |
4e25ac79 | 3829 | tempo += Form("%d ", AliQAv1::kRECPOINTS) ; |
ce43afbe | 3830 | if ( fQATasks.Contains("ESD") ) |
4e25ac79 | 3831 | tempo += Form("%d ", AliQAv1::kESDS) ; |
ce43afbe | 3832 | fQATasks = tempo ; |
3833 | if (fQATasks.IsNull()) { | |
3834 | AliInfo("No QA requested\n") ; | |
3835 | fRunQA = kFALSE ; | |
3836 | return kTRUE ; | |
3837 | } | |
3838 | } | |
3839 | TString tempo(fQATasks) ; | |
4e25ac79 | 3840 | tempo.ReplaceAll(Form("%d", AliQAv1::kRAWS), AliQAv1::GetTaskName(AliQAv1::kRAWS)) ; |
44ed7a66 | 3841 | tempo.ReplaceAll(Form("%d", AliQAv1::kDIGITSR), AliQAv1::GetTaskName(AliQAv1::kDIGITSR)) ; |
4e25ac79 | 3842 | tempo.ReplaceAll(Form("%d", AliQAv1::kRECPOINTS), AliQAv1::GetTaskName(AliQAv1::kRECPOINTS)) ; |
3843 | tempo.ReplaceAll(Form("%d", AliQAv1::kESDS), AliQAv1::GetTaskName(AliQAv1::kESDS)) ; | |
ce43afbe | 3844 | AliInfo( Form("QA will be done on \"%s\" for \"%s\"\n", fQADetectors.Data(), tempo.Data()) ) ; |
3845 | fRunQA = kTRUE ; | |
3846 | return kTRUE; | |
3847 | } | |
3848 | ||
7e88424f | 3849 | //_____________________________________________________________________________ |
3850 | Bool_t AliReconstruction::InitRecoParams() | |
3851 | { | |
3852 | // The method accesses OCDB and retrieves all | |
3853 | // the available reco-param objects from there. | |
3854 | ||
3855 | Bool_t isOK = kTRUE; | |
3856 | ||
8b26452d | 3857 | if (fRecoParam.GetDetRecoParamArray(kNDetectors)) { |
3858 | AliInfo("Using custom GRP reconstruction parameters"); | |
3859 | } | |
3860 | else { | |
3861 | AliInfo("Loading GRP reconstruction parameter objects"); | |
3862 | ||
3863 | AliCDBPath path("GRP","Calib","RecoParam"); | |
3864 | AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath()); | |
3865 | if(!entry){ | |
3866 | AliWarning("Couldn't find GRP RecoParam entry in OCDB"); | |
3867 | isOK = kFALSE; | |
3868 | } | |
3869 | else { | |
3870 | TObject *recoParamObj = entry->GetObject(); | |
3871 | if (dynamic_cast<TObjArray*>(recoParamObj)) { | |
3872 | // GRP has a normal TobjArray of AliDetectorRecoParam objects | |
3873 | // Registering them in AliRecoParam | |
3874 | fRecoParam.AddDetRecoParamArray(kNDetectors,dynamic_cast<TObjArray*>(recoParamObj)); | |
3875 | } | |
3876 | else if (dynamic_cast<AliDetectorRecoParam*>(recoParamObj)) { | |
3877 | // GRP has only onse set of reco parameters | |
3878 | // Registering it in AliRecoParam | |
3879 | AliInfo("Single set of GRP reconstruction parameters found"); | |
3880 | dynamic_cast<AliDetectorRecoParam*>(recoParamObj)->SetAsDefault(); | |
3881 | fRecoParam.AddDetRecoParam(kNDetectors,dynamic_cast<AliDetectorRecoParam*>(recoParamObj)); | |
3882 | } | |
3883 | else { | |
3884 | AliError("No valid GRP RecoParam object found in the OCDB"); | |
3885 | isOK = kFALSE; | |
3886 | } | |
3887 | entry->SetOwner(0); | |
3888 | } | |
3889 | } | |
3890 | ||
7d566c20 | 3891 | TString detStr = fLoadCDB; |
ac4a7581 | 3892 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
7e88424f | 3893 | |
7d566c20 | 3894 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
3895 | ||
7e88424f | 3896 | if (fRecoParam.GetDetRecoParamArray(iDet)) { |
3897 | AliInfo(Form("Using custom reconstruction parameters for detector %s",fgkDetectorName[iDet])); | |
3898 | continue; | |
3899 | } | |
3900 | ||
ac232c75 | 3901 | AliInfo(Form("Loading reconstruction parameter objects for detector %s",fgkDetectorName[iDet])); |
7e88424f | 3902 | |
3903 | AliCDBPath path(fgkDetectorName[iDet],"Calib","RecoParam"); | |
3904 | AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath()); | |
3905 | if(!entry){ | |
3906 | AliWarning(Form("Couldn't find RecoParam entry in OCDB for detector %s",fgkDetectorName[iDet])); | |
3907 | isOK = kFALSE; | |
3908 | } | |
3909 | else { | |
3910 | TObject *recoParamObj = entry->GetObject(); | |
3911 | if (dynamic_cast<TObjArray*>(recoParamObj)) { | |
3912 | // The detector has a normal TobjArray of AliDetectorRecoParam objects | |
3913 | // Registering them in AliRecoParam | |
3914 | fRecoParam.AddDetRecoParamArray(iDet,dynamic_cast<TObjArray*>(recoParamObj)); | |
3915 | } | |
3916 | else if (dynamic_cast<AliDetectorRecoParam*>(recoParamObj)) { | |
3917 | // The detector has only onse set of reco parameters | |
3918 | // Registering it in AliRecoParam | |
ac232c75 | 3919 | AliInfo(Form("Single set of reconstruction parameters found for detector %s",fgkDetectorName[iDet])); |
7e88424f | 3920 | dynamic_cast<AliDetectorRecoParam*>(recoParamObj)->SetAsDefault(); |
3921 | fRecoParam.AddDetRecoParam(iDet,dynamic_cast<AliDetectorRecoParam*>(recoParamObj)); | |
3922 | } | |
3923 | else { | |
3924 | AliError(Form("No valid RecoParam object found in the OCDB for detector %s",fgkDetectorName[iDet])); | |
3925 | isOK = kFALSE; | |
3926 | } | |
3927 | entry->SetOwner(0); | |
f168abba | 3928 | // FIX ME: We have to disable the unloading of reco-param CDB |
3929 | // entries because QA framework is using them. Has to be fix in | |
3930 | // a way that the QA takes the objects already constructed in | |
3931 | // this method. | |
3932 | // AliCDBManager::Instance()->UnloadFromCache(path.GetPath()); | |
7e88424f | 3933 | } |
3934 | } | |
3935 | ||
e30a9b4d | 3936 | if (AliDebugLevel() > 0) fRecoParam.Print(); |
ac232c75 | 3937 | |
7e88424f | 3938 | return isOK; |
3939 | } | |
3940 | ||
3941 | //_____________________________________________________________________________ | |
3942 | Bool_t AliReconstruction::GetEventInfo() | |
3943 | { | |
3944 | // Fill the event info object | |
3945 | // ... | |
52dd4a8c | 3946 | AliCodeTimerAuto("",0) |
7e88424f | 3947 | |
3948 | AliCentralTrigger *aCTP = NULL; | |
3949 | if (fRawReader) { | |
3950 | fEventInfo.SetEventType(fRawReader->GetType()); | |
3951 | ||
3952 | ULong64_t mask = fRawReader->GetClassMask(); | |
3953 | fEventInfo.SetTriggerMask(mask); | |
3954 | UInt_t clmask = fRawReader->GetDetectorPattern()[0]; | |
3955 | fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(clmask)); | |
3956 | ||
3957 | aCTP = new AliCentralTrigger(); | |
3958 | TString configstr(""); | |
3959 | if (!aCTP->LoadConfiguration(configstr)) { // Load CTP config from OCDB | |
3960 | AliError("No trigger configuration found in OCDB! The trigger configuration information will not be used!"); | |
3961 | delete aCTP; | |
3962 | return kFALSE; | |
3963 | } | |
3964 | aCTP->SetClassMask(mask); | |
3965 | aCTP->SetClusterMask(clmask); | |
5b3ea9c5 | 3966 | |
3967 | AliCentralTrigger* rlCTP = fRunLoader->GetTrigger(); | |
173b7e07 | 3968 | if (rlCTP) { |
3969 | rlCTP->SetClassMask(mask); | |
3970 | rlCTP->SetClusterMask(clmask); | |
3971 | } | |
7e88424f | 3972 | } |
3973 | else { | |
3974 | fEventInfo.SetEventType(AliRawEventHeaderBase::kPhysicsEvent); | |
3975 | ||
3976 | if (fRunLoader && (!fRunLoader->LoadTrigger())) { | |
3977 | aCTP = fRunLoader->GetTrigger(); | |
3978 | fEventInfo.SetTriggerMask(aCTP->GetClassMask()); | |
e61ed4b1 | 3979 | // get inputs from actp - just get |
3980 | AliESDHeader* esdheader = fesd->GetHeader(); | |
3981 | esdheader->SetL0TriggerInputs(aCTP->GetL0TriggerInputs()); | |
3982 | esdheader->SetL1TriggerInputs(aCTP->GetL1TriggerInputs()); | |
3983 | esdheader->SetL2TriggerInputs(aCTP->GetL2TriggerInputs()); | |
7e88424f | 3984 | fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(aCTP->GetClusterMask())); |
3985 | } | |
3986 | else { | |
3987 | AliWarning("No trigger can be loaded! The trigger information will not be used!"); | |
3988 | return kFALSE; | |
3989 | } | |
3990 | } | |
3991 | ||
3992 | AliTriggerConfiguration *config = aCTP->GetConfiguration(); | |
3993 | if (!config) { | |
3994 | AliError("No trigger configuration has been found! The trigger configuration information will not be used!"); | |
3995 | if (fRawReader) delete aCTP; | |
3996 | return kFALSE; | |
3997 | } | |
3998 | ||
a0c2cf2d | 3999 | UChar_t clustmask = 0; |
7e88424f | 4000 | TString trclasses; |
4001 | ULong64_t trmask = fEventInfo.GetTriggerMask(); | |
4002 | const TObjArray& classesArray = config->GetClasses(); | |
4003 | Int_t nclasses = classesArray.GetEntriesFast(); | |
4004 | for( Int_t iclass=0; iclass < nclasses; iclass++ ) { | |
4005 | AliTriggerClass* trclass = (AliTriggerClass*)classesArray.At(iclass); | |
a2ec4f82 | 4006 | if (trclass && trclass->GetMask()>0) { |
a4b0683d | 4007 | Int_t trindex = TMath::Nint(TMath::Log2(trclass->GetMask())); |
7e88424f | 4008 | fesd->SetTriggerClass(trclass->GetName(),trindex); |
8a933107 | 4009 | if (fRawReader) fRawReader->LoadTriggerClass(trclass->GetName(),trindex); |
e61ed4b1 | 4010 | if (trmask & (1ull << trindex)) { |
7e88424f | 4011 | trclasses += " "; |
4012 | trclasses += trclass->GetName(); | |
4013 | trclasses += " "; | |
a0c2cf2d | 4014 | clustmask |= trclass->GetCluster()->GetClusterMask(); |
7e88424f | 4015 | } |
4016 | } | |
4017 | } | |
4018 | fEventInfo.SetTriggerClasses(trclasses); | |
764daca3 | 4019 | // Now put the declared trigger classes (not present in the run) |
4020 | // to 0/false in the event selection | |
4021 | if (!fDeclTriggerClasses.IsNull()) { | |
4022 | TObjArray *tokens = fDeclTriggerClasses.Tokenize(" "); | |
4023 | Int_t ntokens = tokens->GetEntriesFast(); | |
4024 | for (Int_t itoken = 0; itoken < ntokens; ++itoken) { | |
4025 | if (fRawReader) fRawReader->LoadTriggerClass((((TObjString*)tokens->At(itoken))->String()).Data(),-1); | |
4026 | } | |
4027 | delete tokens; | |
4028 | } | |
7e88424f | 4029 | |
6ef9caeb | 4030 | // Write names of active trigger inputs in ESD Header |
4031 | const TObjArray& inputsArray = config->GetInputs(); | |
4032 | Int_t ninputs = inputsArray.GetEntriesFast(); | |
4033 | for( Int_t iinput=0; iinput < ninputs; iinput++ ) { | |
4034 | AliTriggerInput* trginput = (AliTriggerInput*)inputsArray.At(iinput); | |
a2ec4f82 | 4035 | if (trginput && trginput->GetMask()>0) { |
6ef9caeb | 4036 | Int_t inputIndex = (Int_t)TMath::Nint(TMath::Log2(trginput->GetMask())); |
4037 | AliESDHeader* headeresd = fesd->GetHeader(); | |
4038 | Int_t trglevel = (Int_t)trginput->GetLevel(); | |
4039 | if (trglevel == 0) headeresd->SetActiveTriggerInputs(trginput->GetInputName(), inputIndex); | |
4040 | if (trglevel == 1) headeresd->SetActiveTriggerInputs(trginput->GetInputName(), inputIndex+24); | |
4041 | if (trglevel == 2) headeresd->SetActiveTriggerInputs(trginput->GetInputName(), inputIndex+48); | |
4042 | } | |
4043 | } | |
4044 | ||
a0c2cf2d | 4045 | // Set the information in ESD |
4046 | fesd->SetTriggerMask(trmask); | |
4047 | fesd->SetTriggerCluster(clustmask); | |
4048 | ||
7e88424f | 4049 | if (!aCTP->CheckTriggeredDetectors()) { |
4050 | if (fRawReader) delete aCTP; | |
4051 | return kFALSE; | |
4052 | } | |
4053 | ||
4054 | if (fRawReader) delete aCTP; | |
4055 | ||
4056 | // We have to fill also the HLT decision here!! | |
4057 | // ... | |
4058 | ||
4059 | return kTRUE; | |
4060 | } | |
4061 | ||
4062 | const char *AliReconstruction::MatchDetectorList(const char *detectorList, UInt_t detectorMask) | |
4063 | { | |
4064 | // Match the detector list found in the rec.C or the default 'ALL' | |
4065 | // to the list found in the GRP (stored there by the shuttle PP which | |
4066 | // gets the information from ECS) | |
4067 | static TString resultList; | |
4068 | TString detList = detectorList; | |
4069 | ||
4070 | resultList = ""; | |
4071 | ||
4072 | for(Int_t iDet = 0; iDet < (AliDAQ::kNDetectors-1); iDet++) { | |
4073 | if ((detectorMask >> iDet) & 0x1) { | |
4074 | TString det = AliDAQ::OfflineModuleName(iDet); | |
4075 | if ((detList.CompareTo("ALL") == 0) || | |
a101e1dd | 4076 | ((detList.BeginsWith("ALL ") || |
4077 | detList.EndsWith(" ALL") || | |
4078 | detList.Contains(" ALL ")) && | |
4079 | !(detList.BeginsWith("-"+det+" ") || | |
4080 | detList.EndsWith(" -"+det) || | |
4081 | detList.Contains(" -"+det+" "))) || | |
7e88424f | 4082 | (detList.CompareTo(det) == 0) || |
a101e1dd | 4083 | detList.BeginsWith(det+" ") || |
4084 | detList.EndsWith(" "+det) || | |
7e88424f | 4085 | detList.Contains( " "+det+" " )) { |
4086 | if (!resultList.EndsWith(det + " ")) { | |
4087 | resultList += det; | |
4088 | resultList += " "; | |
4089 | } | |
4090 | } | |
4091 | } | |
4092 | } | |
4093 | ||
4094 | // HLT | |
4095 | if ((detectorMask >> AliDAQ::kHLTId) & 0x1) { | |
4096 | TString hltDet = AliDAQ::OfflineModuleName(AliDAQ::kNDetectors-1); | |
4097 | if ((detList.CompareTo("ALL") == 0) || | |
a101e1dd | 4098 | ((detList.BeginsWith("ALL ") || |
4099 | detList.EndsWith(" ALL") || | |
4100 | detList.Contains(" ALL ")) && | |
4101 | !(detList.BeginsWith("-"+hltDet+" ") || | |
4102 | detList.EndsWith(" -"+hltDet) || | |
4103 | detList.Contains(" -"+hltDet+" "))) || | |
7e88424f | 4104 | (detList.CompareTo(hltDet) == 0) || |
a101e1dd | 4105 | detList.BeginsWith(hltDet+" ") || |
4106 | detList.EndsWith(" "+hltDet) || | |
7e88424f | 4107 | detList.Contains( " "+hltDet+" " )) { |
4108 | resultList += hltDet; | |
4109 | } | |
4110 | } | |
4111 | ||
4112 | return resultList.Data(); | |
4113 | ||
4114 | } | |
4b71572b | 4115 | |
4116 | //______________________________________________________________________________ | |
4117 | void AliReconstruction::Abort(const char *method, EAbort what) | |
4118 | { | |
4119 | // Abort processing. If what = kAbortProcess, the Process() loop will be | |
4120 | // aborted. If what = kAbortFile, the current file in a chain will be | |
4121 | // aborted and the processing will continue with the next file, if there | |
4122 | // is no next file then Process() will be aborted. Abort() can also be | |
4123 | // called from Begin(), SlaveBegin(), Init() and Notify(). After abort | |
4124 | // the SlaveTerminate() and Terminate() are always called. The abort flag | |
4125 | // can be checked in these methods using GetAbort(). | |
4126 | // | |
4127 | // The method is overwritten in AliReconstruction for better handling of | |
4128 | // reco specific errors | |
4129 | ||
4130 | if (!fStopOnError) return; | |
4131 | ||
4132 | CleanUp(); | |
4133 | ||
4134 | TString whyMess = method; | |
4135 | whyMess += " failed! Aborting..."; | |
4136 | ||
4137 | AliError(whyMess.Data()); | |
4138 | ||
4139 | fAbort = what; | |
4140 | TString mess = "Abort"; | |
4141 | if (fAbort == kAbortProcess) | |
4142 | mess = "AbortProcess"; | |
4143 | else if (fAbort == kAbortFile) | |
4144 | mess = "AbortFile"; | |
4145 | ||
6ac1d1f4 | 4146 | Info(mess.Data(), "%s", whyMess.Data()); |
4b71572b | 4147 | } |
4148 | ||
2f954aba | 4149 | //______________________________________________________________________________ |
4150 | Bool_t AliReconstruction::ProcessEvent(void* event) | |
4151 | { | |
4152 | // Method that is used in case the event loop | |
4153 | // is steered from outside, for example by AMORE | |
4154 | // 'event' is a pointer to the DATE event in the memory | |
4155 | ||
4156 | if (fRawReader) delete fRawReader; | |
4157 | fRawReader = new AliRawReaderDate(event); | |
4158 | fStatus = ProcessEvent(fRunLoader->GetNumberOfEvents()); | |
4159 | delete fRawReader; | |
4160 | fRawReader = NULL; | |
4161 | ||
4162 | return fStatus; | |
4163 | } | |
81d57268 | 4164 | |
4165 | //______________________________________________________________________________ | |
4166 | Bool_t AliReconstruction::ParseOutput() | |
4167 | { | |
4168 | // The method parses the output file | |
4169 | // location string in order to steer | |
4170 | // properly the selector | |
4171 | ||
4172 | TPMERegexp re1("(\\w+\\.zip#\\w+\\.root):([,*\\w+\\.root,*]+)@dataset://(\\w++)"); | |
4173 | TPMERegexp re2("(\\w+\\.root)?@?dataset://(\\w++)"); | |
4174 | ||
4175 | if (re1.Match(fESDOutput) == 4) { | |
4176 | // root archive with output files stored and regustered | |
4177 | // in proof dataset | |
4178 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE",re1[1].Data())); | |
4179 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_LOCATION",re1[3].Data())); | |
4180 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_DATASET","")); | |
4181 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_ARCHIVE",re1[2].Data())); | |
4182 | AliInfo(Form("%s files will be stored within %s in dataset %s", | |
4183 | re1[2].Data(), | |
4184 | re1[1].Data(), | |
4185 | re1[3].Data())); | |
4186 | } | |
4187 | else if (re2.Match(fESDOutput) == 3) { | |
4188 | // output file stored and registered | |
4189 | // in proof dataset | |
4190 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE",(re2[1].IsNull()) ? "AliESDs.root" : re2[1].Data())); | |
4191 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_LOCATION",re2[2].Data())); | |
4192 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_DATASET","")); | |
4193 | AliInfo(Form("%s will be stored in dataset %s", | |
4194 | (re2[1].IsNull()) ? "AliESDs.root" : re2[1].Data(), | |
4195 | re2[2].Data())); | |
4196 | } | |
4197 | else { | |
4198 | if (fESDOutput.IsNull()) { | |
4199 | // Output location not given. | |
4200 | // Assuming xrootd has been already started and | |
4201 | // the output file has to be sent back | |
4202 | // to the client machine | |
4203 | TString esdUrl(Form("root://%s/%s/", | |
4204 | TUrl(gSystem->HostName()).GetHostFQDN(), | |
4205 | gSystem->pwd())); | |
4206 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE","AliESDs.root")); | |
4207 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_LOCATION",esdUrl.Data())); | |
4208 | AliInfo(Form("AliESDs.root will be stored in %s", | |
4209 | esdUrl.Data())); | |
4210 | } | |
4211 | else { | |
4212 | // User specified an output location. | |
4213 | // Ones has just to parse it here | |
4214 | TUrl outputUrl(fESDOutput.Data()); | |
4215 | TString outputFile(gSystem->BaseName(outputUrl.GetFile())); | |
4216 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE",outputFile.IsNull() ? "AliESDs.root" : outputFile.Data())); | |
4217 | TString outputLocation(outputUrl.GetUrl()); | |
4218 | outputLocation.ReplaceAll(outputFile.Data(),""); | |
4219 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE_LOCATION",outputLocation.Data())); | |
4220 | AliInfo(Form("%s will be stored in %s", | |
4221 | outputFile.IsNull() ? "AliESDs.root" : outputFile.Data(), | |
4222 | outputLocation.Data())); | |
4223 | } | |
4224 | } | |
4225 | ||
4226 | return kTRUE; | |
4227 | } | |
f00558b6 | 4228 | |
4229 | //______________________________________________________________________________ | |
4230 | Bool_t AliReconstruction::IsHighPt() const { | |
4231 | // Selection of events containing "high" pT tracks | |
4232 | // If at least one track is found within 1.5 and 100 GeV (pT) | |
4233 | // that was reconstructed by both ITS and TPC, the event is accepted | |
4234 | ||
4235 | // Track cuts | |
f00558b6 | 4236 | const Double_t pTmin = 1.5; |
4237 | const Double_t pTmax = 100; | |
4238 | ULong_t mask = 0; | |
4239 | mask |= (AliESDtrack::kITSrefit); | |
4240 | mask |= (AliESDtrack::kTPCrefit); | |
a307e234 | 4241 | const Double_t pTminCosmic = 5.; |
4242 | const Double_t pTmaxCosmic = 100; | |
4243 | ULong_t maskCosmic = 0; | |
d0fc0a32 | 4244 | Int_t cosmicCount=0; |
a307e234 | 4245 | maskCosmic |= (AliESDtrack::kTPCrefit); |
f00558b6 | 4246 | |
4247 | Bool_t isOK = kFALSE; | |
4248 | ||
4249 | if (fesd && fesd->GetEventType()==AliRawEventHeaderBase::kPhysicsEvent) { | |
4250 | // Check if this ia a physics event (code 7) | |
4251 | Int_t ntrk = fesd->GetNumberOfTracks(); | |
4252 | for (Int_t itrk=0; itrk<ntrk; ++itrk) { | |
4253 | ||
4254 | AliESDtrack * trk = fesd->GetTrack(itrk); | |
4255 | if (trk | |
4256 | && trk->Pt() > pTmin | |
4257 | && trk->Pt() < pTmax | |
4258 | && (trk->GetStatus() & mask) == mask ) { | |
4259 | ||
4260 | isOK = kTRUE; | |
4261 | break; | |
4262 | } | |
a307e234 | 4263 | if (trk |
4264 | && trk->GetInnerParam() | |
4265 | && trk->GetInnerParam()->Pt() > pTminCosmic | |
4266 | && trk->GetInnerParam()->Pt() < pTmaxCosmic | |
4267 | && (trk->GetStatus() & maskCosmic) == maskCosmic ) { | |
4268 | ||
d0fc0a32 | 4269 | cosmicCount++; |
a307e234 | 4270 | break; |
4271 | } | |
f00558b6 | 4272 | } |
d0fc0a32 | 4273 | if (cosmicCount>1) isOK=kTRUE; |
f00558b6 | 4274 | } |
4275 | return isOK; | |
4276 | } | |
4277 | ||
4278 | //______________________________________________________________________________ | |
4279 | Bool_t AliReconstruction::IsCosmicOrCalibSpecie() const { | |
4280 | // Select cosmic or calibration events | |
4281 | ||
4282 | Bool_t isOK = kFALSE; | |
4283 | ||
4284 | if (fesd && fesd->GetEventType()==AliRawEventHeaderBase::kPhysicsEvent) { | |
4285 | // Check if this ia a physics event (code 7) | |
4286 | ||
4287 | UInt_t specie = fesd->GetEventSpecie(); | |
4288 | if (specie==AliRecoParam::kCosmic || specie==AliRecoParam::kCalib) { | |
4289 | isOK = kTRUE; | |
4290 | } | |
4291 | } | |
4292 | return isOK; | |
4293 | } | |
4294 | ||
4295 | //______________________________________________________________________________ | |
4296 | void AliReconstruction::WriteESDfriend() { | |
4297 | // Fill the ESD friend in the tree. The required fraction of ESD friends is stored | |
4298 | // in fFractionFriends. We select events where we store the ESD friends according | |
4299 | // to the following algorithm: | |
4300 | // 1. Store all Cosmic or Calibration events within the required fraction | |
4301 | // 2. Sample "high Pt" events within the remaining fraction after step 1. | |
4302 | // 3. Sample randomly events if we still have remaining slot | |
ddfbc51a | 4303 | |
f00558b6 | 4304 | fNall++; |
f00558b6 | 4305 | Bool_t isSelected = kFALSE; |
d0fc0a32 | 4306 | // |
4307 | // Store all friends for B field OFF | |
4308 | if (TMath::Abs(AliTrackerBase::GetBz())<0.5) isSelected=kTRUE; | |
f00558b6 | 4309 | |
4310 | if (IsCosmicOrCalibSpecie()) { // Selection of calib or cosmic events | |
4311 | fNspecie++; | |
0623e625 | 4312 | |
4313 | isSelected = kTRUE; | |
4314 | fSspecie++; | |
f00558b6 | 4315 | } |
4316 | ||
4317 | Double_t remainingFraction = fFractionFriends; | |
4318 | remainingFraction -= ((Double_t)(fSspecie)/(Double_t)(fNall)); | |
4319 | ||
4320 | if (IsHighPt()) { // Selection of "high Pt" events | |
4321 | fNhighPt++; | |
4322 | Double_t curentHighPtFraction = ((Double_t)(fNhighPt+1))/((Double_t)(fNall+1)); | |
4323 | // "Bayesian" estimate supposing that without events all the events are of the required type | |
4324 | ||
4325 | if (!isSelected) { | |
4326 | Double_t rnd = gRandom->Rndm()*curentHighPtFraction; | |
4327 | if (rnd<remainingFraction) { | |
4328 | isSelected = kTRUE; | |
4329 | fShighPt++; | |
4330 | } | |
4331 | } | |
4332 | } | |
4333 | remainingFraction -= ((Double_t)(fShighPt)/(Double_t)(fNall)); | |
4334 | ||
4335 | // Random selection to fill the remaining fraction (if any) | |
4336 | if (!isSelected) { | |
4337 | Double_t rnd = gRandom->Rndm(); | |
4338 | if (rnd<remainingFraction) { | |
4339 | isSelected = kTRUE; | |
4340 | } | |
4341 | } | |
ddfbc51a | 4342 | |
f00558b6 | 4343 | if (!isSelected) { |
ddfbc51a | 4344 | fesdf->~AliESDfriend(); |
4345 | new (fesdf) AliESDfriend(); // Reset... | |
f00558b6 | 4346 | fesdf->SetSkipBit(kTRUE); |
4347 | } | |
e54c9180 | 4348 | // |
f00558b6 | 4349 | ftreeF->Fill(); |
4350 | } | |
e54c9180 | 4351 | |
4352 | //_________________________________________________________________ | |
4353 | void AliReconstruction::DeleteDigits(const TString& detectors) | |
4354 | { | |
4355 | // delete requested digit files produced at current event | |
4356 | static int iEvent = 0; | |
4357 | if (detectors.IsNull()) return; | |
4358 | TString detStr = detectors; | |
4359 | AliInfo(Form("Deleting Digits: %s",detectors.Data())); | |
4360 | ||
4361 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { | |
4362 | gSystem->Exec(Form("if [ -e %s.Digits.root ]; then\nrm %s.Digits.root\nfi", | |
4363 | fgkDetectorName[iDet],fgkDetectorName[iDet])); | |
4364 | } | |
4365 | AliSysInfo::AddStamp(Form("DelDigits_%d",iEvent), 0,0,iEvent); | |
4366 | iEvent++; | |
4367 | } | |
4368 | ||
4369 | //_________________________________________________________________ | |
4370 | void AliReconstruction::DeleteRecPoints(const TString& detectors) | |
4371 | { | |
4372 | // delete requested recpoint files produced at current event | |
4373 | static int iEvent = 0; | |
4374 | if (detectors.IsNull()) return; | |
4375 | TString detStr = detectors; | |
4376 | AliInfo(Form("Deleting Recpoints: %s",detectors.Data())); | |
4377 | // | |
4378 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { | |
4379 | gSystem->Exec(Form("if [ -e %s.RecPoints.root ]; then\nrm %s.RecPoints.root\nfi", | |
4380 | fgkDetectorName[iDet],fgkDetectorName[iDet])); | |
4381 | } | |
4382 | AliSysInfo::AddStamp(Form("DelRecPoints_%d",iEvent), 0,0,iEvent); | |
4383 | iEvent++; | |
4384 | } | |
30b916f7 | 4385 | |
4386 | //_________________________________________________________________ | |
4387 | void AliReconstruction::SetStopOnResourcesExcess(Int_t vRSS,Int_t vVMEM) | |
4388 | { | |
4389 | // require checking the resources left and stopping on excess | |
4390 | // if 0 : no check is done | |
4391 | // if >0 : stop reconstruction if exceeds this value | |
4392 | // if <0 : use as margin to system limits | |
4393 | // | |
4394 | const int kKB2MB = 1024; | |
4395 | const int kInfMem = 9999999; | |
4396 | // | |
4397 | struct rlimit r; | |
4398 | int pgSize = getpagesize(); | |
4399 | // | |
4400 | if (vRSS>0) { | |
4401 | fMaxRSS = vRSS; | |
4402 | AliInfo(Form("Setting max. RSS usage to user value %d MB",fMaxRSS)); | |
4403 | } | |
4404 | else if (vRSS<0) { | |
4405 | getrlimit(RLIMIT_RSS,&r); | |
4406 | fMaxRSS = r.rlim_max==RLIM_INFINITY ? kInfMem : int(r.rlim_max*pgSize/kKB2MB/kKB2MB) + vRSS; | |
4407 | AliInfo(Form("Setting max. RSS usage to system hard limit %d%s MB (%d margin)",fMaxRSS,r.rlim_max==RLIM_INFINITY ? "(inf)":"",-vRSS)); | |
4408 | } | |
4409 | else {AliInfo("No check on RSS memory usage will be applied");} | |
4410 | // | |
4411 | if (vVMEM>0) { | |
4412 | fMaxVMEM = vVMEM; | |
4413 | AliInfo(Form("Setting max. VMEM usage to user value %d MB",fMaxVMEM)); | |
4414 | } | |
4415 | else if (vVMEM<0) { | |
4416 | getrlimit(RLIMIT_AS,&r); | |
4417 | fMaxVMEM = r.rlim_max==RLIM_INFINITY ? kInfMem : int(r.rlim_max*pgSize/kKB2MB/kKB2MB) + vVMEM; | |
4418 | AliInfo(Form("Setting max. VMEM usage to system hard limit %d%s MB (%d margin)",fMaxVMEM,r.rlim_max==RLIM_INFINITY ? "(inf)":"",-vVMEM)); | |
4419 | } | |
4420 | else {AliInfo("No check on RSS memory usage will be applied");} | |
4421 | // | |
4422 | } | |
4423 | ||
4424 | //_________________________________________________________________ | |
4425 | Bool_t AliReconstruction::HasEnoughResources(int ev) | |
4426 | { | |
4427 | // check if process consumed more than allowed resources | |
4428 | const int kKB2MB = 1024; | |
4429 | Bool_t res = kTRUE; | |
4430 | if (!fMaxRSS && !fMaxVMEM) return res; | |
4431 | // | |
4432 | ProcInfo_t procInfo; | |
4433 | gSystem->GetProcInfo(&procInfo); | |
4434 | if (procInfo.fMemResident/kKB2MB > fMaxRSS) res = kFALSE; | |
4435 | if (procInfo.fMemVirtual/kKB2MB > fMaxVMEM) res = kFALSE; | |
4436 | // | |
4437 | if (!res) { | |
4438 | AliInfo(Form("Job exceeded allowed limits: RSS:%d (%d) VMEM:%d (%d), will stop", | |
4439 | int(procInfo.fMemResident/kKB2MB),fMaxRSS, | |
4440 | int(procInfo.fMemVirtual/kKB2MB) ,fMaxVMEM)); | |
4441 | // | |
4442 | gSystem->Exec(Form("if [ -e %s ]; then\nrm %s\nfi\necho %d > %s",fgkStopEvFName,fgkStopEvFName,ev,fgkStopEvFName)); | |
4443 | fStopped = kTRUE; | |
4444 | } | |
4445 | return res; | |
4446 | } |