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

const static StringFunctionMap functionTable
 

Private Attributes

const DetId_detId
 
const TrackerTopology_trackerTopology
 

Detailed Description

Definition at line 94 of file TrackerDetIdSelector.h.

Member Typedef Documentation

◆ DetIdFunction

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

Definition at line 100 of file TrackerDetIdSelector.h.

◆ StringFunctionMap

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

Definition at line 101 of file TrackerDetIdSelector.h.

Constructor & Destructor Documentation

◆ TrackerDetIdSelector()

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

Definition at line 104 of file TrackerDetIdSelector.h.

105  : _detId(detId), _trackerTopology(trackerTopology) {}

Member Function Documentation

◆ passSelection()

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

Definition at line 166 of file TrackerDetIdSelector.cc.

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

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

Referenced by TrackingRecHitProducer::setupDetIdPipes().

Member Data Documentation

◆ _detId

const DetId& TrackerDetIdSelector::_detId
private

Definition at line 96 of file TrackerDetIdSelector.h.

Referenced by passSelection().

◆ _trackerTopology

const TrackerTopology& TrackerDetIdSelector::_trackerTopology
private

Definition at line 97 of file TrackerDetIdSelector.h.

Referenced by passSelection().

◆ functionTable

const TrackerDetIdSelector::StringFunctionMap TrackerDetIdSelector::functionTable
static

Definition at line 102 of file TrackerDetIdSelector.h.

Referenced by Accessor::operator()().

ExpressionAST
Definition: TrackerDetIdSelector.h:20
ExpressionAST::evaluate
int evaluate(const DetId &detId, const TrackerTopology &trackerTopology) const
Definition: TrackerDetIdSelector.h:211
TrackerDetIdSelector::_trackerTopology
const TrackerTopology & _trackerTopology
Definition: TrackerDetIdSelector.h:97
trigObjTnPSource_cfi.selectionStr
selectionStr
Definition: trigObjTnPSource_cfi.py:69
mps_fire.end
end
Definition: mps_fire.py:242
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Exception
Definition: hltDiff.cc:246
TrackerDetIdSelectorGrammar
Definition: TrackerDetIdSelector.cc:129
TrackerDetIdSelector::_detId
const DetId & _detId
Definition: TrackerDetIdSelector.h:96