|
|
Go to the documentation of this file.
13 const char *startingFrom =
expr.c_str();
16 grammar.use_parser<1>() >> end_p,
30 const char *startingFrom =
expr.c_str();
33 grammar.use_parser<0>() >> end_p,
49 std::cerr <<
"Can't get a type out of " << wrapperType.
name() << std::endl;
54 if (
sel.get() ==
nullptr)
61 if (
expr.get() ==
nullptr)
70 if (exprs_.back().get() ==
nullptr) {
71 std::cerr <<
"Failed to parse expression " <<
expr << std::endl;
81 if (strlen(
cut) && !cuts_[0].
get()) {
82 std::cerr <<
"Failed to set cut \"" <<
cut <<
"\"" << std::endl;
95 if (!cuts_.back().get()) {
96 std::cerr <<
"Failed to add cut \"" <<
cut <<
"\"" << std::endl;
104 if (icut >= cuts_.size())
106 if (cuts_[icut].
get() ==
nullptr)
110 return (*cuts_[icut])(
obj);
112 if (!ignoreExceptions_)
113 std::cerr <<
"Caught exception " << ex.what() << std::endl;
121 if (exprs_.size() > iexpr)
124 if (!ignoreExceptions_)
125 std::cerr <<
"Caught exception " << ex.what() << std::endl;
132 if ((cuts_[0].
get() ==
nullptr) || (*cuts_[0])(
obj)) {
133 for (std::vector<reco::parser::ExpressionPtr>::const_iterator it = exprs_.begin(), ed = exprs_.end(); it != ed;
135 if (ptr ==
nullptr || it->get() ==
nullptr) {
136 printf(
" : %8s",
"#ERR");
139 double val = (*it)->value(
obj);
143 int len = sprintf(buff,
" : % 8.6g",
val);
147 if (strchr(buff,
'e')) {
148 printf((len == 3 + 13 ?
" : % .0e" :
" : % .1e"),
val);
150 printf(
"%11.11s", buff);
154 printf(
" : %8s",
"EXCEPT");
155 if (!ignoreExceptions_)
156 std::cerr <<
"Caught exception " << ex.what() << std::endl;
160 for (std::vector<reco::parser::SelectorPtr>::const_iterator it = cuts_.begin() + 1, ed = cuts_.end(); it != ed;
162 if (ptr ==
nullptr || it->get() ==
nullptr) {
163 printf(
" : %8s",
"#ERR");
166 int ret = (*it)->operator()(
obj);
167 printf(
" : %8d",
ret);
169 printf(
" : %8s",
"EXCEPT");
170 if (!ignoreExceptions_)
171 std::cerr <<
"Caught exception " << ex.what() << std::endl;
181 if ((cuts_[0].
get() ==
nullptr) || (*cuts_[0])(
obj)) {
184 hist->Fill(exprs_[0]->value(
obj));
186 if (!ignoreExceptions_)
187 std::cerr <<
"Caught exception " << ex.what() << std::endl;
194 if ((cuts_[0].
get() ==
nullptr) || (*cuts_[0])(
obj)) {
196 if (exprs_.size() >= 2)
197 hist->Fill(exprs_[0]->value(
obj), exprs_[1]->value(
obj));
199 if (!ignoreExceptions_)
200 std::cerr <<
"Caught exception " << ex.what() << std::endl;
207 if ((cuts_[0].
get() ==
nullptr) || (*cuts_[0])(
obj)) {
209 if (exprs_.size() >= 2)
210 graph->SetPoint(graph->GetN(), exprs_[0]->value(
obj), exprs_[1]->value(
obj));
212 if (!ignoreExceptions_)
213 std::cerr <<
"Caught exception " << ex.what() << std::endl;
220 if ((cuts_[0].
get() ==
nullptr) || (*cuts_[0])(
obj)) {
222 if (exprs_.size() >= 2)
223 hist->Fill(exprs_[0]->value(
obj), exprs_[1]->value(
obj));
225 if (!ignoreExceptions_)
226 std::cerr <<
"Caught exception " << ex.what() << std::endl;
ret
prodAgent to be discontinued
const char * baseExceptionWhat(const BaseException &e)
returns the appropriate 'what' message for the exception
TypeWithDict templateArgumentAt(size_t index) const
static edm::TypeWithDict elementType(const edm::TypeWithDict &wrapperType)
Perform the type deduction form edm::Wrapper<C> to C::value_type and resolves typedefs.
bool addExpression(const char *expr)
static double eval(const reco::parser::ExpressionPtr &sel, const edm::TypeWithDict type, const void *obj)
Make a edm::ObjectWithDict(type, obj) and pass it to the expression.
void print(const void *obj) const
bool addExtraCut(const char *cut)
Add one extra cut that can be evaluated separately (as if it was an expression)
static reco::parser::SelectorPtr makeSelector(const std::string &expr, const edm::TypeWithDict &type)
Parse an expression for a given object type (using lazy parsing when resolving methods)
static reco::parser::ExpressionPtr makeExpression(const std::string &expr, const edm::TypeWithDict &type)
Parse an expression for a given object type (using lazy parsing when resolving methods)
void fillProf(const void *obj, TProfile *prof) const
void clearCut()
Clear the default cut.
boost::spirit::classic::parser_error< reco::parser::SyntaxErrors > BaseException
void fill1D(const void *obj, TH1 *hist) const
void fillGraph(const void *obj, TGraph *graph) const
bool setCut(const char *cut)
Set the default cut that is applied to the events.
std::shared_ptr< ExpressionBase > ExpressionPtr
static bool test(const reco::parser::SelectorPtr &sel, const edm::TypeWithDict type, const void *obj)
Make a edm::ObjectWithDict(type, obj) and pass it to the selector.
void clearExtraCuts()
Clear all extra cuts ;.
double eval(const void *obj, size_t iexpr=0) const
std::shared_ptr< SelectorBase > SelectorPtr
bool test(const void *obj, size_t icut=0) const
void fill2D(const void *obj, TH2 *hist2d) const