Public Member Functions | |
CosmicsMuonIdProducer (const edm::ParameterSet &iConfig) | |
virtual | ~CosmicsMuonIdProducer () |
Private Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
MuonCosmicCompatibilityFiller | compatibilityFiller_ |
edm::InputTag | inputMuonCollection_ |
std::vector< edm::InputTag > | inputTrackCollections_ |
Definition at line 19 of file CosmicsMuonIdProducer.cc.
CosmicsMuonIdProducer::CosmicsMuonIdProducer | ( | const edm::ParameterSet & | iConfig | ) | [inline] |
Definition at line 21 of file CosmicsMuonIdProducer.cc.
: inputMuonCollection_(iConfig.getParameter<edm::InputTag>("muonCollection")), inputTrackCollections_(iConfig.getParameter<std::vector<edm::InputTag> >("trackCollections")), compatibilityFiller_(iConfig.getParameter<edm::ParameterSet>("CosmicCompFillerParameters")) { produces<edm::ValueMap<unsigned int> >().setBranchAlias("cosmicsVeto"); produces<edm::ValueMap<reco::MuonCosmicCompatibility> >().setBranchAlias("cosmicCompatibility"); }
virtual CosmicsMuonIdProducer::~CosmicsMuonIdProducer | ( | ) | [inline, virtual] |
Definition at line 29 of file CosmicsMuonIdProducer.cc.
{}
void CosmicsMuonIdProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 39 of file CosmicsMuonIdProducer.cc.
References compatibilityFiller_, edm::helper::Filler< Map >::fill(), MuonCosmicCompatibilityFiller::fillCompatibility(), muonid::findOppositeTrack(), edm::Event::getByLabel(), i, inputMuonCollection_, inputTrackCollections_, edm::helper::Filler< Map >::insert(), metsig::muon, patZpeak::muons, dbtoconf::out, edm::Event::put(), testEve_cfg::tracks, and makeHLTPrescaleTable::values.
{ edm::Handle<reco::MuonCollection> muons; iEvent.getByLabel(inputMuonCollection_, muons); // reserve some space std::vector<unsigned int> values; values.reserve(muons->size()); std::vector<reco::MuonCosmicCompatibility> compValues; compValues.reserve(muons->size()); for(reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) { unsigned int foundPartner(0); if ( muon->innerTrack().isNonnull() ){ for ( unsigned int i=0; i<inputTrackCollections_.size(); ++i ) { edm::Handle<reco::TrackCollection> tracks; iEvent.getByLabel(inputTrackCollections_.at(i), tracks); if ( muonid::findOppositeTrack(tracks,*muon->innerTrack()).isNonnull() ){ foundPartner = i+1; break; } } } values.push_back(foundPartner); compValues.push_back(compatibilityFiller_.fillCompatibility(*muon, iEvent, iSetup)); } // create and fill value map std::auto_ptr<edm::ValueMap<unsigned int> > out(new edm::ValueMap<unsigned int>()); edm::ValueMap<unsigned int>::Filler filler(*out); filler.insert(muons, values.begin(), values.end()); filler.fill(); std::auto_ptr<edm::ValueMap<reco::MuonCosmicCompatibility> > outC(new edm::ValueMap<reco::MuonCosmicCompatibility>()); edm::ValueMap<reco::MuonCosmicCompatibility>::Filler fillerC(*outC); fillerC.insert(muons, compValues.begin(), compValues.end()); fillerC.fill(); // put value map into event iEvent.put(out); iEvent.put(outC); }
Definition at line 35 of file CosmicsMuonIdProducer.cc.
Referenced by produce().
Definition at line 33 of file CosmicsMuonIdProducer.cc.
Referenced by produce().
std::vector<edm::InputTag> CosmicsMuonIdProducer::inputTrackCollections_ [private] |
Definition at line 34 of file CosmicsMuonIdProducer.cc.
Referenced by produce().