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