GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 79.3% 169 / 0 / 213
Functions: 100.0% 10 / 0 / 10
Branches: 59.9% 160 / 0 / 267

src/iguana/algorithms/clas12/rga/FiducialFilterPass1/Algorithm.cc
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 //////////////////////////////////////////////////////////////////////////////////
9
10 3 void FiducialFilterPass1::ConfigHook()
11 {
12
6/12
✓ Branch 3 → 4 taken 3 times.
✗ Branch 3 → 55 not taken.
✓ Branch 4 → 5 taken 3 times.
✗ Branch 4 → 53 not taken.
✓ Branch 5 → 6 taken 3 times.
✗ Branch 5 → 47 not taken.
✓ Branch 6 → 7 taken 3 times.
✗ Branch 6 → 9 not taken.
✓ Branch 13 → 14 taken 3 times.
✓ Branch 13 → 16 taken 3 times.
✗ Branch 56 → 57 not taken.
✗ Branch 56 → 59 not taken.
9 o_pcal_electron_cut_level = ParseCutLevel(GetOptionScalar<std::string>({"pcal_electron_cut_level"}));
13
6/12
✓ Branch 17 → 18 taken 3 times.
✗ Branch 17 → 68 not taken.
✓ Branch 18 → 19 taken 3 times.
✗ Branch 18 → 66 not taken.
✓ Branch 19 → 20 taken 3 times.
✗ Branch 19 → 60 not taken.
✓ Branch 20 → 21 taken 3 times.
✗ Branch 20 → 23 not taken.
✓ Branch 27 → 28 taken 3 times.
✓ Branch 27 → 30 taken 3 times.
✗ Branch 69 → 70 not taken.
✗ Branch 69 → 72 not taken.
9 o_pcal_photon_cut_level = ParseCutLevel(GetOptionScalar<std::string>({"pcal_photon_cut_level"}));
14
4/8
✓ Branch 31 → 32 taken 3 times.
✗ Branch 31 → 75 not taken.
✓ Branch 32 → 33 taken 3 times.
✗ Branch 32 → 73 not taken.
✓ Branch 35 → 36 taken 3 times.
✓ Branch 35 → 38 taken 3 times.
✗ Branch 76 → 77 not taken.
✗ Branch 76 → 79 not taken.
6 o_enable_pcal_cuts = GetOptionScalar<int>({"enable_pcal_cuts"}) == 1;
15
4/8
✓ Branch 39 → 40 taken 3 times.
✗ Branch 39 → 82 not taken.
✓ Branch 40 → 41 taken 3 times.
✗ Branch 40 → 80 not taken.
✓ Branch 43 → 44 taken 3 times.
✓ Branch 43 → 46 taken 3 times.
✗ Branch 83 → 84 not taken.
✗ Branch 83 → 86 not taken.
6 o_enable_dc_cuts = GetOptionScalar<int>({"enable_dc_cuts"}) == 1;
16 3 }
17
18 //////////////////////////////////////////////////////////////////////////////////
19
20 3 void FiducialFilterPass1::StartHook(hipo::banklist& banks)
21 {
22
2/4
✓ Branch 3 → 4 taken 3 times.
✗ Branch 3 → 31 not taken.
✓ Branch 4 → 5 taken 3 times.
✗ Branch 4 → 7 not taken.
3 b_particle = GetBankIndex(banks, "REC::Particle");
23
2/4
✓ Branch 10 → 11 taken 3 times.
✗ Branch 10 → 37 not taken.
✓ Branch 11 → 12 taken 3 times.
✗ Branch 11 → 14 not taken.
3 b_config = GetBankIndex(banks, "RUN::config");
24
2/4
✓ Branch 17 → 18 taken 3 times.
✗ Branch 17 → 43 not taken.
✗ Branch 18 → 19 not taken.
✓ Branch 18 → 21 taken 3 times.
3 b_traj = GetBankIndex(banks, "REC::Particle::Traj");
25
2/4
✓ Branch 24 → 25 taken 3 times.
✗ Branch 24 → 49 not taken.
✗ Branch 25 → 26 not taken.
✓ Branch 25 → 28 taken 3 times.
3 b_cal = GetBankIndex(banks, "REC::Particle::Calorimeter");
26 3 }
27
28 //////////////////////////////////////////////////////////////////////////////////
29
30 3000 bool FiducialFilterPass1::RunHook(hipo::banklist& banks) const
31 {
32
1/2
✓ Branch 10 → 11 taken 3000 times.
✗ Branch 10 → 32 not taken.
3000 return Run(
33
3/8
✓ Branch 8 → 9 taken 3000 times.
✗ Branch 8 → 38 not taken.
✓ Branch 9 → 10 taken 3000 times.
✗ Branch 9 → 32 not taken.
✓ Branch 16 → 17 taken 3000 times.
✗ Branch 16 → 19 not taken.
✗ Branch 38 → 39 not taken.
✗ Branch 38 → 41 not taken.
6000 GetBank(banks, b_particle, "REC::Particle"),
34
3/8
✓ Branch 6 → 7 taken 3000 times.
✗ Branch 6 → 44 not taken.
✓ Branch 7 → 8 taken 3000 times.
✗ Branch 7 → 38 not taken.
✗ Branch 21 → 22 not taken.
✓ Branch 21 → 24 taken 3000 times.
✗ Branch 44 → 45 not taken.
✗ Branch 44 → 47 not taken.
6000 GetBank(banks, b_config, "RUN::config"),
35
3/8
✓ Branch 4 → 5 taken 3000 times.
✗ Branch 4 → 50 not taken.
✓ Branch 5 → 6 taken 3000 times.
✗ Branch 5 → 44 not taken.
✗ Branch 26 → 27 not taken.
✓ Branch 26 → 29 taken 3000 times.
✗ Branch 50 → 51 not taken.
✗ Branch 50 → 53 not taken.
6000 GetBank(banks, b_traj, "REC::Particle::Traj"),
36
1/2
✓ Branch 3 → 4 taken 3000 times.
✗ Branch 3 → 50 not taken.
6000 GetBank(banks, b_cal, "REC::Particle::Calorimeter"));
37 }
38
39 3000 bool FiducialFilterPass1::Run(
40 hipo::bank& particleBank,
41 hipo::bank const& configBank,
42 hipo::bank const& trajBank,
43 hipo::bank const& calBank) const
44 {
45
2/4
✓ Branch 5 → 6 taken 3000 times.
✗ Branch 5 → 34 not taken.
✓ Branch 11 → 12 taken 3000 times.
✗ Branch 11 → 13 not taken.
9000 ShowBank(particleBank, Logger::Header("INPUT PARTICLES"));
46
47
2/4
✓ Branch 11 → 12 taken 3000 times.
✗ Branch 11 → 13 not taken.
✗ Branch 12 → 13 not taken.
✓ Branch 12 → 16 taken 3000 times.
3000 if(auto num_rows{particleBank.getRows()}; num_rows != trajBank.getRows() || num_rows != calBank.getRows()) {
48 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?");
49 throw std::runtime_error("cannot proceed");
50 }
51 3000 auto torus = configBank.getFloat("torus", 0);
52
1/2
✓ Branch 19 → 21 taken 3000 times.
✗ Branch 19 → 42 not taken.
3000 particleBank.getMutableRowList().filter([this, torus, &trajBank, &calBank](hipo::bank& bank, int row) {
53 16312 auto pid = bank.getInt("pid", row);
54
3/6
✓ Branch 3 → 4 taken 16312 times.
✗ Branch 3 → 25 not taken.
✓ Branch 4 → 5 taken 16312 times.
✗ Branch 4 → 25 not taken.
✓ Branch 5 → 6 taken 16312 times.
✗ Branch 5 → 25 not taken.
16312 if(row >= 0 && row < calBank.getRows() && row < trajBank.getRows()) {
55 // call the action function
56 65248 return FilterRgaPass1(
57 calBank.getInt("pcal_sector", row),
58 calBank.getFloat("pcal_lv", row),
59 calBank.getFloat("pcal_lw", row),
60 16312 calBank.getByte("pcal_found", row) == 1,
61 trajBank.getInt("sector", row),
62 trajBank.getFloat("r1_x", row),
63 trajBank.getFloat("r1_y", row),
64 trajBank.getFloat("r1_z", row),
65 16312 trajBank.getByte("r1_found", row) == 1,
66 trajBank.getFloat("r2_x", row),
67 trajBank.getFloat("r2_y", row),
68 trajBank.getFloat("r2_z", row),
69 16312 trajBank.getByte("r2_found", row) == 1,
70 trajBank.getFloat("r3_x", row),
71 trajBank.getFloat("r3_y", row),
72 trajBank.getFloat("r3_z", row),
73 16312 trajBank.getByte("r3_found", row) == 1,
74 torus,
75 16312 pid);
76 }
77 else
78 throw std::runtime_error(fmt::format("FiducialFilterPass1 filter encountered bad row number {}", row));
79 });
80
81
1/2
✓ Branch 26 → 27 taken 3000 times.
✗ Branch 26 → 45 not taken.
6000 ShowBank(particleBank, Logger::Header("OUTPUT PARTICLES"));
82 3000 return !particleBank.getRowList().empty();
83 }
84
85 //////////////////////////////////////////////////////////////////////////////////
86
87 6 FiducialFilterPass1::CutLevel FiducialFilterPass1::ParseCutLevel(std::string const& level) const
88 {
89
2/2
✓ Branch 2 → 3 taken 4 times.
✓ Branch 2 → 23 taken 2 times.
6 if(level == "loose")
90 return loose;
91
2/2
✓ Branch 3 → 4 taken 2 times.
✓ Branch 3 → 23 taken 2 times.
4 else if(level == "medium")
92 return medium;
93
1/2
✗ Branch 4 → 5 not taken.
✓ Branch 4 → 23 taken 2 times.
2 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 16312 times.
16312 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 16312 times.
16312 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 11067 times.
✓ Branch 6 → 8 taken 5245 times.
16312 bool dc_found = dc_r1_found && dc_r2_found && dc_r3_found;
133
4/4
✓ Branch 8 → 9 taken 5061 times.
✓ Branch 8 → 10 taken 1939 times.
✓ Branch 8 → 22 taken 3678 times.
✓ Branch 8 → 40 taken 5634 times.
16312 switch(pid) {
134 1939 case 11: // electrons
135 case -11: // positrons
136 {
137
1/2
✗ Branch 10 → 11 not taken.
✓ Branch 10 → 12 taken 1939 times.
1939 if(o_enable_pcal_cuts)
138
4/4
✓ Branch 12 → 13 taken 457 times.
✓ Branch 12 → 15 taken 1482 times.
✓ Branch 14 → 11 taken 362 times.
✓ Branch 14 → 15 taken 95 times.
1939 result &= pcal_found && FilterPcalHomogeneous(pcal_sector, pcal_lv, pcal_lw, torus, pid);
139
1/2
✓ Branch 16 → 17 taken 1939 times.
✗ Branch 16 → 40 not taken.
1939 if(o_enable_dc_cuts)
140
4/4
✓ Branch 17 → 18 taken 457 times.
✓ Branch 17 → 20 taken 1482 times.
✓ Branch 19 → 20 taken 52 times.
✓ Branch 19 → 21 taken 405 times.
1939 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 3678 case 22: // photons
144 {
145
1/2
✗ Branch 22 → 9 not taken.
✓ Branch 22 → 23 taken 3678 times.
3678 if(o_enable_pcal_cuts)
146
4/4
✓ Branch 23 → 24 taken 3012 times.
✓ Branch 23 → 26 taken 666 times.
✓ Branch 25 → 9 taken 2599 times.
✓ Branch 25 → 26 taken 413 times.
3678 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 8739 times.
✗ Branch 27 → 40 not taken.
8739 if(o_enable_dc_cuts) {
153
1/2
✓ Branch 28 → 29 taken 8739 times.
✗ Branch 28 → 34 not taken.
8739 if(torus < 0) // inbending
154
4/4
✓ Branch 29 → 30 taken 4098 times.
✓ Branch 29 → 32 taken 4641 times.
✓ Branch 31 → 32 taken 63 times.
✓ Branch 31 → 33 taken 4035 times.
8739 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 3469 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 3469 times.
✗ Branch 2 → 28 not taken.
3469 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 457 times.
✓ Branch 3 → 5 taken 3012 times.
✗ Branch 3 → 6 not taken.
3469 switch(pid) {
184 457 case 11:
185 case -11:
186 457 cut_level = o_pcal_electron_cut_level;
187 457 break;
188 3012 case 22:
189 3012 cut_level = o_pcal_photon_cut_level;
190 3012 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 20814 times.
✓ Branch 23 → 24 taken 3469 times.
24283 for(int k = 0; k < 6; k++) {
203
3/4
✓ Branch 10 → 11 taken 3469 times.
✓ Branch 10 → 16 taken 17345 times.
✓ Branch 11 → 12 taken 3469 times.
✗ Branch 11 → 16 not taken.
20814 if(pcal_sector - 1 == k && torus < 0) { // inbending
204
3/4
✓ Branch 12 → 13 taken 1662 times.
✓ Branch 12 → 14 taken 1506 times.
✓ Branch 12 → 15 taken 301 times.
✗ Branch 12 → 22 not taken.
3469 switch(cut_level) {
205 1662 case tight:
206 1662 min_v = fiducial_pass1::min_lv_tight_inb[k];
207 1662 max_v = fiducial_pass1::max_lv_tight_inb[k];
208 1662 min_w = fiducial_pass1::min_lw_tight_inb[k];
209 1662 max_w = fiducial_pass1::max_lw_tight_inb[k];
210 1662 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 17345 times.
✗ Branch 17 → 18 not taken.
✗ Branch 17 → 22 not taken.
17345 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 238 times.
✓ Branch 24 → 25 taken 3231 times.
✓ Branch 25 → 8 taken 2 times.
✓ Branch 25 → 26 taken 3229 times.
✓ Branch 26 → 8 taken 266 times.
✓ Branch 26 → 27 taken 2963 times.
✓ Branch 27 → 8 taken 2 times.
✓ Branch 27 → 28 taken 2961 times.
3469 return lv > min_v && lv < max_v && lw > min_w && lw < max_w;
249 }
250
251 //////////////////////////////////////////////////////////////////////////////////
252
253 457 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 457 times.
457 if(!o_enable_dc_cuts)
268 return true;
269
1/2
✗ Branch 4 → 5 not taken.
✓ Branch 4 → 6 taken 457 times.
457 if(!(dc_sector >= 1 && dc_sector <= 6))
270 return false;
271
1/2
✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 457 times.
457 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 405 times.
✓ Branch 34 → 9 taken 1288 times.
1693 for(int region = 0; region < 3; region++) {
276 X = 0;
277 Y = 0;
278
3/3
✓ Branch 9 → 10 taken 457 times.
✓ Branch 9 → 11 taken 420 times.
✓ Branch 9 → 12 taken 411 times.
1288 switch(region) {
279 457 case 0:
280 457 X = r1_x;
281 457 Y = r1_y;
282 457 break;
283 420 case 1:
284 420 X = r2_x;
285 420 Y = r2_y;
286 420 break;
287 411 case 2:
288 411 X = r3_x;
289 411 Y = r3_y;
290 411 break;
291 }
292
2/2
✓ Branch 13 → 14 taken 276 times.
✓ Branch 13 → 15 taken 1012 times.
1288 if(dc_sector == 2) {
293 276 double const X_new = X * std::cos(-60 * M_PI / 180) - Y * std::sin(-60 * M_PI / 180);
294 276 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 186 times.
✓ Branch 15 → 17 taken 1102 times.
1288 if(dc_sector == 3) {
298 186 double const X_new = X * std::cos(-120 * M_PI / 180) - Y * std::sin(-120 * M_PI / 180);
299 186 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 88 times.
✓ Branch 17 → 19 taken 1200 times.
1288 if(dc_sector == 4) {
303 88 double const X_new = X * std::cos(-180 * M_PI / 180) - Y * std::sin(-180 * M_PI / 180);
304 88 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 278 times.
✓ Branch 19 → 21 taken 1010 times.
1288 if(dc_sector == 5) {
308 278 double const X_new = X * std::cos(120 * M_PI / 180) - Y * std::sin(120 * M_PI / 180);
309 278 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 249 times.
✓ Branch 21 → 23 taken 1039 times.
1288 if(dc_sector == 6) {
313 249 double const X_new = X * std::cos(60 * M_PI / 180) - Y * std::sin(60 * M_PI / 180);
314 249 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 22 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 1266 times.
1288 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 1266 double calc_min = minparams[this_pid][dc_sector - 1][region][0] + minparams[this_pid][dc_sector - 1][region][1] * X;
342 1266 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 1266 times.
✗ Branch 30 → 5 not taken.
✓ Branch 30 → 31 taken 1266 times.
1266 if(std::isnan(calc_min) || std::isnan(calc_max))
344 return false;
345
3/4
✗ Branch 31 → 5 not taken.
✓ Branch 31 → 32 taken 1266 times.
✓ Branch 32 → 5 taken 30 times.
✓ Branch 32 → 33 taken 1236 times.
1266 if((Y < calc_min) || (Y > calc_max)) {
346 return false;
347 }
348 }
349 return true;
350 }
351
352 //////////////////////////////////////////////////////////////////////////////////
353
354 4098 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 4098 times.
4098 if(!o_enable_dc_cuts)
369 return true;
370
1/2
✗ Branch 4 → 5 not taken.
✓ Branch 4 → 6 taken 4098 times.
4098 if(!(dc_sector >= 1 && dc_sector <= 6))
371 return false;
372
1/2
✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 4098 times.
4098 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 4035 times.
✓ Branch 38 → 9 taken 12174 times.
16209 for(int region = 0; region < 3; region++) {
380 x = 0;
381 y = 0;
382 z = 0;
383
3/3
✓ Branch 9 → 10 taken 4098 times.
✓ Branch 9 → 11 taken 4041 times.
✓ Branch 9 → 12 taken 4035 times.
12174 switch(region) {
384 4098 case 0:
385 4098 x = r1_x;
386 4098 y = r1_y;
387 4098 z = r1_z;
388 4098 break;
389 4041 case 1:
390 4041 x = r2_x;
391 4041 y = r2_y;
392 4041 z = r2_z;
393 4041 break;
394 4035 case 2:
395 4035 x = r3_x;
396 4035 y = r3_y;
397 4035 z = r3_z;
398 4035 break;
399 }
400 12174 theta_DCr = 180 / M_PI * acos(z / sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2)));
401 12174 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 10017 times.
✓ Branch 13 → 16 taken 2157 times.
12174 if(dc_sector == 1)
404 phi_DCr = phi_DCr_raw;
405
2/2
✓ Branch 14 → 15 taken 2019 times.
✓ Branch 14 → 16 taken 7998 times.
10017 if(dc_sector == 2)
406 2019 phi_DCr = phi_DCr_raw - 60;
407
2/2
✓ Branch 16 → 17 taken 2025 times.
✓ Branch 16 → 18 taken 8130 times.
10155 if(dc_sector == 3)
408 2025 phi_DCr = phi_DCr_raw - 120;
409
4/4
✓ Branch 18 → 19 taken 2022 times.
✓ Branch 18 → 23 taken 8127 times.
✓ Branch 19 → 20 taken 1041 times.
✓ Branch 19 → 21 taken 981 times.
10149 if(dc_sector == 4 && phi_DCr_raw > 0)
410 1041 phi_DCr = phi_DCr_raw - 180;
411
2/2
✓ Branch 21 → 22 taken 981 times.
✓ Branch 21 → 23 taken 1041 times.
2022 if(dc_sector == 4 && phi_DCr_raw < 0)
412 981 phi_DCr = phi_DCr_raw + 180;
413
2/2
✓ Branch 23 → 24 taken 2142 times.
✓ Branch 23 → 25 taken 10032 times.
12174 if(dc_sector == 5)
414 2142 phi_DCr = phi_DCr_raw + 120;
415
2/2
✓ Branch 25 → 26 taken 1809 times.
✓ Branch 25 → 27 taken 8223 times.
10032 if(dc_sector == 6)
416 1809 phi_DCr = phi_DCr_raw + 60;
417 int this_pid = 0;
418
3/7
✗ Branch 27 → 5 not taken.
✓ Branch 27 → 28 taken 1236 times.
✓ Branch 27 → 29 taken 7767 times.
✓ Branch 27 → 30 taken 3171 times.
✗ Branch 27 → 31 not taken.
✗ Branch 27 → 32 not taken.
✗ Branch 27 → 33 not taken.
12174 switch(pid) {
419 case 11:
420 this_pid = 0;
421 break;
422 1236 case 2212:
423 this_pid = 1;
424 1236 break;
425 7767 case 211:
426 this_pid = 2;
427 7767 break;
428 3171 case -211:
429 this_pid = 3;
430 3171 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 12174 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 12174 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 12174 times.
✗ Branch 34 → 5 not taken.
✓ Branch 34 → 35 taken 12174 times.
12174 if(std::isnan(calc_phi_min) || std::isnan(calc_phi_max))
444 return false;
445
4/4
✓ Branch 35 → 5 taken 30 times.
✓ Branch 35 → 36 taken 12144 times.
✓ Branch 36 → 5 taken 33 times.
✓ Branch 36 → 37 taken 12111 times.
12174 if((phi_DCr < calc_phi_min) || (phi_DCr > calc_phi_max))
446 return false;
447 }
448 return true;
449 }
450
451 //////////////////////////////////////////////////////////////////////////////////
452
453 }
454