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