4#include <hipo4/reader.h>
5#include <iguana/algorithms/AlgorithmSequence.h>
7inline int TestBanklist(
13 fmt::print(stderr,
"ERROR: need a data file for command 'banklist'\n");
18 iguana::GlobalConcurrencyModel =
"single";
21 std::vector<std::string> input_bank_names = {
30 hipo::reader reader(data_file.c_str());
31 auto banks = reader.getBanks(input_bank_names);
34 std::vector<std::string> algo_names = {
40 seq.
Add(
"clas12::SectorFinder",
"creator_1a");
41 seq.
Add(
"clas12::CalorimeterLinker",
"creator_2");
42 seq.
Add(
"clas12::SectorFinder",
"creator_1b");
51 fmt::println(
"BANKLIST:");
52 for(
decltype(banks)::size_type i = 0; i < banks.size(); i++) {
53 auto& bank = banks.at(i);
54 fmt::println(
" - {}: {}", i, bank.getSchema().getName());
58 assert((seq.
Get(
"creator_1a")->GetCreatedBankVariant() == 0));
59 assert((seq.
Get(
"creator_1b")->GetCreatedBankVariant() == 1));
60 assert((seq.
Get(
"creator_2")->GetCreatedBankVariant() == 0));
64 for(
decltype(input_bank_names)::size_type i = 0; i < input_bank_names.size(); i++) {
65 auto const& bank_name = input_bank_names.at(i);
70 for(
decltype(algo_names)::size_type i = 0; i < algo_names.size(); i++) {
71 auto const& algo_name = algo_names.at(i);
73 assert((idx == input_bank_names.size() + i));
77 for(
auto const& algo_name : algo_names) {
79 for(
auto const& bank_name : input_bank_names) {
81 assert((idx == seq.
Get(algo_name)->GetBankIndex(banks, bank_name)));
82 assert((idx == seq.
GetBankIndex(banks, bank_name, algo_name)));
91 for(
auto const& algo_name : algo_names) {
93 assert((idx == seq.
Get(algo_name)->GetCreatedBankIndex(banks)));
Algorithm: An algorithm that can run a sequence of algorithms
hipo::banklist::size_type GetCreatedBankIndex(hipo::banklist &banks, std::string const &algo_instance_name) const noexcept(false)
void Stop() override
Finalize this algorithm after all events are processed.
void Add(std::string const &algo_class_name, std::string const &algo_instance_name="")
ALGORITHM * Get(std::string const &algo_instance_name)
std::string GetCreatedBankName(std::string const &algo_instance_name) const noexcept(false)
hipo::banklist::size_type GetBankIndex(hipo::banklist &banks, std::string const &bank_name, std::string const &algo_instance_name) const noexcept(false)
void Start(hipo::banklist &banks) override
Initialize this algorithm before any events are processed, with the intent to process banks.
void PrintSequence(Logger::Level level=Logger::info) const