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  return SiStripBadStrip::Range(v_badstrips.begin()+p->ibegin,v_badstrips.begin()+p->iend);
34 }
35 
36 
37 void SiStripBadStrip::getDetIds(std::vector<uint32_t>& DetIds_) const {
38  // returns vector of DetIds in map
41  for (SiStripBadStrip::RegistryIterator p=begin; p != end; ++p) {
42  DetIds_.push_back(p->detid);
43  }
44 }
45 
46 void SiStripBadStrip::printSummary(std::stringstream & ss) const {
47  SiStripDetSummary summaryBadModules;
48  SiStripDetSummary summaryBadStrips;
49 
50  // Loop on the vector<DetRegistry> and take the bad modules and bad strips
51  Registry::const_iterator it = indexes.begin();
52  for( ; it!=indexes.end(); ++it ) {
53  summaryBadModules.add(it->detid);
54  summaryBadStrips.add(it->iend - it->ibegin);
55  }
56  ss << "Summary of bad modules in detector:" << std::endl;
57  summaryBadModules.print(ss, false);
58  ss << "Summary of bad strip in detectors:" << std::endl;
59  summaryBadStrips.print(ss, false);
60 }
61 
62 void SiStripBadStrip::printDebug(std::stringstream & ss) const {
63  ss << "Printing all bad strips for all DetIds" << std::endl;
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 // ss << "For DetId = " << it->detid << std::endl;
68  SiStripBadStrip::Range range(getRange(it->detid));
69  for( std::vector<unsigned int>::const_iterator badStrip = range.first;
70  badStrip != range.second; ++badStrip ) {
71  ss << "DetId="<<it->detid << " Strip=" << decode(*badStrip).firstStrip <<":"<<decode(*badStrip).range << " flag="<< decode(*badStrip).flag << std::endl;
72  }
73  }
74 }
unsigned short range
void getDetIds(std::vector< uint32_t > &DetIds_) const
void printSummary(std::stringstream &ss) const
Registry::const_iterator RegistryIterator
#define end
Definition: vmac.h:38
void printDebug(std::stringstream &ss) const
void print(std::stringstream &ss, const bool mean=true) const
Definition: DetId.h:20
unsigned short firstStrip
Container v_badstrips
double sd
const Range getRange(const uint32_t &detID) const
#define begin
Definition: vmac.h:31
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