Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-17 23:36:22

0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/EventSetup.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include "CondFormats/GeometryObjects/interface/CaloSimulationParameters.h"
0006 #include "Geometry/Records/interface/HcalParametersRcd.h"
0007 #include <iostream>
0008 #include <sstream>
0009 
0010 class CaloSimParametersAnalyzer : public edm::one::EDAnalyzer<> {
0011 public:
0012   explicit CaloSimParametersAnalyzer(const edm::ParameterSet&);
0013   ~CaloSimParametersAnalyzer(void) override;
0014 
0015   void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
0016 
0017 private:
0018   edm::ESGetToken<CaloSimulationParameters, HcalParametersRcd> simparToken_;
0019 };
0020 
0021 CaloSimParametersAnalyzer::CaloSimParametersAnalyzer(const edm::ParameterSet&) {
0022   simparToken_ = esConsumes<CaloSimulationParameters, HcalParametersRcd>(edm::ESInputTag{});
0023 }
0024 
0025 CaloSimParametersAnalyzer::~CaloSimParametersAnalyzer(void) {}
0026 
0027 void CaloSimParametersAnalyzer::analyze(const edm::Event& /*iEvent*/, const edm::EventSetup& iSetup) {
0028   const auto& parS = iSetup.getData(simparToken_);
0029   const CaloSimulationParameters* parsim = &parS;
0030   if (parsim != nullptr) {
0031     std::ostringstream st1;
0032     st1 << "\ncaloNames_: ";
0033     for (const auto& it : parsim->caloNames_)
0034       st1 << it << ", ";
0035     st1 << "\nlevels_: ";
0036     for (const auto& it : parsim->levels_)
0037       st1 << it << ", ";
0038     st1 << "\nneighbours_: ";
0039     for (const auto& it : parsim->neighbours_)
0040       st1 << it << ", ";
0041     st1 << "\ninsideNames_: ";
0042     for (const auto& it : parsim->insideNames_)
0043       st1 << it << ", ";
0044     edm::LogVerbatim("HCalGeom") << st1.str();
0045 
0046     std::ostringstream st2;
0047     st2 << "\nfCaloNames_: ";
0048     for (const auto& it : parsim->fCaloNames_)
0049       st2 << it << ", ";
0050     st2 << "\nfLevels_: ";
0051     for (const auto& it : parsim->fLevels_)
0052       st2 << it << ", ";
0053     edm::LogVerbatim("HCalGeom") << st2.str();
0054   }
0055 }
0056 
0057 DEFINE_FWK_MODULE(CaloSimParametersAnalyzer);