GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 80.0% 4 / 0 / 5
Functions: 100.0% 3 / 0 / 3
Branches: 57.1% 8 / 0 / 14

src/iguana/algorithms/clas12/rga/FiducialFilterPass1/Algorithm.h
Line Branch Exec Source
1 #pragma once
2
3 #include "iguana/algorithms/Algorithm.h"
4
5 namespace iguana::clas12::rga {
6
7 /// @algo_brief{Filter the `REC::Particle` bank by applying DC (drift chamber) and ECAL (electromagnetic calorimeter) fiducial cuts}
8 /// @algo_type_filter
9 ///
10 /// Currently these are the "legacy" Pass 1 fiducial cuts tuned for Run Group A.
11 ///
12 /// The following **additional banks** are needed:
13 /// - if configuration option `pass` is `1`:
14 /// - `REC::Particle::Traj`, created by algorithm `iguana::clas12::TrajLinker`
15 /// - `REC::Particle::Calorimeter`, created by algorithm `iguana::clas12::CalorimeterLinker`
16 ///
17 /// @doc_config{clas12/rga/FiducialFilterPass1}
18 class FiducialFilterPass1 : public Algorithm
19 {
20
21
8/14
✓ Branch 2 → 3 taken 2 times.
✓ Branch 2 → 6 taken 1 time.
✗ Branch 5 → 7 not taken.
✓ Branch 5 → 8 taken 2 times.
✓ Branch 9 → 10 taken 3 times.
✗ Branch 9 → 32 not taken.
✓ Branch 10 → 11 taken 2 times.
✓ Branch 10 → 17 taken 1 time.
✓ Branch 17 → 18 taken 3 times.
✗ Branch 17 → 40 not taken.
✓ Branch 24 → 25 taken 3 times.
✗ Branch 24 → 40 not taken.
✗ Branch 32 → 33 not taken.
✗ Branch 32 → 39 not taken.
19 DEFINE_IGUANA_ALGORITHM(FiducialFilterPass1, clas12::rga::FiducialFilterPass1)
22
23 private: // hooks
24 void ConfigHook() override;
25 void StartHook(hipo::banklist& banks) override;
26 bool RunHook(hipo::banklist& banks) const override;
27
28 public:
29
30 /// cut levels, currently only used for PCAL cuts
31 enum CutLevel {
32 loose,
33 medium,
34 tight
35 };
36
37 /// @run_function
38 /// @param [in,out] particleBank `REC::Particle`, which will be filtered
39 /// @param [in] configBank `RUN::config`
40 /// @param [in] trajBank `REC::Particle::Traj`, created by algorithm `clas12::TrajLinker`
41 /// @param [in] calBank `REC::Particle::Calorimeter`, created by algorithm `clas12::CalorimeterLinker`
42 /// @returns `false` if all particles are filtered out
43 bool Run(
44 hipo::bank& particleBank,
45 hipo::bank const& configBank,
46 hipo::bank const& trajBank,
47 hipo::bank const& calBank) const;
48
49 /// @action_function{scalar filter} top-level fiducial cut for RG-A Pass 1
50 /// @param pcal_sector PCAL sector
51 /// @param pcal_lv PCAL lv
52 /// @param pcal_lw PCAL lw
53 /// @param pcal_found if PCAL info exists for this particle, this should be true
54 /// @param dc_sector DC sector
55 /// @param dc_r1_x DC region 1 x
56 /// @param dc_r1_y DC region 1 y
57 /// @param dc_r1_z DC region 1 z
58 /// @param dc_r1_found if DC region 1 info exists for this particle, this should be true
59 /// @param dc_r2_x DC region 2 x
60 /// @param dc_r2_y DC region 2 y
61 /// @param dc_r2_z DC region 2 z
62 /// @param dc_r2_found if DC region 2 info exists for this particle, this should be true
63 /// @param dc_r3_x DC region 3 x
64 /// @param dc_r3_y DC region 3 y
65 /// @param dc_r3_z DC region 3 z
66 /// @param dc_r3_found if DC region 3 info exists for this particle, this should be true
67 /// @param torus the torus magnetic field sign
68 /// @param pid the PDG of the particle
69 /// @returns `true` if passes fiducial cuts
70 bool FilterRgaPass1(
71 int const pcal_sector,
72 float const pcal_lv,
73 float const pcal_lw,
74 bool const pcal_found,
75 int const dc_sector,
76 float const dc_r1_x,
77 float const dc_r1_y,
78 float const dc_r1_z,
79 bool const dc_r1_found,
80 float const dc_r2_x,
81 float const dc_r2_y,
82 float const dc_r2_z,
83 bool const dc_r2_found,
84 float const dc_r3_x,
85 float const dc_r3_y,
86 float const dc_r3_z,
87 bool const dc_r3_found,
88 float const torus,
89 int const pid) const;
90
91 /// @action_function{scalar filter} EC hit position homogeneous cut on lv and lw
92 /// @param pcal_sector PCAL sector
93 /// @param lv PCAL lv
94 /// @param lw PCAL lw
95 /// @param torus the torus magnetic field sign
96 /// @param pid the PDG of the particle
97 bool FilterPcalHomogeneous(
98 int const pcal_sector,
99 float const lv,
100 float const lw,
101 float const torus,
102 int const pid) const;
103
104 /// @action_function{scalar filter} filter using DC XY fiducial cut
105 /// @param dc_sector DC sector
106 /// @param r1_x DC region 1 x
107 /// @param r1_y DC region 1 y
108 /// @param r1_z DC region 1 z
109 /// @param r2_x DC region 2 x
110 /// @param r2_y DC region 2 y
111 /// @param r2_z DC region 2 z
112 /// @param r3_x DC region 3 x
113 /// @param r3_y DC region 3 y
114 /// @param r3_z DC region 3 z
115 /// @param torus the torus magnetic field sign
116 /// @param pid the PDG of the particle
117 /// @returns `true` if passes fiducial cuts
118 bool FilterDcXY(
119 int const dc_sector,
120 float const r1_x,
121 float const r1_y,
122 float const r1_z,
123 float const r2_x,
124 float const r2_y,
125 float const r2_z,
126 float const r3_x,
127 float const r3_y,
128 float const r3_z,
129 float const torus,
130 int const pid) const;
131
132 /// @action_function{scalar filter} filter using DC theta-phi fiducial cut
133 /// @param dc_sector DC sector
134 /// @param r1_x DC region 1 x
135 /// @param r1_y DC region 1 y
136 /// @param r1_z DC region 1 z
137 /// @param r2_x DC region 2 x
138 /// @param r2_y DC region 2 y
139 /// @param r2_z DC region 2 z
140 /// @param r3_x DC region 3 x
141 /// @param r3_y DC region 3 y
142 /// @param r3_z DC region 3 z
143 /// @param torus the torus magnetic field sign
144 /// @param pid the PDG of the particle
145 /// @returns `true` if passes fiducial cuts
146 bool FilterDcThetaPhi(
147 int const dc_sector,
148 float const r1_x,
149 float const r1_y,
150 float const r1_z,
151 float const r2_x,
152 float const r2_y,
153 float const r2_z,
154 float const r3_x,
155 float const r3_y,
156 float const r3_z,
157 float const torus,
158 int const pid) const;
159
160 private: // methods
161
162 /// @param level the cut level string
163 /// @returns `CutLevel` associated to the input
164 CutLevel ParseCutLevel(std::string const& level) const;
165
166 private: // members
167
168 // `hipo::banklist`
169 hipo::banklist::size_type b_particle;
170 hipo::banklist::size_type b_traj;
171 hipo::banklist::size_type b_cal;
172 hipo::banklist::size_type b_config;
173
174 // options
175 CutLevel o_pcal_electron_cut_level;
176 CutLevel o_pcal_photon_cut_level;
177 bool o_enable_pcal_cuts;
178 bool o_enable_dc_cuts;
179 };
180
181 }
182