CMS 3D CMS Logo

StringObjectFunction.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_StringObjectFunction_h
2 #define CommonTools_Utils_StringObjectFunction_h
3 /* \class StringCutObjectSelector
4  *
5  * \author Luca Lista, INFN
6  *
7  * $Id: StringObjectFunction.h,v 1.4 2012/06/26 21:09:37 wmtan Exp $
8  */
14 
15 template <typename T, bool DefaultLazyness = false>
17  StringObjectFunction(const std::string &expr, bool lazy = DefaultLazyness) : type_(typeid(T)) {
18  if (!reco::parser::expressionParser<T>(expr, expr_, lazy)) {
19  throw edm::Exception(edm::errors::Configuration, "failed to parse \"" + expr + "\"");
20  }
21  }
23  double operator()(const T &t) const {
24  edm::ObjectWithDict o(type_, const_cast<T *>(&t));
25  return expr_->value(o);
26  }
27 
28 private:
31 };
32 
33 template <typename Object>
35 public:
38 
39  bool operator()(const Object *o1, const Object *o2) { return (*f_)(*o1) > (*f_)(*o2); }
40 
41 private:
43 };
44 
45 #endif
StringObjectFunction::operator()
double operator()(const T &t) const
Definition: StringObjectFunction.h:23
StringObjectFunction
Definition: StringObjectFunction.h:16
sortByStringFunction::operator()
bool operator()(const Object *o1, const Object *o2)
Definition: StringObjectFunction.h:39
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
edm::ObjectWithDict
Definition: ObjectWithDict.h:17
ExpressionBase.h
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
sortByStringFunction::~sortByStringFunction
~sortByStringFunction()
Definition: StringObjectFunction.h:37
ObjectWithDict.h
EDMException.h
StringObjectFunction::type_
edm::TypeWithDict type_
Definition: StringObjectFunction.h:30
sortByStringFunction
Definition: StringObjectFunction.h:34
CastorDigiReco.o1
o1
Definition: CastorDigiReco.py:84
sortByStringFunction::sortByStringFunction
sortByStringFunction(StringObjectFunction< Object > *f)
Definition: StringObjectFunction.h:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::TypeWithDict
Definition: TypeWithDict.h:38
StringObjectFunction::StringObjectFunction
StringObjectFunction(const reco::parser::ExpressionPtr &expr)
Definition: StringObjectFunction.h:22
sortByStringFunction::f_
StringObjectFunction< Object > * f_
Definition: StringObjectFunction.h:42
reco::parser::ExpressionPtr
std::shared_ptr< ExpressionBase > ExpressionPtr
Definition: ExpressionBase.h:25
ExpressionPtr.h
jets_cff.expr
expr
Definition: jets_cff.py:489
T
long double T
Definition: Basic3DVectorLD.h:48
Exception
Definition: hltDiff.cc:245
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
StringObjectFunction::expr_
reco::parser::ExpressionPtr expr_
Definition: StringObjectFunction.h:29
edm::errors::Configuration
Definition: EDMException.h:36
StringObjectFunction::StringObjectFunction
StringObjectFunction(const std::string &expr, bool lazy=DefaultLazyness)
Definition: StringObjectFunction.h:17
expressionParser.h