Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:22

0001 // -*- C++ -*-
0002 //
0003 // Package:    L1CaloInputScalesProducer
0004 // Class:      L1CaloInputScalesProducer
0005 //
0006 /**\class L1CaloInputScalesProducer L1CaloInputScalesProducer.h L1TriggerConfig/RCTConfigProducers/src/L1CaloInputScalesProducer.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Jim Brooke
0015 //         Created:  Fri May 16 16:09:43 CEST 2008
0016 //
0017 //
0018 
0019 // system include files
0020 
0021 // user include files
0022 #include "FWCore/Framework/interface/ESHandle.h"
0023 #include "L1TriggerConfig/L1ScalesProducers/interface/L1CaloInputScalesProducer.h"
0024 
0025 //
0026 // class decleration
0027 //
0028 
0029 //
0030 // constants, enums and typedefs
0031 //
0032 
0033 //
0034 // static data member definitions
0035 //
0036 
0037 //
0038 // constructors and destructor
0039 //
0040 L1CaloInputScalesProducer::L1CaloInputScalesProducer(const edm::ParameterSet& iConfig) {
0041   //the following line is needed to tell the framework what
0042   // data is being produced
0043   setWhatProduced(this, &L1CaloInputScalesProducer::produceEcalScale);
0044   setWhatProduced(this, &L1CaloInputScalesProducer::produceHcalScale);
0045 
0046   //now do what ever other initialization is needed
0047 
0048   // { Et for each rank, eta bin 0 }, { Et for each rank, eta bin 1 }, ...
0049   m_ecalEtThresholdsPosEta = iConfig.getParameter<std::vector<double> >("L1EcalEtThresholdsPositiveEta");
0050   m_ecalEtThresholdsNegEta = iConfig.getParameter<std::vector<double> >("L1EcalEtThresholdsNegativeEta");
0051   m_hcalEtThresholdsPosEta = iConfig.getParameter<std::vector<double> >("L1HcalEtThresholdsPositiveEta");
0052   m_hcalEtThresholdsNegEta = iConfig.getParameter<std::vector<double> >("L1HcalEtThresholdsNegativeEta");
0053 }
0054 
0055 L1CaloInputScalesProducer::~L1CaloInputScalesProducer() {
0056   // do anything here that needs to be done at desctruction time
0057   // (e.g. close files, deallocate resources etc.)
0058 }
0059 
0060 //
0061 // member functions
0062 //
0063 
0064 // ------------ method called to produce the data  ------------
0065 std::unique_ptr<L1CaloEcalScale> L1CaloInputScalesProducer::produceEcalScale(const L1CaloEcalScaleRcd& iRecord) {
0066   auto pL1CaloEcalScale = std::make_unique<L1CaloEcalScale>();
0067 
0068   std::vector<double>::const_iterator posItr = m_ecalEtThresholdsPosEta.begin();
0069   std::vector<double>::const_iterator negItr = m_ecalEtThresholdsNegEta.begin();
0070 
0071   for (unsigned short ieta = 1; ieta <= L1CaloEcalScale::nBinEta; ++ieta) {
0072     for (unsigned short irank = 0; irank < L1CaloEcalScale::nBinRank; ++irank) {
0073       pL1CaloEcalScale->setBin(irank, ieta, 1, *posItr);
0074       pL1CaloEcalScale->setBin(irank, ieta, -1, *negItr);
0075 
0076       ++posItr;
0077       ++negItr;
0078     }
0079   }
0080 
0081   return pL1CaloEcalScale;
0082 }
0083 
0084 // ------------ method called to produce the data  ------------
0085 std::unique_ptr<L1CaloHcalScale> L1CaloInputScalesProducer::produceHcalScale(const L1CaloHcalScaleRcd& iRecord) {
0086   auto pL1CaloHcalScale = std::make_unique<L1CaloHcalScale>();
0087 
0088   std::vector<double>::const_iterator posItr = m_hcalEtThresholdsPosEta.begin();
0089 
0090   std::vector<double>::const_iterator negItr = m_hcalEtThresholdsNegEta.begin();
0091 
0092   for (unsigned short ieta = 1; ieta <= L1CaloHcalScale::nBinEta; ++ieta) {
0093     for (unsigned short irank = 0; irank < L1CaloHcalScale::nBinRank; ++irank) {
0094       pL1CaloHcalScale->setBin(irank, ieta, 1, *posItr);
0095       pL1CaloHcalScale->setBin(irank, ieta, -1, *negItr);
0096 
0097       ++posItr;
0098       ++negItr;
0099     }
0100   }
0101 
0102   return pL1CaloHcalScale;
0103 }
0104 
0105 //define this as a plug-in
0106 //DEFINE_FWK_EVENTSETUP_MODULE(L1CaloInputScalesProducer);