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