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