GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 5 / 0 / 5
Functions: 100.0% 3 / 0 / 3
Branches: 40.9% 9 / 0 / 22

src/iguana/algorithms/physics/InclusiveKinematics/Algorithm.h
Line Branch Exec Source
1 #pragma once
2
3 #include "iguana/algorithms/Algorithm.h"
4 #include "iguana/algorithms/TypeDefs.h"
5 #include "iguana/services/ConcurrentParam.h"
6
7 namespace iguana::physics {
8
9 /// @algo_brief{Calculate inclusive kinematics quantities}
10 /// @algo_type_creator
11 /// @doc_config{physics/InclusiveKinematics}
12 /// @rcdb_note
13 class InclusiveKinematics : public Algorithm
14 {
15
16
9/22
None:
✓ Branch 3 → 4 taken 8000 times.
✗ Branch 3 → 25 not taken.
✓ Branch 11 → 12 taken 8 times.
✗ Branch 11 → 48 not taken.
iguana::physics::InclusiveKinematics::InclusiveKinematics(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::physics::InclusiveKinematics::~InclusiveKinematics():
✓ Branch 2 → 3 taken 8 times.
✗ Branch 2 → 5 not taken.
8088 DEFINE_IGUANA_ALGORITHM(InclusiveKinematics, physics::InclusiveKinematics)
17
18 private: // hooks
19 void ConfigHook() override;
20 void StartHook(hipo::banklist& banks) override;
21 bool RunHook(hipo::banklist& banks) const override;
22
23 public:
24
25 /// @run_function
26 /// @param [in] particle_bank particle bank (_e.g._, `REC::Particle`)
27 /// @param [in] config_bank `RUN::config`
28 /// @param [out] result_bank `%physics::InclusiveKinematics`, which will be created
29 /// @returns `true` if the kinematics were calculated; _e.g._, if the calculations are performed using
30 /// the scattered lepton, and no scattered lepton was found, `false` will be returned
31 bool Run(
32 hipo::bank const& particle_bank,
33 hipo::bank const& config_bank,
34 hipo::bank& result_bank) const;
35
36 /// @action_function{reload} prepare the event
37 /// @when_to_call{for each event}
38 /// @param runnum the run number
39 /// @param beam_energy the beam energy; if negative (the default), RCDB will be used to get the beam energy from `runnum`
40 /// @returns the key to be used in `::ComputeFromLepton`
41 concurrent_key_t PrepareEvent(int const runnum, double const beam_energy = -1) const;
42
43 /// @action_function{scalar creator} compute kinematics from the scattered lepton.
44 /// @param lepton_px scattered lepton momentum component @latex{p_x} (GeV)
45 /// @param lepton_py scattered lepton momentum component @latex{p_y} (GeV)
46 /// @param lepton_pz scattered lepton momentum component @latex{p_z} (GeV)
47 /// @param key the return value of `::PrepareEvent`
48 /// @returns the reconstructed inclusive kinematics in a `iguana::physics::InclusiveKinematicsVars` instance
49 InclusiveKinematicsVars ComputeFromLepton(
50 vector_element_t const lepton_px,
51 vector_element_t const lepton_py,
52 vector_element_t const lepton_pz,
53 concurrent_key_t const key) const;
54
55 private:
56
57 /// FIXME: this could be changed to a vector action function
58 /// Find the scattered lepton. Since finding the scattered lepton requires
59 /// reading all the particles of an event, there is no **Action function**;
60 /// therefore, callers that do not have access to `hipo::bank` objects are
61 /// responsible for finding the scattered lepton.
62 /// @param particle_bank the particle bank to search
63 /// @param key the return value of `::PrepareEvent`
64 /// @returns the bank row of the scattered lepton, if found
65 std::optional<int> const FindScatteredLepton(hipo::bank const& particle_bank, concurrent_key_t const key) const;
66
67 void Reload(int const runnum, double const user_beam_energy, concurrent_key_t key) const;
68
69 // banklist indices
70 hipo::banklist::size_type b_particle;
71 hipo::banklist::size_type b_config;
72 hipo::banklist::size_type b_result;
73
74 // `b_result` bank item indices
75 int i_pindex;
76 int i_Q2;
77 int i_x;
78 int i_y;
79 int i_W;
80 int i_nu;
81 int i_qx;
82 int i_qy;
83 int i_qz;
84 int i_qE;
85 int i_beamPz;
86 int i_targetM;
87
88 // config options
89 std::string o_particle_bank;
90 mutable std::unique_ptr<ConcurrentParam<int>> o_runnum;
91 mutable std::unique_ptr<ConcurrentParam<std::vector<double>>> o_target_PxPyPzM;
92 mutable std::unique_ptr<ConcurrentParam<std::vector<double>>> o_beam_PxPyPzM;
93 double o_beam_mass; // unlikely to change
94 int o_beam_pdg; // unlikely to change
95 double o_override_beam_energy;
96 double o_theta_between_FD_and_FT;
97
98 enum method_reconstruction {
99 scattered_lepton
100 };
101 enum method_lepton_finder {
102 highest_energy_FD_trigger,
103 lund_beam_daughter,
104 };
105 method_reconstruction o_method_reconstruction;
106 method_lepton_finder o_method_lepton_finder;
107 };
108
109 }
110