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 
16 
18 
21 
27 
29  theReferenceCollection_ = iConfig.getParameter<edm::InputTag>("ReferenceCollection");
30  muonToken_ = consumes<reco::MuonCollection>(theReferenceCollection_);
31 
32  type_ = muon::TMLastStation; // default type
33  std::string type = iConfig.getParameter<std::string>("algorithmType");
34  if (type != "TMLastStation")
35  edm::LogWarning("MuonIdentification")
36  << "Unknown algorithm type is requested: " << type << "\nUsing the default one.";
37 
38  minNumberOfMatches_ = iConfig.getParameter<int>("minNumberOfMatchedStations");
39  maxAbsDx_ = iConfig.getParameter<double>("maxAbsDx");
40  maxAbsPullX_ = iConfig.getParameter<double>("maxAbsPullX");
41  maxAbsDy_ = iConfig.getParameter<double>("maxAbsDy");
42  maxAbsPullY_ = iConfig.getParameter<double>("maxAbsPullY");
43  maxChamberDist_ = iConfig.getParameter<double>("maxChamberDistance");
44  maxChamberDistPull_ = iConfig.getParameter<double>("maxChamberDistancePull");
45 
46  std::string arbitrationType = iConfig.getParameter<std::string>("arbitrationType");
47  if (arbitrationType == "NoArbitration")
49  else if (arbitrationType == "SegmentArbitration")
51  else if (arbitrationType == "SegmentAndTrackArbitration")
53  else {
54  edm::LogWarning("MuonIdentification")
55  << "Unknown arbitration type is requested: " << arbitrationType << "\nUsing the default one";
57  }
58  produces<edm::RefVector<std::vector<reco::Muon>>>();
59 }
60 
62 
64  auto outputCollection = std::make_unique<edm::RefVector<std::vector<reco::Muon>>>();
65 
67  iEvent.getByToken(muonToken_, muons);
68 
69  // loop over input collection
70  for (unsigned int i = 0; i < muons->size(); ++i)
71  if (muon::isGoodMuon((*muons)[i],
72  type_,
74  maxAbsDx_,
76  maxAbsDy_,
81  outputCollection->push_back(edm::RefVector<std::vector<reco::Muon>>::value_type(muons, i));
82  iEvent.put(std::move(outputCollection));
83 }
reco::Muon::ArbitrationType arbitrationType_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::InputTag theReferenceCollection_
int iEvent
Definition: GenABIO.cc:224
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
double maxChamberDistPull_
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511