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

Constructor & Destructor Documentation

◆ Rule()

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

Definition at line 702 of file PixelCPEClusterRepair.cc.

702  {
703  static const boost::regex rule("([A-Z]+)(\\s+(\\d+))?");
704  boost::cmatch match;
705  // match and check it works
706  if (!regex_match(str.c_str(), match, rule))
707  throw cms::Exception("Configuration") << "Rule '" << str << "' not understood.\n";
708 
709  // subdet
710  subdet_ = -1;
711  if (strncmp(match[1].first, "PXB", 3) == 0)
713  else if (strncmp(match[1].first, "PXE", 3) == 0)
715  if (subdet_ == -1) {
716  throw cms::Exception("PixelCPEClusterRepair::Configuration")
717  << "Detector '" << match[1].first << "' not understood. Should be PXB, PXE.\n";
718  }
719  // layer (if present)
720  if (match[3].first != match[3].second) {
721  layer_ = atoi(match[3].first);
722  } else {
723  layer_ = 0;
724  }
725 } //end Rule::Rule

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

Member Function Documentation

◆ recommend()

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

Definition at line 127 of file PixelCPEClusterRepair.h.

127  {
128  // check detector
129  if (detid.subdetId() == subdet_) {
130  // check layer
131  if ((layer_ == 0) || (layer_ == int(tTopo.layer(detid)))) {
132  return true;
133  } else
134  return false;
135  } else
136  return false;
137  }

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

Member Data Documentation

◆ layer_

int PixelCPEClusterRepair::Rule::layer_
private

Definition at line 141 of file PixelCPEClusterRepair.h.

Referenced by recommend(), and Rule().

◆ subdet_

int PixelCPEClusterRepair::Rule::subdet_
private

Definition at line 140 of file PixelCPEClusterRepair.h.

Referenced by recommend(), and Rule().

PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
TrackerTopology::layer
unsigned int layer(const DetId &id) const
Definition: TrackerTopology.cc:47
dqmdumpme.first
first
Definition: dqmdumpme.py:55
str
#define str(s)
Definition: TestProcessor.cc:51
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
createfilelist.int
int
Definition: createfilelist.py:10
PixelCPEClusterRepair::Rule::subdet_
int subdet_
Definition: PixelCPEClusterRepair.h:140
Exception
Definition: hltDiff.cc:246
PixelCPEClusterRepair::Rule::layer_
int layer_
Definition: PixelCPEClusterRepair.h:141