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