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