CMS 3D CMS Logo

MuonRefProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuonIdentification
4 // Class: MuonRefProducer
5 //
6 //
7 // Original Author: Dmytro Kovalskyi
8 //
9 //
10 
11 // user include files
13 //#include "FWCore/Framework/interface/EDProducer.h"
14 
17 
19 
22 
28 
30  theReferenceCollection_ = iConfig.getParameter<edm::InputTag>("ReferenceCollection");
31  muonToken_ = consumes<reco::MuonCollection>(theReferenceCollection_);
32 
33  type_ = muon::TMLastStation; // default type
34  std::string type = iConfig.getParameter<std::string>("algorithmType");
35  if (type != "TMLastStation")
36  edm::LogWarning("MuonIdentification")
37  << "Unknown algorithm type is requested: " << type << "\nUsing the default one.";
38 
39  minNumberOfMatches_ = iConfig.getParameter<int>("minNumberOfMatchedStations");
40  maxAbsDx_ = iConfig.getParameter<double>("maxAbsDx");
41  maxAbsPullX_ = iConfig.getParameter<double>("maxAbsPullX");
42  maxAbsDy_ = iConfig.getParameter<double>("maxAbsDy");
43  maxAbsPullY_ = iConfig.getParameter<double>("maxAbsPullY");
44  maxChamberDist_ = iConfig.getParameter<double>("maxChamberDistance");
45  maxChamberDistPull_ = iConfig.getParameter<double>("maxChamberDistancePull");
46 
47  std::string arbitrationType = iConfig.getParameter<std::string>("arbitrationType");
48  if (arbitrationType == "NoArbitration")
50  else if (arbitrationType == "SegmentArbitration")
52  else if (arbitrationType == "SegmentAndTrackArbitration")
54  else {
55  edm::LogWarning("MuonIdentification")
56  << "Unknown arbitration type is requested: " << arbitrationType << "\nUsing the default one";
58  }
59  produces<edm::RefVector<std::vector<reco::Muon>>>();
60 }
61 
63 
65  auto outputCollection = std::make_unique<edm::RefVector<std::vector<reco::Muon>>>();
66 
68  iEvent.getByToken(muonToken_, muons);
69 
70  // loop over input collection
71  for (unsigned int i = 0; i < muons->size(); ++i)
72  if (muon::isGoodMuon((*muons)[i],
73  type_,
75  maxAbsDx_,
77  maxAbsDy_,
82  outputCollection->push_back(edm::RefVector<std::vector<reco::Muon>>::value_type(muons, i));
83  iEvent.put(std::move(outputCollection));
84 }
edm::StreamID
Definition: StreamID.h:30
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
Muon.h
MessageLogger.h
reco::Muon::SegmentAndTrackArbitration
Definition: Muon.h:190
reco::Muon::SegmentArbitration
Definition: Muon.h:189
muon::TMLastStation
Definition: MuonSelectors.h:154
MuonRefProducer::~MuonRefProducer
~MuonRefProducer() override
Definition: MuonRefProducer.cc:62
edm::RefVector
Definition: EDProductfwd.h:27
edm::Handle< reco::MuonCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
MuonRefProducer::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition: MuonRefProducer.h:34
MuonRefProducer::type_
muon::AlgorithmType type_
Definition: MuonRefProducer.h:36
MuonRefProducer::maxChamberDist_
double maxChamberDist_
Definition: MuonRefProducer.h:42
muon::isGoodMuon
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
Definition: MuonSelectors.cc:649
MuonSelectors.h
MuonRefProducer.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonRefProducer::maxAbsDy_
double maxAbsDy_
Definition: MuonRefProducer.h:40
reco::Muon::NoArbitration
Definition: Muon.h:188
edm::ParameterSet
Definition: ParameterSet.h:47
MuonRefProducer::MuonRefProducer
MuonRefProducer(const edm::ParameterSet &)
Definition: MuonRefProducer.cc:29
RefVector.h
Event.h
MuonRefProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: MuonRefProducer.cc:64
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
MuonRefProducer::maxChamberDistPull_
double maxChamberDistPull_
Definition: MuonRefProducer.h:43
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
MuonRefProducer::maxAbsPullY_
double maxAbsPullY_
Definition: MuonRefProducer.h:41
MuonRefProducer::maxAbsPullX_
double maxAbsPullX_
Definition: MuonRefProducer.h:39
MuonRefProducer::maxAbsDx_
double maxAbsDx_
Definition: MuonRefProducer.h:38
eostools.move
def move(src, dest)
Definition: eostools.py:511
Ref.h
Frameworkfwd.h
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MuonRefProducer::arbitrationType_
reco::Muon::ArbitrationType arbitrationType_
Definition: MuonRefProducer.h:44
ParameterSet.h
MuonRefProducer::theReferenceCollection_
edm::InputTag theReferenceCollection_
Definition: MuonRefProducer.h:33
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
MuonRefProducer::minNumberOfMatches_
int minNumberOfMatches_
Definition: MuonRefProducer.h:37