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/DihadronKinematics/Algorithm.h
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 dihadron kinematic quantities defined in `iguana::physics::DihadronKinematicsVars`}
10 /// @algo_type_creator
11 ///
12 /// @doc_config{physics/DihadronKinematics}
13 ///
14 /// Dihadron PDGs will be formed from pairs from `hadron_a_list` and `hadron_b_list`. For example,
15 /// if you define:
16 /// @code{yaml}
17 /// hadron_a_list: [ 211 ]
18 /// hadron_b_list: [ -211, 2212 ]
19 /// @endcode
20 /// then the algorithm will calculate kinematics for @latex{\pi^+\pi^-} and @latex{\pi^+p} dihadrons; hadron A
21 /// is the @latex{\pi^+} for both of these, whereas hadron B is the @latex{\pi^-} for the former and the proton
22 /// for the latter.
23 ///
24 /// @par phiR calculation methods
25 /// - `"RT_via_covariant_kT"`: use @latex{R_T} computed via covariant @latex{k_T} formula
26 ///
27 /// @par theta calculation methods
28 /// - `"hadron_a"`: use hadron A's "decay angle" in the dihadron rest frame
29 class DihadronKinematics : public Algorithm
30 {
31
32
9/22
None:
✓ Branch 3 → 4 taken 286 times.
✗ Branch 3 → 25 not taken.
✓ Branch 11 → 12 taken 2 times.
✗ Branch 11 → 38 not taken.
iguana::physics::DihadronKinematics::DihadronKinematics(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.
✗ Branch 40 → 41 not taken.
✗ Branch 40 → 43 not taken.
iguana::physics::DihadronKinematics::~DihadronKinematics():
✓ Branch 2 → 3 taken 2 times.
✗ Branch 2 → 5 not taken.
308 DEFINE_IGUANA_ALGORITHM(DihadronKinematics, physics::DihadronKinematics)
33
34 private: // hooks
35 void ConfigHook() override;
36 void StartHook(hipo::banklist& banks) override;
37 bool RunHook(hipo::banklist& banks) const override;
38
39 public:
40
41 /// @run_function
42 /// @param [in] particle_bank particle bank (_e.g._, `REC::Particle`)
43 /// @param [in] inc_kin_bank `%physics::InclusiveKinematics`, produced by the `physics::InclusiveKinematics` algorithm
44 /// @param [out] result_bank `%physics::DihadronKinematics`, which will be created
45 /// @returns `false` if the input banks do not have enough information, _e.g._, if the inclusive kinematics bank is empty,
46 /// or if the created bank is empty
47 bool Run(
48 hipo::bank const& particle_bank,
49 hipo::bank const& inc_kin_bank,
50 hipo::bank& result_bank) const;
51
52 /// @brief form dihadrons by pairing hadrons
53 /// @param particle_bank the particle bank
54 /// @returns a list of pairs of hadron rows
55 std::vector<std::pair<int, int>> PairHadrons(hipo::bank const& particle_bank) const;
56
57 private:
58
59 // banklist indices
60 hipo::banklist::size_type b_particle;
61 hipo::banklist::size_type b_inc_kin;
62 hipo::banklist::size_type b_result;
63
64 // `b_result` bank item indices
65 int i_pindex_a;
66 int i_pindex_b;
67 int i_pdg_a;
68 int i_pdg_b;
69 int i_Mh;
70 int i_z;
71 int i_PhPerp;
72 int i_MX2;
73 int i_xF;
74 int i_yB;
75 int i_phiH;
76 int i_phiR;
77 int i_theta;
78
79 // config options
80 std::string o_particle_bank;
81 std::set<int> o_hadron_a_pdgs;
82 std::set<int> o_hadron_b_pdgs;
83 std::string o_phi_r_method;
84 std::string o_theta_method;
85 enum { e_RT_via_covariant_kT } m_phi_r_method;
86 enum { e_hadron_a } m_theta_method;
87
88 // storage for a single hadron
89 struct Hadron {
90 int row;
91 int pdg;
92 ROOT::Math::PxPyPzMVector p;
93 double z;
94 std::optional<ROOT::Math::XYZVector> p_perp;
95 };
96 };
97
98 }
99