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 123 of file PixelCPEClusterRepair.h.

Constructor & Destructor Documentation

◆ Rule()

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

Definition at line 691 of file PixelCPEClusterRepair.cc.

References Exception, dqmdumpme::first, layer_, match(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, edm::second(), str, and subdet_.

691  {
692  static const boost::regex rule("([A-Z]+)(\\s+(\\d+))?");
693  boost::cmatch match;
694  // match and check it works
695  if (!regex_match(str.c_str(), match, rule))
696  throw cms::Exception("Configuration") << "Rule '" << str << "' not understood.\n";
697 
698  // subdet
699  subdet_ = -1;
700  if (strncmp(match[1].first, "PXB", 3) == 0)
702  else if (strncmp(match[1].first, "PXE", 3) == 0)
704  if (subdet_ == -1) {
705  throw cms::Exception("PixelCPEClusterRepair::Configuration")
706  << "Detector '" << match[1].first << "' not understood. Should be PXB, PXE.\n";
707  }
708  // layer (if present)
709  if (match[3].first != match[3].second) {
710  layer_ = atoi(match[3].first);
711  } else {
712  layer_ = 0;
713  }
714 } //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

◆ recommend()

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

Definition at line 128 of file PixelCPEClusterRepair.h.

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

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

Member Data Documentation

◆ layer_

int PixelCPEClusterRepair::Rule::layer_
private

Definition at line 142 of file PixelCPEClusterRepair.h.

Referenced by recommend(), and Rule().

◆ subdet_

int PixelCPEClusterRepair::Rule::subdet_
private

Definition at line 141 of file PixelCPEClusterRepair.h.

Referenced by recommend(), and Rule().