CMS 3D CMS Logo

SiStripSummaryReader.cc
Go to the documentation of this file.
1 // user include files
12 
13 // system include files
14 #include <iostream>
15 #include <string>
16 #include <sstream>
17 #include <cstdio>
18 #include <sys/time.h>
19 
21 public:
22  explicit SiStripSummaryReader(const edm::ParameterSet&);
23  ~SiStripSummaryReader() override = default;
24 
25  void analyze(const edm::Event&, const edm::EventSetup&) override;
26 
27 private:
28  uint32_t printdebug_;
30 };
31 
33  : printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 1)), summaryToken_(esConsumes()) {}
34 
36  const auto& summary = iSetup.getData(summaryToken_);
37  edm::LogInfo("SiStripSummaryReader") << "[SiStripSummaryReader::analyze] End Reading SiStripSummary" << std::endl;
38 
39  std::vector<uint32_t> detid = summary.getDetIds();
40 
41  std::vector<std::string> userDB = summary.getUserDBContent();
42  std::stringstream ss;
43  for (size_t i = 0; i < userDB.size(); ++i)
44  ss << userDB[i] << " \n";
45 
46  if (printdebug_)
47  for (size_t id = 0; id < detid.size(); id++) {
48  ss << "\n\tdetid " << detid[id];
49  SiStripSummary::Range range = summary.getRange(detid[id]);
50 
51  size_t c = 0;
52  for (SiStripSummary::ContainerIterator it = range.first; it != range.second; ++it) {
53  ss << "\n\t\t " << userDB[c++] << " " << *it;
54  }
55  }
56  edm::LogInfo("SiStripSummaryReader") << ss.str();
57 }
58 
61 
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::pair< ContainerIterator, ContainerIterator > Range
const edm::ESGetToken< SiStripSummary, SiStripSummaryRcd > summaryToken_
void analyze(const edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SiStripSummaryReader(const edm::ParameterSet &)
Log< level::Info, false > LogInfo
~SiStripSummaryReader() override=default
std::vector< float >::const_iterator ContainerIterator