17 #include "art_root_io/Inputfwd.h" 18 #include "art_root_io/RootDB/SQLite3Wrapper.h" 19 #include "art_root_io/detail/readMetadata.h" 23 #include "cetlib_except/exception.h" 52 if (filename.empty()) {
return; }
53 std::unique_ptr<TFile>
file{TFile::Open(filename.c_str(),
"READ")};
54 if (!
file ||
file->IsZombie() || !
file->IsOpen()) {
return; }
55 std::unique_ptr<TTree> metaDataTree{
57 if (metaDataTree ==
nullptr) {
59 "Input file does not contain a metadata tree!");
61 auto const fileFormatVersion =
62 art::detail::readMetadata<art::FileFormatVersion>(metaDataTree.get());
66 bitset<kConfigTypeMax> config_set;
69 auto count_configuration_changes =
72 auto const value_from_file = ps.get<
double>(cfgName[i]);
73 if (not config_set[i]) {
74 config_value[i] = value_from_file;
77 else if (config_value[i] != value_from_file) {
79 <<
"Found historical value disagreement for " << cfgName[i] <<
" ... " 80 << config_value[i] <<
" != " << value_from_file;
85 if (fileFormatVersion.value_ < 5) {
87 if (!art::detail::readMetadata(metaDataTree.get(), psetMap)) {
89 "Could not read ParameterSetMap from metadata tree!");
92 for (
auto const& psEntry : psetMap) {
97 count_configuration_changes(ps);
101 art::SQLite3Wrapper sqliteDB(
file.get(),
"RootFileDB");
102 sqlite3_stmt* stmt{
nullptr};
103 sqlite3_prepare_v2(sqliteDB,
"SELECT PSetBlob from ParameterSets;", -1, &stmt,
nullptr);
104 while (sqlite3_step(stmt) == SQLITE_ROW) {
109 count_configuration_changes(ps);
111 sqlite3_finalize(stmt);
115 if (not config_set[i])
continue;
116 if (cfgValue[i] == config_value[i])
continue;
118 cout <<
"Overriding configuration parameter " << cfgName[i] <<
" ... " << cfgValue[i]
119 <<
" (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
std::vector< double > const & ConfigValues() const override
std::map< fhicl::ParameterSetID, ParameterSetBlob > ParameterSetMap
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.
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
Helper to get clocks data from detinfo::DetectorClocksStandard.
cet::coded_exception< error, detail::translate > exception