Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-11 03:56:57

0001 // system include files
0002 #include <iostream>
0003 #include <cstdio>
0004 #include <sys/time.h>
0005 
0006 // user include files
0007 #include "FWCore/Framework/interface/Frameworkfwd.h"
0008 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/Framework/interface/EventSetup.h"
0011 #include "FWCore/Framework/interface/ESHandle.h"
0012 #include "FWCore/ServiceRegistry/interface/Service.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
0016 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
0017 
0018 class SiStripNoisesReader : public edm::one::EDAnalyzer<> {
0019 public:
0020   explicit SiStripNoisesReader(const edm::ParameterSet&);
0021   ~SiStripNoisesReader() override;
0022 
0023   void analyze(const edm::Event&, const edm::EventSetup&) override;
0024 
0025 private:
0026   const uint32_t printdebug_;
0027   const edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> noisesToken_;
0028 };
0029 
0030 using namespace cms;
0031 
0032 SiStripNoisesReader::SiStripNoisesReader(const edm::ParameterSet& iConfig)
0033     : printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 1)), noisesToken_(esConsumes()) {}
0034 
0035 SiStripNoisesReader::~SiStripNoisesReader() = default;
0036 
0037 void SiStripNoisesReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) {
0038   const auto& stripNoises = iSetup.getData(noisesToken_);
0039   edm::LogInfo("SiStripNoisesReader") << "[SiStripNoisesReader::analyze] End Reading SiStripNoises" << std::endl;
0040 
0041   std::vector<uint32_t> detid;
0042   stripNoises.getDetIds(detid);
0043   edm::LogInfo("Number of detids ") << detid.size() << std::endl;
0044 
0045   if (printdebug_)
0046     for (size_t id = 0; id < detid.size() && id < printdebug_; id++) {
0047       SiStripNoises::Range range = stripNoises.getRange(detid[id]);
0048 
0049       int strip = 0;
0050       for (int it = 0; it < (range.second - range.first) * 8 / 9; it++) {
0051         edm::LogInfo("SiStripNoisesReader") << "detid " << detid[id] << " \t"
0052                                             << " strip " << strip++ << " \t" << stripNoises.getNoise(it, range)
0053                                             << " \t"
0054                                             //<< stripNoises.getDisable(it,range)   << " \t"
0055                                             << std::endl;
0056       }
0057     }
0058 }
0059 
0060 #include "FWCore/PluginManager/interface/ModuleDef.h"
0061 #include "FWCore/Framework/interface/MakerMacros.h"
0062 
0063 DEFINE_FWK_MODULE(SiStripNoisesReader);