Skip to content

Commit

Permalink
feat: attempt to write a new bank
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Nov 14, 2023
1 parent a0f4dc2 commit ae28683
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/algorithms/clas12/event_builder_filter/EventBuilderFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,29 @@ namespace iguana::clas12 {

Algorithm::BankMap EventBuilderFilter::Run(Algorithm::BankMap inputBanks) {

if(MissingInputBanks(inputBanks, {"particles"})) ThrowRun();
// check the input banks existence
if(MissingInputBanks(inputBanks, {"particles"}))
ThrowRun();

return inputBanks;
// define the output schemata and banks
BankMap outputBanks = {
{ "particles", hipo::bank(inputBanks.at("particles").getSchema(), inputBanks.at("particles").getRows()) }
};

// filter the input bank for requested PDG code(s)
int j=0;
for(int i=0; i<inputBanks.at("particles").getRows(); i++) {
auto pid = inputBanks.at("particles").get("pid",i);
m_log->Info("INPUT PID = {}", pid);
if(pid==11)
outputBanks.at("particles").put("pid", j++, pid);
}

// print
m_log->Info("SHOW OUTPUT BANKS");
outputBanks.at("particles").show();

return outputBanks;
}

void EventBuilderFilter::Stop() {
Expand Down

0 comments on commit ae28683

Please sign in to comment.