| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "iguana/algorithms/Algorithm.h" | ||
| 4 | #include "iguana/services/ConcurrentParam.h" | ||
| 5 | |||
| 6 | namespace iguana::clas12 { | ||
| 7 | |||
| 8 | /// @algo_brief{Filter a particle bank by cutting on Z Vertex} | ||
| 9 | /// @algo_type_filter | ||
| 10 | /// | ||
| 11 | /// @begin_doc_config{clas12/ZVertexFilter} | ||
| 12 | /// @config_param{electron_vz | list[double] | lower and upper electron @f$z@f$-vertex cuts; run-range dependent; cuts are not applied to FT electrons (FD and CD only)} | ||
| 13 | /// @end_doc | ||
| 14 | class ZVertexFilter : public Algorithm | ||
| 15 | { | ||
| 16 | |||
| 17 |
7/18iguana::clas12::ZVertexFilter::~ZVertexFilter():
✓ Branch 2 → 3 taken 8 times.
✗ Branch 2 → 5 not taken.
iguana::clas12::ZVertexFilter::ZVertexFilter(std::basic_string_view<char, std::char_traits<char> >):
✓ Branch 2 → 3 taken 8 times.
✗ Branch 2 → 6 not taken.
✗ Branch 5 → 7 not taken.
✓ Branch 5 → 8 taken 8 times.
✓ Branch 9 → 10 taken 8 times.
✗ Branch 9 → 32 not taken.
✓ Branch 10 → 11 taken 8 times.
✗ Branch 10 → 17 not taken.
✓ Branch 17 → 18 taken 8 times.
✗ Branch 17 → 40 not taken.
✓ Branch 24 → 25 taken 8 times.
✗ Branch 24 → 40 not taken.
✗ Branch 32 → 33 not taken.
✗ Branch 32 → 39 not taken.
✗ Branch 40 → 41 not taken.
✗ Branch 40 → 43 not taken.
|
74 | DEFINE_IGUANA_ALGORITHM(ZVertexFilter, clas12::ZVertexFilter) |
| 18 | |||
| 19 | public: | ||
| 20 | |||
| 21 | void Start(hipo::banklist& banks) override; | ||
| 22 | bool Run(hipo::banklist& banks) const override; | ||
| 23 | void Stop() override; | ||
| 24 | |||
| 25 | /// @run_function | ||
| 26 | /// @param [in,out] particleBank particle bank (_e.g._, `REC::Particle`), which will be filtered | ||
| 27 | /// @param [in] configBank `RUN::config` | ||
| 28 | /// @returns `false` if all particles are filtered out | ||
| 29 | bool Run(hipo::bank& particleBank, hipo::bank const& configBank) const; | ||
| 30 | |||
| 31 | /// @action_function{reload} prepare the event | ||
| 32 | /// @when_to_call{for each event} | ||
| 33 | /// @param runnum the run number | ||
| 34 | /// @returns the key to be used in `::Filter` | ||
| 35 | concurrent_key_t PrepareEvent(int const runnum) const; | ||
| 36 | |||
| 37 | /// @action_function{scalar filter} checks if the Z Vertex is within specified bounds if pid is one for which the filter should be applied to.; | ||
| 38 | /// Cuts applied to particles in FD or CD (ie not in FT). | ||
| 39 | /// @when_to_call{for each particle} | ||
| 40 | /// @param zvertex the particle Z Vertex to check | ||
| 41 | /// @param pid the particle pid | ||
| 42 | /// @param status particle status used to check particle is not in FT | ||
| 43 | /// @param key the return value of `::PrepareEvent` | ||
| 44 | /// @returns `true` if `zvertex` is within specified bounds | ||
| 45 | bool Filter(double const zvertex, int const pid, int const status, concurrent_key_t const key) const; | ||
| 46 | |||
| 47 | /// @param key the return value of `::PrepareEvent` | ||
| 48 | /// @returns the current run number | ||
| 49 | int GetRunNum(concurrent_key_t const key) const; | ||
| 50 | |||
| 51 | /// @param key the return value of `::PrepareEvent` | ||
| 52 | /// @returns the current z-vertex cuts | ||
| 53 | std::vector<double> GetElectronZcuts(concurrent_key_t const key) const; | ||
| 54 | |||
| 55 | /// @brief sets the z-vertex cuts | ||
| 56 | /// @warning this method is not thread safe; instead, for thread safety, | ||
| 57 | /// use `::PrepareEvent` and a custom configuration file. | ||
| 58 | /// @param zcut_lower the lower bound of the cut | ||
| 59 | /// @param zcut_upper the upper bound of the cut | ||
| 60 | /// @param key the, for `::GetElectronZcuts` | ||
| 61 | void SetElectronZcuts(double zcut_lower, double zcut_upper, concurrent_key_t const key); | ||
| 62 | |||
| 63 | private: | ||
| 64 | hipo::banklist::size_type b_particle, b_config; | ||
| 65 | |||
| 66 | // Reload function | ||
| 67 | void Reload(int const runnum, concurrent_key_t key) const; | ||
| 68 | |||
| 69 | /// Particle bank name | ||
| 70 | std::string o_particle_bank; | ||
| 71 | |||
| 72 | /// Run number | ||
| 73 | mutable std::unique_ptr<ConcurrentParam<int>> o_runnum; | ||
| 74 | |||
| 75 | /// Electron Z-vertex cuts | ||
| 76 | mutable std::unique_ptr<ConcurrentParam<std::vector<double>>> o_electron_vz_cuts; | ||
| 77 | }; | ||
| 78 | |||
| 79 | } | ||
| 80 |