Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:28

0001 // -*- C++ -*-
0002 //
0003 // Package:    EcalGlobalShowerContainmentCorrectionsVsEtaESProducer
0004 // Class:      EcalGlobalShowerContainmentCorrectionsVsEtaESProducer
0005 //
0006 /**\class EcalGlobalShowerContainmentCorrectionsVsEtaESProducer
0007  EcalGlobalShowerContainmentCorrectionsVsEtaESProducer.h
0008  User/EcalGlobalShowerContainmentCorrectionsVsEtaESProducer/interface/EcalGlobalShowerContainmentCorrectionsVsEtaESProducer.h
0009 
0010  Description: Trivial ESProducer to provide EventSetup with (hard coded)
0011               global shower containment corrections as a function of eta
0012 
0013 
0014  \author  Paolo Meridiani
0015 */
0016 
0017 // system include files
0018 #include <memory>
0019 
0020 // user include files
0021 #include "FWCore/Framework/interface/ESProducer.h"
0022 #include "FWCore/Framework/interface/ModuleFactory.h"
0023 
0024 #include "FWCore/Framework/interface/ESHandle.h"
0025 
0026 #include "CondFormats/DataRecord/interface/EcalGlobalShowerContainmentCorrectionsVsEtaRcd.h"
0027 #include "CondFormats/EcalCorrections/interface/EcalGlobalShowerContainmentCorrectionsVsEta.h"
0028 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0029 
0030 class EcalGlobalShowerContainmentCorrectionsVsEtaESProducer : public edm::ESProducer {
0031 public:
0032   EcalGlobalShowerContainmentCorrectionsVsEtaESProducer(const edm::ParameterSet &);
0033   ~EcalGlobalShowerContainmentCorrectionsVsEtaESProducer() override;
0034 
0035   typedef std::unique_ptr<EcalGlobalShowerContainmentCorrectionsVsEta> ReturnType;
0036 
0037   ReturnType produce(const EcalGlobalShowerContainmentCorrectionsVsEtaRcd &);
0038 
0039 private:
0040 };
0041 
0042 EcalGlobalShowerContainmentCorrectionsVsEtaESProducer::EcalGlobalShowerContainmentCorrectionsVsEtaESProducer(
0043     const edm::ParameterSet &iConfig) {
0044   setWhatProduced(this);
0045 }
0046 
0047 EcalGlobalShowerContainmentCorrectionsVsEtaESProducer::~EcalGlobalShowerContainmentCorrectionsVsEtaESProducer() {}
0048 
0049 //
0050 // member functions
0051 //
0052 
0053 EcalGlobalShowerContainmentCorrectionsVsEtaESProducer::ReturnType
0054 EcalGlobalShowerContainmentCorrectionsVsEtaESProducer::produce(
0055     const EcalGlobalShowerContainmentCorrectionsVsEtaRcd &iRecord) {
0056   using namespace edm::es;
0057   using namespace std;
0058 
0059   auto pEcalGlobalShowerContainmentCorrectionsVsEta = std::make_unique<EcalGlobalShowerContainmentCorrectionsVsEta>();
0060 
0061   double values[] = {
0062       43.77,  // 3x3
0063       1.,
0064       -3.97e-006,
0065       43.77,  // 5x5
0066       1.,
0067       -3.97e-006,
0068   };
0069 
0070   const size_t size = sizeof values / sizeof values[0];
0071   EcalGlobalShowerContainmentCorrectionsVsEta::Coefficients coeff;
0072   std::copy(values, values + size, coeff.data);
0073   pEcalGlobalShowerContainmentCorrectionsVsEta->fillCorrectionCoefficients(coeff);
0074 
0075   return pEcalGlobalShowerContainmentCorrectionsVsEta;
0076 }
0077 
0078 // define this as a plug-in
0079 DEFINE_FWK_EVENTSETUP_MODULE(EcalGlobalShowerContainmentCorrectionsVsEtaESProducer);