GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/clas12/rga/FTEnergyCorrection/Algorithm.cc
Date: 2025-11-25 17:57:04
Coverage Exec Excl Total
Lines: 100.0% 27 0 27
Functions: 100.0% 6 0 6
Branches: 58.3% 14 0 24

Line Branch Exec Source
1 #include "Algorithm.h"
2
3 namespace iguana::clas12::rga {
4 REGISTER_IGUANA_ALGORITHM(FTEnergyCorrection);
5
6 1 void FTEnergyCorrection::Start(hipo::banklist& banks)
7 {
8
2/4
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 11 not taken.
✓ Branch 4 → 5 taken 1 time.
✗ Branch 4 → 7 not taken.
1 b_ft_particle = GetBankIndex(banks, "RECFT::Particle");
9 1 electron_mass = particle::mass.at(particle::electron);
10 1 }
11
12 1000 bool FTEnergyCorrection::Run(hipo::banklist& banks) const
13 {
14
2/4
✓ Branch 3 → 4 taken 1000 times.
✗ Branch 3 → 11 not taken.
✓ Branch 4 → 5 taken 1000 times.
✗ Branch 4 → 11 not taken.
2000 return Run(GetBank(banks, b_ft_particle, "RECFT::Particle"));
15 }
16
17 1000 bool FTEnergyCorrection::Run(hipo::bank& ftParticleBank) const
18 {
19
1/2
✓ Branch 5 → 6 taken 1000 times.
✗ Branch 5 → 36 not taken.
2000 ShowBank(ftParticleBank, Logger::Header("INPUT FT PARTICLES"));
20
2/2
✓ Branch 25 → 13 taken 2580 times.
✓ Branch 25 → 26 taken 1000 times.
3580 for(auto const& row : ftParticleBank.getRowList()) {
21
2/2
✓ Branch 14 → 15 taken 377 times.
✓ Branch 14 → 24 taken 2203 times.
2580 if(ftParticleBank.getInt("pid", row) == particle::PDG::electron) {
22 377 auto px = ftParticleBank.getFloat("px", row);
23 377 auto py = ftParticleBank.getFloat("py", row);
24 377 auto pz = ftParticleBank.getFloat("pz", row);
25 377 auto E = std::hypot(std::hypot(px, py, pz), electron_mass);
26
1/2
✓ Branch 19 → 20 taken 377 times.
✗ Branch 19 → 42 not taken.
377 auto [px_new, py_new, pz_new, E_new] = Transform(px, py, pz, E);
27
1/2
✓ Branch 20 → 21 taken 377 times.
✗ Branch 20 → 42 not taken.
377 ftParticleBank.putFloat("px", row, px_new);
28
1/2
✓ Branch 21 → 22 taken 377 times.
✗ Branch 21 → 42 not taken.
377 ftParticleBank.putFloat("py", row, py_new);
29
1/2
✓ Branch 22 → 23 taken 377 times.
✗ Branch 22 → 42 not taken.
377 ftParticleBank.putFloat("pz", row, pz_new);
30 }
31 }
32
1/2
✓ Branch 29 → 30 taken 1000 times.
✗ Branch 29 → 43 not taken.
2000 ShowBank(ftParticleBank, Logger::Header("OUTPUT FT PARTICLES"));
33 1000 return true;
34 }
35
36 377 Momentum4 FTEnergyCorrection::Transform(
37 vector_element_t const px,
38 vector_element_t const py,
39 vector_element_t const pz,
40 vector_element_t const E) const
41 {
42 vector_element_t rho = std::hypot(px, py, pz);
43 377 vector_element_t E_new = CorrectEnergy(E);
44 377 return {E_new * (px / rho), E_new * (py / rho), E_new * (pz / rho), E_new};
45 }
46
47 377 vector_element_t FTEnergyCorrection::CorrectEnergy(vector_element_t const E) const
48 {
49 377 return E + 0.0208922 + 0.050158 * E - 0.0181107 * pow(E, 2) + 0.00305671 * pow(E, 3) - 0.000178235 * pow(E, 4);
50 }
51
52 1 void FTEnergyCorrection::Stop()
53 {
54 1 }
55
56 }
57