fMC(false),
fSatellite(false),
fDB(0),
- fDebug(false)
+ fDebug(false),
+ fFallBack(false)
{
}
fMC(false),
fSatellite(false),
fDB(0),
- fDebug(false)
+ fDebug(false),
+ fFallBack(false)
{
fCorrections.SetOwner(false);
fCorrections.SetName("corrections");
fMC(o.fMC),
fSatellite(o.fSatellite),
fDB(o.fDB),
- fDebug(o.fDebug)
+ fDebug(o.fDebug),
+ fFallBack(o.fFallBack)
{
fCorrections.SetOwner(false);
Int_t n = o.fCorrections.GetEntriesFast();
fSatellite = o.fSatellite;
fDB = o.fDB;
fDebug = o.fDebug;
+ fFallBack = o.fFallBack;
fCorrections.Clear();
Int_t n = o.fCorrections.GetEntriesFast();
// fCorrections.Delete();
}
+#define PF(N,V,...) \
+ AliForwardUtil::PrintField(N,V, ## __VA_ARGS__)
+#define PFB(N,FLAG) \
+ do { \
+ AliForwardUtil::PrintName(N); \
+ std::cout << std::boolalpha << (FLAG) << std::noboolalpha << std::endl; \
+ } while(false)
+#define PFV(N,VALUE) \
+ do { \
+ AliForwardUtil::PrintName(N); \
+ std::cout << (VALUE) << std::endl; } while(false)
+
//____________________________________________________________________
void
AliCorrectionManagerBase::Print(Option_t* option) const
{
- char ind[gROOT->GetDirLevel()+1];
- for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
- ind[gROOT->GetDirLevel()] = '\0';
-
- std::cout << ind << GetName() << ":\n"
- << ind << " Initialised: "
- << (fIsInit ? "yes" : "no") << std::endl;
- if (fIsInit)
- std::cout << ind << " Run number: " << fRun << "\n"
- << ind << " Collision system: "
- << AliForwardUtil::CollisionSystemString(fSys) << "\n"
- << ind << " Sqrt(s_NN): "
- << AliForwardUtil::CenterOfMassEnergyString(fSNN) << "\n"
- << ind << " Magnetic field: "
- << AliForwardUtil::MagneticFieldString(fField) << "\n"
- << ind << " For simulations: " << (fMC ? "yes" : "no") << "\n"
- << ind << " For satellites: "
- << (fSatellite ? "yes" : "no") << std::endl;
-
+ AliForwardUtil::PrintTask(*this);
+ gROOT->IncreaseDirLevel();
+ PFB("Initialized", fIsInit);
+ if (fIsInit) {
+ PFV("Run number", fRun);
+ PFV("Collision system", AliForwardUtil::CollisionSystemString(fSys));
+ PFV("Sqrt(s_NN)",AliForwardUtil::CenterOfMassEnergyString(fSNN));
+ PFV("Magnetic field", AliForwardUtil::MagneticFieldString(fField));
+ PFB("For simulations", fMC);
+ PFB("For satellites", fSatellite);
+ }
TString opt(option);
opt.ToUpper();
- if (!opt.Contains("R")) return;
-
- gROOT->IncreaseDirLevel();
- Int_t n = fCorrections.GetEntriesFast();
- for (Int_t id = 0; id < n; id++) {
- const Correction* c = GetCorrection(id);
- c->Print(option);
+ if (opt.Contains("R")) {
+ // gROOT->IncreaseDirLevel();
+ Int_t n = fCorrections.GetEntriesFast();
+ for (Int_t id = 0; id < n; id++) {
+ const Correction* c = GetCorrection(id);
+ c->Print(option);
+ }
+ // gROOT->DecreaseDirLevel();
}
gROOT->DecreaseDirLevel();
-
}
//____________________________________________________________________
return true;
}
+//____________________________________________________________________
+void
+AliCorrectionManagerBase::EnableCorrections(UInt_t what)
+{
+ for (Int_t i = 0; i < 32; i++) {
+ if (!GetCorrection(i)) continue;
+ EnableCorrection(i, (1 << i) & what);
+ }
+}
+//____________________________________________________________________
+Bool_t
+AliCorrectionManagerBase::CheckCorrections(UInt_t what, Bool_t verbose) const
+{
+ Bool_t ret = true;
+ for (Int_t i = 0; i < 32; i++) {
+ Bool_t enabled = (1 << i) & what;
+ if (!enabled) continue;
+ const Correction* c = GetCorrection(i);
+ if (!c) {
+ ret = false;
+ if (verbose)
+ AliWarningF("No correction registered for bit %d", i);
+ continue;
+ }
+ const TObject* o = c->Get();
+ if (!o) {
+ ret = false;
+ if (verbose)
+ AliWarningF("Correction %s (bit %d) not initialized!", c->GetName(), i);
+ continue;
+ }
+ }
+ return ret;
+}
+
//____________________________________________________________________
void
AliCorrectionManagerBase::RegisterCorrection(Int_t id, Correction* corr)
Correction* c = GetCorrection(id);
if (!c->fEnabled) return true;
- return c->ReadIt(fDB, run, sys, sNN, fld, mc, sat, fDebug);
+ return c->ReadIt(fDB, run, sys, sNN, fld, mc, sat, fDebug, fFallBack);
}
//____________________________________________________________________
Short_t fld,
Bool_t mc,
Bool_t sat,
- Bool_t vrb)
+ Bool_t vrb,
+ Bool_t fallback)
{
if (!fEnabled) {
AliWarningF("Correction %s not enabled", GetName());
if (!(fQueryFields & kRun)) run = kIgnoreValue;
if (!(fQueryFields & kSys)) sys = kIgnoreValue;
if (!(fQueryFields & kSNN)) sNN = kIgnoreValue;
- if (!(fQueryFields & kField)) fld = kIgnoreField;
+ if (!(fQueryFields & kField)) fld = AliOADBForward::kInvalidField; // kIgnoreField;
if (!(fQueryFields & kMC)) mc = false;
if (!(fQueryFields & kSatellite)) sat = false;
// Check if table is open, and if not try to open it
if (!db->FindTable(fName, true)) {
- if (!db->Open(fTitle, fName, false, vrb)) {
+ if (!db->Open(fTitle, fName, false, vrb, fallback)) {
AliWarningF("Failed to open table %s from %s", GetName(), GetTitle());
AliWarningF("content of %s for %s:",
gSystem->WorkingDirectory(), GetName());
if (!(fQueryFields & kRun)) run = kIgnoreValue;
if (!(fQueryFields & kSys)) sys = kIgnoreValue;
if (!(fQueryFields & kSNN)) sNN = kIgnoreValue;
- if (!(fQueryFields & kField)) fld = kIgnoreField;
+ if (!(fQueryFields & kField)) fld = AliOADBForward::kInvalidField; // kIgnoreField;
if (!(fQueryFields & kMC)) mc = false;
if (!(fQueryFields & kSatellite)) sat = false;
void
AliCorrectionManagerBase::Correction::Print(Option_t* option) const
{
- char ind[gROOT->GetDirLevel()+1];
- for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
- ind[gROOT->GetDirLevel()] = '\0';
-
- std::cout << ind << GetName() << ": " << (fEnabled ? "en" : "dis")
- << "abled" << std::endl;
- if (!fEnabled) return;
+ AliForwardUtil::PrintTask(*this);
+ gROOT->IncreaseDirLevel();
+ PFB("Enabled", fEnabled);
+ if (!fEnabled) {
+ gROOT->DecreaseDirLevel();
+ return;
+ }
TString flds;
if (fQueryFields & kRun) flds.Append("run");
const TClass* cl = TheClass();
- std::cout << " Path: " << GetTitle() << "\n"
- << " Data class: " << cl->GetName() << "\n"
- << " Query fields: " << flds << std::endl;
+ PFV("Path",GetTitle());
+ PFV("Data class", cl->GetName());
+ PFV("Query fields", flds);
- if (fObject && !fLastEntry.IsNull())
- std::cout << " Entry: " << fLastEntry << std::endl;
+ if (fObject && !fLastEntry.IsNull()) PF("Entry", fLastEntry);
TString opt(option);
opt.ToUpper();
- if (!opt.Contains("D")) return;
-
- gROOT->IncreaseDirLevel();
- fObject->Print();
+ if (opt.Contains("D") && fObject) {
+ gROOT->IncreaseDirLevel();
+ fObject->Print();
+ gROOT->DecreaseDirLevel();
+ }
gROOT->DecreaseDirLevel();
}