CMS 3D CMS Logo

SiPhase2BadStripChannelReader.cc
Go to the documentation of this file.
1 // user include files
13 
14 //
15 //
16 // class decleration
17 //
19 public:
21  ~SiPhase2BadStripChannelReader() override = default;
22  void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;
23 
24  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
25 
26 private:
27  const bool printverbose_;
28  const int printdebug_;
31 };
32 
34  : printverbose_(iConfig.getUntrackedParameter<bool>("printVerbose", false)),
35  printdebug_(iConfig.getUntrackedParameter<int>("printDebug", 1)),
36  label_(iConfig.getUntrackedParameter<std::string>("label", "")),
37  badStripToken_(esConsumes(edm::ESInputTag{"", label_})) {}
38 
40  edm::Event const& iEvent,
41  edm::EventSetup const& iSetup) const {
42  const auto& payload = &iSetup.getData(badStripToken_);
43 
44  edm::LogInfo("SiPhase2BadStripChannelReader")
45  << "[SiPhase2BadStripChannelReader::analyze] End Reading SiStriBadStrip with label " << label_ << std::endl;
46 
47  const TrackerTopology* ttopo = nullptr;
48 
49  std::stringstream ss;
50  if (printverbose_) {
51  payload->printDebug(ss, ttopo);
52  }
53 
54  std::vector<uint32_t> detIds;
55  payload->getDetIds(detIds);
56 
57  int countMessages{0};
58  for (const auto& d : detIds) {
60  for (std::vector<unsigned int>::const_iterator badChannel = range.first; badChannel != range.second; ++badChannel) {
61  const auto& firstStrip = payload->decodePhase2(*badChannel).firstStrip;
62  const auto& range = payload->decodePhase2(*badChannel).range;
63 
64  if (printverbose_) {
65  ss << "DetId= " << d << " Channel=" << payload->decodePhase2(*badChannel).firstStrip << ":"
66  << payload->decodePhase2(*badChannel).range << std::endl;
67  }
68 
69  if (countMessages < printdebug_) {
70  for (unsigned int index = 0; index < range; index++) {
71  std::pair<int, int> badStrip = Phase2TrackerDigi::channelToPixel(firstStrip + index);
72  ss << "DetId= " << d << " Channel= " << firstStrip + index << " -> strip (row,col)=(" << badStrip.first << ","
73  << badStrip.second << ")" << std::endl;
74  }
75  } // if doesn't exceed the maximum printout level
76  } // loop over the range
77  countMessages++;
78  } // loop over the detids
79 
80  edm::LogInfo("SiPhase2BadStripChannelReader") << ss.str() << std::endl;
81 }
82 
83 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
86  desc.setComment("Module to read SiStripBadStrip Payloads through SiPhase2OuterTrackerBadStripRcd");
87  desc.addUntracked<bool>("printVerbose", false)->setComment("if active, very verbose output");
88  desc.addUntracked<int>("printDebug", 1)->setComment("tunes the amount of debug level print-outs");
89  desc.addUntracked<std::string>("label", "")->setComment("label from which to read the payload");
90  descriptions.addWithDefaultLabel(desc);
91 }
92 
93 //define this as a plug-in
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void analyze(edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
const edm::ESGetToken< SiStripBadStrip, SiPhase2OuterTrackerBadStripRcd > badStripToken_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
d
Definition: ztail.py:151
SiPhase2BadStripChannelReader(const edm::ParameterSet &)
Log< level::Info, false > LogInfo
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)
HLT enums.
std::pair< ContainerIterator, ContainerIterator > Range
~SiPhase2BadStripChannelReader() override=default