Belle II Software development
|
This class implements a common way to implement cut/selection functionality for arbitrary objects. More...
#include <GeneralCut.h>
Public Member Functions | |
bool | check (const Object *p) const |
Check if the current cuts are passed by the given object. | |
void | print () const |
Print cut tree. | |
std::string | decompile () const |
Do the compilation from a string in return. | |
Static Public Member Functions | |
static std::unique_ptr< GeneralCut > | compile (const std::string &cut) |
Creates an instance of a cut and returns a unique_ptr to it, if you need a copy-able object instead you can cast it to a shared_ptr using std::shared_ptr<Variable::Cut>(Cut::compile(cutString)) | |
Private Types | |
typedef AVariableManager::Object | Object |
Object, that can be checked. This depends on the VariableManager, as the returned variables from the manager must calculate their values on pointers of these objects. | |
typedef AVariableManager::Var | Var |
Variable returned by the variable manager. | |
Private Member Functions | |
GeneralCut (Nodetuple tuple) | |
Constructor of the cut. | |
GeneralCut (const GeneralCut &)=delete | |
Delete Copy constructor. | |
GeneralCut & | operator= (const GeneralCut &)=delete |
Delete assign operator. | |
Private Attributes | |
std::unique_ptr< const AbstractBooleanNode< AVariableManager > > | m_root |
cut root node | |
This class implements a common way to implement cut/selection functionality for arbitrary objects.
Every module which wants to perform cuts should use this object. As a parameter the module requires a std::string with the written cut. This std::string has to be passed as an argument to the static Compile method of the Cut class, which returns a unique_ptr to the Cut object. Cuts can be performed via the check method.
Valid cuts can contain:
For example when using the analysis VariableManager for particles, valid cuts are: 1.2 < M < 1.5 daughter(0, M) < daughter(1, M) [M > 1.5 or M < 0.5] and 0.2 < getExtraInfo(SignalProbability) < 0.7
== and != conditions are evaluated not exactly because we deal with floating point values instead two floating point number are equal if their distance in their integral ordering is less than 3.
The general "Variable Manager" passed as a template argument to this class has to have some properties:
The best example for a VariableManager, that has all these parameters, is probably the analysis VariableManager with VariableManager::var equals to the analysis variable and the VariableManager::Object equal to a Particle. For a more slim example of a valid variable manager, see the generalCut.cc test, where a mock variable manager is created.
Definition at line 71 of file GeneralCut.h.
|
private |
Object, that can be checked. This depends on the VariableManager, as the returned variables from the manager must calculate their values on pointers of these objects.
Definition at line 73 of file GeneralCut.h.
|
private |
Variable returned by the variable manager.
Definition at line 75 of file GeneralCut.h.
|
inlineexplicitprivate |
Constructor of the cut.
Call init with given Nodetuple
tuple | (const boost::python::tuple&) constructed by the python parser from cut. |
Definition at line 132 of file GeneralCut.h.
|
inline |
Check if the current cuts are passed by the given object.
p | pointer to the object, that should be checked. All formerly received variables from the variable manager (from the type Var), are asked for their value using var->function(p). |
Definition at line 102 of file GeneralCut.h.
|
inlinestatic |
Creates an instance of a cut and returns a unique_ptr to it, if you need a copy-able object instead you can cast it to a shared_ptr using std::shared_ptr<Variable::Cut>(Cut::compile(cutString))
cut | the string defining the cut |
Definition at line 84 of file GeneralCut.h.
|
inline |
Do the compilation from a string in return.
In principle, compile(decompile()) should give the same result again.
Definition at line 119 of file GeneralCut.h.
|
inline |
|
private |
cut root node
Definition at line 144 of file GeneralCut.h.