8 #include "ERNXyterCalibrator.h" 17 ERNXyterCalibrator::ERNXyterCalibrator() {
18 fConstructed = kFALSE;
22 ERNXyterCalibrator::~ERNXyterCalibrator() {
26 void ERNXyterCalibrator::Deconstruct(
void) {
31 fConstructed = kFALSE;
35 UInt_t ERNXyterCalibrator::ImportGraphs(TString graphFile) {
42 TFile fr(graphFile.Data());
44 TObject::Error(
"ERNXyterCalibrator::ImportGraphs",
"Error opening file %s", graphFile.Data());
48 TList *gList = fr.GetListOfKeys();
49 const Int_t nEntries = gList->GetEntries();
51 Error(
"ERNXyterCalibrator::ImportGraphs",
"Something wrong, only %d graphs found instead of 64.", nEntries);
56 for (Int_t i=0; i<nEntries; i++) {
57 gName.Form(
"gcal%d", i);
58 fGraph[i] = (TGraph*)fr.Get(gName.Data());
60 Error(
"ERNXyterCalibrator::ImportGraphs",
"Graph %s was not found in file %s", gName.Data(), fr.GetName());
80 Float_t ERNXyterCalibrator::GetCalibratedVal(UInt_t ch, Float_t val) {
83 if (ch>=64)
return 0.;
87 if (fGraph[ch] == NULL)
return (Float_t)val;
89 return (Float_t)fGraph[ch]->Eval(val);