Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:33:15

0001 /**
0002  * \file EcalContainmentCorrectionAnalyzer
0003  *
0004  * Analyzer to test Shower Containment Corrections
0005  *
0006  *
0007  */
0008 
0009 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/MakerMacros.h"
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 
0014 #include "CondFormats/DataRecord/interface/EcalGlobalShowerContainmentCorrectionsVsEtaRcd.h"
0015 #include "CondFormats/EcalCorrections/interface/EcalGlobalShowerContainmentCorrectionsVsEta.h"
0016 #include "FWCore/Framework/interface/EventSetup.h"
0017 
0018 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0019 
0020 class EcalContainmentCorrectionAnalyzer : public edm::global::EDAnalyzer<> {
0021 public:
0022   explicit EcalContainmentCorrectionAnalyzer(const edm::ParameterSet &ps);
0023   ~EcalContainmentCorrectionAnalyzer() override = default;
0024 
0025   void analyze(edm::StreamID, edm::Event const &, edm::EventSetup const &) const override;
0026 
0027 protected:
0028   const edm::ESGetToken<EcalGlobalShowerContainmentCorrectionsVsEta, EcalGlobalShowerContainmentCorrectionsVsEtaRcd>
0029       esToken_;
0030 };
0031 
0032 DEFINE_FWK_MODULE(EcalContainmentCorrectionAnalyzer);
0033 
0034 EcalContainmentCorrectionAnalyzer::EcalContainmentCorrectionAnalyzer(const edm::ParameterSet &ps)
0035     : esToken_(esConsumes()) {}
0036 
0037 void EcalContainmentCorrectionAnalyzer::analyze(edm::StreamID,
0038                                                 edm::Event const &iEvent,
0039                                                 const edm::EventSetup &iSetup) const {
0040   const auto &corr = iSetup.getData(esToken_);
0041 
0042   for (int i = 1; i < 86; ++i) {
0043     EBDetId aId(i, 1, EBDetId::ETAPHIMODE);
0044     double e3x3 = corr.correction3x3(aId);
0045     double e5x5 = corr.correction5x5(aId);
0046     edm::LogVerbatim("EcalContainmentCorrectionAnalyzer")
0047         << "ieta " << aId.ieta() << " " << e3x3 << " " << e5x5 << "\n";
0048   }
0049 }