Line | Branch | Exec | Source |
---|---|---|---|
1 | #pragma once | ||
2 | |||
3 | #include "iguana/algorithms/Algorithm.h" | ||
4 | |||
5 | namespace iguana::clas12 { | ||
6 | |||
7 | /// @brief_algo Filter the `REC::Particle` bank by applying DC (drift chamber) and ECAL (electromagnetic calorimeter) fiducial cuts | ||
8 | /// | ||
9 | /// Currently these are the "legacy" Pass 1 fiducial cuts tuned for Run Group A. | ||
10 | /// | ||
11 | /// @begin_doc_algo{clas12::FiducialFilter | Filter} | ||
12 | /// @input_banks{REC::Particle, RUN::config, and others (see below)} | ||
13 | /// @output_banks{REC::Particle} | ||
14 | /// @end_doc | ||
15 | /// | ||
16 | /// The following **additional banks** are needed: | ||
17 | /// - if configuration option `pass` is `1`: | ||
18 | /// - `REC::Particle::Traj`, created by algorithm `iguana::clas12::TrajLinker` | ||
19 | /// - `REC::Particle::Calorimeter`, created by algorithm `iguana::clas12::CalorimeterLinker` | ||
20 | /// | ||
21 | /// @begin_doc_config{clas12/FiducialFilter} | ||
22 | /// @config_param{pass | int | cook type to use for assigning fiducial cuts} | ||
23 | /// @config_param{pcal_electron_cut_level | string | cut level for PCAL homogeneous cuts for electrons and positrons, one of: loose, medium, tight} | ||
24 | /// @config_param{pcal_photon_cut_level | string | cut level for PCAL homogeneous cuts for photons, one of: loose, medium, tight} | ||
25 | /// @config_param{enable_pcal_cuts | int | enable (1) or disable (0) PCAL cuts } | ||
26 | /// @config_param{enable_dc_cuts | int | enable (1) or disable (0) DC cuts } | ||
27 | /// @end_doc | ||
28 | class FiducialFilter : public Algorithm | ||
29 | { | ||
30 | |||
31 |
6/14✓ Branch 0 (2→3) taken 2 times.
✗ Branch 1 (2→6) not taken.
✗ Branch 2 (5→7) not taken.
✓ Branch 3 (5→8) taken 2 times.
✓ Branch 4 (9→10) taken 2 times.
✗ Branch 5 (9→32) not taken.
✓ Branch 6 (10→11) taken 2 times.
✗ Branch 7 (10→17) not taken.
✓ Branch 8 (17→18) taken 2 times.
✗ Branch 9 (17→40) not taken.
✓ Branch 10 (24→25) taken 2 times.
✗ Branch 11 (24→40) not taken.
✗ Branch 12 (32→33) not taken.
✗ Branch 13 (32→39) not taken.
|
15 | DEFINE_IGUANA_ALGORITHM(FiducialFilter, clas12::FiducialFilter) |
32 | |||
33 | public: | ||
34 | |||
35 | /// cut levels, currently only used for PCAL cuts | ||
36 | enum CutLevel { | ||
37 | loose, | ||
38 | medium, | ||
39 | tight | ||
40 | }; | ||
41 | |||
42 | void Start(hipo::banklist& banks) override; | ||
43 | void Run(hipo::banklist& banks) const override; | ||
44 | void Stop() override; | ||
45 | |||
46 | /// @action_function{scalar filter} top-level fiducial cut for RG-A Pass 1 | ||
47 | /// @param pcal_sector PCAL sector | ||
48 | /// @param pcal_lv PCAL lv | ||
49 | /// @param pcal_lw PCAL lw | ||
50 | /// @param pcal_found if PCAL info exists for this particle, this should be true | ||
51 | /// @param dc_sector DC sector | ||
52 | /// @param dc_r1_x DC region 1 x | ||
53 | /// @param dc_r1_y DC region 1 y | ||
54 | /// @param dc_r1_z DC region 1 z | ||
55 | /// @param dc_r1_found if DC region 1 info exists for this particle, this should be true | ||
56 | /// @param dc_r2_x DC region 2 x | ||
57 | /// @param dc_r2_y DC region 2 y | ||
58 | /// @param dc_r2_z DC region 2 z | ||
59 | /// @param dc_r2_found if DC region 2 info exists for this particle, this should be true | ||
60 | /// @param dc_r3_x DC region 3 x | ||
61 | /// @param dc_r3_y DC region 3 y | ||
62 | /// @param dc_r3_z DC region 3 z | ||
63 | /// @param dc_r3_found if DC region 3 info exists for this particle, this should be true | ||
64 | /// @param torus the torus magnetic field sign | ||
65 | /// @param pid the PDG of the particle | ||
66 | /// @returns `true` if passes fiducial cuts | ||
67 | bool FilterRgaPass1( | ||
68 | int const pcal_sector, | ||
69 | float const pcal_lv, | ||
70 | float const pcal_lw, | ||
71 | bool const pcal_found, | ||
72 | int const dc_sector, | ||
73 | float const dc_r1_x, | ||
74 | float const dc_r1_y, | ||
75 | float const dc_r1_z, | ||
76 | bool const dc_r1_found, | ||
77 | float const dc_r2_x, | ||
78 | float const dc_r2_y, | ||
79 | float const dc_r2_z, | ||
80 | bool const dc_r2_found, | ||
81 | float const dc_r3_x, | ||
82 | float const dc_r3_y, | ||
83 | float const dc_r3_z, | ||
84 | bool const dc_r3_found, | ||
85 | float const torus, | ||
86 | int const pid) const; | ||
87 | |||
88 | /// @action_function{scalar filter} EC hit position homogeneous cut on lv and lw | ||
89 | /// @param pcal_sector PCAL sector | ||
90 | /// @param lv PCAL lv | ||
91 | /// @param lw PCAL lw | ||
92 | /// @param torus the torus magnetic field sign | ||
93 | /// @param pid the PDG of the particle | ||
94 | bool FilterPcalHomogeneous( | ||
95 | int const pcal_sector, | ||
96 | float const lv, | ||
97 | float const lw, | ||
98 | float const torus, | ||
99 | int const pid) const; | ||
100 | |||
101 | /// @action_function{scalar filter} filter using DC XY fiducial cut | ||
102 | /// @param dc_sector DC sector | ||
103 | /// @param r1_x DC region 1 x | ||
104 | /// @param r1_y DC region 1 y | ||
105 | /// @param r1_z DC region 1 z | ||
106 | /// @param r2_x DC region 2 x | ||
107 | /// @param r2_y DC region 2 y | ||
108 | /// @param r2_z DC region 2 z | ||
109 | /// @param r3_x DC region 3 x | ||
110 | /// @param r3_y DC region 3 y | ||
111 | /// @param r3_z DC region 3 z | ||
112 | /// @param torus the torus magnetic field sign | ||
113 | /// @param pid the PDG of the particle | ||
114 | /// @returns `true` if passes fiducial cuts | ||
115 | bool FilterDcXY( | ||
116 | int const dc_sector, | ||
117 | float const r1_x, | ||
118 | float const r1_y, | ||
119 | float const r1_z, | ||
120 | float const r2_x, | ||
121 | float const r2_y, | ||
122 | float const r2_z, | ||
123 | float const r3_x, | ||
124 | float const r3_y, | ||
125 | float const r3_z, | ||
126 | float const torus, | ||
127 | int const pid) const; | ||
128 | |||
129 | /// @action_function{scalar filter} filter using DC theta-phi fiducial cut | ||
130 | /// @param dc_sector DC sector | ||
131 | /// @param r1_x DC region 1 x | ||
132 | /// @param r1_y DC region 1 y | ||
133 | /// @param r1_z DC region 1 z | ||
134 | /// @param r2_x DC region 2 x | ||
135 | /// @param r2_y DC region 2 y | ||
136 | /// @param r2_z DC region 2 z | ||
137 | /// @param r3_x DC region 3 x | ||
138 | /// @param r3_y DC region 3 y | ||
139 | /// @param r3_z DC region 3 z | ||
140 | /// @param torus the torus magnetic field sign | ||
141 | /// @param pid the PDG of the particle | ||
142 | /// @returns `true` if passes fiducial cuts | ||
143 | bool FilterDcThetaPhi( | ||
144 | int const dc_sector, | ||
145 | float const r1_x, | ||
146 | float const r1_y, | ||
147 | float const r1_z, | ||
148 | float const r2_x, | ||
149 | float const r2_y, | ||
150 | float const r2_z, | ||
151 | float const r3_x, | ||
152 | float const r3_y, | ||
153 | float const r3_z, | ||
154 | float const torus, | ||
155 | int const pid) const; | ||
156 | |||
157 | private: // methods | ||
158 | |||
159 | /// @param level the cut level string | ||
160 | /// @returns `CutLevel` associated to the input | ||
161 | CutLevel ParseCutLevel(std::string const& level) const; | ||
162 | |||
163 | private: // members | ||
164 | |||
165 | // `hipo::banklist` | ||
166 | hipo::banklist::size_type b_particle; | ||
167 | hipo::banklist::size_type b_traj; | ||
168 | hipo::banklist::size_type b_cal; | ||
169 | hipo::banklist::size_type b_config; | ||
170 | |||
171 | // options | ||
172 | int o_pass = 1; | ||
173 | CutLevel o_pcal_electron_cut_level; | ||
174 | CutLevel o_pcal_photon_cut_level; | ||
175 | bool o_enable_pcal_cuts; | ||
176 | bool o_enable_dc_cuts; | ||
177 | |||
178 | }; | ||
179 | |||
180 | } | ||
181 |