9#include <generators/modules/InclusiveParticleCheckerModule.h>
10#include <framework/core/ModuleParam.templateDetails.h>
11#include <framework/particledb/EvtGenDatabasePDG.h>
19 class GetPDGCode:
public boost::static_visitor<int> {
22 int operator()(
int i)
const
27 int operator()(
const std::string& i)
const
31 B2ERROR(
"Unknown particle name: " << i);
52Check for the existence of one or more inclusive particles in the list of
53generated particles. If any of the particles is found the event is accepted and
54the return value is set to True. Otherwise the return value is set to false.
56The particles to look for can either be given as numerical pdg codes or as
57particle names or even as a mix of both:
59>>> checker = path.add_module("InclusiveParticleChecker", particles = [11, "pi+"])
61Valid names are defined in the ``evt.pdl`` of evtgen and can be inspected using
62either the `pdg` module or ``b2help-particles``.
64This module is intended for inclusive signal generation where we run a
65generator which produces generic events and we require a certain particle to be
66present in the resulting list of particles.
71 "If any of those is found in the event the event is accepted");
73 "particles or their charge conjugates",
true);
80 int pdg = boost::apply_visitor(GetPDGCode(), p);
90 B2INFO(
"Accepting events which contain one of the following particles:");
static EvtGenDatabasePDG * Instance()
Instance method that loads the EvtGen table.
InclusiveParticleCheckerModule()
Constructor: Sets the description, the properties and the parameters of the module.
virtual void initialize() override
Register input and output data.
virtual void event() override
Look for the particle and set the return type.
bool m_includeConjugates
If true require either the particle or its charge conjugate.
std::vector< boost::variant< std::string, int > > m_particles
Name or PDG string of the particle to look for.
StoreArray< MCParticle > m_mcParticles
List of generated particles.
std::set< int > m_particleCodes
Set of PDG codes to look for.
A Class to store the Monte Carlo particle information.
void setDescription(const std::string &description)
Sets the description of the module.
void setReturnValue(int value)
Sets the return value for this module as integer.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.