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