GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/clas12/rga/MomentumCorrection/Algorithm.h
Date: 2025-11-25 17:57:04
Coverage Exec Excl Total
Lines: 75.0% 3 0 4
Functions: 100.0% 3 0 3
Branches: 42.9% 6 0 14

Line Branch Exec Source
1 #pragma once
2
3 #include "iguana/algorithms/Algorithm.h"
4 #include "iguana/algorithms/TypeDefs.h"
5
6 namespace iguana::clas12::rga {
7
8 /// @algo_brief{Momentum Corrections}
9 /// @algo_type_transformer
10 /// Adapted from <https://clasweb.jlab.org/wiki/index.php/CLAS12_Momentum_Corrections#tab=Correction_Code>
11 class MomentumCorrection : public Algorithm
12 {
13
14
6/14
✓ Branch 2 → 3 taken 5 times.
✗ Branch 2 → 6 not taken.
✗ Branch 5 → 7 not taken.
✓ Branch 5 → 8 taken 5 times.
✓ Branch 9 → 10 taken 5 times.
✗ Branch 9 → 32 not taken.
✓ Branch 10 → 11 taken 5 times.
✗ Branch 10 → 17 not taken.
✓ Branch 17 → 18 taken 5 times.
✗ Branch 17 → 40 not taken.
✓ Branch 24 → 25 taken 5 times.
✗ Branch 24 → 40 not taken.
✗ Branch 32 → 33 not taken.
✗ Branch 32 → 39 not taken.
38 DEFINE_IGUANA_ALGORITHM(MomentumCorrection, clas12::rga::MomentumCorrection)
15
16 public:
17
18 void Start(hipo::banklist& banks) override;
19 bool Run(hipo::banklist& banks) const override;
20 void Stop() override;
21
22 /// @run_function
23 /// @param [in,out] particleBank `REC::Particle`; the momenta will be corrected
24 /// @param [in] sectorBank `REC::Particle::Sector`, from `SectorFinder`
25 /// @param [in] configBank `RUN::config`
26 /// @run_function_returns_true
27 bool Run(
28 hipo::bank& particleBank,
29 hipo::bank const& sectorBank,
30 hipo::bank const& configBank) const;
31
32 /// @action_function{scalar transformer} Apply the momentum correction
33 /// @param px @f$p_x@f$
34 /// @param py @f$p_y@f$
35 /// @param pz @f$p_z@f$
36 /// @param sec the sector
37 /// @param pid the particle PDG
38 /// @param torus torus setting
39 /// @returns the transformed momentum
40 Momentum3 Transform(vector_element_t const px, vector_element_t const py, vector_element_t const pz, int const sec, int const pid, float const torus) const;
41
42 /// @action_function{scalar creator} Calculate the correction factor for inbending data
43 /// @param px @f$p_x@f$
44 /// @param py @f$p_y@f$
45 /// @param pz @f$p_z@f$
46 /// @param sec the sector
47 /// @param pid the particle PDG
48 /// @returns the correction factor
49 double CorrectionInbending(vector_element_t const px, vector_element_t const py, vector_element_t const pz, int const sec, int const pid) const;
50
51 /// @action_function{scalar creator} Calculate the correction factor for outbending data
52 /// @param px @f$p_x@f$
53 /// @param py @f$p_y@f$
54 /// @param pz @f$p_z@f$
55 /// @param sec the sector
56 /// @param pid the particle PDG
57 /// @returns the correction factor
58 double CorrectionOutbending(vector_element_t const px, vector_element_t const py, vector_element_t const pz, int const sec, int const pid) const;
59
60 /// @action_function{scalar creator} Energy loss correction for inbending data
61 /// @param px @f$p_x@f$
62 /// @param py @f$p_y@f$
63 /// @param pz @f$p_z@f$
64 /// @param pid the particle PDG
65 /// @returns the correction factor
66 double EnergyLossInbending(vector_element_t const px, vector_element_t const py, vector_element_t const pz, int const pid) const;
67
68 /// @action_function{scalar creator} Energy loss correction for outbending data
69 /// @param px @f$p_x@f$
70 /// @param py @f$p_y@f$
71 /// @param pz @f$p_z@f$
72 /// @param pid the particle PDG
73 /// @returns the correction factor
74 double EnergyLossOutbending(vector_element_t const px, vector_element_t const py, vector_element_t const pz, int const pid) const;
75
76 private:
77
78 /// `hipo::banklist` indices
79 hipo::banklist::size_type b_particle;
80 hipo::banklist::size_type b_sector;
81 hipo::banklist::size_type b_config;
82 };
83
84 }
85