CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
reco::Muon::ArbitrationType arbitrationType_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::InputTag theReferenceCollection_
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
muon::AlgorithmType type_
~MuonRefProducer() override
edm::EDGetTokenT< reco::MuonCollection > muonToken_
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
MuonRefProducer(const edm::ParameterSet &)
const reco::Muon::ArbitrationType arbitrationType
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
tuple muons
Definition: patZpeak.py:41
double maxChamberDistPull_
Log< level::Warning, false > LogWarning