Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-10 01:53:44

0001 ///
0002 /// \class l1t::BXVectorInputProducer
0003 ///
0004 /// Description: Create Proper BX Vector Structure for full GT Test Vector Generation including out of time BX.
0005 ///
0006 ///              The producer takes the CAL collections with BX=0 and shifts them, inserting them at BX = -2
0007 ///              and ratcheting older BX information through BX = -1, 0, 1, 2.
0008 ///
0009 ///
0010 /// \author: B Winer OSU
0011 ///
0012 ///  Modeled after GenToInputProducer.cc
0013 
0014 // system include files
0015 #include <memory>
0016 
0017 // user include files
0018 
0019 #include "FWCore/Framework/interface/EventSetup.h"
0020 #include "FWCore/Framework/interface/Frameworkfwd.h"
0021 #include "FWCore/Framework/interface/one/EDProducer.h"
0022 #include "FWCore/Framework/interface/Event.h"
0023 #include "FWCore/Framework/interface/MakerMacros.h"
0024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0025 #include "FWCore/Utilities/interface/EDGetToken.h"
0026 #include "FWCore/Utilities/interface/InputTag.h"
0027 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0028 
0029 //#include <vector>
0030 #include "DataFormats/L1Trigger/interface/BXVector.h"
0031 
0032 #include "DataFormats/L1Trigger/interface/EGamma.h"
0033 #include "DataFormats/L1Trigger/interface/Muon.h"
0034 #include "DataFormats/L1Trigger/interface/MuonShower.h"
0035 #include "DataFormats/L1Trigger/interface/Tau.h"
0036 #include "DataFormats/L1Trigger/interface/Jet.h"
0037 #include "DataFormats/L1Trigger/interface/EtSum.h"
0038 
0039 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0040 #include "DataFormats/JetReco/interface/GenJet.h"
0041 #include "DataFormats/METReco/interface/GenMETCollection.h"
0042 #include "DataFormats/METReco/interface/GenMET.h"
0043 
0044 #include "TMath.h"
0045 
0046 using namespace std;
0047 using namespace edm;
0048 
0049 #ifndef M_PI
0050 #define M_PI 3.14159265358979323846
0051 #endif
0052 
0053 namespace l1t {
0054 
0055   //
0056   // class declaration
0057   //
0058 
0059   class BXVectorInputProducer : public one::EDProducer<> {
0060   public:
0061     explicit BXVectorInputProducer(const ParameterSet&);
0062     ~BXVectorInputProducer() override;
0063 
0064     static void fillDescriptions(ConfigurationDescriptions& descriptions);
0065 
0066   private:
0067     void produce(Event&, EventSetup const&) override;
0068 
0069     int convertPhiToHW(double iphi, int steps) const;
0070     int convertEtaToHW(double ieta, double minEta, double maxEta, int steps) const;
0071     int convertPtToHW(double ipt, int maxPt, double step) const;
0072 
0073     // ----------member data ---------------------------
0074     //std::shared_ptr<const CaloParams> m_dbpars; // Database parameters for the trigger, to be updated as needed.
0075     //std::shared_ptr<const FirmwareVersion> m_fwv;
0076     //std::shared_ptr<FirmwareVersion> m_fwv; //not const during testing.
0077 
0078     // BX parameters
0079     int bxFirst_;
0080     int bxLast_;
0081 
0082     unsigned int maxNumMuCands_;
0083     unsigned int maxNumMuShowerCands_;
0084     unsigned int maxNumJetCands_;
0085     unsigned int maxNumEGCands_;
0086     unsigned int maxNumTauCands_;
0087 
0088     double jetEtThreshold_;
0089     double tauEtThreshold_;
0090     double egEtThreshold_;
0091     double muEtThreshold_;
0092 
0093     // Control how to end the job
0094     int emptyBxTrailer_;
0095     int emptyBxEvt_;
0096     int eventCnt_;
0097 
0098     // Tokens for inputs from other parts of the L1 system
0099     edm::EDGetToken egToken;
0100     edm::EDGetToken muToken;
0101     edm::EDGetToken muShowerToken;
0102     edm::EDGetToken tauToken;
0103     edm::EDGetToken jetToken;
0104     edm::EDGetToken etsumToken;
0105 
0106     std::vector<l1t::Muon> muonVec_bxm2;
0107     std::vector<l1t::Muon> muonVec_bxm1;
0108     std::vector<l1t::Muon> muonVec_bx0;
0109     std::vector<l1t::Muon> muonVec_bxp1;
0110 
0111     std::vector<l1t::MuonShower> muonShowerVec_bxm2;
0112     std::vector<l1t::MuonShower> muonShowerVec_bxm1;
0113     std::vector<l1t::MuonShower> muonShowerVec_bx0;
0114     std::vector<l1t::MuonShower> muonShowerVec_bxp1;
0115 
0116     std::vector<l1t::EGamma> egammaVec_bxm2;
0117     std::vector<l1t::EGamma> egammaVec_bxm1;
0118     std::vector<l1t::EGamma> egammaVec_bx0;
0119     std::vector<l1t::EGamma> egammaVec_bxp1;
0120 
0121     std::vector<l1t::Tau> tauVec_bxm2;
0122     std::vector<l1t::Tau> tauVec_bxm1;
0123     std::vector<l1t::Tau> tauVec_bx0;
0124     std::vector<l1t::Tau> tauVec_bxp1;
0125 
0126     std::vector<l1t::Jet> jetVec_bxm2;
0127     std::vector<l1t::Jet> jetVec_bxm1;
0128     std::vector<l1t::Jet> jetVec_bx0;
0129     std::vector<l1t::Jet> jetVec_bxp1;
0130 
0131     std::vector<l1t::EtSum> etsumVec_bxm2;
0132     std::vector<l1t::EtSum> etsumVec_bxm1;
0133     std::vector<l1t::EtSum> etsumVec_bx0;
0134     std::vector<l1t::EtSum> etsumVec_bxp1;
0135   };
0136 
0137   //
0138   // constructors and destructor
0139   //
0140   BXVectorInputProducer::BXVectorInputProducer(const ParameterSet& iConfig) {
0141     egToken = consumes<BXVector<l1t::EGamma>>(iConfig.getParameter<InputTag>("egInputTag"));
0142     muToken = consumes<BXVector<l1t::Muon>>(iConfig.getParameter<InputTag>("muInputTag"));
0143     muShowerToken = consumes<BXVector<l1t::MuonShower>>(iConfig.getParameter<InputTag>("muShowerInputTag"));
0144     tauToken = consumes<BXVector<l1t::Tau>>(iConfig.getParameter<InputTag>("tauInputTag"));
0145     jetToken = consumes<BXVector<l1t::Jet>>(iConfig.getParameter<InputTag>("jetInputTag"));
0146     etsumToken = consumes<BXVector<l1t::EtSum>>(iConfig.getParameter<InputTag>("etsumInputTag"));
0147 
0148     // register what you produce
0149     produces<BXVector<l1t::EGamma>>();
0150     produces<BXVector<l1t::Muon>>();
0151     produces<BXVector<l1t::MuonShower>>();
0152     produces<BXVector<l1t::Tau>>();
0153     produces<BXVector<l1t::Jet>>();
0154     produces<BXVector<l1t::EtSum>>();
0155 
0156     // Setup parameters
0157     bxFirst_ = iConfig.getParameter<int>("bxFirst");
0158     bxLast_ = iConfig.getParameter<int>("bxLast");
0159 
0160     maxNumMuCands_ = iConfig.getParameter<unsigned int>("maxMuCand");
0161     maxNumMuShowerCands_ = iConfig.getParameter<unsigned int>("maxMuShowerCand");
0162     maxNumJetCands_ = iConfig.getParameter<unsigned int>("maxJetCand");
0163     maxNumEGCands_ = iConfig.getParameter<unsigned int>("maxEGCand");
0164     maxNumTauCands_ = iConfig.getParameter<unsigned int>("maxTauCand");
0165 
0166     jetEtThreshold_ = iConfig.getParameter<double>("jetEtThreshold");
0167     tauEtThreshold_ = iConfig.getParameter<double>("tauEtThreshold");
0168     egEtThreshold_ = iConfig.getParameter<double>("egEtThreshold");
0169     muEtThreshold_ = iConfig.getParameter<double>("muEtThreshold");
0170 
0171     emptyBxTrailer_ = iConfig.getParameter<int>("emptyBxTrailer");
0172     emptyBxEvt_ = iConfig.getParameter<int>("emptyBxEvt");
0173 
0174     // set cache id to zero, will be set at first beginRun:
0175     eventCnt_ = 0;
0176   }
0177 
0178   BXVectorInputProducer::~BXVectorInputProducer() {}
0179 
0180   //
0181   // member functions
0182   //
0183 
0184   // ------------ method called to produce the data ------------
0185   void BXVectorInputProducer::produce(Event& iEvent, const EventSetup& iSetup) {
0186     eventCnt_++;
0187 
0188     LogDebug("l1t|Global") << "BXVectorInputProducer::produce function called...\n";
0189 
0190     // Setup vectors
0191     std::vector<l1t::Muon> muonVec;
0192     std::vector<l1t::MuonShower> muonShowerVec;
0193     std::vector<l1t::EGamma> egammaVec;
0194     std::vector<l1t::Tau> tauVec;
0195     std::vector<l1t::Jet> jetVec;
0196     std::vector<l1t::EtSum> etsumVec;
0197 
0198     // Set the range of BX....TO DO...move to Params or determine from param set.
0199     int bxFirst = bxFirst_;
0200     int bxLast = bxLast_;
0201 
0202     //outputs
0203     std::unique_ptr<l1t::EGammaBxCollection> egammas(new l1t::EGammaBxCollection(0, bxFirst, bxLast));
0204     std::unique_ptr<l1t::MuonBxCollection> muons(new l1t::MuonBxCollection(0, bxFirst, bxLast));
0205     std::unique_ptr<l1t::MuonShowerBxCollection> muonShowers(new l1t::MuonShowerBxCollection(0, bxFirst, bxLast));
0206     std::unique_ptr<l1t::TauBxCollection> taus(new l1t::TauBxCollection(0, bxFirst, bxLast));
0207     std::unique_ptr<l1t::JetBxCollection> jets(new l1t::JetBxCollection(0, bxFirst, bxLast));
0208     std::unique_ptr<l1t::EtSumBxCollection> etsums(new l1t::EtSumBxCollection(0, bxFirst, bxLast));
0209 
0210     std::vector<int> mu_cands_index;
0211     std::vector<int> eg_cands_index;
0212     std::vector<int> tau_cands_index;
0213 
0214     // Bx to use...grab only bx=0 for now
0215     int bx = 0;
0216 
0217     // Make sure that you can get input EG
0218     Handle<BXVector<l1t::EGamma>> inputEgammas;
0219     if (iEvent.getByToken(egToken, inputEgammas)) {
0220       for (std::vector<l1t::EGamma>::const_iterator eg = inputEgammas->begin(bx); eg != inputEgammas->end(bx); ++eg) {
0221         if (eg->hwPt() > egEtThreshold_ && egammaVec.size() < maxNumEGCands_) {
0222           egammaVec.push_back((*eg));
0223         }
0224       }
0225     } else {
0226       LogTrace("l1t|Global") << ">>> input EG collection not found!" << std::endl;
0227     }
0228 
0229     // Make sure that you can get input Muons
0230     Handle<BXVector<l1t::Muon>> inputMuons;
0231     if (iEvent.getByToken(muToken, inputMuons)) {
0232       for (std::vector<l1t::Muon>::const_iterator mu = inputMuons->begin(bx); mu != inputMuons->end(bx); ++mu) {
0233         if (mu->hwPt() > muEtThreshold_ && muonVec.size() < maxNumMuCands_) {
0234           muonVec.push_back((*mu));
0235         }
0236       }
0237     } else {
0238       LogTrace("l1t|Global") << ">>> input Mu collection not found!" << std::endl;
0239     }
0240 
0241     // Make sure that you can get input Muon Showers
0242     Handle<BXVector<l1t::MuonShower>> inputMuonShowers;
0243     if (iEvent.getByToken(muToken, inputMuonShowers)) {
0244       for (std::vector<l1t::MuonShower>::const_iterator mu = inputMuonShowers->begin(bx);
0245            mu != inputMuonShowers->end(bx);
0246            ++mu) {
0247         if (mu->isValid() && muonShowerVec.size() < maxNumMuCands_) {
0248           muonShowerVec.push_back((*mu));
0249         }
0250       }
0251     } else {
0252       LogTrace("l1t|Global") << ">>> input Mu collection not found!" << std::endl;
0253     }
0254 
0255     // Make sure that you can get input Tau
0256     Handle<BXVector<l1t::Tau>> inputTaus;
0257     if (iEvent.getByToken(tauToken, inputTaus)) {
0258       for (std::vector<l1t::Tau>::const_iterator tau = inputTaus->begin(bx); tau != inputTaus->end(bx); ++tau) {
0259         if (tau->hwPt() > tauEtThreshold_ && tauVec.size() < maxNumTauCands_) {
0260           tauVec.push_back((*tau));
0261         }
0262       }
0263     } else {
0264       LogTrace("l1t|Global") << ">>> input tau collection not found!" << std::endl;
0265     }
0266 
0267     // Make sure that you can get input jet
0268     Handle<BXVector<l1t::Jet>> inputJets;
0269     if (iEvent.getByToken(jetToken, inputJets)) {
0270       for (std::vector<l1t::Jet>::const_iterator jet = inputJets->begin(bx); jet != inputJets->end(bx); ++jet) {
0271         if (jet->hwPt() > jetEtThreshold_ && jetVec.size() < maxNumJetCands_) {
0272           jetVec.push_back((*jet));
0273         }
0274       }
0275     } else {
0276       LogTrace("l1t|Global") << ">>> input jet collection not found!" << std::endl;
0277     }
0278 
0279     // Make sure that you can get input etsum
0280     Handle<BXVector<l1t::EtSum>> inputEtsums;
0281     if (iEvent.getByToken(etsumToken, inputEtsums)) {
0282       for (std::vector<l1t::EtSum>::const_iterator etsum = inputEtsums->begin(bx); etsum != inputEtsums->end(bx);
0283            ++etsum) {
0284         etsumVec.push_back((*etsum));
0285       }
0286     } else {
0287       LogTrace("l1t|Global") << ">>> input etsum collection not found!" << std::endl;
0288     }
0289 
0290     // Insert all the bx into the L1 Collections
0291     LogTrace("l1t|Global") << "Event " << eventCnt_ << " EmptyBxEvt " << emptyBxEvt_ << " emptyBxTrailer "
0292                            << emptyBxTrailer_ << " diff " << (emptyBxEvt_ - eventCnt_) << std::endl;
0293 
0294     // Fill Muons
0295     for (int iMu = 0; iMu < int(muonVec_bxm2.size()); iMu++) {
0296       muons->push_back(-2, muonVec_bxm2[iMu]);
0297     }
0298     for (int iMu = 0; iMu < int(muonVec_bxm1.size()); iMu++) {
0299       muons->push_back(-1, muonVec_bxm1[iMu]);
0300     }
0301     for (int iMu = 0; iMu < int(muonVec_bx0.size()); iMu++) {
0302       muons->push_back(0, muonVec_bx0[iMu]);
0303     }
0304     for (int iMu = 0; iMu < int(muonVec_bxp1.size()); iMu++) {
0305       muons->push_back(1, muonVec_bxp1[iMu]);
0306     }
0307     if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
0308       for (int iMu = 0; iMu < int(muonVec.size()); iMu++) {
0309         muons->push_back(2, muonVec[iMu]);
0310       }
0311     } else {
0312       // this event is part of empty trailer...clear out data
0313       muonVec.clear();
0314     }
0315 
0316     // Fill MuonShowers
0317     for (int iMuShower = 0; iMuShower < int(muonShowerVec_bxm2.size()); iMuShower++) {
0318       muonShowers->push_back(-2, muonShowerVec_bxm2[iMuShower]);
0319     }
0320     for (int iMuShower = 0; iMuShower < int(muonShowerVec_bxm1.size()); iMuShower++) {
0321       muonShowers->push_back(-1, muonShowerVec_bxm1[iMuShower]);
0322     }
0323     for (int iMuShower = 0; iMuShower < int(muonShowerVec_bx0.size()); iMuShower++) {
0324       muonShowers->push_back(0, muonShowerVec_bx0[iMuShower]);
0325     }
0326     for (int iMuShower = 0; iMuShower < int(muonShowerVec_bxp1.size()); iMuShower++) {
0327       muonShowers->push_back(1, muonShowerVec_bxp1[iMuShower]);
0328     }
0329     if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
0330       for (int iMuShower = 0; iMuShower < int(muonShowerVec.size()); iMuShower++) {
0331         muonShowers->push_back(2, muonShowerVec[iMuShower]);
0332       }
0333     } else {
0334       // this event is part of empty trailer...clear out data
0335       muonShowerVec.clear();
0336     }
0337 
0338     // Fill Egammas
0339     for (int iEG = 0; iEG < int(egammaVec_bxm2.size()); iEG++) {
0340       egammas->push_back(-2, egammaVec_bxm2[iEG]);
0341     }
0342     for (int iEG = 0; iEG < int(egammaVec_bxm1.size()); iEG++) {
0343       egammas->push_back(-1, egammaVec_bxm1[iEG]);
0344     }
0345     for (int iEG = 0; iEG < int(egammaVec_bx0.size()); iEG++) {
0346       egammas->push_back(0, egammaVec_bx0[iEG]);
0347     }
0348     for (int iEG = 0; iEG < int(egammaVec_bxp1.size()); iEG++) {
0349       egammas->push_back(1, egammaVec_bxp1[iEG]);
0350     }
0351     if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
0352       for (int iEG = 0; iEG < int(egammaVec.size()); iEG++) {
0353         egammas->push_back(2, egammaVec[iEG]);
0354       }
0355     } else {
0356       // this event is part of empty trailer...clear out data
0357       egammaVec.clear();
0358     }
0359 
0360     // Fill Taus
0361     for (int iTau = 0; iTau < int(tauVec_bxm2.size()); iTau++) {
0362       taus->push_back(-2, tauVec_bxm2[iTau]);
0363     }
0364     for (int iTau = 0; iTau < int(tauVec_bxm1.size()); iTau++) {
0365       taus->push_back(-1, tauVec_bxm1[iTau]);
0366     }
0367     for (int iTau = 0; iTau < int(tauVec_bx0.size()); iTau++) {
0368       taus->push_back(0, tauVec_bx0[iTau]);
0369     }
0370     for (int iTau = 0; iTau < int(tauVec_bxp1.size()); iTau++) {
0371       taus->push_back(1, tauVec_bxp1[iTau]);
0372     }
0373     if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
0374       for (int iTau = 0; iTau < int(tauVec.size()); iTau++) {
0375         taus->push_back(2, tauVec[iTau]);
0376       }
0377     } else {
0378       // this event is part of empty trailer...clear out data
0379       tauVec.clear();
0380     }
0381 
0382     // Fill Jets
0383     for (int iJet = 0; iJet < int(jetVec_bxm2.size()); iJet++) {
0384       jets->push_back(-2, jetVec_bxm2[iJet]);
0385     }
0386     for (int iJet = 0; iJet < int(jetVec_bxm1.size()); iJet++) {
0387       jets->push_back(-1, jetVec_bxm1[iJet]);
0388     }
0389     for (int iJet = 0; iJet < int(jetVec_bx0.size()); iJet++) {
0390       jets->push_back(0, jetVec_bx0[iJet]);
0391     }
0392     for (int iJet = 0; iJet < int(jetVec_bxp1.size()); iJet++) {
0393       jets->push_back(1, jetVec_bxp1[iJet]);
0394     }
0395     if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
0396       for (int iJet = 0; iJet < int(jetVec.size()); iJet++) {
0397         jets->push_back(2, jetVec[iJet]);
0398       }
0399     } else {
0400       // this event is part of empty trailer...clear out data
0401       jetVec.clear();
0402     }
0403 
0404     // Fill Etsums
0405     for (int iETsum = 0; iETsum < int(etsumVec_bxm2.size()); iETsum++) {
0406       etsums->push_back(-2, etsumVec_bxm2[iETsum]);
0407     }
0408     for (int iETsum = 0; iETsum < int(etsumVec_bxm1.size()); iETsum++) {
0409       etsums->push_back(-1, etsumVec_bxm1[iETsum]);
0410     }
0411     for (int iETsum = 0; iETsum < int(etsumVec_bx0.size()); iETsum++) {
0412       etsums->push_back(0, etsumVec_bx0[iETsum]);
0413     }
0414     for (int iETsum = 0; iETsum < int(etsumVec_bxp1.size()); iETsum++) {
0415       etsums->push_back(1, etsumVec_bxp1[iETsum]);
0416     }
0417     if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
0418       for (int iETsum = 0; iETsum < int(etsumVec.size()); iETsum++) {
0419         etsums->push_back(2, etsumVec[iETsum]);
0420       }
0421     } else {
0422       // this event is part of empty trailer...clear out data
0423       etsumVec.clear();
0424     }
0425 
0426     iEvent.put(std::move(egammas));
0427     iEvent.put(std::move(muons));
0428     iEvent.put(std::move(muonShowers));
0429     iEvent.put(std::move(taus));
0430     iEvent.put(std::move(jets));
0431     iEvent.put(std::move(etsums));
0432 
0433     // Now shift the bx data by one to prepare for next event.
0434     muonVec_bxm2 = muonVec_bxm1;
0435     muonShowerVec_bxm2 = muonShowerVec_bxm1;
0436     egammaVec_bxm2 = egammaVec_bxm1;
0437     tauVec_bxm2 = tauVec_bxm1;
0438     jetVec_bxm2 = jetVec_bxm1;
0439     etsumVec_bxm2 = etsumVec_bxm1;
0440 
0441     muonVec_bxm1 = muonVec_bx0;
0442     muonShowerVec_bxm1 = muonShowerVec_bx0;
0443     egammaVec_bxm1 = egammaVec_bx0;
0444     tauVec_bxm1 = tauVec_bx0;
0445     jetVec_bxm1 = jetVec_bx0;
0446     etsumVec_bxm1 = etsumVec_bx0;
0447 
0448     muonVec_bx0 = muonVec_bxp1;
0449     muonShowerVec_bx0 = muonShowerVec_bxp1;
0450     egammaVec_bx0 = egammaVec_bxp1;
0451     tauVec_bx0 = tauVec_bxp1;
0452     jetVec_bx0 = jetVec_bxp1;
0453     etsumVec_bx0 = etsumVec_bxp1;
0454 
0455     muonVec_bxp1 = muonVec;
0456     muonShowerVec_bxp1 = muonShowerVec;
0457     egammaVec_bxp1 = egammaVec;
0458     tauVec_bxp1 = tauVec;
0459     jetVec_bxp1 = jetVec;
0460     etsumVec_bxp1 = etsumVec;
0461   }
0462 
0463   // ------------ methods to convert from physical to HW values ------------
0464   int BXVectorInputProducer::convertPhiToHW(double iphi, int steps) const {
0465     double phiMax = 2 * M_PI;
0466     if (iphi < 0)
0467       iphi += 2 * M_PI;
0468     if (iphi > phiMax)
0469       iphi -= phiMax;
0470 
0471     int hwPhi = int((iphi / phiMax) * steps + 0.00001);
0472     return hwPhi;
0473   }
0474 
0475   int BXVectorInputProducer::convertEtaToHW(double ieta, double minEta, double maxEta, int steps) const {
0476     double binWidth = (maxEta - minEta) / steps;
0477 
0478     //if we are outside the limits, set error
0479     if (ieta < minEta)
0480       return 99999;  //ieta = minEta+binWidth/2.;
0481     if (ieta > maxEta)
0482       return 99999;  //ieta = maxEta-binWidth/2.;
0483 
0484     int binNum = (int)(ieta / binWidth);
0485     if (ieta < 0.)
0486       binNum--;
0487 
0488     //   unsigned int hwEta = binNum & bitMask;
0489     //   Remove masking for BXVectors...only assume in raw data
0490 
0491     return binNum;
0492   }
0493 
0494   int BXVectorInputProducer::convertPtToHW(double ipt, int maxPt, double step) const {
0495     int hwPt = int(ipt / step + 0.0001);
0496     // if above max Pt, set to largest value
0497     if (hwPt > maxPt)
0498       hwPt = maxPt;
0499 
0500     return hwPt;
0501   }
0502 
0503   // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
0504   void BXVectorInputProducer::fillDescriptions(ConfigurationDescriptions& descriptions) {
0505     //The following says we do not know what parameters are allowed so do no validation
0506     // Please change this to state exactly what you do use, even if it is no parameters
0507     ParameterSetDescription desc;
0508     desc.setUnknown();
0509     descriptions.addDefault(desc);
0510   }
0511 
0512 }  // namespace l1t
0513 
0514 //define this as a plug-in
0515 DEFINE_FWK_MODULE(l1t::BXVectorInputProducer);