CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DetIdSelector Class Reference

#include <DetIdSelector.h>

Public Member Functions

 DetIdSelector ()
 
 DetIdSelector (const std::string &selstring)
 
 DetIdSelector (const std::vector< std::string > &selstrings)
 
 DetIdSelector (const edm::ParameterSet &selconfig)
 
bool isSelected (const DetId &detid) const
 
bool isSelected (const unsigned int &rawid) const
 
bool isValid () const
 
bool operator() (const DetId &detid) const
 
bool operator() (const unsigned int &rawid) const
 

Private Member Functions

void addSelection (const std::string &selstring)
 
void addSelection (const std::vector< std::string > &selstrings)
 

Private Attributes

std::vector< unsigned int > m_masks
 
std::vector< unsigned int > m_selections
 

Detailed Description

Definition at line 12 of file DetIdSelector.h.

Constructor & Destructor Documentation

DetIdSelector::DetIdSelector ( )

Definition at line 7 of file DetIdSelector.cc.

7  :
9 {}
std::vector< unsigned int > m_masks
Definition: DetIdSelector.h:31
std::vector< unsigned int > m_selections
Definition: DetIdSelector.h:30
DetIdSelector::DetIdSelector ( const std::string &  selstring)

Definition at line 11 of file DetIdSelector.cc.

References addSelection().

11  :
13 {
14  addSelection(selstring);
15 }
std::vector< unsigned int > m_masks
Definition: DetIdSelector.h:31
std::vector< unsigned int > m_selections
Definition: DetIdSelector.h:30
void addSelection(const std::string &selstring)
DetIdSelector::DetIdSelector ( const std::vector< std::string > &  selstrings)

Definition at line 17 of file DetIdSelector.cc.

References addSelection().

17  :
19 {
20  addSelection(selstrings);
21 }
std::vector< unsigned int > m_masks
Definition: DetIdSelector.h:31
std::vector< unsigned int > m_selections
Definition: DetIdSelector.h:30
void addSelection(const std::string &selstring)
DetIdSelector::DetIdSelector ( const edm::ParameterSet selconfig)

Definition at line 23 of file DetIdSelector.cc.

References addSelection(), and edm::ParameterSet::getUntrackedParameter().

23  :
25 {
26 
27  const std::vector<std::string> selstrings = selconfig.getUntrackedParameter<std::vector<std::string> >("selection");
28  addSelection(selstrings);
29 
30 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< unsigned int > m_masks
Definition: DetIdSelector.h:31
std::vector< unsigned int > m_selections
Definition: DetIdSelector.h:30
void addSelection(const std::string &selstring)

Member Function Documentation

void DetIdSelector::addSelection ( const std::string &  selstring)
private

Definition at line 32 of file DetIdSelector.cc.

References LogDebug, m_masks, m_selections, RecoTauDiscriminantConfiguration::mask, and corrVsCorr::selection.

Referenced by addSelection(), and DetIdSelector().

32  {
33 
34  unsigned int selection;
35  unsigned int mask;
36 
37  if(selstring.substr(0,2) == "0x") {
38  sscanf(selstring.c_str(),"%x-%x",&mask,&selection);
39  }
40  else {
41  sscanf(selstring.c_str(),"%u-%u",&mask,&selection);
42  }
43 
44  m_selections.push_back(selection);
45  m_masks.push_back(mask);
46 
47  LogDebug("Selection added") << "Selection " << selection << " with mask " << mask << " added";
48 
49 }
#define LogDebug(id)
selection
main part
Definition: corrVsCorr.py:100
std::vector< unsigned int > m_masks
Definition: DetIdSelector.h:31
std::vector< unsigned int > m_selections
Definition: DetIdSelector.h:30
void DetIdSelector::addSelection ( const std::vector< std::string > &  selstrings)
private

Definition at line 51 of file DetIdSelector.cc.

References addSelection().

51  {
52 
53  for(std::vector<std::string>::const_iterator selstring=selstrings.begin();selstring!=selstrings.end();++selstring) {
54  addSelection(*selstring);
55  }
56 
57 }
void addSelection(const std::string &selstring)
bool DetIdSelector::isSelected ( const DetId detid) const
bool DetIdSelector::isSelected ( const unsigned int &  rawid) const
bool DetIdSelector::isValid ( void  ) const
inline
bool DetIdSelector::operator() ( const DetId detid) const

Definition at line 74 of file DetIdSelector.cc.

References isSelected(), and DetId::rawId().

74  {
75 
76  return isSelected(detid.rawId());
77 
78 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
bool isSelected(const DetId &detid) const
bool DetIdSelector::operator() ( const unsigned int &  rawid) const

Definition at line 80 of file DetIdSelector.cc.

References isSelected().

80  {
81 
82  return isSelected(rawid);
83 
84 }
bool isSelected(const DetId &detid) const

Member Data Documentation

std::vector<unsigned int> DetIdSelector::m_masks
private

Definition at line 31 of file DetIdSelector.h.

Referenced by addSelection(), and isSelected().

std::vector<unsigned int> DetIdSelector::m_selections
private

Definition at line 30 of file DetIdSelector.h.

Referenced by addSelection(), and isSelected().