-
Notifications
You must be signed in to change notification settings - Fork 7
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
7 changed files
with
74 additions
and
16 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
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,10 +1,12 @@ | ||
test_bin = executable( | ||
'run', | ||
'main.cc', | ||
include_directories: project_inc, | ||
dependencies: [ fmt_dep, hipo_dep ], | ||
link_with: iguana_lib, | ||
install: true, | ||
install_dir: project_bin_install_dir, | ||
install_rpath: project_bin_rpath, | ||
) | ||
foreach test_exe : [ 'run_banks', 'run_rows' ] | ||
executable( | ||
test_exe, | ||
test_exe + '.cc', | ||
include_directories: project_inc, | ||
dependencies: [ fmt_dep, hipo_dep ], | ||
link_with: [ iguana_lib, algo_lib ], | ||
install: true, | ||
install_dir: project_bin_install_dir, | ||
install_rpath: project_bin_rpath, | ||
) | ||
endforeach |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "algorithms/clas12/event_builder_filter/EventBuilderFilter.h" | ||
#include <hipo4/reader.h> | ||
|
||
int main(int argc, char **argv) { | ||
|
||
// 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 the algorithm | ||
auto algo = std::make_shared<iguana::clas12::EventBuilderFilter>(); | ||
algo->Start(); | ||
|
||
///////////////////////////////////////////////////// | ||
|
||
// read input file | ||
hipo::reader reader; | ||
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); | ||
auto particleBank = std::make_shared<hipo::bank>(factory.getSchema("REC::Particle")); | ||
|
||
// event loop | ||
hipo::event event; | ||
int iEvent = 0; | ||
while(reader.next(event) && (iEvent++ < numEvents || numEvents == 0)) { | ||
event.getStructure(*particleBank); | ||
fmt::print("PIDS FILTERED BY algo->Filter():\n"); | ||
for(int row=0; row<particleBank->getRows(); row++) { | ||
auto pid = particleBank->get("pid", row); | ||
fmt::print("{:>10}:{}\n", pid, algo->Filter(pid) ? " -- ACCEPT" : ""); | ||
} | ||
|
||
} | ||
|
||
///////////////////////////////////////////////////// | ||
|
||
algo->Stop(); | ||
return 0; | ||
} |