Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:35

0001 // -*- C++ -*-
0002 //
0003 // Package:    EcalShowerContainmentCorrectionsESProducer
0004 // Class:      EcalShowerContainmentCorrectionsESProducer
0005 //
0006 /**\class EcalShowerContainmentCorrectionsESProducer
0007  EcalShowerContainmentCorrectionsESProducer.h
0008  User/EcalShowerContainmentCorrectionsESProducer/interface/EcalShowerContainmentCorrectionsESProducer.h
0009 
0010  Description: Trivial ESProducer to provide EventSetup with (hard coded)
0011               shower containment corrections
0012 
0013 
0014  \author  Stefano Argiro
0015          Created:  Mon Mar  5 08:39:12 CET 2007
0016 */
0017 
0018 // system include files
0019 #include <memory>
0020 
0021 // user include files
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 // member functions
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;  // in testbeam data sw believes we always are on sm01
0061 
0062   // where is the n of xtals per sm coded ?
0063   for (int xtal = 1; xtal <= 1700; ++xtal) {
0064     //     // from
0065     //     /afs/cern.ch/user/h/h4ecal/h4ana/data/gapCorrections/parametres_pol6_X204_2_1.out
0066 
0067     // corrections computed on module3 - (sm16, 1run)
0068 
0069     double values[] = {0.998959,  // 3x3 x right
0070                        0.00124547,
0071                        -0.000348259,
0072                        6.04065e-006,
0073                        0.999032,  // 3x3 x left
0074                        7.90628e-005,
0075                        -0.000175699,
0076                        -2.60715e-007,
0077                        //
0078                        0.999983,  // 3x3 y right
0079                        -0.000132085,
0080                        2.04773e-005,
0081                        -1.21629e-005,
0082                        1.00002,  // 3x3 y left
0083                        0.00016518,
0084                        5.36343e-005,
0085                        1.32094e-005,
0086                        //
0087                        0.998944,  // 5x5
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     // we are filling always the same group ...
0111     pEcalShowerContainmentCorrections->fillCorrectionCoefficients(id, 3, coeff);
0112   }
0113 
0114   return pEcalShowerContainmentCorrections;
0115 }
0116 
0117 // define this as a plug-in
0118 DEFINE_FWK_EVENTSETUP_MODULE(EcalShowerContainmentCorrectionsESProducer);