CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/L1TriggerConfig/L1ScalesProducers/src/L1CaloInputScalesProducer.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    L1CaloInputScalesProducer
00004 // Class:      L1CaloInputScalesProducer
00005 // 
00013 //
00014 // Original Author:  Jim Brooke
00015 //         Created:  Fri May 16 16:09:43 CEST 2008
00016 // $Id: L1CaloInputScalesProducer.cc,v 1.2 2008/10/20 17:11:55 bachtis Exp $
00017 //
00018 //
00019 
00020 // system include files
00021 
00022 // user include files
00023 #include "FWCore/Framework/interface/ESHandle.h"
00024 #include "L1TriggerConfig/L1ScalesProducers/interface/L1CaloInputScalesProducer.h"
00025 
00026 //
00027 // class decleration
00028 //
00029 
00030 //
00031 // constants, enums and typedefs
00032 //
00033 
00034 //
00035 // static data member definitions
00036 //
00037 
00038 //
00039 // constructors and destructor
00040 //
00041 L1CaloInputScalesProducer::L1CaloInputScalesProducer(const edm::ParameterSet& iConfig)
00042 {
00043    //the following line is needed to tell the framework what
00044    // data is being produced
00045    setWhatProduced(this, &L1CaloInputScalesProducer::produceEcalScale);
00046    setWhatProduced(this, &L1CaloInputScalesProducer::produceHcalScale);
00047 
00048    //now do what ever other initialization is needed
00049 
00050    // { Et for each rank, eta bin 0 }, { Et for each rank, eta bin 1 }, ...
00051    m_ecalEtThresholdsPosEta =
00052      iConfig.getParameter< std::vector<double> >("L1EcalEtThresholdsPositiveEta");
00053    m_ecalEtThresholdsNegEta =
00054      iConfig.getParameter< std::vector<double> >("L1EcalEtThresholdsNegativeEta");
00055    m_hcalEtThresholdsPosEta =
00056      iConfig.getParameter< std::vector<double> >("L1HcalEtThresholdsPositiveEta");
00057    m_hcalEtThresholdsNegEta =
00058      iConfig.getParameter< std::vector<double> >("L1HcalEtThresholdsNegativeEta");
00059 }
00060 
00061 
00062 L1CaloInputScalesProducer::~L1CaloInputScalesProducer()
00063 {
00064  
00065    // do anything here that needs to be done at desctruction time
00066    // (e.g. close files, deallocate resources etc.)
00067 
00068 }
00069 
00070 
00071 //
00072 // member functions
00073 //
00074 
00075 // ------------ method called to produce the data  ------------
00076 boost::shared_ptr<L1CaloEcalScale>
00077 L1CaloInputScalesProducer::produceEcalScale(const L1CaloEcalScaleRcd& iRecord)
00078 {
00079    using namespace edm::es;
00080    boost::shared_ptr<L1CaloEcalScale> pL1CaloEcalScale =
00081      boost::shared_ptr<L1CaloEcalScale>( new L1CaloEcalScale ) ;
00082 
00083    std::vector< double >::const_iterator posItr =
00084      m_ecalEtThresholdsPosEta.begin() ;
00085    std::vector< double >::const_iterator negItr =
00086      m_ecalEtThresholdsNegEta.begin() ;
00087 
00088    for( unsigned short ieta = 1 ;
00089         ieta <= L1CaloEcalScale::nBinEta ;
00090         ++ieta )
00091      {
00092        for( unsigned short irank = 0 ;
00093             irank < L1CaloEcalScale::nBinRank;
00094             ++irank )
00095          {
00096            pL1CaloEcalScale->setBin( irank, ieta, 1, *posItr ) ;
00097            pL1CaloEcalScale->setBin( irank, ieta, -1, *negItr ) ;
00098 
00099            ++posItr ;
00100            ++negItr ;
00101          }
00102      }
00103 
00104    return pL1CaloEcalScale ;
00105 }
00106 
00107 // ------------ method called to produce the data  ------------
00108 boost::shared_ptr<L1CaloHcalScale>
00109 L1CaloInputScalesProducer::produceHcalScale(const L1CaloHcalScaleRcd& iRecord)
00110 {
00111    using namespace edm::es;
00112    boost::shared_ptr<L1CaloHcalScale> pL1CaloHcalScale =
00113      boost::shared_ptr<L1CaloHcalScale>( new L1CaloHcalScale ) ;
00114 
00115    std::vector< double >::const_iterator posItr =
00116      m_hcalEtThresholdsPosEta.begin() ;
00117 
00118    std::vector< double >::const_iterator negItr =
00119      m_hcalEtThresholdsNegEta.begin() ;
00120 
00121 
00122    for( unsigned short ieta = 1 ;
00123         ieta <= L1CaloHcalScale::nBinEta ;
00124         ++ieta )
00125      {
00126        for( unsigned short irank = 0 ;
00127             irank < L1CaloHcalScale::nBinRank;
00128             ++irank )
00129          {
00130            pL1CaloHcalScale->setBin( irank, ieta, 1, *posItr ) ;
00131            pL1CaloHcalScale->setBin( irank, ieta, -1, *negItr ) ;
00132 
00133            ++posItr ;
00134            ++negItr ;
00135          }
00136      }
00137 
00138    return pL1CaloHcalScale ;
00139 }
00140 
00141 //define this as a plug-in
00142 //DEFINE_FWK_EVENTSETUP_MODULE(L1CaloInputScalesProducer);