Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:07

0001 #include "L1TMuonOverlapPhase1TrackProducer.h"
0002 #include "FWCore/Utilities/interface/EDGetToken.h"
0003 #include "FWCore/Utilities/interface/InputTag.h"
0004 
0005 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0006 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0007 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
0008 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0009 
0010 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
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("genParticleTag"))
0047     mayConsume<reco::GenParticleCollection>(edmParameterSet.getParameter<edm::InputTag>("genParticleTag"));
0048 
0049   if (edmParameterSet.exists("rpcSimHitsInputTag"))
0050     mayConsume<edm::PSimHitContainer>(edmParameterSet.getParameter<edm::InputTag>("rpcSimHitsInputTag"));
0051   if (edmParameterSet.exists("cscSimHitsInputTag"))
0052     mayConsume<edm::PSimHitContainer>(edmParameterSet.getParameter<edm::InputTag>("cscSimHitsInputTag"));
0053   if (edmParameterSet.exists("dtSimHitsInputTag"))
0054     mayConsume<edm::PSimHitContainer>(edmParameterSet.getParameter<edm::InputTag>("dtSimHitsInputTag"));
0055 
0056   if (edmParameterSet.exists("rpcDigiSimLinkInputTag"))
0057     mayConsume<edm::DetSetVector<RPCDigiSimLink> >(
0058         edmParameterSet.getParameter<edm::InputTag>("rpcDigiSimLinkInputTag"));
0059   if (edmParameterSet.exists("cscStripDigiSimLinksInputTag"))
0060     mayConsume<edm::DetSetVector<StripDigiSimLink> >(
0061         edmParameterSet.getParameter<edm::InputTag>("cscStripDigiSimLinksInputTag"));
0062   if (edmParameterSet.exists("dtDigiSimLinksInputTag"))
0063     mayConsume<MuonDigiCollection<DTLayerId, DTDigiSimLink> >(
0064         edmParameterSet.getParameter<edm::InputTag>("dtDigiSimLinksInputTag"));
0065 }
0066 /////////////////////////////////////////////////////
0067 /////////////////////////////////////////////////////
0068 L1TMuonOverlapPhase1TrackProducer::~L1TMuonOverlapPhase1TrackProducer() {}
0069 /////////////////////////////////////////////////////
0070 /////////////////////////////////////////////////////
0071 void L1TMuonOverlapPhase1TrackProducer::beginJob() { omtfReconstruction.beginJob(); }
0072 /////////////////////////////////////////////////////
0073 /////////////////////////////////////////////////////
0074 void L1TMuonOverlapPhase1TrackProducer::endJob() { omtfReconstruction.endJob(); }
0075 /////////////////////////////////////////////////////
0076 /////////////////////////////////////////////////////
0077 void L1TMuonOverlapPhase1TrackProducer::beginRun(edm::Run const& run, edm::EventSetup const& iSetup) {
0078   omtfReconstruction.beginRun(
0079       run, iSetup, omtfParamsEsToken, muonGeometryTokens, magneticFieldEsToken, propagatorEsToken);
0080 }
0081 /////////////////////////////////////////////////////
0082 /////////////////////////////////////////////////////
0083 void L1TMuonOverlapPhase1TrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSetup) {
0084   std::ostringstream str;
0085 
0086   std::unique_ptr<l1t::RegionalMuonCandBxCollection> candidates = omtfReconstruction.reconstruct(iEvent, evSetup);
0087 
0088   iEvent.put(std::move(candidates), "OMTF");
0089 }
0090 /////////////////////////////////////////////////////
0091 /////////////////////////////////////////////////////
0092 #include "FWCore/Framework/interface/MakerMacros.h"
0093 DEFINE_FWK_MODULE(L1TMuonOverlapPhase1TrackProducer);