| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "iguana/algorithms/TypeDefs.h" // (PDG names/titles if you want to expand later) | ||
| 4 | #include "iguana/algorithms/Validator.h" | ||
| 5 | |||
| 6 | #include <TFile.h> | ||
| 7 | #include <TH1.h> | ||
| 8 | #include <TH2.h> | ||
| 9 | |||
| 10 | #include <array> | ||
| 11 | #include <memory> | ||
| 12 | #include <mutex> | ||
| 13 | #include <unordered_map> | ||
| 14 | #include <vector> | ||
| 15 | |||
| 16 | namespace iguana::clas12::rga { | ||
| 17 | |||
| 18 | /// @brief `iguana::clas12::rga::FiducialFilterPass2` validator | ||
| 19 | class FiducialFilterPass2Validator : public Validator | ||
| 20 | { | ||
| 21 |
7/16✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 6 not taken.
✗ Branch 5 → 7 not taken.
✓ Branch 5 → 8 taken 1 time.
✓ Branch 9 → 10 taken 1 time.
✗ Branch 9 → 33 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 17 not taken.
✓ Branch 17 → 18 taken 1 time.
✗ Branch 17 → 43 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 41 not taken.
✓ Branch 25 → 26 taken 1 time.
✗ Branch 25 → 41 not taken.
✗ Branch 33 → 34 not taken.
✗ Branch 33 → 40 not taken.
|
10 | DEFINE_IGUANA_VALIDATOR(FiducialFilterPass2Validator, clas12::rga::FiducialFilterPass2Validator) |
| 22 | |||
| 23 | public: | ||
| 24 | void Start(hipo::banklist& banks) override; | ||
| 25 | bool Run(hipo::banklist& banks) const override; | ||
| 26 | void Stop() override; | ||
| 27 | |||
| 28 | private: | ||
| 29 | // banks | ||
| 30 | hipo::banklist::size_type b_particle{}; | ||
| 31 | hipo::banklist::size_type b_calor{}; | ||
| 32 | hipo::banklist::size_type b_ft{}; | ||
| 33 | hipo::banklist::size_type b_traj{}; | ||
| 34 | hipo::banklist::size_type b_config{}; | ||
| 35 | bool m_have_calor = false; | ||
| 36 | bool m_have_ft = false; | ||
| 37 | bool m_have_traj = false; | ||
| 38 | |||
| 39 | // ust run the algorithm via AlgorithmSequence | ||
| 40 | std::unique_ptr<AlgorithmSequence> m_algo_seq; | ||
| 41 | |||
| 42 | // Small PID set to visualize specially | ||
| 43 | std::array<int, 2> const kPIDs{11, 22}; // electrons, photons | ||
| 44 | |||
| 45 | // Histograms | ||
| 46 | // PCAL hists per PID & sector (BEFORE/AFTER) | ||
| 47 | struct SecHists { | ||
| 48 | TH1D* lv_before = nullptr; | ||
| 49 | TH1D* lv_after = nullptr; | ||
| 50 | TH1D* lw_before = nullptr; | ||
| 51 | TH1D* lw_after = nullptr; | ||
| 52 | }; | ||
| 53 | using PerPIDCal = std::array<SecHists, 7>; // sectors 1..6 | ||
| 54 | std::unordered_map<int, PerPIDCal> m_cal; | ||
| 55 | |||
| 56 | // Counts for survival % (unique pindex per sector) | ||
| 57 | struct SecCounts { | ||
| 58 | long long before = 0, after = 0; | ||
| 59 | }; | ||
| 60 | using PerPIDCalCounts = std::array<SecCounts, 7>; | ||
| 61 | std::unordered_map<int, PerPIDCalCounts> m_cal_counts; | ||
| 62 | |||
| 63 | // FT XY before/after per PID | ||
| 64 | struct FTHists { | ||
| 65 | TH2F* before = nullptr; | ||
| 66 | TH2F* after = nullptr; | ||
| 67 | }; | ||
| 68 | std::unordered_map<int, FTHists> m_ft_h; | ||
| 69 | std::unordered_map<int, long long> m_ft_before_n, m_ft_after_n; // unique pindex counts | ||
| 70 | |||
| 71 | // CVT (layer 12) phi vs theta (combined hadrons) before/after | ||
| 72 | TH2F* m_cvt_before = nullptr; | ||
| 73 | TH2F* m_cvt_after = nullptr; | ||
| 74 | long long m_cvt_before_n = 0; | ||
| 75 | long long m_cvt_after_n = 0; | ||
| 76 | |||
| 77 | // DC edge distributions by sign (pos/neg), regions 1,2,3; before/after | ||
| 78 | struct DCHists { | ||
| 79 | TH1D* r1_before = nullptr; | ||
| 80 | TH1D* r2_before = nullptr; | ||
| 81 | TH1D* r3_before = nullptr; | ||
| 82 | TH1D* r1_after = nullptr; | ||
| 83 | TH1D* r2_after = nullptr; | ||
| 84 | TH1D* r3_after = nullptr; | ||
| 85 | }; | ||
| 86 | DCHists m_dc_pos{}, m_dc_neg{}; | ||
| 87 | long long m_dc_pos_before_n = 0, m_dc_pos_after_n = 0; | ||
| 88 | long long m_dc_neg_before_n = 0, m_dc_neg_after_n = 0; | ||
| 89 | |||
| 90 | // Torus polarity counters (for DC labelling only) | ||
| 91 | long long m_torus_in_events = 0; | ||
| 92 | long long m_torus_out_events = 0; | ||
| 93 | |||
| 94 | // Output | ||
| 95 | TString m_base; | ||
| 96 | TFile* m_out = nullptr; | ||
| 97 | |||
| 98 | // Helpers | ||
| 99 | void BookIfNeeded(); | ||
| 100 | void DrawCalCanvas(int pid, char const* title); | ||
| 101 | void DrawFTCanvas2x2(); | ||
| 102 | void DrawCVTCanvas1x2(char const* title); | ||
| 103 | void DrawDCCanvas2x3(DCHists const& H, char const* bend, double survive_pct); | ||
| 104 | |||
| 105 | mutable std::mutex m_mutex{}; | ||
| 106 | }; | ||
| 107 | |||
| 108 | } | ||
| 109 |