R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
NeulandParticleFilter.h
Go to the documentation of this file.
1#pragma once
2#include "R3BNeulandPoint.h"
3#include <R3BPDGConverter.h>
4#include <cstdint>
5#include <string>
6#include <unordered_map>
7#include <utility>
8#include <vector>
9
10namespace R3B::Neuland
11{
13 {
14 public:
26 enum class Mode : uint8_t
27 {
31 };
32
43 struct Options
44 {
46 double global_min_energy = 0.;
47 double global_max_energy = 0.;
48 std::vector<std::string> particle_names;
49 std::vector<double> energy_range_mins;
50 std::vector<double> energy_range_maxs;
51 };
52
56 ParticleFilter() = default;
57
63 explicit ParticleFilter(Mode mode)
64 : mode_{ mode }
65 {
66 }
67
75 static auto Create(const Options& options) -> ParticleFilter;
76
90 void AddParticle(const std::string& particle_name, double min_energy = 0., double max_energy = 0.);
91
98 void SetMinEnergy(double energy) { minimum_allowed_energy_ = energy; }
99
106 void SetMaxEnergy(double energy) { maximum_allowed_energy_ = energy; }
107
111 void SetMode(Mode mode) { mode_ = mode; }
112
118 [[nodiscard]] auto GetMinEnergy() const -> double { return minimum_allowed_energy_; }
119
125 [[nodiscard]] auto GetMaxEnergy() const -> double { return maximum_allowed_energy_; }
126
132 [[nodiscard]] auto GetMode() const -> Mode { return mode_; }
133
140 auto IsPointAllowed(const R3BNeulandPoint& neuland_point) -> bool;
141
147 void Reset();
148
155 auto Print() -> std::string;
156
157 // void SetFilter(R3B::Neuland::BitSetParticle filtered_particles);
158 // void SetFilter(R3B::Neuland::BitSetParticle filtered_particles, double minimum_allowed_energy);
159 // [[nodiscard]] auto GetFilter() const -> R3B::Neuland::BitSetParticle { return filtered_particles_; }
160
161 private:
165 std::unordered_map<int32_t, std::pair<double, double>> list_;
167 // R3B::Neuland::BitSetParticle filtered_particles_ = R3B::Neuland::BitSetParticle::none;
168 auto is_allowed_with_whitelist(const R3BNeulandPoint& neuland_point) -> bool;
169 auto is_allowed_with_blacklist(const R3BNeulandPoint& neuland_point) -> bool;
170 };
171
172} // namespace R3B::Neuland
double maximum_allowed_energy_
global maximum engergy in GeV
auto GetMaxEnergy() const -> double
Get the global max energy threshold.
ParticleFilter()=default
Default constructor.
auto IsPointAllowed(const R3BNeulandPoint &neuland_point) -> bool
Check if the neuland point is allowed.
auto Print() -> std::string
Print the configuration of the current filter.
ParticleFilter(Mode mode)
constructor with mode
auto is_allowed_with_whitelist(const R3BNeulandPoint &neuland_point) -> bool
void SetMinEnergy(double energy)
Set the global energy range with a minimum value.
static auto Create(const Options &options) -> ParticleFilter
Generator for the filter object from the configuration.
void SetMode(Mode mode)
Set the mode of the fileter.
std::unordered_map< int32_t, std::pair< double, double > > list_
Whitelist with min energy values [GeV].
Mode
A enum class for the point filtering mode.
void AddParticle(const std::string &particle_name, double min_energy=0., double max_energy=0.)
Add particle to the list.
double minimum_allowed_energy_
global minimum engergy in GeV
auto is_allowed_with_blacklist(const R3BNeulandPoint &neuland_point) -> bool
auto GetMode() const -> Mode
Get the mode of the filter.
void SetMaxEnergy(double energy)
Set the global energy range with a maximum value.
auto GetMinEnergy() const -> double
Get the global minimum energy threshold.
Simulation of NeuLAND Bar/Paddle.
AnalysisApplication::Options Options
Option structure to create a filter.