|
|
Go to the documentation of this file. 1 #ifndef FastSimulation_TrackingRecHitProducer_TrackerDetIdSelector_H
2 #define FastSimulation_TrackingRecHitProducer_TrackerDetIdSelector_H
8 #include <boost/variant/recursive_variant.hpp>
14 #include <unordered_map>
21 typedef boost::variant<
Nil,
24 boost::recursive_wrapper<ExpressionAST>,
25 boost::recursive_wrapper<BinaryOP>,
26 boost::recursive_wrapper<UnaryOP> >
31 template <
typename Expr>
110 class Accessor :
public boost::static_visitor<int> {
120 throw cms::Exception(
"FastSimulation/TrackingRecHitProducer/TrackerDetIdSelector",
121 "while evaluating a DetId selection a symbol was not set");
133 "error while parsing DetId selection: named identifier '" +
s +
"' not known. Possible values are: ";
135 msg += pair.first +
",";
137 throw cms::Exception(
"FastSimulation/TrackingRecHitProducer/TrackerDetIdSelector",
msg);
163 boost::apply_visitor(*
this, ast.
expr);
169 boost::apply_visitor(*
this,
expr.left.expr);
196 boost::apply_visitor(*
this,
expr.right.expr);
206 boost::apply_visitor(*
this,
expr.subject.expr);
212 return boost::apply_visitor(
Accessor(detId, trackerTopology), this->
expr);
void operator()(std::string str) const
int operator()(const ExpressionAST &ast) const
ExpressionAST operator>(ExpressionAST const &lhs, ExpressionAST const &rhs)
int operator()(const BinaryOP &binaryOP) const
ExpressionAST operator<(ExpressionAST const &lhs, ExpressionAST const &rhs)
ExpressionAST(Expr const &expr)
ExpressionAST operator<=(ExpressionAST const &lhs, ExpressionAST const &rhs)
boost::variant< Nil, int, std::string, boost::recursive_wrapper< ExpressionAST >, boost::recursive_wrapper< BinaryOP >, boost::recursive_wrapper< UnaryOP > > Type
void operator()(ExpressionAST const &ast) const
TrackerDetIdSelector(const DetId &detId, const TrackerTopology &trackerTopology)
ExpressionAST operator!=(ExpressionAST const &lhs, ExpressionAST const &rhs)
int operator()(Nil i) const
int evaluate(const DetId &detId, const TrackerTopology &trackerTopology) const
int evaluate(const DetId &detId, const TrackerTopology &trackerTopology) const
ExpressionAST operator>=(ExpressionAST const &lhs, ExpressionAST const &rhs)
const TrackerTopology & _trackerTopology
UnaryOP(OP op, ExpressionAST const &subject)
int operator()(const std::string &s) const
int evaluate(const DetId &detId, const TrackerTopology &trackerTopology) const
ExpressionAST operator||(ExpressionAST const &lhs, ExpressionAST const &rhs)
int operator()(const UnaryOP &unaryOP) const
std::function< int(const TrackerTopology &trackerTopology, const DetId &)> DetIdFunction
int operator()(const int &i) const
ExpressionAST operator==(ExpressionAST const &lhs, ExpressionAST const &rhs)
ExpressionAST operator&&(ExpressionAST const &lhs, ExpressionAST const &rhs)
Container::value_type value_type
void operator()(BinaryOP const &expr) const
bool passSelection(const std::string &selectionStr) const
ExpressionAST & operator!()
void operator()(int n) const
BinaryOP(OP op, ExpressionAST const &left, ExpressionAST const &right)
const TrackerTopology & _trackerTopology
const static StringFunctionMap functionTable
void operator()(UnaryOP const &expr) const
WalkAST(const DetId &detId, const TrackerTopology &trackerTopology)
std::unordered_map< std::string, DetIdFunction > StringFunctionMap
Accessor(const DetId &detId, const TrackerTopology &trackerTopology)