10#include <cdc/dbobjects/CDCDedxDatabaseImporter.h>
11#include <cdc/dbobjects/CDCDedxScaleFactor.h>
12#include <cdc/dbobjects/CDCDedxHadronCor.h>
13#include <cdc/dbobjects/CDCDedxMeanPars.h>
14#include <cdc/dbobjects/CDCDedxSigmaPars.h>
17#include <framework/logging/Logger.h>
18#include <framework/database/IntervalOfValidity.h>
19#include <framework/database/Database.h>
27#include <TClonesArray.h>
41 TClonesArray scaleFactor(
"Belle2::CDCDedxScaleFactor");
51 TClonesArray hadronCorrection(
"Belle2::CDCDedxHadronCor");
58 TFile* f = TFile::Open(inputFile.c_str(),
"READ");
60 TIter next(f->GetListOfKeys());
62 while ((key = (TKey*) next())) {
64 std::string histconstants = key->GetName();
66 if (histconstants.compare(
"CDCDedxHadronCor") == 0) {
67 parhist = (TH1F*)f->Get(histconstants.c_str());
68 B2INFO(
"Key name matches: " << histconstants);
72 B2WARNING(
"Key name does not match: " << histconstants);
80 if (nFiles != 1) { B2FATAL(
"Sorry, you must only import one file at a time for now!"); }
83 if (!parhist) B2FATAL(
"None of the input files contains the histogram called 'CDCDedxHadronCor'!");
84 short version = parhist->GetBinContent(1);
85 std::vector<double> hadroncor;
86 for (
int bin = 2; bin <= parhist->GetNbinsX(); ++bin) {
87 hadroncor.push_back(parhist->GetBinContent(bin));
98 TClonesArray meanParameters(
"Belle2::CDCDedxMeanPars");
105 TFile* f = TFile::Open(inputFile.c_str(),
"READ");
107 TIter next(f->GetListOfKeys());
109 while ((key = (TKey*) next())) {
111 std::string histconstants = key->GetName();
113 if (histconstants.compare(
"CDCDedxMeanPars") == 0) {
114 parhist = (TH1F*)f->Get(histconstants.c_str());
115 B2INFO(
"Key name matches: " << histconstants);
119 B2WARNING(
"Key name does not match: " << histconstants);
127 if (nFiles != 1) { B2FATAL(
"Sorry, you must only import one file at a time for now!"); }
130 if (!parhist) B2FATAL(
"None of the input files contains the histogram called 'CDCDedxMeanPars'!");
131 short version = parhist->GetBinContent(1);
132 std::vector<double> meanpars;
133 for (
int bin = 2; bin <= parhist->GetNbinsX(); ++bin) {
134 meanpars.push_back(parhist->GetBinContent(bin));
145 TClonesArray sigmaParameters(
"Belle2::CDCDedxSigmaPars");
152 TFile* f = TFile::Open(inputFile.c_str(),
"READ");
154 TIter next(f->GetListOfKeys());
156 while ((key = (TKey*) next())) {
158 std::string histconstants = key->GetName();
160 if (histconstants.compare(
"CDCDedxSigmaPars") == 0) {
161 parhist = (TH1F*)f->Get(histconstants.c_str());
162 B2INFO(
"Key name matches: " << histconstants);
166 B2WARNING(
"Key name does not match: " << histconstants);
174 if (nFiles != 1) { B2FATAL(
"Sorry, you must only import one file at a time for now!"); }
177 if (!parhist) B2FATAL(
"None of the input files contains the histogram called 'CDCDedxSigmaPars'!");
178 short version = parhist->GetBinContent(1);
179 std::vector<double> sigmapars;
180 for (
int bin = 2; bin <= parhist->GetNbinsX(); ++bin) {
181 sigmapars.push_back(parhist->GetBinContent(bin));
void importScaleFactor(double scale)
Import a scale factor to make electron dE/dx ~ 1.
void importHadronCorrection()
Import parameters for the hadron correction.
void importSigmaParameters()
Import predicted resolution parameters to the database.
std::vector< std::string > m_inputFileNames
Name of input ROOT files.
CDCDedxDatabaseImporter(std::string inputFileName, const std::string &m_name)
Constructor.
void importMeanParameters()
Import predicted mean parameters to the database.
std::string m_name
Name of database ROOT file.
dE/dx hadron saturation parameterization constants
dE/dx mean (curve versus beta-gamma) parameterization constants
dE/dx run gain calibration constants
dE/dx sigma (versus beta-gamma) parameterization constants
A class that describes the interval of experiments/runs for which an object in the database is valid.
static Database & Instance()
Instance of a singleton Database.
bool storeData(const std::string &name, TObject *object, const IntervalOfValidity &iov)
Store an object in the database.
Abstract base class for different kinds of events.