Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-12 01:51:39

0001 #include "L1TMuonOverlapPhase1TrackProducer.h"
0002 
0003 #include "FWCore/Utilities/interface/EDGetToken.h"
0004 #include "FWCore/Utilities/interface/InputTag.h"
0005 
0006 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0007 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0008 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
0009 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0010 
0011 #include "DataFormats/Common/interface/DetSetVector.h"
0012 #include "SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLink.h"
0013 #include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h"
0014 #include "DataFormats/MuonData/interface/MuonDigiCollection.h"
0015 #include "SimDataFormats/DigiSimLinks/interface/DTDigiSimLink.h"
0016 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0017 
0018 #include <algorithm>
0019 #include <iostream>
0020 #include <memory>
0021 
0022 L1TMuonOverlapPhase1TrackProducer::L1TMuonOverlapPhase1TrackProducer(const edm::ParameterSet& edmParameterSet)
0023     : muStubsInputTokens(
0024           {consumes<L1MuDTChambPhContainer>(edmParameterSet.getParameter<edm::InputTag>("srcDTPh")),
0025            consumes<L1MuDTChambThContainer>(edmParameterSet.getParameter<edm::InputTag>("srcDTTh")),
0026            consumes<CSCCorrelatedLCTDigiCollection>(edmParameterSet.getParameter<edm::InputTag>("srcCSC")),
0027            consumes<RPCDigiCollection>(edmParameterSet.getParameter<edm::InputTag>("srcRPC"))}),
0028       omtfParamsEsToken(esConsumes<L1TMuonOverlapParams, L1TMuonOverlapParamsRcd, edm::Transition::BeginRun>()),
0029       muonGeometryTokens({esConsumes<RPCGeometry, MuonGeometryRecord, edm::Transition::BeginRun>(),
0030                           esConsumes<CSCGeometry, MuonGeometryRecord, edm::Transition::BeginRun>(),
0031                           esConsumes<DTGeometry, MuonGeometryRecord, edm::Transition::BeginRun>()}),
0032       magneticFieldEsToken(esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>()),
0033       propagatorEsToken(esConsumes<Propagator, TrackingComponentsRecord, edm::Transition::BeginRun>(
0034           edm::ESInputTag("", "SteppingHelixPropagatorAlong"))),
0035       //propagatorEsToken(esConsumes<Propagator, TrackingComponentsRecord, edm::Transition::BeginRun>(edmParameterSet.getParameter<edm::ESInputTag>("propagatorTag"))),
0036       omtfReconstruction(edmParameterSet, muStubsInputTokens) {
0037   produces<l1t::RegionalMuonCandBxCollection>("OMTF");
0038 
0039   if (edmParameterSet.exists("simTracksTag"))
0040     mayConsume<edm::SimTrackContainer>(edmParameterSet.getParameter<edm::InputTag>("simTracksTag"));
0041   if (edmParameterSet.exists("simVertexesTag"))
0042     mayConsume<edm::SimVertexContainer>(edmParameterSet.getParameter<edm::InputTag>("simVertexesTag"));
0043   if (edmParameterSet.exists("trackingParticleTag"))
0044     mayConsume<TrackingParticleCollection>(edmParameterSet.getParameter<edm::InputTag>("trackingParticleTag"));
0045 
0046   if (edmParameterSet.exists("rpcSimHitsInputTag"))
0047     mayConsume<edm::PSimHitContainer>(edmParameterSet.getParameter<edm::InputTag>("rpcSimHitsInputTag"));
0048   if (edmParameterSet.exists("cscSimHitsInputTag"))
0049     mayConsume<edm::PSimHitContainer>(edmParameterSet.getParameter<edm::InputTag>("cscSimHitsInputTag"));
0050   if (edmParameterSet.exists("dtSimHitsInputTag"))
0051     mayConsume<edm::PSimHitContainer>(edmParameterSet.getParameter<edm::InputTag>("dtSimHitsInputTag"));
0052 
0053   if (edmParameterSet.exists("rpcDigiSimLinkInputTag"))
0054     mayConsume<edm::DetSetVector<RPCDigiSimLink> >(
0055         edmParameterSet.getParameter<edm::InputTag>("rpcDigiSimLinkInputTag"));
0056   if (edmParameterSet.exists("cscStripDigiSimLinksInputTag"))
0057     mayConsume<edm::DetSetVector<StripDigiSimLink> >(
0058         edmParameterSet.getParameter<edm::InputTag>("cscStripDigiSimLinksInputTag"));
0059   if (edmParameterSet.exists("dtDigiSimLinksInputTag"))
0060     mayConsume<MuonDigiCollection<DTLayerId, DTDigiSimLink> >(
0061         edmParameterSet.getParameter<edm::InputTag>("dtDigiSimLinksInputTag"));
0062 }
0063 /////////////////////////////////////////////////////
0064 /////////////////////////////////////////////////////
0065 L1TMuonOverlapPhase1TrackProducer::~L1TMuonOverlapPhase1TrackProducer() {}
0066 /////////////////////////////////////////////////////
0067 /////////////////////////////////////////////////////
0068 void L1TMuonOverlapPhase1TrackProducer::beginJob() { omtfReconstruction.beginJob(); }
0069 /////////////////////////////////////////////////////
0070 /////////////////////////////////////////////////////
0071 void L1TMuonOverlapPhase1TrackProducer::endJob() { omtfReconstruction.endJob(); }
0072 /////////////////////////////////////////////////////
0073 /////////////////////////////////////////////////////
0074 void L1TMuonOverlapPhase1TrackProducer::beginRun(edm::Run const& run, edm::EventSetup const& iSetup) {
0075   omtfReconstruction.beginRun(
0076       run, iSetup, omtfParamsEsToken, muonGeometryTokens, magneticFieldEsToken, propagatorEsToken);
0077 }
0078 /////////////////////////////////////////////////////
0079 /////////////////////////////////////////////////////
0080 void L1TMuonOverlapPhase1TrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSetup) {
0081   std::ostringstream str;
0082 
0083   std::unique_ptr<l1t::RegionalMuonCandBxCollection> candidates = omtfReconstruction.reconstruct(iEvent, evSetup);
0084 
0085   iEvent.put(std::move(candidates), "OMTF");
0086 }
0087 /////////////////////////////////////////////////////
0088 /////////////////////////////////////////////////////
0089 #include "FWCore/Framework/interface/MakerMacros.h"
0090 DEFINE_FWK_MODULE(L1TMuonOverlapPhase1TrackProducer);