15 #include "art_root_io/RootDB/SQLite3Wrapper.h"
16 #include "fhiclcpp/ParameterSet.h"
20 std::map<fhicl::ParameterSetID, fhicl::ParameterSet>
32 art::SQLite3Wrapper
sqliteDB(&file,
"RootFileDB");
36 auto const throwOnSQLiteNotOK = [&
db](std::string
const&
msg = {})
39 throw cet::exception(
"readConfigurationFromArtFile")
40 <<
"Can't open SQLite database.";
42 auto const errcode = sqlite3_errcode(
db);
45 if (errcode == SQLITE_OK)
return;
46 throw cet::exception(
"readConfigurationFromArtFile")
47 <<
"SQLite3 error (code" << errcode <<
"): "
48 << sqlite3_errstr(errcode) << (msg.empty() ?
"" : (
": " +
msg))
53 sqlite3_stmt* stmt =
nullptr;
55 (sqliteDB,
"SELECT ID, PSetBlob from ParameterSets;", -1, &stmt,
nullptr);
56 throwOnSQLiteNotOK(
"[SELECT ID, PSetBlob from ParameterSets;]");
58 std::map<fhicl::ParameterSetID, fhicl::ParameterSet> config;
59 while (sqlite3_step(stmt) == SQLITE_ROW) {
62 std::string
const psetIDstr
63 =
reinterpret_cast<const char*
>(sqlite3_column_text(stmt, 0));
64 auto pset = fhicl::ParameterSet::make
65 (reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1)));
66 config.emplace(fhicl::ParameterSetID{ psetIDstr }, std::move(pset));
69 sqlite3_finalize(stmt);
70 throwOnSQLiteNotOK(
"[SELECT ID, PSetBlob from ParameterSets;]");
std::map< fhicl::ParameterSetID, fhicl::ParameterSet > readConfigurationFromArtFile(TFile &file)
Reads and returns the art configuration stored in sourceDir.
Utilities to extract art FHiCL configuration from different sources.
height to which particles are projected pnfs larsoft persistent physics cosmics Fermilab CORSIKA standard He_showers_ * db