CMS 3D CMS Logo

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.1 2008/05/30 19:29:27 wsun 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_hcalEtThresholds =
00056      iConfig.getParameter< std::vector<double> >("L1HcalEtThresholds");
00057 }
00058 
00059 
00060 L1CaloInputScalesProducer::~L1CaloInputScalesProducer()
00061 {
00062  
00063    // do anything here that needs to be done at desctruction time
00064    // (e.g. close files, deallocate resources etc.)
00065 
00066 }
00067 
00068 
00069 //
00070 // member functions
00071 //
00072 
00073 // ------------ method called to produce the data  ------------
00074 boost::shared_ptr<L1CaloEcalScale>
00075 L1CaloInputScalesProducer::produceEcalScale(const L1CaloEcalScaleRcd& iRecord)
00076 {
00077    using namespace edm::es;
00078    boost::shared_ptr<L1CaloEcalScale> pL1CaloEcalScale =
00079      boost::shared_ptr<L1CaloEcalScale>( new L1CaloEcalScale ) ;
00080 
00081    std::vector< double >::const_iterator posItr =
00082      m_ecalEtThresholdsPosEta.begin() ;
00083    std::vector< double >::const_iterator negItr =
00084      m_ecalEtThresholdsNegEta.begin() ;
00085 
00086    for( unsigned short ieta = 1 ;
00087         ieta <= L1CaloEcalScale::nBinEta ;
00088         ++ieta )
00089      {
00090        for( unsigned short irank = 0 ;
00091             irank < L1CaloEcalScale::nBinRank;
00092             ++irank )
00093          {
00094            pL1CaloEcalScale->setBin( irank, ieta, 1, *posItr ) ;
00095            pL1CaloEcalScale->setBin( irank, ieta, -1, *negItr ) ;
00096 
00097            ++posItr ;
00098            ++negItr ;
00099          }
00100      }
00101 
00102    return pL1CaloEcalScale ;
00103 }
00104 
00105 // ------------ method called to produce the data  ------------
00106 boost::shared_ptr<L1CaloHcalScale>
00107 L1CaloInputScalesProducer::produceHcalScale(const L1CaloHcalScaleRcd& iRecord)
00108 {
00109    using namespace edm::es;
00110    boost::shared_ptr<L1CaloHcalScale> pL1CaloHcalScale =
00111      boost::shared_ptr<L1CaloHcalScale>( new L1CaloHcalScale ) ;
00112 
00113    std::vector< double >::const_iterator itr =
00114      m_hcalEtThresholds.begin() ;
00115 
00116    for( unsigned short ieta = 1 ;
00117         ieta <= L1CaloHcalScale::nBinEta ;
00118         ++ieta )
00119      {
00120        for( unsigned short irank = 0 ;
00121             irank < L1CaloHcalScale::nBinRank;
00122             ++irank )
00123          {
00124            pL1CaloHcalScale->setBin( irank, ieta, 1, *itr ) ;
00125            pL1CaloHcalScale->setBin( irank, ieta, -1, *itr ) ;
00126 
00127            ++itr ;
00128          }
00129      }
00130 
00131    return pL1CaloHcalScale ;
00132 }
00133 
00134 //define this as a plug-in
00135 //DEFINE_FWK_EVENTSETUP_MODULE(L1CaloInputScalesProducer);

Generated on Tue Jun 9 17:40:28 2009 for CMSSW by  doxygen 1.5.4