CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 << " is already stored. Skippig this put" << std::endl;
12  return false;
13  }
14 
15  size_t sd= input.second-input.first;
16  DetRegistry detregistry;
17  detregistry.detid=DetId;
18  detregistry.ibegin=v_badstrips.size();
19  detregistry.iend=v_badstrips.size()+sd;
20  indexes.insert(p,detregistry);
21 
22  v_badstrips.insert(v_badstrips.end(),input.first,input.second);
23  return true;
24 }
25 
27  // get SiStripBadStrip Range of DetId
28 
29  RegistryIterator p = std::lower_bound(indexes.begin(),indexes.end(),DetId,SiStripBadStrip::StrictWeakOrdering());
30  if (p==indexes.end()|| p->detid!=DetId)
31  return SiStripBadStrip::Range(v_badstrips.end(),v_badstrips.end());
32  else {
33  __builtin_prefetch((&v_badstrips.front())+p->ibegin);
34  __builtin_prefetch((&v_badstrips.front())+p->ibegin+24);
35  __builtin_prefetch((&v_badstrips.front())+p->iend-24);
36  return SiStripBadStrip::Range(v_badstrips.begin()+p->ibegin,v_badstrips.begin()+p->iend);
37  }
38 }
39 
41  if (pos>indexes.size()) return Range(v_badstrips.end(),v_badstrips.end());
42  auto p = indexes.begin()+pos;
43  __builtin_prefetch((&v_badstrips.front())+p->ibegin);
44  __builtin_prefetch((&v_badstrips.front())+p->ibegin+24);
45  __builtin_prefetch((&v_badstrips.front())+p->iend-24);
46  return Range(v_badstrips.begin()+p->ibegin,v_badstrips.begin()+p->iend);
47 }
48 
49 
50 void SiStripBadStrip::getDetIds(std::vector<uint32_t>& DetIds_) const {
51  // returns vector of DetIds in map
54  for (SiStripBadStrip::RegistryIterator p=begin; p != end; ++p) {
55  DetIds_.push_back(p->detid);
56  }
57 }
58 
59 void SiStripBadStrip::printSummary(std::stringstream & ss) const {
60  SiStripDetSummary summaryBadModules;
61  SiStripDetSummary summaryBadStrips;
62 
63  // Loop on the vector<DetRegistry> and take the bad modules and bad strips
64  Registry::const_iterator it = indexes.begin();
65  for( ; it!=indexes.end(); ++it ) {
66  summaryBadModules.add(it->detid);
67  summaryBadStrips.add(it->iend - it->ibegin);
68  }
69  ss << "Summary of bad modules in detector:" << std::endl;
70  summaryBadModules.print(ss, false);
71  ss << "Summary of bad strip in detectors:" << std::endl;
72  summaryBadStrips.print(ss, false);
73 }
74 
75 void SiStripBadStrip::printDebug(std::stringstream & ss) const {
76  ss << "Printing all bad strips for all DetIds" << std::endl;
77  // Loop on the vector<DetRegistry> and take the bad modules and bad strips
78  Registry::const_iterator it = indexes.begin();
79  for( ; it!=indexes.end(); ++it ) {
80 // ss << "For DetId = " << it->detid << std::endl;
81  SiStripBadStrip::Range range(getRange(it->detid));
82  for( std::vector<unsigned int>::const_iterator badStrip = range.first;
83  badStrip != range.second; ++badStrip ) {
84  ss << "DetId="<<it->detid << " Strip=" << decode(*badStrip).firstStrip <<":"<<decode(*badStrip).range << " flag="<< decode(*badStrip).flag << std::endl;
85  }
86  }
87 }
unsigned short range
void getDetIds(std::vector< uint32_t > &DetIds_) const
void printSummary(std::stringstream &ss) const
Range getRangeByPos(unsigned short pos) const
Registry::const_iterator RegistryIterator
static std::string const input
Definition: EdmProvDump.cc:43
#define end
Definition: vmac.h:37
void printDebug(std::stringstream &ss) const
void print(std::stringstream &ss, const bool mean=true) const
Definition: DetId.h:18
unsigned short firstStrip
Container v_badstrips
double sd
#define begin
Definition: vmac.h:30
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
bool put(const uint32_t &detID, const InputVector &vect)
void add(const DetId &detid, const float &value)
Used to compute the mean value of the value variable divided by subdetector, layer and mono/stereo...
data decode(const unsigned int &value) const