CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Attributes
TrackerDetIdSelector Class Reference

#include <TrackerDetIdSelector.h>

Public Types

typedef std::function< int(const TrackerTopology &trackerTopology, const DetId &)> DetIdFunction
 
typedef std::unordered_map< std::string, DetIdFunctionStringFunctionMap
 

Public Member Functions

bool passSelection (const std::string &selectionStr) const
 
 TrackerDetIdSelector (const DetId &detId, const TrackerTopology &trackerTopology)
 

Static Public Attributes

static const StringFunctionMap functionTable
 

Private Attributes

const DetId_detId
 
const TrackerTopology_trackerTopology
 

Detailed Description

Definition at line 118 of file TrackerDetIdSelector.h.

Member Typedef Documentation

◆ DetIdFunction

typedef std::function<int(const TrackerTopology& trackerTopology, const DetId&)> TrackerDetIdSelector::DetIdFunction

Definition at line 124 of file TrackerDetIdSelector.h.

◆ StringFunctionMap

typedef std::unordered_map<std::string, DetIdFunction> TrackerDetIdSelector::StringFunctionMap

Definition at line 125 of file TrackerDetIdSelector.h.

Constructor & Destructor Documentation

◆ TrackerDetIdSelector()

TrackerDetIdSelector::TrackerDetIdSelector ( const DetId detId,
const TrackerTopology trackerTopology 
)
inline

Definition at line 128 of file TrackerDetIdSelector.h.

129  : _detId(detId), _trackerTopology(trackerTopology) {}
const TrackerTopology & _trackerTopology

Member Function Documentation

◆ passSelection()

bool TrackerDetIdSelector::passSelection ( const std::string &  selectionStr) const

Definition at line 160 of file TrackerDetIdSelector.cc.

References _detId, _trackerTopology, mps_fire::end, ExpressionAST::evaluate(), Exception, trigObjTnPSource_cfi::selectionStr, AlCaHLTBitMon_QueryRunRegistry::string, and summarizeEdmComparisonLogfiles::success.

160  {
161  std::string::const_iterator begin = selectionStr.cbegin();
162  std::string::const_iterator end = selectionStr.cend();
163 
165  ExpressionAST exprAST;
166 
167  bool success = boost::spirit::qi::phrase_parse(begin, end, grammar, boost::spirit::ascii::space, exprAST);
168  if (begin != end) {
169  throw cms::Exception("FastSimulation/TrackingRecHitProducer/TrackerDetIdSelector",
170  "parsing selection '" + selectionStr + "' failed at " +
171  std::string(selectionStr.cbegin(), begin) + "^^^" + std::string(begin, end));
172  }
173  if (!success) {
174  throw cms::Exception("FastSimulation/TrackingRecHitProducer/TrackerDetIdSelector",
175  "parsing selection '" + selectionStr + "' failed.");
176  }
177  /* Comment out for debugging
178  WalkAST walker(_detId,_trackerTopology);
179  walker(exprAST);
180  std::cout<<std::endl;
181  */
182  return exprAST.evaluate(_detId, _trackerTopology);
183 }
const TrackerTopology & _trackerTopology
int evaluate(const DetId &detId, const TrackerTopology &trackerTopology) const

Member Data Documentation

◆ _detId

const DetId& TrackerDetIdSelector::_detId
private

Definition at line 120 of file TrackerDetIdSelector.h.

Referenced by passSelection().

◆ _trackerTopology

const TrackerTopology& TrackerDetIdSelector::_trackerTopology
private

Definition at line 121 of file TrackerDetIdSelector.h.

Referenced by passSelection().

◆ functionTable

const TrackerDetIdSelector::StringFunctionMap TrackerDetIdSelector::functionTable
static

Definition at line 126 of file TrackerDetIdSelector.h.

Referenced by Accessor::operator()().