GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/physics/SingleHadronKinematics/Algorithm.h
Date: 2025-11-25 17:57:04
Coverage Exec Excl Total
Lines: 100.0% 5 0 5
Functions: 100.0% 3 0 3
Branches: 44.4% 8 0 18

Line Branch Exec Source
1 #pragma once
2
3 #include "iguana/algorithms/Algorithm.h"
4 #include <Math/Vector3D.h>
5 #include <Math/Vector4D.h>
6
7 namespace iguana::physics {
8
9 /// @algo_brief{Calculate semi-inclusive hadron kinematic quantities}
10 /// @algo_type_creator
11 ///
12 /// @begin_doc_config{physics/SingleHadronKinematics}
13 /// @config_param{hadron_list | list[int] | calculate kinematics for these hadron PDGs}
14 /// @end_doc
15 ///
16 /// The output bank `%physics::SingleHadronKinematics` will have the same number of rows as the input particle bank
17 /// - we want the output bank to have the same number of rows and ordering as the input
18 /// particle bank, so that banks which reference the input particle bank's rows (usually via `pindex`) can be used to
19 /// reference the output bank's rows too
20 /// - rows of the input particle bank which were filtered upstream will also be filtered out here, and all the values of the
21 /// corresponding row in the output bank will be zeroed, since no calculations are performed for
22 /// those particles
23 /// - particles which are not listed in the configuration parameter `hadron_list` will also be filtered out and zeroed
24 class SingleHadronKinematics : public Algorithm
25 {
26
27
8/18
iguana::physics::SingleHadronKinematics::SingleHadronKinematics(std::basic_string_view<char, std::char_traits<char> >):
✓ Branch 2 → 3 taken 2 times.
✗ Branch 2 → 6 not taken.
✗ Branch 5 → 7 not taken.
✓ Branch 5 → 8 taken 2 times.
✓ Branch 9 → 10 taken 2 times.
✗ Branch 9 → 32 not taken.
✓ Branch 10 → 11 taken 2 times.
✗ Branch 10 → 17 not taken.
✓ Branch 17 → 18 taken 2 times.
✗ Branch 17 → 40 not taken.
✓ Branch 24 → 25 taken 2 times.
✗ Branch 24 → 40 not taken.
✗ Branch 32 → 33 not taken.
✗ Branch 32 → 39 not taken.
None:
✓ Branch 3 → 4 taken 286 times.
✗ Branch 3 → 25 not taken.
✓ Branch 38 → 39 taken 2 times.
✗ Branch 38 → 78 not taken.
308 DEFINE_IGUANA_ALGORITHM(SingleHadronKinematics, physics::SingleHadronKinematics)
28
29 public:
30
31 void Start(hipo::banklist& banks) override;
32 bool Run(hipo::banklist& banks) const override;
33 void Stop() override;
34
35 /// @run_function
36 /// @param [in] particle_bank particle bank (_e.g._, `REC::Particle`)
37 /// @param [in] inc_kin_bank `%physics::InclusiveKinematics`, produced by the `physics::InclusiveKinematics` algorithm
38 /// @param [out] result_bank `%physics::SingleHadronKinematics`, which will be created
39 /// @returns `false` if the input banks do not have enough information, _e.g._, if the inclusive kinematics bank is empty,
40 /// or if the created bank is empty
41 bool Run(
42 hipo::bank const& particle_bank,
43 hipo::bank const& inc_kin_bank,
44 hipo::bank& result_bank) const;
45
46 private:
47
48 // banklist indices
49 hipo::banklist::size_type b_particle;
50 hipo::banklist::size_type b_inc_kin;
51 hipo::banklist::size_type b_result;
52
53 // `b_result` bank item indices
54 int i_pindex;
55 int i_pdg;
56 int i_z;
57 int i_PhPerp;
58 int i_MX2;
59 int i_xF;
60 int i_yB;
61 int i_phiH;
62 int i_xi;
63
64 // config options
65 std::string o_particle_bank;
66 std::set<int> o_hadron_pdgs;
67 };
68
69 }
70