File indexing completed on 2024-04-06 12:20:47
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
0048 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0049
0050 private:
0051 void produce(edm::Event&, const edm::EventSetup&) override;
0052
0053
0054 edm::EDGetTokenT<RegionalMuonCandBxCollection> m_barrelTfInputToken;
0055 edm::InputTag m_barrelTfInputTag;
0056 std::map<int, int> ptMap_;
0057 };
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070 L1TBMTFConverter::L1TBMTFConverter(const edm::ParameterSet& iConfig) {
0071 m_barrelTfInputTag = iConfig.getParameter<edm::InputTag>("barrelTFInput");
0072 m_barrelTfInputToken = consumes<RegionalMuonCandBxCollection>(m_barrelTfInputTag);
0073
0074 produces<RegionalMuonCandBxCollection>("ConvBMTFMuons");
0075 ptMap_[0] = 0;
0076 ptMap_[1] = 0;
0077 ptMap_[2] = 3;
0078 ptMap_[3] = 4;
0079 ptMap_[4] = 5;
0080 ptMap_[5] = 6;
0081 ptMap_[6] = 7;
0082 ptMap_[7] = 8;
0083 ptMap_[8] = 9;
0084 ptMap_[9] = 10;
0085 ptMap_[10] = 12;
0086 ptMap_[11] = 14;
0087 ptMap_[12] = 16;
0088 ptMap_[13] = 20;
0089 ptMap_[14] = 24;
0090 ptMap_[15] = 28;
0091 ptMap_[16] = 32;
0092 ptMap_[17] = 36;
0093 ptMap_[18] = 40;
0094 ptMap_[19] = 50;
0095 ptMap_[20] = 60;
0096 ptMap_[21] = 70;
0097 ptMap_[22] = 80;
0098 ptMap_[23] = 90;
0099 ptMap_[24] = 100;
0100 ptMap_[25] = 120;
0101 ptMap_[26] = 140;
0102 ptMap_[27] = 160;
0103 ptMap_[28] = 180;
0104 ptMap_[29] = 200;
0105 ptMap_[30] = 240;
0106 ptMap_[31] = 280;
0107 }
0108
0109
0110
0111
0112
0113
0114 void L1TBMTFConverter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0115 using namespace edm;
0116
0117 std::unique_ptr<RegionalMuonCandBxCollection> convMuons(new RegionalMuonCandBxCollection());
0118
0119 Handle<RegionalMuonCandBxCollection> bmtfMuons;
0120 iEvent.getByToken(m_barrelTfInputToken, bmtfMuons);
0121 for (auto mu = bmtfMuons->begin(0); mu != bmtfMuons->end(0); ++mu) {
0122 RegionalMuonCand convMu((*mu));
0123
0124
0125
0126 int convEta = (mu->hwEta() - 32) * 3.54;
0127
0128
0129 convMu.setHwEta(convEta);
0130
0131 convMuons->push_back(0, convMu);
0132 }
0133
0134 iEvent.put(std::move(convMuons), "ConvBMTFMuons");
0135 }
0136
0137
0138 void L1TBMTFConverter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0139
0140
0141 edm::ParameterSetDescription desc;
0142 desc.setUnknown();
0143 descriptions.addDefault(desc);
0144 }
0145
0146
0147 DEFINE_FWK_MODULE(L1TBMTFConverter);