diff --git a/src/algorithms/clas12/event_builder_filter/EventBuilderFilter.cc b/src/algorithms/clas12/event_builder_filter/EventBuilderFilter.cc index 7eb244ec..01619de5 100644 --- a/src/algorithms/clas12/event_builder_filter/EventBuilderFilter.cc +++ b/src/algorithms/clas12/event_builder_filter/EventBuilderFilter.cc @@ -21,13 +21,13 @@ namespace iguana::clas12 { // define the output schemata and banks BankMap outBanks = { - { "particles", hipo::bank(inBanks.at("particles").getSchema()) } + { "particles", std::make_shared(inBanks.at("particles")->getSchema()) } }; // filter the input bank for requested PDG code(s) std::set acceptedRows; - for(int row = 0; row < inBanks.at("particles").getRows(); row++) { - auto pid = inBanks.at("particles").get("pid", row); + for(int row = 0; row < inBanks.at("particles")->getRows(); row++) { + auto pid = inBanks.at("particles")->get("pid", row); auto accept = m_opt.pids.find(pid) != m_opt.pids.end(); if(accept) acceptedRows.insert(row); m_log->Debug("input PID {} -- accept = {}", pid, accept); @@ -38,8 +38,8 @@ namespace iguana::clas12 { case EventBuilderFilterOptions::Modes::blank: { - outBanks.at("particles").setRows(inBanks.at("particles").getRows()); - for(int row = 0; row < inBanks.at("particles").getRows(); row++) { + outBanks.at("particles")->setRows(inBanks.at("particles")->getRows()); + for(int row = 0; row < inBanks.at("particles")->getRows(); row++) { if(acceptedRows.find(row) != acceptedRows.end()) CopyBankRow(inBanks.at("particles"), row, outBanks.at("particles"), row); else @@ -50,7 +50,7 @@ namespace iguana::clas12 { case EventBuilderFilterOptions::Modes::compact: { - outBanks.at("particles").setRows(acceptedRows.size()); + outBanks.at("particles")->setRows(acceptedRows.size()); int row = 0; for(auto acceptedRow : acceptedRows) CopyBankRow(inBanks.at("particles"), acceptedRow, outBanks.at("particles"), row++); diff --git a/src/iguana/Iguana.h b/src/iguana/Iguana.h index 30d52de8..c49c78f9 100644 --- a/src/iguana/Iguana.h +++ b/src/iguana/Iguana.h @@ -2,7 +2,6 @@ #include "services/Algorithm.h" #include -#include // TODO: avoid listing the algos #include "algorithms/clas12/event_builder_filter/EventBuilderFilter.h" diff --git a/src/services/Algorithm.cc b/src/services/Algorithm.cc index a77ce4df..beb5e23a 100644 --- a/src/services/Algorithm.cc +++ b/src/services/Algorithm.cc @@ -19,17 +19,17 @@ namespace iguana { return false; } - void Algorithm::CopyBankRow(hipo::bank srcBank, int srcRow, hipo::bank destBank, int destRow) { - // TODO: check srcBank.getSchema() == destBank.getSchema() - for(int item = 0; item < srcBank.getSchema().getEntries(); item++) { - auto val = srcBank.get(item, srcRow); - destBank.put(item, destRow, val); + void Algorithm::CopyBankRow(std::shared_ptr srcBank, int srcRow, std::shared_ptr destBank, int destRow) { + // TODO: check srcBank->getSchema() == destBank.getSchema() + for(int item = 0; item < srcBank->getSchema().getEntries(); item++) { + auto val = srcBank->get(item, srcRow); + destBank->put(item, destRow, val); } } - void Algorithm::BlankRow(hipo::bank bank, int row) { - for(int item = 0; item < bank.getSchema().getEntries(); item++) { - bank.put(item, row, 0); + void Algorithm::BlankRow(std::shared_ptr bank, int row) { + for(int item = 0; item < bank->getSchema().getEntries(); item++) { + bank->put(item, row, 0); } } @@ -38,7 +38,7 @@ namespace iguana { m_log->Print(level, message); for(auto [key,bank] : banks) { m_log->Print(level, "BANK: '{}'", key); - bank.show(); + bank->show(); } } } diff --git a/src/services/Algorithm.h b/src/services/Algorithm.h index 7b6bba97..572afa9e 100644 --- a/src/services/Algorithm.h +++ b/src/services/Algorithm.h @@ -10,7 +10,7 @@ namespace iguana { public: - using BankMap = std::unordered_map; + using BankMap = std::unordered_map>; /// Algorithm base class constructor /// @param name the unique name for a derived class instance @@ -43,12 +43,12 @@ namespace iguana { /// @param srcRow the row in `srcBank` to copy from /// @param destBank the destination bank /// @param destRow the row in `destBank` to copy to - void CopyBankRow(hipo::bank srcBank, int srcRow, hipo::bank destBank, int destRow); + void CopyBankRow(std::shared_ptr srcBank, int srcRow, std::shared_ptr destBank, int destRow); /// Blank a row, setting all items to zero /// @param bank the bank to modify /// @param row the row to blank - void BlankRow(hipo::bank bank, int row); + void BlankRow(std::shared_ptr bank, int row); /// Dump all banks in a BankMap /// @param banks the banks to show diff --git a/src/tests/main.cc b/src/tests/main.cc index dac76f7c..b45c72ac 100644 --- a/src/tests/main.cc +++ b/src/tests/main.cc @@ -28,13 +28,13 @@ int main(int argc, char **argv) { */ hipo::dictionary factory; reader.readDictionary(factory); - hipo::bank particleBank(factory.getSchema("REC::Particle")); + auto particleBank = std::make_shared(factory.getSchema("REC::Particle")); // event loop hipo::event event; int iEvent = 0; while(reader.next(event) && (iEvent++ < numEvents || numEvents == 0)) { - event.getStructure(particleBank); + event.getStructure(*particleBank); auto resultBank = algo->Run({{"particles", particleBank}}); }