Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:27

0001 // system includes
0002 #include <iostream>
0003 #include <stdio.h>
0004 #include <sys/time.h>
0005 
0006 // user include files
0007 #include "CondFormats/PhysicsToolsObjects/interface/Histogram2D.h"
0008 #include "CondFormats/DataRecord/interface/SiStripDeDxMipRcd.h"
0009 #include "FWCore/Framework/interface/Frameworkfwd.h"
0010 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0011 #include "FWCore/Framework/interface/Event.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "FWCore/Framework/interface/ESHandle.h"
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 
0018 class SiStripDeDxMipReader : public edm::one::EDAnalyzer<> {
0019 public:
0020   explicit SiStripDeDxMipReader(const edm::ParameterSet&);
0021   ~SiStripDeDxMipReader();
0022 
0023   void analyze(const edm::Event&, const edm::EventSetup&);
0024 
0025 private:
0026   const edm::ESGetToken<PhysicsTools::Calibration::HistogramD2D, SiStripDeDxMipRcd> SiStripDeDxMipToken_;
0027 };
0028 
0029 using namespace cms;
0030 
0031 SiStripDeDxMipReader::SiStripDeDxMipReader(const edm::ParameterSet& iConfig) : SiStripDeDxMipToken_(esConsumes()) {}
0032 
0033 SiStripDeDxMipReader::~SiStripDeDxMipReader() = default;
0034 
0035 void SiStripDeDxMipReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) {
0036   edm::ESHandle<PhysicsTools::Calibration::HistogramD2D> SiStripDeDxMip_ = iSetup.getHandle(SiStripDeDxMipToken_);
0037   edm::LogInfo("SiStripDeDxMipReader") << "[SiStripDeDxMipReader::analyze] End Reading SiStripDeDxMip" << std::endl;
0038   std::cout << SiStripDeDxMip_->numberOfBinsX() << "   " << SiStripDeDxMip_->numberOfBinsY() << std::endl;
0039   for (int ix = 0; ix < 300; ix++) {
0040     for (int iy = 0; iy < 1000; iy++) {
0041       std::cout << SiStripDeDxMip_->binContent(ix, iy) << " " << SiStripDeDxMip_->value(ix / 100., iy) << std::endl;
0042     }
0043   }
0044 }
0045 
0046 #include "FWCore/PluginManager/interface/ModuleDef.h"
0047 #include "FWCore/Framework/interface/MakerMacros.h"
0048 
0049 DEFINE_FWK_MODULE(SiStripDeDxMipReader);