|
ATLAS Offline Software
|
Go to the documentation of this file.
9 using namespace TopEventSelectionTools;
12 SignValueSelector::SignValueSelector(
const std::string&
name, std::string
params,
bool multiplicityMode,
20 if (!multiplicityMode) cutValueMode =
false;
31 throw std::runtime_error(
"Cut value and multiplicity must be set for " +
name);
42 bool cutValueMode, std::string delim, std::string
replace,
43 std::string default_prefix) :
49 std::vector<std::string>
tokens;
64 ATH_MSG_INFO(
"SignValueSelector :: We are using a default_prefix as we could not split on a delimiter.");
77 <<
"As defined in " <<
name() <<
"\n");
78 throw std::runtime_error(
"Failed parsing value for SignValueSelector");
85 <<
"As defined in " <<
name() <<
"\n");
86 throw std::runtime_error(
"Failed parsing multiplicity cut for SignValueSelector");
113 if (
params.find(
"==") != std::string::npos) {
116 }
else if (
params.find(
"<=") != std::string::npos) {
119 }
else if (
params.find(
">=") != std::string::npos) {
122 }
else if (
params.find(
"<") != std::string::npos) {
125 }
else if (
params.find(
">") != std::string::npos) {
136 throw std::runtime_error(
"SignValueSelector::checkFloat: Can't recognise the sign");
140 throw std::runtime_error(
"SignValueSelector::checkFloat: Can't compare floats with ==");
162 throw std::runtime_error(
"SignValueSelector::checkInt: Can't recognise the sign");
188 <<
"Check that your cuts have one of: "
189 <<
"==, >, >=, <, <=\n");
190 throw std::runtime_error(
"SignValueSelector::signstring: Can't recognise the comparison operator");
std::string replace(std::string s, const std::string &s2, const std::string &s3)
SignValueSelector(const std::string &name, std::string params, bool multiplicityMode=false, bool cutValueMode=false)
Constructor for tools that need a sign and a value.
bool checkInt(int value, int cut) const
Compare a cut supplied by the user with the value calculated in the event.
Sign sign() const
Get the sign setup in the constructor.
TopConfig A simple configuration that is NOT a singleton.
double multiplicity() const
Get the cut multiplicity assigned in the constructor.
void tokenize(const std::string &input, Container &output, const std::string &delimiters=" ", bool trim_empty=false)
Tokenize an input string using a set of delimiters.
std::string m_name
Hold the name of the tool, filled by the constructor.
Sign m_sign
The sign of the cut, filled by the constructor.
Many of the tools need a sign (>=) and a value (2).
void checkValueIsInteger()
Integers are annoying in C++.
bool checkFloat(double value, double cut) const
Compare a cut supplied by the user with the value calculated in the event.
std::string valueString() const
Get the cut value assigned in the constructor.
double m_multiplicity
The multiplicity for cuts that take both a value and a multiplicity e.g. EL_N 25000 >= 2.
const std::string signstring() const
Convert the sign enum back to a string for use in the name and print outs.
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
void checkMultiplicityIsInteger()
Integers are annoying in C++.
double m_cutvalue
The value of the cut, filled by the constructor.
Sign decodesign(std::string ¶ms)
Take the string params, look for one of the allowed inequalities (or equality) and return that.
double value() const
Get the cut value assigned in the constructor.
Sign
Many of the tools will be supplied with an equality (or inequality) by the user.
std::string valueStringDelimReplace() const
valueString which is manipulated to replace delimiter with new string
std::string m_cutvalueString
The value of the cut in the case it's a string, filled by the constructor.
std::string m_cutvalueStringDelimReplace
The value of the cut when it is a string, with replacement of delimiter with a replacement substring.
virtual std::string name() const override
The name is generated in the constructor for this kind of tool.