Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:17

0001 #include <string>
0002 #include <map>
0003 #include <vector>
0004 
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0007 #include "FWCore/Framework/interface/MakerMacros.h"
0008 #include "FWCore/Framework/interface/Event.h"
0009 #include "CondTools/RPC/interface/RPCDBSimSetUp.h"
0010 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0011 #include "CondFormats/RPCObjects/interface/RPCStripNoises.h"
0012 #include "CondFormats/DataRecord/interface/RPCStripNoisesRcd.h"
0013 
0014 class RPCStripNoisesRcdRead : public edm::one::EDAnalyzer<> {
0015 public:
0016   RPCStripNoisesRcdRead(const edm::ParameterSet& iConfig);
0017   ~RPCStripNoisesRcdRead() override;
0018   void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override;
0019 
0020 private:
0021   edm::ESGetToken<RPCStripNoises, RPCStripNoisesRcd> noise_RcdToken_;
0022 };
0023 
0024 RPCStripNoisesRcdRead::RPCStripNoisesRcdRead(const edm::ParameterSet& iConfig) : noise_RcdToken_(esConsumes()) {}
0025 
0026 RPCStripNoisesRcdRead::~RPCStripNoisesRcdRead() {}
0027 
0028 void RPCStripNoisesRcdRead::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
0029   const RPCStripNoises* noiseRcd = &evtSetup.getData(noise_RcdToken_);
0030   edm::LogInfo("RPCStripNoisesReader") << "[RPCStripNoisesReader::analyze] End Reading RPCStripNoises" << std::endl;
0031   std::vector<RPCStripNoises::NoiseItem> vnoise = noiseRcd->getVNoise();
0032   std::vector<float> vcls = noiseRcd->getCls();
0033 
0034   for (unsigned int n = 0; n < vcls.size(); ++n) {
0035     std::cout << "Cls Value: " << vcls[n] << std::endl;
0036   }
0037 
0038   int i = 1;
0039   for (std::vector<RPCStripNoises::NoiseItem>::iterator it = vnoise.begin(); it != vnoise.end(); ++it) {
0040     if (i % 96 == 0)
0041       std::cout << "DetId:  " << it->dpid << "  " << it->time << "  " << std::endl;
0042     std::cout << "                                    Noise Value: " << (it->noise) << "  " << (it->eff) << std::endl;
0043     i++;
0044   }
0045 }
0046 
0047 //define this as a plug-in
0048 DEFINE_FWK_MODULE(RPCStripNoisesRcdRead);