CMS 3D CMS Logo

SiStripBadComponentsDQMServiceReader.cc
Go to the documentation of this file.
3 
8 
9 #include <iostream>
10 #include <cstdio>
11 #include <sys/time.h>
12 
13 #include <boost/lexical_cast.hpp>
14 
15 using namespace std;
16 
18  : printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", true)) {}
19 
21 
23  //Retrieve tracker topology from geometry
25  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
26  const TrackerTopology* const tTopo = tTopoHandle.product();
27 
28  uint32_t FedErrorMask = 1; // bit 0
29  uint32_t DigiErrorMask = 2; // bit 1
30  uint32_t ClusterErrorMask = 4; // bit 2
31 
32  edm::ESHandle<SiStripBadStrip> SiStripBadStrip_;
33  iSetup.get<SiStripBadStripRcd>().get(SiStripBadStrip_);
34  edm::LogInfo("SiStripBadComponentsDQMServiceReader")
35  << "[SiStripBadComponentsDQMServiceReader::analyze] End Reading SiStripBadStrip" << std::endl;
36 
37  std::vector<uint32_t> detid;
38  SiStripBadStrip_->getDetIds(detid);
39 
40  std::stringstream ss;
41 
42  // ss << " detid" << " \t\t\t" << "FED error" << " \t" << "Digi test failed" << " \t" << "Cluster test failed" << std::endl;
43 
44  ss << "subdet layer stereo side \t detId \t\t Errors" << std::endl;
45 
46  for (size_t id = 0; id < detid.size(); id++) {
47  SiStripBadStrip::Range range = SiStripBadStrip_->getRange(detid[id]);
48 
49  for (int it = 0; it < range.second - range.first; it++) {
50  unsigned int value = (*(range.first + it));
51  ss << detIdToString(detid[id], tTopo) << "\t" << detid[id] << "\t";
52 
53  uint32_t flag = boost::lexical_cast<uint32_t>(SiStripBadStrip_->decode(value).flag);
54 
55  printError(ss, ((flag & FedErrorMask) == FedErrorMask), "Fed error, ");
56  printError(ss, ((flag & DigiErrorMask) == DigiErrorMask), "Digi error, ");
57  printError(ss, ((flag & ClusterErrorMask) == ClusterErrorMask), "Cluster error");
58  ss << std::endl;
59 
60  if (printdebug_) {
61  ss << " firstBadStrip " << SiStripBadStrip_->decode(value).firstStrip << "\t "
62  << " NconsecutiveBadStrips " << SiStripBadStrip_->decode(value).range << "\t " // << std::endl;
63  << " flag " << SiStripBadStrip_->decode(value).flag << "\t "
64  << " packed integer " << std::hex << value << std::dec << "\t " << std::endl;
65  }
66  }
67  ss << std::endl;
68  }
69  edm::LogInfo("SiStripBadComponentsDQMServiceReader") << ss.str();
70 }
71 
73  const bool error,
74  const std::string& errorText) {
75  if (error) {
76  ss << errorText << "\t ";
77  } else {
78  ss << "\t\t ";
79  }
80 }
81 
84  int layer = 0;
85  int stereo = 0;
86  int side = -1;
87 
88  // Using the operator[] if the element does not exist it is created with the default value. That is 0 for integral types.
89  switch (detid.subdetId()) {
90  case StripSubdetector::TIB: {
91  detector = "TIB";
92  layer = tTopo->tibLayer(detid.rawId());
93  stereo = tTopo->tibStereo(detid.rawId());
94  break;
95  }
96  case StripSubdetector::TOB: {
97  detector = "TOB";
98  layer = tTopo->tobLayer(detid.rawId());
99  stereo = tTopo->tobStereo(detid.rawId());
100  break;
101  }
102  case StripSubdetector::TEC: {
103  // is this module in TEC+ or TEC-?
104  side = tTopo->tecSide(detid.rawId());
105  detector = "TEC";
106  layer = tTopo->tecWheel(detid.rawId());
107  stereo = tTopo->tecStereo(detid.rawId());
108  break;
109  }
110  case StripSubdetector::TID: {
111  // is this module in TID+ or TID-?
112  side = tTopo->tidSide(detid.rawId());
113  detector = "TID";
114  layer = tTopo->tidWheel(detid.rawId());
115  stereo = tTopo->tidStereo(detid.rawId());
116  break;
117  }
118  }
119  std::string name(detector + "\t" + std::to_string(layer) + "\t" + std::to_string(stereo) + "\t");
120  if (side == 1) {
121  name += "-";
122  } else if (side == 2) {
123  name += "+";
124  }
125  // if( side != -1 ) {
126  // name += boost::lexical_cast<string>(side);
127  // }
128 
129  return name;
130 }
SiStripBadComponentsDQMServiceReader.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
electrons_cff.bool
bool
Definition: electrons_cff.py:393
SiStripBadStrip::getRange
const Range getRange(const uint32_t detID) const
Definition: SiStripBadStrip.cc:27
SiStripBadComponentsDQMServiceReader::SiStripBadComponentsDQMServiceReader
SiStripBadComponentsDQMServiceReader(const edm::ParameterSet &)
Definition: SiStripBadComponentsDQMServiceReader.cc:17
TrackerTopology
Definition: TrackerTopology.h:16
SiStripBadStrip::decode
data decode(const unsigned int &value) const
Definition: SiStripBadStrip.h:78
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripBadStrip.h
relativeConstraints.error
error
Definition: relativeConstraints.py:53
TrackerTopology::tobStereo
uint32_t tobStereo(const DetId &id) const
Definition: TrackerTopology.h:275
TrackerTopology::tidWheel
unsigned int tidWheel(const DetId &id) const
Definition: TrackerTopology.h:201
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
SiStripBadComponentsDQMServiceReader::printdebug_
bool printdebug_
Definition: SiStripBadComponentsDQMServiceReader.h:35
TrackerTopology.h
SiStripBadStrip::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripBadStrip.h:53
TrackerTopologyRcd.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
SiStripBadStrip::data::flag
unsigned short flag
Definition: SiStripBadStrip.h:35
edm::ESHandle< TrackerTopology >
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackerTopology::tibStereo
uint32_t tibStereo(const DetId &id) const
Definition: TrackerTopology.h:279
funct::true
true
Definition: Factorize.h:173
SiStripBadComponentsDQMServiceReader::printError
void printError(std::stringstream &ss, const bool error, const std::string &errorText)
Definition: SiStripBadComponentsDQMServiceReader.cc:72
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripBadComponentsDQMServiceReader::detIdToString
std::string detIdToString(const DetId &detid, const TrackerTopology *tTopo)
Definition: SiStripBadComponentsDQMServiceReader.cc:82
TrackerTopology::tidStereo
uint32_t tidStereo(const DetId &id) const
Definition: TrackerTopology.h:283
TrackerTopology::tidSide
unsigned int tidSide(const DetId &id) const
Definition: TrackerTopology.h:190
SiStripBadStrip::data::firstStrip
unsigned short firstStrip
Definition: SiStripBadStrip.h:33
value
Definition: value.py:1
SiStripBadStrip::getDetIds
void getDetIds(std::vector< uint32_t > &DetIds_) const
Definition: SiStripBadStrip.cc:51
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
TrackerTopology::tobLayer
unsigned int tobLayer(const DetId &id) const
Definition: TrackerTopology.h:147
SiStripBadStripRcd
Definition: SiStripCondDataRecords.h:19
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
SiStripBadComponentsDQMServiceReader::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripBadComponentsDQMServiceReader.cc:22
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
SiStripBadStrip::data::range
unsigned short range
Definition: SiStripBadStrip.h:34
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
SiStripBadComponentsDQMServiceReader::~SiStripBadComponentsDQMServiceReader
~SiStripBadComponentsDQMServiceReader() override
Definition: SiStripBadComponentsDQMServiceReader.cc:20
edm::Event
Definition: Event.h:73
TrackerTopology::tecWheel
unsigned int tecWheel(const DetId &id) const
Definition: TrackerTopology.h:198
StripSubdetector.h
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
SiStripBadStripRcd.h
TrackerTopology::tecStereo
uint32_t tecStereo(const DetId &id) const
Definition: TrackerTopology.h:287
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackerTopology::tibLayer
unsigned int tibLayer(const DetId &id) const
Definition: TrackerTopology.h:150
TrackerTopology::tecSide
unsigned int tecSide(const DetId &id) const
Definition: TrackerTopology.h:184