10 #include "art_root_io/RootDB/SQLite3Wrapper.h" 14 #include "cetlib_except/exception.h" 23 #include "art_root_io/Inputfwd.h" 24 #include "art_root_io/detail/readMetadata.h" 53 if (filename.empty()) {
return; }
54 std::unique_ptr<TFile>
file{TFile::Open(filename.c_str(),
"READ")};
55 if (!
file ||
file->IsZombie() || !
file->IsOpen()) {
return; }
56 std::unique_ptr<TTree> metaDataTree{
58 if (metaDataTree ==
nullptr) {
60 "Input file does not contain a metadata tree!");
62 auto const fileFormatVersion =
63 art::detail::readMetadata<art::FileFormatVersion>(metaDataTree.get());
67 bitset<kConfigTypeMax> config_set;
70 auto count_configuration_changes =
73 auto const value_from_file = ps.get<
double>(cfgName[i]);
74 if (not config_set[i]) {
75 config_value[i] = value_from_file;
78 else if (config_value[i] != value_from_file) {
80 <<
"Found historical value disagreement for " << cfgName[i] <<
" ... " 81 << config_value[i] <<
" != " << value_from_file;
86 if (fileFormatVersion.value_ < 5) {
88 if (!art::detail::readMetadata(metaDataTree.get(), psetMap)) {
90 "Could not read ParameterSetMap from metadata tree!");
93 for (
auto const& psEntry : psetMap) {
98 count_configuration_changes(ps);
102 art::SQLite3Wrapper sqliteDB(
file.get(),
"RootFileDB");
104 sqlite3_prepare_v2(sqliteDB,
"SELECT PSetBlob from ParameterSets;", -1, &stmt,
nullptr);
105 while (sqlite3_step(stmt) == SQLITE_ROW) {
110 count_configuration_changes(ps);
112 sqlite3_finalize(stmt);
116 if (not config_set[i])
continue;
117 if (cfgValue[i] == config_value[i])
continue;
119 cout <<
"Overriding configuration parameter " << cfgName[i] <<
" ... " << cfgValue[i]
120 <<
" (fcl) => " << config_value[i] <<
" (data file)" <<
endl;
bool IsRightConfig(const fhicl::ParameterSet &ps) const
static ParameterSet make(intermediate_table const &tbl)
std::vector< std::string > const & ConfigNames() const override
struct sqlite3_stmt sqlite3_stmt
std::vector< double > const & ConfigValues() const override
std::string const & metaDataTreeName()
void ApplyParams()
Internal function to apply loaded parameters to member attributes.
void preBeginRun(art::Run const &run)
void postOpenFile(std::string const &filename)
General LArSoft Utilities.
static constexpr double ps
art service managing detinfo::DetectorClocksStandard.
detinfo::DetectorClocksData detectorClocksStandardDataFor(detinfo::DetectorClocksStandard const &detClocks, Event const &event)
Returns DetectorClocksData tuned on the specified event.
void SetConfigValue(size_t i, double val)
Contains all timing reference information for the detector.
DetectorClocksStandard fClocks
DetectorClocksData DataFor(art::Event const &e) const override
std::map< fhicl::ParameterSetID, ParameterSetBlob > ParameterSetMap
Helper to get clocks data from detinfo::DetectorClocksStandard.
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)