CMS 3D CMS Logo

SiStripBadStrip.cc
Go to the documentation of this file.
4 
5 #include <algorithm>
6 
7 bool SiStripBadStrip::put(const uint32_t& DetId, Range input) {
8  // put in SiStripBadStrip::v_badstrips of DetId
9  Registry::iterator p = std::lower_bound(indexes.begin(), indexes.end(), DetId, SiStripBadStrip::StrictWeakOrdering());
10  if (p != indexes.end() && p->detid == DetId) {
11  edm::LogError("SiStripBadStrip") << "[" << __PRETTY_FUNCTION__ << "] SiStripBadStrip for DetID " << DetId
12  << " is already stored. Skipping this put" << std::endl;
13  return false;
14  }
15 
16  size_t sd = input.second - input.first;
17  DetRegistry detregistry;
18  detregistry.detid = DetId;
19  detregistry.ibegin = v_badstrips.size();
20  detregistry.iend = v_badstrips.size() + sd;
21  indexes.insert(p, detregistry);
22 
23  v_badstrips.insert(v_badstrips.end(), input.first, input.second);
24  return true;
25 }
26 
28  // get SiStripBadStrip Range of DetId
29 
31  if (p == indexes.end() || p->detid != DetId)
32  return SiStripBadStrip::Range(v_badstrips.end(), v_badstrips.end());
33  else {
34  __builtin_prefetch((&v_badstrips.front()) + p->ibegin);
35  __builtin_prefetch((&v_badstrips.front()) + p->ibegin + 24);
36  __builtin_prefetch((&v_badstrips.front()) + p->iend - 24);
37  return SiStripBadStrip::Range(v_badstrips.begin() + p->ibegin, v_badstrips.begin() + p->iend);
38  }
39 }
40 
42  if (pos > indexes.size())
43  return Range(v_badstrips.end(), v_badstrips.end());
44  auto p = indexes.begin() + pos;
45  __builtin_prefetch((&v_badstrips.front()) + p->ibegin);
46  __builtin_prefetch((&v_badstrips.front()) + p->ibegin + 24);
47  __builtin_prefetch((&v_badstrips.front()) + p->iend - 24);
48  return Range(v_badstrips.begin() + p->ibegin, v_badstrips.begin() + p->iend);
49 }
50 
51 void SiStripBadStrip::getDetIds(std::vector<uint32_t>& DetIds_) const {
52  // returns vector of DetIds in map
55  for (SiStripBadStrip::RegistryIterator p = begin; p != end; ++p) {
56  DetIds_.push_back(p->detid);
57  }
58 }
59 
60 void SiStripBadStrip::printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const {
61  SiStripDetSummary summaryBadModules{trackerTopo};
62  SiStripDetSummary summaryBadStrips{trackerTopo};
63 
64  // Loop on the vector<DetRegistry> and take the bad modules and bad strips
65  Registry::const_iterator it = indexes.begin();
66  for (; it != indexes.end(); ++it) {
67  summaryBadModules.add(it->detid);
68  summaryBadStrips.add(it->iend - it->ibegin);
69  }
70  ss << "Summary of bad modules in detector:" << std::endl;
71  summaryBadModules.print(ss, false);
72  ss << "Summary of bad strip in detectors:" << std::endl;
73  summaryBadStrips.print(ss, false);
74 }
75 
76 void SiStripBadStrip::printDebug(std::stringstream& ss, const TrackerTopology* /*trackerTopo*/) const {
77  ss << "Printing all bad strips for all DetIds" << std::endl;
78  // Loop on the vector<DetRegistry> and take the bad modules and bad strips
79  Registry::const_iterator it = indexes.begin();
80  for (; it != indexes.end(); ++it) {
81  // ss << "For DetId = " << it->detid << std::endl;
83  for (std::vector<unsigned int>::const_iterator badStrip = range.first; badStrip != range.second; ++badStrip) {
84  ss << "DetId=" << it->detid << " Strip=" << decode(*badStrip).firstStrip << ":" << decode(*badStrip).range
85  << " flag=" << decode(*badStrip).flag << std::endl;
86  }
87  }
88 }
unsigned short range
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Registry::const_iterator RegistryIterator
Log< level::Error, false > LogError
const Range getRange(const uint32_t detID) const
void getDetIds(std::vector< uint32_t > &DetIds_) const
static std::string const input
Definition: EdmProvDump.cc:47
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Range getRangeByPos(unsigned short pos) const
Definition: DetId.h:17
unsigned short firstStrip
Container v_badstrips
std::pair< ContainerIterator, ContainerIterator > Range
data decode(const unsigned int &value) const
bool put(const uint32_t &detID, const InputVector &vect)