File indexing completed on 2024-04-06 11:57:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <memory>
0020
0021
0022 #include "FWCore/Framework/interface/ESProducer.h"
0023 #include "FWCore/Framework/interface/ModuleFactory.h"
0024
0025 #include "FWCore/Framework/interface/ESHandle.h"
0026
0027 #include "CondFormats/DataRecord/interface/EcalShowerContainmentCorrectionsRcd.h"
0028 #include "CondFormats/EcalCorrections/interface/EcalShowerContainmentCorrections.h"
0029 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0030
0031 class EcalShowerContainmentCorrectionsESProducer : public edm::ESProducer {
0032 public:
0033 EcalShowerContainmentCorrectionsESProducer(const edm::ParameterSet &);
0034 ~EcalShowerContainmentCorrectionsESProducer() override;
0035
0036 typedef std::unique_ptr<EcalShowerContainmentCorrections> ReturnType;
0037
0038 ReturnType produce(const EcalShowerContainmentCorrectionsRcd &);
0039
0040 private:
0041 };
0042
0043 EcalShowerContainmentCorrectionsESProducer::EcalShowerContainmentCorrectionsESProducer(
0044 const edm::ParameterSet &iConfig) {
0045 setWhatProduced(this);
0046 }
0047
0048 EcalShowerContainmentCorrectionsESProducer::~EcalShowerContainmentCorrectionsESProducer() {}
0049
0050
0051
0052
0053
0054 EcalShowerContainmentCorrectionsESProducer::ReturnType EcalShowerContainmentCorrectionsESProducer::produce(
0055 const EcalShowerContainmentCorrectionsRcd &iRecord) {
0056 using namespace edm::es;
0057 using namespace std;
0058
0059 auto pEcalShowerContainmentCorrections = std::make_unique<EcalShowerContainmentCorrections>();
0060 int sm = 1;
0061
0062
0063 for (int xtal = 1; xtal <= 1700; ++xtal) {
0064
0065
0066
0067
0068
0069 double values[] = {0.998959,
0070 0.00124547,
0071 -0.000348259,
0072 6.04065e-006,
0073 0.999032,
0074 7.90628e-005,
0075 -0.000175699,
0076 -2.60715e-007,
0077
0078 0.999983,
0079 -0.000132085,
0080 2.04773e-005,
0081 -1.21629e-005,
0082 1.00002,
0083 0.00016518,
0084 5.36343e-005,
0085 1.32094e-005,
0086
0087 0.998944,
0088 0.00100987,
0089 -0.000223207,
0090 2.15615e-006,
0091 0.999127,
0092 0.000253437,
0093 -9.80656e-005,
0094 1.48651e-006,
0095 1.00006,
0096 -0.000179675,
0097 8.15627e-005,
0098 -1.21549e-005,
0099 1.00022,
0100 0.000363728,
0101 0.000128066,
0102 1.54473e-005};
0103
0104 const size_t size = sizeof values / sizeof values[0];
0105 EcalShowerContainmentCorrections::Coefficients coeff;
0106 std::copy(values, values + size, coeff.data);
0107
0108 EBDetId id(sm, xtal, EBDetId::SMCRYSTALMODE);
0109
0110
0111 pEcalShowerContainmentCorrections->fillCorrectionCoefficients(id, 3, coeff);
0112 }
0113
0114 return pEcalShowerContainmentCorrections;
0115 }
0116
0117
0118 DEFINE_FWK_EVENTSETUP_MODULE(EcalShowerContainmentCorrectionsESProducer);