Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef SiStripDeDx3DReader_H
0002 #define SiStripDeDx3DReader_H
0003 
0004 // system include files
0005 //#include <memory>
0006 
0007 // user include files
0008 #include "FWCore/Framework/interface/Frameworkfwd.h"
0009 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 #include "FWCore/Framework/interface/ESHandle.h"
0013 #include "FWCore/ServiceRegistry/interface/Service.h"
0014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 #include "CondFormats/PhysicsToolsObjects/interface/Histogram3D.h"
0017 #include "CondFormats/DataRecord/interface/SiStripDeDxProton_3D_Rcd.h"
0018 
0019 #include <iostream>
0020 #include <stdio.h>
0021 #include <sys/time.h>
0022 
0023 class SiStripDeDx3DReader : public edm::one::EDAnalyzer<> {
0024 public:
0025   explicit SiStripDeDx3DReader(const edm::ParameterSet&);
0026   ~SiStripDeDx3DReader();
0027 
0028   void analyze(const edm::Event&, const edm::EventSetup&);
0029 
0030 private:
0031   const edm::ESGetToken<PhysicsTools::Calibration::HistogramD3D, SiStripDeDxProton_3D_Rcd> SiStripDeDx3DToken_;
0032   //  uint32_t printdebug_;
0033 };
0034 
0035 SiStripDeDx3DReader::SiStripDeDx3DReader(const edm::ParameterSet& iConfig) : SiStripDeDx3DToken_(esConsumes()) {}
0036 //:  printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug",1)){}
0037 
0038 SiStripDeDx3DReader::~SiStripDeDx3DReader() = default;
0039 
0040 void SiStripDeDx3DReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) {
0041   edm::ESHandle<PhysicsTools::Calibration::HistogramD3D> SiStripDeDx3D_ = iSetup.getHandle(SiStripDeDx3DToken_);
0042   edm::LogInfo("SiStripDeDx3DReader") << "[SiStripDeDx3DReader::analyze] End Reading SiStripDeDxProton_3D" << std::endl;
0043 
0044   for (int ix = 0; ix < 5; ix++) {
0045     for (int iy = 0; iy < 100; iy++) {
0046       for (int iz = 0; iz < 100; iz++) {
0047         double Got = SiStripDeDx3D_->binContent(ix, iy, iz);
0048         std::cout << " X = " << ix << "Y = " << iy << " Z = " << iz << " --> " << Got << std::endl;
0049         if (Got != ix + 2 * iy + 3 * iz)
0050           std::cout << " BUG --> expected is " << ix + 2 * iy + 3 * iz << std::endl;
0051       }
0052     }
0053   }
0054 }
0055 
0056 #include "FWCore/PluginManager/interface/ModuleDef.h"
0057 #include "FWCore/Framework/interface/MakerMacros.h"
0058 
0059 DEFINE_FWK_MODULE(SiStripDeDx3DReader);
0060 
0061 #endif