File indexing completed on 2024-04-06 12:20:50
0001 #include <memory>
0002 #include "FWCore/Framework/interface/Frameworkfwd.h"
0003 #include "FWCore/Framework/interface/stream/EDProducer.h"
0004
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/Utilities/interface/StreamID.h"
0010
0011 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h"
0012 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
0013 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThDigi.h"
0014 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
0015
0016 #include "L1Trigger/L1TMuonBarrel/interface/L1TMuonBarrelKalmanStubProcessor.h"
0017
0018
0019
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 #include "CondFormats/L1TObjects/interface/L1TMuonBarrelParams.h"
0022 #include "CondFormats/DataRecord/interface/L1TMuonBarrelParamsRcd.h"
0023 #include "CondFormats/L1TObjects/interface/L1MuDTTFMasks.h"
0024 #include "CondFormats/DataRecord/interface/L1MuDTTFMasksRcd.h"
0025
0026
0027
0028
0029
0030 class L1TMuonBarrelKalmanStubProducer : public edm::stream::EDProducer<> {
0031 public:
0032 explicit L1TMuonBarrelKalmanStubProducer(const edm::ParameterSet&);
0033 ~L1TMuonBarrelKalmanStubProducer() override;
0034
0035 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0036
0037 private:
0038 void beginStream(edm::StreamID) override;
0039 void produce(edm::Event&, const edm::EventSetup&) override;
0040 void endStream() override;
0041 const edm::EDGetTokenT<L1MuDTChambPhContainer> srcPhi_;
0042 const edm::EDGetTokenT<L1MuDTChambThContainer> srcTheta_;
0043 std::unique_ptr<L1TMuonBarrelKalmanStubProcessor> proc_;
0044 const int verbose_;
0045 const edm::ESGetToken<L1TMuonBarrelParams, L1TMuonBarrelParamsRcd> bmtfParamsToken_;
0046 const edm::EDPutTokenT<L1MuKBMTCombinedStubCollection> putToken_;
0047 };
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 L1TMuonBarrelKalmanStubProducer::L1TMuonBarrelKalmanStubProducer(const edm::ParameterSet& iConfig)
0061 : srcPhi_(consumes<L1MuDTChambPhContainer>(iConfig.getParameter<edm::InputTag>("srcPhi"))),
0062 srcTheta_(consumes<L1MuDTChambThContainer>(iConfig.getParameter<edm::InputTag>("srcTheta"))),
0063 proc_(std::make_unique<L1TMuonBarrelKalmanStubProcessor>(iConfig)),
0064 verbose_(iConfig.getParameter<int>("verbose")),
0065 bmtfParamsToken_(esConsumes()),
0066 putToken_(produces<L1MuKBMTCombinedStubCollection>()) {}
0067
0068 L1TMuonBarrelKalmanStubProducer::~L1TMuonBarrelKalmanStubProducer() {}
0069
0070
0071
0072
0073
0074
0075 void L1TMuonBarrelKalmanStubProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0076 using namespace edm;
0077 Handle<L1MuDTChambPhContainer> phiIn;
0078 iEvent.getByToken(srcPhi_, phiIn);
0079
0080 Handle<L1MuDTChambThContainer> thetaIn;
0081 iEvent.getByToken(srcTheta_, thetaIn);
0082
0083
0084
0085 const L1TMuonBarrelParams& bmtfParams = iSetup.getData(bmtfParamsToken_);
0086
0087 L1MuKBMTCombinedStubCollection stubs = proc_->makeStubs(phiIn.product(), thetaIn.product(), bmtfParams);
0088 if (verbose_ == 1)
0089 for (const auto& stub : stubs) {
0090 printf("Stub: wheel=%d sector=%d station =%d tag=%d eta1=%d qeta1=%d eta2=%d qeta2=%d\n",
0091 stub.whNum(),
0092 stub.scNum(),
0093 stub.stNum(),
0094 stub.tag(),
0095 stub.eta1(),
0096 stub.qeta1(),
0097 stub.eta2(),
0098 stub.qeta2());
0099 }
0100
0101 if (verbose_ == 2) {
0102 std::cout << "NEW" << std::endl;
0103 for (uint sector = 0; sector < 12; ++sector)
0104 proc_->makeInputPattern(phiIn.product(), thetaIn.product(), sector);
0105 }
0106
0107 iEvent.emplace(putToken_, std::move(stubs));
0108 }
0109
0110
0111 void L1TMuonBarrelKalmanStubProducer::beginStream(edm::StreamID) {}
0112
0113
0114 void L1TMuonBarrelKalmanStubProducer::endStream() {}
0115
0116 void L1TMuonBarrelKalmanStubProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0117
0118
0119 edm::ParameterSetDescription desc;
0120 desc.setUnknown();
0121 descriptions.addDefault(desc);
0122 }
0123
0124
0125 DEFINE_FWK_MODULE(L1TMuonBarrelKalmanStubProducer);