23 #include "nuevdb/IFDatabase/Table.h" 26 #include "cetlib_except/exception.h" 83 mf::LogError(
"LinCalibProtoDUNE") <<
"Channel " << chanId
98 nutools::dbi::Table
t;
100 t.SetDetector(
"pdunesp");
101 t.SetTableName(
"linconsts");
102 t.SetTableType(nutools::dbi::kConditionsTable);
103 t.SetDataTypeMask(nutools::dbi::kDataOnly);
105 t.SetDataTypeMask(nutools::dbi::kMCOnly);
107 int statusIdx = t.AddCol(
"status",
"int");
108 int gainIdx = t.AddCol(
"gain",
"float");
109 int offsetIdx = t.AddCol(
"offset",
"float");
110 int shapeIdx = t.AddCol(
"shape",
"float");
111 int chi2Idx = t.AddCol(
"chi2",
"float");
112 int adcLowIdx = t.AddCol(
"adc_low",
"int");
113 int adcHiIdx = t.AddCol(
"adc_high",
"int");
116 for (
int i=0; i<20; ++i) {
117 sprintf(buff,
"nl%d",i);
118 nlIdx[i] = t.AddCol(buff,
"float");
134 mf::LogError(
"LinCalibProtoDUNE") <<
"Load from norm linconsts database table failed.";
141 mf::LogError(
"LinCalibProtoDUNE") <<
"Number of rows in linconsts calib table is 0. This should never be the case!";
145 nutools::dbi::Row*
row;
147 for (
int i=0; i<t.NRow(); ++i) {
150 chan = row->Channel();
151 row->Col(statusIdx).Get(c.
status);
152 row->Col(gainIdx).Get(c.
gain);
153 row->Col(offsetIdx).Get(c.
offset);
154 row->Col(shapeIdx).Get(c.
shape);
155 row->Col(chi2Idx).Get(c.
chi2);
156 row->Col(adcLowIdx).Get(c.
adc_low);
158 for (
int j=0; j<20; ++j) {
159 row->Col(nlIdx[j]).Get(c.
nl[j]);
bool Configure(fhicl::ParameterSet const &pset)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
bool Update(uint64_t ts=0)
T get(std::string const &key) const
std::map< int, LinConsts_t > fLinConsts
LinConsts_t GetLinConsts(int chanId)