CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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
14 
17 
19 
23 
29 
31 {
32  theReferenceCollection_ = iConfig.getParameter<edm::InputTag>("ReferenceCollection");
33  muonToken_ = consumes<reco::MuonCollection> (theReferenceCollection_);
34 
35  type_ = muon::TMLastStation; // default type
36  std::string type = iConfig.getParameter<std::string>("algorithmType");
37  if ( type.compare("TMLastStation") != 0 )
38  edm::LogWarning("MuonIdentification") << "Unknown algorithm type is requested: " << type << "\nUsing the default one.";
39 
40  minNumberOfMatches_ = iConfig.getParameter<int>("minNumberOfMatchedStations");
41  maxAbsDx_ = iConfig.getParameter<double>("maxAbsDx");
42  maxAbsPullX_ = iConfig.getParameter<double>("maxAbsPullX");
43  maxAbsDy_ = iConfig.getParameter<double>("maxAbsDy");
44  maxAbsPullY_ = iConfig.getParameter<double>("maxAbsPullY");
45  maxChamberDist_ = iConfig.getParameter<double>("maxChamberDistance");
46  maxChamberDistPull_ = iConfig.getParameter<double>("maxChamberDistancePull");
47 
48  std::string arbitrationType = iConfig.getParameter<std::string>("arbitrationType");
49  if (arbitrationType.compare("NoArbitration")==0)
51  else if (arbitrationType.compare("SegmentArbitration")==0)
53  else if (arbitrationType.compare("SegmentAndTrackArbitration")==0)
55  else {
56  edm::LogWarning("MuonIdentification") << "Unknown arbitration type is requested: " << arbitrationType << "\nUsing the default one";
58  }
59  produces<edm::RefVector<std::vector<reco::Muon> > >();
60 }
61 
62 
64 
66 {
67  std::auto_ptr<edm::RefVector<std::vector<reco::Muon> > > outputCollection(new edm::RefVector<std::vector<reco::Muon> >);
68 
70  iEvent.getByToken(muonToken_, muons);
71 
72  // loop over input collection
73  for ( unsigned int i=0; i<muons->size(); ++i )
74  if ( muon::isGoodMuon( (*muons)[i], type_, minNumberOfMatches_,
76  outputCollection->push_back( edm::RefVector<std::vector<reco::Muon> >::value_type(muons,i) );
77  iEvent.put(outputCollection);
78 }
reco::Muon::ArbitrationType arbitrationType_
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
virtual ~MuonRefProducer()
edm::InputTag theReferenceCollection_
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
muon::AlgorithmType type_
Container::value_type value_type
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 &)
virtual void produce(edm::Event &, const edm::EventSetup &)
tuple muons
Definition: patZpeak.py:38
double maxChamberDistPull_