CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PixelCPEClusterRepair::Rule Class Reference

Public Member Functions

bool recommend (DetId detid, const TrackerTopology &tTopo) const
 
 Rule (const std::string &str)
 

Private Attributes

int layer_
 
int subdet_
 

Detailed Description

Definition at line 119 of file PixelCPEClusterRepair.h.

Constructor & Destructor Documentation

PixelCPEClusterRepair::Rule::Rule ( const std::string &  str)

Definition at line 717 of file PixelCPEClusterRepair.cc.

References Exception, plotBeamSpotDB::first, sistrip::layer_, match(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, and edm::second().

717  {
718  static const boost::regex rule("([A-Z]+)(\\s+(\\d+))?");
719  boost::cmatch match;
720  // match and check it works
721  if (!regex_match(str.c_str(), match, rule))
722  throw cms::Exception("Configuration") << "Rule '" << str << "' not understood.\n";
723 
724  // subdet
725  subdet_ = -1;
726  if (strncmp(match[1].first, "PXB", 3) == 0) subdet_ = PixelSubdetector::PixelBarrel;
727  else if (strncmp(match[1].first, "PXE", 3) == 0) subdet_ = PixelSubdetector::PixelEndcap;
728  if (subdet_ == -1) {
729  throw cms::Exception("PixelCPEClusterRepair::Configuration") << "Detector '" << match[1].first << "' not understood. Should be PXB, PXE.\n";
730  }
731  // layer (if present)
732  if (match[3].first != match[3].second) {
733  layer_ = atoi(match[3].first);
734  } else {
735  layer_ = 0;
736  }
737 }//end Rule::Rule
U second(std::pair< T, U > const &p)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
#define str(s)

Member Function Documentation

bool PixelCPEClusterRepair::Rule::recommend ( DetId  detid,
const TrackerTopology tTopo 
) const
inline

Definition at line 124 of file PixelCPEClusterRepair.h.

References createfilelist::int, TrackerTopology::layer(), sistrip::layer_, and DetId::subdetId().

124  {
125  // check detector
126  if (detid.subdetId() == subdet_) {
127  // check layer
128  if ( (layer_ == 0) || (layer_ == int(tTopo.layer(detid))) ) {
129  return true;
130  }
131  else return false;
132  }
133  else return false;
134  }
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
unsigned int layer(const DetId &id) const

Member Data Documentation

int PixelCPEClusterRepair::Rule::layer_
private

Definition at line 137 of file PixelCPEClusterRepair.h.

int PixelCPEClusterRepair::Rule::subdet_
private

Definition at line 136 of file PixelCPEClusterRepair.h.