ATLAS Offline Software
SignValueSelector.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 #ifndef SIGNVALUESELECTOR_H_
6 #define SIGNVALUESELECTOR_H_
7 
9 
10 namespace top {
17  public:
23  enum Sign {
24  signNOIDEA, //the user clearly did something wrong, expect to exit / crash
25  signEQ, // ==
26  signLT, // <
27  signGT, // >
28  signLTEQ, // <=
29  signGTEQ // >=
30  };
31 
48  SignValueSelector(const std::string& name, std::string params, bool multiplicityMode = false,
49  bool cutValueMode = false);
58  SignValueSelector(const std::string& name, std::string params, bool multiplicityMode, bool cutValueMode,
59  std::string delim, std::string replace, std::string default_prefix);
60 
64  virtual std::string name() const override;
65  protected:
71  void checkValueIsInteger();
72 
87 
91  Sign sign() const;
92 
96  double value() const;
97 
102  std::string valueString() const;
103 
104 
108  std::string valueStringDelimReplace() const;
109 
122  double multiplicity() const;
123 
135  Sign decodesign(std::string& params);
136 
146  bool checkFloat(double value, double cut) const;
147 
157  bool checkInt(int value, int cut) const;
158 
165  const std::string signstring() const;
166  private:
168  std::string m_name;
169 
172 
174  double m_cutvalue;
175 
177  std::string m_cutvalueString;
178 
181 
184  };
185 }
186 
187 #endif
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
top::SignValueSelector::SignValueSelector
SignValueSelector(const std::string &name, std::string params, bool multiplicityMode=false, bool cutValueMode=false)
Constructor for tools that need a sign and a value.
Definition: SignValueSelector.cxx:12
top::SignValueSelector::checkInt
bool checkInt(int value, int cut) const
Compare a cut supplied by the user with the value calculated in the event.
Definition: SignValueSelector.cxx:159
top::SignValueSelector::sign
Sign sign() const
Get the sign setup in the constructor.
Definition: SignValueSelector.cxx:90
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::SignValueSelector::multiplicity
double multiplicity() const
Get the cut multiplicity assigned in the constructor.
Definition: SignValueSelector.cxx:106
top::SignValueSelector::signLT
@ signLT
Definition: SignValueSelector.h:26
top::SignValueSelector::signGT
@ signGT
Definition: SignValueSelector.h:27
top::SignValueSelector::m_name
std::string m_name
Hold the name of the tool, filled by the constructor.
Definition: SignValueSelector.h:168
top::SignValueSelector::m_sign
Sign m_sign
The sign of the cut, filled by the constructor.
Definition: SignValueSelector.h:171
top::SignValueSelector
Many of the tools need a sign (>=) and a value (2).
Definition: SignValueSelector.h:16
top::SignValueSelector::checkValueIsInteger
void checkValueIsInteger()
Integers are annoying in C++.
Definition: SignValueSelector.cxx:74
top::SignValueSelector::checkFloat
bool checkFloat(double value, double cut) const
Compare a cut supplied by the user with the value calculated in the event.
Definition: SignValueSelector.cxx:133
top::SignValueSelector::valueString
std::string valueString() const
Get the cut value assigned in the constructor.
Definition: SignValueSelector.cxx:98
top::SignValueSelector::m_multiplicity
double m_multiplicity
The multiplicity for cuts that take both a value and a multiplicity e.g. EL_N 25000 >= 2.
Definition: SignValueSelector.h:180
top::SignValueSelector::signstring
const std::string signstring() const
Convert the sign enum back to a string for use in the name and print outs.
Definition: SignValueSelector.cxx:184
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
top::SignValueSelector::checkMultiplicityIsInteger
void checkMultiplicityIsInteger()
Integers are annoying in C++.
Definition: SignValueSelector.cxx:82
top::SignValueSelector::signNOIDEA
@ signNOIDEA
Definition: SignValueSelector.h:24
top::SignValueSelector::m_cutvalue
double m_cutvalue
The value of the cut, filled by the constructor.
Definition: SignValueSelector.h:174
top::EventSelectorBase
This should apply event-level cuts and perform simple plotting on top::Event objects.
Definition: EventSelectorBase.h:20
top::SignValueSelector::decodesign
Sign decodesign(std::string &params)
Take the string params, look for one of the allowed inequalities (or equality) and return that.
Definition: SignValueSelector.cxx:110
top::SignValueSelector::value
double value() const
Get the cut value assigned in the constructor.
Definition: SignValueSelector.cxx:94
top::SignValueSelector::signGTEQ
@ signGTEQ
Definition: SignValueSelector.h:29
top::SignValueSelector::Sign
Sign
Many of the tools will be supplied with an equality (or inequality) by the user.
Definition: SignValueSelector.h:23
top::SignValueSelector::signLTEQ
@ signLTEQ
Definition: SignValueSelector.h:28
EventSelectorBase.h
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
top::SignValueSelector::valueStringDelimReplace
std::string valueStringDelimReplace() const
valueString which is manipulated to replace delimiter with new string
Definition: SignValueSelector.cxx:102
top::SignValueSelector::signEQ
@ signEQ
Definition: SignValueSelector.h:25
top::SignValueSelector::m_cutvalueString
std::string m_cutvalueString
The value of the cut in the case it's a string, filled by the constructor.
Definition: SignValueSelector.h:177
top::SignValueSelector::m_cutvalueStringDelimReplace
std::string m_cutvalueStringDelimReplace
The value of the cut when it is a string, with replacement of delimiter with a replacement substring.
Definition: SignValueSelector.h:183
top::SignValueSelector::name
virtual std::string name() const override
The name is generated in the constructor for this kind of tool.
Definition: SignValueSelector.cxx:70