28 #include <boost/spirit/include/qi.hpp> 43 namespace qi = boost::spirit::qi;
44 namespace ascii = boost::spirit::ascii;
54 virtual const char*
pathName()
const {
return ""; }
56 virtual void setLeft(std::unique_ptr<Evaluator>&&) {}
57 virtual void setRight(std::unique_ptr<Evaluator>&&) {}
102 template <
typename T>
179 std::unique_ptr<Evaluator>& backEvaluator =
operatorStack.back();
189 std::unique_ptr<Evaluator>& backEvaluator =
operatorStack.back();
198 std::unique_ptr<Evaluator>& backEvaluator =
operatorStack.back();
212 std::unique_ptr<Evaluator>& backEvaluator =
operatorStack.back();
228 std::unique_ptr<Evaluator>& backEvaluator =
operatorStack.back();
243 std::unique_ptr<Evaluator>& backEvaluator =
operatorStack.back();
247 throw cms::Exception(
"LogicError") <<
"Should be impossible to get this error. Contact a Framework developer";
258 throw cms::Exception(
"LogicError") <<
"Should be impossible to get this error. Contact a Framework developer";
274 template <
typename Iterator>
275 class Grammar :
public qi::grammar<Iterator, ascii::space_type> {
342 desc.addVPSet(
"algorithms", algoDesc);
348 : getterOfPassedReferences_(
edm::TypeMatch(), this) {
363 throw cms::Exception(
"Configuration") <<
"Syntax error in logical expression. Here is an example of how\n" 364 <<
"the syntax should look:\n" 365 <<
" \"path1 and not (path2 or not path3)\"\n" 366 <<
"The expression must contain alternating appearances of operands\n" 367 <<
"which are path names and binary operators which can be \'and\'\n" 368 <<
"or \'or\', with a path name at the beginning and end. There\n" 369 <<
"must be at least one path name. In addition to the alternating\n" 370 <<
"path names and binary operators, the unary operator \'not\' can\n" 371 <<
"be inserted before a path name or a begin parenthesis.\n" 372 <<
"Parentheses are allowed. Parentheses must come in matching pairs.\n" 373 <<
"Matching begin and end parentheses must contain a complete and\n" 374 <<
"syntactically correct logical expression. There must be at least\n" 375 <<
"one space or parenthesis between operators and path names. Extra\n" 376 <<
"space is ignored and OK. Path names can only contain upper and\n" 377 <<
"lower case letters, numbers, and underscores. A path name cannot\n" 378 <<
"be the same as an operator name.\n";
394 produces<P2GTAlgoBlockCollection>();
408 if (
pset->existsAs<std::vector<std::string>>(
pathName)) {
412 const auto& modPSet =
pset->getParameterSet(
mod);
413 if (modPSet.getParameter<
std::string>(
"@module_edm_type") ==
"EDFilter") {
414 if (modPSet.getParameter<
std::string>(
"@module_type") ==
"L1GTSingleObjectCond") {
416 }
else if (modPSet.getParameter<
std::string>(
"@module_type") ==
"L1GTDoubleObjectCond") {
417 algoDef.filtModules_.insert(
419 algoDef.filtModules_.insert(
421 }
else if (modPSet.getParameter<
std::string>(
"@module_type") ==
"L1GTTripleObjectCond") {
422 algoDef.filtModules_.insert(
424 algoDef.filtModules_.insert(
426 algoDef.filtModules_.insert(
428 }
else if (modPSet.getParameter<
std::string>(
"@module_type") ==
"L1GTQuadObjectCond") {
429 algoDef.filtModules_.insert(
431 algoDef.filtModules_.insert(
433 algoDef.filtModules_.insert(
435 algoDef.filtModules_.insert(
447 std::vector<edm::Handle<P2GTCandidateVectorRef>>
handles;
450 std::unique_ptr<P2GTAlgoBlockCollection>
algoCollection = std::make_unique<P2GTAlgoBlockCollection>();
454 bool initial = algoDef.evaluator_->evaluate(
event);
464 if (algoDef.filtModules_.count({module, instance}) > 0) {
465 trigObjects.insert(trigObjects.end(),
handle->begin(),
handle->end());
virtual bool evaluate(edm::Event const &event) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
qi::rule< Iterator, ascii::space_type > expression
static void fillDescriptions(edm::ConfigurationDescriptions &)
bool getMapped(key_type const &k, value_type &result) const
std::vector< std::string > pathNames_
void setRight(std::unique_ptr< Evaluator > &&v) override
void moveBinaryOperator()
std::set< std::tuple< std::string, std::string > > filtModules_
void addPathName(std::vector< char > const &s)
static PFTauRenderPlugin instance
virtual void setRight(std::unique_ptr< Evaluator > &&)
edm::propagate_const< std::unique_ptr< pathStatusExpression::Evaluator > > evaluator_
void init(edm::ConsumesCollector &iC) override
virtual void init(edm::ConsumesCollector &)
qi::rule< Iterator > binaryOperator
EvaluatorType type() const override
std::vector< std::unique_ptr< Evaluator > > operandStack
void produce(edm::Event &, const edm::EventSetup &) override
qi::rule< Iterator > unaryOperator
bool getConfigurationForProcess(std::string const &name, ProcessConfiguration &config) const
void print(std::ostream &out, unsigned int indentation) const override
std::map< std::string, AlgoDefinition > algoDefinitions_
void setLeft(std::unique_ptr< Evaluator > &&v) override
qi::rule< Iterator > afterOperator
edm::EDGetTokenT< edm::PathStatus > token_
edm::propagate_const< std::unique_ptr< Evaluator > > left_
bool evaluate(edm::Event const &event) const override
edm::propagate_const< std::unique_ptr< Evaluator > > right_
void init(edm::ConsumesCollector &iC) override
L1GTAlgoBlockProducer(const edm::ParameterSet &)
std::vector< BaseVolumeHandle * > handles
void print(std::ostream &out, unsigned int indentation) const override
EvaluatorType type() const override
edm::propagate_const< std::unique_ptr< Evaluator > > operand_
virtual EvaluatorType type() const =0
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
EvaluatorType type() const override
Operand(std::vector< char > const &pathName)
#define DEFINE_FWK_MODULE(type)
edm::GetterOfProducts< P2GTCandidateVectorRef > getterOfPassedReferences_
ProcessHistory const & processHistory() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual const char * pathName() const
def getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
void fillHandles(ProductContainer const &productContainer, std::vector< edm::Handle< T >> &handles) const
void print(std::ostream &out, unsigned int indentation) const override
void addBeginParenthesis()
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
qi::rule< Iterator > pathName
std::vector< std::string > pathNames_
virtual void print(std::ostream &out, unsigned int indentation) const
bool evaluate(edm::Event const &event) const override
void init(edm::ConsumesCollector &iC) override
qi::rule< Iterator, ascii::space_type > binaryOperand
virtual void setLeft(std::unique_ptr< Evaluator > &&)
EvaluatorType type() const override
std::vector< P2GTCandidateRef > P2GTCandidateVectorRef
std::vector< std::unique_ptr< Evaluator > > operatorStack
bool evaluate(edm::Event const &event) const override
void setLeft(std::unique_ptr< Evaluator > &&v) override
const std::vector< std::string > & pathNames()
qi::rule< Iterator > binaryOperatorTest
T mod(const T &a, const T &b)
std::unique_ptr< Evaluator > finish()
Grammar(ShuntingYardAlgorithm *algorithm)
ShuntingYardAlgorithm * algorithm_
static Registry * instance()
void beginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override