GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/physics/DihadronKinematics/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: 40.9% 9 0 22

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