| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "Validator.h" | ||
| 2 | |||
| 3 | #include <TCanvas.h> | ||
| 4 | #include <TH1.h> | ||
| 5 | #include <TLegend.h> | ||
| 6 | #include <TPad.h> | ||
| 7 | #include <TROOT.h> | ||
| 8 | #include <TString.h> | ||
| 9 | #include <TStyle.h> | ||
| 10 | |||
| 11 | #include <algorithm> | ||
| 12 | #include <array> | ||
| 13 | #include <cmath> | ||
| 14 | #include <set> | ||
| 15 | #include <string> | ||
| 16 | #include <unordered_map> | ||
| 17 | #include <unordered_set> | ||
| 18 | #include <vector> | ||
| 19 | |||
| 20 | namespace iguana::clas12::rga { | ||
| 21 | |||
| 22 | REGISTER_IGUANA_VALIDATOR(FiducialFilterPass2Validator); | ||
| 23 | |||
| 24 | 3 | static bool banklist_has(hipo::banklist& banks, char const* name) | |
| 25 | { | ||
| 26 |
2/2✓ Branch 13 → 3 taken 15 times.
✓ Branch 13 → 14 taken 1 time.
|
16 | for(auto& b : banks) |
| 27 |
4/4✓ Branch 6 → 7 taken 10 times.
✓ Branch 6 → 9 taken 5 times.
✓ Branch 11 → 12 taken 13 times.
✓ Branch 11 → 14 taken 2 times.
|
30 | if(b.getSchema().getName() == name) |
| 28 | return true; | ||
| 29 | return false; | ||
| 30 | } | ||
| 31 | |||
| 32 | 5 | static inline void SaveAndDisposeCanvas(TCanvas* c, char const* path_png) | |
| 33 | { | ||
| 34 |
1/2✓ Branch 2 → 3 taken 5 times.
✗ Branch 2 → 13 not taken.
|
5 | if(!c) |
| 35 | return; | ||
| 36 | 5 | c->Modified(); | |
| 37 | 5 | c->Update(); | |
| 38 | 5 | c->Print(path_png); | |
| 39 | // Remove from global list before deletion | ||
| 40 |
2/4✓ Branch 7 → 8 taken 5 times.
✗ Branch 7 → 12 not taken.
✓ Branch 9 → 10 taken 5 times.
✗ Branch 9 → 12 not taken.
|
5 | if(gROOT && gROOT->GetListOfCanvases()) |
| 41 | 5 | gROOT->GetListOfCanvases()->Remove(c); | |
| 42 | 5 | delete c; | |
| 43 | } | ||
| 44 | |||
| 45 | 1 | void FiducialFilterPass2Validator::BookIfNeeded() | |
| 46 | { | ||
| 47 | // PCal: 0–45 cm with 4.5 cm bins (bar width) | ||
| 48 | int const nb = 10; | ||
| 49 | double const lo = 0.0, hi = 45.0; | ||
| 50 | |||
| 51 |
2/2✓ Branch 35 → 3 taken 2 times.
✓ Branch 35 → 36 taken 1 time.
|
3 | for(int pid : kPIDs) { |
| 52 | auto& P = m_cal[pid]; | ||
| 53 |
2/2✓ Branch 33 → 4 taken 12 times.
✓ Branch 33 → 34 taken 2 times.
|
14 | for(int s = 1; s <= 6; ++s) { |
| 54 |
1/2✓ Branch 4 → 5 taken 12 times.
✗ Branch 4 → 11 not taken.
|
12 | if(!P[s].lv_before) { |
| 55 |
1/2✓ Branch 7 → 8 taken 12 times.
✗ Branch 7 → 81 not taken.
|
12 | P[s].lv_before = new TH1D(Form("h_pcal_lv_before_pid%d_s%d", pid, s), |
| 56 |
2/4✓ Branch 6 → 7 taken 12 times.
✗ Branch 6 → 81 not taken.
✓ Branch 8 → 9 taken 12 times.
✗ Branch 8 → 81 not taken.
|
24 | Form("PID %d S%d;length (cm);counts", pid, s), nb, lo, hi); |
| 57 | 12 | P[s].lv_before->SetStats(0); | |
| 58 | 12 | P[s].lv_before->SetDirectory(nullptr); | |
| 59 | } | ||
| 60 |
1/2✓ Branch 11 → 12 taken 12 times.
✗ Branch 11 → 18 not taken.
|
12 | if(!P[s].lv_after) { |
| 61 |
1/2✓ Branch 14 → 15 taken 12 times.
✗ Branch 14 → 83 not taken.
|
12 | P[s].lv_after = new TH1D(Form("h_pcal_lv_after_pid%d_s%d", pid, s), |
| 62 |
2/4✓ Branch 13 → 14 taken 12 times.
✗ Branch 13 → 83 not taken.
✓ Branch 15 → 16 taken 12 times.
✗ Branch 15 → 83 not taken.
|
24 | Form("PID %d S%d;length (cm);counts", pid, s), nb, lo, hi); |
| 63 | 12 | P[s].lv_after->SetStats(0); | |
| 64 | 12 | P[s].lv_after->SetDirectory(nullptr); | |
| 65 | } | ||
| 66 |
1/2✓ Branch 18 → 19 taken 12 times.
✗ Branch 18 → 25 not taken.
|
12 | if(!P[s].lw_before) { |
| 67 |
1/2✓ Branch 21 → 22 taken 12 times.
✗ Branch 21 → 85 not taken.
|
12 | P[s].lw_before = new TH1D(Form("h_pcal_lw_before_pid%d_s%d", pid, s), |
| 68 |
2/4✓ Branch 20 → 21 taken 12 times.
✗ Branch 20 → 85 not taken.
✓ Branch 22 → 23 taken 12 times.
✗ Branch 22 → 85 not taken.
|
24 | Form("PID %d S%d;length (cm);counts", pid, s), nb, lo, hi); |
| 69 | 12 | P[s].lw_before->SetStats(0); | |
| 70 | 12 | P[s].lw_before->SetDirectory(nullptr); | |
| 71 | } | ||
| 72 |
1/2✓ Branch 25 → 26 taken 12 times.
✗ Branch 25 → 32 not taken.
|
12 | if(!P[s].lw_after) { |
| 73 |
1/2✓ Branch 28 → 29 taken 12 times.
✗ Branch 28 → 87 not taken.
|
12 | P[s].lw_after = new TH1D(Form("h_pcal_lw_after_pid%d_s%d", pid, s), |
| 74 |
2/4✓ Branch 27 → 28 taken 12 times.
✗ Branch 27 → 87 not taken.
✓ Branch 29 → 30 taken 12 times.
✗ Branch 29 → 87 not taken.
|
24 | Form("PID %d S%d;length (cm);counts", pid, s), nb, lo, hi); |
| 75 | 12 | P[s].lw_after->SetStats(0); | |
| 76 | 12 | P[s].lw_after->SetDirectory(nullptr); | |
| 77 | } | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | // FT: x,y in +/-20 cm | ||
| 82 |
2/2✓ Branch 53 → 37 taken 2 times.
✓ Branch 53 → 54 taken 1 time.
|
3 | for(int pid : kPIDs) { |
| 83 | auto& F = m_ft_h[pid]; | ||
| 84 |
1/2✓ Branch 38 → 39 taken 2 times.
✗ Branch 38 → 45 not taken.
|
2 | if(!F.before) { |
| 85 |
1/2✓ Branch 41 → 42 taken 2 times.
✗ Branch 41 → 89 not taken.
|
2 | F.before = new TH2F(Form("h_ft_before_pid%d", pid), |
| 86 |
2/4✓ Branch 40 → 41 taken 2 times.
✗ Branch 40 → 89 not taken.
✓ Branch 42 → 43 taken 2 times.
✗ Branch 42 → 89 not taken.
|
4 | Form("FT x-y before (PID %d);x (cm);y (cm)", pid), 120, -20, 20, 120, -20, 20); |
| 87 | 2 | F.before->SetStats(0); | |
| 88 | 2 | F.before->SetDirectory(nullptr); | |
| 89 | } | ||
| 90 |
1/2✓ Branch 45 → 46 taken 2 times.
✗ Branch 45 → 52 not taken.
|
2 | if(!F.after) { |
| 91 |
1/2✓ Branch 48 → 49 taken 2 times.
✗ Branch 48 → 91 not taken.
|
2 | F.after = new TH2F(Form("h_ft_after_pid%d", pid), |
| 92 |
2/4✓ Branch 47 → 48 taken 2 times.
✗ Branch 47 → 91 not taken.
✓ Branch 49 → 50 taken 2 times.
✗ Branch 49 → 91 not taken.
|
4 | Form("FT x-y after (PID %d);x (cm);y (cm)", pid), 120, -20, 20, 120, -20, 20); |
| 93 | 2 | F.after->SetStats(0); | |
| 94 | 2 | F.after->SetDirectory(nullptr); | |
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | // CVT layer 12: phi (deg) vs theta (deg), hadrons only | ||
| 99 |
1/2✓ Branch 54 → 55 taken 1 time.
✗ Branch 54 → 59 not taken.
|
1 | if(!m_cvt_before) { |
| 100 | 1 | m_cvt_before = new TH2F("h_cvt_l12_phi_theta_before_all", | |
| 101 | "CVT layer 12 before (hadrons: #pm211,#pm321,#pm2212);phi (deg);theta (deg)", | ||
| 102 |
1/2✓ Branch 56 → 57 taken 1 time.
✗ Branch 56 → 93 not taken.
|
1 | 180, 0, 360, 90, 0, 90); |
| 103 | 1 | m_cvt_before->SetStats(0); | |
| 104 | 1 | m_cvt_before->SetDirectory(nullptr); | |
| 105 | } | ||
| 106 |
1/2✓ Branch 59 → 60 taken 1 time.
✗ Branch 59 → 64 not taken.
|
1 | if(!m_cvt_after) { |
| 107 | 1 | m_cvt_after = new TH2F("h_cvt_l12_phi_theta_after_all", | |
| 108 | "CVT layer 12 after (hadrons: #pm211,#pm321,#pm2212);phi (deg);theta (deg)", | ||
| 109 |
1/2✓ Branch 61 → 62 taken 1 time.
✗ Branch 61 → 95 not taken.
|
1 | 180, 0, 360, 90, 0, 90); |
| 110 | 1 | m_cvt_after->SetStats(0); | |
| 111 | 1 | m_cvt_after->SetDirectory(nullptr); | |
| 112 | } | ||
| 113 | |||
| 114 | // DC edges: 0–30 cm in 0.3 cm bins | ||
| 115 | 12 | auto mk = [](char const* name, char const* title) { | |
| 116 |
1/2✓ Branch 3 → 4 taken 12 times.
✗ Branch 3 → 7 not taken.
|
12 | auto* h = new TH1D(name, title, 100, 0.0, 30.0); |
| 117 | 12 | h->SetStats(0); | |
| 118 | 12 | h->SetDirectory(nullptr); | |
| 119 | 12 | return h; | |
| 120 | }; | ||
| 121 |
1/2✓ Branch 64 → 65 taken 1 time.
✗ Branch 64 → 72 not taken.
|
1 | if(!m_dc_pos.r1_before) { |
| 122 | 1 | m_dc_pos.r1_before = mk("h_dc_pos_r1_before", "DC R1 before (+);edge (cm);counts"); | |
| 123 | 1 | m_dc_pos.r2_before = mk("h_dc_pos_r2_before", "DC R2 before (+);edge (cm);counts"); | |
| 124 | 1 | m_dc_pos.r3_before = mk("h_dc_pos_r3_before", "DC R3 before (+);edge (cm);counts"); | |
| 125 | 1 | m_dc_pos.r1_after = mk("h_dc_pos_r1_after", "DC R1 after (+);edge (cm);counts"); | |
| 126 | 1 | m_dc_pos.r2_after = mk("h_dc_pos_r2_after", "DC R2 after (+);edge (cm);counts"); | |
| 127 | 1 | m_dc_pos.r3_after = mk("h_dc_pos_r3_after", "DC R3 after (+);edge (cm);counts"); | |
| 128 | } | ||
| 129 |
1/2✓ Branch 72 → 73 taken 1 time.
✗ Branch 72 → 80 not taken.
|
1 | if(!m_dc_neg.r1_before) { |
| 130 | 1 | m_dc_neg.r1_before = mk("h_dc_neg_r1_before", "DC R1 before (-);edge (cm);counts"); | |
| 131 | 1 | m_dc_neg.r2_before = mk("h_dc_neg_r2_before", "DC R2 before (-);edge (cm);counts"); | |
| 132 | 1 | m_dc_neg.r3_before = mk("h_dc_neg_r3_before", "DC R3 before (-);edge (cm);counts"); | |
| 133 | 1 | m_dc_neg.r1_after = mk("h_dc_neg_r1_after", "DC R1 after (-);edge (cm);counts"); | |
| 134 | 1 | m_dc_neg.r2_after = mk("h_dc_neg_r2_after", "DC R2 after (-);edge (cm);counts"); | |
| 135 | 1 | m_dc_neg.r3_after = mk("h_dc_neg_r3_after", "DC R3 after (-);edge (cm);counts"); | |
| 136 | } | ||
| 137 | 1 | } | |
| 138 | |||
| 139 | 1 | void FiducialFilterPass2Validator::Start(hipo::banklist& banks) | |
| 140 | { | ||
| 141 | |||
| 142 |
1/2✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 6 not taken.
|
1 | if(gROOT) |
| 143 | 1 | gROOT->SetBatch(kTRUE); | |
| 144 |
1/2✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 8 not taken.
|
1 | if(gStyle) |
| 145 | 1 | gStyle->SetOptStat(0); | |
| 146 | 1 | TH1::AddDirectory(kFALSE); | |
| 147 | |||
| 148 |
2/4✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 88 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 14 not taken.
|
1 | b_particle = GetBankIndex(banks, "REC::Particle"); |
| 149 |
1/2✓ Branch 17 → 18 taken 1 time.
✗ Branch 17 → 26 not taken.
|
1 | if(banklist_has(banks, "REC::Calorimeter")) { |
| 150 |
2/4✓ Branch 19 → 20 taken 1 time.
✗ Branch 19 → 94 not taken.
✗ Branch 20 → 21 not taken.
✓ Branch 20 → 23 taken 1 time.
|
1 | b_calor = GetBankIndex(banks, "REC::Calorimeter"); |
| 151 | 1 | m_have_calor = true; | |
| 152 | } | ||
| 153 |
1/2✗ Branch 27 → 28 not taken.
✓ Branch 27 → 36 taken 1 time.
|
1 | if(banklist_has(banks, "REC::ForwardTagger")) { |
| 154 | ✗ | b_ft = GetBankIndex(banks, "REC::ForwardTagger"); | |
| 155 | ✗ | m_have_ft = true; | |
| 156 | } | ||
| 157 |
1/2✓ Branch 37 → 38 taken 1 time.
✗ Branch 37 → 46 not taken.
|
1 | if(banklist_has(banks, "REC::Traj")) { |
| 158 |
2/4✓ Branch 39 → 40 taken 1 time.
✗ Branch 39 → 106 not taken.
✓ Branch 40 → 41 taken 1 time.
✗ Branch 40 → 43 not taken.
|
1 | b_traj = GetBankIndex(banks, "REC::Traj"); |
| 159 | 1 | m_have_traj = true; | |
| 160 | } | ||
| 161 | else { | ||
| 162 | ✗ | m_log->Info("[RGAFID][VAL] REC::Traj not provided; CVT/DC plots disabled. " | |
| 163 | "Re-run with -b REC::Traj to enable trajectory-based plots."); | ||
| 164 | } | ||
| 165 |
2/4✓ Branch 49 → 50 taken 1 time.
✗ Branch 49 → 112 not taken.
✓ Branch 50 → 51 taken 1 time.
✗ Branch 50 → 53 not taken.
|
1 | b_config = GetBankIndex(banks, "RUN::config"); |
| 166 | |||
| 167 | 2 | m_algo_seq = std::make_unique<AlgorithmSequence>(); | |
| 168 |
3/8✓ Branch 60 → 61 taken 1 time.
✗ Branch 60 → 124 not taken.
✓ Branch 61 → 62 taken 1 time.
✗ Branch 61 → 118 not taken.
✓ Branch 67 → 68 taken 1 time.
✗ Branch 67 → 70 not taken.
✗ Branch 124 → 125 not taken.
✗ Branch 124 → 127 not taken.
|
2 | m_algo_seq->Add("clas12::rga::FiducialFilterPass2"); |
| 169 | 1 | m_algo_seq->Start(banks); | |
| 170 | |||
| 171 | // Output | ||
| 172 |
1/2✓ Branch 74 → 75 taken 1 time.
✗ Branch 74 → 83 not taken.
|
1 | if(auto dir = GetOutputDirectory()) { |
| 173 |
1/2✓ Branch 75 → 76 taken 1 time.
✗ Branch 75 → 132 not taken.
|
1 | m_base.Form("%s/rga_fiducial", dir->c_str()); |
| 174 |
2/4✓ Branch 80 → 81 taken 1 time.
✗ Branch 80 → 130 not taken.
✓ Branch 81 → 82 taken 1 time.
✗ Branch 81 → 130 not taken.
|
1 | m_out = new TFile(Form("%s.root", m_base.Data()), "RECREATE"); |
| 175 | } | ||
| 176 | else { | ||
| 177 | ✗ | m_base = "rga_fiducial"; | |
| 178 | ✗ | m_out = nullptr; | |
| 179 | } | ||
| 180 | |||
| 181 | 1 | BookIfNeeded(); | |
| 182 | 1 | } | |
| 183 | |||
| 184 | // DC pad margins | ||
| 185 | 12 | static inline void SetDCPadMargins() | |
| 186 | { | ||
| 187 | 12 | gPad->SetLeftMargin(0.16); | |
| 188 | 12 | gPad->SetRightMargin(0.06); | |
| 189 | 12 | gPad->SetBottomMargin(0.12); | |
| 190 | 12 | gPad->SetTopMargin(0.08); | |
| 191 | 12 | } | |
| 192 | |||
| 193 | 1000 | bool FiducialFilterPass2Validator::Run(hipo::banklist& banks) const | |
| 194 | { | ||
| 195 |
1/2✓ Branch 3 → 4 taken 1000 times.
✗ Branch 3 → 455 not taken.
|
1000 | auto& particle = GetBank(banks, b_particle, "REC::Particle"); |
| 196 |
1/2✓ Branch 10 → 11 taken 1000 times.
✗ Branch 10 → 461 not taken.
|
1000 | auto& config = GetBank(banks, b_config, "RUN::config"); |
| 197 | |||
| 198 | // track torus polarity stats (labels for DC summary) | ||
| 199 | { | ||
| 200 | 1000 | bool e_out = (config.getFloat("torus", 0) == 1.0f); | |
| 201 |
1/2✗ Branch 17 → 18 not taken.
✓ Branch 17 → 19 taken 1000 times.
|
1000 | if(e_out) |
| 202 | ✗ | const_cast<FiducialFilterPass2Validator*>(this)->m_torus_out_events++; | |
| 203 | else | ||
| 204 | 1000 | const_cast<FiducialFilterPass2Validator*>(this)->m_torus_in_events++; | |
| 205 | } | ||
| 206 | |||
| 207 | // snapshot before sets of pindex | ||
| 208 | std::unordered_set<int> eorg_before; | ||
| 209 | std::unordered_set<int> had_before; | ||
| 210 | std::unordered_set<int> pos_before, neg_before; | ||
| 211 | |||
| 212 |
3/4✓ Branch 20 → 21 taken 1000 times.
✗ Branch 20 → 569 not taken.
✓ Branch 34 → 22 taken 6993 times.
✓ Branch 34 → 35 taken 1000 times.
|
7993 | for(auto const& row : particle.getRowList()) { |
| 213 | 6993 | int pidx = (int)row; | |
| 214 | 6993 | int pid = particle.getInt("pid", row); | |
| 215 |
2/2✓ Branch 23 → 24 taken 2478 times.
✓ Branch 23 → 25 taken 4515 times.
|
6993 | if(pid == 11 || pid == 22) |
| 216 | eorg_before.insert(pidx); | ||
| 217 |
6/6✓ Branch 25 → 26 taken 5950 times.
✓ Branch 25 → 28 taken 1043 times.
✓ Branch 26 → 27 taken 5268 times.
✓ Branch 26 → 28 taken 682 times.
✓ Branch 27 → 28 taken 43 times.
✓ Branch 27 → 29 taken 5225 times.
|
6993 | if(pid == 211 || pid == 321 || pid == 2212 || pid == -211 || pid == -321 || pid == -2212) |
| 218 | had_before.insert(pidx); | ||
| 219 |
2/2✓ Branch 29 → 30 taken 5566 times.
✓ Branch 29 → 31 taken 1427 times.
|
6993 | if(pid > 0) |
| 220 | pos_before.insert(pidx); | ||
| 221 |
2/2✓ Branch 31 → 32 taken 500 times.
✓ Branch 31 → 33 taken 927 times.
|
1427 | else if(pid < 0) |
| 222 | neg_before.insert(pidx); | ||
| 223 | } | ||
| 224 | |||
| 225 | std::unordered_map<int, int> pid_before; | ||
| 226 |
3/4✓ Branch 35 → 36 taken 1000 times.
✗ Branch 35 → 567 not taken.
✓ Branch 40 → 37 taken 6993 times.
✓ Branch 40 → 41 taken 1000 times.
|
7993 | for(auto const& row : particle.getRowList()) { |
| 227 |
1/2✓ Branch 38 → 39 taken 6993 times.
✗ Branch 38 → 567 not taken.
|
6993 | pid_before[(int)row] = particle.getInt("pid", row); |
| 228 | } | ||
| 229 | |||
| 230 | // run the algorithm to prune REC::Particle in place | ||
| 231 |
1/2✓ Branch 41 → 42 taken 1000 times.
✗ Branch 41 → 567 not taken.
|
1000 | m_algo_seq->Run(banks); |
| 232 | |||
| 233 | // Snapshot after sets | ||
| 234 | std::unordered_set<int> eorg_after; | ||
| 235 | std::unordered_set<int> had_after; | ||
| 236 | std::unordered_set<int> pos_after, neg_after; | ||
| 237 | |||
| 238 |
3/4✓ Branch 42 → 43 taken 1000 times.
✗ Branch 42 → 559 not taken.
✓ Branch 56 → 44 taken 6643 times.
✓ Branch 56 → 57 taken 1000 times.
|
7643 | for(auto const& row : particle.getRowList()) { |
| 239 | 6643 | int pidx = (int)row; | |
| 240 | 6643 | int pid = particle.getInt("pid", row); | |
| 241 |
2/2✓ Branch 45 → 46 taken 2368 times.
✓ Branch 45 → 47 taken 4275 times.
|
6643 | if(pid == 11 || pid == 22) |
| 242 | eorg_after.insert(pidx); | ||
| 243 |
6/6✓ Branch 47 → 48 taken 5711 times.
✓ Branch 47 → 50 taken 932 times.
✓ Branch 48 → 49 taken 5141 times.
✓ Branch 48 → 50 taken 570 times.
✓ Branch 49 → 50 taken 28 times.
✓ Branch 49 → 51 taken 5113 times.
|
6643 | if(pid == 211 || pid == 321 || pid == 2212 || pid == -211 || pid == -321 || pid == -2212) |
| 244 | had_after.insert(pidx); | ||
| 245 |
2/2✓ Branch 51 → 52 taken 5311 times.
✓ Branch 51 → 53 taken 1332 times.
|
6643 | if(pid > 0) |
| 246 | pos_after.insert(pidx); | ||
| 247 |
2/2✓ Branch 53 → 54 taken 405 times.
✓ Branch 53 → 55 taken 927 times.
|
1332 | else if(pid < 0) |
| 248 | neg_after.insert(pidx); | ||
| 249 | } | ||
| 250 | |||
| 251 |
1/2✓ Branch 57 → 58 taken 1000 times.
✗ Branch 57 → 559 not taken.
|
1000 | std::scoped_lock<std::mutex> lock(m_mutex); |
| 252 | |||
| 253 | // PCal before/after (electrons, photons) | ||
| 254 |
1/2✓ Branch 58 → 59 taken 1000 times.
✗ Branch 58 → 148 not taken.
|
1000 | if(m_have_calor) { |
| 255 |
2/4✓ Branch 59 → 60 taken 1000 times.
✗ Branch 59 → 557 not taken.
✓ Branch 60 → 61 taken 1000 times.
✗ Branch 60 → 467 not taken.
|
2000 | auto& cal = GetBank(banks, b_calor, "REC::Calorimeter"); |
| 256 | |||
| 257 | // unique pindex counters per sector (for survival %) | ||
| 258 | std::array<std::set<int>, 7> be_e, af_e, be_g, af_g; | ||
| 259 | |||
| 260 | int const n = cal.getRows(); | ||
| 261 |
2/2✓ Branch 125 → 76 taken 6129 times.
✓ Branch 125 → 131 taken 1000 times.
|
7129 | for(int i = 0; i < n; ++i) { |
| 262 |
2/2✓ Branch 77 → 78 taken 2983 times.
✓ Branch 77 → 79 taken 3146 times.
|
6129 | if(cal.getInt("layer", i) != 1) |
| 263 | 4478 | continue; // PCal only | |
| 264 |
2/2✓ Branch 80 → 81 taken 1495 times.
✓ Branch 80 → 83 taken 1651 times.
|
3146 | int pidx = cal.getInt("pindex", i); |
| 265 | 1495 | if(!eorg_before.count(pidx)) | |
| 266 | 1495 | continue; | |
| 267 | |||
| 268 | 1651 | int sector = cal.getInt("sector", i); | |
| 269 |
1/2✗ Branch 85 → 86 not taken.
✓ Branch 85 → 87 taken 1651 times.
|
1651 | if(sector < 1 || sector > 6) |
| 270 | ✗ | continue; | |
| 271 | |||
| 272 | 1651 | double lv = cal.getFloat("lv", i); | |
| 273 |
1/2✓ Branch 89 → 90 taken 1651 times.
✗ Branch 89 → 91 not taken.
|
1651 | double lw = cal.getFloat("lw", i); |
| 274 | |||
| 275 | // PID for this pindex (from before snapshot) | ||
| 276 | int pid = 0; | ||
| 277 | auto itpb = pid_before.find(pidx); | ||
| 278 |
1/2✗ Branch 91 → 92 not taken.
✓ Branch 91 → 93 taken 1651 times.
|
1651 | if(itpb == pid_before.end()) |
| 279 | ✗ | continue; | |
| 280 | 1651 | pid = itpb->second; | |
| 281 |
1/2✗ Branch 93 → 94 not taken.
✓ Branch 93 → 95 taken 1651 times.
|
1651 | if(pid != 11 && pid != 22) |
| 282 | ✗ | continue; | |
| 283 | |||
| 284 | 1651 | auto& H = const_cast<FiducialFilterPass2Validator*>(this)->m_cal[pid][sector]; | |
| 285 | |||
| 286 |
3/4✓ Branch 96 → 97 taken 1651 times.
✗ Branch 96 → 99 not taken.
✓ Branch 97 → 98 taken 391 times.
✓ Branch 97 → 99 taken 1260 times.
|
1651 | if(lv >= 0.0 && lv <= 45.0) |
| 287 |
1/2✓ Branch 98 → 99 taken 391 times.
✗ Branch 98 → 473 not taken.
|
391 | H.lv_before->Fill(lv); |
| 288 |
3/4✓ Branch 99 → 100 taken 1651 times.
✗ Branch 99 → 102 not taken.
✓ Branch 100 → 101 taken 415 times.
✓ Branch 100 → 102 taken 1236 times.
|
1651 | if(lw >= 0.0 && lw <= 45.0) |
| 289 |
1/2✓ Branch 101 → 102 taken 415 times.
✗ Branch 101 → 473 not taken.
|
415 | H.lw_before->Fill(lw); |
| 290 | |||
| 291 | bool const survived = eorg_after.count(pidx); | ||
| 292 | |||
| 293 | if(survived) { | ||
| 294 |
3/4✓ Branch 106 → 107 taken 1541 times.
✗ Branch 106 → 109 not taken.
✓ Branch 107 → 108 taken 332 times.
✓ Branch 107 → 109 taken 1209 times.
|
1541 | if(lv >= 0.0 && lv <= 45.0) |
| 295 |
1/2✓ Branch 108 → 109 taken 332 times.
✗ Branch 108 → 473 not taken.
|
332 | H.lv_after->Fill(lv); |
| 296 |
3/4✓ Branch 109 → 110 taken 1541 times.
✗ Branch 109 → 111 not taken.
✓ Branch 110 → 111 taken 1218 times.
✓ Branch 110 → 112 taken 323 times.
|
1541 | if(lw >= 0.0 && lw <= 45.0) |
| 297 |
1/2✓ Branch 112 → 111 taken 323 times.
✗ Branch 112 → 473 not taken.
|
323 | H.lw_after->Fill(lw); |
| 298 | } | ||
| 299 | |||
| 300 | // unique pindex per sector (counts) | ||
| 301 |
2/2✓ Branch 113 → 114 taken 145 times.
✓ Branch 113 → 118 taken 1506 times.
|
1651 | if(pid == 11) { |
| 302 | be_e[sector].insert(pidx); | ||
| 303 |
2/2✓ Branch 115 → 116 taken 117 times.
✓ Branch 115 → 122 taken 28 times.
|
145 | if(survived) |
| 304 | af_e[sector].insert(pidx); | ||
| 305 | } | ||
| 306 | else { | ||
| 307 | be_g[sector].insert(pidx); | ||
| 308 |
2/2✓ Branch 119 → 120 taken 1424 times.
✓ Branch 119 → 122 taken 82 times.
|
1506 | if(survived) |
| 309 | af_g[sector].insert(pidx); | ||
| 310 | } | ||
| 311 | } | ||
| 312 | |||
| 313 |
2/2✓ Branch 131 → 126 taken 6000 times.
✓ Branch 131 → 132 taken 1000 times.
|
7000 | for(int s = 1; s <= 6; ++s) { |
| 314 |
2/4✓ Branch 126 → 127 taken 6000 times.
✗ Branch 126 → 473 not taken.
✓ Branch 127 → 128 taken 6000 times.
✗ Branch 127 → 473 not taken.
|
6000 | const_cast<FiducialFilterPass2Validator*>(this)->m_cal_counts[11][s].before += be_e[s].size(); |
| 315 |
2/4✓ Branch 127 → 128 taken 6000 times.
✗ Branch 127 → 473 not taken.
✓ Branch 128 → 129 taken 6000 times.
✗ Branch 128 → 473 not taken.
|
6000 | const_cast<FiducialFilterPass2Validator*>(this)->m_cal_counts[11][s].after += af_e[s].size(); |
| 316 |
2/4✓ Branch 128 → 129 taken 6000 times.
✗ Branch 128 → 473 not taken.
✓ Branch 129 → 130 taken 6000 times.
✗ Branch 129 → 473 not taken.
|
6000 | const_cast<FiducialFilterPass2Validator*>(this)->m_cal_counts[22][s].before += be_g[s].size(); |
| 317 |
1/2✓ Branch 129 → 130 taken 6000 times.
✗ Branch 129 → 473 not taken.
|
6000 | const_cast<FiducialFilterPass2Validator*>(this)->m_cal_counts[22][s].after += af_g[s].size(); |
| 318 | } | ||
| 319 | } | ||
| 320 | |||
| 321 | // FT XY before/after (e-/gamma) | ||
| 322 |
1/2✗ Branch 148 → 149 not taken.
✓ Branch 148 → 243 taken 1000 times.
|
1000 | if(m_have_ft) { |
| 323 | ✗ | auto& ft = GetBank(banks, b_ft, "REC::ForwardTagger"); | |
| 324 | |||
| 325 | std::set<int> seen_b_e, seen_a_e, seen_b_g, seen_a_g; | ||
| 326 | |||
| 327 | int const n = ft.getRows(); | ||
| 328 | ✗ | for(int i = 0; i < n; ++i) { | |
| 329 | ✗ | int pidx = ft.getInt("pindex", i); | |
| 330 | ✗ | if(!eorg_before.count(pidx)) | |
| 331 | ✗ | continue; | |
| 332 | |||
| 333 | int pid = 0; | ||
| 334 | auto itpb = pid_before.find(pidx); | ||
| 335 | ✗ | if(itpb == pid_before.end()) | |
| 336 | ✗ | continue; | |
| 337 | ✗ | pid = itpb->second; | |
| 338 | ✗ | if(pid != 11 && pid != 22) | |
| 339 | ✗ | continue; | |
| 340 | |||
| 341 | auto& HH = const_cast<FiducialFilterPass2Validator*>(this)->m_ft_h.at(pid); | ||
| 342 | |||
| 343 | ✗ | double x = ft.getFloat("x", i); | |
| 344 | ✗ | double y = ft.getFloat("y", i); | |
| 345 | ✗ | if(pid == 11) { | |
| 346 | if(!seen_b_e.count(pidx)) { | ||
| 347 | ✗ | HH.before->Fill(x, y); | |
| 348 | seen_b_e.insert(pidx); | ||
| 349 | } | ||
| 350 | if(eorg_after.count(pidx) && !seen_a_e.count(pidx)) { | ||
| 351 | ✗ | HH.after->Fill(x, y); | |
| 352 | seen_a_e.insert(pidx); | ||
| 353 | } | ||
| 354 | } | ||
| 355 | else { | ||
| 356 | if(!seen_b_g.count(pidx)) { | ||
| 357 | ✗ | HH.before->Fill(x, y); | |
| 358 | seen_b_g.insert(pidx); | ||
| 359 | } | ||
| 360 | if(eorg_after.count(pidx) && !seen_a_g.count(pidx)) { | ||
| 361 | ✗ | HH.after->Fill(x, y); | |
| 362 | seen_a_g.insert(pidx); | ||
| 363 | } | ||
| 364 | } | ||
| 365 | } | ||
| 366 | |||
| 367 | ✗ | const_cast<FiducialFilterPass2Validator*>(this)->m_ft_before_n[11] += seen_b_e.size(); | |
| 368 | ✗ | const_cast<FiducialFilterPass2Validator*>(this)->m_ft_after_n[11] += seen_a_e.size(); | |
| 369 | ✗ | const_cast<FiducialFilterPass2Validator*>(this)->m_ft_before_n[22] += seen_b_g.size(); | |
| 370 | ✗ | const_cast<FiducialFilterPass2Validator*>(this)->m_ft_after_n[22] += seen_a_g.size(); | |
| 371 | } | ||
| 372 | |||
| 373 | // CVT layer 12 phi/theta before/after (hadrons) | ||
| 374 |
1/2✓ Branch 243 → 244 taken 1000 times.
✗ Branch 243 → 306 not taken.
|
1000 | if(m_have_traj) { |
| 375 |
2/4✓ Branch 244 → 245 taken 1000 times.
✗ Branch 244 → 557 not taken.
✓ Branch 245 → 246 taken 1000 times.
✗ Branch 245 → 507 not taken.
|
2000 | auto& traj = GetBank(banks, b_traj, "REC::Traj"); |
| 376 | |||
| 377 | std::set<int> b_seen, a_seen; | ||
| 378 | |||
| 379 | int const n = traj.getRows(); | ||
| 380 |
2/2✓ Branch 302 → 252 taken 38201 times.
✓ Branch 302 → 303 taken 1000 times.
|
39201 | for(int i = 0; i < n; ++i) { |
| 381 |
2/2✓ Branch 253 → 254 taken 33561 times.
✓ Branch 253 → 255 taken 4640 times.
|
38201 | if(traj.getInt("detector", i) != 5) |
| 382 | 37841 | continue; // CVT | |
| 383 |
2/2✓ Branch 256 → 257 taken 3712 times.
✓ Branch 256 → 258 taken 928 times.
|
4640 | if(traj.getInt("layer", i) != 12) |
| 384 | 3712 | continue; | |
| 385 | |||
| 386 |
2/2✓ Branch 259 → 260 taken 568 times.
✓ Branch 259 → 262 taken 360 times.
|
928 | int pidx = traj.getInt("pindex", i); |
| 387 | 568 | if(!had_before.count(pidx)) | |
| 388 | 568 | continue; | |
| 389 | |||
| 390 | 360 | double x = traj.getFloat("x", i); | |
| 391 | 360 | double y = traj.getFloat("y", i); | |
| 392 | 360 | double z = traj.getFloat("z", i); | |
| 393 | |||
| 394 | constexpr double kPI = 3.14159; | ||
| 395 | 360 | double phi = std::atan2(y, x) * (180.0 / kPI); | |
| 396 |
2/2✓ Branch 266 → 267 taken 171 times.
✓ Branch 266 → 268 taken 189 times.
|
360 | if(phi < 0) |
| 397 | 171 | phi += 360.0; | |
| 398 | 360 | double rho = std::sqrt(x * x + y * y); | |
| 399 |
1/2✗ Branch 268 → 269 not taken.
✓ Branch 268 → 270 taken 360 times.
|
360 | double theta = std::atan2(rho, (z == 0.0 ? 1e-9 : z)) * (180.0 / kPI); |
| 400 | |||
| 401 | if(!b_seen.count(pidx)) { | ||
| 402 |
1/2✓ Branch 280 → 281 taken 360 times.
✗ Branch 280 → 513 not taken.
|
360 | m_cvt_before->Fill(phi, theta); |
| 403 | b_seen.insert(pidx); | ||
| 404 | } | ||
| 405 | if(had_after.count(pidx) && !a_seen.count(pidx)) { | ||
| 406 |
1/2✓ Branch 296 → 297 taken 247 times.
✗ Branch 296 → 513 not taken.
|
247 | m_cvt_after->Fill(phi, theta); |
| 407 | a_seen.insert(pidx); | ||
| 408 | } | ||
| 409 | } | ||
| 410 | |||
| 411 | 1000 | const_cast<FiducialFilterPass2Validator*>(this)->m_cvt_before_n += (long long)b_seen.size(); | |
| 412 | 1000 | const_cast<FiducialFilterPass2Validator*>(this)->m_cvt_after_n += (long long)a_seen.size(); | |
| 413 | } | ||
| 414 | |||
| 415 | // DC edges pos/neg before/after (use last-seen edge per (track,region)) | ||
| 416 |
1/2✓ Branch 306 → 307 taken 1000 times.
✗ Branch 306 → 444 not taken.
|
1000 | if(m_have_traj) { |
| 417 |
2/4✓ Branch 307 → 308 taken 1000 times.
✗ Branch 307 → 557 not taken.
✓ Branch 308 → 309 taken 1000 times.
✗ Branch 308 → 517 not taken.
|
2000 | auto& traj = GetBank(banks, b_traj, "REC::Traj"); |
| 418 | |||
| 419 | std::unordered_map<int, double> pos_r1, pos_r2, pos_r3; | ||
| 420 | std::unordered_map<int, double> neg_r1, neg_r2, neg_r3; | ||
| 421 | |||
| 422 | int const n = traj.getRows(); | ||
| 423 |
2/2✓ Branch 352 → 315 taken 38201 times.
✓ Branch 352 → 353 taken 1000 times.
|
39201 | for(int i = 0; i < n; ++i) { |
| 424 |
2/2✓ Branch 316 → 317 taken 32600 times.
✓ Branch 316 → 318 taken 5601 times.
|
38201 | if(traj.getInt("detector", i) != 6) |
| 425 | 33416 | continue; // DC | |
| 426 | |||
| 427 | 5601 | int pidx = traj.getInt("pindex", i); | |
| 428 | 5601 | double edge = traj.getFloat("edge", i); | |
| 429 | 5601 | int layer = traj.getInt("layer", i); | |
| 430 | |||
| 431 | bool is_pos_before = pos_before.count(pidx); | ||
| 432 | bool is_neg_before = neg_before.count(pidx); | ||
| 433 |
2/2✓ Branch 327 → 329 taken 816 times.
✓ Branch 327 → 330 taken 3618 times.
|
4434 | if(!is_pos_before && !is_neg_before) |
| 434 | 816 | continue; | |
| 435 | |||
| 436 |
2/2✓ Branch 330 → 331 taken 3618 times.
✓ Branch 330 → 340 taken 1167 times.
|
4785 | if(is_pos_before) { |
| 437 |
2/2✓ Branch 331 → 332 taken 1206 times.
✓ Branch 331 → 334 taken 2412 times.
|
3618 | if(layer == 6) |
| 438 | 1206 | pos_r1[pidx] = edge; | |
| 439 |
2/2✓ Branch 334 → 335 taken 1206 times.
✓ Branch 334 → 337 taken 1206 times.
|
2412 | else if(layer == 18) |
| 440 | 1206 | pos_r2[pidx] = edge; | |
| 441 |
1/2✓ Branch 337 → 338 taken 1206 times.
✗ Branch 337 → 349 not taken.
|
1206 | else if(layer == 36) |
| 442 | 1206 | pos_r3[pidx] = edge; | |
| 443 | } | ||
| 444 | else { // negative | ||
| 445 |
2/2✓ Branch 340 → 341 taken 389 times.
✓ Branch 340 → 343 taken 778 times.
|
1167 | if(layer == 6) |
| 446 | 389 | neg_r1[pidx] = edge; | |
| 447 |
2/2✓ Branch 343 → 344 taken 389 times.
✓ Branch 343 → 346 taken 389 times.
|
778 | else if(layer == 18) |
| 448 | 389 | neg_r2[pidx] = edge; | |
| 449 |
1/2✓ Branch 346 → 347 taken 389 times.
✗ Branch 346 → 349 not taken.
|
389 | else if(layer == 36) |
| 450 | 389 | neg_r3[pidx] = edge; | |
| 451 | } | ||
| 452 | } | ||
| 453 | |||
| 454 |
2/2✓ Branch 362 → 354 taken 1206 times.
✓ Branch 362 → 363 taken 1000 times.
|
2206 | for(auto& kv : pos_r1) { |
| 455 |
1/2✓ Branch 354 → 355 taken 1206 times.
✗ Branch 354 → 356 not taken.
|
1206 | if(m_dc_pos.r1_before) |
| 456 |
1/2✓ Branch 355 → 356 taken 1206 times.
✗ Branch 355 → 545 not taken.
|
1206 | m_dc_pos.r1_before->Fill(kv.second); |
| 457 |
3/4✓ Branch 356 → 357 taken 99 times.
✓ Branch 356 → 358 taken 1107 times.
✓ Branch 359 → 360 taken 1107 times.
✗ Branch 359 → 361 not taken.
|
2313 | if(pos_after.count(kv.first) && m_dc_pos.r1_after) |
| 458 |
1/2✓ Branch 360 → 361 taken 1107 times.
✗ Branch 360 → 545 not taken.
|
1107 | m_dc_pos.r1_after->Fill(kv.second); |
| 459 | } | ||
| 460 |
2/2✓ Branch 372 → 364 taken 1206 times.
✓ Branch 372 → 373 taken 1000 times.
|
2206 | for(auto& kv : pos_r2) { |
| 461 |
1/2✓ Branch 364 → 365 taken 1206 times.
✗ Branch 364 → 366 not taken.
|
1206 | if(m_dc_pos.r2_before) |
| 462 |
1/2✓ Branch 365 → 366 taken 1206 times.
✗ Branch 365 → 545 not taken.
|
1206 | m_dc_pos.r2_before->Fill(kv.second); |
| 463 |
3/4✓ Branch 366 → 367 taken 99 times.
✓ Branch 366 → 368 taken 1107 times.
✓ Branch 369 → 370 taken 1107 times.
✗ Branch 369 → 371 not taken.
|
2313 | if(pos_after.count(kv.first) && m_dc_pos.r2_after) |
| 464 |
1/2✓ Branch 370 → 371 taken 1107 times.
✗ Branch 370 → 545 not taken.
|
1107 | m_dc_pos.r2_after->Fill(kv.second); |
| 465 | } | ||
| 466 |
2/2✓ Branch 382 → 374 taken 1206 times.
✓ Branch 382 → 383 taken 1000 times.
|
2206 | for(auto& kv : pos_r3) { |
| 467 |
1/2✓ Branch 374 → 375 taken 1206 times.
✗ Branch 374 → 376 not taken.
|
1206 | if(m_dc_pos.r3_before) |
| 468 |
1/2✓ Branch 375 → 376 taken 1206 times.
✗ Branch 375 → 545 not taken.
|
1206 | m_dc_pos.r3_before->Fill(kv.second); |
| 469 |
3/4✓ Branch 376 → 377 taken 99 times.
✓ Branch 376 → 378 taken 1107 times.
✓ Branch 379 → 380 taken 1107 times.
✗ Branch 379 → 381 not taken.
|
2313 | if(pos_after.count(kv.first) && m_dc_pos.r3_after) |
| 470 |
1/2✓ Branch 380 → 381 taken 1107 times.
✗ Branch 380 → 545 not taken.
|
1107 | m_dc_pos.r3_after->Fill(kv.second); |
| 471 | } | ||
| 472 |
2/2✓ Branch 392 → 384 taken 389 times.
✓ Branch 392 → 393 taken 1000 times.
|
1389 | for(auto& kv : neg_r1) { |
| 473 |
1/2✓ Branch 384 → 385 taken 389 times.
✗ Branch 384 → 386 not taken.
|
389 | if(m_dc_neg.r1_before) |
| 474 |
1/2✓ Branch 385 → 386 taken 389 times.
✗ Branch 385 → 545 not taken.
|
389 | m_dc_neg.r1_before->Fill(kv.second); |
| 475 |
3/4✓ Branch 386 → 387 taken 56 times.
✓ Branch 386 → 388 taken 333 times.
✓ Branch 389 → 390 taken 333 times.
✗ Branch 389 → 391 not taken.
|
722 | if(neg_after.count(kv.first) && m_dc_neg.r1_after) |
| 476 |
1/2✓ Branch 390 → 391 taken 333 times.
✗ Branch 390 → 545 not taken.
|
333 | m_dc_neg.r1_after->Fill(kv.second); |
| 477 | } | ||
| 478 |
2/2✓ Branch 402 → 394 taken 389 times.
✓ Branch 402 → 403 taken 1000 times.
|
1389 | for(auto& kv : neg_r2) { |
| 479 |
1/2✓ Branch 394 → 395 taken 389 times.
✗ Branch 394 → 396 not taken.
|
389 | if(m_dc_neg.r2_before) |
| 480 |
1/2✓ Branch 395 → 396 taken 389 times.
✗ Branch 395 → 545 not taken.
|
389 | m_dc_neg.r2_before->Fill(kv.second); |
| 481 |
3/4✓ Branch 396 → 397 taken 56 times.
✓ Branch 396 → 398 taken 333 times.
✓ Branch 399 → 400 taken 333 times.
✗ Branch 399 → 401 not taken.
|
722 | if(neg_after.count(kv.first) && m_dc_neg.r2_after) |
| 482 |
1/2✓ Branch 400 → 401 taken 333 times.
✗ Branch 400 → 545 not taken.
|
333 | m_dc_neg.r2_after->Fill(kv.second); |
| 483 | } | ||
| 484 |
2/2✓ Branch 412 → 404 taken 389 times.
✓ Branch 412 → 413 taken 1000 times.
|
1389 | for(auto& kv : neg_r3) { |
| 485 |
1/2✓ Branch 404 → 405 taken 389 times.
✗ Branch 404 → 406 not taken.
|
389 | if(m_dc_neg.r3_before) |
| 486 |
1/2✓ Branch 405 → 406 taken 389 times.
✗ Branch 405 → 545 not taken.
|
389 | m_dc_neg.r3_before->Fill(kv.second); |
| 487 |
3/4✓ Branch 406 → 407 taken 56 times.
✓ Branch 406 → 408 taken 333 times.
✓ Branch 409 → 410 taken 333 times.
✗ Branch 409 → 411 not taken.
|
722 | if(neg_after.count(kv.first) && m_dc_neg.r3_after) |
| 488 |
1/2✓ Branch 410 → 411 taken 333 times.
✗ Branch 410 → 545 not taken.
|
333 | m_dc_neg.r3_after->Fill(kv.second); |
| 489 | } | ||
| 490 | |||
| 491 | 6000 | auto set_from_keys = [](std::unordered_map<int, double> const& m) { | |
| 492 |
3/4✓ Branch 3 → 4 taken 4785 times.
✗ Branch 3 → 7 not taken.
✓ Branch 5 → 3 taken 4785 times.
✓ Branch 5 → 6 taken 6000 times.
|
10785 | std::set<int> s; for (auto& kv : m) s.insert(kv.first); return s; }; |
| 493 | |||
| 494 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 4000 times.
|
4000 | auto inter3 = [](std::set<int> const& A, |
| 495 | std::set<int> const& B, std::set<int> const& C) -> size_t { | ||
| 496 | std::set<int> const* smallest = &A; | ||
| 497 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 4000 times.
|
4000 | if(B.size() < smallest->size()) |
| 498 | smallest = &B; | ||
| 499 |
1/2✗ Branch 4 → 5 not taken.
✓ Branch 4 → 6 taken 4000 times.
|
4000 | if(C.size() < smallest->size()) |
| 500 | smallest = &C; | ||
| 501 | size_t cnt = 0; | ||
| 502 |
2/2✓ Branch 39 → 7 taken 3035 times.
✓ Branch 39 → 40 taken 4000 times.
|
7035 | for(int v : *smallest) |
| 503 | if(A.count(v) && B.count(v) && C.count(v)) | ||
| 504 | 3035 | ++cnt; | |
| 505 | 4000 | return cnt; | |
| 506 | }; | ||
| 507 | |||
| 508 | 6000 | auto keep_if_survived = [](std::set<int> const& S, std::unordered_set<int> const& survivors) { | |
| 509 |
4/4✓ Branch 3 → 4 taken 465 times.
✓ Branch 3 → 5 taken 4320 times.
✓ Branch 8 → 3 taken 4785 times.
✓ Branch 8 → 9 taken 6000 times.
|
10785 | std::set<int> out; for (int v : S) if (survivors.count(v)) out.insert(v); return out; }; |
| 510 | |||
| 511 |
3/6✓ Branch 413 → 414 taken 1000 times.
✗ Branch 413 → 545 not taken.
✓ Branch 414 → 415 taken 1000 times.
✗ Branch 414 → 543 not taken.
✓ Branch 415 → 416 taken 1000 times.
✗ Branch 415 → 541 not taken.
|
1000 | std::set<int> pos_b1 = set_from_keys(pos_r1), pos_b2 = set_from_keys(pos_r2), pos_b3 = set_from_keys(pos_r3); |
| 512 |
3/6✓ Branch 416 → 417 taken 1000 times.
✗ Branch 416 → 539 not taken.
✓ Branch 417 → 418 taken 1000 times.
✗ Branch 417 → 537 not taken.
✓ Branch 418 → 419 taken 1000 times.
✗ Branch 418 → 535 not taken.
|
1000 | std::set<int> neg_b1 = set_from_keys(neg_r1), neg_b2 = set_from_keys(neg_r2), neg_b3 = set_from_keys(neg_r3); |
| 513 | |||
| 514 |
1/2✓ Branch 419 → 420 taken 1000 times.
✗ Branch 419 → 533 not taken.
|
1000 | std::set<int> pos_a1 = keep_if_survived(pos_b1, pos_after); |
| 515 |
1/2✓ Branch 420 → 421 taken 1000 times.
✗ Branch 420 → 531 not taken.
|
1000 | std::set<int> pos_a2 = keep_if_survived(pos_b2, pos_after); |
| 516 |
1/2✓ Branch 421 → 422 taken 1000 times.
✗ Branch 421 → 529 not taken.
|
1000 | std::set<int> pos_a3 = keep_if_survived(pos_b3, pos_after); |
| 517 |
1/2✓ Branch 422 → 423 taken 1000 times.
✗ Branch 422 → 527 not taken.
|
1000 | std::set<int> neg_a1 = keep_if_survived(neg_b1, neg_after); |
| 518 |
1/2✓ Branch 423 → 424 taken 1000 times.
✗ Branch 423 → 525 not taken.
|
1000 | std::set<int> neg_a2 = keep_if_survived(neg_b2, neg_after); |
| 519 |
1/2✓ Branch 424 → 425 taken 1000 times.
✗ Branch 424 → 523 not taken.
|
1000 | std::set<int> neg_a3 = keep_if_survived(neg_b3, neg_after); |
| 520 | |||
| 521 | 1000 | const_cast<FiducialFilterPass2Validator*>(this)->m_dc_pos_before_n += (long long)inter3(pos_b1, pos_b2, pos_b3); | |
| 522 | 1000 | const_cast<FiducialFilterPass2Validator*>(this)->m_dc_pos_after_n += (long long)inter3(pos_a1, pos_a2, pos_a3); | |
| 523 | 1000 | const_cast<FiducialFilterPass2Validator*>(this)->m_dc_neg_before_n += (long long)inter3(neg_b1, neg_b2, neg_b3); | |
| 524 | 1000 | const_cast<FiducialFilterPass2Validator*>(this)->m_dc_neg_after_n += (long long)inter3(neg_a1, neg_a2, neg_a3); | |
| 525 | } | ||
| 526 | 1000 | return true; | |
| 527 | } | ||
| 528 | |||
| 529 | // plotting | ||
| 530 |
1/2✓ Branch 2 → 3 taken 2 times.
✗ Branch 2 → 4 not taken.
|
2 | void FiducialFilterPass2Validator::DrawCalCanvas(int pid, char const* title) |
| 531 | { | ||
| 532 | auto it = m_cal.find(pid); | ||
| 533 |
1/2✓ Branch 4 → 5 taken 2 times.
✗ Branch 4 → 58 not taken.
|
2 | if(it == m_cal.end()) |
| 534 | return; | ||
| 535 | |||
| 536 |
2/4✓ Branch 6 → 7 taken 2 times.
✗ Branch 6 → 59 not taken.
✓ Branch 7 → 8 taken 2 times.
✗ Branch 7 → 59 not taken.
|
2 | auto* c = new TCanvas(Form("rgafid_pcal_pid%d", pid), title, 1400, 900); |
| 537 | 2 | c->Divide(3, 2); | |
| 538 | |||
| 539 |
2/2✓ Branch 52 → 9 taken 12 times.
✓ Branch 52 → 53 taken 2 times.
|
14 | for(int s = 1; s <= 6; ++s) { |
| 540 | 12 | c->cd(s); | |
| 541 | 12 | gPad->SetLeftMargin(0.12); | |
| 542 | 12 | gPad->SetRightMargin(0.04); | |
| 543 | 12 | gPad->SetBottomMargin(0.12); | |
| 544 | 12 | gPad->SetTopMargin(0.08); | |
| 545 | |||
| 546 | 12 | auto& H = it->second[s]; | |
| 547 |
1/2✗ Branch 18 → 19 not taken.
✓ Branch 18 → 20 taken 12 times.
|
12 | if(!H.lv_before) |
| 548 | ✗ | continue; | |
| 549 | |||
| 550 | 12 | H.lv_before->SetLineColor(kBlue + 1); | |
| 551 | 12 | H.lv_before->SetLineWidth(2); | |
| 552 | 12 | H.lw_before->SetLineColor(kRed + 1); | |
| 553 | 12 | H.lw_before->SetLineWidth(2); | |
| 554 | 12 | H.lv_after->SetLineColor(kBlue + 1); | |
| 555 | 12 | H.lv_after->SetLineWidth(2); | |
| 556 | 12 | H.lv_after->SetLineStyle(2); | |
| 557 | 12 | H.lw_after->SetLineColor(kRed + 1); | |
| 558 | 12 | H.lw_after->SetLineWidth(2); | |
| 559 | 12 | H.lw_after->SetLineStyle(2); | |
| 560 | |||
| 561 | // survival % for this PID/sector (unique pindex) | ||
| 562 | 12 | long long b = m_cal_counts[pid][s].before; | |
| 563 | 12 | long long a = m_cal_counts[pid][s].after; | |
| 564 |
1/2✓ Branch 32 → 33 taken 12 times.
✗ Branch 32 → 34 not taken.
|
12 | double pct = (b > 0) ? (100.0 * double(a) / double(b)) : 0.0; |
| 565 | |||
| 566 |
2/2✓ Branch 34 → 35 taken 6 times.
✓ Branch 34 → 36 taken 6 times.
|
18 | H.lv_before->SetTitle(Form("%s - Sector %d [survive = %.3f%%];length (cm);counts", |
| 567 | pid == 11 ? "Electrons" : "Photons", s, pct)); | ||
| 568 | |||
| 569 | 12 | H.lv_before->Draw("HIST"); | |
| 570 | 12 | H.lw_before->Draw("HISTSAME"); | |
| 571 | 12 | H.lv_after->Draw("HISTSAME"); | |
| 572 | 12 | H.lw_after->Draw("HISTSAME"); | |
| 573 | |||
| 574 |
1/2✓ Branch 43 → 44 taken 12 times.
✗ Branch 43 → 61 not taken.
|
12 | auto* leg = new TLegend(0.55, 0.72, 0.88, 0.90); |
| 575 | 12 | leg->SetBorderSize(0); | |
| 576 | 12 | leg->SetFillStyle(0); | |
| 577 | 12 | leg->AddEntry(H.lv_before, "lv before", "l"); | |
| 578 | 12 | leg->AddEntry(H.lw_before, "lw before", "l"); | |
| 579 | 12 | leg->AddEntry(H.lv_after, "lv after", "l"); | |
| 580 | 12 | leg->AddEntry(H.lw_after, "lw after", "l"); | |
| 581 | leg->SetBit(TObject::kCanDelete); | ||
| 582 | 12 | leg->Draw(); | |
| 583 | } | ||
| 584 | |||
| 585 | 2 | SaveAndDisposeCanvas(c, Form("%s_pcal_lv_lw_pid%d.png", m_base.Data(), pid)); | |
| 586 | } | ||
| 587 | |||
| 588 | 1 | void FiducialFilterPass2Validator::DrawFTCanvas2x2() | |
| 589 | { | ||
| 590 |
1/2✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 4 not taken.
|
1 | if(!m_have_ft) |
| 591 | 1 | return; | |
| 592 | |||
| 593 | ✗ | auto* c = new TCanvas("rgafid_ft_xy_2x2", "FT x-y Before/After", 1200, 900); | |
| 594 | ✗ | c->Divide(2, 2); | |
| 595 | |||
| 596 | ✗ | auto draw_pad = [&](int pad, TH2F* h, char const* ttl) { | |
| 597 | ✗ | c->cd(pad); | |
| 598 | ✗ | gPad->SetLeftMargin(0.12); | |
| 599 | ✗ | gPad->SetRightMargin(0.04); | |
| 600 | ✗ | gPad->SetBottomMargin(0.12); | |
| 601 | ✗ | gPad->SetTopMargin(0.08); | |
| 602 | ✗ | h->SetTitle(ttl); | |
| 603 | ✗ | h->Draw("COLZ"); | |
| 604 | ✗ | }; | |
| 605 | |||
| 606 | ✗ | auto pct = [&](int pid) -> double { | |
| 607 | ✗ | long long b = m_ft_before_n[pid]; | |
| 608 | ✗ | long long a = m_ft_after_n[pid]; | |
| 609 | ✗ | return (b > 0) ? (100.0 * double(a) / double(b)) : 0.0; | |
| 610 | ✗ | }; | |
| 611 | |||
| 612 | ✗ | draw_pad(1, m_ft_h.at(11).before, "Electrons (before);x (cm);y (cm)"); | |
| 613 | ✗ | draw_pad(2, m_ft_h.at(11).after, | |
| 614 | ✗ | Form("Electrons (after) [survive = %.3f%%];x (cm);y (cm)", pct(11))); | |
| 615 | |||
| 616 | ✗ | draw_pad(3, m_ft_h.at(22).before, "Photons (before);x (cm);y (cm)"); | |
| 617 | ✗ | draw_pad(4, m_ft_h.at(22).after, | |
| 618 | ✗ | Form("Photons (after) [survive = %.3f%%];x (cm);y (cm)", pct(22))); | |
| 619 | |||
| 620 | ✗ | SaveAndDisposeCanvas(c, Form("%s_ft_xy_2x2.png", m_base.Data())); | |
| 621 | } | ||
| 622 | |||
| 623 | 1 | void FiducialFilterPass2Validator::DrawCVTCanvas1x2(char const* title) | |
| 624 | { | ||
| 625 |
3/6✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 37 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 37 not taken.
✓ Branch 4 → 5 taken 1 time.
✗ Branch 4 → 37 not taken.
|
1 | if(!m_have_traj || !m_cvt_before || !m_cvt_after) |
| 626 | return; | ||
| 627 | |||
| 628 |
1/2✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 38 not taken.
|
1 | auto* c = new TCanvas("rgafid_cvt_l12_all", title, 1200, 600); |
| 629 | 1 | c->Divide(2, 1); | |
| 630 | |||
| 631 | double const left = 0.12; | ||
| 632 | double const right = 0.16; | ||
| 633 | double const bottom = 0.12; | ||
| 634 | double const top = 0.08; | ||
| 635 | |||
| 636 | double pct = 0.0; | ||
| 637 |
1/2✓ Branch 8 → 9 taken 1 time.
✗ Branch 8 → 10 not taken.
|
1 | if(m_cvt_before_n > 0) |
| 638 | 1 | pct = 100.0 * double(m_cvt_after_n) / double(m_cvt_before_n); | |
| 639 | |||
| 640 | 1 | c->cd(1); | |
| 641 | 1 | gPad->SetLeftMargin(left); | |
| 642 | 1 | gPad->SetRightMargin(right); | |
| 643 | 1 | gPad->SetBottomMargin(bottom); | |
| 644 | 1 | gPad->SetTopMargin(top); | |
| 645 | 1 | m_cvt_before->Draw("COLZ"); | |
| 646 | |||
| 647 | 1 | c->cd(2); | |
| 648 | 1 | gPad->SetLeftMargin(left); | |
| 649 | 1 | gPad->SetRightMargin(right); | |
| 650 | 1 | gPad->SetBottomMargin(bottom); | |
| 651 | 1 | gPad->SetTopMargin(top); | |
| 652 | 1 | m_cvt_after->SetTitle(Form("CVT layer 12 after (hadrons) [survive = %.3f%%];phi (deg);theta (deg)", pct)); | |
| 653 | 1 | m_cvt_after->Draw("COLZ"); | |
| 654 | |||
| 655 | 1 | SaveAndDisposeCanvas(c, Form("%s_cvt_l12_phi_theta_hadrons.png", m_base.Data())); | |
| 656 | } | ||
| 657 | |||
| 658 | 2 | void FiducialFilterPass2Validator::DrawDCCanvas2x3(DCHists const& H, | |
| 659 | char const* bend, double survive_pct) | ||
| 660 | { | ||
| 661 | |||
| 662 |
5/8✓ Branch 3 → 4 taken 2 times.
✗ Branch 3 → 76 not taken.
✓ Branch 4 → 5 taken 1 time.
✓ Branch 4 → 6 taken 1 time.
✓ Branch 6 → 7 taken 2 times.
✗ Branch 6 → 76 not taken.
✓ Branch 8 → 9 taken 2 times.
✗ Branch 8 → 80 not taken.
|
3 | TString bendTitle = (TString(bend) == "inb") ? "Inb" : "Out"; |
| 663 | |||
| 664 |
1/2✓ Branch 12 → 13 taken 2 times.
✗ Branch 12 → 78 not taken.
|
2 | auto* c = new TCanvas(Form("rgafid_dc_%s_2x3", bend), |
| 665 |
2/4✓ Branch 11 → 12 taken 2 times.
✗ Branch 11 → 78 not taken.
✓ Branch 13 → 14 taken 2 times.
✗ Branch 13 → 78 not taken.
|
4 | Form("%s DC edges: before/after", bendTitle.Data()), 1500, 900); |
| 666 |
1/2✓ Branch 14 → 15 taken 2 times.
✗ Branch 14 → 80 not taken.
|
2 | c->Divide(3, 2); |
| 667 | |||
| 668 | // before row | ||
| 669 |
1/2✓ Branch 15 → 16 taken 2 times.
✗ Branch 15 → 80 not taken.
|
2 | c->cd(1); |
| 670 |
1/2✓ Branch 16 → 17 taken 2 times.
✗ Branch 16 → 80 not taken.
|
2 | SetDCPadMargins(); |
| 671 |
1/2✓ Branch 17 → 18 taken 2 times.
✗ Branch 17 → 24 not taken.
|
2 | if(H.r1_before) { |
| 672 |
1/2✓ Branch 18 → 19 taken 2 times.
✗ Branch 18 → 80 not taken.
|
2 | H.r1_before->SetLineWidth(2); |
| 673 |
1/2✓ Branch 19 → 20 taken 2 times.
✗ Branch 19 → 80 not taken.
|
2 | H.r1_before->Draw("HIST"); |
| 674 |
3/6✗ Branch 20 → 21 not taken.
✓ Branch 20 → 22 taken 2 times.
✓ Branch 22 → 23 taken 2 times.
✗ Branch 22 → 80 not taken.
✓ Branch 23 → 24 taken 2 times.
✗ Branch 23 → 80 not taken.
|
2 | H.r1_before->SetTitle(Form("%s DC Region 1 (before);edge (cm);counts", bendTitle.Data())); |
| 675 | } | ||
| 676 |
1/2✓ Branch 24 → 25 taken 2 times.
✗ Branch 24 → 80 not taken.
|
2 | c->cd(2); |
| 677 |
1/2✓ Branch 25 → 26 taken 2 times.
✗ Branch 25 → 80 not taken.
|
2 | SetDCPadMargins(); |
| 678 |
1/2✓ Branch 26 → 27 taken 2 times.
✗ Branch 26 → 33 not taken.
|
2 | if(H.r2_before) { |
| 679 |
1/2✓ Branch 27 → 28 taken 2 times.
✗ Branch 27 → 80 not taken.
|
2 | H.r2_before->SetLineWidth(2); |
| 680 |
1/2✓ Branch 28 → 29 taken 2 times.
✗ Branch 28 → 80 not taken.
|
2 | H.r2_before->Draw("HIST"); |
| 681 |
3/6✗ Branch 29 → 30 not taken.
✓ Branch 29 → 31 taken 2 times.
✓ Branch 31 → 32 taken 2 times.
✗ Branch 31 → 80 not taken.
✓ Branch 32 → 33 taken 2 times.
✗ Branch 32 → 80 not taken.
|
2 | H.r2_before->SetTitle(Form("%s DC Region 2 (before);edge (cm);counts", bendTitle.Data())); |
| 682 | } | ||
| 683 |
1/2✓ Branch 33 → 34 taken 2 times.
✗ Branch 33 → 80 not taken.
|
2 | c->cd(3); |
| 684 |
1/2✓ Branch 34 → 35 taken 2 times.
✗ Branch 34 → 80 not taken.
|
2 | SetDCPadMargins(); |
| 685 |
1/2✓ Branch 35 → 36 taken 2 times.
✗ Branch 35 → 42 not taken.
|
2 | if(H.r3_before) { |
| 686 |
1/2✓ Branch 36 → 37 taken 2 times.
✗ Branch 36 → 80 not taken.
|
2 | H.r3_before->SetLineWidth(2); |
| 687 |
1/2✓ Branch 37 → 38 taken 2 times.
✗ Branch 37 → 80 not taken.
|
2 | H.r3_before->Draw("HIST"); |
| 688 |
3/6✗ Branch 38 → 39 not taken.
✓ Branch 38 → 40 taken 2 times.
✓ Branch 40 → 41 taken 2 times.
✗ Branch 40 → 80 not taken.
✓ Branch 41 → 42 taken 2 times.
✗ Branch 41 → 80 not taken.
|
2 | H.r3_before->SetTitle(Form("%s DC Region 3 (before);edge (cm);counts", bendTitle.Data())); |
| 689 | } | ||
| 690 | |||
| 691 | // after row | ||
| 692 |
1/2✓ Branch 42 → 43 taken 2 times.
✗ Branch 42 → 80 not taken.
|
2 | c->cd(4); |
| 693 |
1/2✓ Branch 43 → 44 taken 2 times.
✗ Branch 43 → 80 not taken.
|
2 | SetDCPadMargins(); |
| 694 |
1/2✓ Branch 44 → 45 taken 2 times.
✗ Branch 44 → 51 not taken.
|
2 | if(H.r1_after) { |
| 695 |
1/2✓ Branch 45 → 46 taken 2 times.
✗ Branch 45 → 80 not taken.
|
2 | H.r1_after->SetLineWidth(2); |
| 696 |
1/2✓ Branch 46 → 47 taken 2 times.
✗ Branch 46 → 80 not taken.
|
2 | H.r1_after->Draw("HIST"); |
| 697 |
3/6✗ Branch 47 → 48 not taken.
✓ Branch 47 → 49 taken 2 times.
✓ Branch 49 → 50 taken 2 times.
✗ Branch 49 → 80 not taken.
✓ Branch 50 → 51 taken 2 times.
✗ Branch 50 → 80 not taken.
|
2 | H.r1_after->SetTitle(Form("%s DC Region 1 (after) [survive = %.3f%%];edge (cm);counts", bendTitle.Data(), survive_pct)); |
| 698 | } | ||
| 699 |
1/2✓ Branch 51 → 52 taken 2 times.
✗ Branch 51 → 80 not taken.
|
2 | c->cd(5); |
| 700 |
1/2✓ Branch 52 → 53 taken 2 times.
✗ Branch 52 → 80 not taken.
|
2 | SetDCPadMargins(); |
| 701 |
1/2✓ Branch 53 → 54 taken 2 times.
✗ Branch 53 → 60 not taken.
|
2 | if(H.r2_after) { |
| 702 |
1/2✓ Branch 54 → 55 taken 2 times.
✗ Branch 54 → 80 not taken.
|
2 | H.r2_after->SetLineWidth(2); |
| 703 |
1/2✓ Branch 55 → 56 taken 2 times.
✗ Branch 55 → 80 not taken.
|
2 | H.r2_after->Draw("HIST"); |
| 704 |
3/6✗ Branch 56 → 57 not taken.
✓ Branch 56 → 58 taken 2 times.
✓ Branch 58 → 59 taken 2 times.
✗ Branch 58 → 80 not taken.
✓ Branch 59 → 60 taken 2 times.
✗ Branch 59 → 80 not taken.
|
2 | H.r2_after->SetTitle(Form("%s DC Region 2 (after) [survive = %.3f%%];edge (cm);counts", bendTitle.Data(), survive_pct)); |
| 705 | } | ||
| 706 |
1/2✓ Branch 60 → 61 taken 2 times.
✗ Branch 60 → 80 not taken.
|
2 | c->cd(6); |
| 707 |
1/2✓ Branch 61 → 62 taken 2 times.
✗ Branch 61 → 80 not taken.
|
2 | SetDCPadMargins(); |
| 708 |
1/2✓ Branch 62 → 63 taken 2 times.
✗ Branch 62 → 69 not taken.
|
2 | if(H.r3_after) { |
| 709 |
1/2✓ Branch 63 → 64 taken 2 times.
✗ Branch 63 → 80 not taken.
|
2 | H.r3_after->SetLineWidth(2); |
| 710 |
1/2✓ Branch 64 → 65 taken 2 times.
✗ Branch 64 → 80 not taken.
|
2 | H.r3_after->Draw("HIST"); |
| 711 |
3/6✗ Branch 65 → 66 not taken.
✓ Branch 65 → 67 taken 2 times.
✓ Branch 67 → 68 taken 2 times.
✗ Branch 67 → 80 not taken.
✓ Branch 68 → 69 taken 2 times.
✗ Branch 68 → 80 not taken.
|
2 | H.r3_after->SetTitle(Form("%s DC Region 3 (after) [survive = %.3f%%];edge (cm);counts", bendTitle.Data(), survive_pct)); |
| 712 | } | ||
| 713 | |||
| 714 |
2/4✓ Branch 72 → 73 taken 2 times.
✗ Branch 72 → 80 not taken.
✓ Branch 73 → 74 taken 2 times.
✗ Branch 73 → 80 not taken.
|
2 | SaveAndDisposeCanvas(c, Form("%s_dc_%s_2x3.png", m_base.Data(), bend)); |
| 715 | 2 | } | |
| 716 | |||
| 717 | 1 | void FiducialFilterPass2Validator::Stop() | |
| 718 | { | ||
| 719 | // PCAL canvases | ||
| 720 | 1 | DrawCalCanvas(11, "PCAL lv & lw (Electrons): before solid, after dashed"); | |
| 721 | 1 | DrawCalCanvas(22, "PCAL lv & lw (Photons): before solid, after dashed"); | |
| 722 | |||
| 723 | // FT 2x2 | ||
| 724 | 1 | DrawFTCanvas2x2(); | |
| 725 | |||
| 726 | // CVT 1x2 (combined hadrons) with survive % | ||
| 727 | 1 | DrawCVTCanvas1x2("CVT layer 12 (Hadrons): phi vs theta"); | |
| 728 | |||
| 729 | // Torus labels for DC summaries | ||
| 730 | 1 | bool electron_out = (m_torus_out_events >= m_torus_in_events); | |
| 731 |
1/2✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 8 not taken.
|
1 | char const* pos_bend_id = electron_out ? "inb" : "out"; |
| 732 |
1/2✓ Branch 8 → 9 taken 1 time.
✗ Branch 8 → 10 not taken.
|
1 | char const* neg_bend_id = electron_out ? "out" : "inb"; |
| 733 | |||
| 734 | // DC canvases | ||
| 735 | 1 | double pos_pct = | |
| 736 |
1/2✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 12 not taken.
|
1 | (m_dc_pos_before_n > 0) ? (100.0 * double(m_dc_pos_after_n) / double(m_dc_pos_before_n)) : 0.0; |
| 737 | 1 | double neg_pct = | |
| 738 |
1/2✓ Branch 12 → 13 taken 1 time.
✗ Branch 12 → 14 not taken.
|
1 | (m_dc_neg_before_n > 0) ? (100.0 * double(m_dc_neg_after_n) / double(m_dc_neg_before_n)) : 0.0; |
| 739 | 1 | DrawDCCanvas2x3(m_dc_pos, pos_bend_id, pos_pct); | |
| 740 | 1 | DrawDCCanvas2x3(m_dc_neg, neg_bend_id, neg_pct); | |
| 741 | |||
| 742 | // write all histograms into the ROOT file | ||
| 743 |
1/2✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 52 not taken.
|
1 | if(m_out) { |
| 744 | 1 | m_out->cd(); | |
| 745 | |||
| 746 | 66 | auto write_obj = [&](TObject* o) { if (o) o->Write(); }; | |
| 747 | |||
| 748 | // PCAL (per PID, per sector) | ||
| 749 |
2/2✓ Branch 30 → 31 taken 2 times.
✓ Branch 30 → 32 taken 1 time.
|
3 | for(auto& kv : m_cal) { |
| 750 | auto& sectors = kv.second; | ||
| 751 |
2/2✓ Branch 28 → 19 taken 12 times.
✓ Branch 28 → 29 taken 2 times.
|
14 | for(int s = 1; s <= 6; ++s) { |
| 752 | 12 | auto& H = sectors[s]; | |
| 753 |
1/2✓ Branch 19 → 20 taken 12 times.
✗ Branch 19 → 21 not taken.
|
12 | write_obj(H.lv_before); |
| 754 |
1/2✓ Branch 21 → 22 taken 12 times.
✗ Branch 21 → 23 not taken.
|
12 | write_obj(H.lv_after); |
| 755 |
1/2✓ Branch 23 → 24 taken 12 times.
✗ Branch 23 → 25 not taken.
|
12 | write_obj(H.lw_before); |
| 756 |
1/2✓ Branch 25 → 26 taken 12 times.
✗ Branch 25 → 27 not taken.
|
12 | write_obj(H.lw_after); |
| 757 | } | ||
| 758 | } | ||
| 759 | |||
| 760 | // FT | ||
| 761 |
2/2✓ Branch 38 → 33 taken 2 times.
✓ Branch 38 → 39 taken 1 time.
|
3 | for(auto& kv : m_ft_h) { |
| 762 |
1/2✓ Branch 33 → 34 taken 2 times.
✗ Branch 33 → 35 not taken.
|
2 | write_obj(kv.second.before); |
| 763 |
1/2✓ Branch 35 → 36 taken 2 times.
✗ Branch 35 → 37 not taken.
|
2 | write_obj(kv.second.after); |
| 764 | } | ||
| 765 | |||
| 766 | // CVT | ||
| 767 |
1/2✓ Branch 39 → 40 taken 1 time.
✗ Branch 39 → 41 not taken.
|
1 | write_obj(m_cvt_before); |
| 768 |
1/2✓ Branch 41 → 42 taken 1 time.
✗ Branch 41 → 43 not taken.
|
1 | write_obj(m_cvt_after); |
| 769 | |||
| 770 | // DC | ||
| 771 | 2 | auto write_dc = [&](DCHists const& H) { | |
| 772 |
1/2✓ Branch 2 → 3 taken 2 times.
✗ Branch 2 → 4 not taken.
|
2 | write_obj(H.r1_before); |
| 773 |
1/2✓ Branch 4 → 5 taken 2 times.
✗ Branch 4 → 6 not taken.
|
2 | write_obj(H.r1_after); |
| 774 |
1/2✓ Branch 6 → 7 taken 2 times.
✗ Branch 6 → 8 not taken.
|
2 | write_obj(H.r2_before); |
| 775 |
1/2✓ Branch 8 → 9 taken 2 times.
✗ Branch 8 → 10 not taken.
|
2 | write_obj(H.r2_after); |
| 776 |
1/2✓ Branch 10 → 11 taken 2 times.
✗ Branch 10 → 12 not taken.
|
2 | write_obj(H.r3_before); |
| 777 |
1/2✓ Branch 12 → 13 taken 2 times.
✗ Branch 12 → 14 not taken.
|
2 | write_obj(H.r3_after); |
| 778 | 2 | }; | |
| 779 | 1 | write_dc(m_dc_pos); | |
| 780 | 1 | write_dc(m_dc_neg); | |
| 781 | |||
| 782 | 1 | m_out->Write(); | |
| 783 | 1 | m_log->Info("Wrote output file {}", m_out->GetName()); | |
| 784 | 1 | m_out->Close(); | |
| 785 |
1/2✓ Branch 49 → 50 taken 1 time.
✗ Branch 49 → 51 not taken.
|
1 | delete m_out; |
| 786 | 1 | m_out = nullptr; | |
| 787 | } | ||
| 788 | |||
| 789 | // explicitly delete all booked histograms | ||
| 790 |
12/24✓ Branch 5 → 6 taken 2 times.
✗ Branch 5 → 8 not taken.
✓ Branch 8 → 9 taken 2 times.
✗ Branch 8 → 11 not taken.
✓ Branch 11 → 12 taken 2 times.
✗ Branch 11 → 14 not taken.
✓ Branch 14 → 15 taken 2 times.
✗ Branch 14 → 17 not taken.
✓ Branch 17 → 18 taken 2 times.
✗ Branch 17 → 20 not taken.
✓ Branch 56 → 57 taken 12 times.
✗ Branch 56 → 59 not taken.
✓ Branch 59 → 60 taken 12 times.
✗ Branch 59 → 62 not taken.
✓ Branch 62 → 63 taken 12 times.
✗ Branch 62 → 65 not taken.
✓ Branch 72 → 73 taken 2 times.
✗ Branch 72 → 75 not taken.
✓ Branch 75 → 76 taken 2 times.
✗ Branch 75 → 78 not taken.
✓ Branch 81 → 82 taken 1 time.
✗ Branch 81 → 84 not taken.
✓ Branch 84 → 85 taken 1 time.
✗ Branch 84 → 87 not taken.
|
17 | auto zap = [&](auto*& p) { if (p) { delete p; p = nullptr; } }; |
| 791 | |||
| 792 | // PCAL | ||
| 793 |
2/2✓ Branch 68 → 69 taken 2 times.
✓ Branch 68 → 70 taken 1 time.
|
3 | for(auto& kv : m_cal) { |
| 794 | auto& sectors = kv.second; | ||
| 795 |
2/2✓ Branch 66 → 53 taken 12 times.
✓ Branch 66 → 67 taken 2 times.
|
14 | for(int s = 1; s <= 6; ++s) { |
| 796 |
1/2✓ Branch 53 → 54 taken 12 times.
✗ Branch 53 → 56 not taken.
|
12 | auto& H = sectors[s]; |
| 797 | zap(H.lv_before); | ||
| 798 | zap(H.lv_after); | ||
| 799 | zap(H.lw_before); | ||
| 800 | zap(H.lw_after); | ||
| 801 | } | ||
| 802 | } | ||
| 803 | m_cal.clear(); | ||
| 804 | |||
| 805 | // FT | ||
| 806 |
2/2✓ Branch 79 → 72 taken 2 times.
✓ Branch 79 → 80 taken 1 time.
|
3 | for(auto& kv : m_ft_h) { |
| 807 | zap(kv.second.before); | ||
| 808 | zap(kv.second.after); | ||
| 809 | } | ||
| 810 | m_ft_h.clear(); | ||
| 811 | |||
| 812 | // CVT | ||
| 813 | zap(m_cvt_before); | ||
| 814 | zap(m_cvt_after); | ||
| 815 | |||
| 816 | // DC | ||
| 817 |
1/2✓ Branch 2 → 3 taken 2 times.
✗ Branch 2 → 5 not taken.
|
2 | auto zap_dc = [&](DCHists& H) { |
| 818 | zap(H.r1_before); | ||
| 819 | zap(H.r1_after); | ||
| 820 | zap(H.r2_before); | ||
| 821 | zap(H.r2_after); | ||
| 822 | zap(H.r3_before); | ||
| 823 | zap(H.r3_after); | ||
| 824 | 2 | }; | |
| 825 | 1 | zap_dc(m_dc_pos); | |
| 826 | 1 | zap_dc(m_dc_neg); | |
| 827 | |||
| 828 | // ensure no canvases linger globally | ||
| 829 |
2/4✓ Branch 90 → 91 taken 1 time.
✗ Branch 90 → 95 not taken.
✓ Branch 92 → 93 taken 1 time.
✗ Branch 92 → 95 not taken.
|
1 | if(gROOT && gROOT->GetListOfCanvases()) |
| 830 | 1 | gROOT->GetListOfCanvases()->Delete(); | |
| 831 | 1 | } | |
| 832 | |||
| 833 | } | ||
| 834 |