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. Skippig 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
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 }
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
SiStripDetSummary.h
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
SiStripBadStrip::getRange
const Range getRange(const uint32_t detID) const
Definition: SiStripBadStrip.cc:27
TrackerTopology
Definition: TrackerTopology.h:16
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiStripBadStrip::DetRegistry::iend
uint32_t iend
Definition: SiStripBadStrip.h:41
pos
Definition: PixelAliasList.h:18
SiStripBadStrip::decode
data decode(const unsigned int &value) const
Definition: SiStripBadStrip.h:78
SiStripBadStrip::put
bool put(const uint32_t &detID, const InputVector &vect)
Definition: SiStripBadStrip.h:65
SiStripBadStrip.h
end
#define end
Definition: vmac.h:39
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
SiStripBadStrip::DetRegistry::ibegin
uint32_t ibegin
Definition: SiStripBadStrip.h:40
SiStripBadStrip::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripBadStrip.h:53
SiStripBadStrip::printDebug
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Definition: SiStripBadStrip.cc:76
SiStripBadStrip::data::flag
unsigned short flag
Definition: SiStripBadStrip.h:35
SiStripBadStrip::DetRegistry::detid
uint32_t detid
Definition: SiStripBadStrip.h:39
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
SiStripBadStrip::DetRegistry
Definition: SiStripBadStrip.h:38
edm::LogError
Definition: MessageLogger.h:183
SiStripBadStrip::data::firstStrip
unsigned short firstStrip
Definition: SiStripBadStrip.h:33
SiStripBadStrip::getRangeByPos
Range getRangeByPos(unsigned short pos) const
Definition: SiStripBadStrip.cc:41
SiStripBadStrip::indexes
Registry indexes
Definition: SiStripBadStrip.h:96
SiStripBadStrip::getDetIds
void getDetIds(std::vector< uint32_t > &DetIds_) const
Definition: SiStripBadStrip.cc:51
SiStripBadStrip::v_badstrips
Container v_badstrips
Definition: SiStripBadStrip.h:95
SiStripBadStrip::printSummary
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Definition: SiStripBadStrip.cc:60
SiStripDetSummary
Definition: SiStripDetSummary.h:28
SiStripBadStrip::RegistryIterator
Registry::const_iterator RegistryIterator
Definition: SiStripBadStrip.h:55
sd
double sd
Definition: CascadeWrapper.h:113
SiStripBadStrip::data::range
unsigned short range
Definition: SiStripBadStrip.h:34
SiStripBadStrip::StrictWeakOrdering
Definition: SiStripBadStrip.h:46
begin
#define begin
Definition: vmac.h:32