CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CalibCalorimetry/EcalCorrectionModules/src/EcalShowerContainmentCorrectionsESProducer.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    EcalShowerContainmentCorrectionsESProducer
00004 // Class:      EcalShowerContainmentCorrectionsESProducer
00005 // 
00017 // system include files
00018 #include <memory>
00019 #include "boost/shared_ptr.hpp"
00020 
00021 // user include files
00022 #include "FWCore/Framework/interface/ModuleFactory.h"
00023 #include "FWCore/Framework/interface/ESProducer.h"
00024 
00025 #include "FWCore/Framework/interface/ESHandle.h"
00026 
00027 #include "CondFormats/EcalCorrections/interface/EcalShowerContainmentCorrections.h"
00028 #include "CondFormats/DataRecord/interface/EcalShowerContainmentCorrectionsRcd.h"
00029 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00030 
00031 
00032 
00033 class EcalShowerContainmentCorrectionsESProducer : public edm::ESProducer {
00034 
00035    public:
00036       EcalShowerContainmentCorrectionsESProducer(const edm::ParameterSet&);
00037      ~EcalShowerContainmentCorrectionsESProducer();
00038 
00039       typedef std::auto_ptr<EcalShowerContainmentCorrections> ReturnType;
00040 
00041       ReturnType produce(const EcalShowerContainmentCorrectionsRcd&);
00042    private:
00043   
00044 
00045 };
00046 
00047 
00048 EcalShowerContainmentCorrectionsESProducer::EcalShowerContainmentCorrectionsESProducer(const edm::ParameterSet& iConfig)
00049 {   
00050    setWhatProduced(this);
00051 }
00052 
00053 
00054 EcalShowerContainmentCorrectionsESProducer::~EcalShowerContainmentCorrectionsESProducer(){ }
00055 
00056 
00057 //
00058 // member functions
00059 //
00060 
00061 EcalShowerContainmentCorrectionsESProducer::ReturnType
00062 EcalShowerContainmentCorrectionsESProducer::produce(const EcalShowerContainmentCorrectionsRcd& iRecord)
00063 {
00064 
00065    using namespace edm::es;
00066    using namespace std;
00067 
00068    auto_ptr<EcalShowerContainmentCorrections> pEcalShowerContainmentCorrections(new EcalShowerContainmentCorrections) ;
00069    int sm=1; // in testbeam data sw believes we always are on sm01
00070 
00071    // where is the n of xtals per sm coded ?
00072    for (int xtal=1; xtal<=1700 ; ++xtal){
00073 
00074      //     // from  /afs/cern.ch/user/h/h4ecal/h4ana/data/gapCorrections/parametres_pol6_X204_2_1.out
00075 
00076  // corrections computed on module3 - (sm16, 1run)
00077 
00078      double values[] = {   0.998959,       // 3x3 x right         
00079                            0.00124547,    
00080                           -0.000348259,
00081                            6.04065e-006,  
00082                            0.999032,       // 3x3 x left
00083                            7.90628e-005,
00084                           -0.000175699,
00085                            -2.60715e-007,
00086                            //
00087                            0.999983,       // 3x3 y right
00088                          -0.000132085,
00089                           2.04773e-005,
00090                          -1.21629e-005,
00091                            1.00002,        // 3x3 y left 
00092                           0.00016518,
00093                           5.36343e-005,
00094                           1.32094e-005, 
00095                            //
00096                            0.998944,      // 5x5
00097                            0.00100987,
00098                            -0.000223207,
00099                            2.15615e-006,
00100                            0.999127,   
00101                            0.000253437,
00102                            -9.80656e-005, 
00103                            1.48651e-006,
00104                            1.00006,
00105                            -0.000179675,
00106                            8.15627e-005,
00107                            -1.21549e-005,
00108                            1.00022,
00109                            0.000363728,
00110                            0.000128066,
00111                            1.54473e-005 };
00112 
00113 
00114 
00115 
00116      const size_t size = sizeof values / sizeof values[0];
00117      EcalShowerContainmentCorrections::Coefficients coeff;
00118      std::copy(values,values+size,coeff.data);
00119 
00120      EBDetId id(sm,xtal,EBDetId::SMCRYSTALMODE);
00121      
00122      // we are filling always the same group ...
00123      pEcalShowerContainmentCorrections->fillCorrectionCoefficients(id,3,coeff);
00124    }
00125 
00126    return pEcalShowerContainmentCorrections ;
00127 }
00128 
00129 //define this as a plug-in
00130 DEFINE_FWK_EVENTSETUP_MODULE(EcalShowerContainmentCorrectionsESProducer);