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