GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 4 / 0 / 4
Functions: 100.0% 3 / 0 / 3
Branches: 38.9% 7 / 0 / 18

src/iguana/algorithms/clas12/ZVertexFilter/Algorithm.h
Line Branch Exec Source
1 #pragma once
2
3 #include "iguana/algorithms/Algorithm.h"
4 #include "iguana/services/ConcurrentParam.h"
5
6 namespace iguana::clas12 {
7
8 /// @algo_brief{Filter a particle bank by cutting on Z Vertex}
9 /// @algo_type_filter
10 ///
11 /// @doc_config{clas12/ZVertexFilter}
12 class ZVertexFilter : public Algorithm
13 {
14
15
7/18
iguana::clas12::ZVertexFilter::ZVertexFilter(std::basic_string_view<char, std::char_traits<char> >):
✓ Branch 2 → 3 taken 8 times.
✗ Branch 2 → 6 not taken.
✗ Branch 5 → 7 not taken.
✓ Branch 5 → 8 taken 8 times.
✓ Branch 9 → 10 taken 8 times.
✗ Branch 9 → 32 not taken.
✓ Branch 10 → 11 taken 8 times.
✗ Branch 10 → 17 not taken.
✓ Branch 17 → 18 taken 8 times.
✗ Branch 17 → 40 not taken.
✓ Branch 24 → 25 taken 8 times.
✗ Branch 24 → 40 not taken.
✗ Branch 32 → 33 not taken.
✗ Branch 32 → 39 not taken.
✗ Branch 40 → 41 not taken.
✗ Branch 40 → 43 not taken.
iguana::clas12::ZVertexFilter::~ZVertexFilter():
✓ Branch 2 → 3 taken 8 times.
✗ Branch 2 → 5 not taken.
74 DEFINE_IGUANA_ALGORITHM(ZVertexFilter, clas12::ZVertexFilter)
16
17 private: // hooks
18 void ConfigHook() override;
19 void StartHook(hipo::banklist& banks) override;
20 bool RunHook(hipo::banklist& banks) const override;
21
22 public:
23
24 /// @run_function
25 /// @param [in,out] particleBank particle bank (_e.g._, `REC::Particle`), which will be filtered
26 /// @param [in] configBank `RUN::config`
27 /// @returns `false` if all particles are filtered out
28 bool Run(hipo::bank& particleBank, hipo::bank const& configBank) const;
29
30 /// @action_function{reload} prepare the event
31 /// @when_to_call{for each event}
32 /// @param runnum the run number
33 /// @returns the key to be used in `::Filter`
34 concurrent_key_t PrepareEvent(int const runnum) const;
35
36 /// @action_function{scalar filter} checks if the Z Vertex is within specified bounds if pid is one for which the filter should be applied to.;
37 /// Cuts applied to particles in FD or CD (ie not in FT).
38 /// @when_to_call{for each particle}
39 /// @param zvertex the particle Z Vertex to check
40 /// @param pid the particle pid
41 /// @param status particle status used to check particle is not in FT
42 /// @param key the return value of `::PrepareEvent`
43 /// @returns `true` if `zvertex` is within specified bounds
44 bool Filter(double const zvertex, int const pid, int const status, concurrent_key_t const key) const;
45
46 /// @param key the return value of `::PrepareEvent`
47 /// @returns the current run number
48 int GetRunNum(concurrent_key_t const key) const;
49
50 /// @param key the return value of `::PrepareEvent`
51 /// @returns the current z-vertex cuts
52 std::vector<double> GetElectronZcuts(concurrent_key_t const key) const;
53
54 /// @brief sets the z-vertex cuts
55 /// @warning this method is not thread safe; instead, for thread safety,
56 /// use `::PrepareEvent` and a custom configuration file.
57 /// @param zcut_lower the lower bound of the cut
58 /// @param zcut_upper the upper bound of the cut
59 /// @param key the, for `::GetElectronZcuts`
60 void SetElectronZcuts(double zcut_lower, double zcut_upper, concurrent_key_t const key);
61
62 private:
63 hipo::banklist::size_type b_particle, b_config;
64
65 // Reload function
66 void Reload(int const runnum, concurrent_key_t key) const;
67
68 /// Particle bank name
69 std::string o_particle_bank;
70
71 /// Run number
72 mutable std::unique_ptr<ConcurrentParam<int>> o_runnum;
73
74 /// Electron Z-vertex cuts
75 mutable std::unique_ptr<ConcurrentParam<std::vector<double>>> o_electron_vz_cuts;
76 };
77
78 }
79