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