LDMX Software
EcalReconConditions.cxx
1#include "Ecal/EcalReconConditions.h"
2
3namespace ecal {
4
5const std::string EcalReconConditions::CONDITIONS_NAME = "EcalReconConditions";
6
11const std::vector<std::string> EcalReconConditions::EXPECTED_COLUMNS = {
12 "ADC_PEDESTAL", "ADC_GAIN", "TOT_PEDESTAL", "TOT_GAIN"};
13
15 const conditions::DoubleTableCondition& table, bool validate)
16 : the_table_{table} {
17 // leave early if we don't want to validate
18 if (!validate) return;
19
21 EXCEPTION_RAISE(
22 "ConditionsException",
23 "Inconsistent condition for EcalReconConditions :" + table.getName());
24 }
25
26 // not using fancy C++17 to shorten this because we want the error to
27 // tell us where the failure is
28 for (size_t i = 0; i < EXPECTED_COLUMNS.size(); i++) {
29 if (the_table_.getColumnNames().at(i) != EXPECTED_COLUMNS.at(i)) {
30 EXCEPTION_RAISE("ConditionsException",
31 "Expected column '" + EXPECTED_COLUMNS.at(i) +
32 "', got '" + the_table_.getColumnNames().at(i) + "'");
33 } // does name match?
34 } // loop through columns
35}
36
37} // namespace ecal
unsigned int getColumnCount() const
Get the number of columns.
const std::vector< std::string > & getColumnNames() const
Get the names of the columns.
const conditions::DoubleTableCondition & the_table_
reference to the table of conditions storing the chip conditions
EcalReconConditions(const conditions::DoubleTableCondition &table, bool validate=true)
Constructor.
static const std::vector< std::string > EXPECTED_COLUMNS
expected order of column names matching the above indices (must match the indices above)
static const std::string CONDITIONS_NAME
the name of the EcalReconConditions table (must match python registration name)
std::string getName() const
Get the name of this object.