GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/clas12/EventBuilderFilter/Algorithm.cc
Date: 2025-11-25 17:57:04
Coverage Exec Excl Total
Lines: 84.0% 21 0 25
Functions: 85.7% 6 0 7
Branches: 40.9% 9 0 22

Line Branch Exec Source
1 #include "Algorithm.h"
2
3 namespace iguana::clas12 {
4
5 REGISTER_IGUANA_ALGORITHM(EventBuilderFilter);
6
7 8 void EventBuilderFilter::Start(hipo::banklist& banks)
8 {
9
10 // define options, their default values, and cache them
11 8 ParseYAMLConfig();
12
2/4
✓ Branch 4 → 5 taken 8 times.
✗ Branch 4 → 37 not taken.
✓ Branch 5 → 6 taken 8 times.
✗ Branch 5 → 31 not taken.
16 o_particle_bank = GetOptionScalar<std::string>("particle_bank");
13
2/4
✓ Branch 19 → 20 taken 8 times.
✗ Branch 19 → 45 not taken.
✓ Branch 20 → 21 taken 8 times.
✗ Branch 20 → 39 not taken.
16 o_pids = GetOptionSet<int>("pids");
14
15 // get expected bank indices
16 8 b_particle = GetBankIndex(banks, o_particle_bank);
17 8 }
18
19
20 5069 bool EventBuilderFilter::Run(hipo::banklist& banks) const
21 {
22 5069 return Run(GetBank(banks, b_particle, o_particle_bank));
23 }
24
25 5169 bool EventBuilderFilter::Run(hipo::bank& particleBank) const
26 {
27 // dump the bank
28
1/2
✓ Branch 5 → 6 taken 5169 times.
✗ Branch 5 → 26 not taken.
10338 ShowBank(particleBank, Logger::Header("INPUT PARTICLES"));
29
30 // filter the input bank for requested PDG code(s)
31
1/2
✓ Branch 12 → 13 taken 5169 times.
✗ Branch 12 → 32 not taken.
5169 particleBank.getMutableRowList().filter([this](auto bank, auto row) {
32 34911 auto pid = bank.getInt("pid", row);
33 34911 auto accept = Filter(pid);
34 34911 m_log->Debug("input PID {} -- accept = {}", pid, accept);
35
2/2
✓ Branch 5 → 6 taken 24231 times.
✓ Branch 5 → 7 taken 10680 times.
34911 return accept ? 1 : 0;
36 });
37
38 // dump the modified bank
39
1/2
✓ Branch 18 → 19 taken 5169 times.
✗ Branch 18 → 35 not taken.
10338 ShowBank(particleBank, Logger::Header("OUTPUT PARTICLES"));
40
41 // return false if everything is filtered out
42 5169 return !particleBank.getRowList().empty();
43 }
44
45
46 35594 bool EventBuilderFilter::Filter(int const pid) const
47 {
48 35594 return o_pids.find(pid) != o_pids.end();
49 }
50
51 std::deque<bool> EventBuilderFilter::Filter(std::vector<int> const pids) const
52 {
53 std::deque<bool> result;
54 for(auto const& pid : pids)
55 result.push_back(Filter(pid));
56 return result;
57 }
58
59 5 void EventBuilderFilter::Stop()
60 {
61 5 }
62
63 }
64