GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/clas12/rga/FiducialFilterPass1/Algorithm.cc
Date: 2025-11-25 17:57:04
Coverage Exec Excl Total
Lines: 76.2% 163 0 214
Functions: 100.0% 10 0 10
Branches: 59.2% 151 0 255

Line Branch Exec Source
1 #include "Algorithm.h"
2 #include "Pass1CutData.h"
3
4 namespace iguana::clas12::rga {
5
6 REGISTER_IGUANA_ALGORITHM(FiducialFilterPass1);
7
8 2 void FiducialFilterPass1::Start(hipo::banklist& banks)
9 {
10 2 ParseYAMLConfig();
11
4/8
✓ Branch 4 → 5 taken 2 times.
✗ Branch 4 → 92 not taken.
✓ Branch 5 → 6 taken 2 times.
✗ Branch 5 → 86 not taken.
✓ Branch 6 → 7 taken 2 times.
✗ Branch 6 → 80 not taken.
✓ Branch 7 → 8 taken 2 times.
✗ Branch 7 → 10 not taken.
4 o_pcal_electron_cut_level = ParseCutLevel(GetOptionScalar<std::string>("pcal_electron_cut_level"));
12
4/8
✓ Branch 19 → 20 taken 2 times.
✗ Branch 19 → 106 not taken.
✓ Branch 20 → 21 taken 2 times.
✗ Branch 20 → 100 not taken.
✓ Branch 21 → 22 taken 2 times.
✗ Branch 21 → 94 not taken.
✓ Branch 22 → 23 taken 2 times.
✗ Branch 22 → 25 not taken.
4 o_pcal_photon_cut_level = ParseCutLevel(GetOptionScalar<std::string>("pcal_photon_cut_level"));
13
3/6
✓ Branch 34 → 35 taken 2 times.
✗ Branch 34 → 114 not taken.
✓ Branch 35 → 36 taken 2 times.
✗ Branch 35 → 108 not taken.
✗ Branch 36 → 37 not taken.
✓ Branch 36 → 39 taken 2 times.
4 o_enable_pcal_cuts = GetOptionScalar<int>("enable_pcal_cuts") == 1;
14
3/6
✓ Branch 43 → 44 taken 2 times.
✗ Branch 43 → 122 not taken.
✓ Branch 44 → 45 taken 2 times.
✗ Branch 44 → 116 not taken.
✓ Branch 45 → 46 taken 2 times.
✗ Branch 45 → 48 not taken.
4 o_enable_dc_cuts = GetOptionScalar<int>("enable_dc_cuts") == 1;
15
16
2/4
✓ Branch 52 → 53 taken 2 times.
✗ Branch 52 → 124 not taken.
✓ Branch 53 → 54 taken 2 times.
✗ Branch 53 → 56 not taken.
2 b_particle = GetBankIndex(banks, "REC::Particle");
17
2/4
✓ Branch 59 → 60 taken 2 times.
✗ Branch 59 → 130 not taken.
✓ Branch 60 → 61 taken 2 times.
✗ Branch 60 → 63 not taken.
2 b_config = GetBankIndex(banks, "RUN::config");
18
2/4
✓ Branch 66 → 67 taken 2 times.
✗ Branch 66 → 136 not taken.
✗ Branch 67 → 68 not taken.
✓ Branch 67 → 70 taken 2 times.
2 b_traj = GetBankIndex(banks, "REC::Particle::Traj");
19
2/4
✓ Branch 73 → 74 taken 2 times.
✗ Branch 73 → 142 not taken.
✗ Branch 74 → 75 not taken.
✓ Branch 74 → 77 taken 2 times.
2 b_cal = GetBankIndex(banks, "REC::Particle::Calorimeter");
20 2 }
21
22 //////////////////////////////////////////////////////////////////////////////////
23
24 2000 bool FiducialFilterPass1::Run(hipo::banklist& banks) const
25 {
26
1/2
✓ Branch 10 → 11 taken 2000 times.
✗ Branch 10 → 32 not taken.
2000 return Run(
27
3/8
✓ Branch 8 → 9 taken 2000 times.
✗ Branch 8 → 38 not taken.
✓ Branch 9 → 10 taken 2000 times.
✗ Branch 9 → 32 not taken.
✓ Branch 16 → 17 taken 2000 times.
✗ Branch 16 → 19 not taken.
✗ Branch 38 → 39 not taken.
✗ Branch 38 → 41 not taken.
4000 GetBank(banks, b_particle, "REC::Particle"),
28
3/8
✓ Branch 6 → 7 taken 2000 times.
✗ Branch 6 → 44 not taken.
✓ Branch 7 → 8 taken 2000 times.
✗ Branch 7 → 38 not taken.
✗ Branch 21 → 22 not taken.
✓ Branch 21 → 24 taken 2000 times.
✗ Branch 44 → 45 not taken.
✗ Branch 44 → 47 not taken.
4000 GetBank(banks, b_config, "RUN::config"),
29
3/8
✓ Branch 4 → 5 taken 2000 times.
✗ Branch 4 → 50 not taken.
✓ Branch 5 → 6 taken 2000 times.
✗ Branch 5 → 44 not taken.
✗ Branch 26 → 27 not taken.
✓ Branch 26 → 29 taken 2000 times.
✗ Branch 50 → 51 not taken.
✗ Branch 50 → 53 not taken.
4000 GetBank(banks, b_traj, "REC::Particle::Traj"),
30
1/2
✓ Branch 3 → 4 taken 2000 times.
✗ Branch 3 → 50 not taken.
4000 GetBank(banks, b_cal, "REC::Particle::Calorimeter"));
31 }
32
33 2000 bool FiducialFilterPass1::Run(
34 hipo::bank& particleBank,
35 hipo::bank const& configBank,
36 hipo::bank const& trajBank,
37 hipo::bank const& calBank) const
38 {
39
2/4
✓ Branch 5 → 6 taken 2000 times.
✗ Branch 5 → 34 not taken.
✓ Branch 11 → 12 taken 2000 times.
✗ Branch 11 → 13 not taken.
6000 ShowBank(particleBank, Logger::Header("INPUT PARTICLES"));
40
41
2/4
✓ Branch 11 → 12 taken 2000 times.
✗ Branch 11 → 13 not taken.
✗ Branch 12 → 13 not taken.
✓ Branch 12 → 16 taken 2000 times.
2000 if(auto num_rows{particleBank.getRows()}; num_rows != trajBank.getRows() || num_rows != calBank.getRows()) {
42 m_log->Error("number of particle bank rows differs from 'REC::Particle::Traj' and/or 'REC::Particle::Calorimeter' rows; are you sure these input banks are being filled?");
43 throw std::runtime_error("cannot proceed");
44 }
45 2000 auto torus = configBank.getFloat("torus", 0);
46
1/2
✓ Branch 19 → 21 taken 2000 times.
✗ Branch 19 → 42 not taken.
2000 particleBank.getMutableRowList().filter([this, torus, &trajBank, &calBank](hipo::bank& bank, int row) {
47 9319 auto pid = bank.getInt("pid", row);
48
3/6
✓ Branch 3 → 4 taken 9319 times.
✗ Branch 3 → 25 not taken.
✓ Branch 4 → 5 taken 9319 times.
✗ Branch 4 → 25 not taken.
✓ Branch 5 → 6 taken 9319 times.
✗ Branch 5 → 25 not taken.
9319 if(row >= 0 && row < calBank.getRows() && row < trajBank.getRows()) {
49 // call the action function
50 37276 return FilterRgaPass1(
51 calBank.getInt("pcal_sector", row),
52 calBank.getFloat("pcal_lv", row),
53 calBank.getFloat("pcal_lw", row),
54 9319 calBank.getByte("pcal_found", row) == 1,
55 trajBank.getInt("sector", row),
56 trajBank.getFloat("r1_x", row),
57 trajBank.getFloat("r1_y", row),
58 trajBank.getFloat("r1_z", row),
59 9319 trajBank.getByte("r1_found", row) == 1,
60 trajBank.getFloat("r2_x", row),
61 trajBank.getFloat("r2_y", row),
62 trajBank.getFloat("r2_z", row),
63 9319 trajBank.getByte("r2_found", row) == 1,
64 trajBank.getFloat("r3_x", row),
65 trajBank.getFloat("r3_y", row),
66 trajBank.getFloat("r3_z", row),
67 9319 trajBank.getByte("r3_found", row) == 1,
68 torus,
69 9319 pid);
70 }
71 else
72 throw std::runtime_error(fmt::format("FiducialFilterPass1 filter encountered bad row number {}", row));
73 });
74
75
1/2
✓ Branch 26 → 27 taken 2000 times.
✗ Branch 26 → 45 not taken.
4000 ShowBank(particleBank, Logger::Header("OUTPUT PARTICLES"));
76 2000 return !particleBank.getRowList().empty();
77 }
78
79 //////////////////////////////////////////////////////////////////////////////////
80
81 2 void FiducialFilterPass1::Stop()
82 {
83 2 }
84
85 //////////////////////////////////////////////////////////////////////////////////
86
87 4 FiducialFilterPass1::CutLevel FiducialFilterPass1::ParseCutLevel(std::string const& level) const
88 {
89
2/2
✓ Branch 2 → 3 taken 2 times.
✓ Branch 2 → 23 taken 2 times.
4 if(level == "loose")
90 return loose;
91
1/2
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 23 taken 2 times.
2 else if(level == "medium")
92 return medium;
93 else if(level == "tight")
94 return tight;
95 else
96 throw std::runtime_error(std::string("unknown PCAL cut level ") + level);
97 }
98
99 //////////////////////////////////////////////////////////////////////////////////
100 //////////////////////////////////////////////////////////////////////////////////
101 //////////////////////////////////////////////////////////////////////////////////
102
103
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 6 taken 9319 times.
9319 bool FiducialFilterPass1::FilterRgaPass1(
104 int const pcal_sector,
105 float const pcal_lv,
106 float const pcal_lw,
107 bool const pcal_found,
108 int const dc_sector,
109 float const dc_r1_x,
110 float const dc_r1_y,
111 float const dc_r1_z,
112 bool const dc_r1_found,
113 float const dc_r2_x,
114 float const dc_r2_y,
115 float const dc_r2_z,
116 bool const dc_r2_found,
117 float const dc_r3_x,
118 float const dc_r3_y,
119 float const dc_r3_z,
120 bool const dc_r3_found,
121 float const torus,
122 int const pid) const
123 {
124
125 // reject if torus is not +/-1
126
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 6 taken 9319 times.
9319 if(std::abs(torus) != 1) {
127 m_log->Warn("torus={}...value must be either -1 or 1, otherwise fiducial cuts are not defined...filtering out all particles...", torus);
128 return false;
129 }
130 // apply cuts
131 bool result = true;
132
2/2
✓ Branch 6 → 7 taken 5941 times.
✓ Branch 6 → 8 taken 3378 times.
9319 bool dc_found = dc_r1_found && dc_r2_found && dc_r3_found;
133
4/4
✓ Branch 8 → 9 taken 3374 times.
✓ Branch 8 → 10 taken 1289 times.
✓ Branch 8 → 22 taken 1839 times.
✓ Branch 8 → 40 taken 2817 times.
9319 switch(pid) {
134 1289 case 11: // electrons
135 case -11: // positrons
136 {
137
1/2
✗ Branch 10 → 11 not taken.
✓ Branch 10 → 12 taken 1289 times.
1289 if(o_enable_pcal_cuts)
138
4/4
✓ Branch 12 → 13 taken 301 times.
✓ Branch 12 → 15 taken 988 times.
✓ Branch 14 → 11 taken 257 times.
✓ Branch 14 → 15 taken 44 times.
1289 result &= pcal_found && FilterPcalHomogeneous(pcal_sector, pcal_lv, pcal_lw, torus, pid);
139
1/2
✓ Branch 16 → 17 taken 1289 times.
✗ Branch 16 → 40 not taken.
1289 if(o_enable_dc_cuts)
140
4/4
✓ Branch 17 → 18 taken 301 times.
✓ Branch 17 → 20 taken 988 times.
✓ Branch 19 → 20 taken 31 times.
✓ Branch 19 → 21 taken 270 times.
1289 result &= dc_found && FilterDcXY(dc_sector, dc_r1_x, dc_r1_y, dc_r1_z, dc_r2_x, dc_r2_y, dc_r2_z, dc_r3_x, dc_r3_y, dc_r3_z, torus, pid);
141 break;
142 }
143 1839 case 22: // photons
144 {
145
1/2
✗ Branch 22 → 9 not taken.
✓ Branch 22 → 23 taken 1839 times.
1839 if(o_enable_pcal_cuts)
146
4/4
✓ Branch 23 → 24 taken 1506 times.
✓ Branch 23 → 26 taken 333 times.
✓ Branch 25 → 9 taken 1344 times.
✓ Branch 25 → 26 taken 162 times.
1839 result &= pcal_found && FilterPcalHomogeneous(pcal_sector, pcal_lv, pcal_lw, torus, pid);
147 }
148 case 211: // pi+
149 case -211: // pi-
150 case 2212: // protons
151 {
152
1/2
✓ Branch 27 → 28 taken 5213 times.
✗ Branch 27 → 40 not taken.
5213 if(o_enable_dc_cuts) {
153
1/2
✓ Branch 28 → 29 taken 5213 times.
✗ Branch 28 → 34 not taken.
5213 if(torus < 0) // inbending
154
4/4
✓ Branch 29 → 30 taken 2732 times.
✓ Branch 29 → 32 taken 2481 times.
✓ Branch 31 → 32 taken 42 times.
✓ Branch 31 → 33 taken 2690 times.
5213 result &= dc_found && FilterDcThetaPhi(dc_sector, dc_r1_x, dc_r1_y, dc_r1_z, dc_r2_x, dc_r2_y, dc_r2_z, dc_r3_x, dc_r3_y, dc_r3_z, torus, pid);
155 else if(torus > 0) // outbending
156 result &= dc_found && FilterDcXY(dc_sector, dc_r1_x, dc_r1_y, dc_r1_z, dc_r2_x, dc_r2_y, dc_r2_z, dc_r3_x, dc_r3_y, dc_r3_z, torus, pid);
157 else
158 result = false;
159 }
160 break;
161 }
162 default:
163 result = true; // cut not applied, do not filter
164 }
165 return result;
166 }
167
168 //////////////////////////////////////////////////////////////////////////////////
169 //////////////////////////////////////////////////////////////////////////////////
170 //////////////////////////////////////////////////////////////////////////////////
171
172 1807 bool FiducialFilterPass1::FilterPcalHomogeneous(
173 int const pcal_sector,
174 float const lv,
175 float const lw,
176 float const torus,
177 int const pid) const
178 {
179
1/2
✓ Branch 2 → 3 taken 1807 times.
✗ Branch 2 → 28 not taken.
1807 if(!o_enable_pcal_cuts)
180 return true;
181 // set cut level from PDG
182 CutLevel cut_level;
183
2/3
✓ Branch 3 → 4 taken 301 times.
✓ Branch 3 → 5 taken 1506 times.
✗ Branch 3 → 6 not taken.
1807 switch(pid) {
184 301 case 11:
185 case -11:
186 301 cut_level = o_pcal_electron_cut_level;
187 301 break;
188 1506 case 22:
189 1506 cut_level = o_pcal_photon_cut_level;
190 1506 break;
191 default:
192 m_log->Error("called FilterPcalHomogeneous with unknown PDG {}", pid);
193 return false;
194 }
195 // NOTE: lv + lw is going from the side to the back end of the PCAL, lu is going from side to side
196 // 1 scintillator bar is 4.5 cm wide. In the outer regions (back) double bars are used.
197 // A cut is only applied on lv and lw
198 double min_v = 0;
199 double max_v = 0;
200 double min_w = 0;
201 double max_w = 0;
202
2/2
✓ Branch 23 → 10 taken 10842 times.
✓ Branch 23 → 24 taken 1807 times.
12649 for(int k = 0; k < 6; k++) {
203
3/4
✓ Branch 10 → 11 taken 1807 times.
✓ Branch 10 → 16 taken 9035 times.
✓ Branch 11 → 12 taken 1807 times.
✗ Branch 11 → 16 not taken.
10842 if(pcal_sector - 1 == k && torus < 0) { // inbending
204
2/4
✗ Branch 12 → 13 not taken.
✓ Branch 12 → 14 taken 1506 times.
✓ Branch 12 → 15 taken 301 times.
✗ Branch 12 → 22 not taken.
1807 switch(cut_level) {
205 case tight:
206 min_v = fiducial_pass1::min_lv_tight_inb[k];
207 max_v = fiducial_pass1::max_lv_tight_inb[k];
208 min_w = fiducial_pass1::min_lw_tight_inb[k];
209 max_w = fiducial_pass1::max_lw_tight_inb[k];
210 break;
211 1506 case medium:
212 1506 min_v = fiducial_pass1::min_lv_med_inb[k];
213 1506 max_v = fiducial_pass1::max_lv_med_inb[k];
214 1506 min_w = fiducial_pass1::min_lw_med_inb[k];
215 1506 max_w = fiducial_pass1::max_lw_med_inb[k];
216 1506 break;
217 301 case loose:
218 301 min_v = fiducial_pass1::min_lv_loose_inb[k];
219 301 max_v = fiducial_pass1::max_lv_loose_inb[k];
220 301 min_w = fiducial_pass1::min_lw_loose_inb[k];
221 301 max_w = fiducial_pass1::max_lw_loose_inb[k];
222 301 break;
223 }
224 }
225
1/4
✗ Branch 16 → 17 not taken.
✓ Branch 16 → 22 taken 9035 times.
✗ Branch 17 → 18 not taken.
✗ Branch 17 → 22 not taken.
9035 else if(pcal_sector - 1 == k && torus > 0) { // outbending
226 switch(cut_level) {
227 case tight:
228 min_v = fiducial_pass1::min_lv_tight_out[k];
229 max_v = fiducial_pass1::max_lv_tight_out[k];
230 min_w = fiducial_pass1::min_lw_tight_out[k];
231 max_w = fiducial_pass1::max_lw_tight_out[k];
232 break;
233 case medium:
234 min_v = fiducial_pass1::min_lv_med_out[k];
235 max_v = fiducial_pass1::max_lv_med_out[k];
236 min_w = fiducial_pass1::min_lw_med_out[k];
237 max_w = fiducial_pass1::max_lw_med_out[k];
238 break;
239 case loose:
240 min_v = fiducial_pass1::min_lv_loose_out[k];
241 max_v = fiducial_pass1::max_lv_loose_out[k];
242 min_w = fiducial_pass1::min_lw_loose_out[k];
243 max_w = fiducial_pass1::max_lw_loose_out[k];
244 break;
245 }
246 }
247 }
248
8/8
✓ Branch 24 → 8 taken 85 times.
✓ Branch 24 → 25 taken 1722 times.
✓ Branch 25 → 8 taken 1 time.
✓ Branch 25 → 26 taken 1721 times.
✓ Branch 26 → 8 taken 119 times.
✓ Branch 26 → 27 taken 1602 times.
✓ Branch 27 → 8 taken 1 time.
✓ Branch 27 → 28 taken 1601 times.
1807 return lv > min_v && lv < max_v && lw > min_w && lw < max_w;
249 }
250
251 //////////////////////////////////////////////////////////////////////////////////
252
253 301 bool FiducialFilterPass1::FilterDcXY(
254 int const dc_sector,
255 float const r1_x,
256 float const r1_y,
257 float const r1_z,
258 float const r2_x,
259 float const r2_y,
260 float const r2_z,
261 float const r3_x,
262 float const r3_y,
263 float const r3_z,
264 float const torus,
265 int const pid) const
266 {
267
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 301 times.
301 if(!o_enable_dc_cuts)
268 return true;
269
1/2
✗ Branch 4 → 5 not taken.
✓ Branch 4 → 6 taken 301 times.
301 if(!(dc_sector >= 1 && dc_sector <= 6))
270 return false;
271
1/2
✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 301 times.
301 auto const& minparams = ((torus < 0) ? fiducial_pass1::minparams_in_XY_pass1 : fiducial_pass1::minparams_out_XY_pass1);
272 auto const& maxparams = ((torus < 0) ? fiducial_pass1::maxparams_in_XY_pass1 : fiducial_pass1::maxparams_out_XY_pass1);
273 double X = 0;
274 double Y = 0;
275
2/2
✓ Branch 34 → 3 taken 270 times.
✓ Branch 34 → 9 taken 855 times.
1125 for(int region = 0; region < 3; region++) {
276 X = 0;
277 Y = 0;
278
3/3
✓ Branch 9 → 10 taken 301 times.
✓ Branch 9 → 11 taken 280 times.
✓ Branch 9 → 12 taken 274 times.
855 switch(region) {
279 301 case 0:
280 301 X = r1_x;
281 301 Y = r1_y;
282 301 break;
283 280 case 1:
284 280 X = r2_x;
285 280 Y = r2_y;
286 280 break;
287 274 case 2:
288 274 X = r3_x;
289 274 Y = r3_y;
290 274 break;
291 }
292
2/2
✓ Branch 13 → 14 taken 184 times.
✓ Branch 13 → 15 taken 671 times.
855 if(dc_sector == 2) {
293 184 double const X_new = X * std::cos(-60 * M_PI / 180) - Y * std::sin(-60 * M_PI / 180);
294 184 Y = X * std::sin(-60 * M_PI / 180) + Y * std::cos(-60 * M_PI / 180);
295 X = X_new;
296 }
297
2/2
✓ Branch 15 → 16 taken 123 times.
✓ Branch 15 → 17 taken 732 times.
855 if(dc_sector == 3) {
298 123 double const X_new = X * std::cos(-120 * M_PI / 180) - Y * std::sin(-120 * M_PI / 180);
299 123 Y = X * std::sin(-120 * M_PI / 180) + Y * std::cos(-120 * M_PI / 180);
300 X = X_new;
301 }
302
2/2
✓ Branch 17 → 18 taken 58 times.
✓ Branch 17 → 19 taken 797 times.
855 if(dc_sector == 4) {
303 58 double const X_new = X * std::cos(-180 * M_PI / 180) - Y * std::sin(-180 * M_PI / 180);
304 58 Y = X * std::sin(-180 * M_PI / 180) + Y * std::cos(-180 * M_PI / 180);
305 X = X_new;
306 }
307
2/2
✓ Branch 19 → 20 taken 185 times.
✓ Branch 19 → 21 taken 670 times.
855 if(dc_sector == 5) {
308 185 double const X_new = X * std::cos(120 * M_PI / 180) - Y * std::sin(120 * M_PI / 180);
309 185 Y = X * std::sin(120 * M_PI / 180) + Y * std::cos(120 * M_PI / 180);
310 X = X_new;
311 }
312
2/2
✓ Branch 21 → 22 taken 165 times.
✓ Branch 21 → 23 taken 690 times.
855 if(dc_sector == 6) {
313 165 double const X_new = X * std::cos(60 * M_PI / 180) - Y * std::sin(60 * M_PI / 180);
314 165 Y = X * std::sin(60 * M_PI / 180) + Y * std::cos(60 * M_PI / 180);
315 X = X_new;
316 }
317 int this_pid = 0;
318
2/7
✓ Branch 23 → 5 taken 11 times.
✗ Branch 23 → 24 not taken.
✗ Branch 23 → 25 not taken.
✗ Branch 23 → 26 not taken.
✗ Branch 23 → 27 not taken.
✗ Branch 23 → 28 not taken.
✓ Branch 23 → 29 taken 844 times.
855 switch(pid) {
319 case 11:
320 this_pid = 0;
321 break;
322 case 2212:
323 this_pid = 1;
324 break;
325 case 211:
326 this_pid = 2;
327 break;
328 case -211:
329 this_pid = 3;
330 break;
331 case 321:
332 this_pid = 4;
333 break;
334 case -321:
335 this_pid = 5;
336 break;
337 default:
338 return false;
339 break;
340 }
341 844 double calc_min = minparams[this_pid][dc_sector - 1][region][0] + minparams[this_pid][dc_sector - 1][region][1] * X;
342 844 double calc_max = maxparams[this_pid][dc_sector - 1][region][0] + maxparams[this_pid][dc_sector - 1][region][1] * X;
343
2/4
✗ Branch 29 → 5 not taken.
✓ Branch 29 → 30 taken 844 times.
✗ Branch 30 → 5 not taken.
✓ Branch 30 → 31 taken 844 times.
844 if(std::isnan(calc_min) || std::isnan(calc_max))
344 return false;
345
3/4
✗ Branch 31 → 5 not taken.
✓ Branch 31 → 32 taken 844 times.
✓ Branch 32 → 5 taken 20 times.
✓ Branch 32 → 33 taken 824 times.
844 if((Y < calc_min) || (Y > calc_max)) {
346 return false;
347 }
348 }
349 return true;
350 }
351
352 //////////////////////////////////////////////////////////////////////////////////
353
354 2732 bool FiducialFilterPass1::FilterDcThetaPhi(
355 int const dc_sector,
356 float const r1_x,
357 float const r1_y,
358 float const r1_z,
359 float const r2_x,
360 float const r2_y,
361 float const r2_z,
362 float const r3_x,
363 float const r3_y,
364 float const r3_z,
365 float const torus,
366 int const pid) const
367 {
368
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 2732 times.
2732 if(!o_enable_dc_cuts)
369 return true;
370
1/2
✗ Branch 4 → 5 not taken.
✓ Branch 4 → 6 taken 2732 times.
2732 if(!(dc_sector >= 1 && dc_sector <= 6))
371 return false;
372
1/2
✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 2732 times.
2732 auto const& minparams = ((torus < 0) ? fiducial_pass1::minparams_in_theta_phi_pass1 : fiducial_pass1::minparams_out_theta_phi_pass1);
373 auto const& maxparams = ((torus < 0) ? fiducial_pass1::maxparams_in_theta_phi_pass1 : fiducial_pass1::maxparams_out_theta_phi_pass1);
374 double theta_DCr = 5000;
375 double phi_DCr_raw = 5000;
376 double x = 0;
377 double y = 0;
378 double z = 0;
379
2/2
✓ Branch 38 → 3 taken 2690 times.
✓ Branch 38 → 9 taken 8116 times.
10806 for(int region = 0; region < 3; region++) {
380 x = 0;
381 y = 0;
382 z = 0;
383
3/3
✓ Branch 9 → 10 taken 2732 times.
✓ Branch 9 → 11 taken 2694 times.
✓ Branch 9 → 12 taken 2690 times.
8116 switch(region) {
384 2732 case 0:
385 2732 x = r1_x;
386 2732 y = r1_y;
387 2732 z = r1_z;
388 2732 break;
389 2694 case 1:
390 2694 x = r2_x;
391 2694 y = r2_y;
392 2694 z = r2_z;
393 2694 break;
394 2690 case 2:
395 2690 x = r3_x;
396 2690 y = r3_y;
397 2690 z = r3_z;
398 2690 break;
399 }
400 8116 theta_DCr = 180 / M_PI * acos(z / sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2)));
401 8116 phi_DCr_raw = 180 / M_PI * atan2(y / sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2)), x / sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2)));
402 double phi_DCr = 5000;
403
2/2
✓ Branch 13 → 14 taken 6678 times.
✓ Branch 13 → 16 taken 1438 times.
8116 if(dc_sector == 1)
404 phi_DCr = phi_DCr_raw;
405
2/2
✓ Branch 14 → 15 taken 1346 times.
✓ Branch 14 → 16 taken 5332 times.
6678 if(dc_sector == 2)
406 1346 phi_DCr = phi_DCr_raw - 60;
407
2/2
✓ Branch 16 → 17 taken 1350 times.
✓ Branch 16 → 18 taken 5420 times.
6770 if(dc_sector == 3)
408 1350 phi_DCr = phi_DCr_raw - 120;
409
4/4
✓ Branch 18 → 19 taken 1348 times.
✓ Branch 18 → 23 taken 5418 times.
✓ Branch 19 → 20 taken 694 times.
✓ Branch 19 → 21 taken 654 times.
6766 if(dc_sector == 4 && phi_DCr_raw > 0)
410 694 phi_DCr = phi_DCr_raw - 180;
411
2/2
✓ Branch 21 → 22 taken 654 times.
✓ Branch 21 → 23 taken 694 times.
1348 if(dc_sector == 4 && phi_DCr_raw < 0)
412 654 phi_DCr = phi_DCr_raw + 180;
413
2/2
✓ Branch 23 → 24 taken 1428 times.
✓ Branch 23 → 25 taken 6688 times.
8116 if(dc_sector == 5)
414 1428 phi_DCr = phi_DCr_raw + 120;
415
2/2
✓ Branch 25 → 26 taken 1206 times.
✓ Branch 25 → 27 taken 5482 times.
6688 if(dc_sector == 6)
416 1206 phi_DCr = phi_DCr_raw + 60;
417 int this_pid = 0;
418
3/7
✗ Branch 27 → 5 not taken.
✓ Branch 27 → 28 taken 824 times.
✓ Branch 27 → 29 taken 5178 times.
✓ Branch 27 → 30 taken 2114 times.
✗ Branch 27 → 31 not taken.
✗ Branch 27 → 32 not taken.
✗ Branch 27 → 33 not taken.
8116 switch(pid) {
419 case 11:
420 this_pid = 0;
421 break;
422 824 case 2212:
423 this_pid = 1;
424 824 break;
425 5178 case 211:
426 this_pid = 2;
427 5178 break;
428 2114 case -211:
429 this_pid = 3;
430 2114 break;
431 case 321:
432 this_pid = 4;
433 break;
434 case -321:
435 this_pid = 5;
436 break;
437 default:
438 return false;
439 break;
440 }
441 8116 double calc_phi_min = minparams[this_pid][dc_sector - 1][region][0] + minparams[this_pid][dc_sector - 1][region][1] * std::log(theta_DCr) + minparams[this_pid][dc_sector - 1][region][2] * theta_DCr + minparams[this_pid][dc_sector - 1][region][3] * theta_DCr * theta_DCr;
442 8116 double calc_phi_max = maxparams[this_pid][dc_sector - 1][region][0] + maxparams[this_pid][dc_sector - 1][region][1] * std::log(theta_DCr) + maxparams[this_pid][dc_sector - 1][region][2] * theta_DCr + maxparams[this_pid][dc_sector - 1][region][3] * theta_DCr * theta_DCr;
443
2/4
✗ Branch 33 → 5 not taken.
✓ Branch 33 → 34 taken 8116 times.
✗ Branch 34 → 5 not taken.
✓ Branch 34 → 35 taken 8116 times.
8116 if(std::isnan(calc_phi_min) || std::isnan(calc_phi_max))
444 return false;
445
4/4
✓ Branch 35 → 5 taken 20 times.
✓ Branch 35 → 36 taken 8096 times.
✓ Branch 36 → 5 taken 22 times.
✓ Branch 36 → 37 taken 8074 times.
8116 if((phi_DCr < calc_phi_min) || (phi_DCr > calc_phi_max))
446 return false;
447 }
448 return true;
449 }
450
451 //////////////////////////////////////////////////////////////////////////////////
452
453 }
454