21#include <hipo4/reader.h>
22#include <iguana/algorithms/AlgorithmSequence.h>
25int main(
int argc,
char** argv)
29 char const* inFileName = argc > 1 ? argv[1] :
"data.hipo";
30 int const numEvents = argc > 2 ? std::stoi(argv[2]) : 3;
33 hipo::reader reader(inFileName, {0});
36 hipo::banklist banks = reader.getBanks({
"RUN::config",
40 "REC::Scintillator"});
45 seq.
Add(
"clas12::EventBuilderFilter");
46 seq.
Add(
"clas12::SectorFinder");
47 seq.
Add(
"clas12::rga::MomentumCorrection");
52 seq.
SetOption(
"clas12::EventBuilderFilter",
"log",
"info");
53 seq.
SetOption(
"clas12::SectorFinder",
"log",
"info");
54 seq.
SetOption(
"clas12::rga::MomentumCorrection",
"log",
"info");
58 seq.
SetOption<std::vector<int>>(
"clas12::EventBuilderFilter",
"pids", {11, 211, -211});
71 while(reader.next(banks) && (numEvents == 0 || iEvent++ < numEvents)) {
74 auto& bank_config = banks.at(b_config);
75 auto& bank_particle = banks.at(b_particle);
76 auto& bank_sector = banks.at(b_sector);
79 fmt::println(
"===== EVENT {} =====", bank_config.getInt(
"event", 0));
82 fmt::println(
"----- BEFORE IGUANA -----");
89 fmt::println(
"----- AFTER IGUANA -----");
94 fmt::print(
"----- Analysis Particles -----\n");
95 fmt::print(
" {:<20} {:<20} {:<20} {:<20}\n",
"row == pindex",
"PDG",
"|p|",
"sector");
99 for(
auto const& row : bank_particle.getRowList()) {
101 bank_particle.getFloat(
"px", row),
102 bank_particle.getFloat(
"py", row),
103 bank_particle.getFloat(
"pz", row));
104 auto pdg = bank_particle.getInt(
"pid", row);
105 auto sector = bank_sector.getInt(
"sector", row);
106 fmt::print(
" {:<20} {:<20} {:<20.3f} {:<20}\n", row, pdg, p, sector);
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="")
void SetOption(std::string const &algo_instance_name, std::string const &key, const OPTION_TYPE val)
void Start(hipo::banklist &banks) override
Initialize this algorithm before any events are processed, with the intent to process banks.
bool Run(hipo::banklist &banks) const override
Run Function: Process an event's hipo::banklist
int main(int argc, char **argv)
main function