File indexing completed on 2023-03-17 11:12:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <memory>
0022 #include <fstream>
0023
0024
0025 #include "FWCore/Framework/interface/Frameworkfwd.h"
0026 #include "FWCore/Framework/interface/stream/EDProducer.h"
0027
0028 #include "FWCore/Framework/interface/Event.h"
0029 #include "FWCore/Framework/interface/MakerMacros.h"
0030
0031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0032 #include "FWCore/Utilities/interface/Exception.h"
0033 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0034
0035 #include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
0036 #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
0037
0038 #include <iostream>
0039
0040
0041
0042 using namespace l1t;
0043
0044 class L1TBMTFConverter : public edm::stream::EDProducer<> {
0045 public:
0046 explicit L1TBMTFConverter(const edm::ParameterSet&);
0047 ~L1TBMTFConverter() override;
0048
0049 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0050
0051 private:
0052 void produce(edm::Event&, const edm::EventSetup&) override;
0053
0054 void beginRun(const edm::Run&, edm::EventSetup const&) override;
0055 void endRun(const edm::Run&, edm::EventSetup const&) override;
0056 void beginLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) override;
0057 void endLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) override;
0058
0059 edm::EDGetTokenT<RegionalMuonCandBxCollection> m_barrelTfInputToken;
0060 edm::InputTag m_barrelTfInputTag;
0061 std::map<int, int> ptMap_;
0062 };
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 L1TBMTFConverter::L1TBMTFConverter(const edm::ParameterSet& iConfig) {
0076 m_barrelTfInputTag = iConfig.getParameter<edm::InputTag>("barrelTFInput");
0077 m_barrelTfInputToken = consumes<RegionalMuonCandBxCollection>(m_barrelTfInputTag);
0078
0079 produces<RegionalMuonCandBxCollection>("ConvBMTFMuons");
0080 ptMap_[0] = 0;
0081 ptMap_[1] = 0;
0082 ptMap_[2] = 3;
0083 ptMap_[3] = 4;
0084 ptMap_[4] = 5;
0085 ptMap_[5] = 6;
0086 ptMap_[6] = 7;
0087 ptMap_[7] = 8;
0088 ptMap_[8] = 9;
0089 ptMap_[9] = 10;
0090 ptMap_[10] = 12;
0091 ptMap_[11] = 14;
0092 ptMap_[12] = 16;
0093 ptMap_[13] = 20;
0094 ptMap_[14] = 24;
0095 ptMap_[15] = 28;
0096 ptMap_[16] = 32;
0097 ptMap_[17] = 36;
0098 ptMap_[18] = 40;
0099 ptMap_[19] = 50;
0100 ptMap_[20] = 60;
0101 ptMap_[21] = 70;
0102 ptMap_[22] = 80;
0103 ptMap_[23] = 90;
0104 ptMap_[24] = 100;
0105 ptMap_[25] = 120;
0106 ptMap_[26] = 140;
0107 ptMap_[27] = 160;
0108 ptMap_[28] = 180;
0109 ptMap_[29] = 200;
0110 ptMap_[30] = 240;
0111 ptMap_[31] = 280;
0112 }
0113
0114 L1TBMTFConverter::~L1TBMTFConverter() {
0115
0116
0117 }
0118
0119
0120
0121
0122
0123
0124 void L1TBMTFConverter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0125 using namespace edm;
0126
0127 std::unique_ptr<RegionalMuonCandBxCollection> convMuons(new RegionalMuonCandBxCollection());
0128
0129 Handle<RegionalMuonCandBxCollection> bmtfMuons;
0130 iEvent.getByToken(m_barrelTfInputToken, bmtfMuons);
0131 for (auto mu = bmtfMuons->begin(0); mu != bmtfMuons->end(0); ++mu) {
0132 RegionalMuonCand convMu((*mu));
0133
0134
0135
0136 int convEta = (mu->hwEta() - 32) * 3.54;
0137
0138
0139 convMu.setHwEta(convEta);
0140
0141 convMuons->push_back(0, convMu);
0142 }
0143
0144 iEvent.put(std::move(convMuons), "ConvBMTFMuons");
0145 }
0146
0147
0148 void L1TBMTFConverter::beginRun(const edm::Run&, edm::EventSetup const&) {}
0149
0150
0151 void L1TBMTFConverter::endRun(const edm::Run&, edm::EventSetup const&) {}
0152
0153
0154 void L1TBMTFConverter::beginLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) {}
0155
0156
0157 void L1TBMTFConverter::endLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) {}
0158
0159
0160 void L1TBMTFConverter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0161
0162
0163 edm::ParameterSetDescription desc;
0164 desc.setUnknown();
0165 descriptions.addDefault(desc);
0166 }
0167
0168
0169 DEFINE_FWK_MODULE(L1TBMTFConverter);