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 {
31  theReferenceCollection_ = iConfig.getParameter<edm::InputTag>("ReferenceCollection");
32  muonToken_ = consumes<reco::MuonCollection> (theReferenceCollection_);
33 
34  type_ = muon::TMLastStation; // default type
35  std::string type = iConfig.getParameter<std::string>("algorithmType");
36  if ( type != "TMLastStation" )
37  edm::LogWarning("MuonIdentification") << "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") << "Unknown arbitration type is requested: " << arbitrationType << "\nUsing the default one";
57  }
58  produces<edm::RefVector<std::vector<reco::Muon> > >();
59 }
60 
61 
63 
65 {
66  auto outputCollection = std::make_unique<edm::RefVector<std::vector<reco::Muon>>>();
67 
69  iEvent.getByToken(muonToken_, muons);
70 
71  // loop over input collection
72  for ( unsigned int i=0; i<muons->size(); ++i )
73  if ( muon::isGoodMuon( (*muons)[i], type_, minNumberOfMatches_,
75  outputCollection->push_back( edm::RefVector<std::vector<reco::Muon> >::value_type(muons,i) );
76  iEvent.put(std::move(outputCollection));
77 }
reco::Muon::ArbitrationType arbitrationType_
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::InputTag theReferenceCollection_
int iEvent
Definition: GenABIO.cc:230
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 &)
double maxChamberDistPull_
def move(src, dest)
Definition: eostools.py:511