]>
Commit | Line | Data |
---|---|---|
596a855f | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
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 | ||
024a7e64 | 111 | #include <TArrayF.h> |
112 | #include <TFile.h> | |
444753c6 | 113 | #include <TList.h> |
024a7e64 | 114 | #include <TSystem.h> |
115 | #include <TROOT.h> | |
116 | #include <TPluginManager.h> | |
3103d196 | 117 | #include <TGeoManager.h> |
2bdb9d38 | 118 | #include <TLorentzVector.h> |
3dd9f9e3 | 119 | #include <TArrayS.h> |
120 | #include <TArrayD.h> | |
3c3709c4 | 121 | #include <TObjArray.h> |
325aa76f | 122 | #include <TMap.h> |
4b71572b | 123 | #include <TChain.h> |
124 | #include <TProof.h> | |
db4aeca1 | 125 | #include <TProofOutputFile.h> |
002c9d1b | 126 | #include <TParameter.h> |
596a855f | 127 | |
128 | #include "AliReconstruction.h" | |
87932dab | 129 | #include "AliCodeTimer.h" |
b8cd5251 | 130 | #include "AliReconstructor.h" |
815c2b38 | 131 | #include "AliLog.h" |
596a855f | 132 | #include "AliRunLoader.h" |
133 | #include "AliRun.h" | |
b649205a | 134 | #include "AliRawReaderFile.h" |
135 | #include "AliRawReaderDate.h" | |
136 | #include "AliRawReaderRoot.h" | |
001397cd | 137 | #include "AliRawEventHeaderBase.h" |
4b71572b | 138 | #include "AliRawEvent.h" |
af885e0f | 139 | #include "AliESDEvent.h" |
faffd83e | 140 | #include "AliESDMuonTrack.h" |
1d99986f | 141 | #include "AliESDfriend.h" |
2257f27e | 142 | #include "AliESDVertex.h" |
faffd83e | 143 | #include "AliESDcascade.h" |
144 | #include "AliESDkink.h" | |
145 | #include "AliESDtrack.h" | |
146 | #include "AliESDCaloCluster.h" | |
e649177a | 147 | #include "AliESDCaloCells.h" |
32e449be | 148 | #include "AliMultiplicity.h" |
c84a5e9e | 149 | #include "AliTracker.h" |
2257f27e | 150 | #include "AliVertexer.h" |
c5e3e5d1 | 151 | #include "AliVertexerTracks.h" |
5e4ff34d | 152 | #include "AliV0vertexer.h" |
153 | #include "AliCascadeVertexer.h" | |
596a855f | 154 | #include "AliHeader.h" |
155 | #include "AliGenEventHeader.h" | |
b26c3770 | 156 | #include "AliPID.h" |
596a855f | 157 | #include "AliESDpid.h" |
ff8bb5ae | 158 | #include "AliESDtrack.h" |
3dd9f9e3 | 159 | #include "AliESDPmdTrack.h" |
f3a97c86 | 160 | |
08e1a23e | 161 | #include "AliESDTagCreator.h" |
f3a97c86 | 162 | |
25be1e5c | 163 | #include "AliGeomManager.h" |
98937d93 | 164 | #include "AliTrackPointArray.h" |
b0314964 | 165 | #include "AliCDBManager.h" |
795e4a22 | 166 | #include "AliCDBStorage.h" |
6bae477a | 167 | #include "AliCDBEntry.h" |
168 | #include "AliAlignObj.h" | |
f3a97c86 | 169 | |
b647652d | 170 | #include "AliCentralTrigger.h" |
b024fd7f | 171 | #include "AliTriggerConfiguration.h" |
172 | #include "AliTriggerClass.h" | |
a0c2cf2d | 173 | #include "AliTriggerCluster.h" |
b647652d | 174 | #include "AliCTPRawStream.h" |
175 | ||
04236e67 | 176 | #include "AliQADataMakerRec.h" |
aa3c69a9 | 177 | #include "AliGlobalQADataMaker.h" |
c65c502a | 178 | #include "AliQA.h" |
179 | #include "AliQADataMakerSteer.h" | |
f29f1726 | 180 | |
7167ae53 | 181 | #include "AliPlaneEff.h" |
182 | ||
0f88822a | 183 | #include "AliSysInfo.h" // memory snapshots |
cd0b062e | 184 | #include "AliRawHLTManager.h" |
0f88822a | 185 | |
325aa76f | 186 | #include "AliMagWrapCheb.h" |
6efecea1 | 187 | |
7e88424f | 188 | #include "AliDetectorRecoParam.h" |
a00021a7 | 189 | #include "AliGRPRecoParam.h" |
7e88424f | 190 | #include "AliRunInfo.h" |
191 | #include "AliEventInfo.h" | |
192 | ||
193 | #include "AliDAQ.h" | |
194 | ||
44e45fac | 195 | #include "AliGRPObject.h" |
196 | ||
596a855f | 197 | ClassImp(AliReconstruction) |
198 | ||
c757bafd | 199 | //_____________________________________________________________________________ |
ac4a7581 | 200 | const char* AliReconstruction::fgkDetectorName[AliReconstruction::kNDetectors] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "ACORDE", "HLT"}; |
c757bafd | 201 | |
596a855f | 202 | //_____________________________________________________________________________ |
4b71572b | 203 | AliReconstruction::AliReconstruction(const char* gAliceFilename) : |
204 | TSelector(), | |
f8b507e0 | 205 | fUniformField(kFALSE), |
4b71572b | 206 | fForcedFieldMap(NULL), |
2257f27e | 207 | fRunVertexFinder(kTRUE), |
a84e2607 | 208 | fRunVertexFinderTracks(kTRUE), |
1f46a9ae | 209 | fRunHLTTracking(kFALSE), |
e66fbafb | 210 | fRunMuonTracking(kFALSE), |
d1683eef | 211 | fRunV0Finder(kTRUE), |
212 | fRunCascadeFinder(kTRUE), | |
1d99986f | 213 | fStopOnError(kFALSE), |
214 | fWriteAlignmentData(kFALSE), | |
215 | fWriteESDfriend(kFALSE), | |
b647652d | 216 | fFillTriggerESD(kTRUE), |
1d99986f | 217 | |
7f68891d | 218 | fCleanESD(kTRUE), |
a023d8d8 | 219 | fV0DCAmax(3.), |
220 | fV0CsPmin(0.), | |
7f68891d | 221 | fDmax(50.), |
222 | fZmax(50.), | |
223 | ||
1d99986f | 224 | fRunLocalReconstruction("ALL"), |
b8cd5251 | 225 | fRunTracking("ALL"), |
e583c30d | 226 | fFillESD("ALL"), |
7d566c20 | 227 | fLoadCDB(""), |
48ce48d1 | 228 | fUseTrackingErrorsForAlignment(""), |
e583c30d | 229 | fGAliceFileName(gAliceFilename), |
4b71572b | 230 | fRawInput(""), |
35042093 | 231 | fEquipIdMap(""), |
b26c3770 | 232 | fFirstEvent(0), |
233 | fLastEvent(-1), | |
9d705769 | 234 | fNumberOfEventsPerFile((UInt_t)-1), |
b8cd5251 | 235 | fOptions(), |
6bae477a | 236 | fLoadAlignFromCDB(kTRUE), |
237 | fLoadAlignData("ALL"), | |
cd0b062e | 238 | fUseHLTData(), |
7e88424f | 239 | fRunInfo(NULL), |
240 | fEventInfo(), | |
e583c30d | 241 | |
242 | fRunLoader(NULL), | |
b649205a | 243 | fRawReader(NULL), |
cd0b062e | 244 | fParentRawReader(NULL), |
b8cd5251 | 245 | |
7e88424f | 246 | fRecoParam(), |
247 | ||
98937d93 | 248 | fVertexer(NULL), |
f2a195c1 | 249 | fDiamondProfileSPD(NULL), |
9178838a | 250 | fDiamondProfile(NULL), |
43c9dae1 | 251 | fDiamondProfileTPC(NULL), |
f2a195c1 | 252 | |
6b6e4472 | 253 | fGRPData(NULL), |
444753c6 | 254 | |
6bae477a | 255 | fAlignObjArray(NULL), |
795e4a22 | 256 | fCDBUri(), |
759c1df1 | 257 | fSpecCDBUri(), |
795e4a22 | 258 | fInitCDBCalled(kFALSE), |
259 | fSetRunNumberFromDataCalled(kFALSE), | |
ce43afbe | 260 | fQADetectors("ALL"), |
30bbd491 | 261 | fQASteer(NULL), |
ce43afbe | 262 | fQATasks("ALL"), |
7e963665 | 263 | fRunQA(kTRUE), |
6b150027 | 264 | fRunGlobalQA(kTRUE), |
e4a998ed | 265 | fSameQACycle(kFALSE), |
7167ae53 | 266 | |
21a3aa09 | 267 | fRunPlaneEff(kFALSE), |
268 | ||
269 | fesd(NULL), | |
270 | fhltesd(NULL), | |
271 | fesdf(NULL), | |
272 | ffile(NULL), | |
273 | ftree(NULL), | |
274 | fhlttree(NULL), | |
21a3aa09 | 275 | ftVertexer(NULL), |
14dd053c | 276 | fIsNewRunLoader(kFALSE), |
4b71572b | 277 | fRunAliEVE(kFALSE), |
278 | fChain(NULL) | |
596a855f | 279 | { |
280 | // create reconstruction object with default parameters | |
002c9d1b | 281 | gGeoManager = NULL; |
b8cd5251 | 282 | |
ac4a7581 | 283 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 284 | fReconstructor[iDet] = NULL; |
285 | fLoader[iDet] = NULL; | |
286 | fTracker[iDet] = NULL; | |
287 | } | |
252f8aa8 | 288 | for (Int_t iDet = 0; iDet < AliQA::kNDET; iDet++) { |
289 | fQACycles[iDet] = 999999 ; | |
290 | fQAWriteExpert[iDet] = kFALSE ; | |
291 | } | |
292 | ||
e47c4c2e | 293 | AliPID pid; |
596a855f | 294 | } |
295 | ||
296 | //_____________________________________________________________________________ | |
297 | AliReconstruction::AliReconstruction(const AliReconstruction& rec) : | |
4b71572b | 298 | TSelector(), |
c84a5e9e | 299 | fUniformField(rec.fUniformField), |
4b71572b | 300 | fForcedFieldMap(NULL), |
2257f27e | 301 | fRunVertexFinder(rec.fRunVertexFinder), |
a84e2607 | 302 | fRunVertexFinderTracks(rec.fRunVertexFinderTracks), |
1f46a9ae | 303 | fRunHLTTracking(rec.fRunHLTTracking), |
e66fbafb | 304 | fRunMuonTracking(rec.fRunMuonTracking), |
d1683eef | 305 | fRunV0Finder(rec.fRunV0Finder), |
306 | fRunCascadeFinder(rec.fRunCascadeFinder), | |
1d99986f | 307 | fStopOnError(rec.fStopOnError), |
308 | fWriteAlignmentData(rec.fWriteAlignmentData), | |
309 | fWriteESDfriend(rec.fWriteESDfriend), | |
b647652d | 310 | fFillTriggerESD(rec.fFillTriggerESD), |
1d99986f | 311 | |
7f68891d | 312 | fCleanESD(rec.fCleanESD), |
a023d8d8 | 313 | fV0DCAmax(rec.fV0DCAmax), |
5e5c1aa9 | 314 | fV0CsPmin(rec.fV0CsPmin), |
7f68891d | 315 | fDmax(rec.fDmax), |
316 | fZmax(rec.fZmax), | |
317 | ||
1d99986f | 318 | fRunLocalReconstruction(rec.fRunLocalReconstruction), |
e583c30d | 319 | fRunTracking(rec.fRunTracking), |
320 | fFillESD(rec.fFillESD), | |
7d566c20 | 321 | fLoadCDB(rec.fLoadCDB), |
48ce48d1 | 322 | fUseTrackingErrorsForAlignment(rec.fUseTrackingErrorsForAlignment), |
e583c30d | 323 | fGAliceFileName(rec.fGAliceFileName), |
4b71572b | 324 | fRawInput(rec.fRawInput), |
35042093 | 325 | fEquipIdMap(rec.fEquipIdMap), |
b26c3770 | 326 | fFirstEvent(rec.fFirstEvent), |
327 | fLastEvent(rec.fLastEvent), | |
973388c2 | 328 | fNumberOfEventsPerFile(rec.fNumberOfEventsPerFile), |
b8cd5251 | 329 | fOptions(), |
6bae477a | 330 | fLoadAlignFromCDB(rec.fLoadAlignFromCDB), |
331 | fLoadAlignData(rec.fLoadAlignData), | |
2972d4eb | 332 | fUseHLTData(rec.fUseHLTData), |
7e88424f | 333 | fRunInfo(NULL), |
334 | fEventInfo(), | |
e583c30d | 335 | |
336 | fRunLoader(NULL), | |
b649205a | 337 | fRawReader(NULL), |
2972d4eb | 338 | fParentRawReader(NULL), |
b8cd5251 | 339 | |
4b71572b | 340 | fRecoParam(rec.fRecoParam), |
7e88424f | 341 | |
98937d93 | 342 | fVertexer(NULL), |
f2a195c1 | 343 | fDiamondProfileSPD(rec.fDiamondProfileSPD), |
4b71572b | 344 | fDiamondProfile(rec.fDiamondProfile), |
345 | fDiamondProfileTPC(rec.fDiamondProfileTPC), | |
f2a195c1 | 346 | |
6b6e4472 | 347 | fGRPData(NULL), |
444753c6 | 348 | |
6bae477a | 349 | fAlignObjArray(rec.fAlignObjArray), |
ec92bee0 | 350 | fCDBUri(rec.fCDBUri), |
7e963665 | 351 | fSpecCDBUri(), |
795e4a22 | 352 | fInitCDBCalled(rec.fInitCDBCalled), |
353 | fSetRunNumberFromDataCalled(rec.fSetRunNumberFromDataCalled), | |
ce43afbe | 354 | fQADetectors(rec.fQADetectors), |
4b71572b | 355 | fQASteer(NULL), |
ce43afbe | 356 | fQATasks(rec.fQATasks), |
aa3c69a9 | 357 | fRunQA(rec.fRunQA), |
358 | fRunGlobalQA(rec.fRunGlobalQA), | |
e4a998ed | 359 | fSameQACycle(rec.fSameQACycle), |
21a3aa09 | 360 | fRunPlaneEff(rec.fRunPlaneEff), |
361 | ||
362 | fesd(NULL), | |
363 | fhltesd(NULL), | |
364 | fesdf(NULL), | |
365 | ffile(NULL), | |
366 | ftree(NULL), | |
367 | fhlttree(NULL), | |
21a3aa09 | 368 | ftVertexer(NULL), |
14dd053c | 369 | fIsNewRunLoader(rec.fIsNewRunLoader), |
4b71572b | 370 | fRunAliEVE(kFALSE), |
371 | fChain(NULL) | |
596a855f | 372 | { |
373 | // copy constructor | |
374 | ||
ec92bee0 | 375 | for (Int_t i = 0; i < rec.fOptions.GetEntriesFast(); i++) { |
efd2085e | 376 | if (rec.fOptions[i]) fOptions.Add(rec.fOptions[i]->Clone()); |
377 | } | |
ac4a7581 | 378 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 379 | fReconstructor[iDet] = NULL; |
380 | fLoader[iDet] = NULL; | |
381 | fTracker[iDet] = NULL; | |
b1af1125 | 382 | } |
383 | ||
252f8aa8 | 384 | for (Int_t iDet = 0; iDet < AliQA::kNDET; iDet++) { |
b1af1125 | 385 | fQACycles[iDet] = rec.fQACycles[iDet]; |
252f8aa8 | 386 | fQAWriteExpert[iDet] = rec.fQAWriteExpert[iDet] ; |
387 | } | |
b1af1125 | 388 | |
ec92bee0 | 389 | for (Int_t i = 0; i < rec.fSpecCDBUri.GetEntriesFast(); i++) { |
390 | if (rec.fSpecCDBUri[i]) fSpecCDBUri.Add(rec.fSpecCDBUri[i]->Clone()); | |
391 | } | |
596a855f | 392 | } |
393 | ||
394 | //_____________________________________________________________________________ | |
395 | AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) | |
396 | { | |
397 | // assignment operator | |
4b71572b | 398 | // Used in PROOF mode |
399 | // Be very careful while modifing it! | |
400 | // Simple rules to follow: | |
401 | // for persistent data members - use their assignment operators | |
402 | // for non-persistent ones - do nothing or take the default values from constructor | |
403 | // TSelector members should not be touched | |
404 | if(&rec == this) return *this; | |
405 | ||
406 | fUniformField = rec.fUniformField; | |
407 | fForcedFieldMap = NULL; | |
408 | fRunVertexFinder = rec.fRunVertexFinder; | |
409 | fRunVertexFinderTracks = rec.fRunVertexFinderTracks; | |
410 | fRunHLTTracking = rec.fRunHLTTracking; | |
411 | fRunMuonTracking = rec.fRunMuonTracking; | |
412 | fRunV0Finder = rec.fRunV0Finder; | |
413 | fRunCascadeFinder = rec.fRunCascadeFinder; | |
414 | fStopOnError = rec.fStopOnError; | |
415 | fWriteAlignmentData = rec.fWriteAlignmentData; | |
416 | fWriteESDfriend = rec.fWriteESDfriend; | |
417 | fFillTriggerESD = rec.fFillTriggerESD; | |
418 | ||
419 | fCleanESD = rec.fCleanESD; | |
420 | fV0DCAmax = rec.fV0DCAmax; | |
421 | fV0CsPmin = rec.fV0CsPmin; | |
422 | fDmax = rec.fDmax; | |
423 | fZmax = rec.fZmax; | |
424 | ||
425 | fRunLocalReconstruction = rec.fRunLocalReconstruction; | |
426 | fRunTracking = rec.fRunTracking; | |
427 | fFillESD = rec.fFillESD; | |
7d566c20 | 428 | fLoadCDB = rec.fLoadCDB; |
4b71572b | 429 | fUseTrackingErrorsForAlignment = rec.fUseTrackingErrorsForAlignment; |
430 | fGAliceFileName = rec.fGAliceFileName; | |
431 | fRawInput = rec.fRawInput; | |
432 | fEquipIdMap = rec.fEquipIdMap; | |
433 | fFirstEvent = rec.fFirstEvent; | |
434 | fLastEvent = rec.fLastEvent; | |
435 | fNumberOfEventsPerFile = rec.fNumberOfEventsPerFile; | |
436 | ||
437 | for (Int_t i = 0; i < rec.fOptions.GetEntriesFast(); i++) { | |
438 | if (rec.fOptions[i]) fOptions.Add(rec.fOptions[i]->Clone()); | |
439 | } | |
440 | ||
441 | fLoadAlignFromCDB = rec.fLoadAlignFromCDB; | |
442 | fLoadAlignData = rec.fLoadAlignData; | |
4b71572b | 443 | fUseHLTData = rec.fUseHLTData; |
444 | ||
445 | delete fRunInfo; fRunInfo = NULL; | |
446 | if (rec.fRunInfo) fRunInfo = new AliRunInfo(*rec.fRunInfo); | |
447 | ||
448 | fEventInfo = rec.fEventInfo; | |
449 | ||
450 | fRunLoader = NULL; | |
451 | fRawReader = NULL; | |
452 | fParentRawReader = NULL; | |
453 | ||
454 | fRecoParam = rec.fRecoParam; | |
455 | ||
ac4a7581 | 456 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
4b71572b | 457 | delete fReconstructor[iDet]; fReconstructor[iDet] = NULL; |
458 | delete fLoader[iDet]; fLoader[iDet] = NULL; | |
459 | delete fTracker[iDet]; fTracker[iDet] = NULL; | |
4b71572b | 460 | } |
b1af1125 | 461 | |
252f8aa8 | 462 | for (Int_t iDet = 0; iDet < AliQA::kNDET; iDet++) { |
b1af1125 | 463 | fQACycles[iDet] = rec.fQACycles[iDet]; |
252f8aa8 | 464 | fQAWriteExpert[iDet] = rec.fQAWriteExpert[iDet] ; |
465 | } | |
466 | ||
4b71572b | 467 | fVertexer = NULL; |
f2a195c1 | 468 | delete fDiamondProfileSPD; fDiamondProfileSPD = NULL; |
469 | if (rec.fDiamondProfileSPD) fDiamondProfileSPD = new AliESDVertex(*rec.fDiamondProfileSPD); | |
4b71572b | 470 | delete fDiamondProfile; fDiamondProfile = NULL; |
471 | if (rec.fDiamondProfile) fDiamondProfile = new AliESDVertex(*rec.fDiamondProfile); | |
472 | delete fDiamondProfileTPC; fDiamondProfileTPC = NULL; | |
473 | if (rec.fDiamondProfileTPC) fDiamondProfileTPC = new AliESDVertex(*rec.fDiamondProfileTPC); | |
4b71572b | 474 | |
475 | delete fGRPData; fGRPData = NULL; | |
44e45fac | 476 | // if (rec.fGRPData) fGRPData = (TMap*)((rec.fGRPData)->Clone()); |
477 | if (rec.fGRPData) fGRPData = (AliGRPObject*)((rec.fGRPData)->Clone()); | |
4b71572b | 478 | |
479 | delete fAlignObjArray; fAlignObjArray = NULL; | |
480 | ||
481 | fCDBUri = ""; | |
482 | fSpecCDBUri.Delete(); | |
483 | fInitCDBCalled = rec.fInitCDBCalled; | |
484 | fSetRunNumberFromDataCalled = rec.fSetRunNumberFromDataCalled; | |
485 | fQADetectors = rec.fQADetectors; | |
486 | fQASteer = NULL; | |
487 | fQATasks = rec.fQATasks; | |
488 | fRunQA = rec.fRunQA; | |
489 | fRunGlobalQA = rec.fRunGlobalQA; | |
4b71572b | 490 | fSameQACycle = rec.fSameQACycle; |
491 | fRunPlaneEff = rec.fRunPlaneEff; | |
492 | ||
493 | fesd = NULL; | |
494 | fhltesd = NULL; | |
495 | fesdf = NULL; | |
496 | ffile = NULL; | |
497 | ftree = NULL; | |
498 | fhlttree = NULL; | |
499 | ftVertexer = NULL; | |
500 | fIsNewRunLoader = rec.fIsNewRunLoader; | |
501 | fRunAliEVE = kFALSE; | |
502 | fChain = NULL; | |
596a855f | 503 | |
596a855f | 504 | return *this; |
505 | } | |
506 | ||
507 | //_____________________________________________________________________________ | |
508 | AliReconstruction::~AliReconstruction() | |
509 | { | |
510 | // clean up | |
511 | ||
e583c30d | 512 | CleanUp(); |
4f3c479a | 513 | delete fGRPData; |
4b71572b | 514 | delete fForcedFieldMap; |
efd2085e | 515 | fOptions.Delete(); |
4b71572b | 516 | if (fAlignObjArray) { |
517 | fAlignObjArray->Delete(); | |
518 | delete fAlignObjArray; | |
519 | } | |
ec92bee0 | 520 | fSpecCDBUri.Delete(); |
4b71572b | 521 | delete fQASteer; |
87932dab | 522 | AliCodeTimer::Instance()->Print(); |
596a855f | 523 | } |
524 | ||
024cf675 | 525 | //_____________________________________________________________________________ |
795e4a22 | 526 | void AliReconstruction::InitCDB() |
024cf675 | 527 | { |
528 | // activate a default CDB storage | |
529 | // First check if we have any CDB storage set, because it is used | |
530 | // to retrieve the calibration and alignment constants | |
002c9d1b | 531 | AliCodeTimerAuto(""); |
024cf675 | 532 | |
795e4a22 | 533 | if (fInitCDBCalled) return; |
534 | fInitCDBCalled = kTRUE; | |
535 | ||
024cf675 | 536 | AliCDBManager* man = AliCDBManager::Instance(); |
ec92bee0 | 537 | if (man->IsDefaultStorageSet()) |
024cf675 | 538 | { |
539 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
ec92bee0 | 540 | AliWarning("Default CDB storage has been already set !"); |
541 | AliWarning(Form("Ignoring the default storage declared in AliReconstruction: %s",fCDBUri.Data())); | |
024cf675 | 542 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
795e4a22 | 543 | fCDBUri = man->GetDefaultStorage()->GetURI(); |
ec92bee0 | 544 | } |
545 | else { | |
795e4a22 | 546 | if (fCDBUri.Length() > 0) |
547 | { | |
548 | AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
549 | AliDebug(2, Form("Default CDB storage is set to: %s", fCDBUri.Data())); | |
550 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
551 | } else { | |
552 | fCDBUri="local://$ALICE_ROOT"; | |
553 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
554 | AliWarning("Default CDB storage not yet set !!!!"); | |
555 | AliWarning(Form("Setting it now to: %s", fCDBUri.Data())); | |
556 | AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
557 | ||
558 | } | |
ec92bee0 | 559 | man->SetDefaultStorage(fCDBUri); |
560 | } | |
561 | ||
562 | // Now activate the detector specific CDB storage locations | |
c3a7b59a | 563 | for (Int_t i = 0; i < fSpecCDBUri.GetEntriesFast(); i++) { |
564 | TObject* obj = fSpecCDBUri[i]; | |
565 | if (!obj) continue; | |
b8ec52f6 | 566 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
567 | AliDebug(2, Form("Specific CDB storage for %s is set to: %s",obj->GetName(),obj->GetTitle())); | |
568 | AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); | |
c3a7b59a | 569 | man->SetSpecificStorage(obj->GetName(), obj->GetTitle()); |
ec92bee0 | 570 | } |
002c9d1b | 571 | AliSysInfo::AddStamp("InitCDB"); |
024cf675 | 572 | } |
573 | ||
574 | //_____________________________________________________________________________ | |
575 | void AliReconstruction::SetDefaultStorage(const char* uri) { | |
ec92bee0 | 576 | // Store the desired default CDB storage location |
577 | // Activate it later within the Run() method | |
024cf675 | 578 | |
ec92bee0 | 579 | fCDBUri = uri; |
024cf675 | 580 | |
581 | } | |
582 | ||
00aa02d5 | 583 | //_____________________________________________________________________________ |
c3a7b59a | 584 | void AliReconstruction::SetSpecificStorage(const char* calibType, const char* uri) { |
ec92bee0 | 585 | // Store a detector-specific CDB storage location |
586 | // Activate it later within the Run() method | |
024cf675 | 587 | |
c3a7b59a | 588 | AliCDBPath aPath(calibType); |
589 | if(!aPath.IsValid()){ | |
590 | // if calibType is not wildcard but it is a valid detector, add "/*" to make it a valid path | |
ac4a7581 | 591 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
c3a7b59a | 592 | if(!strcmp(calibType, fgkDetectorName[iDet])) { |
593 | aPath.SetPath(Form("%s/*", calibType)); | |
594 | AliInfo(Form("Path for specific storage set to %s", aPath.GetPath().Data())); | |
595 | break; | |
596 | } | |
597 | } | |
598 | if(!aPath.IsValid()){ | |
599 | AliError(Form("Not a valid path or detector: %s", calibType)); | |
600 | return; | |
601 | } | |
602 | } | |
603 | ||
53dd3c3d | 604 | // // check that calibType refers to a "valid" detector name |
605 | // Bool_t isDetector = kFALSE; | |
ac4a7581 | 606 | // for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
53dd3c3d | 607 | // TString detName = fgkDetectorName[iDet]; |
608 | // if(aPath.GetLevel0() == detName) { | |
609 | // isDetector = kTRUE; | |
610 | // break; | |
611 | // } | |
612 | // } | |
613 | // | |
614 | // if(!isDetector) { | |
615 | // AliError(Form("Not a valid detector: %s", aPath.GetLevel0().Data())); | |
616 | // return; | |
617 | // } | |
c3a7b59a | 618 | |
619 | TObject* obj = fSpecCDBUri.FindObject(aPath.GetPath().Data()); | |
ec92bee0 | 620 | if (obj) fSpecCDBUri.Remove(obj); |
c3a7b59a | 621 | fSpecCDBUri.Add(new TNamed(aPath.GetPath().Data(), uri)); |
024cf675 | 622 | |
623 | } | |
624 | ||
6bae477a | 625 | //_____________________________________________________________________________ |
795e4a22 | 626 | Bool_t AliReconstruction::SetRunNumberFromData() |
6bae477a | 627 | { |
628 | // The method is called in Run() in order | |
629 | // to set a correct run number. | |
630 | // In case of raw data reconstruction the | |
631 | // run number is taken from the raw data header | |
632 | ||
795e4a22 | 633 | if (fSetRunNumberFromDataCalled) return kTRUE; |
634 | fSetRunNumberFromDataCalled = kTRUE; | |
635 | ||
636 | AliCDBManager* man = AliCDBManager::Instance(); | |
4b71572b | 637 | |
638 | if(fRawReader) { | |
639 | if(fRawReader->NextEvent()) { | |
640 | if(man->GetRun() > 0) { | |
21a3aa09 | 641 | AliWarning("Run number is taken from raw-event header! Ignoring settings in AliCDBManager!"); |
4b71572b | 642 | } |
643 | man->SetRun(fRawReader->GetRunNumber()); | |
644 | fRawReader->RewindEvents(); | |
645 | } | |
646 | else { | |
647 | if(man->GetRun() > 0) { | |
648 | AliWarning("No raw-data events are found ! Using settings in AliCDBManager !"); | |
649 | } | |
650 | else { | |
651 | AliWarning("Neither raw events nor settings in AliCDBManager are found !"); | |
652 | return kFALSE; | |
653 | } | |
654 | } | |
655 | } | |
656 | else { | |
657 | AliRunLoader *rl = AliRunLoader::Open(fGAliceFileName.Data()); | |
658 | if (!rl) { | |
659 | AliError(Form("No run loader found in file %s", fGAliceFileName.Data())); | |
6bae477a | 660 | return kFALSE; |
661 | } | |
ec92bee0 | 662 | else { |
4b71572b | 663 | rl->LoadHeader(); |
664 | // read run number from gAlice | |
665 | if(rl->GetHeader()) { | |
666 | man->SetRun(rl->GetHeader()->GetRun()); | |
667 | rl->UnloadHeader(); | |
668 | delete rl; | |
ec92bee0 | 669 | } |
670 | else { | |
4b71572b | 671 | AliError("Neither run-loader header nor RawReader objects are found !"); |
672 | delete rl; | |
ec92bee0 | 673 | return kFALSE; |
674 | } | |
4b71572b | 675 | } |
6bae477a | 676 | } |
795e4a22 | 677 | |
678 | man->Print(); | |
679 | ||
6bae477a | 680 | return kTRUE; |
681 | } | |
682 | ||
795e4a22 | 683 | //_____________________________________________________________________________ |
684 | void AliReconstruction::SetCDBLock() { | |
685 | // Set CDB lock: from now on it is forbidden to reset the run number | |
686 | // or the default storage or to activate any further storage! | |
687 | ||
688 | AliCDBManager::Instance()->SetLock(1); | |
689 | } | |
690 | ||
6bae477a | 691 | //_____________________________________________________________________________ |
692 | Bool_t AliReconstruction::MisalignGeometry(const TString& detectors) | |
693 | { | |
694 | // Read the alignment objects from CDB. | |
695 | // Each detector is supposed to have the | |
696 | // alignment objects in DET/Align/Data CDB path. | |
697 | // All the detector objects are then collected, | |
698 | // sorted by geometry level (starting from ALIC) and | |
699 | // then applied to the TGeo geometry. | |
700 | // Finally an overlaps check is performed. | |
701 | ||
702 | // Load alignment data from CDB and fill fAlignObjArray | |
703 | if(fLoadAlignFromCDB){ | |
6bae477a | 704 | |
25be1e5c | 705 | TString detStr = detectors; |
706 | TString loadAlObjsListOfDets = ""; | |
707 | ||
ac4a7581 | 708 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
8cb26cdf | 709 | if(!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
f12d42ce | 710 | if(!strcmp(fgkDetectorName[iDet],"HLT")) continue; |
4fbb8e9d | 711 | |
712 | if(AliGeomManager::GetNalignable(fgkDetectorName[iDet]) != 0) | |
8cb26cdf | 713 | { |
714 | loadAlObjsListOfDets += fgkDetectorName[iDet]; | |
715 | loadAlObjsListOfDets += " "; | |
716 | } | |
25be1e5c | 717 | } // end loop over detectors |
4fbb8e9d | 718 | |
719 | if(AliGeomManager::GetNalignable("GRP") != 0) | |
8cb26cdf | 720 | loadAlObjsListOfDets.Prepend("GRP "); //add alignment objects for non-sensitive modules |
98e303d9 | 721 | AliGeomManager::ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data()); |
e30a9b4d | 722 | AliCDBManager::Instance()->UnloadFromCache("*/Align/*"); |
25be1e5c | 723 | }else{ |
724 | // Check if the array with alignment objects was | |
725 | // provided by the user. If yes, apply the objects | |
726 | // to the present TGeo geometry | |
727 | if (fAlignObjArray) { | |
728 | if (gGeoManager && gGeoManager->IsClosed()) { | |
98e303d9 | 729 | if (AliGeomManager::ApplyAlignObjsToGeom(*fAlignObjArray) == kFALSE) { |
25be1e5c | 730 | AliError("The misalignment of one or more volumes failed!" |
731 | "Compare the list of simulated detectors and the list of detector alignment data!"); | |
732 | return kFALSE; | |
733 | } | |
734 | } | |
735 | else { | |
736 | AliError("Can't apply the misalignment! gGeoManager doesn't exist or it is still opened!"); | |
6bae477a | 737 | return kFALSE; |
738 | } | |
739 | } | |
6bae477a | 740 | } |
25be1e5c | 741 | |
4b71572b | 742 | if (fAlignObjArray) { |
743 | fAlignObjArray->Delete(); | |
744 | delete fAlignObjArray; fAlignObjArray=NULL; | |
745 | } | |
a03b0371 | 746 | |
6bae477a | 747 | return kTRUE; |
748 | } | |
596a855f | 749 | |
750 | //_____________________________________________________________________________ | |
751 | void AliReconstruction::SetGAliceFile(const char* fileName) | |
752 | { | |
753 | // set the name of the galice file | |
754 | ||
755 | fGAliceFileName = fileName; | |
756 | } | |
757 | ||
21a3aa09 | 758 | //_____________________________________________________________________________ |
b58710ef | 759 | void AliReconstruction::SetInput(const char* input) |
21a3aa09 | 760 | { |
b58710ef | 761 | // In case the input string starts with 'mem://', we run in an online mode |
762 | // and AliRawReaderDateOnline object is created. In all other cases a raw-data | |
763 | // file is assumed. One can give as an input: | |
764 | // mem://: - events taken from DAQ monitoring libs online | |
765 | // or | |
766 | // mem://<filename> - emulation of the above mode (via DATE monitoring libs) | |
4b71572b | 767 | if (input) fRawInput = input; |
21a3aa09 | 768 | } |
769 | ||
efd2085e | 770 | //_____________________________________________________________________________ |
771 | void AliReconstruction::SetOption(const char* detector, const char* option) | |
772 | { | |
773 | // set options for the reconstruction of a detector | |
774 | ||
775 | TObject* obj = fOptions.FindObject(detector); | |
776 | if (obj) fOptions.Remove(obj); | |
777 | fOptions.Add(new TNamed(detector, option)); | |
778 | } | |
779 | ||
7e88424f | 780 | //_____________________________________________________________________________ |
781 | void AliReconstruction::SetRecoParam(const char* detector, AliDetectorRecoParam *par) | |
782 | { | |
783 | // Set custom reconstruction parameters for a given detector | |
784 | // Single set of parameters for all the events | |
a00021a7 | 785 | |
786 | // First check if the reco-params are global | |
787 | if(!strcmp(detector, "GRP")) { | |
788 | par->SetAsDefault(); | |
ac4a7581 | 789 | fRecoParam.AddDetRecoParam(kNDetectors,par); |
a00021a7 | 790 | return; |
791 | } | |
792 | ||
ac4a7581 | 793 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
7e88424f | 794 | if(!strcmp(detector, fgkDetectorName[iDet])) { |
795 | par->SetAsDefault(); | |
796 | fRecoParam.AddDetRecoParam(iDet,par); | |
797 | break; | |
798 | } | |
799 | } | |
800 | ||
801 | } | |
802 | ||
61807e09 | 803 | //_____________________________________________________________________________ |
856024f0 | 804 | Bool_t AliReconstruction::SetFieldMap(Float_t l3Current, Float_t diCurrent, Float_t factor, const char *path) { |
61807e09 | 805 | //------------------------------------------------ |
806 | // The magnetic field map, defined externally... | |
807 | // L3 current 30000 A -> 0.5 T | |
808 | // L3 current 12000 A -> 0.2 T | |
809 | // dipole current 6000 A | |
810 | // The polarities must be the same | |
811 | //------------------------------------------------ | |
812 | const Float_t l3NominalCurrent1=30000.; // (A) | |
813 | const Float_t l3NominalCurrent2=12000.; // (A) | |
814 | const Float_t diNominalCurrent =6000. ; // (A) | |
815 | ||
816 | const Float_t tolerance=0.03; // relative current tolerance | |
817 | const Float_t zero=77.; // "zero" current (A) | |
818 | ||
819 | Int_t map=0; | |
820 | Bool_t dipoleON=kFALSE; | |
821 | ||
856024f0 | 822 | TString s=(factor < 0) ? "L3: -" : "L3: +"; |
61807e09 | 823 | |
bb91052d | 824 | l3Current = TMath::Abs(l3Current); |
61807e09 | 825 | if (TMath::Abs(l3Current-l3NominalCurrent1)/l3NominalCurrent1 < tolerance) { |
826 | map=AliMagWrapCheb::k5kG; | |
827 | s+="0.5 T; "; | |
828 | } else | |
829 | if (TMath::Abs(l3Current-l3NominalCurrent2)/l3NominalCurrent2 < tolerance) { | |
830 | map=AliMagWrapCheb::k2kG; | |
831 | s+="0.2 T; "; | |
832 | } else | |
bb91052d | 833 | if (l3Current < zero) { |
61807e09 | 834 | map=AliMagWrapCheb::k2kG; |
835 | s+="0.0 T; "; | |
836 | factor=0.; // in fact, this is a global factor... | |
4d338614 | 837 | fUniformField=kTRUE; // track with the uniform (zero) B field |
61807e09 | 838 | } else { |
bb91052d | 839 | AliError(Form("Wrong L3 current (%f A)!",l3Current)); |
61807e09 | 840 | return kFALSE; |
841 | } | |
842 | ||
bb91052d | 843 | diCurrent = TMath::Abs(diCurrent); |
61807e09 | 844 | if (TMath::Abs(diCurrent-diNominalCurrent)/diNominalCurrent < tolerance) { |
845 | // 3% current tolerance... | |
846 | dipoleON=kTRUE; | |
847 | s+="Dipole ON"; | |
848 | } else | |
bb91052d | 849 | if (diCurrent < zero) { // some small current.. |
61807e09 | 850 | dipoleON=kFALSE; |
851 | s+="Dipole OFF"; | |
852 | } else { | |
bb91052d | 853 | AliError(Form("Wrong dipole current (%f A)!",diCurrent)); |
61807e09 | 854 | return kFALSE; |
855 | } | |
856 | ||
857 | delete fForcedFieldMap; | |
858 | fForcedFieldMap= | |
859 | new AliMagWrapCheb("B field map ",s,2,factor,10.,map,dipoleON,path); | |
860 | ||
861 | fForcedFieldMap->Print(); | |
862 | ||
863 | AliTracker::SetFieldMap(fForcedFieldMap,fUniformField); | |
864 | ||
865 | return kTRUE; | |
866 | } | |
867 | ||
868 | ||
869 | Bool_t AliReconstruction::InitGRP() { | |
870 | //------------------------------------ | |
871 | // Initialization of the GRP entry | |
872 | //------------------------------------ | |
873 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); | |
874 | ||
4b71572b | 875 | if (entry) { |
44e45fac | 876 | |
877 | TMap* m = dynamic_cast<TMap*>(entry->GetObject()); // old GRP entry | |
878 | ||
879 | if (m) { | |
880 | AliInfo("Found a TMap in GRP/GRP/Data, converting it into an AliGRPObject"); | |
881 | m->Print(); | |
882 | fGRPData = new AliGRPObject(); | |
883 | fGRPData->ReadValuesFromMap(m); | |
884 | } | |
885 | ||
886 | else { | |
887 | AliInfo("Found an AliGRPObject in GRP/GRP/Data, reading it"); | |
888 | fGRPData = dynamic_cast<AliGRPObject*>(entry->GetObject()); // new GRP entry | |
889 | entry->SetOwner(0); | |
890 | } | |
891 | ||
4b71572b | 892 | AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data"); |
893 | } | |
61807e09 | 894 | |
895 | if (!fGRPData) { | |
896 | AliError("No GRP entry found in OCDB!"); | |
897 | return kFALSE; | |
898 | } | |
899 | ||
44e45fac | 900 | TString lhcState = fGRPData->GetLHCState(); |
901 | if (lhcState==AliGRPObject::GetInvalidString()) { | |
7e88424f | 902 | AliError("GRP/GRP/Data entry: missing value for the LHC state ! Using UNKNOWN"); |
44e45fac | 903 | lhcState = "UNKNOWN"; |
7e88424f | 904 | } |
905 | ||
44e45fac | 906 | TString beamType = fGRPData->GetBeamType(); |
907 | if (beamType==AliGRPObject::GetInvalidString()) { | |
7e88424f | 908 | AliError("GRP/GRP/Data entry: missing value for the beam type ! Using UNKNOWN"); |
44e45fac | 909 | beamType = "UNKNOWN"; |
7e88424f | 910 | } |
911 | ||
44e45fac | 912 | Float_t beamEnergy = fGRPData->GetBeamEnergy(); |
913 | if (beamEnergy==AliGRPObject::GetInvalidFloat()) { | |
7e88424f | 914 | AliError("GRP/GRP/Data entry: missing value for the beam energy ! Using 0"); |
44e45fac | 915 | beamEnergy = 0; |
7e88424f | 916 | } |
917 | ||
44e45fac | 918 | TString runType = fGRPData->GetRunType(); |
919 | if (runType==AliGRPObject::GetInvalidString()) { | |
7e88424f | 920 | AliError("GRP/GRP/Data entry: missing value for the run type ! Using UNKNOWN"); |
44e45fac | 921 | runType = "UNKNOWN"; |
7e88424f | 922 | } |
923 | ||
44e45fac | 924 | Int_t activeDetectors = fGRPData->GetDetectorMask(); |
a5dede5c | 925 | if (activeDetectors==AliGRPObject::GetInvalidUInt()) { |
7e88424f | 926 | AliError("GRP/GRP/Data entry: missing value for the detector mask ! Using 1074790399"); |
44e45fac | 927 | activeDetectors = 1074790399; |
7e88424f | 928 | } |
929 | ||
44e45fac | 930 | fRunInfo = new AliRunInfo(lhcState, beamType, beamEnergy, runType, activeDetectors); |
931 | ||
932 | fRunInfo->Dump(); | |
933 | ||
7e88424f | 934 | |
935 | // Process the list of active detectors | |
44e45fac | 936 | if (activeDetectors) { |
937 | UInt_t detMask = activeDetectors; | |
7a317bef | 938 | fRunLocalReconstruction = MatchDetectorList(fRunLocalReconstruction,detMask); |
939 | fRunTracking = MatchDetectorList(fRunTracking,detMask); | |
940 | fFillESD = MatchDetectorList(fFillESD,detMask); | |
941 | fQADetectors = MatchDetectorList(fQADetectors,detMask); | |
7d566c20 | 942 | fLoadCDB.Form("%s %s %s %s", |
943 | fRunLocalReconstruction.Data(), | |
944 | fRunTracking.Data(), | |
945 | fFillESD.Data(), | |
946 | fQADetectors.Data()); | |
7d566c20 | 947 | fLoadCDB = MatchDetectorList(fLoadCDB,detMask); |
91e2f025 | 948 | if (!((detMask >> AliDAQ::DetectorID("ITSSPD")) & 0x1)) { |
949 | // switch off the vertexer | |
950 | AliInfo("SPD is not in the list of active detectors. Vertexer switched off."); | |
951 | fRunVertexFinder = kFALSE; | |
952 | } | |
304d7f0b | 953 | if (!((detMask >> AliDAQ::DetectorID("TRG")) & 0x1)) { |
954 | // switch off the reading of CTP raw-data payload | |
955 | if (fFillTriggerESD) { | |
956 | AliInfo("CTP is not in the list of active detectors. CTP data reading switched off."); | |
957 | fFillTriggerESD = kFALSE; | |
958 | } | |
959 | } | |
7e88424f | 960 | } |
961 | ||
962 | AliInfo("==================================================================================="); | |
963 | AliInfo(Form("Running local reconstruction for detectors: %s",fRunLocalReconstruction.Data())); | |
964 | AliInfo(Form("Running tracking for detectors: %s",fRunTracking.Data())); | |
965 | AliInfo(Form("Filling ESD for detectors: %s",fFillESD.Data())); | |
ca13fb87 | 966 | AliInfo(Form("Quality assurance is active for detectors: %s",fQADetectors.Data())); |
7d566c20 | 967 | AliInfo(Form("CDB and reconstruction parameters are loaded for detectors: %s",fLoadCDB.Data())); |
7e88424f | 968 | AliInfo("==================================================================================="); |
61807e09 | 969 | |
970 | //*** Dealing with the magnetic field map | |
971 | if (AliTracker::GetFieldMap()) { | |
972 | AliInfo("Running with the externally set B field !"); | |
973 | } else { | |
974 | // Construct the field map out of the information retrieved from GRP. | |
975 | ||
856024f0 | 976 | Bool_t ok = kTRUE; |
977 | ||
61807e09 | 978 | // L3 |
44e45fac | 979 | Float_t l3Current = fGRPData->GetL3Current((AliGRPObject::Stats)0); |
980 | if (l3Current == AliGRPObject::GetInvalidFloat()) { | |
981 | AliError("GRP/GRP/Data entry: missing value for the L3 current !"); | |
982 | ok = kFALSE; | |
983 | } | |
984 | ||
985 | Char_t l3Polarity = fGRPData->GetL3Polarity(); | |
986 | if (l3Polarity == AliGRPObject::GetInvalidChar()) { | |
987 | AliError("GRP/GRP/Data entry: missing value for the L3 polarity !"); | |
988 | ok = kFALSE; | |
989 | } | |
990 | ||
991 | // Dipole | |
992 | Float_t diCurrent = fGRPData->GetDipoleCurrent((AliGRPObject::Stats)0); | |
993 | if (diCurrent == AliGRPObject::GetInvalidFloat()) { | |
994 | AliError("GRP/GRP/Data entry: missing value for the dipole current !"); | |
995 | ok = kFALSE; | |
996 | } | |
997 | ||
998 | Char_t diPolarity = fGRPData->GetDipolePolarity(); | |
999 | if (diPolarity == AliGRPObject::GetInvalidChar()) { | |
1000 | AliError("GRP/GRP/Data entry: missing value for the dipole polarity !"); | |
1001 | ok = kFALSE; | |
1002 | } | |
1003 | ||
1004 | /* | |
61807e09 | 1005 | TObjString *l3Current= |
1006 | dynamic_cast<TObjString*>(fGRPData->GetValue("fL3Current")); | |
1007 | if (!l3Current) { | |
1008 | AliError("GRP/GRP/Data entry: missing value for the L3 current !"); | |
856024f0 | 1009 | ok = kFALSE; |
61807e09 | 1010 | } |
1011 | TObjString *l3Polarity= | |
1012 | dynamic_cast<TObjString*>(fGRPData->GetValue("fL3Polarity")); | |
1013 | if (!l3Polarity) { | |
1014 | AliError("GRP/GRP/Data entry: missing value for the L3 polarity !"); | |
856024f0 | 1015 | ok = kFALSE; |
61807e09 | 1016 | } |
44e45fac | 1017 | |
61807e09 | 1018 | // Dipole |
1019 | TObjString *diCurrent= | |
1020 | dynamic_cast<TObjString*>(fGRPData->GetValue("fDipoleCurrent")); | |
1021 | if (!diCurrent) { | |
1022 | AliError("GRP/GRP/Data entry: missing value for the dipole current !"); | |
856024f0 | 1023 | ok = kFALSE; |
61807e09 | 1024 | } |
1025 | TObjString *diPolarity= | |
1026 | dynamic_cast<TObjString*>(fGRPData->GetValue("fDipolePolarity")); | |
1027 | if (!diPolarity) { | |
1028 | AliError("GRP/GRP/Data entry: missing value for the dipole polarity !"); | |
856024f0 | 1029 | ok = kFALSE; |
61807e09 | 1030 | } |
44e45fac | 1031 | */ |
61807e09 | 1032 | |
856024f0 | 1033 | if (ok) { |
44e45fac | 1034 | Float_t l3Cur=TMath::Abs(l3Current); |
1035 | Float_t diCur=TMath::Abs(diCurrent); | |
1036 | Float_t l3Pol=l3Polarity; | |
1037 | // Float_t l3Cur=TMath::Abs(atof(l3Current->GetName())); | |
1038 | //Float_t diCur=TMath::Abs(atof(diCurrent->GetName())); | |
1039 | //Float_t l3Pol=atof(l3Polarity->GetName()); | |
856024f0 | 1040 | Float_t factor=1.; |
1041 | if (l3Pol != 0.) factor=-1.; | |
1042 | ||
61807e09 | 1043 | |
856024f0 | 1044 | if (!SetFieldMap(l3Cur, diCur, factor)) { |
1045 | AliFatal("Failed to creat a B field map ! Exiting..."); | |
1046 | } | |
1047 | AliInfo("Running with the B field constructed out of GRP !"); | |
1048 | } | |
1049 | else { | |
1050 | AliFatal("B field is neither set nor constructed from GRP ! Exitig..."); | |
61807e09 | 1051 | } |
1052 | ||
61807e09 | 1053 | } |
1054 | ||
f2a195c1 | 1055 | //*** Get the diamond profiles from OCDB |
1056 | entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexSPD"); | |
1057 | if (entry) { | |
1058 | fDiamondProfileSPD = dynamic_cast<AliESDVertex*> (entry->GetObject()); | |
1059 | } else { | |
1060 | AliError("No SPD diamond profile found in OCDB!"); | |
1061 | } | |
1062 | ||
61807e09 | 1063 | entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertex"); |
1064 | if (entry) { | |
f2a195c1 | 1065 | fDiamondProfile = dynamic_cast<AliESDVertex*> (entry->GetObject()); |
61807e09 | 1066 | } else { |
1067 | AliError("No diamond profile found in OCDB!"); | |
1068 | } | |
1069 | ||
1070 | entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexTPC"); | |
1071 | if (entry) { | |
f2a195c1 | 1072 | fDiamondProfileTPC = dynamic_cast<AliESDVertex*> (entry->GetObject()); |
61807e09 | 1073 | } else { |
f2a195c1 | 1074 | AliError("No TPC diamond profile found in OCDB!"); |
61807e09 | 1075 | } |
1076 | ||
1077 | return kTRUE; | |
1078 | } | |
1079 | ||
4b71572b | 1080 | //_____________________________________________________________________________ |
1081 | Bool_t AliReconstruction::LoadCDB() | |
1082 | { | |
1083 | AliCodeTimerAuto(""); | |
1084 | ||
1085 | AliCDBManager::Instance()->Get("GRP/CTP/Config"); | |
1086 | ||
7d566c20 | 1087 | TString detStr = fLoadCDB; |
ac4a7581 | 1088 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
4b71572b | 1089 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
1090 | AliCDBManager::Instance()->GetAll(Form("%s/Calib/*",fgkDetectorName[iDet])); | |
1091 | } | |
1092 | return kTRUE; | |
1093 | } | |
1094 | ||
596a855f | 1095 | //_____________________________________________________________________________ |
21a3aa09 | 1096 | Bool_t AliReconstruction::Run(const char* input) |
596a855f | 1097 | { |
21a3aa09 | 1098 | // Run Run Run |
1099 | AliCodeTimerAuto(""); | |
596a855f | 1100 | |
4b71572b | 1101 | InitRun(input); |
1102 | if (GetAbort() != TSelector::kContinue) return kFALSE; | |
1103 | ||
1104 | TChain *chain = NULL; | |
1105 | if (fRawReader && (chain = fRawReader->GetChain())) { | |
1106 | // Proof mode | |
1107 | if (gProof) { | |
4b71572b | 1108 | gProof->AddInput(this); |
db4aeca1 | 1109 | TUrl outputFile; |
1110 | outputFile.SetProtocol("root",kTRUE); | |
1111 | outputFile.SetHost(gSystem->HostName()); | |
1112 | outputFile.SetFile(Form("%s/AliESDs.root",gSystem->pwd())); | |
1113 | AliInfo(Form("Output file with ESDs is %s",outputFile.GetUrl())); | |
1114 | gProof->AddInput(new TNamed("PROOF_OUTPUTFILE",outputFile.GetUrl())); | |
4b71572b | 1115 | chain->SetProof(); |
1116 | chain->Process("AliReconstruction"); | |
1117 | } | |
1118 | else { | |
1119 | chain->Process(this); | |
1120 | } | |
1121 | } | |
1122 | else { | |
1123 | Begin(NULL); | |
1124 | if (GetAbort() != TSelector::kContinue) return kFALSE; | |
1125 | SlaveBegin(NULL); | |
1126 | if (GetAbort() != TSelector::kContinue) return kFALSE; | |
1127 | //******* The loop over events | |
44e45fac | 1128 | AliInfo("Starting looping over events"); |
4b71572b | 1129 | Int_t iEvent = 0; |
1130 | while ((iEvent < fRunLoader->GetNumberOfEvents()) || | |
1131 | (fRawReader && fRawReader->NextEvent())) { | |
1132 | if (!ProcessEvent(iEvent)) { | |
930e6e3e | 1133 | Abort("ProcessEvent",TSelector::kAbortFile); |
1134 | return kFALSE; | |
4b71572b | 1135 | } |
1136 | iEvent++; | |
1137 | } | |
1138 | SlaveTerminate(); | |
1139 | if (GetAbort() != TSelector::kContinue) return kFALSE; | |
1140 | Terminate(); | |
1141 | if (GetAbort() != TSelector::kContinue) return kFALSE; | |
21a3aa09 | 1142 | } |
21a3aa09 | 1143 | |
1144 | return kTRUE; | |
1145 | } | |
1146 | ||
1147 | //_____________________________________________________________________________ | |
4b71572b | 1148 | void AliReconstruction::InitRawReader(const char* input) |
21a3aa09 | 1149 | { |
21a3aa09 | 1150 | AliCodeTimerAuto(""); |
1151 | ||
4b71572b | 1152 | // Init raw-reader and |
21a3aa09 | 1153 | // set the input in case of raw data |
4b71572b | 1154 | if (input) fRawInput = input; |
1155 | fRawReader = AliRawReader::Create(fRawInput.Data()); | |
b58710ef | 1156 | if (!fRawReader) |
21a3aa09 | 1157 | AliInfo("Reconstruction will run over digits"); |
e0027792 | 1158 | |
35042093 | 1159 | if (!fEquipIdMap.IsNull() && fRawReader) |
1160 | fRawReader->LoadEquipmentIdsMap(fEquipIdMap); | |
1161 | ||
cd0b062e | 1162 | if (!fUseHLTData.IsNull()) { |
1163 | // create the RawReaderHLT which performs redirection of HLT input data for | |
1164 | // the specified detectors | |
1165 | AliRawReader* pRawReader=AliRawHLTManager::CreateRawReaderHLT(fRawReader, fUseHLTData.Data()); | |
1166 | if (pRawReader) { | |
1167 | fParentRawReader=fRawReader; | |
1168 | fRawReader=pRawReader; | |
1169 | } else { | |
1170 | AliError(Form("can not create Raw Reader for HLT input %s", fUseHLTData.Data())); | |
1171 | } | |
1172 | } | |
4b71572b | 1173 | AliSysInfo::AddStamp("CreateRawReader"); |
1174 | } | |
cd0b062e | 1175 | |
4b71572b | 1176 | //_____________________________________________________________________________ |
1177 | void AliReconstruction::InitRun(const char* input) | |
1178 | { | |
1179 | // Initialization of raw-reader, | |
1180 | // run number, CDB etc. | |
1181 | AliCodeTimerAuto(""); | |
1182 | AliSysInfo::AddStamp("Start"); | |
1183 | ||
002c9d1b | 1184 | // Initialize raw-reader if any |
4b71572b | 1185 | InitRawReader(input); |
596a855f | 1186 | |
ec92bee0 | 1187 | // Initialize the CDB storage |
795e4a22 | 1188 | InitCDB(); |
ec92bee0 | 1189 | |
6bae477a | 1190 | // Set run number in CDBManager (if it is not already set by the user) |
4b71572b | 1191 | if (!SetRunNumberFromData()) { |
1192 | Abort("SetRunNumberFromData", TSelector::kAbortProcess); | |
1193 | return; | |
1194 | } | |
002c9d1b | 1195 | |
795e4a22 | 1196 | // Set CDB lock: from now on it is forbidden to reset the run number |
1197 | // or the default storage or to activate any further storage! | |
1198 | SetCDBLock(); | |
1199 | ||
002c9d1b | 1200 | } |
1201 | ||
1202 | //_____________________________________________________________________________ | |
1203 | void AliReconstruction::Begin(TTree *) | |
1204 | { | |
1205 | // Initialize AlReconstruction before | |
1206 | // going into the event loop | |
1207 | // Should follow the TSelector convention | |
1208 | // i.e. initialize only the object on the client side | |
db4aeca1 | 1209 | AliCodeTimerAuto(""); |
1210 | ||
b4fef0d2 | 1211 | AliReconstruction *reco = NULL; |
002c9d1b | 1212 | if (fInput) { |
8fb1f1dc | 1213 | if ((reco = (AliReconstruction*)fInput->FindObject("AliReconstruction"))) { |
002c9d1b | 1214 | *this = *reco; |
002c9d1b | 1215 | } |
1216 | AliSysInfo::AddStamp("ReadInputInBegin"); | |
1217 | } | |
1218 | ||
6bae477a | 1219 | // Import ideal TGeo geometry and apply misalignment |
1220 | if (!gGeoManager) { | |
1221 | TString geom(gSystem->DirName(fGAliceFileName)); | |
1222 | geom += "/geometry.root"; | |
98e303d9 | 1223 | AliGeomManager::LoadGeometry(geom.Data()); |
4b71572b | 1224 | if (!gGeoManager) { |
1225 | Abort("LoadGeometry", TSelector::kAbortProcess); | |
1226 | return; | |
1227 | } | |
281270d3 | 1228 | AliSysInfo::AddStamp("LoadGeom"); |
ff5970a3 | 1229 | TString detsToCheck=fRunLocalReconstruction; |
4b71572b | 1230 | if(!AliGeomManager::CheckSymNamesLUT(detsToCheck.Data())) { |
1231 | Abort("CheckSymNamesLUT", TSelector::kAbortProcess); | |
1232 | return; | |
1233 | } | |
281270d3 | 1234 | AliSysInfo::AddStamp("CheckGeom"); |
6bae477a | 1235 | } |
8e245d15 | 1236 | |
4b71572b | 1237 | if (!MisalignGeometry(fLoadAlignData)) { |
1238 | Abort("MisalignGeometry", TSelector::kAbortProcess); | |
1239 | return; | |
1240 | } | |
1241 | AliCDBManager::Instance()->UnloadFromCache("GRP/Geometry/Data"); | |
281270d3 | 1242 | AliSysInfo::AddStamp("MisalignGeom"); |
6bae477a | 1243 | |
8cb26cdf | 1244 | if (!InitGRP()) { |
1245 | Abort("InitGRP", TSelector::kAbortProcess); | |
1246 | return; | |
1247 | } | |
1248 | AliSysInfo::AddStamp("InitGRP"); | |
1249 | ||
4b71572b | 1250 | if (!LoadCDB()) { |
1251 | Abort("LoadCDB", TSelector::kAbortProcess); | |
1252 | return; | |
1253 | } | |
1254 | AliSysInfo::AddStamp("LoadCDB"); | |
325aa76f | 1255 | |
7e88424f | 1256 | // Read the reconstruction parameters from OCDB |
1257 | if (!InitRecoParams()) { | |
002c9d1b | 1258 | AliWarning("Not all detectors have correct RecoParam objects initialized"); |
4b71572b | 1259 | } |
1260 | AliSysInfo::AddStamp("InitRecoParams"); | |
1261 | ||
002c9d1b | 1262 | if (fInput) { |
b4fef0d2 | 1263 | if (reco) *reco = *this; |
002c9d1b | 1264 | fInput->Add(gGeoManager); |
1265 | gGeoManager = NULL; | |
1266 | fInput->Add(const_cast<TMap*>(AliCDBManager::Instance()->GetEntryCache())); | |
1267 | fInput->Add(new TParameter<Int_t>("RunNumber",AliCDBManager::Instance()->GetRun())); | |
ead7b391 | 1268 | AliMagF *magFieldMap = (AliMagF*)AliTracker::GetFieldMap(); |
1269 | magFieldMap->SetName("MagneticFieldMap"); | |
1270 | fInput->Add(magFieldMap); | |
002c9d1b | 1271 | } |
4b71572b | 1272 | |
1273 | } | |
1274 | ||
1275 | //_____________________________________________________________________________ | |
1276 | void AliReconstruction::SlaveBegin(TTree*) | |
1277 | { | |
1278 | // Initialization related to run-loader, | |
1279 | // vertexer, trackers, recontructors | |
1280 | // In proof mode it is executed on the slave | |
1281 | AliCodeTimerAuto(""); | |
1282 | ||
db4aeca1 | 1283 | TProofOutputFile *outProofFile = NULL; |
ead7b391 | 1284 | if (fInput) { |
db4aeca1 | 1285 | if (AliReconstruction *reco = (AliReconstruction*)fInput->FindObject("AliReconstruction")) { |
1286 | *this = *reco; | |
1287 | } | |
4b71572b | 1288 | if (TGeoManager *tgeo = (TGeoManager*)fInput->FindObject("Geometry")) { |
1289 | gGeoManager = tgeo; | |
1290 | AliGeomManager::SetGeometry(tgeo); | |
7e88424f | 1291 | } |
281270d3 | 1292 | if (TMap *entryCache = (TMap*)fInput->FindObject("CDBEntryCache")) { |
1293 | Int_t runNumber = -1; | |
1294 | if (TProof::GetParameter(fInput,"RunNumber",runNumber) == 0) { | |
1295 | AliCDBManager *man = AliCDBManager::Instance(entryCache,runNumber); | |
1296 | man->SetCacheFlag(kTRUE); | |
1297 | man->SetLock(kTRUE); | |
1298 | man->Print(); | |
1299 | } | |
4b71572b | 1300 | } |
ead7b391 | 1301 | if (AliMagF *map = (AliMagF*)fInput->FindObject("MagneticFieldMap")) { |
4b71572b | 1302 | AliTracker::SetFieldMap(map,fUniformField); |
1303 | } | |
db4aeca1 | 1304 | if (TNamed *outputFileName = (TNamed *) fInput->FindObject("PROOF_OUTPUTFILE")) { |
1305 | outProofFile = new TProofOutputFile(gSystem->BaseName(TUrl(outputFileName->GetTitle()).GetFile())); | |
1306 | outProofFile->SetOutputFileName(outputFileName->GetTitle()); | |
1307 | fOutput->Add(outProofFile); | |
4b71572b | 1308 | } |
002c9d1b | 1309 | AliSysInfo::AddStamp("ReadInputInSlaveBegin"); |
7e88424f | 1310 | } |
325aa76f | 1311 | |
4b71572b | 1312 | // get the run loader |
1313 | if (!InitRunLoader()) { | |
1314 | Abort("InitRunLoader", TSelector::kAbortProcess); | |
1315 | return; | |
1316 | } | |
1317 | AliSysInfo::AddStamp("LoadLoader"); | |
1318 | ||
325aa76f | 1319 | ftVertexer = new AliVertexerTracks(AliTracker::GetBz()); |
2257f27e | 1320 | |
1321 | // get vertexer | |
1322 | if (fRunVertexFinder && !CreateVertexer()) { | |
4b71572b | 1323 | Abort("CreateVertexer", TSelector::kAbortProcess); |
1324 | return; | |
2257f27e | 1325 | } |
4b71572b | 1326 | AliSysInfo::AddStamp("CreateVertexer"); |
596a855f | 1327 | |
f08fc9f5 | 1328 | // get trackers |
b8cd5251 | 1329 | if (!fRunTracking.IsNull() && !CreateTrackers(fRunTracking)) { |
4b71572b | 1330 | Abort("CreateTrackers", TSelector::kAbortProcess); |
1331 | return; | |
1332 | } | |
1333 | AliSysInfo::AddStamp("CreateTrackers"); | |
24f7a148 | 1334 | |
36711aa4 | 1335 | // create the ESD output file and tree |
db4aeca1 | 1336 | if (!outProofFile) { |
1337 | ffile = TFile::Open("AliESDs.root", "RECREATE"); | |
1338 | ffile->SetCompressionLevel(2); | |
1339 | if (!ffile->IsOpen()) { | |
1340 | Abort("OpenESDFile", TSelector::kAbortProcess); | |
1341 | return; | |
1342 | } | |
1343 | } | |
1344 | else { | |
1345 | if (!(ffile = outProofFile->OpenFile("RECREATE"))) { | |
1346 | Abort(Form("Problems opening output PROOF file: %s/%s", | |
1347 | outProofFile->GetDir(), outProofFile->GetFileName()), | |
1348 | TSelector::kAbortProcess); | |
1349 | return; | |
1350 | } | |
596a855f | 1351 | } |
46698ae4 | 1352 | |
21a3aa09 | 1353 | ftree = new TTree("esdTree", "Tree with ESD objects"); |
1354 | fesd = new AliESDEvent(); | |
1355 | fesd->CreateStdContent(); | |
1d99986f | 1356 | if (fWriteESDfriend) { |
21a3aa09 | 1357 | fesdf = new AliESDfriend(); |
1358 | TBranch *br=ftree->Branch("ESDfriend.","AliESDfriend", &fesdf); | |
46698ae4 | 1359 | br->SetFile("AliESDfriends.root"); |
21a3aa09 | 1360 | fesd->AddObject(fesdf); |
1d99986f | 1361 | } |
f9604a22 | 1362 | fesd->WriteToTree(ftree); |
1363 | ftree->GetUserInfo()->Add(fesd); | |
1364 | ||
1365 | fhlttree = new TTree("HLTesdTree", "Tree with HLT ESD objects"); | |
1366 | fhltesd = new AliESDEvent(); | |
1367 | fhltesd->CreateStdContent(); | |
7491aea6 | 1368 | |
1369 | // read the ESD template from CDB | |
1370 | // HLT is allowed to put non-std content to its ESD, the non-std | |
1371 | // objects need to be created before invocation of WriteToTree in | |
1372 | // order to create all branches. Initialization is done from an | |
1373 | // ESD layout template in CDB | |
1374 | AliCDBManager* man = AliCDBManager::Instance(); | |
1375 | AliCDBPath hltESDConfigPath("HLT/ConfigHLT/esdLayout"); | |
1376 | AliCDBEntry* hltESDConfig=NULL; | |
1377 | if (man->GetId(hltESDConfigPath)!=NULL && | |
1378 | (hltESDConfig=man->Get(hltESDConfigPath))!=NULL) { | |
1379 | AliESDEvent* pESDLayout=dynamic_cast<AliESDEvent*>(hltESDConfig->GetObject()); | |
1380 | if (pESDLayout) { | |
1381 | // init all internal variables from the list of objects | |
1382 | pESDLayout->GetStdContent(); | |
1383 | ||
1384 | // copy content and create non-std objects | |
1385 | *fhltesd=*pESDLayout; | |
1386 | fhltesd->Reset(); | |
1387 | } else { | |
1388 | AliError(Form("error setting hltEsd layout from %s: invalid object type", | |
1389 | hltESDConfigPath.GetPath().Data())); | |
1390 | } | |
1391 | } | |
1392 | ||
f9604a22 | 1393 | fhltesd->WriteToTree(fhlttree); |
1394 | fhlttree->GetUserInfo()->Add(fhltesd); | |
5728d3d5 | 1395 | |
ac4a7581 | 1396 | ProcInfo_t procInfo; |
1397 | gSystem->GetProcInfo(&procInfo); | |
1398 | AliInfo(Form("Current memory usage %d %d", procInfo.fMemResident, procInfo.fMemVirtual)); | |
8661738e | 1399 | |
325aa76f | 1400 | //QA |
930e6e3e | 1401 | //Initialize the QA and start of cycle |
f6806ad3 | 1402 | if (fRunQA) { |
930e6e3e | 1403 | fQASteer = new AliQADataMakerSteer("rec") ; |
1404 | fQASteer->SetActiveDetectors(fQADetectors) ; | |
252f8aa8 | 1405 | for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { |
930e6e3e | 1406 | fQASteer->SetCycleLength(AliQA::DETECTORINDEX_t(det), fQACycles[det]) ; |
252f8aa8 | 1407 | if (fQAWriteExpert[det]) |
1408 | fQASteer->SetWriteExpert(AliQA::DETECTORINDEX_t(det)) ; | |
1409 | } | |
1410 | ||
930e6e3e | 1411 | if (!fRawReader && fQATasks.Contains(AliQA::kRAWS)) |
1412 | fQATasks.ReplaceAll(Form("%d",AliQA::kRAWS), "") ; | |
1413 | fQASteer->SetTasks(fQATasks) ; | |
1414 | fQASteer->InitQADataMaker(AliCDBManager::Instance()->GetRun(), fRecoParam) ; | |
4b71572b | 1415 | } |
930e6e3e | 1416 | |
4b71572b | 1417 | if (fRunGlobalQA) { |
0de86d1a | 1418 | Bool_t sameCycle = kFALSE ; |
1419 | if (!fQASteer) fQASteer = new AliQADataMakerSteer("rec") ; | |
4b71572b | 1420 | AliQADataMaker *qadm = fQASteer->GetQADataMaker(AliQA::kGLOBAL); |
1421 | AliInfo(Form("Initializing the global QA data maker")); | |
1422 | if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) { | |
930e6e3e | 1423 | qadm->StartOfCycle(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun(), sameCycle) ; |
1424 | TObjArray *arr=qadm->Init(AliQA::kRECPOINTS); | |
4b71572b | 1425 | AliTracker::SetResidualsArray(arr); |
930e6e3e | 1426 | sameCycle = kTRUE ; |
4b71572b | 1427 | } |
1428 | if (fQATasks.Contains(Form("%d", AliQA::kESDS))) { | |
930e6e3e | 1429 | qadm->StartOfCycle(AliQA::kESDS, AliCDBManager::Instance()->GetRun(), sameCycle) ; |
1430 | qadm->Init(AliQA::kESDS); | |
4b71572b | 1431 | } |
1432 | } | |
aa3c69a9 | 1433 | |
7167ae53 | 1434 | //Initialize the Plane Efficiency framework |
1435 | if (fRunPlaneEff && !InitPlaneEff()) { | |
4b71572b | 1436 | Abort("InitPlaneEff", TSelector::kAbortProcess); |
1437 | return; | |
7167ae53 | 1438 | } |
aa3c69a9 | 1439 | |
14dd053c | 1440 | if (strcmp(gProgName,"alieve") == 0) |
1441 | fRunAliEVE = InitAliEVE(); | |
1442 | ||
4b71572b | 1443 | return; |
21a3aa09 | 1444 | } |
1445 | ||
1446 | //_____________________________________________________________________________ | |
4b71572b | 1447 | Bool_t AliReconstruction::Process(Long64_t entry) |
1448 | { | |
1449 | // run the reconstruction over a single entry | |
1450 | // from the chain with raw data | |
1451 | AliCodeTimerAuto(""); | |
1452 | ||
1453 | TTree *currTree = fChain->GetTree(); | |
1454 | AliRawEvent *event = new AliRawEvent; | |
1455 | currTree->SetBranchAddress("rawevent",&event); | |
1456 | currTree->GetEntry(entry); | |
1457 | fRawReader = new AliRawReaderRoot(event); | |
1458 | fStatus = ProcessEvent(fRunLoader->GetNumberOfEvents()); | |
1459 | delete fRawReader; | |
1460 | fRawReader = NULL; | |
1461 | delete event; | |
1462 | ||
1463 | return fStatus; | |
1464 | } | |
1465 | ||
1466 | //_____________________________________________________________________________ | |
1467 | void AliReconstruction::Init(TTree *tree) | |
1468 | { | |
1469 | if (tree == 0) { | |
1470 | AliError("The input tree is not found!"); | |
1471 | return; | |
1472 | } | |
1473 | fChain = tree; | |
1474 | } | |
1475 | ||
1476 | //_____________________________________________________________________________ | |
1477 | Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) | |
21a3aa09 | 1478 | { |
1479 | // run the reconstruction over a single event | |
1480 | // The event loop is steered in Run method | |
1481 | ||
1482 | AliCodeTimerAuto(""); | |
1483 | ||
1484 | if (iEvent >= fRunLoader->GetNumberOfEvents()) { | |
1485 | fRunLoader->SetEventNumber(iEvent); | |
1486 | fRunLoader->GetHeader()->Reset(fRawReader->GetRunNumber(), | |
1487 | iEvent, iEvent); | |
21a3aa09 | 1488 | fRunLoader->TreeE()->Fill(); |
4b71572b | 1489 | if (fRawReader && fRawReader->UseAutoSaveESD()) |
1490 | fRunLoader->TreeE()->AutoSave("SaveSelf"); | |
21a3aa09 | 1491 | } |
1492 | ||
1493 | if ((iEvent < fFirstEvent) || ((fLastEvent >= 0) && (iEvent > fLastEvent))) { | |
21a3aa09 | 1494 | return kTRUE; |
1495 | } | |
1496 | ||
1497 | AliInfo(Form("processing event %d", iEvent)); | |
aa3c69a9 | 1498 | |
7e88424f | 1499 | // Fill Event-info object |
1500 | GetEventInfo(); | |
1501 | fRecoParam.SetEventSpecie(fRunInfo,fEventInfo); | |
48f5e52d | 1502 | AliInfo(Form("Current event specie: %s",fRecoParam.PrintEventSpecie())); |
7e88424f | 1503 | |
a00021a7 | 1504 | // Set the reco-params |
1505 | { | |
1506 | TString detStr = fLoadCDB; | |
ac4a7581 | 1507 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
a00021a7 | 1508 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
1509 | AliReconstructor *reconstructor = GetReconstructor(iDet); | |
1510 | if (reconstructor && fRecoParam.GetDetRecoParamArray(iDet)) { | |
1511 | const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet); | |
1512 | reconstructor->SetRecoParam(par); | |
1513 | } | |
1514 | } | |
1515 | } | |
1516 | ||
4b71572b | 1517 | fRunLoader->GetEvent(iEvent); |
24f7a148 | 1518 | |
ca13fb87 | 1519 | // QA on single raw |
930e6e3e | 1520 | if (fRunQA) |
e84c88f5 | 1521 | fQASteer->RunOneEvent(fRawReader) ; |
ca13fb87 | 1522 | |
d506c543 | 1523 | // local single event reconstruction |
b26c3770 | 1524 | if (!fRunLocalReconstruction.IsNull()) { |
d506c543 | 1525 | TString detectors=fRunLocalReconstruction; |
a441bf51 | 1526 | // run HLT event reconstruction first |
d506c543 | 1527 | // ;-( IsSelected changes the string |
1528 | if (IsSelected("HLT", detectors) && | |
1529 | !RunLocalEventReconstruction("HLT")) { | |
4b71572b | 1530 | if (fStopOnError) {CleanUp(); return kFALSE;} |
a441bf51 | 1531 | } |
1532 | detectors=fRunLocalReconstruction; | |
1533 | detectors.ReplaceAll("HLT", ""); | |
1534 | if (!RunLocalEventReconstruction(detectors)) { | |
4b71572b | 1535 | if (fStopOnError) {CleanUp(); return kFALSE;} |
b26c3770 | 1536 | } |
1537 | } | |
1538 | ||
21a3aa09 | 1539 | fesd->SetRunNumber(fRunLoader->GetHeader()->GetRun()); |
1540 | fhltesd->SetRunNumber(fRunLoader->GetHeader()->GetRun()); | |
1541 | fesd->SetEventNumberInFile(fRunLoader->GetHeader()->GetEventNrInRun()); | |
1542 | fhltesd->SetEventNumberInFile(fRunLoader->GetHeader()->GetEventNrInRun()); | |
46698ae4 | 1543 | |
d6ee376f | 1544 | // Set magnetic field from the tracker |
21a3aa09 | 1545 | fesd->SetMagneticField(AliTracker::GetBz()); |
1546 | fhltesd->SetMagneticField(AliTracker::GetBz()); | |
596a855f | 1547 | |
71f6cda4 | 1548 | // Set most probable pt, for B=0 tracking |
9257a1bd | 1549 | // Get the global reco-params. They are atposition 16 inside the array of detectors in fRecoParam |
ac4a7581 | 1550 | const AliGRPRecoParam *grpRecoParam = dynamic_cast<const AliGRPRecoParam*>(fRecoParam.GetDetRecoParam(kNDetectors)); |
71f6cda4 | 1551 | if (grpRecoParam) AliExternalTrackParam::SetMostProbablePt(grpRecoParam->GetMostProbablePt()); |
46698ae4 | 1552 | |
2e3550da | 1553 | // Fill raw-data error log into the ESD |
21a3aa09 | 1554 | if (fRawReader) FillRawDataErrorLog(iEvent,fesd); |
2e3550da | 1555 | |
2257f27e | 1556 | // vertex finder |
1557 | if (fRunVertexFinder) { | |
4b71572b | 1558 | if (!RunVertexFinder(fesd)) { |
1559 | if (fStopOnError) {CleanUp(); return kFALSE;} | |
2257f27e | 1560 | } |
1561 | } | |
1562 | ||
e66fbafb | 1563 | // Muon tracking |
b8cd5251 | 1564 | if (!fRunTracking.IsNull()) { |
e66fbafb | 1565 | if (fRunMuonTracking) { |
21a3aa09 | 1566 | if (!RunMuonTracking(fesd)) { |
4b71572b | 1567 | if (fStopOnError) {CleanUp(); return kFALSE;} |
24f7a148 | 1568 | } |
596a855f | 1569 | } |
1570 | } | |
1571 | ||
e66fbafb | 1572 | // barrel tracking |
1573 | if (!fRunTracking.IsNull()) { | |
4b71572b | 1574 | if (!RunTracking(fesd)) { |
1575 | if (fStopOnError) {CleanUp(); return kFALSE;} | |
e66fbafb | 1576 | } |
1577 | } | |
21c573b7 | 1578 | |
596a855f | 1579 | // fill ESD |
1580 | if (!fFillESD.IsNull()) { | |
d506c543 | 1581 | TString detectors=fFillESD; |
f6806ad3 | 1582 | // run HLT first and on hltesd |
d506c543 | 1583 | // ;-( IsSelected changes the string |
1584 | if (IsSelected("HLT", detectors) && | |
1585 | !FillESD(fhltesd, "HLT")) { | |
4b71572b | 1586 | if (fStopOnError) {CleanUp(); return kFALSE;} |
f6806ad3 | 1587 | } |
1588 | detectors=fFillESD; | |
d5105682 | 1589 | // Temporary fix to avoid problems with HLT that overwrites the offline ESDs |
1590 | if (detectors.Contains("ALL")) { | |
1591 | detectors=""; | |
ac4a7581 | 1592 | for (Int_t idet=0; idet<kNDetectors; ++idet){ |
d5105682 | 1593 | detectors += fgkDetectorName[idet]; |
1594 | detectors += " "; | |
1595 | } | |
1596 | } | |
f6806ad3 | 1597 | detectors.ReplaceAll("HLT", ""); |
1598 | if (!FillESD(fesd, detectors)) { | |
4b71572b | 1599 | if (fStopOnError) {CleanUp(); return kFALSE;} |
596a855f | 1600 | } |
1601 | } | |
a5fa6165 | 1602 | |
001397cd | 1603 | // fill Event header information from the RawEventHeader |
21a3aa09 | 1604 | if (fRawReader){FillRawEventHeaderESD(fesd);} |
596a855f | 1605 | |
1606 | // combined PID | |
21a3aa09 | 1607 | AliESDpid::MakePID(fesd); |
596a855f | 1608 | |
b647652d | 1609 | if (fFillTriggerESD) { |
4b71572b | 1610 | if (!FillTriggerESD(fesd)) { |
1611 | if (fStopOnError) {CleanUp(); return kFALSE;} | |
b647652d | 1612 | } |
1613 | } | |
1614 | ||
21a3aa09 | 1615 | ffile->cd(); |
a6ee503a | 1616 | |
3c3709c4 | 1617 | // |
67be5c77 | 1618 | // Propagate track to the beam pipe (if not already done by ITS) |
3c3709c4 | 1619 | // |
21a3aa09 | 1620 | const Int_t ntracks = fesd->GetNumberOfTracks(); |
1621 | const Double_t kBz = fesd->GetMagneticField(); | |
3c3709c4 | 1622 | const Double_t kRadius = 2.8; //something less than the beam pipe radius |
1623 | ||
1624 | TObjArray trkArray; | |
1625 | UShort_t *selectedIdx=new UShort_t[ntracks]; | |
1626 | ||
1627 | for (Int_t itrack=0; itrack<ntracks; itrack++){ | |
1628 | const Double_t kMaxStep = 5; //max step over the material | |
1629 | Bool_t ok; | |
1630 | ||
21a3aa09 | 1631 | AliESDtrack *track = fesd->GetTrack(itrack); |
3c3709c4 | 1632 | if (!track) continue; |
1633 | ||
1634 | AliExternalTrackParam *tpcTrack = | |
1635 | (AliExternalTrackParam *)track->GetTPCInnerParam(); | |
bcabd6af | 1636 | ok = kFALSE; |
1637 | if (tpcTrack) | |
1638 | ok = AliTracker:: | |
e92d2a64 | 1639 | PropagateTrackTo(tpcTrack,kRadius,track->GetMass(),kMaxStep,kFALSE); |
43c9dae1 | 1640 | |
3c3709c4 | 1641 | if (ok) { |
1642 | Int_t n=trkArray.GetEntriesFast(); | |
1643 | selectedIdx[n]=track->GetID(); | |
1644 | trkArray.AddLast(tpcTrack); | |
1645 | } | |
1646 | ||
3d65e645 | 1647 | //Tracks refitted by ITS should already be at the SPD vertex |
1648 | if (track->IsOn(AliESDtrack::kITSrefit)) continue; | |
1649 | ||
1650 | AliTracker:: | |
e92d2a64 | 1651 | PropagateTrackTo(track,kRadius,track->GetMass(),kMaxStep,kFALSE); |
3d65e645 | 1652 | track->RelateToVertex(fesd->GetPrimaryVertexSPD(), kBz, kVeryBig); |
3c3709c4 | 1653 | |
3c3709c4 | 1654 | } |
1655 | ||
1656 | // | |
1657 | // Improve the reconstructed primary vertex position using the tracks | |
1658 | // | |
59224b2b | 1659 | Bool_t runVertexFinderTracks = fRunVertexFinderTracks; |
1660 | if(fesd->GetPrimaryVertexSPD()) { | |
1661 | TString vtitle = fesd->GetPrimaryVertexSPD()->GetTitle(); | |
1662 | if(vtitle.Contains("cosmics")) { | |
1663 | runVertexFinderTracks=kFALSE; | |
1664 | } | |
c060d7fe | 1665 | } |
a00021a7 | 1666 | |
1667 | if (runVertexFinderTracks) { | |
3c3709c4 | 1668 | // TPC + ITS primary vertex |
f09c879d | 1669 | ftVertexer->SetITSMode(); |
f2a195c1 | 1670 | ftVertexer->SetConstraintOff(); |
a00021a7 | 1671 | // get cuts for vertexer from AliGRPRecoParam |
1672 | if (grpRecoParam) { | |
1673 | Int_t nCutsVertexer = grpRecoParam->GetVertexerTracksNCuts(); | |
1674 | Double_t *cutsVertexer = new Double_t[nCutsVertexer]; | |
1675 | grpRecoParam->GetVertexerTracksCutsITS(cutsVertexer); | |
1676 | ftVertexer->SetCuts(cutsVertexer); | |
1677 | delete [] cutsVertexer; cutsVertexer = NULL; | |
f2a195c1 | 1678 | if(fDiamondProfile && grpRecoParam->GetVertexerTracksConstraintITS()) |
1679 | ftVertexer->SetVtxStart(fDiamondProfile); | |
43c9dae1 | 1680 | } |
21a3aa09 | 1681 | AliESDVertex *pvtx=ftVertexer->FindPrimaryVertex(fesd); |
3c3709c4 | 1682 | if (pvtx) { |
1683 | if (pvtx->GetStatus()) { | |
c264b61b | 1684 | fesd->SetPrimaryVertexTracks(pvtx); |
3c3709c4 | 1685 | for (Int_t i=0; i<ntracks; i++) { |
21a3aa09 | 1686 | AliESDtrack *t = fesd->GetTrack(i); |
3d65e645 | 1687 | t->RelateToVertex(pvtx, kBz, kVeryBig); |
3c3709c4 | 1688 | } |
1689 | } | |
1690 | } | |
1691 | ||
1692 | // TPC-only primary vertex | |
f09c879d | 1693 | ftVertexer->SetTPCMode(); |
f2a195c1 | 1694 | ftVertexer->SetConstraintOff(); |
a00021a7 | 1695 | // get cuts for vertexer from AliGRPRecoParam |
1696 | if (grpRecoParam) { | |
1697 | Int_t nCutsVertexer = grpRecoParam->GetVertexerTracksNCuts(); | |
1698 | Double_t *cutsVertexer = new Double_t[nCutsVertexer]; | |
1699 | grpRecoParam->GetVertexerTracksCutsTPC(cutsVertexer); | |
1700 | ftVertexer->SetCuts(cutsVertexer); | |
1701 | delete [] cutsVertexer; cutsVertexer = NULL; | |
f2a195c1 | 1702 | if(fDiamondProfileTPC && grpRecoParam->GetVertexerTracksConstraintTPC()) |
1703 | ftVertexer->SetVtxStart(fDiamondProfileTPC); | |
43c9dae1 | 1704 | } |
21a3aa09 | 1705 | pvtx=ftVertexer->FindPrimaryVertex(&trkArray,selectedIdx); |
3c3709c4 | 1706 | if (pvtx) { |
1707 | if (pvtx->GetStatus()) { | |
21a3aa09 | 1708 | fesd->SetPrimaryVertexTPC(pvtx); |
3d65e645 | 1709 | for (Int_t i=0; i<ntracks; i++) { |
1710 | AliESDtrack *t = fesd->GetTrack(i); | |
1711 | t->RelateToVertexTPC(pvtx, kBz, kVeryBig); | |
3c3709c4 | 1712 | } |
1713 | } | |
1714 | } | |
1715 | ||
1716 | } | |
1717 | delete[] selectedIdx; | |
1718 | ||
21a3aa09 | 1719 | if(fDiamondProfile) fesd->SetDiamond(fDiamondProfile); |
17c86e90 | 1720 | |
c5e3e5d1 | 1721 | |
d1683eef | 1722 | if (fRunV0Finder) { |
1723 | // V0 finding | |
1724 | AliV0vertexer vtxer; | |
21a3aa09 | 1725 | vtxer.Tracks2V0vertices(fesd); |
5e4ff34d | 1726 | |
d1683eef | 1727 | if (fRunCascadeFinder) { |
1728 | // Cascade finding | |
1729 | AliCascadeVertexer cvtxer; | |
21a3aa09 | 1730 | cvtxer.V0sTracks2CascadeVertices(fesd); |
d1683eef | 1731 | } |
5e4ff34d | 1732 | } |
1733 | ||
596a855f | 1734 | // write ESD |
21a3aa09 | 1735 | if (fCleanESD) CleanESD(fesd); |
854c6476 | 1736 | |
bea94759 | 1737 | if (fRunQA) |
1738 | fQASteer->RunOneEvent(fesd) ; | |
1739 | ||
1740 | if (fRunGlobalQA) { | |
0d106d88 | 1741 | AliQADataMaker *qadm = fQASteer->GetQADataMaker(AliQA::kGLOBAL); |
1742 | if (qadm && fQATasks.Contains(Form("%d", AliQA::kESDS))) | |
bea94759 | 1743 | qadm->Exec(AliQA::kESDS, fesd); |
b8bd1ab8 | 1744 | } |
854c6476 | 1745 | |
1d99986f | 1746 | if (fWriteESDfriend) { |
b090e6a3 | 1747 | // fesdf->~AliESDfriend(); |
1748 | // new (fesdf) AliESDfriend(); // Reset... | |
21a3aa09 | 1749 | fesd->GetESDfriend(fesdf); |
1d99986f | 1750 | } |
21a3aa09 | 1751 | ftree->Fill(); |
500d54ab | 1752 | |
2d91a353 | 1753 | // Auto-save the ESD tree in case of prompt reco @P2 |
be103ac8 | 1754 | if (fRawReader && fRawReader->UseAutoSaveESD()) { |
2d91a353 | 1755 | ftree->AutoSave("SaveSelf"); |
be103ac8 | 1756 | TFile *friendfile = (TFile *)(gROOT->GetListOfFiles()->FindObject("AliESDfriends.root")); |
1757 | if (friendfile) friendfile->Save(); | |
1758 | } | |
2d91a353 | 1759 | |
500d54ab | 1760 | // write HLT ESD |
21a3aa09 | 1761 | fhlttree->Fill(); |
1d99986f | 1762 | |
14dd053c | 1763 | // call AliEVE |
1764 | if (fRunAliEVE) RunAliEVE(); | |
1765 | ||
21a3aa09 | 1766 | fesd->Reset(); |
1767 | fhltesd->Reset(); | |
5728d3d5 | 1768 | if (fWriteESDfriend) { |
21a3aa09 | 1769 | fesdf->~AliESDfriend(); |
1770 | new (fesdf) AliESDfriend(); // Reset... | |
5728d3d5 | 1771 | } |
a5fa6165 | 1772 | |
ac4a7581 | 1773 | ProcInfo_t procInfo; |
1774 | gSystem->GetProcInfo(&procInfo); | |
1775 | AliInfo(Form("Event %d -> Current memory usage %d %d",iEvent, procInfo.fMemResident, procInfo.fMemVirtual)); | |
a5fa6165 | 1776 | |
ca13fb87 | 1777 | fEventInfo.Reset(); |
ac4a7581 | 1778 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
ca13fb87 | 1779 | if (fReconstructor[iDet]) |
a00021a7 | 1780 | fReconstructor[iDet]->SetRecoParam(NULL); |
ca13fb87 | 1781 | } |
1782 | ||
53c8f690 | 1783 | if (fRunQA || fRunGlobalQA) |
1784 | fQASteer->Increment() ; | |
1785 | ||
ca13fb87 | 1786 | return kTRUE; |
21a3aa09 | 1787 | } |
1788 | ||
21a3aa09 | 1789 | //_____________________________________________________________________________ |
4b71572b | 1790 | void AliReconstruction::SlaveTerminate() |
21a3aa09 | 1791 | { |
4b71572b | 1792 | // Finalize the run on the slave side |
21a3aa09 | 1793 | // Called after the exit |
1794 | // from the event loop | |
1795 | AliCodeTimerAuto(""); | |
1796 | ||
1797 | if (fIsNewRunLoader) { // galice.root didn't exist | |
1798 | fRunLoader->WriteHeader("OVERWRITE"); | |
1799 | fRunLoader->CdGAFile(); | |
1800 | fRunLoader->Write(0, TObject::kOverwrite); | |
1801 | } | |
1802 | ||
f747912b | 1803 | const TMap *cdbMap = AliCDBManager::Instance()->GetStorageMap(); |
1804 | const TList *cdbList = AliCDBManager::Instance()->GetRetrievedIds(); | |
1805 | ||
1806 | TMap *cdbMapCopy = new TMap(cdbMap->GetEntries()); | |
1807 | cdbMapCopy->SetOwner(1); | |
1808 | cdbMapCopy->SetName("cdbMap"); | |
1809 | TIter iter(cdbMap->GetTable()); | |
1810 | ||
1811 | TPair* pair = 0; | |
1812 | while((pair = dynamic_cast<TPair*> (iter.Next()))){ | |
1813 | TObjString* keyStr = dynamic_cast<TObjString*> (pair->Key()); | |
1814 | TObjString* valStr = dynamic_cast<TObjString*> (pair->Value()); | |
1815 | cdbMapCopy->Add(new TObjString(keyStr->GetName()), new TObjString(valStr->GetName())); | |
1816 | } | |
1817 | ||
1818 | TList *cdbListCopy = new TList(); | |
1819 | cdbListCopy->SetOwner(1); | |
1820 | cdbListCopy->SetName("cdbList"); | |
1821 | ||
1822 | TIter iter2(cdbList); | |
1823 | ||
b940cb9b | 1824 | AliCDBId* id=0; |
e84c88f5 | 1825 | while((id = dynamic_cast<AliCDBId*> (iter2.Next()))){ |
a4970db9 | 1826 | cdbListCopy->Add(new TObjString(id->ToString().Data())); |
f747912b | 1827 | } |
1828 | ||
21a3aa09 | 1829 | ftree->GetUserInfo()->Add(cdbMapCopy); |
1830 | ftree->GetUserInfo()->Add(cdbListCopy); | |
abe0c04e | 1831 | |
46698ae4 | 1832 | |
21a3aa09 | 1833 | ffile->cd(); |
aa3c69a9 | 1834 | |
a9c0e6db | 1835 | if (fWriteESDfriend) |
21a3aa09 | 1836 | ftree->SetBranchStatus("ESDfriend*",0); |
562dd0b4 | 1837 | // we want to have only one tree version number |
21a3aa09 | 1838 | ftree->Write(ftree->GetName(),TObject::kOverwrite); |
1839 | fhlttree->Write(); | |
f3a97c86 | 1840 | |
a7a1e1c7 | 1841 | // Finish with Plane Efficiency evaluation: before of CleanUp !!! |
1842 | if (fRunPlaneEff && !FinishPlaneEff()) { | |
1843 | AliWarning("Finish PlaneEff evaluation failed"); | |
1844 | } | |
1845 | ||
930e6e3e | 1846 | // End of cycle for the in-loop |
1847 | if (fRunQA) { | |
930e6e3e | 1848 | fQASteer->EndOfCycle() ; |
1849 | } | |
1850 | if (fRunGlobalQA) { | |
4b71572b | 1851 | AliQADataMaker *qadm = fQASteer->GetQADataMaker(AliQA::kGLOBAL); |
1852 | if (qadm) { | |
1853 | if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) | |
930e6e3e | 1854 | qadm->EndOfCycle(AliQA::kRECPOINTS); |
4b71572b | 1855 | if (fQATasks.Contains(Form("%d", AliQA::kESDS))) |
930e6e3e | 1856 | qadm->EndOfCycle(AliQA::kESDS); |
4b71572b | 1857 | qadm->Finish(); |
1858 | } | |
a7807689 | 1859 | } |
4b71572b | 1860 | gROOT->cd(); |
1861 | CleanUp(); | |
1862 | } | |
1863 | ||
1864 | //_____________________________________________________________________________ | |
1865 | void AliReconstruction::Terminate() | |
1866 | { | |
f3a97c86 | 1867 | // Create tags for the events in the ESD tree (the ESD tree is always present) |
1868 | // In case of empty events the tags will contain dummy values | |
4b71572b | 1869 | AliCodeTimerAuto(""); |
1870 | ||
08e1a23e | 1871 | AliESDTagCreator *esdtagCreator = new AliESDTagCreator(); |
6b6e4472 | 1872 | esdtagCreator->CreateESDTags(fFirstEvent,fLastEvent,fGRPData); |
e84c88f5 | 1873 | |
795e4a22 | 1874 | // Cleanup of CDB manager: cache and active storages! |
1875 | AliCDBManager::Instance()->ClearCache(); | |
596a855f | 1876 | } |
1877 | ||
b26c3770 | 1878 | //_____________________________________________________________________________ |
1879 | Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors) | |
1880 | { | |
1881 | // run the local reconstruction | |
aa3c69a9 | 1882 | |
0f88822a | 1883 | static Int_t eventNr=0; |
87932dab | 1884 | AliCodeTimerAuto("") |
b26c3770 | 1885 | |
1886 | TString detStr = detectors; | |
ac4a7581 | 1887 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b26c3770 | 1888 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
1889 | AliReconstructor* reconstructor = GetReconstructor(iDet); | |
1890 | if (!reconstructor) continue; | |
1891 | AliLoader* loader = fLoader[iDet]; | |
f6806ad3 | 1892 | // Matthias April 2008: temporary fix to run HLT reconstruction |
1893 | // although the HLT loader is missing | |
1894 | if (strcmp(fgkDetectorName[iDet], "HLT")==0) { | |
1895 | if (fRawReader) { | |
1896 | reconstructor->Reconstruct(fRawReader, NULL); | |
1897 | } else { | |
1898 | TTree* dummy=NULL; | |
1899 | reconstructor->Reconstruct(dummy, NULL); | |
1900 | } | |
1901 | continue; | |
1902 | } | |
d76c31f4 | 1903 | if (!loader) { |
1904 | AliWarning(Form("No loader is defined for %s!",fgkDetectorName[iDet])); | |
1905 | continue; | |
1906 | } | |
b26c3770 | 1907 | // conversion of digits |
1908 | if (fRawReader && reconstructor->HasDigitConversion()) { | |
1909 | AliInfo(Form("converting raw data digits into root objects for %s", | |
1910 | fgkDetectorName[iDet])); | |
30bbd491 | 1911 | // AliCodeTimerAuto(Form("converting raw data digits into root objects for %s", |
1912 | // fgkDetectorName[iDet])); | |
b26c3770 | 1913 | loader->LoadDigits("update"); |
1914 | loader->CleanDigits(); | |
1915 | loader->MakeDigitsContainer(); | |
1916 | TTree* digitsTree = loader->TreeD(); | |
1917 | reconstructor->ConvertDigits(fRawReader, digitsTree); | |
1918 | loader->WriteDigits("OVERWRITE"); | |
1919 | loader->UnloadDigits(); | |
b26c3770 | 1920 | } |
b26c3770 | 1921 | // local reconstruction |
b26c3770 | 1922 | AliInfo(Form("running reconstruction for %s", fgkDetectorName[iDet])); |
30bbd491 | 1923 | //AliCodeTimerAuto(Form("running reconstruction for %s", fgkDetectorName[iDet])); |
b26c3770 | 1924 | loader->LoadRecPoints("update"); |
1925 | loader->CleanRecPoints(); | |
1926 | loader->MakeRecPointsContainer(); | |
1927 | TTree* clustersTree = loader->TreeR(); | |
1928 | if (fRawReader && !reconstructor->HasDigitConversion()) { | |
1929 | reconstructor->Reconstruct(fRawReader, clustersTree); | |
1930 | } else { | |
1931 | loader->LoadDigits("read"); | |
1932 | TTree* digitsTree = loader->TreeD(); | |
1933 | if (!digitsTree) { | |
1934 | AliError(Form("Can't get the %s digits tree", fgkDetectorName[iDet])); | |
1935 | if (fStopOnError) return kFALSE; | |
1936 | } else { | |
1937 | reconstructor->Reconstruct(digitsTree, clustersTree); | |
1938 | } | |
1939 | loader->UnloadDigits(); | |
1940 | } | |
d76c31f4 | 1941 | |
30bbd491 | 1942 | TString detQAStr(fQADetectors) ; |
930e6e3e | 1943 | if (fRunQA) |
e84c88f5 | 1944 | fQASteer->RunOneEventInOneDetector(iDet, clustersTree) ; |
1945 | ||
1946 | loader->WriteRecPoints("OVERWRITE"); | |
1947 | loader->UnloadRecPoints(); | |
1948 | AliSysInfo::AddStamp(Form("LRec%s_%d",fgkDetectorName[iDet],eventNr), iDet,1,eventNr); | |
a00021a7 | 1949 | } |
1950 | if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { | |
b26c3770 | 1951 | AliError(Form("the following detectors were not found: %s", |
1952 | detStr.Data())); | |
1953 | if (fStopOnError) return kFALSE; | |
1954 | } | |
0f88822a | 1955 | eventNr++; |
b26c3770 | 1956 | return kTRUE; |
1957 | } | |
1958 | ||
596a855f | 1959 | //_____________________________________________________________________________ |
af885e0f | 1960 | Bool_t AliReconstruction::RunVertexFinder(AliESDEvent*& esd) |
596a855f | 1961 | { |
1962 | // run the barrel tracking | |
1963 | ||
87932dab | 1964 | AliCodeTimerAuto("") |
030b532d | 1965 | |
2257f27e | 1966 | AliESDVertex* vertex = NULL; |
1967 | Double_t vtxPos[3] = {0, 0, 0}; | |
1968 | Double_t vtxErr[3] = {0.07, 0.07, 0.1}; | |
1969 | TArrayF mcVertex(3); | |
a6b0b91b | 1970 | if (fRunLoader->GetHeader() && fRunLoader->GetHeader()->GenEventHeader()) { |
1971 | fRunLoader->GetHeader()->GenEventHeader()->PrimaryVertex(mcVertex); | |
1972 | for (Int_t i = 0; i < 3; i++) vtxPos[i] = mcVertex[i]; | |
1973 | } | |
2257f27e | 1974 | |
b8cd5251 | 1975 | if (fVertexer) { |
815c2b38 | 1976 | AliInfo("running the ITS vertex finder"); |
308c2f7c | 1977 | if (fLoader[0]) { |
1978 | fLoader[0]->LoadRecPoints(); | |
1979 | TTree* cltree = fLoader[0]->TreeR(); | |
1980 | if (cltree) { | |
f2a195c1 | 1981 | if(fDiamondProfileSPD) fVertexer->SetVtxStart(fDiamondProfileSPD); |
308c2f7c | 1982 | vertex = fVertexer->FindVertexForCurrentEvent(cltree); |
1983 | } | |
1984 | else { | |
1985 | AliError("Can't get the ITS cluster tree"); | |
1986 | } | |
1987 | fLoader[0]->UnloadRecPoints(); | |
1988 | } | |
1989 | else { | |
1990 | AliError("Can't get the ITS loader"); | |
1991 | } | |
2257f27e | 1992 | if(!vertex){ |
815c2b38 | 1993 | AliWarning("Vertex not found"); |
c710f220 | 1994 | vertex = new AliESDVertex(); |
d1a50cb5 | 1995 | vertex->SetName("default"); |
2257f27e | 1996 | } |
1997 | else { | |
d1a50cb5 | 1998 | vertex->SetName("reconstructed"); |
2257f27e | 1999 | } |
2000 | ||
2001 | } else { | |
815c2b38 | 2002 | AliInfo("getting the primary vertex from MC"); |
2257f27e | 2003 | vertex = new AliESDVertex(vtxPos, vtxErr); |
2004 | } | |
2005 | ||
2006 | if (vertex) { | |
2007 | vertex->GetXYZ(vtxPos); | |
2008 | vertex->GetSigmaXYZ(vtxErr); | |
2009 | } else { | |
815c2b38 | 2010 | AliWarning("no vertex reconstructed"); |
2257f27e | 2011 | vertex = new AliESDVertex(vtxPos, vtxErr); |
2012 | } | |
06cc9d95 | 2013 | esd->SetPrimaryVertexSPD(vertex); |
32e449be | 2014 | // if SPD multiplicity has been determined, it is stored in the ESD |
25be1e5c | 2015 | AliMultiplicity *mult = fVertexer->GetMultiplicity(); |
32e449be | 2016 | if(mult)esd->SetMultiplicity(mult); |
2017 | ||
ac4a7581 | 2018 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 2019 | if (fTracker[iDet]) fTracker[iDet]->SetVertex(vtxPos, vtxErr); |
2020 | } | |
2257f27e | 2021 | delete vertex; |
2022 | ||
2257f27e | 2023 | return kTRUE; |
2024 | } | |
2025 | ||
1f46a9ae | 2026 | //_____________________________________________________________________________ |
af885e0f | 2027 | Bool_t AliReconstruction::RunHLTTracking(AliESDEvent*& esd) |
1f46a9ae | 2028 | { |
2029 | // run the HLT barrel tracking | |
2030 | ||
87932dab | 2031 | AliCodeTimerAuto("") |
1f46a9ae | 2032 | |
2033 | if (!fRunLoader) { | |
2034 | AliError("Missing runLoader!"); | |
2035 | return kFALSE; | |
2036 | } | |
2037 | ||
2038 | AliInfo("running HLT tracking"); | |
2039 | ||
2040 | // Get a pointer to the HLT reconstructor | |
ac4a7581 | 2041 | AliReconstructor *reconstructor = GetReconstructor(kNDetectors-1); |
1f46a9ae | 2042 | if (!reconstructor) return kFALSE; |
2043 | ||
2044 | // TPC + ITS | |
2045 | for (Int_t iDet = 1; iDet >= 0; iDet--) { | |
2046 | TString detName = fgkDetectorName[iDet]; | |
2047 | AliDebug(1, Form("%s HLT tracking", detName.Data())); | |
2048 | reconstructor->SetOption(detName.Data()); | |
d76c31f4 | 2049 | AliTracker *tracker = reconstructor->CreateTracker(); |
1f46a9ae | 2050 | if (!tracker) { |
2051 | AliWarning(Form("couldn't create a HLT tracker for %s", detName.Data())); | |
2052 | if (fStopOnError) return kFALSE; | |
9dcc06e1 | 2053 | continue; |
1f46a9ae | 2054 | } |
2055 | Double_t vtxPos[3]; | |
2056 | Double_t vtxErr[3]={0.005,0.005,0.010}; | |
2057 | const AliESDVertex *vertex = esd->GetVertex(); | |
2058 | vertex->GetXYZ(vtxPos); | |
2059 | tracker->SetVertex(vtxPos,vtxErr); | |
2060 | if(iDet != 1) { | |
2061 | fLoader[iDet]->LoadRecPoints("read"); | |
2062 | TTree* tree = fLoader[iDet]->TreeR(); | |
2063 | if (!tree) { | |
2064 | AliError(Form("Can't get the %s cluster tree", detName.Data())); | |
2065 | return kFALSE; | |
2066 | } | |
2067 | tracker->LoadClusters(tree); | |
2068 | } | |
2069 | if (tracker->Clusters2Tracks(esd) != 0) { | |
2070 | AliError(Form("HLT %s Clusters2Tracks failed", fgkDetectorName[iDet])); | |
2071 | return kFALSE; | |
2072 | } | |
2073 | if(iDet != 1) { | |
2074 | tracker->UnloadClusters(); | |
2075 | } | |
2076 | delete tracker; | |
2077 | } | |
2078 | ||
1f46a9ae | 2079 | return kTRUE; |
2080 | } | |
2081 | ||
e66fbafb | 2082 | //_____________________________________________________________________________ |
af885e0f | 2083 | Bool_t AliReconstruction::RunMuonTracking(AliESDEvent*& esd) |
e66fbafb | 2084 | { |
2085 | // run the muon spectrometer tracking | |
2086 | ||
87932dab | 2087 | AliCodeTimerAuto("") |
e66fbafb | 2088 | |
2089 | if (!fRunLoader) { | |
2090 | AliError("Missing runLoader!"); | |
2091 | return kFALSE; | |
2092 | } | |
2093 | Int_t iDet = 7; // for MUON | |
2094 | ||
2095 | AliInfo("is running..."); | |
2096 | ||
2097 | // Get a pointer to the MUON reconstructor | |
2098 | AliReconstructor *reconstructor = GetReconstructor(iDet); | |
2099 | if (!reconstructor) return kFALSE; | |
2100 | ||
2101 | ||
2102 | TString detName = fgkDetectorName[iDet]; | |
2103 | AliDebug(1, Form("%s tracking", detName.Data())); | |
d76c31f4 | 2104 | AliTracker *tracker = reconstructor->CreateTracker(); |
e66fbafb | 2105 | if (!tracker) { |
2106 | AliWarning(Form("couldn't create a tracker for %s", detName.Data())); | |
2107 | return kFALSE; | |
2108 | } | |
2109 | ||
e66fbafb | 2110 | // read RecPoints |
761350a6 | 2111 | fLoader[iDet]->LoadRecPoints("read"); |
c1954ee5 | 2112 | |
761350a6 | 2113 | tracker->LoadClusters(fLoader[iDet]->TreeR()); |
2114 | ||
2115 | Int_t rv = tracker->Clusters2Tracks(esd); | |
2116 | ||
761350a6 | 2117 | if ( rv ) |
2118 | { | |
e66fbafb | 2119 | AliError(Form("%s Clusters2Tracks failed", fgkDetectorName[iDet])); |
2120 | return kFALSE; | |
2121 | } | |
761350a6 | 2122 | |
e66fbafb | 2123 | fLoader[iDet]->UnloadRecPoints(); |
2124 | ||
c1954ee5 | 2125 | tracker->UnloadClusters(); |
2126 | ||
e66fbafb | 2127 | delete tracker; |
2128 | ||
e66fbafb | 2129 | return kTRUE; |
2130 | } | |
2131 | ||
2132 | ||
2257f27e | 2133 | //_____________________________________________________________________________ |
af885e0f | 2134 | Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd) |
2257f27e | 2135 | { |
2136 | // run the barrel tracking | |
0f88822a | 2137 | static Int_t eventNr=0; |
87932dab | 2138 | AliCodeTimerAuto("") |
24f7a148 | 2139 | |
815c2b38 | 2140 | AliInfo("running tracking"); |
596a855f | 2141 | |
91b876d1 | 2142 | //Fill the ESD with the T0 info (will be used by the TOF) |
d76c31f4 | 2143 | if (fReconstructor[11] && fLoader[11]) { |
2144 | fLoader[11]->LoadRecPoints("READ"); | |
2145 | TTree *treeR = fLoader[11]->TreeR(); | |
89916438 | 2146 | if (treeR) { |
2147 | GetReconstructor(11)->FillESD((TTree *)NULL,treeR,esd); | |
2148 | } | |
d76c31f4 | 2149 | } |
91b876d1 | 2150 | |
b8cd5251 | 2151 | // pass 1: TPC + ITS inwards |
2152 | for (Int_t iDet = 1; iDet >= 0; iDet--) { | |
2153 | if (!fTracker[iDet]) continue; | |
2154 | AliDebug(1, Form("%s tracking", fgkDetectorName[iDet])); | |
24f7a148 | 2155 | |
b8cd5251 | 2156 | // load clusters |
2157 | fLoader[iDet]->LoadRecPoints("read"); | |
6efecea1 | 2158 | AliSysInfo::AddStamp(Form("RLoadCluster%s_%d",fgkDetectorName[iDet],eventNr),iDet,1, eventNr); |
b8cd5251 | 2159 | TTree* tree = fLoader[iDet]->TreeR(); |
2160 | if (!tree) { | |
2161 | AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet])); | |
24f7a148 | 2162 | return kFALSE; |
2163 | } | |
b8cd5251 | 2164 | fTracker[iDet]->LoadClusters(tree); |
6efecea1 | 2165 | AliSysInfo::AddStamp(Form("TLoadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,2, eventNr); |
b8cd5251 | 2166 | // run tracking |
2167 | if (fTracker[iDet]->Clusters2Tracks(esd) != 0) { | |
2168 | AliError(Form("%s Clusters2Tracks failed", fgkDetectorName[iDet])); | |
24f7a148 | 2169 | return kFALSE; |
2170 | } | |
878e1fe1 | 2171 | // preliminary PID in TPC needed by the ITS tracker |
2172 | if (iDet == 1) { | |
b26c3770 | 2173 | GetReconstructor(1)->FillESD((TTree*)NULL, (TTree*)NULL, esd); |
878e1fe1 | 2174 | AliESDpid::MakePID(esd); |
0f88822a | 2175 | } |
6efecea1 | 2176 | AliSysInfo::AddStamp(Form("Tracking0%s_%d",fgkDetectorName[iDet],eventNr), iDet,3,eventNr); |
b8cd5251 | 2177 | } |
596a855f | 2178 | |
b8cd5251 | 2179 | // pass 2: ALL backwards |
aa3c69a9 | 2180 | |
ac4a7581 | 2181 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 2182 | if (!fTracker[iDet]) continue; |
2183 | AliDebug(1, Form("%s back propagation", fgkDetectorName[iDet])); | |
2184 | ||
2185 | // load clusters | |
2186 | if (iDet > 1) { // all except ITS, TPC | |
2187 | TTree* tree = NULL; | |
7b61cd9c | 2188 | fLoader[iDet]->LoadRecPoints("read"); |
6efecea1 | 2189 | AliSysInfo::AddStamp(Form("RLoadCluster0%s_%d",fgkDetectorName[iDet],eventNr), iDet,1, eventNr); |
7b61cd9c | 2190 | tree = fLoader[iDet]->TreeR(); |
b8cd5251 | 2191 | if (!tree) { |
2192 | AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet])); | |
24f7a148 | 2193 | return kFALSE; |
2194 | } | |
0f88822a | 2195 | fTracker[iDet]->LoadClusters(tree); |
6efecea1 | 2196 | AliSysInfo::AddStamp(Form("TLoadCluster0%s_%d",fgkDetectorName[iDet],eventNr), iDet,2, eventNr); |
b8cd5251 | 2197 | } |
24f7a148 | 2198 | |
b8cd5251 | 2199 | // run tracking |
283f39c6 | 2200 | if (iDet>1) // start filling residuals for the "outer" detectors |
2201 | if (fRunGlobalQA) AliTracker::SetFillResiduals(kTRUE); | |
2202 | ||
b8cd5251 | 2203 | if (fTracker[iDet]->PropagateBack(esd) != 0) { |
2204 | AliError(Form("%s backward propagation failed", fgkDetectorName[iDet])); | |
49dfd67a | 2205 | // return kFALSE; |
b8cd5251 | 2206 | } |
24f7a148 | 2207 | |
b8cd5251 | 2208 | // unload clusters |
6e65648b | 2209 | if (iDet > 3) { // all except ITS, TPC, TRD and TOF |
b8cd5251 | 2210 | fTracker[iDet]->UnloadClusters(); |
7b61cd9c | 2211 | fLoader[iDet]->UnloadRecPoints(); |
b8cd5251 | 2212 | } |
8f37df88 | 2213 | // updated PID in TPC needed by the ITS tracker -MI |
2214 | if (iDet == 1) { | |
8f37df88 | 2215 | GetReconstructor(1)->FillESD((TTree*)NULL, (TTree*)NULL, esd); |
2216 | AliESDpid::MakePID(esd); | |
2217 | } | |
6efecea1 | 2218 | AliSysInfo::AddStamp(Form("Tracking1%s_%d",fgkDetectorName[iDet],eventNr), iDet,3, eventNr); |
b8cd5251 | 2219 | } |
283f39c6 | 2220 | //stop filling residuals for the "outer" detectors |
2221 | if (fRunGlobalQA) AliTracker::SetFillResiduals(kFALSE); | |
596a855f | 2222 | |
b8cd5251 | 2223 | // pass 3: TRD + TPC + ITS refit inwards |
aa3c69a9 | 2224 | |
b8cd5251 | 2225 | for (Int_t iDet = 2; iDet >= 0; iDet--) { |
2226 | if (!fTracker[iDet]) continue; | |
2227 | AliDebug(1, Form("%s inward refit", fgkDetectorName[iDet])); | |
596a855f | 2228 | |
b8cd5251 | 2229 | // run tracking |
283f39c6 | 2230 | if (iDet<2) // start filling residuals for TPC and ITS |
2231 | if (fRunGlobalQA) AliTracker::SetFillResiduals(kTRUE); | |
2232 | ||
b8cd5251 | 2233 | if (fTracker[iDet]->RefitInward(esd) != 0) { |
2234 | AliError(Form("%s inward refit failed", fgkDetectorName[iDet])); | |
49dfd67a | 2235 | // return kFALSE; |
b8cd5251 | 2236 | } |
db2368d0 | 2237 | // run postprocessing |
2238 | if (fTracker[iDet]->PostProcess(esd) != 0) { | |
2239 | AliError(Form("%s postprocessing failed", fgkDetectorName[iDet])); | |
2240 | // return kFALSE; | |
2241 | } | |
6efecea1 | 2242 | AliSysInfo::AddStamp(Form("Tracking2%s_%d",fgkDetectorName[iDet],eventNr), iDet,3, eventNr); |
6e65648b | 2243 | } |
2244 | ||
2245 | // write space-points to the ESD in case alignment data output | |
2246 | // is switched on | |
2247 | if (fWriteAlignmentData) | |
2248 | WriteAlignmentData(esd); | |
2249 | ||
2250 | for (Int_t iDet = 3; iDet >= 0; iDet--) { | |
2251 | if (!fTracker[iDet]) continue; | |
b8cd5251 | 2252 | // unload clusters |
2253 | fTracker[iDet]->UnloadClusters(); | |
6efecea1 | 2254 | AliSysInfo::AddStamp(Form("TUnloadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,4, eventNr); |
b8cd5251 | 2255 | fLoader[iDet]->UnloadRecPoints(); |
6efecea1 | 2256 | AliSysInfo::AddStamp(Form("RUnloadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,5, eventNr); |
b8cd5251 | 2257 | } |
283f39c6 | 2258 | // stop filling residuals for TPC and ITS |
3b378a42 | 2259 | if (fRunGlobalQA) AliTracker::SetFillResiduals(kFALSE); |
854c6476 | 2260 | |
0f88822a | 2261 | eventNr++; |
596a855f | 2262 | return kTRUE; |
2263 | } | |
2264 | ||
d64bd07d | 2265 | //_____________________________________________________________________________ |
2266 | Bool_t AliReconstruction::CleanESD(AliESDEvent *esd){ | |
2267 | // | |
2268 | // Remove the data which are not needed for the physics analysis. | |
2269 | // | |
2270 | ||
d64bd07d | 2271 | Int_t nTracks=esd->GetNumberOfTracks(); |
18571674 | 2272 | Int_t nV0s=esd->GetNumberOfV0s(); |
cf37fd88 | 2273 | AliInfo |
2274 | (Form("Number of ESD tracks and V0s before cleaning: %d %d",nTracks,nV0s)); | |
d64bd07d | 2275 | |
18571674 | 2276 | Float_t cleanPars[]={fV0DCAmax,fV0CsPmin,fDmax,fZmax}; |
7f68891d | 2277 | Bool_t rc=esd->Clean(cleanPars); |
d64bd07d | 2278 | |
7f68891d | 2279 | nTracks=esd->GetNumberOfTracks(); |
18571674 | 2280 | nV0s=esd->GetNumberOfV0s(); |
cf37fd88 | 2281 | AliInfo |
ae5d5566 | 2282 | (Form("Number of ESD tracks and V0s after cleaning %d %d",nTracks,nV0s)); |
d64bd07d | 2283 | |
7f68891d | 2284 | return rc; |
d64bd07d | 2285 | } |
2286 | ||
596a855f | 2287 | //_____________________________________________________________________________ |
af885e0f | 2288 | Bool_t AliReconstruction::FillESD(AliESDEvent*& esd, const TString& detectors) |
596a855f | 2289 | { |
2290 | // fill the event summary data | |
2291 | ||
87932dab | 2292 | AliCodeTimerAuto("") |
0f88822a | 2293 | static Int_t eventNr=0; |
596a855f | 2294 | TString detStr = detectors; |
abe0c04e | 2295 | |
ac4a7581 | 2296 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
abe0c04e | 2297 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
b8cd5251 | 2298 | AliReconstructor* reconstructor = GetReconstructor(iDet); |
2299 | if (!reconstructor) continue; | |
4b71572b | 2300 | AliDebug(1, Form("filling ESD for %s", fgkDetectorName[iDet])); |
2301 | TTree* clustersTree = NULL; | |
2302 | if (fLoader[iDet]) { | |
2303 | fLoader[iDet]->LoadRecPoints("read"); | |
2304 | clustersTree = fLoader[iDet]->TreeR(); | |
2305 | if (!clustersTree) { | |
2306 | AliError(Form("Can't get the %s clusters tree", | |
2307 | fgkDetectorName[iDet])); | |
2308 | if (fStopOnError) return kFALSE; | |
2309 | } | |
2310 | } | |
2311 | if (fRawReader && !reconstructor->HasDigitConversion()) { | |
2312 | reconstructor->FillESD(fRawReader, clustersTree, esd); | |
2313 | } else { | |
2314 | TTree* digitsTree = NULL; | |
d76c31f4 | 2315 | if (fLoader[iDet]) { |
4b71572b | 2316 | fLoader[iDet]->LoadDigits("read"); |
2317 | digitsTree = fLoader[iDet]->TreeD(); | |
2318 | if (!digitsTree) { | |
2319 | AliError(Form("Can't get the %s digits tree", | |
b26c3770 | 2320 | fgkDetectorName[iDet])); |
2321 | if (fStopOnError) return kFALSE; | |
2322 | } | |
2323 | } | |
4b71572b | 2324 | reconstructor->FillESD(digitsTree, clustersTree, esd); |
2325 | if (fLoader[iDet]) fLoader[iDet]->UnloadDigits(); | |
2326 | } | |
2327 | if (fLoader[iDet]) { | |
2328 | fLoader[iDet]->UnloadRecPoints(); | |
596a855f | 2329 | } |
2330 | } | |
2331 | ||
2332 | if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { | |
815c2b38 | 2333 | AliError(Form("the following detectors were not found: %s", |
2334 | detStr.Data())); | |
596a855f | 2335 | if (fStopOnError) return kFALSE; |
2336 | } | |
6efecea1 | 2337 | AliSysInfo::AddStamp(Form("FillESD%d",eventNr), 0,1, eventNr); |
0f88822a | 2338 | eventNr++; |
596a855f | 2339 | return kTRUE; |
2340 | } | |
2341 | ||
b647652d | 2342 | //_____________________________________________________________________________ |
af885e0f | 2343 | Bool_t AliReconstruction::FillTriggerESD(AliESDEvent*& esd) |
b647652d | 2344 | { |
2345 | // Reads the trigger decision which is | |
2346 | // stored in Trigger.root file and fills | |
2347 | // the corresponding esd entries | |
2348 | ||
87932dab | 2349 | AliCodeTimerAuto("") |
2350 | ||
b647652d | 2351 | AliInfo("Filling trigger information into the ESD"); |
2352 | ||
2353 | if (fRawReader) { | |
2354 | AliCTPRawStream input(fRawReader); | |
2355 | if (!input.Next()) { | |
7e88424f | 2356 | AliWarning("No valid CTP (trigger) DDL raw data is found ! The trigger info is taken from the event header!"); |
b647652d | 2357 | } |
2358 | else { | |
7e88424f | 2359 | if (esd->GetTriggerMask() != input.GetClassMask()) |
2360 | AliError(Form("Invalid trigger pattern found in CTP raw-data: %llx %llx", | |
2361 | input.GetClassMask(),esd->GetTriggerMask())); | |
2362 | if (esd->GetOrbitNumber() != input.GetOrbitID()) | |
2363 | AliError(Form("Invalid orbit id found in CTP raw-data: %x %x", | |
2364 | input.GetOrbitID(),esd->GetOrbitNumber())); | |
2365 | if (esd->GetBunchCrossNumber() != input.GetBCID()) | |
2366 | AliError(Form("Invalid bunch-crossing id found in CTP raw-data: %x %x", | |
2367 | input.GetBCID(),esd->GetBunchCrossNumber())); | |
b647652d | 2368 | } |
b024fd7f | 2369 | |
7e88424f | 2370 | // Here one has to add the filling of trigger inputs and |
2371 | // interaction records | |
2372 | // ... | |
b024fd7f | 2373 | } |
b647652d | 2374 | return kTRUE; |
2375 | } | |
596a855f | 2376 | |
001397cd | 2377 | |
2378 | ||
2379 | ||
2380 | ||
2381 | //_____________________________________________________________________________ | |
af885e0f | 2382 | Bool_t AliReconstruction::FillRawEventHeaderESD(AliESDEvent*& esd) |
001397cd | 2383 | { |
2384 | // | |
2385 | // Filling information from RawReader Header | |
2386 | // | |
2387 | ||
151bea4e | 2388 | if (!fRawReader) return kFALSE; |
2389 | ||
001397cd | 2390 | AliInfo("Filling information from RawReader Header"); |
151bea4e | 2391 | |
2392 | esd->SetBunchCrossNumber(fRawReader->GetBCID()); | |
2393 | esd->SetOrbitNumber(fRawReader->GetOrbitID()); | |
2394 | esd->SetPeriodNumber(fRawReader->GetPeriod()); | |
2395 | ||
2396 | esd->SetTimeStamp(fRawReader->GetTimestamp()); | |
2397 | esd->SetEventType(fRawReader->GetType()); | |
001397cd | 2398 | |
2399 | return kTRUE; | |
2400 | } | |
2401 | ||
2402 | ||
596a855f | 2403 | //_____________________________________________________________________________ |
2404 | Bool_t AliReconstruction::IsSelected(TString detName, TString& detectors) const | |
2405 | { | |
2406 | // check whether detName is contained in detectors | |
2407 | // if yes, it is removed from detectors | |
2408 | ||
2409 | // check if all detectors are selected | |
2410 | if ((detectors.CompareTo("ALL") == 0) || | |
2411 | detectors.BeginsWith("ALL ") || | |
2412 | detectors.EndsWith(" ALL") || | |
2413 | detectors.Contains(" ALL ")) { | |
2414 | detectors = "ALL"; | |
2415 | return kTRUE; | |
2416 | } | |
2417 | ||
2418 | // search for the given detector | |
2419 | Bool_t result = kFALSE; | |
2420 | if ((detectors.CompareTo(detName) == 0) || | |
2421 | detectors.BeginsWith(detName+" ") || | |
2422 | detectors.EndsWith(" "+detName) || | |
2423 | detectors.Contains(" "+detName+" ")) { | |
2424 | detectors.ReplaceAll(detName, ""); | |
2425 | result = kTRUE; | |
2426 | } | |
2427 | ||
2428 | // clean up the detectors string | |
2429 | while (detectors.Contains(" ")) detectors.ReplaceAll(" ", " "); | |
2430 | while (detectors.BeginsWith(" ")) detectors.Remove(0, 1); | |
2431 | while (detectors.EndsWith(" ")) detectors.Remove(detectors.Length()-1, 1); | |
2432 | ||
2433 | return result; | |
2434 | } | |
e583c30d | 2435 | |
f08fc9f5 | 2436 | //_____________________________________________________________________________ |
2437 | Bool_t AliReconstruction::InitRunLoader() | |
2438 | { | |
2439 | // get or create the run loader | |
2440 | ||
2441 | if (gAlice) delete gAlice; | |
2442 | gAlice = NULL; | |
2443 | ||
b26c3770 | 2444 | if (!gSystem->AccessPathName(fGAliceFileName.Data())) { // galice.root exists |
2445 | // load all base libraries to get the loader classes | |
2446 | TString libs = gSystem->GetLibraries(); | |
ac4a7581 | 2447 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b26c3770 | 2448 | TString detName = fgkDetectorName[iDet]; |
2449 | if (detName == "HLT") continue; | |
2450 | if (libs.Contains("lib" + detName + "base.so")) continue; | |
2451 | gSystem->Load("lib" + detName + "base.so"); | |
2452 | } | |
f08fc9f5 | 2453 | fRunLoader = AliRunLoader::Open(fGAliceFileName.Data()); |
2454 | if (!fRunLoader) { | |
2455 | AliError(Form("no run loader found in file %s", fGAliceFileName.Data())); | |
2456 | CleanUp(); | |
2457 | return kFALSE; | |
2458 | } | |
325aa76f | 2459 | |
b26c3770 | 2460 | fRunLoader->CdGAFile(); |
325aa76f | 2461 | fRunLoader->LoadgAlice(); |
f08fc9f5 | 2462 | |
6cae184e | 2463 | //PH This is a temporary fix to give access to the kinematics |
2464 | //PH that is needed for the labels of ITS clusters | |
f2ee4290 | 2465 | fRunLoader->LoadHeader(); |
6cae184e | 2466 | fRunLoader->LoadKinematics(); |
2467 | ||
f08fc9f5 | 2468 | } else { // galice.root does not exist |
2469 | if (!fRawReader) { | |
2470 | AliError(Form("the file %s does not exist", fGAliceFileName.Data())); | |
f08fc9f5 | 2471 | } |
2472 | fRunLoader = AliRunLoader::Open(fGAliceFileName.Data(), | |
2473 | AliConfig::GetDefaultEventFolderName(), | |
2474 | "recreate"); | |
2475 | if (!fRunLoader) { | |
2476 | AliError(Form("could not create run loader in file %s", | |
2477 | fGAliceFileName.Data())); | |
2478 | CleanUp(); | |
2479 | return kFALSE; | |
2480 | } | |
21a3aa09 | 2481 | fIsNewRunLoader = kTRUE; |
f08fc9f5 | 2482 | fRunLoader->MakeTree("E"); |
21a3aa09 | 2483 | |
973388c2 | 2484 | if (fNumberOfEventsPerFile > 0) |
2485 | fRunLoader->SetNumberOfEventsPerFile(fNumberOfEventsPerFile); | |
2486 | else | |
21a3aa09 | 2487 | fRunLoader->SetNumberOfEventsPerFile((UInt_t)-1); |
f08fc9f5 | 2488 | } |
2489 | ||
2490 | return kTRUE; | |
2491 | } | |
2492 | ||
c757bafd | 2493 | //_____________________________________________________________________________ |
b8cd5251 | 2494 | AliReconstructor* AliReconstruction::GetReconstructor(Int_t iDet) |
c757bafd | 2495 | { |
f08fc9f5 | 2496 | // get the reconstructor object and the loader for a detector |
c757bafd | 2497 | |
7e88424f | 2498 | if (fReconstructor[iDet]) { |
2499 | if (fRecoParam.GetDetRecoParamArray(iDet) && !AliReconstructor::GetRecoParam(iDet)) { | |
2500 | const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet); | |
2501 | fReconstructor[iDet]->SetRecoParam(par); | |
2502 | } | |
2503 | return fReconstructor[iDet]; | |
2504 | } | |
b8cd5251 | 2505 | |
2506 | // load the reconstructor object | |
2507 | TPluginManager* pluginManager = gROOT->GetPluginManager(); | |
2508 | TString detName = fgkDetectorName[iDet]; | |
2509 | TString recName = "Ali" + detName + "Reconstructor"; | |
f0999a9a | 2510 | |
2511 | if (!fIsNewRunLoader && !fRunLoader->GetLoader(detName+"Loader") && (detName != "HLT")) return NULL; | |
b8cd5251 | 2512 | |
b8cd5251 | 2513 | AliReconstructor* reconstructor = NULL; |
2514 | // first check if a plugin is defined for the reconstructor | |
2515 | TPluginHandler* pluginHandler = | |
2516 | pluginManager->FindHandler("AliReconstructor", detName); | |
f08fc9f5 | 2517 | // if not, add a plugin for it |
2518 | if (!pluginHandler) { | |
b8cd5251 | 2519 | AliDebug(1, Form("defining plugin for %s", recName.Data())); |
b26c3770 | 2520 | TString libs = gSystem->GetLibraries(); |
2521 | if (libs.Contains("lib" + detName + "base.so") || | |
2522 | (gSystem->Load("lib" + detName + "base.so") >= 0)) { | |
b8cd5251 | 2523 | pluginManager->AddHandler("AliReconstructor", detName, |
2524 | recName, detName + "rec", recName + "()"); | |
2525 | } else { | |
2526 | pluginManager->AddHandler("AliReconstructor", detName, | |
2527 | recName, detName, recName + "()"); | |
c757bafd | 2528 | } |
b8cd5251 | 2529 | pluginHandler = pluginManager->FindHandler("AliReconstructor", detName); |
2530 | } | |
2531 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { | |
2532 | reconstructor = (AliReconstructor*) pluginHandler->ExecPlugin(0); | |
c757bafd | 2533 | } |
b8cd5251 | 2534 | if (reconstructor) { |
2535 | TObject* obj = fOptions.FindObject(detName.Data()); | |
2536 | if (obj) reconstructor->SetOption(obj->GetTitle()); | |
d76c31f4 | 2537 | reconstructor->Init(); |
b8cd5251 | 2538 | fReconstructor[iDet] = reconstructor; |
2539 | } | |
2540 | ||
f08fc9f5 | 2541 | // get or create the loader |
2542 | if (detName != "HLT") { | |
2543 | fLoader[iDet] = fRunLoader->GetLoader(detName + "Loader"); | |
2544 | if (!fLoader[iDet]) { | |
2545 | AliConfig::Instance() | |
2546 | ->CreateDetectorFolders(fRunLoader->GetEventFolder(), | |
2547 | detName, detName); | |
2548 | // first check if a plugin is defined for the loader | |
bb0901a4 | 2549 | pluginHandler = |
f08fc9f5 | 2550 | pluginManager->FindHandler("AliLoader", detName); |
2551 | // if not, add a plugin for it | |
2552 | if (!pluginHandler) { | |
2553 | TString loaderName = "Ali" + detName + "Loader"; | |
2554 | AliDebug(1, Form("defining plugin for %s", loaderName.Data())); | |
2555 | pluginManager->AddHandler("AliLoader", detName, | |
2556 | loaderName, detName + "base", | |
2557 | loaderName + "(const char*, TFolder*)"); | |
2558 | pluginHandler = pluginManager->FindHandler("AliLoader", detName); | |
2559 | } | |
2560 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { | |
2561 | fLoader[iDet] = | |
2562 | (AliLoader*) pluginHandler->ExecPlugin(2, detName.Data(), | |
2563 | fRunLoader->GetEventFolder()); | |
2564 | } | |
2565 | if (!fLoader[iDet]) { // use default loader | |
2566 | fLoader[iDet] = new AliLoader(detName, fRunLoader->GetEventFolder()); | |
2567 | } | |
2568 | if (!fLoader[iDet]) { | |
2569 | AliWarning(Form("couldn't get loader for %s", detName.Data())); | |
6667b602 | 2570 | if (fStopOnError) return NULL; |
f08fc9f5 | 2571 | } else { |
2572 | fRunLoader->AddLoader(fLoader[iDet]); | |
2573 | fRunLoader->CdGAFile(); | |
2574 | if (gFile && !gFile->IsWritable()) gFile->ReOpen("UPDATE"); | |
2575 | fRunLoader->Write(0, TObject::kOverwrite); | |
2576 | } | |
2577 | } | |
2578 | } | |
2579 | ||
7e88424f | 2580 | if (fRecoParam.GetDetRecoParamArray(iDet) && !AliReconstructor::GetRecoParam(iDet)) { |
2581 | const AliDetectorRecoParam *par = fRecoParam.GetDetRecoParam(iDet); | |
2582 | reconstructor->SetRecoParam(par); | |
2583 | } | |
b8cd5251 | 2584 | return reconstructor; |
c757bafd | 2585 | } |
2586 | ||
2257f27e | 2587 | //_____________________________________________________________________________ |
2588 | Bool_t AliReconstruction::CreateVertexer() | |
2589 | { | |
2590 | // create the vertexer | |
2591 | ||
b8cd5251 | 2592 | fVertexer = NULL; |
2593 | AliReconstructor* itsReconstructor = GetReconstructor(0); | |
59697224 | 2594 | if (itsReconstructor) { |
d76c31f4 | 2595 | fVertexer = itsReconstructor->CreateVertexer(); |
2257f27e | 2596 | } |
b8cd5251 | 2597 | if (!fVertexer) { |
815c2b38 | 2598 | AliWarning("couldn't create a vertexer for ITS"); |
2257f27e | 2599 | if (fStopOnError) return kFALSE; |
2600 | } | |
2601 | ||
2602 | return kTRUE; | |
2603 | } | |
2604 | ||
24f7a148 | 2605 | //_____________________________________________________________________________ |
b8cd5251 | 2606 | Bool_t AliReconstruction::CreateTrackers(const TString& detectors) |
24f7a148 | 2607 | { |
f08fc9f5 | 2608 | // create the trackers |
44e45fac | 2609 | AliInfo("Creating trackers"); |
24f7a148 | 2610 | |
b8cd5251 | 2611 | TString detStr = detectors; |
ac4a7581 | 2612 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 2613 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
2614 | AliReconstructor* reconstructor = GetReconstructor(iDet); | |
2615 | if (!reconstructor) continue; | |
2616 | TString detName = fgkDetectorName[iDet]; | |
1f46a9ae | 2617 | if (detName == "HLT") { |
2618 | fRunHLTTracking = kTRUE; | |
2619 | continue; | |
2620 | } | |
e66fbafb | 2621 | if (detName == "MUON") { |
2622 | fRunMuonTracking = kTRUE; | |
2623 | continue; | |
2624 | } | |
2625 | ||
f08fc9f5 | 2626 | |
d76c31f4 | 2627 | fTracker[iDet] = reconstructor->CreateTracker(); |
f08fc9f5 | 2628 | if (!fTracker[iDet] && (iDet < 7)) { |
2629 | AliWarning(Form("couldn't create a tracker for %s", detName.Data())); | |
8250d5f5 | 2630 | if (fStopOnError) return kFALSE; |
2631 | } | |
6efecea1 | 2632 | AliSysInfo::AddStamp(Form("LTracker%s",fgkDetectorName[iDet]), iDet,0); |
8250d5f5 | 2633 | } |
2634 | ||
24f7a148 | 2635 | return kTRUE; |
2636 | } | |
2637 | ||
e583c30d | 2638 | //_____________________________________________________________________________ |
4b71572b | 2639 | void AliReconstruction::CleanUp() |
e583c30d | 2640 | { |
2641 | // delete trackers and the run loader and close and delete the file | |
2642 | ||
ac4a7581 | 2643 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
b8cd5251 | 2644 | delete fReconstructor[iDet]; |
2645 | fReconstructor[iDet] = NULL; | |
2646 | fLoader[iDet] = NULL; | |
2647 | delete fTracker[iDet]; | |
2648 | fTracker[iDet] = NULL; | |
2649 | } | |
4b71572b | 2650 | delete fRunInfo; |
7e88424f | 2651 | fRunInfo = NULL; |
2652 | ||
b8cd5251 | 2653 | delete fVertexer; |
2654 | fVertexer = NULL; | |
21a3aa09 | 2655 | |
4b71572b | 2656 | delete ftVertexer; |
21a3aa09 | 2657 | ftVertexer = NULL; |
795e4a22 | 2658 | |
2659 | if(!(AliCDBManager::Instance()->GetCacheFlag())) { | |
f2a195c1 | 2660 | delete fDiamondProfileSPD; |
2661 | fDiamondProfileSPD = NULL; | |
4b71572b | 2662 | delete fDiamondProfile; |
2663 | fDiamondProfile = NULL; | |
2664 | delete fDiamondProfileTPC; | |
2665 | fDiamondProfileTPC = NULL; | |
795e4a22 | 2666 | } |
e583c30d | 2667 | delete fRunLoader; |
2668 | fRunLoader = NULL; | |
b649205a | 2669 | delete fRawReader; |
2670 | fRawReader = NULL; | |
4b71572b | 2671 | delete fParentRawReader; |
cd0b062e | 2672 | fParentRawReader=NULL; |
e583c30d | 2673 | |
4b71572b | 2674 | if (ffile) { |
2675 | ffile->Close(); | |
2676 | delete ffile; | |
2677 | ffile = NULL; | |
24f7a148 | 2678 | } |
24f7a148 | 2679 | } |
f3a97c86 | 2680 | |
af885e0f | 2681 | void AliReconstruction::WriteAlignmentData(AliESDEvent* esd) |
98937d93 | 2682 | { |
2683 | // Write space-points which are then used in the alignment procedures | |
6e65648b | 2684 | // For the moment only ITS, TPC, TRD and TOF |
98937d93 | 2685 | |
98937d93 | 2686 | Int_t ntracks = esd->GetNumberOfTracks(); |
2687 | for (Int_t itrack = 0; itrack < ntracks; itrack++) | |
2688 | { | |
2689 | AliESDtrack *track = esd->GetTrack(itrack); | |
2690 | Int_t nsp = 0; | |
ef7253ac | 2691 | Int_t idx[200]; |
81aa7a0d | 2692 | for (Int_t iDet = 5; iDet >= 0; iDet--) {// TOF, TRD, TPC, ITS clusters |
6e65648b | 2693 | nsp += track->GetNcls(iDet); |
2694 | ||
2695 | if (iDet==0) { // ITS "extra" clusters | |
2696 | track->GetClusters(iDet,idx); | |
2697 | for (Int_t i=6; i<12; i++) if(idx[i] >= 0) nsp++; | |
2698 | } | |
2699 | } | |
2700 | ||
98937d93 | 2701 | if (nsp) { |
2702 | AliTrackPointArray *sp = new AliTrackPointArray(nsp); | |
2703 | track->SetTrackPointArray(sp); | |
2704 | Int_t isptrack = 0; | |
81aa7a0d | 2705 | for (Int_t iDet = 5; iDet >= 0; iDet--) { |
98937d93 | 2706 | AliTracker *tracker = fTracker[iDet]; |
2707 | if (!tracker) continue; | |
6e65648b | 2708 | Int_t nspdet = track->GetClusters(iDet,idx); |
2709 | ||
2710 | if (iDet==0) // ITS "extra" clusters | |
2711 | for (Int_t i=6; i<12; i++) if(idx[i] >= 0) nspdet++; | |
2712 | ||
98937d93 | 2713 | if (nspdet <= 0) continue; |
98937d93 | 2714 | AliTrackPoint p; |
2715 | Int_t isp = 0; | |
2716 | Int_t isp2 = 0; | |
4ed6fb1c | 2717 | while (isp2 < nspdet) { |
f3c6e4c9 | 2718 | Bool_t isvalid=kTRUE; |
2719 | ||
2720 | Int_t index=idx[isp++]; | |
2721 | if (index < 0) continue; | |
2722 | ||
c12b6e44 | 2723 | TString dets = fgkDetectorName[iDet]; |
2724 | if ((fUseTrackingErrorsForAlignment.CompareTo(dets) == 0) || | |
2725 | fUseTrackingErrorsForAlignment.BeginsWith(dets+" ") || | |
2726 | fUseTrackingErrorsForAlignment.EndsWith(" "+dets) || | |
2727 | fUseTrackingErrorsForAlignment.Contains(" "+dets+" ")) { | |
f3c6e4c9 | 2728 | isvalid = tracker->GetTrackPointTrackingError(index,p,track); |
48ce48d1 | 2729 | } else { |
f3c6e4c9 | 2730 | isvalid = tracker->GetTrackPoint(index,p); |
48ce48d1 | 2731 | } |
2732 | isp2++; | |
98937d93 | 2733 | if (!isvalid) continue; |
f3c6e4c9 | 2734 | sp->AddPoint(isptrack,&p); isptrack++; |
98937d93 | 2735 | } |
98937d93 | 2736 | } |
2737 | } | |
2738 | } | |
98937d93 | 2739 | } |
2e3550da | 2740 | |
2741 | //_____________________________________________________________________________ | |
af885e0f | 2742 | void AliReconstruction::FillRawDataErrorLog(Int_t iEvent, AliESDEvent* esd) |
2e3550da | 2743 | { |
2744 | // The method reads the raw-data error log | |
2745 | // accumulated within the rawReader. | |
2746 | // It extracts the raw-data errors related to | |
2747 | // the current event and stores them into | |
2748 | // a TClonesArray inside the esd object. | |
2749 | ||
2750 | if (!fRawReader) return; | |
2751 | ||
2752 | for(Int_t i = 0; i < fRawReader->GetNumberOfErrorLogs(); i++) { | |
2753 | ||
2754 | AliRawDataErrorLog *log = fRawReader->GetErrorLog(i); | |
2755 | if (!log) continue; | |
2756 | if (iEvent != log->GetEventNumber()) continue; | |
2757 | ||
2758 | esd->AddRawDataErrorLog(log); | |
2759 | } | |
2760 | ||
2761 | } | |
46698ae4 | 2762 | |
8661738e | 2763 | //_____________________________________________________________________________ |
2764 | void AliReconstruction::CheckQA() | |
2765 | { | |
2766 | // check the QA of SIM for this run and remove the detectors | |
2767 | // with status Fatal | |
2768 | ||
abe0c04e | 2769 | TString newRunLocalReconstruction ; |
2770 | TString newRunTracking ; | |
2771 | TString newFillESD ; | |
2772 | ||
8661738e | 2773 | for (Int_t iDet = 0; iDet < AliQA::kNDET; iDet++) { |
2774 | TString detName(AliQA::GetDetName(iDet)) ; | |
96d67a8d | 2775 | AliQA * qa = AliQA::Instance(AliQA::DETECTORINDEX_t(iDet)) ; |
2776 | if ( qa->IsSet(AliQA::DETECTORINDEX_t(iDet), AliQA::kSIM, AliQA::kFATAL)) { | |
8661738e | 2777 | AliInfo(Form("QA status for %s in Hits and/or SDIGITS and/or Digits was Fatal; No reconstruction performed", detName.Data())) ; |
abe0c04e | 2778 | } else { |
2779 | if ( fRunLocalReconstruction.Contains(AliQA::GetDetName(iDet)) || | |
2780 | fRunLocalReconstruction.Contains("ALL") ) { | |
2781 | newRunLocalReconstruction += detName ; | |
2782 | newRunLocalReconstruction += " " ; | |
2783 | } | |
2784 | if ( fRunTracking.Contains(AliQA::GetDetName(iDet)) || | |
2785 | fRunTracking.Contains("ALL") ) { | |
2786 | newRunTracking += detName ; | |
2787 | newRunTracking += " " ; | |
2788 | } | |
2789 | if ( fFillESD.Contains(AliQA::GetDetName(iDet)) || | |
2790 | fFillESD.Contains("ALL") ) { | |
2791 | newFillESD += detName ; | |
2792 | newFillESD += " " ; | |
8661738e | 2793 | } |
2794 | } | |
2795 | } | |
abe0c04e | 2796 | fRunLocalReconstruction = newRunLocalReconstruction ; |
2797 | fRunTracking = newRunTracking ; | |
2798 | fFillESD = newFillESD ; | |
a5fa6165 | 2799 | } |
5b188f2f | 2800 | |
2801 | //_____________________________________________________________________________ | |
2802 | Int_t AliReconstruction::GetDetIndex(const char* detector) | |
2803 | { | |
2804 | // return the detector index corresponding to detector | |
2805 | Int_t index = -1 ; | |
ac4a7581 | 2806 | for (index = 0; index < kNDetectors ; index++) { |
5b188f2f | 2807 | if ( strcmp(detector, fgkDetectorName[index]) == 0 ) |
2808 | break ; | |
2809 | } | |
2810 | return index ; | |
2811 | } | |
7167ae53 | 2812 | //_____________________________________________________________________________ |
2813 | Bool_t AliReconstruction::FinishPlaneEff() { | |
2814 | // | |
2815 | // Here execute all the necessary operationis, at the end of the tracking phase, | |
d7f8fd68 | 2816 | // in case that evaluation of PlaneEfficiencies was required for some detector. |
2817 | // E.g., write into a DataBase file the PlaneEfficiency which have been evaluated. | |
7167ae53 | 2818 | // |
2819 | // This Preliminary version works only FOR ITS !!!!! | |
2820 | // other detectors (TOF,TRD, etc. have to develop their specific codes) | |
2821 | // | |
2822 | // Input: none | |
d7f8fd68 | 2823 | // Return: kTRUE if all operations have been done properly, kFALSE otherwise |
7167ae53 | 2824 | // |
2825 | Bool_t ret=kFALSE; | |
ac4a7581 | 2826 | //for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
d7f8fd68 | 2827 | for (Int_t iDet = 0; iDet < 1; iDet++) { // for the time being only ITS |
7167ae53 | 2828 | //if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
5fbd4fd6 | 2829 | if(fTracker[iDet]) { |
d7f8fd68 | 2830 | AliPlaneEff *planeeff=fTracker[iDet]->GetPlaneEff(); |
2831 | TString name=planeeff->GetName(); | |
2832 | name+=".root"; | |
2833 | TFile* pefile = TFile::Open(name, "RECREATE"); | |
2834 | ret=(Bool_t)planeeff->Write(); | |
2835 | pefile->Close(); | |
5fbd4fd6 | 2836 | if(planeeff->GetCreateHistos()) { |
d7f8fd68 | 2837 | TString hname=planeeff->GetName(); |
2838 | hname+="Histo.root"; | |
2839 | ret*=planeeff->WriteHistosToFile(hname,"RECREATE"); | |
5fbd4fd6 | 2840 | } |
2841 | } | |
7167ae53 | 2842 | } |
2843 | return ret; | |
2844 | } | |
2845 | //_____________________________________________________________________________ | |
2846 | Bool_t AliReconstruction::InitPlaneEff() { | |
2847 | // | |
2848 | // Here execute all the necessary operations, before of the tracking phase, | |
2849 | // for the evaluation of PlaneEfficiencies, in case required for some detectors. | |
2850 | // E.g., read from a DataBase file a first evaluation of the PlaneEfficiency | |
2851 | // which should be updated/recalculated. | |
2852 | // | |
2853 | // This Preliminary version will work only FOR ITS !!!!! | |
2854 | // other detectors (TOF,TRD, etc. have to develop their specific codes) | |
2855 | // | |
2856 | // Input: none | |
2857 | // Return: kTRUE if all operations have been done properly, kFALSE otherwise | |
2858 | // | |
2859 | AliWarning(Form("Implementation of this method not yet done !! Method return kTRUE")); | |
2860 | return kTRUE; | |
7520312d | 2861 | } |
14dd053c | 2862 | |
2863 | //_____________________________________________________________________________ | |
2864 | Bool_t AliReconstruction::InitAliEVE() | |
2865 | { | |
2866 | // This method should be called only in case | |
2867 | // AliReconstruction is run | |
2868 | // within the alieve environment. | |
2869 | // It will initialize AliEVE in a way | |
2870 | // so that it can visualize event processed | |
2871 | // by AliReconstruction. | |
2872 | // The return flag shows whenever the | |
2873 | // AliEVE initialization was successful or not. | |
2874 | ||
2875 | TString macroStr; | |
2876 | macroStr.Form("%s/EVE/macros/alieve_online.C",gSystem->ExpandPathName("$ALICE_ROOT")); | |
2877 | AliInfo(Form("Loading AliEVE macro: %s",macroStr.Data())); | |
2878 | if (gROOT->LoadMacro(macroStr.Data()) != 0) return kFALSE; | |
2879 | ||
6a840f1e | 2880 | gROOT->ProcessLine("if (!AliEveEventManager::GetMaster()){new AliEveEventManager();AliEveEventManager::GetMaster()->AddNewEventCommand(\"alieve_online_on_new_event()\");gEve->AddEvent(AliEveEventManager::GetMaster());};"); |
de33999e | 2881 | gROOT->ProcessLine("alieve_online_init()"); |
14dd053c | 2882 | |
2883 | return kTRUE; | |
2884 | } | |
2885 | ||
2886 | //_____________________________________________________________________________ | |
2887 | void AliReconstruction::RunAliEVE() | |
2888 | { | |
2889 | // Runs AliEVE visualisation of | |
2890 | // the current event. | |
2891 | // Should be executed only after | |
2892 | // successful initialization of AliEVE. | |
2893 | ||
2894 | AliInfo("Running AliEVE..."); | |
6a840f1e | 2895 | gROOT->ProcessLine(Form("AliEveEventManager::GetMaster()->SetEvent((AliRunLoader*)%p,(AliRawReader*)%p,(AliESDEvent*)%p);",fRunLoader,fRawReader,fesd)); |
14dd053c | 2896 | gSystem->Run(); |
2897 | } | |
ce43afbe | 2898 | |
2899 | //_____________________________________________________________________________ | |
2900 | Bool_t AliReconstruction::SetRunQA(TString detAndAction) | |
2901 | { | |
2902 | // Allows to run QA for a selected set of detectors | |
2903 | // and a selected set of tasks among RAWS, RECPOINTS and ESDS | |
2904 | // all selected detectors run the same selected tasks | |
2905 | ||
2906 | if (!detAndAction.Contains(":")) { | |
2907 | AliError( Form("%s is a wrong syntax, use \"DetectorList:ActionList\" \n", detAndAction.Data()) ) ; | |
2908 | fRunQA = kFALSE ; | |
2909 | return kFALSE ; | |
2910 | } | |
2911 | Int_t colon = detAndAction.Index(":") ; | |
2912 | fQADetectors = detAndAction(0, colon) ; | |
2913 | if (fQADetectors.Contains("ALL") ) | |
2914 | fQADetectors = fFillESD ; | |
e84c88f5 | 2915 | fQATasks = detAndAction(colon+1, detAndAction.Sizeof() ) ; |
ce43afbe | 2916 | if (fQATasks.Contains("ALL") ) { |
2917 | fQATasks = Form("%d %d %d", AliQA::kRAWS, AliQA::kRECPOINTS, AliQA::kESDS) ; | |
2918 | } else { | |
2919 | fQATasks.ToUpper() ; | |
2920 | TString tempo("") ; | |
2921 | if ( fQATasks.Contains("RAW") ) | |
2922 | tempo = Form("%d ", AliQA::kRAWS) ; | |
2923 | if ( fQATasks.Contains("RECPOINT") ) | |
2924 | tempo += Form("%d ", AliQA::kRECPOINTS) ; | |
2925 | if ( fQATasks.Contains("ESD") ) | |
2926 | tempo += Form("%d ", AliQA::kESDS) ; | |
2927 | fQATasks = tempo ; | |
2928 | if (fQATasks.IsNull()) { | |
2929 | AliInfo("No QA requested\n") ; | |
2930 | fRunQA = kFALSE ; | |
2931 | return kTRUE ; | |
2932 | } | |
2933 | } | |
2934 | TString tempo(fQATasks) ; | |
e84c88f5 | 2935 | tempo.ReplaceAll(Form("%d", AliQA::kRAWS), AliQA::GetTaskName(AliQA::kRAWS)) ; |
2936 | tempo.ReplaceAll(Form("%d", AliQA::kRECPOINTS), AliQA::GetTaskName(AliQA::kRECPOINTS)) ; | |
2937 | tempo.ReplaceAll(Form("%d", AliQA::kESDS), AliQA::GetTaskName(AliQA::kESDS)) ; | |
ce43afbe | 2938 | AliInfo( Form("QA will be done on \"%s\" for \"%s\"\n", fQADetectors.Data(), tempo.Data()) ) ; |
2939 | fRunQA = kTRUE ; | |
2940 | return kTRUE; | |
2941 | } | |
2942 | ||
7e88424f | 2943 | //_____________________________________________________________________________ |
2944 | Bool_t AliReconstruction::InitRecoParams() | |
2945 | { | |
2946 | // The method accesses OCDB and retrieves all | |
2947 | // the available reco-param objects from there. | |
2948 | ||
2949 | Bool_t isOK = kTRUE; | |
2950 | ||
7d566c20 | 2951 | TString detStr = fLoadCDB; |
ac4a7581 | 2952 | for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { |
7e88424f | 2953 | |
7d566c20 | 2954 | if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; |
2955 | ||
7e88424f | 2956 | if (fRecoParam.GetDetRecoParamArray(iDet)) { |
2957 | AliInfo(Form("Using custom reconstruction parameters for detector %s",fgkDetectorName[iDet])); | |
2958 | continue; | |
2959 | } | |
2960 | ||
ac232c75 | 2961 | AliInfo(Form("Loading reconstruction parameter objects for detector %s",fgkDetectorName[iDet])); |
7e88424f | 2962 | |
2963 | AliCDBPath path(fgkDetectorName[iDet],"Calib","RecoParam"); | |
2964 | AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath()); | |
2965 | if(!entry){ | |
2966 | AliWarning(Form("Couldn't find RecoParam entry in OCDB for detector %s",fgkDetectorName[iDet])); | |
2967 | isOK = kFALSE; | |
2968 | } | |
2969 | else { | |
2970 | TObject *recoParamObj = entry->GetObject(); | |
2971 | if (dynamic_cast<TObjArray*>(recoParamObj)) { | |
2972 | // The detector has a normal TobjArray of AliDetectorRecoParam objects | |
2973 | // Registering them in AliRecoParam | |
2974 | fRecoParam.AddDetRecoParamArray(iDet,dynamic_cast<TObjArray*>(recoParamObj)); | |
2975 | } | |
2976 | else if (dynamic_cast<AliDetectorRecoParam*>(recoParamObj)) { | |
2977 | // The detector has only onse set of reco parameters | |
2978 | // Registering it in AliRecoParam | |
ac232c75 | 2979 | AliInfo(Form("Single set of reconstruction parameters found for detector %s",fgkDetectorName[iDet])); |
7e88424f | 2980 | dynamic_cast<AliDetectorRecoParam*>(recoParamObj)->SetAsDefault(); |
2981 | fRecoParam.AddDetRecoParam(iDet,dynamic_cast<AliDetectorRecoParam*>(recoParamObj)); | |
2982 | } | |
2983 | else { | |
2984 | AliError(Form("No valid RecoParam object found in the OCDB for detector %s",fgkDetectorName[iDet])); | |
2985 | isOK = kFALSE; | |
2986 | } | |
2987 | entry->SetOwner(0); | |
4b71572b | 2988 | AliCDBManager::Instance()->UnloadFromCache(path.GetPath()); |
7e88424f | 2989 | } |
2990 | } | |
2991 | ||
e30a9b4d | 2992 | if (AliDebugLevel() > 0) fRecoParam.Print(); |
ac232c75 | 2993 | |
7e88424f | 2994 | return isOK; |
2995 | } | |
2996 | ||
2997 | //_____________________________________________________________________________ | |
2998 | Bool_t AliReconstruction::GetEventInfo() | |
2999 | { | |
3000 | // Fill the event info object | |
3001 | // ... | |
3002 | AliCodeTimerAuto("") | |
3003 | ||
3004 | AliCentralTrigger *aCTP = NULL; | |
3005 | if (fRawReader) { | |
3006 | fEventInfo.SetEventType(fRawReader->GetType()); | |
3007 | ||
3008 | ULong64_t mask = fRawReader->GetClassMask(); | |
3009 | fEventInfo.SetTriggerMask(mask); | |
3010 | UInt_t clmask = fRawReader->GetDetectorPattern()[0]; | |
3011 | fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(clmask)); | |
3012 | ||
3013 | aCTP = new AliCentralTrigger(); | |
3014 | TString configstr(""); | |
3015 | if (!aCTP->LoadConfiguration(configstr)) { // Load CTP config from OCDB | |
3016 | AliError("No trigger configuration found in OCDB! The trigger configuration information will not be used!"); | |
3017 | delete aCTP; | |
3018 | return kFALSE; | |
3019 | } | |
3020 | aCTP->SetClassMask(mask); | |
3021 | aCTP->SetClusterMask(clmask); | |
3022 | } | |
3023 | else { | |
3024 | fEventInfo.SetEventType(AliRawEventHeaderBase::kPhysicsEvent); | |
3025 | ||
3026 | if (fRunLoader && (!fRunLoader->LoadTrigger())) { | |
3027 | aCTP = fRunLoader->GetTrigger(); | |
3028 | fEventInfo.SetTriggerMask(aCTP->GetClassMask()); | |
3029 | fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(aCTP->GetClusterMask())); | |
3030 | } | |
3031 | else { | |
3032 | AliWarning("No trigger can be loaded! The trigger information will not be used!"); | |
3033 | return kFALSE; | |
3034 | } | |
3035 | } | |
3036 | ||
3037 | AliTriggerConfiguration *config = aCTP->GetConfiguration(); | |
3038 | if (!config) { | |
3039 | AliError("No trigger configuration has been found! The trigger configuration information will not be used!"); | |
3040 | if (fRawReader) delete aCTP; | |
3041 | return kFALSE; | |
3042 | } | |
3043 | ||
a0c2cf2d | 3044 | UChar_t clustmask = 0; |
7e88424f | 3045 | TString trclasses; |
3046 | ULong64_t trmask = fEventInfo.GetTriggerMask(); | |
3047 | const TObjArray& classesArray = config->GetClasses(); | |
3048 | Int_t nclasses = classesArray.GetEntriesFast(); | |
3049 | for( Int_t iclass=0; iclass < nclasses; iclass++ ) { | |
3050 | AliTriggerClass* trclass = (AliTriggerClass*)classesArray.At(iclass); | |
3051 | if (trclass) { | |
a4b0683d | 3052 | Int_t trindex = TMath::Nint(TMath::Log2(trclass->GetMask())); |
7e88424f | 3053 | fesd->SetTriggerClass(trclass->GetName(),trindex); |
8a933107 | 3054 | if (fRawReader) fRawReader->LoadTriggerClass(trclass->GetName(),trindex); |
7e88424f | 3055 | if (trmask & (1 << trindex)) { |
3056 | trclasses += " "; | |
3057 | trclasses += trclass->GetName(); | |
3058 | trclasses += " "; | |
a0c2cf2d | 3059 | clustmask |= trclass->GetCluster()->GetClusterMask(); |
7e88424f | 3060 | } |
3061 | } | |
3062 | } | |
3063 | fEventInfo.SetTriggerClasses(trclasses); | |
3064 | ||
a0c2cf2d | 3065 | // Set the information in ESD |
3066 | fesd->SetTriggerMask(trmask); | |
3067 | fesd->SetTriggerCluster(clustmask); | |
3068 | ||
7e88424f | 3069 | if (!aCTP->CheckTriggeredDetectors()) { |
3070 | if (fRawReader) delete aCTP; | |
3071 | return kFALSE; | |
3072 | } | |
3073 | ||
3074 | if (fRawReader) delete aCTP; | |
3075 | ||
3076 | // We have to fill also the HLT decision here!! | |
3077 | // ... | |
3078 | ||
3079 | return kTRUE; | |
3080 | } | |
3081 | ||
3082 | const char *AliReconstruction::MatchDetectorList(const char *detectorList, UInt_t detectorMask) | |
3083 | { | |
3084 | // Match the detector list found in the rec.C or the default 'ALL' | |
3085 | // to the list found in the GRP (stored there by the shuttle PP which | |
3086 | // gets the information from ECS) | |
3087 | static TString resultList; | |
3088 | TString detList = detectorList; | |
3089 | ||
3090 | resultList = ""; | |
3091 | ||
3092 | for(Int_t iDet = 0; iDet < (AliDAQ::kNDetectors-1); iDet++) { | |
3093 | if ((detectorMask >> iDet) & 0x1) { | |
3094 | TString det = AliDAQ::OfflineModuleName(iDet); | |
3095 | if ((detList.CompareTo("ALL") == 0) || | |
a101e1dd | 3096 | ((detList.BeginsWith("ALL ") || |
3097 | detList.EndsWith(" ALL") || | |
3098 | detList.Contains(" ALL ")) && | |
3099 | !(detList.BeginsWith("-"+det+" ") || | |
3100 | detList.EndsWith(" -"+det) || | |
3101 | detList.Contains(" -"+det+" "))) || | |
7e88424f | 3102 | (detList.CompareTo(det) == 0) || |
a101e1dd | 3103 | detList.BeginsWith(det+" ") || |
3104 | detList.EndsWith(" "+det) || | |
7e88424f | 3105 | detList.Contains( " "+det+" " )) { |
3106 | if (!resultList.EndsWith(det + " ")) { | |
3107 | resultList += det; | |
3108 | resultList += " "; | |
3109 | } | |
3110 | } | |
3111 | } | |
3112 | } | |
3113 | ||
3114 | // HLT | |
3115 | if ((detectorMask >> AliDAQ::kHLTId) & 0x1) { | |
3116 | TString hltDet = AliDAQ::OfflineModuleName(AliDAQ::kNDetectors-1); | |
3117 | if ((detList.CompareTo("ALL") == 0) || | |
a101e1dd | 3118 | ((detList.BeginsWith("ALL ") || |
3119 | detList.EndsWith(" ALL") || | |
3120 | detList.Contains(" ALL ")) && | |
3121 | !(detList.BeginsWith("-"+hltDet+" ") || | |
3122 | detList.EndsWith(" -"+hltDet) || | |
3123 | detList.Contains(" -"+hltDet+" "))) || | |
7e88424f | 3124 | (detList.CompareTo(hltDet) == 0) || |
a101e1dd | 3125 | detList.BeginsWith(hltDet+" ") || |
3126 | detList.EndsWith(" "+hltDet) || | |
7e88424f | 3127 | detList.Contains( " "+hltDet+" " )) { |
3128 | resultList += hltDet; | |
3129 | } | |
3130 | } | |
3131 | ||
3132 | return resultList.Data(); | |
3133 | ||
3134 | } | |
4b71572b | 3135 | |
3136 | //______________________________________________________________________________ | |
3137 | void AliReconstruction::Abort(const char *method, EAbort what) | |
3138 | { | |
3139 | // Abort processing. If what = kAbortProcess, the Process() loop will be | |
3140 | // aborted. If what = kAbortFile, the current file in a chain will be | |
3141 | // aborted and the processing will continue with the next file, if there | |
3142 | // is no next file then Process() will be aborted. Abort() can also be | |
3143 | // called from Begin(), SlaveBegin(), Init() and Notify(). After abort | |
3144 | // the SlaveTerminate() and Terminate() are always called. The abort flag | |
3145 | // can be checked in these methods using GetAbort(). | |
3146 | // | |
3147 | // The method is overwritten in AliReconstruction for better handling of | |
3148 | // reco specific errors | |
3149 | ||
3150 | if (!fStopOnError) return; | |
3151 | ||
3152 | CleanUp(); | |
3153 | ||
3154 | TString whyMess = method; | |
3155 | whyMess += " failed! Aborting..."; | |
3156 | ||
3157 | AliError(whyMess.Data()); | |
3158 | ||
3159 | fAbort = what; | |
3160 | TString mess = "Abort"; | |
3161 | if (fAbort == kAbortProcess) | |
3162 | mess = "AbortProcess"; | |
3163 | else if (fAbort == kAbortFile) | |
3164 | mess = "AbortFile"; | |
3165 | ||
3166 | Info(mess, whyMess.Data()); | |
3167 | } | |
3168 |