GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/clas12/MatchParticleProximity/Algorithm.h
Date: 2025-12-23 16:10:08
Coverage Exec Excl Total
Lines: 100.0% 4 0 4
Functions: 100.0% 3 0 3
Branches: 38.9% 7 0 18

Line Branch Exec Source
1 #pragma once
2
3 #include "iguana/algorithms/Algorithm.h"
4
5 namespace iguana::clas12 {
6
7 /// @algo_brief{Simple particle matching by proximity, for example, MC truth-matching}
8 /// @algo_type_creator
9 /// @begin_doc_config{clas12/MatchParticleProximity}
10 /// @config_param{bank_a | string | the particle bank to match from}
11 /// @config_param{bank_b | string | the particle bank to match to}
12 /// @end_doc
13 ///
14 /// This algorithm matches one particle bank to another, by smallest proximity, where proximity
15 /// is the Euclidean distance in (theta,phi) space.
16 ///
17 /// By default, it matches `REC::Particle` particles to `MC::Particle` particles. This configuration
18 /// is useful for MC files which _lack_ truth-matching banks (`MC::GenMatch` and `MC::RecMatch`);
19 /// you should prefer the truth-matching banks instead, if they are available.
20 ///
21 /// You may also use this algorithm to match `MC::Lund` to `MC::Particle`; in this case, expect match proximity
22 /// values to be very close to zero.
23 class MatchParticleProximity : public Algorithm
24 {
25
26
7/18
iguana::clas12::MatchParticleProximity::~MatchParticleProximity():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 5 not taken.
iguana::clas12::MatchParticleProximity::MatchParticleProximity(std::basic_string_view<char, std::char_traits<char> >):
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 6 not taken.
✗ Branch 5 → 7 not taken.
✓ Branch 5 → 8 taken 1 time.
✓ Branch 9 → 10 taken 1 time.
✗ Branch 9 → 32 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 17 not taken.
✓ Branch 17 → 18 taken 1 time.
✗ Branch 17 → 40 not taken.
✓ Branch 24 → 25 taken 1 time.
✗ 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.
10 DEFINE_IGUANA_ALGORITHM(MatchParticleProximity, clas12::MatchParticleProximity)
27
28 public:
29
30 void Start(hipo::banklist& banks) override;
31 bool Run(hipo::banklist& banks) const override;
32 void Stop() override;
33
34 /// @run_function
35 /// @param [in] bank_a the particle bank to match from, _e.g._, `REC::Particle`
36 /// @param [in] bank_b the particle bank to match to, _e.g._, `MC::Particle`
37 /// @param [out] result_bank `%clas12::MatchParticleProximity`, which will be created
38 /// @returns `true` if the created bank is not empty
39 bool Run(
40 hipo::bank const& bank_a,
41 hipo::bank const& bank_b,
42 hipo::bank& result_bank) const;
43
44 private:
45
46 // config options
47 std::string o_bank_a;
48 std::string o_bank_b;
49
50 // banklist indices
51 hipo::banklist::size_type b_bank_a;
52 hipo::banklist::size_type b_bank_b;
53 hipo::banklist::size_type b_result;
54
55 // `b_result` bank item indices
56 int i_pindex_a;
57 int i_pindex_b;
58 int i_proximity;
59 };
60
61 }
62