GCC Code Coverage Report


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

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 /// Set of hadron kinematics variables
10 struct SingleHadronKinematicsVars {
11 /// @brief `REC::Particle` row (`pindex`) of the hadron
12 int pindex;
13 /// @brief PDG code of the hadron
14 int pdg;
15 /// @brief @latex{z}: Momentum fraction of the fragmenting parton carried by the hadron
16 double z;
17 /// @brief @latex{P_h^\perp}: transverse momentum of the hadron in the @latex{\perp}-frame (transverse to @latex{\vec{q}})
18 double PhPerp;
19 /// @brief @latex{M_X(ehX)^2}: Missing mass squared of the hadron
20 double MX2;
21 /// @brief @latex{x_F}: Feynman-x of the hadron
22 double xF;
23 /// @brief @latex{y_{h,B}}: Breit frame rapidity of the hadron
24 double yB;
25 /// @brief @latex{\phi_h}: @latex{q}-azimuthal angle between the lepton-scattering plane and the @latex{\vec{q}\times\vec{P}_h} plane;
26 /// if the value is `tools::UNDEF`, the calculation failed
27 double phiH;
28 /// @brief @latex{\xi_h}: Longitudinal momentum fraction of the nucleon carried by the hadron
29 double xi;
30 };
31
32 /// @brief_algo Calculate semi-inclusive hadron kinematic quantities defined in `iguana::physics::SingleHadronKinematicsVars`
33 ///
34 /// @begin_doc_algo{physics::SingleHadronKinematics | Creator}
35 /// @input_banks{REC::Particle, %physics::InclusiveKinematics}
36 /// @output_banks{%physics::SingleHadronKinematics}
37 /// @end_doc
38 ///
39 /// @begin_doc_config
40 /// @config_param{hadron_list | list[int] | list of hadron PDGs}
41 /// @end_doc
42 ///
43 /// The output bank `%physics::SingleHadronKinematics` will have the same number of rows as the input particle bank `REC::Particle`
44 /// - we want the output bank to have the same number of rows and ordering as the input
45 /// particle bank, so that banks which reference the input particle bank's rows (usually via `pindex`) can be used to
46 /// reference the output bank's rows too
47 /// - rows of the input particle bank which were filtered upstream will also be filtered out here, and all the values of the
48 /// corresponding row in the output bank will be zeroed, since no calculations are performed for
49 /// those particles
50 /// - particles which are not listed in the configuration parameter `hadron_list` will also be filtered out and zeroed
51 class SingleHadronKinematics : public Algorithm
52 {
53
54
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.
2016 DEFINE_IGUANA_ALGORITHM(SingleHadronKinematics, physics::SingleHadronKinematics)
55
56 public:
57
58 void Start(hipo::banklist& banks) override;
59 void Run(hipo::banklist& banks) const override;
60 void Stop() override;
61
62 private:
63
64 // banklist indices
65 hipo::banklist::size_type b_particle;
66 hipo::banklist::size_type b_inc_kin;
67 hipo::banklist::size_type b_result;
68
69 // `b_result` bank item indices
70 int i_pindex;
71 int i_pdg;
72 int i_z;
73 int i_PhPerp;
74 int i_MX2;
75 int i_xF;
76 int i_yB;
77 int i_phiH;
78 int i_xi;
79
80 // config options
81 std::set<int> o_hadron_pdgs;
82
83 };
84
85 }
86