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