2 // Manager (singleton) of corrections
4 #include "AliForwardCorrectionManagerOADB.h"
5 #include "AliFMDCorrSecondaryMap.h"
6 #include "AliFMDCorrDoubleHit.h"
7 #include "AliFMDCorrELossFit.h"
8 #include "AliFMDCorrVertexBias.h"
9 #include "AliFMDCorrMergingEfficiency.h"
10 #include "AliFMDCorrAcceptance.h"
11 #include "AliForwardUtil.h"
12 #include "AliOADBForward.h"
22 //____________________________________________________________________
23 AliForwardCorrectionManagerOADB* AliForwardCorrectionManagerOADB::fgInstance= 0;
24 const char* AliForwardCorrectionManagerOADB::fgkSecondaryMapSkel = "secondary";
25 const char* AliForwardCorrectionManagerOADB::fgkDoubleHitSkel = "doublehit";
26 const char* AliForwardCorrectionManagerOADB::fgkELossFitsSkel = "elossfits";
27 const char* AliForwardCorrectionManagerOADB::fgkVertexBiasSkel = "vertexbias";
28 const char* AliForwardCorrectionManagerOADB::fgkMergingEffSkel = "merging";
29 const char* AliForwardCorrectionManagerOADB::fgkAcceptanceSkel = "acceptance";
31 #define PREFIX "$(ALICE_ROOT)/OADB/PWGLF/FORWARD/CORRECTIONS/data/"
32 #define DB_NAME "fmd_corrections.root"
34 //____________________________________________________________________
35 AliForwardCorrectionManagerOADB& AliForwardCorrectionManagerOADB::Instance()
38 // Access to the singleton object
41 // Reference to the singleton object
43 if (!fgInstance) fgInstance= new AliForwardCorrectionManagerOADB;
47 //____________________________________________________________________
48 AliForwardCorrectionManagerOADB::AliForwardCorrectionManagerOADB()
57 fELossFitsPath(PREFIX DB_NAME),
58 fMergingEffPath(PREFIX DB_NAME),
59 fSecondaryMapPath(PREFIX DB_NAME),
60 fDoubleHitPath(PREFIX DB_NAME),
61 fVertexBiasPath(PREFIX DB_NAME),
62 fAcceptancePath(PREFIX DB_NAME),
67 fMergingEfficiency(0),
72 // Default constructor
75 //____________________________________________________________________
76 AliForwardCorrectionManagerOADB::AliForwardCorrectionManagerOADB(const AliForwardCorrectionManagerOADB& o)
85 fELossFitsPath(o.fELossFitsPath),
86 fMergingEffPath(o.fMergingEffPath),
87 fSecondaryMapPath(o.fSecondaryMapPath),
88 fDoubleHitPath(o.fDoubleHitPath),
89 fVertexBiasPath(o.fVertexBiasPath),
90 fAcceptancePath(o.fAcceptancePath),
91 fELossFit(o.fELossFit),
92 fSecondaryMap(o.fSecondaryMap),
93 fDoubleHit(o.fDoubleHit),
94 fVertexBias(o.fVertexBias),
95 fMergingEfficiency(o.fMergingEfficiency),
96 fAcceptance(o.fAcceptance),
103 // o Object to copy from
106 //____________________________________________________________________
107 AliForwardCorrectionManagerOADB&
108 AliForwardCorrectionManagerOADB::operator=(const AliForwardCorrectionManagerOADB& o)
111 // Assignment operator
114 // o Object to assign from
117 // Reference to this object
126 fELossFitsPath = o.fELossFitsPath;
127 fMergingEffPath = o.fMergingEffPath;
128 fSecondaryMapPath = o.fSecondaryMapPath;
129 fDoubleHitPath = o.fDoubleHitPath;
130 fVertexBiasPath = o.fVertexBiasPath;
131 fAcceptancePath = o.fAcceptancePath;
132 fELossFit = o.fELossFit;
133 fSecondaryMap = o.fSecondaryMap;
134 fDoubleHit = o.fDoubleHit;
135 fVertexBias = o.fVertexBias;
136 fMergingEfficiency= o.fMergingEfficiency;
137 fAcceptance = o.fAcceptance;
142 //____________________________________________________________________
144 AliForwardCorrectionManagerOADB::SetPrefix(const char* prefix)
148 * @param prefix Prefix to correction objects.
150 fELossFitsPath = Form("%s/%s", prefix, DB_NAME);
151 fMergingEffPath = Form("%s/%s", prefix, DB_NAME);
152 fSecondaryMapPath = Form("%s/%s", prefix, DB_NAME);
153 fDoubleHitPath = Form("%s/%s", prefix, DB_NAME);
154 fVertexBiasPath = Form("%s/%s", prefix, DB_NAME);
155 fAcceptancePath = Form("%s/%s", prefix, DB_NAME);
158 //____________________________________________________________________
160 AliForwardCorrectionManagerOADB::SetFile(ECorrection what, const char* filename)
163 * Set the file directory for a type
166 * @param dirname Directory name
169 if (what & kSecondaryMap) path = &fSecondaryMapPath;
170 else if (what & kDoubleHit) path = &fDoubleHitPath;
171 else if (what & kELossFits) path = &fELossFitsPath;
172 else if (what & kVertexBias) path = &fVertexBiasPath;
173 else if (what & kMergingEfficiency) path = &fMergingEffPath;
174 else if (what & kAcceptance) path = &fAcceptancePath;
176 AliWarning(Form("No such path defined for 0x%02x", what));
180 AliWarning(Form("Couldn't find string for path 0x%02x", what));
186 //____________________________________________________________________
188 AliForwardCorrectionManagerOADB::Init(ULong_t runNo,
198 // Read in correction based on passed parameters
201 // collisionSystem Collision system string
202 // cmsNN Center of mass energy per nucleon pair [GeV]
203 // field Magnetic field [kG]
204 // mc Monte-carlo switch
205 // what What to read in
206 // force Force (re-)reading of specified things
211 UShort_t col = AliForwardUtil::ParseCollisionSystem(sys);
212 // AliInfo(Form("Initialising with cms='%s', sNN=%fGeV field=%fkG",
213 // cms, sNN, field));
214 return Init(runNo, col,
215 AliForwardUtil::ParseCenterOfMassEnergy(col, sNN),
216 AliForwardUtil::ParseMagneticField(field),
217 mc, sat, what, force);
220 //____________________________________________________________________
222 AliForwardCorrectionManagerOADB::Init(ULong_t runNo,
232 // Read in corrections based on the parameters given
235 // collisionSystem Collision system
236 // cmsNN Center of mass energy per nuclean pair [GeV]
237 // field Magnetic field setting [kG]
238 // mc Monte-carlo switch
239 // what What to read in.
240 // force Force (re-)reading of specified things
245 if (force) fInit = kFALSE;
247 // We should always open the database, since we're not
248 // streamingthat object to disk.
249 fDB = new AliOADBForward;
252 // Check that the initialisation and the passed parameters
253 // match - if not give an error but continue - this allows
254 // users to override particular settings.
256 AliInfo("We are already initialised - checking settings...");
258 if (fRunNo != runNo) {
262 AliWarningF("Initialised collision system %s (%d) and "
263 "passed same %s (%d) does not match",
264 AliForwardUtil::CollisionSystemString(fSys), fSys,
265 AliForwardUtil::CollisionSystemString(sys), sys);
268 if (TMath::Abs(fSNN - sNN) >= 10) {
269 AliWarningF("Initialised center of mass energy per nuclean "
270 "%s (%d) and passed same %s (%d) does not match",
271 AliForwardUtil::CenterOfMassEnergyString(fSNN), fSNN,
272 AliForwardUtil::CenterOfMassEnergyString(sNN), sNN);
275 if (fField != field) {
276 AliWarningF("Initialied L3 magnetic field %s (%d) and passed "
277 "same %s (%d) does not match",
278 AliForwardUtil::MagneticFieldString(fField), fField,
279 AliForwardUtil::MagneticFieldString(field), field);
283 AliWarningF("Initialied data type (%s) and passed "
284 "same (%s) does not match",
285 (fMC ? "MC" : "real"), (mc ? "MC" : "real"));
289 AliWarningF("Initialied collision ip type (%s) and passed "
290 "same (%s) does not match",
291 (fSat ? "satelitte" : "nominal"),
292 (sat ? "satellite" : "nominal"));
296 AliWarning("Intialised parameters and these are not the same "
297 "- PROCEED WITH CAUTION!");
300 AliInfo("Initialized values consistent with data");
306 if (fRunNo == runNo &&
311 TMath::Abs(fSNN - sNN) < 10) {
312 // We're already initialised for these settings - do nothing and return
316 // Set cached parameters
324 // AliInfo(Form("Initialising with cms=%d, sNN=%dGeV field=%dkG",
325 // cms, sNN, field));
326 // Read secondary map if requested
327 if (what & kSecondaryMap) {
328 if (!ReadSecondaryMap(runNo, sys, sNN, field, sat)) {
329 AliWarningF("Failed to read in secondary map for "
330 "run=%lu, sys=%hu, sNN=%huGeV, field=%hdkG, %s",
331 runNo, sys, sNN, field, (sat ? "satellite" : "nominal"));
335 // Read double hit if requested
336 if (what & kDoubleHit) {
337 if (!ReadDoubleHit(runNo, sys, sNN, field, sat)) {
338 AliWarningF("Failed to read in double hit correction for "
339 "run=%lu, sys=%hu, sNN=%huGeV, field=%hdkG, %s",
340 runNo, sys, sNN, field, (sat ? "satellite" : "nominal"));
344 // Read energy loss fits if requested
345 if (what & kELossFits) {
346 if (!ReadELossFits(runNo, sys, sNN, field, mc, sat)) {
347 AliWarningF("Failed to read in energy loss fits for "
348 "run=%lu, sys=%hu, sNN=%huGeV, field=%hdkG, %s, %s",
349 runNo, sys, sNN, field, mc ? "MC" : "real",
350 (sat ? "satellite" : "nominal"));
354 // Read acceptance correction if requested
355 if (what & kAcceptance) {
356 if (!ReadAcceptance(runNo, sys, sNN, sat)) {
357 AliWarningF("Failed to read in acceptance for "
358 "run=%lu, sys=%hu, sNN=%huGeV, %s",
359 runNo, sys, sNN, (sat ? "satellite" : "nominal"));
363 // Read event selection efficiencies if requested
364 if (what & kVertexBias) {
365 if (!ReadVertexBias(runNo, sys, sNN, field, sat)) {
366 AliWarningF("Failed to read in vertex bias correction for "
367 "run=%lu, sys=%hu, sNN=%huGeV, field=%hdkG, %s",
368 runNo, sys, sNN, field, (sat ? "satellite" : "nominal"));
372 // Read merging efficiencies if requested
373 if (what & kMergingEfficiency) {
374 if (!ReadMergingEfficiency(runNo, sys, sNN, field, sat)) {
375 AliWarningF("Failed to read in hit merging efficiency for "
376 "run=%lu, sys=%hu, sNN=%huGeV, field=%hdkG, %s",
377 runNo, sys, sNN, field, (sat ? "satellite" : "nominal"));
384 //____________________________________________________________________
386 AliForwardCorrectionManagerOADB::GetEtaAxis() const
388 if (!fSecondaryMap) return 0;
389 return &(fSecondaryMap->GetEtaAxis());
391 //____________________________________________________________________
393 AliForwardCorrectionManagerOADB::GetVertexAxis() const
395 if (!fSecondaryMap) return 0;
396 return &(fSecondaryMap->GetVertexAxis());
399 //____________________________________________________________________
401 AliForwardCorrectionManagerOADB::GetFileName(ECorrection what) const
404 // Get the path to the specified object
407 // what Which stuff to get the path for
408 // sys Collision system
409 // sNN Center of mass energy [GeV]
410 // field Magnetic field in the L3 magnet [kG]
411 // mc Whether the correction objects should be valid for MC
414 // The full path or null
416 return gSystem->BaseName(GetFilePath(what));
418 //____________________________________________________________________
420 AliForwardCorrectionManagerOADB::GetFileDir(ECorrection what) const
423 // Get the path to the specified object
426 // what Which stuff to get the path for
429 // The full path or null
431 return gSystem->DirName(GetFilePath(what));
434 //____________________________________________________________________
436 AliForwardCorrectionManagerOADB::GetFilePath(ECorrection what) const
439 // Get the full path to the object. Note, the manager must be
440 // initialised for this to work
443 // what Which stuff to get the path for
446 // The full path or null
449 case kSecondaryMap: return fSecondaryMapPath;
450 case kDoubleHit: return fDoubleHitPath;
451 case kELossFits: return fELossFitsPath;
452 case kVertexBias: return fVertexBiasPath;
453 case kMergingEfficiency: return fMergingEffPath;
454 case kAcceptance: return fAcceptancePath;
462 //____________________________________________________________________
464 AliForwardCorrectionManagerOADB::GetObjectName(ECorrection what) const
467 // Get the object name corresponding to correction type
473 // Object name or null
476 case kSecondaryMap: return fgkSecondaryMapSkel;
477 case kDoubleHit: return fgkDoubleHitSkel;
478 case kELossFits: return fgkELossFitsSkel;
479 case kVertexBias: return fgkVertexBiasSkel;
480 case kMergingEfficiency: return fgkMergingEffSkel;
481 case kAcceptance: return fgkAcceptanceSkel;
487 //____________________________________________________________________
489 AliForwardCorrectionManagerOADB::GetObjectClass(ECorrection what) const
492 // Get the object name corresponding to correction type
498 // Object name or null
501 case kSecondaryMap: return AliFMDCorrSecondaryMap::Class();
502 case kDoubleHit: return AliFMDCorrDoubleHit::Class();
503 case kELossFits: return AliFMDCorrELossFit::Class();
504 case kVertexBias: return AliFMDCorrVertexBias::Class();
505 case kMergingEfficiency: return AliFMDCorrMergingEfficiency::Class();
506 case kAcceptance: return AliFMDCorrAcceptance::Class();
511 //____________________________________________________________________
512 AliForwardCorrectionManagerOADB::ECorrection
513 AliForwardCorrectionManagerOADB::GetObjectType(const TString& what) const
518 if (w.EqualTo(GetObjectName(kSecondaryMap)))
519 return kSecondaryMap;
520 else if (w.EqualTo(GetObjectName(kDoubleHit)))
522 else if (w.EqualTo(GetObjectName(kELossFits)))
524 else if (w.EqualTo(GetObjectName(kVertexBias)))
526 else if (w.EqualTo(GetObjectName(kMergingEfficiency)))
527 return kMergingEfficiency;
528 else if (w.EqualTo(GetObjectName(kAcceptance)))
533 //____________________________________________________________________
534 AliForwardCorrectionManagerOADB::ECorrection
535 AliForwardCorrectionManagerOADB::GetObjectType(const TObject* obj) const
537 TClass* cl = obj->IsA();
539 if (cl->InheritsFrom(GetObjectClass(kSecondaryMap)))
540 return kSecondaryMap;
541 else if (cl->InheritsFrom(GetObjectClass(kDoubleHit)))
543 else if (cl->InheritsFrom(GetObjectClass(kELossFits)))
545 else if (cl->InheritsFrom(GetObjectClass(kVertexBias)))
547 else if (cl->InheritsFrom(GetObjectClass(kMergingEfficiency)))
548 return kMergingEfficiency;
549 else if (cl->InheritsFrom(GetObjectClass(kAcceptance)))
555 //____________________________________________________________________
557 AliForwardCorrectionManagerOADB::GetObject(ECorrection what,
566 // Get the path to the specified object
569 // what Which stuff to get the path for
570 // sys Collision system
571 // sNN Center of mass energy [GeV]
572 // field Magnetic field in the L3 magnet [kG]
573 // mc Whether the correction objects should be valid for MC
576 // The full path or null
579 AliWarning("Database not opened");
582 TString tableName = GetObjectName(what);
583 if (!fDB->FindTable(tableName, true)) {
584 if (!fDB->Open(GetFilePath(what), tableName, false, true)) {
585 AliWarningF("Failed to open table %s from %s",
586 tableName.Data(), GetFilePath(what).Data());
591 TObject* o = fDB->GetData(GetObjectName(what), runNo,
592 AliOADBForward::kDefault,
593 sys, sNN, field, mc, sat);
597 //____________________________________________________________________
599 AliForwardCorrectionManagerOADB::GetObject(ECorrection what) const
602 // Get the object that contaisn the specified correction
605 // what Which object to get
608 // The object or null
611 AliWarning("Corrections manager initialised, do a forced Init(...)");
615 return GetObject(what, fRunNo, fSys, fSNN, fField, fMC, fSat);
618 #define CHECK_TYPE(O,RET,CL) do { \
619 RET = dynamic_cast<CL*>(O); \
620 if (!O) AliWarningF("%p is not a pointer to a %s object, but a %s", \
621 O, #CL, O->ClassName()); } while (false)
623 //____________________________________________________________________
625 AliForwardCorrectionManagerOADB::ReadSecondaryMap(ULong_t runNo,
632 // Read in the secondary map
635 // sys Collision system
636 // sNN Center of mass energy [GeV]
637 // field Magnetic field in the L3 magnet [kG]
640 // True on success, false otherwise
643 AliWarning("Corrections manager initialised, do a forced Init(...)");
647 TObject* o = GetObject(kSecondaryMap, runNo, sys, sNN, field, false, sat);
648 if (!o) return kFALSE;
650 CHECK_TYPE(o, fSecondaryMap, AliFMDCorrSecondaryMap);
651 if (!fSecondaryMap) return kFALSE;
655 //____________________________________________________________________
657 AliForwardCorrectionManagerOADB::ReadDoubleHit(ULong_t runNo,
664 // Read in the double hit correction
667 // sys Collision system
668 // sNN Center of mass energy [GeV]
669 // field Magnetic field in the L3 magnet [kG]
672 // True on success, false otherwise
675 AliWarning("Corrections manager initialised, do a forced Init(...)");
679 TObject* o = GetObject(kDoubleHit, runNo, sys, sNN, field, false, sat);
680 if (!o) return kFALSE;
682 CHECK_TYPE(o, fDoubleHit, AliFMDCorrDoubleHit);
683 if (!fDoubleHit) return kFALSE;
688 //____________________________________________________________________
690 AliForwardCorrectionManagerOADB::ReadELossFits(ULong_t runNo,
698 // Read in the energy loss fits
701 // sys Collision system
702 // sNN Center of mass energy [GeV]
703 // field Magnetic field in the L3 magnet [kG]
704 // mc Whether the correction objects should be valid for MC
707 // True on success, false otherwise
710 AliWarning("Corrections manager initialised, do a forced Init(...)");
714 TObject* o = GetObject(kELossFits, runNo, sys, sNN, field, mc, sat);
715 if (!o) return kFALSE;
717 CHECK_TYPE(o, fELossFit, AliFMDCorrELossFit);
718 if (!fELossFit) return kFALSE;
723 //____________________________________________________________________
725 AliForwardCorrectionManagerOADB::ReadVertexBias(ULong_t runNo,
732 // Read in the event selection efficiency
735 // sys Collision system
736 // sNN Center of mass energy [GeV]
737 // field Magnetic field in the L3 magnet [kG]
740 // True on success, false otherwise
743 AliWarning("Corrections manager initialised, do a forced Init(...)");
747 TObject* o = GetObject(kVertexBias, runNo, sys, sNN, field, false, sat);
748 if (!o) return kFALSE;
750 CHECK_TYPE(o, fVertexBias, AliFMDCorrVertexBias);
751 if (!fVertexBias) return kFALSE;
756 //____________________________________________________________________
758 AliForwardCorrectionManagerOADB::ReadMergingEfficiency(ULong_t runNo,
765 // Read in the merging efficiency
768 // sys Collision system
769 // sNN Center of mass energy [GeV]
770 // field Magnetic field in the L3 magnet [kG]
773 // True on success, false otherwise
776 AliWarning("Corrections manager initialised, do a forced Init(...)");
780 TObject* o = GetObject(kMergingEfficiency, runNo, sys, sNN, field, false,sat);
781 if (!o) return kFALSE;
783 CHECK_TYPE(o, fMergingEfficiency, AliFMDCorrMergingEfficiency);
784 if (!fMergingEfficiency) return kFALSE;
789 //____________________________________________________________________
791 AliForwardCorrectionManagerOADB::ReadAcceptance(ULong_t runNo,
797 // Read in the event selection efficiency
800 // sys Collision system
801 // sNN Center of mass energy [GeV]
802 // field Magnetic field in the L3 magnet [kG]
805 // True on success, false otherwise
808 AliWarning("Corrections manager initialised, do a forced Init(...)");
812 TObject* o = GetObject(kAcceptance, runNo, sys, sNN, 0, false, sat);
813 if (!o) return kFALSE;
815 CHECK_TYPE(o, fAcceptance, AliFMDCorrAcceptance);
816 if (!fAcceptance) return kFALSE;
820 //____________________________________________________________________
822 AliForwardCorrectionManagerOADB::Print(Option_t* option) const
827 char ind[gROOT->GetDirLevel()+1];
828 for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
829 ind[gROOT->GetDirLevel()] = '\0';
831 std::cout << ind << "AliForwardCorrectionManagerOADB:\n"
832 << ind << " Initialised: "
833 << (fInit ? "yes" : "no") << std::endl;
835 std::cout << ind << " Run number: " << fRunNo << "\n"
836 << ind << " Collision system: "
837 << AliForwardUtil::CollisionSystemString(fSys) << "\n"
838 << ind << " Sqrt(s_NN): "
839 << AliForwardUtil::CenterOfMassEnergyString(fSNN) << "\n"
840 << ind << " Magnetic field: "
841 << AliForwardUtil::MagneticFieldString(fField) << "\n"
842 << ind << " For simulations: " << (fMC ? "yes" : "no") << "\n"
843 << ind << " For satellites: " << (fSat ? "yes" : "no") << "\n"
845 std::cout << ind << " Paths:\n"
846 << ind << " ELoss Fits: " << fELossFitsPath << "\n"
847 << ind << " Merging eff.: " << fMergingEffPath << "\n"
848 << ind << " Secondary maps: " << fSecondaryMapPath << "\n"
849 << ind << " 2-hit corr.: " << fSecondaryMapPath << "\n"
850 << ind << " Vertex bias: " << fVertexBiasPath << "\n"
851 << ind << " Acceptance: " << fAcceptancePath << std::endl;
854 if (!opt.Contains("R")) return;
856 gROOT->IncreaseDirLevel();
857 if (fELossFit) fELossFit->Print(option);
859 std::cout << ind << " Energy loss fits not initialised" << std::endl;
861 if (fSecondaryMap) fSecondaryMap->Print(option);
863 std::cout << ind << " Secondary particle correction not initialised"
866 if (fDoubleHit) fDoubleHit->Print(option);
868 std::cout << ind << " Double hit corr. not initialised" << std::endl;
870 if (fVertexBias) fVertexBias->Print(option);
872 std::cout << ind << " Vertex bias correction not initialised" << std::endl;
873 if (fMergingEfficiency) fMergingEfficiency->Print(option);
875 std::cout << ind << " Merging eff. not initialised" << std::endl;
877 if (fAcceptance) fAcceptance->Print(option);
879 std::cout << ind << " Acceptance corr. not initialised" << std::endl;
880 gROOT->DecreaseDirLevel();
883 //____________________________________________________________________
885 AliForwardCorrectionManagerOADB::Browse(TBrowser* b)
890 if (fELossFit) b->Add(fELossFit, "Energy loss fits");
891 if (fSecondaryMap) b->Add(fSecondaryMap, "Secondary particle corr");
892 if (fDoubleHit) b->Add(fDoubleHit, "Double hit corr");
893 if (fVertexBias) b->Add(fVertexBias, "Vertex bias corr");
894 if (fMergingEfficiency) b->Add(fMergingEfficiency, "Merging eff");
895 if (fAcceptance) b->Add(fAcceptance, "Acceptance corr");
898 //____________________________________________________________________
900 AliForwardCorrectionManagerOADB::StoreObject(ULong_t runNo,
908 const char* meth) const
910 ECorrection what = GetObjectType(obj);
912 AliErrorF("Cannot deduce the correction type from object of class %s",
916 return StoreObject(what, runNo, sys, sNN, fld, mc, sat, obj, full, meth);
918 //____________________________________________________________________
920 AliForwardCorrectionManagerOADB::StoreObject(const TString& what,
929 const char* meth) const
931 return StoreObject(GetObjectType(what), runNo, sys,
932 sNN, fld, mc, sat, obj, full, meth);
935 //____________________________________________________________________
937 AliForwardCorrectionManagerOADB::StoreObject(ECorrection what,
946 const char* meth) const
949 // Write correction output to (a temporary) file
952 // What What to write
953 // sys Collision system (1: pp, 2: PbPb)
954 // sNN Center of mass energy per nucleon (GeV)
957 // obj Object to write
958 // full if true, write to full path, otherwise locally
962 TString tableName = GetObjectName(what);
963 Bool_t local = !(full && fDB);
964 TString fileName = (local ? DB_NAME : GetFilePath(what));
965 AliOADBForward* db = (local ? new AliOADBForward : fDB);
966 ECorrection otype = GetObjectType(obj);
968 AliErrorF("Correction type 0x%02x (%s) and type of object 0x%02x (%s) "
969 "does not match", what, tableName.Data(), otype,
974 if (!db->Open(fileName, Form("%s/%s", tableName.Data(), meth), true, true)) {
976 "Failed to open table %s/%s in %s for read+write (%s)",
977 tableName.Data(), meth, fileName.Data(),
978 (local ? "local" : "global"));
982 // Filter out fields we do not need
984 case kELossFits: break; // Need all fields
985 case kDoubleHit: sat = false; break; // Depreacted
986 case kAcceptance: fld = 0; // Fall through
987 case kSecondaryMap: // Fall through
988 case kVertexBias: // Fall through
989 case kMergingEfficiency: mc = false; break; // No specific for MC
990 default: break; // Never here
994 if (!db->Insert(tableName, obj, runNo, sys, sNN, fld, mc, sat)) {
995 AliErrorF("Failed to write %s to database for "
996 "table=%s run=%lu, sys=%hu, sNN=%hu, field=%hd, mc=%d, sat=%d",
997 obj->GetName(), tableName.Data(), runNo, sys, sNN,
1006 AliInfoF("Correction object %s written to DB in %s - merge this with "
1007 "%s to store for good", obj->GetName(), DB_NAME,
1008 GetFilePath(what).Data());
1014 //______________________________________________________________________________
1015 void AliForwardCorrectionManagerOADB::Streamer(TBuffer &R__b)
1018 // Stream an object of class AliForwardCorrectionManagerOADB.
1020 if (R__b.IsReading()) {
1021 R__b.ReadClassBuffer(AliForwardCorrectionManagerOADB::Class(),this);
1023 AliWarning(Form("Singleton instance already set (%p) when reading "
1024 "singleton object (%p). Read object will be new "
1025 "singleton object", fgInstance, this));
1028 R__b.WriteClassBuffer(AliForwardCorrectionManagerOADB::Class(),this);
1033 //______________________________________________________________________________
1034 void AliForwardCorrectionManagerOADB::Streamer(TBuffer &R__b)
1036 // Stream an object of class AliForwardCorrectionManagerOADB.
1039 if (R__b.IsReading()) {
1040 Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
1041 TObject::Streamer(R__b);
1046 fELossFitsPath.Streamer(R__b);
1047 fMergingEffPath.Streamer(R__b);
1048 fSecondaryMapPath.Streamer(R__b);
1049 fDoubleHitPath.Streamer(R__b);
1050 fVertexBiasPath.Streamer(R__b);
1051 fAcceptancePath.Streamer(R__b);
1053 R__b >> fSecondaryMap;
1055 R__b >> fVertexBias;
1056 R__b >> fMergingEfficiency;
1057 R__b >> fAcceptance;
1058 R__b.CheckByteCount(R__s, R__c, AliForwardCorrectionManagerOADB::IsA());
1060 R__c = R__b.WriteVersion(AliForwardCorrectionManagerOADB::IsA(), kTRUE);
1061 TObject::Streamer(R__b);
1066 fELossFitsPath.Streamer(R__b);
1067 fMergingEffPath.Streamer(R__b);
1068 fSecondaryMapPath.Streamer(R__b);
1069 fDoubleHitPath.Streamer(R__b);
1070 fVertexBiasPath.Streamer(R__b);
1071 fAcceptancePath.Streamer(R__b);
1073 R__b << fSecondaryMap;
1075 R__b << fVertexBias;
1076 R__b << fMergingEfficiency;
1077 R__b << fAcceptance;
1078 R__b.SetByteCount(R__c, kTRUE);
1083 //____________________________________________________________________