Skip to content

Commit

Permalink
ReadEDM4hep: simplify ingestion functions
Browse files Browse the repository at this point in the history
  • Loading branch information
andresailer committed Dec 18, 2024
1 parent 8ff2418 commit ddd4984
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions DDG4/edm4hep/EDM4hepFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,44 +46,34 @@ namespace dd4hep::sim {
/// get the parameters from the GenericParameters of the input EDM4hep frame and store them in the EventParameters
/// extension
template <class T=podio::GenericParameters> void EventParameters::ingestParameters(T const& source) {
auto const& intKeys = source.template getKeys<int>();
for(auto const& key: intKeys) {
for(auto const& key: source.template getKeys<int>()) {
m_intValues[key] = source.template get<std::vector<int>>(key).value();
}
auto const& floatKeys = source.template getKeys<float>();
for(auto const& key: floatKeys) {
for(auto const& key: source.template getKeys<float>()) {
m_fltValues[key] = source.template get<std::vector<float>>(key).value();
}
auto const& doubleKeys = source.template getKeys<double>();
for(auto const& key: doubleKeys) {
for(auto const& key: source.template getKeys<double>()) {
m_dblValues[key] = source.template get<std::vector<double>>(key).value();
}
using std::string;
auto const& stringKeys = source.template getKeys<string>();
for(auto const& key: stringKeys) {
m_strValues[key] = source.template get<std::vector<string>>(key).value();
for(auto const& key: source.template getKeys<std::string>()) {
m_strValues[key] = source.template get<std::vector<std::string>>(key).value();
}
}

/// get the parameters from the GenericParameters of the input EDM4hep run frame and store them in the RunParameters
/// extension
template <class T=podio::GenericParameters> void RunParameters::ingestParameters(T const& source) {
auto const& intKeys = source.template getKeys<int>();
for(auto const& key: intKeys) {
for(auto const& key: source.template getKeys<int>()) {
m_intValues[key] = source.template get<std::vector<int>>(key).value();
}
auto const& floatKeys = source.template getKeys<float>();
for(auto const& key: floatKeys) {
for(auto const& key: source.template getKeys<float>()) {
m_fltValues[key] = source.template get<std::vector<float>>(key).value();
}
auto const& doubleKeys = source.template getKeys<double>();
for(auto const& key: doubleKeys) {
for(auto const& key: source.template getKeys<double>()) {
m_dblValues[key] = source.template get<std::vector<double>>(key).value();
}
using std::string;
auto const& stringKeys = source.template getKeys<string>();
for(auto const& key: stringKeys) {
m_strValues[key] = source.template get<std::vector<string>>(key).value();
for(auto const& key: source.template getKeys<std::string>()) {
m_strValues[key] = source.template get<std::vector<std::string>>(key).value();
}
}

Expand Down

0 comments on commit ddd4984

Please sign in to comment.