]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // |
2 | // Manager (singleton) of corrections | |
3 | // | |
0bd4b00f | 4 | #include "AliForwardCorrectionManager.h" |
5 | #include "AliForwardUtil.h" | |
6 | #include <TString.h> | |
7 | #include <AliLog.h> | |
8 | #include <TFile.h> | |
9 | #include <TSystem.h> | |
10 | ||
11 | ||
12 | //____________________________________________________________________ | |
13 | AliForwardCorrectionManager* AliForwardCorrectionManager::fgInstance = 0; | |
14 | const char* AliForwardCorrectionManager::fgkSecondaryMapSkel = "secondary"; | |
15 | const char* AliForwardCorrectionManager::fgkDoubleHitSkel = "doublehit"; | |
16 | const char* AliForwardCorrectionManager::fgkELossFitsSkel = "elossfits"; | |
17 | const char* AliForwardCorrectionManager::fgkVertexBiasSkel = "vertexbias"; | |
18 | const char* AliForwardCorrectionManager::fgkMergingEffSkel = "merging"; | |
72cc12cd | 19 | const char* AliForwardCorrectionManager::fgkAcceptanceSkel = "acceptance"; |
0bd4b00f | 20 | |
21 | #define PREFIX "$(ALICE_ROOT)/PWG2/FORWARD/corrections/" | |
72cc12cd | 22 | #define ELOSSFIT_DIR "ELossFits" |
23 | #define MERGING_DIR "MergingEfficiency" | |
24 | #define SECONDARY_DIR "SecondaryMap" | |
25 | #define DOUBLE_DIR "DoubleHit" | |
26 | #define VERTEX_DIR "VertexBias" | |
27 | #define ACCEPTANCE_DIR "Acceptance" | |
0bd4b00f | 28 | |
29 | //____________________________________________________________________ | |
30 | AliForwardCorrectionManager& AliForwardCorrectionManager::Instance() | |
31 | { | |
7984e5f7 | 32 | // |
33 | // Access to the singleton object | |
34 | // | |
35 | // Return: | |
36 | // Reference to the singleton object | |
37 | // | |
0bd4b00f | 38 | if (!fgInstance) fgInstance= new AliForwardCorrectionManager; |
39 | return *fgInstance; | |
40 | } | |
41 | ||
42 | //____________________________________________________________________ | |
43 | AliForwardCorrectionManager::AliForwardCorrectionManager() | |
44 | : TObject(), | |
45 | fInit(kFALSE), | |
46 | fSys(0), | |
47 | fSNN(0), | |
48 | fField(999), | |
72cc12cd | 49 | fELossFitsPath(PREFIX ELOSSFIT_DIR), |
50 | fMergingEffPath(PREFIX MERGING_DIR), | |
51 | fSecondaryMapPath(PREFIX SECONDARY_DIR), | |
52 | fDoubleHitPath(PREFIX DOUBLE_DIR), | |
53 | fVertexBiasPath(PREFIX VERTEX_DIR), | |
54 | fAcceptancePath(PREFIX ACCEPTANCE_DIR), | |
0bd4b00f | 55 | fELossFit(0), |
56 | fSecondaryMap(0), | |
57 | fDoubleHit(0), | |
58 | fVertexBias(0), | |
72cc12cd | 59 | fMergingEfficiency(0), |
60 | fAcceptance(0) | |
0bd4b00f | 61 | { |
7984e5f7 | 62 | // |
63 | // Default constructor | |
64 | // | |
0bd4b00f | 65 | } |
66 | //____________________________________________________________________ | |
67 | AliForwardCorrectionManager::AliForwardCorrectionManager(const AliForwardCorrectionManager& o) | |
68 | : TObject(o), | |
69 | fInit(o.fInit), | |
70 | fSys(o.fSys), | |
71 | fSNN(o.fSNN), | |
72 | fField(o.fField), | |
73 | fELossFitsPath(o.fELossFitsPath), | |
74 | fMergingEffPath(o.fMergingEffPath), | |
75 | fSecondaryMapPath(o.fSecondaryMapPath), | |
76 | fDoubleHitPath(o.fDoubleHitPath), | |
77 | fVertexBiasPath(o.fVertexBiasPath), | |
72cc12cd | 78 | fAcceptancePath(o.fAcceptancePath), |
0bd4b00f | 79 | fELossFit(o.fELossFit), |
80 | fSecondaryMap(o.fSecondaryMap), | |
81 | fDoubleHit(o.fDoubleHit), | |
82 | fVertexBias(o.fVertexBias), | |
72cc12cd | 83 | fMergingEfficiency(o.fMergingEfficiency), |
84 | fAcceptance(o.fAcceptance) | |
0bd4b00f | 85 | |
86 | { | |
7984e5f7 | 87 | // |
88 | // Copy constructor | |
89 | // | |
90 | // Parameters: | |
91 | // o Object to copy from | |
92 | // | |
0bd4b00f | 93 | } |
94 | //____________________________________________________________________ | |
95 | AliForwardCorrectionManager& | |
96 | AliForwardCorrectionManager::operator=(const AliForwardCorrectionManager& o) | |
97 | { | |
7984e5f7 | 98 | // |
99 | // Assignment operator | |
100 | // | |
101 | // Parameters: | |
102 | // o Object to assign from | |
103 | // | |
104 | // Return: | |
105 | // Reference to this object | |
106 | // | |
0bd4b00f | 107 | fInit = o.fInit; |
108 | fSys = o.fSys; | |
109 | fSNN = o.fSNN; | |
110 | fField = o.fField; | |
111 | fELossFitsPath = o.fELossFitsPath; | |
112 | fMergingEffPath = o.fMergingEffPath; | |
113 | fSecondaryMapPath = o.fSecondaryMapPath; | |
114 | fDoubleHitPath = o.fDoubleHitPath; | |
115 | fVertexBiasPath = o.fVertexBiasPath; | |
72cc12cd | 116 | fAcceptancePath = o.fAcceptancePath; |
0bd4b00f | 117 | fELossFit = o.fELossFit; |
118 | fSecondaryMap = o.fSecondaryMap; | |
119 | fDoubleHit = o.fDoubleHit; | |
120 | fVertexBias = o.fVertexBias; | |
121 | fMergingEfficiency= o.fMergingEfficiency; | |
72cc12cd | 122 | fAcceptance = o.fAcceptance; |
0bd4b00f | 123 | return *this; |
124 | } | |
125 | ||
126 | //____________________________________________________________________ | |
127 | Bool_t | |
128 | AliForwardCorrectionManager::Init(const char* cms, | |
129 | Float_t sNN, | |
130 | Float_t field, | |
131 | Bool_t mc, | |
132 | UInt_t what, | |
133 | Bool_t force) | |
134 | { | |
7984e5f7 | 135 | // |
136 | // Read in correction based on passed parameters | |
137 | // | |
138 | // Parameters: | |
139 | // collisionSystem Collision system string | |
140 | // cmsNN Center of mass energy per nucleon pair [GeV] | |
141 | // field Magnetic field [kG] | |
142 | // mc Monte-carlo switch | |
143 | // what What to read in | |
144 | // force Force (re-)reading of specified things | |
145 | // | |
146 | // Return: | |
147 | // true on success | |
148 | // | |
0bd4b00f | 149 | UShort_t col = AliForwardUtil::ParseCollisionSystem(cms); |
150 | return Init(col, | |
151 | AliForwardUtil::ParseCenterOfMassEnergy(col, sNN), | |
152 | AliForwardUtil::ParseMagneticField(field), | |
153 | mc, what, force); | |
154 | } | |
155 | ||
156 | //____________________________________________________________________ | |
157 | Bool_t | |
158 | AliForwardCorrectionManager::Init(UShort_t cms, | |
159 | UShort_t sNN, | |
160 | Short_t field, | |
161 | Bool_t mc, | |
162 | UInt_t what, | |
163 | Bool_t force) | |
164 | { | |
7984e5f7 | 165 | // |
166 | // Read in corrections based on the parameters given | |
167 | // | |
168 | // Parameters: | |
169 | // collisionSystem Collision system | |
170 | // cmsNN Center of mass energy per nuclean pair [GeV] | |
171 | // field Magnetic field setting [kG] | |
172 | // mc Monte-carlo switch | |
173 | // what What to read in. | |
174 | // force Force (re-)reading of specified things | |
175 | // | |
176 | // Return: | |
177 | // | |
178 | // | |
0bd4b00f | 179 | if (force) fInit = kFALSE; |
180 | if (fInit) return kTRUE; | |
181 | ||
182 | Bool_t ret = kTRUE; | |
183 | if (fSys == cms && TMath::Abs(fSNN - sNN) < 10 && fField == field) { | |
184 | // We're already initialised for these settings - do nothing and return | |
185 | fInit = kTRUE; | |
186 | return ret; | |
187 | } | |
188 | // Set cached parameters | |
189 | fSys = cms; | |
190 | fSNN = sNN; | |
191 | fField = field; | |
192 | ||
193 | // Read secondary map if requested | |
194 | if (what & kSecondaryMap) { | |
195 | if (!ReadSecondaryMap(cms, sNN, field)) { | |
196 | AliWarning(Form("Failed to read in secondary map for " | |
197 | "cms=%d, sNN=%dGeV, field=%dkG", cms, sNN, field)); | |
198 | ret = kFALSE; | |
199 | } | |
200 | } | |
201 | // Read double hit if requested | |
202 | if (what & kDoubleHit) { | |
203 | if (!ReadDoubleHit(cms, sNN, field)) { | |
204 | AliWarning(Form("Failed to read in double hit correction for " | |
205 | "cms=%d, sNN=%dGeV, field=%dkG", cms, sNN, field)); | |
206 | ret = kFALSE; | |
207 | } | |
208 | } | |
209 | // Read energy loss fits if requested | |
210 | if (what & kELossFits) { | |
211 | if (!ReadELossFits(cms, sNN, field, mc)) { | |
212 | AliWarning(Form("Failed to read in energy loss fits for " | |
213 | "cms=%d, sNN=%dGeV, field=%dkG, %s", | |
214 | cms, sNN, field, mc ? "MC" : "real")); | |
215 | ret = kFALSE; | |
216 | } | |
217 | } | |
72cc12cd | 218 | // Read acceptance correction if requested |
219 | if (what & kAcceptance) { | |
220 | if (!ReadAcceptance(cms, sNN, 0)) { | |
221 | AliWarning(Form("Failed to read in acceptance for " | |
222 | "cms=%d, sNN=%dGeV, field=%dkG", cms, sNN, 0)); | |
223 | ret = kFALSE; | |
224 | } | |
225 | } | |
0bd4b00f | 226 | // Read event selection efficiencies if requested |
227 | if (what & kVertexBias) { | |
228 | if (!ReadVertexBias(cms, sNN, field)) { | |
72cc12cd | 229 | AliWarning(Form("Failed to read in vertex bias correction for " |
0bd4b00f | 230 | "cms=%d, sNN=%dGeV, field=%dkG", cms, sNN, field)); |
231 | ret = kFALSE; | |
232 | } | |
233 | } | |
234 | // Read merging efficiencies if requested | |
235 | if (what & kMergingEfficiency) { | |
236 | if (!ReadMergingEfficiency(cms, sNN, field)) { | |
237 | AliWarning(Form("Failed to read in hit merging efficiency for " | |
238 | "cms=%d, sNN=%dGeV, field=%dkG", | |
239 | cms, sNN, field)); | |
240 | ret = kFALSE; | |
241 | } | |
242 | } | |
243 | fInit = kTRUE; | |
244 | return ret; | |
245 | } | |
246 | ||
247 | //____________________________________________________________________ | |
248 | TString | |
249 | AliForwardCorrectionManager::GetFileName(ECorrection what, | |
250 | UShort_t sys, | |
251 | UShort_t sNN, | |
252 | Short_t field, | |
253 | Bool_t mc) const | |
254 | { | |
7984e5f7 | 255 | // |
256 | // Get the path to the specified object | |
257 | // | |
258 | // Parameters: | |
259 | // what Which stuff to get the path for | |
260 | // sys Collision system | |
261 | // sNN Center of mass energy [GeV] | |
262 | // field Magnetic field in the L3 magnet [kG] | |
263 | // mc Whether the correction objects should be valid for MC | |
264 | // | |
265 | // Return: | |
266 | // The full path or null | |
267 | // | |
0bd4b00f | 268 | TString fname = ""; |
269 | fname = GetObjectName(what); | |
270 | fname.Append(Form("_%s_%04dGeV_%c%1dkG_%s.root", | |
271 | AliForwardUtil::CollisionSystemString(sys), | |
272 | sNN, (field < 0 ? 'm' : 'p'), TMath::Abs(field), | |
273 | (mc ? "MC" : "real"))); | |
274 | return fname; | |
275 | } | |
276 | //____________________________________________________________________ | |
277 | TString | |
278 | AliForwardCorrectionManager::GetFileName(ECorrection what) const | |
279 | { | |
7984e5f7 | 280 | // |
281 | // Get the file name of the specified object | |
282 | // | |
283 | // Parameters: | |
284 | // what Which stuff to get the path for | |
285 | // | |
286 | // Return: | |
287 | // The full path or null | |
288 | // | |
0bd4b00f | 289 | if (!fInit) { |
290 | AliWarning("Corrections manager initialised, do a forced Init(...)"); | |
291 | return ""; | |
292 | } | |
293 | return GetFileName(what, fSys, fSNN, fField, false); | |
294 | } | |
295 | ||
296 | //____________________________________________________________________ | |
297 | const Char_t* | |
298 | AliForwardCorrectionManager::GetFileDir(ECorrection what) const | |
299 | { | |
7984e5f7 | 300 | // |
301 | // Get the path to the specified object | |
302 | // | |
303 | // Parameters: | |
304 | // what Which stuff to get the path for | |
305 | // | |
306 | // Return: | |
307 | // The full path or null | |
308 | // | |
0bd4b00f | 309 | if (what & kSecondaryMap) return fSecondaryMapPath; |
310 | else if (what & kDoubleHit) return fDoubleHitPath; | |
311 | else if (what & kELossFits) return fELossFitsPath; | |
312 | else if (what & kVertexBias) return fVertexBiasPath; | |
313 | else if (what & kMergingEfficiency) return fMergingEffPath; | |
72cc12cd | 314 | else if (what & kAcceptance) return fAcceptancePath; |
0bd4b00f | 315 | |
316 | AliWarning(Form("Unknown correction: %d", what)); | |
317 | return 0; | |
318 | } | |
319 | ||
320 | //____________________________________________________________________ | |
321 | TString | |
322 | AliForwardCorrectionManager::GetFilePath(ECorrection what, | |
323 | UShort_t sys, | |
324 | UShort_t sNN, | |
325 | Short_t field, | |
326 | Bool_t mc) const | |
327 | { | |
7984e5f7 | 328 | // |
329 | // Get the path to the specified object | |
330 | // | |
331 | // Parameters: | |
332 | // what Which stuff to get the path for | |
333 | // sys Collision system | |
334 | // sNN Center of mass energy [GeV] | |
335 | // field Magnetic field in the L3 magnet [kG] | |
336 | // mc Whether the correction objects should be valid for MC | |
337 | // | |
338 | // Return: | |
339 | // The full path or null | |
340 | // | |
0bd4b00f | 341 | TString path = ""; |
342 | const Char_t* dir = GetFileDir(what); | |
343 | if (!dir) return path; | |
344 | ||
345 | TString fname(GetFileName(what, sys, sNN, field, mc)); | |
346 | if (fname.IsNull()) return path; | |
347 | ||
348 | path = gSystem->ConcatFileName(gSystem->ExpandPathName(dir), fname); | |
349 | ||
350 | return path; | |
351 | } | |
352 | //____________________________________________________________________ | |
353 | TString | |
354 | AliForwardCorrectionManager::GetFilePath(ECorrection what) const | |
355 | { | |
7984e5f7 | 356 | // |
357 | // Get the full path to the object. Note, the manager must be | |
358 | // initialised for this to work | |
359 | // | |
360 | // Parameters: | |
361 | // what Which stuff to get the path for | |
362 | // | |
363 | // Return: | |
364 | // The full path or null | |
365 | // | |
0bd4b00f | 366 | if (!fInit) { |
367 | AliWarning("Corrections manager initialised, do a forced Init(...)"); | |
368 | return ""; | |
369 | } | |
370 | return GetFilePath(what, fSys, fSNN, fField, false); | |
371 | } | |
372 | ||
373 | //____________________________________________________________________ | |
374 | TFile* | |
375 | AliForwardCorrectionManager::GetFile(ECorrection what, | |
376 | UShort_t sys, | |
377 | UShort_t sNN, | |
378 | Short_t field, | |
379 | Bool_t mc, | |
380 | Bool_t rw, | |
381 | Bool_t newfile) const | |
382 | { | |
7984e5f7 | 383 | // |
384 | // Open the file that contains the correction object specified | |
385 | // | |
386 | // Parameters: | |
387 | // what Which stuff to get the path for | |
388 | // sys Collision system | |
389 | // sNN Center of mass energy [GeV] | |
390 | // field Magnetic field in the L3 magnet [kG] | |
391 | // mc Whether the correction objects should be valid for MC | |
392 | // rw Whether to open the file in read/write | |
393 | // newfile Wheter to make the file if it doesn't exist | |
394 | // | |
395 | // Return: | |
396 | // The file that contains the correction object or null | |
397 | // | |
0bd4b00f | 398 | TString path = GetFilePath(what, sys, sNN, field, mc); |
399 | if (path.IsNull()) return 0; | |
400 | ||
401 | TString opt; | |
402 | if (newfile) opt="RECREATE"; | |
403 | else { | |
404 | if (gSystem->AccessPathName(path.Data(), | |
405 | (rw ? kWritePermission : kReadPermission))) { | |
406 | AliWarning(Form("file %s cannot be found or insufficient permissions", | |
407 | path.Data())); | |
408 | return 0; | |
409 | } | |
410 | opt=(rw ? "UPDATE" : "READ"); | |
411 | } | |
412 | TFile* file = TFile::Open(path.Data(), opt.Data()); | |
413 | if (!file) { | |
414 | AliWarning(Form("file %s cannot be opened in mode %s", | |
415 | path.Data(), opt.Data())); | |
416 | return 0; | |
417 | } | |
418 | return file; | |
419 | } | |
420 | //____________________________________________________________________ | |
421 | TFile* | |
422 | AliForwardCorrectionManager::GetFile(ECorrection what) const | |
423 | { | |
7984e5f7 | 424 | // |
425 | // Get the file that contains the object specifed. Note, the manager | |
426 | // must be initialised for this to work. | |
427 | // | |
428 | // Parameters: | |
429 | // what Which stuff to get the path for | |
430 | // | |
431 | // Return: | |
432 | // The file that contains the correction object or null | |
433 | // | |
0bd4b00f | 434 | if (!fInit) { |
435 | AliWarning("Corrections manager initialised, do a forced Init(...)"); | |
436 | return 0; | |
437 | } | |
438 | return GetFile(what, fSys, fSNN, fField, false); | |
439 | } | |
440 | ||
441 | //____________________________________________________________________ | |
442 | const Char_t* | |
443 | AliForwardCorrectionManager::GetObjectName(ECorrection what) const | |
444 | { | |
7984e5f7 | 445 | // |
446 | // Get the object name corresponding to correction type | |
447 | // | |
448 | // Parameters: | |
449 | // what Correction | |
450 | // | |
451 | // Return: | |
452 | // Object name or null | |
453 | // | |
0bd4b00f | 454 | if (what & kSecondaryMap) return fgkSecondaryMapSkel; |
455 | else if (what & kDoubleHit) return fgkDoubleHitSkel; | |
456 | else if (what & kELossFits) return fgkELossFitsSkel; | |
457 | else if (what & kVertexBias) return fgkVertexBiasSkel; | |
458 | else if (what & kMergingEfficiency) return fgkMergingEffSkel; | |
72cc12cd | 459 | else if (what & kAcceptance) return fgkAcceptanceSkel; |
0bd4b00f | 460 | return 0; |
461 | } | |
462 | ||
463 | //____________________________________________________________________ | |
464 | TObject* | |
465 | AliForwardCorrectionManager::CheckObject(TFile* file, ECorrection what) const | |
466 | { | |
7984e5f7 | 467 | // |
468 | // Check if the specified objet exists in the file, and return it | |
469 | // | |
470 | // Parameters: | |
471 | // file File to query | |
472 | // what Correction type | |
473 | // | |
474 | // Return: | |
475 | // Object found, or null | |
476 | // | |
0bd4b00f | 477 | TObject* o = file->Get(GetObjectName(what)); |
478 | if (!o) { | |
479 | AliWarning(Form("Object %s not found in %s", | |
480 | GetObjectName(what), file->GetName())); | |
481 | file->Close(); | |
482 | return 0; | |
483 | } | |
484 | return o; | |
485 | } | |
486 | ||
487 | //____________________________________________________________________ | |
488 | TObject* | |
489 | AliForwardCorrectionManager::GetObject(ECorrection what, | |
490 | UShort_t sys, | |
491 | UShort_t sNN, | |
492 | Short_t field, | |
493 | Bool_t mc) const | |
494 | { | |
7984e5f7 | 495 | // |
496 | // Get the path to the specified object | |
497 | // | |
498 | // Parameters: | |
499 | // what Which stuff to get the path for | |
500 | // sys Collision system | |
501 | // sNN Center of mass energy [GeV] | |
502 | // field Magnetic field in the L3 magnet [kG] | |
503 | // mc Whether the correction objects should be valid for MC | |
504 | // | |
505 | // Return: | |
506 | // The full path or null | |
507 | // | |
0bd4b00f | 508 | TFile* file = GetFile(what, sys, sNN, field, mc, false, false); |
509 | if (!file) return 0; | |
510 | ||
511 | return CheckObject(file, what); | |
512 | } | |
513 | //____________________________________________________________________ | |
514 | TObject* | |
515 | AliForwardCorrectionManager::GetObject(ECorrection what) const | |
516 | { | |
7984e5f7 | 517 | // |
518 | // Get the object that contaisn the specified correction | |
519 | // | |
520 | // Parameters: | |
521 | // what Which object to get | |
522 | // | |
523 | // Return: | |
524 | // The object or null | |
525 | // | |
0bd4b00f | 526 | if (!fInit) { |
527 | AliWarning("Corrections manager initialised, do a forced Init(...)"); | |
528 | return 0; | |
529 | } | |
530 | return GetObject(what, fSys, fSNN, fField, false); | |
531 | } | |
532 | ||
533 | ||
534 | //____________________________________________________________________ | |
535 | Bool_t | |
536 | AliForwardCorrectionManager::ReadSecondaryMap(UShort_t sys, UShort_t sNN, | |
537 | Short_t field) | |
538 | { | |
7984e5f7 | 539 | // |
540 | // Read in the secondary map | |
541 | // | |
542 | // Parameters: | |
543 | // sys Collision system | |
544 | // sNN Center of mass energy [GeV] | |
545 | // field Magnetic field in the L3 magnet [kG] | |
546 | // | |
547 | // Return: | |
548 | // True on success, false otherwise | |
549 | // | |
0bd4b00f | 550 | if (fInit) { |
551 | AliWarning("Corrections manager initialised, do a forced Init(...)"); | |
552 | return kFALSE; | |
553 | } | |
554 | ||
555 | TObject* o = GetObject(kSecondaryMap, sys, sNN, field, false); | |
556 | if (!o) return kFALSE; | |
557 | ||
558 | fSecondaryMap = dynamic_cast<AliFMDCorrSecondaryMap*>(o); | |
559 | if (!fSecondaryMap) { | |
560 | AliWarning(Form("Object %s (%p) is not an AliFMDCorrSecondaryMap object, " | |
561 | "but %s", fgkSecondaryMapSkel, o, o->ClassName())); | |
562 | return kFALSE; | |
563 | } | |
564 | ||
565 | // file->Close(); | |
566 | return kTRUE; | |
567 | } | |
568 | //____________________________________________________________________ | |
569 | Bool_t | |
570 | AliForwardCorrectionManager::ReadDoubleHit(UShort_t sys, UShort_t sNN, | |
571 | Short_t field) | |
572 | { | |
7984e5f7 | 573 | // |
574 | // Read in the double hit correction | |
575 | // | |
576 | // Parameters: | |
577 | // sys Collision system | |
578 | // sNN Center of mass energy [GeV] | |
579 | // field Magnetic field in the L3 magnet [kG] | |
580 | // | |
581 | // Return: | |
582 | // True on success, false otherwise | |
583 | // | |
0bd4b00f | 584 | if (fInit) { |
585 | AliWarning("Corrections manager initialised, do a forced Init(...)"); | |
586 | return kFALSE; | |
587 | } | |
588 | ||
589 | TObject* o = GetObject(kDoubleHit, sys, sNN, field, false); | |
590 | if (!o) return kFALSE; | |
591 | ||
592 | fDoubleHit = dynamic_cast<AliFMDCorrDoubleHit*>(o); | |
593 | if (!fDoubleHit) { | |
594 | AliWarning(Form("Object %s (%p) is not an AliFMDCorrDoubleHit object, " | |
595 | "but %s", fgkDoubleHitSkel, o, o->ClassName())); | |
596 | return kFALSE; | |
597 | } | |
598 | ||
599 | // file->Close(); | |
600 | return kTRUE; | |
601 | } | |
602 | ||
603 | //____________________________________________________________________ | |
604 | Bool_t | |
605 | AliForwardCorrectionManager::ReadELossFits(UShort_t sys, UShort_t sNN, | |
606 | Short_t field, Bool_t mc) | |
607 | { | |
7984e5f7 | 608 | // |
609 | // Read in the energy loss fits | |
610 | // | |
611 | // Parameters: | |
612 | // sys Collision system | |
613 | // sNN Center of mass energy [GeV] | |
614 | // field Magnetic field in the L3 magnet [kG] | |
615 | // mc Whether the correction objects should be valid for MC | |
616 | // | |
617 | // Return: | |
618 | // True on success, false otherwise | |
619 | // | |
0bd4b00f | 620 | if (fInit) { |
621 | AliWarning("Corrections manager initialised, do a forced Init(...)"); | |
622 | return kFALSE; | |
623 | } | |
624 | ||
625 | TObject* o = GetObject(kELossFits, sys, sNN, field, mc); | |
626 | if (!o) return kFALSE; | |
627 | ||
628 | fELossFit = dynamic_cast<AliFMDCorrELossFit*>(o); | |
629 | if (!fELossFit) { | |
630 | AliWarning(Form("Object %s (%p) is not an AliFMDCorrELossFit object, " | |
631 | "but %s", fgkELossFitsSkel, o, o->ClassName())); | |
632 | return kFALSE; | |
633 | } | |
634 | ||
635 | // file->Close(); | |
636 | return kTRUE; | |
637 | } | |
638 | ||
639 | //____________________________________________________________________ | |
640 | Bool_t | |
641 | AliForwardCorrectionManager::ReadVertexBias(UShort_t sys, | |
642 | UShort_t sNN, | |
643 | Short_t field) | |
644 | { | |
7984e5f7 | 645 | // |
646 | // Read in the event selection efficiency | |
647 | // | |
648 | // Parameters: | |
649 | // sys Collision system | |
650 | // sNN Center of mass energy [GeV] | |
651 | // field Magnetic field in the L3 magnet [kG] | |
652 | // | |
653 | // Return: | |
654 | // True on success, false otherwise | |
655 | // | |
0bd4b00f | 656 | if (fInit) { |
657 | AliWarning("Corrections manager initialised, do a forced Init(...)"); | |
658 | return kFALSE; | |
659 | } | |
660 | ||
661 | TObject* o = GetObject(kVertexBias, sys, sNN, field, false); | |
662 | if (!o) return kFALSE; | |
663 | ||
664 | fVertexBias = dynamic_cast<AliFMDCorrVertexBias*>(o); | |
665 | if (!fVertexBias) { | |
666 | AliWarning(Form("Object %s (%p) is not an AliFMDCorrVertexBias object, " | |
667 | "but %s", fgkVertexBiasSkel, o, o->ClassName())); | |
668 | return kFALSE; | |
669 | } | |
670 | ||
671 | // file->Close(); | |
672 | return kTRUE; | |
673 | } | |
674 | ||
675 | //____________________________________________________________________ | |
676 | Bool_t | |
677 | AliForwardCorrectionManager::ReadMergingEfficiency(UShort_t sys, | |
678 | UShort_t sNN, | |
679 | Short_t field) | |
680 | { | |
7984e5f7 | 681 | // |
682 | // Read in the merging efficiency | |
683 | // | |
684 | // Parameters: | |
685 | // sys Collision system | |
686 | // sNN Center of mass energy [GeV] | |
687 | // field Magnetic field in the L3 magnet [kG] | |
688 | // | |
689 | // Return: | |
690 | // True on success, false otherwise | |
691 | // | |
0bd4b00f | 692 | if (fInit) { |
693 | AliWarning("Corrections manager initialised, do a forced Init(...)"); | |
694 | return kFALSE; | |
695 | } | |
696 | ||
697 | TObject* o = GetObject(kMergingEfficiency, sys, sNN, field, false); | |
698 | if (!o) return kFALSE; | |
699 | ||
700 | fMergingEfficiency = dynamic_cast<AliFMDCorrMergingEfficiency*>(o); | |
701 | if (!fMergingEfficiency) { | |
702 | AliWarning(Form("Object %s (%p) is not an AliFMDCorrMergingEfficiency " | |
703 | "object, but %s", fgkMergingEffSkel, o, o->ClassName())); | |
704 | return kFALSE; | |
705 | } | |
706 | ||
707 | // file->Close(); | |
708 | return kTRUE; | |
709 | } | |
710 | ||
72cc12cd | 711 | //____________________________________________________________________ |
712 | Bool_t | |
713 | AliForwardCorrectionManager::ReadAcceptance(UShort_t sys, | |
714 | UShort_t sNN, | |
715 | Short_t field) | |
716 | { | |
717 | // | |
718 | // Read in the event selection efficiency | |
719 | // | |
720 | // Parameters: | |
721 | // sys Collision system | |
722 | // sNN Center of mass energy [GeV] | |
723 | // field Magnetic field in the L3 magnet [kG] | |
724 | // | |
725 | // Return: | |
726 | // True on success, false otherwise | |
727 | // | |
728 | if (fInit) { | |
729 | AliWarning("Corrections manager initialised, do a forced Init(...)"); | |
730 | return kFALSE; | |
731 | } | |
732 | ||
733 | TObject* o = GetObject(kAcceptance, sys, sNN, field, false); | |
734 | if (!o) return kFALSE; | |
735 | ||
736 | fAcceptance = dynamic_cast<AliFMDCorrAcceptance*>(o); | |
737 | if (!fAcceptance) { | |
738 | AliWarning(Form("Object %s (%p) is not an AliFMDCorrAcceptance object, " | |
739 | "but %s", fgkAcceptanceSkel, o, o->ClassName())); | |
740 | return kFALSE; | |
741 | } | |
742 | ||
743 | // file->Close(); | |
744 | return kTRUE; | |
745 | } | |
746 | ||
0bd4b00f | 747 | //____________________________________________________________________ |
748 | // | |
749 | // EOF | |
750 | // |