-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
38 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,45 @@ | ||
#include "iguana/Arbiter.h" | ||
#include "iguana/Iguana.h" | ||
#include <hipo4/reader.h> | ||
|
||
int main(int argc, char **argv) { | ||
|
||
std::string inFile = "data.hipo"; | ||
if(argc > 1) inFile = std::string(argv[1]); | ||
// parse arguments | ||
int argi = 1; | ||
std::string inFileName = argc > argi ? std::string(argv[argi++]) : "data.hipo"; | ||
int numEvents = argc > argi ? std::stoi(argv[argi++]) : 3; | ||
|
||
// start iguana | ||
/* TODO: will be similified when we have more sugar in `iguana::Iguana`; until then we | ||
* use the test algorithm directly | ||
*/ | ||
iguana::Iguana I; | ||
auto algo = I.algo_map.at(iguana::Iguana::clas12_EventBuilderFilter); | ||
algo->Start(); | ||
|
||
///////////////////////////////////////////////////// | ||
|
||
// read input file | ||
hipo::reader reader; | ||
reader.open(inFile.c_str()); | ||
reader.open(inFileName.c_str()); | ||
|
||
// get bank schema | ||
/* TODO: users should not have to do this; this is a workaround until | ||
* the pattern `hipo::event::getBank("REC::Particle")` is possible | ||
*/ | ||
hipo::dictionary factory; | ||
reader.readDictionary(factory); | ||
// factory.show(); | ||
|
||
hipo::bank particleBank(factory.getSchema("REC::Particle")); | ||
hipo::event event; | ||
|
||
iguana::Arbiter arb; | ||
auto algo = arb.algo_map.at(iguana::Arbiter::clas12_EventBuilderFilter); | ||
algo->Start(); | ||
|
||
int count = 0; | ||
while(reader.next()) { | ||
if(count > 3) break; | ||
reader.read(event); | ||
// event loop | ||
hipo::event event; | ||
int iEvent = 0; | ||
while(reader.next(event) && (iEvent++ < numEvents || numEvents == 0)) { | ||
event.getStructure(particleBank); | ||
|
||
auto resultBank = algo->Run({{"particles", particleBank}}); | ||
|
||
fmt::print("BEFORE -> AFTER: {} -> {}\n", particleBank.getRows(), resultBank.at("particles").getRows()); | ||
|
||
count++; | ||
} | ||
|
||
///////////////////////////////////////////////////// | ||
|
||
algo->Stop(); | ||
return 0; | ||
} |