GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/physics/DihadronKinematics/Algorithm.h
Date: 2025-01-05 09:03:17
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 4 4 100.0%
Branches: 5 12 41.7%

Line Branch Exec Source
1 #pragma once
2
3 #include "iguana/algorithms/Algorithm.h"
4 #include "iguana/algorithms/physics/Tools.h"
5 #include <Math/Vector3D.h>
6 #include <Math/Vector4D.h>
7
8 namespace iguana::physics {
9
10 /// Set of dihadron kinematics variables
11 struct DihadronKinematicsVars {
12 /// @brief `REC::Particle` row (`pindex`) of hadron A
13 int pindex_a;
14 /// @brief `REC::Particle` row (`pindex`) of hadron B
15 int pindex_b;
16 /// @brief PDG code of hadron A
17 int pdg_a;
18 /// @brief PDG code of hadron B
19 int pdg_b;
20 /// @brief @latex{M_h}: Invariant mass of the dihadron
21 double Mh;
22 /// @brief @latex{z}: Momentum fraction of the fragmenting parton carried by the dihadron
23 double z;
24 /// @brief @latex{P_h^\perp}: transverse momentum of the dihadron in the @latex{\perp}-frame (transverse to @latex{\vec{q}})
25 double PhPerp;
26 /// @brief @latex{M_X(ehhX)^2}: Missing mass squared of the dihadron
27 double MX2;
28 /// @brief @latex{x_F}: Feynman-x of the dihadron
29 double xF;
30 /// @brief @latex{y_{h,B}}: Breit frame rapidity of the dihadron
31 double yB;
32 /// @brief @latex{\phi_h}: @latex{q}-azimuthal angle between the lepton-scattering plane and the @latex{\vec{q}\times\vec{P}_h} plane;
33 /// if the value is `tools::UNDEF`, the calculation failed
34 double phiH;
35 /// @brief @latex{\phi_R}: @latex{q}-azimuthal angle between the lepton-scattering plane and dihadron plane;
36 /// if the value is `tools::UNDEF`, the calculation failed
37 double phiR;
38 /// @brief @latex{\theta}: The "decay" angle of hadron A in the dihadron rest frame, with respect;
39 /// to the dihadron momentum direction
40 double theta;
41 };
42
43 /// @brief_algo Calculate semi-inclusive dihadron kinematic quantities defined in `iguana::physics::DihadronKinematicsVars`
44 ///
45 /// @begin_doc_algo{physics::DihadronKinematics | Creator}
46 /// @input_banks{REC::Particle, %physics::InclusiveKinematics}
47 /// @output_banks{%physics::DihadronKinematics}
48 /// @end_doc
49 ///
50 /// @begin_doc_config
51 /// @config_param{hadron_a_list | list[int] | list of "hadron A" PDGs}
52 /// @config_param{hadron_b_list | list[int] | list of "hadron B" PDGs}
53 /// @config_param{phi_r_method | string | method used to calculate @latex{\phi_R} (see section "phiR calculation methods" below)}
54 /// @config_param{theta_method | string | method used to calculate @latex{\theta} (see section "theta calculation methods" below)}
55 /// @end_doc
56 ///
57 /// Dihadron PDGs will be formed from pairs from `hadron_a_list` and `hadron_b_list`. For example,
58 /// if you define:
59 /// ```yaml
60 /// hadron_a_list: [ 211 ]
61 /// hadron_b_list: [ -211, 2212 ]
62 /// ```
63 /// then the algorithm will calculate kinematics for @latex{\pi^+\pi^-} and @latex{\pi^+p} dihadrons; hadron A
64 /// is the @latex{\pi^+} for both of these, whereas hadron B is the @latex{\pi^-} for the former and the proton
65 /// for the latter.
66 ///
67 /// @par phiR calculation methods
68 /// - `"RT_via_covariant_kT"`: use @latex{R_T} computed via covariant @latex{k_T} formula
69 ///
70 /// @par theta calculation methods
71 /// - `"hadron_a"`: use hadron A's "decay angle" in the dihadron rest frame
72 class DihadronKinematics : public Algorithm
73 {
74
75
5/12
✓ Branch 0 taken 2002 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
2020 DEFINE_IGUANA_ALGORITHM(DihadronKinematics, physics::DihadronKinematics)
76
77 public:
78
79 void Start(hipo::banklist& banks) override;
80 void Run(hipo::banklist& banks) const override;
81 void Stop() override;
82
83 /// @brief form dihadrons by pairing hadrons
84 /// @param particle_bank the particle bank (`REC::Particle`)
85 /// @returns a list of pairs of hadron rows
86 std::vector<std::pair<int,int>> PairHadrons(hipo::bank const& particle_bank) const;
87
88 private:
89
90 // banklist indices
91 hipo::banklist::size_type b_particle;
92 hipo::banklist::size_type b_inc_kin;
93 hipo::banklist::size_type b_result;
94
95 // `b_result` bank item indices
96 int i_pindex_a;
97 int i_pindex_b;
98 int i_pdg_a;
99 int i_pdg_b;
100 int i_Mh;
101 int i_z;
102 int i_PhPerp;
103 int i_MX2;
104 int i_xF;
105 int i_yB;
106 int i_phiH;
107 int i_phiR;
108 int i_theta;
109
110 // config options
111 std::set<int> o_hadron_a_pdgs;
112 std::set<int> o_hadron_b_pdgs;
113 std::string o_phi_r_method;
114 std::string o_theta_method;
115 enum {e_RT_via_covariant_kT} m_phi_r_method;
116 enum {e_hadron_a} m_theta_method;
117
118 // storage for a single hadron
119 struct Hadron {
120 int row;
121 int pdg;
122 ROOT::Math::PxPyPzMVector p;
123 double z;
124 std::optional<ROOT::Math::XYZVector> p_perp;
125 };
126
127 };
128
129 }
130