CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CosmicsMuonIdProducer Class Reference
Inheritance diagram for CosmicsMuonIdProducer:
edm::stream::EDProducer<>

Public Member Functions

 CosmicsMuonIdProducer (const edm::ParameterSet &iConfig)
 
 ~CosmicsMuonIdProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

MuonCosmicCompatibilityFillercompatibilityFiller_
 
edm::InputTag inputMuonCollection_
 
std::vector< edm::InputTaginputTrackCollections_
 
edm::EDGetTokenT
< reco::MuonCollection
muonToken_
 
std::vector< edm::EDGetTokenT
< reco::TrackCollection > > 
trackTokens_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 19 of file CosmicsMuonIdProducer.cc.

Constructor & Destructor Documentation

CosmicsMuonIdProducer::CosmicsMuonIdProducer ( const edm::ParameterSet iConfig)
inline

Definition at line 21 of file CosmicsMuonIdProducer.cc.

References compatibilityFiller_, edm::ParameterSet::getParameter(), mps_fire::i, inputMuonCollection_, inputTrackCollections_, muonToken_, and trackTokens_.

22  : inputMuonCollection_(iConfig.getParameter<edm::InputTag>("muonCollection")),
23  inputTrackCollections_(iConfig.getParameter<std::vector<edm::InputTag>>("trackCollections")) {
24  edm::ConsumesCollector iC = consumesCollector();
26  new MuonCosmicCompatibilityFiller(iConfig.getParameter<edm::ParameterSet>("CosmicCompFillerParameters"), iC);
27 
28  produces<edm::ValueMap<unsigned int>>().setBranchAlias("cosmicsVeto");
29  produces<edm::ValueMap<reco::MuonCosmicCompatibility>>().setBranchAlias("cosmicCompatibility");
30 
31  muonToken_ = consumes<reco::MuonCollection>(inputMuonCollection_);
32  for (unsigned int i = 0; i < inputTrackCollections_.size(); ++i)
33  trackTokens_.push_back(consumes<reco::TrackCollection>(inputTrackCollections_.at(i)));
34  }
std::vector< edm::EDGetTokenT< reco::TrackCollection > > trackTokens_
std::vector< edm::InputTag > inputTrackCollections_
MuonCosmicCompatibilityFiller * compatibilityFiller_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::MuonCollection > muonToken_
CosmicsMuonIdProducer::~CosmicsMuonIdProducer ( )
inlineoverride

Definition at line 35 of file CosmicsMuonIdProducer.cc.

References compatibilityFiller_.

35  {
37  delete compatibilityFiller_;
38  }
MuonCosmicCompatibilityFiller * compatibilityFiller_

Member Function Documentation

void CosmicsMuonIdProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 50 of file CosmicsMuonIdProducer.cc.

References compatibilityFiller_, MuonCosmicCompatibilityFiller::fillCompatibility(), muonid::findOppositeTrack(), edm::Event::getByToken(), mps_fire::i, inputTrackCollections_, eostools::move(), HLT_FULL_cff::muon, patZpeak::muons, muonToken_, submitPVResolutionJobs::out, edm::Event::put(), tracks, trackTokens_, and makeHLTPrescaleTable::values.

50  {
52  iEvent.getByToken(muonToken_, muons);
53  // reserve some space
54  std::vector<unsigned int> values;
55  values.reserve(muons->size());
56 
57  std::vector<reco::MuonCosmicCompatibility> compValues;
58  compValues.reserve(muons->size());
59 
60  for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
61  unsigned int foundPartner(0);
62  if (muon->innerTrack().isNonnull()) {
63  for (unsigned int i = 0; i < inputTrackCollections_.size(); ++i) {
65  iEvent.getByToken(trackTokens_.at(i), tracks);
66  if (muonid::findOppositeTrack(tracks, *muon->innerTrack()).isNonnull()) {
67  foundPartner = i + 1;
68  break;
69  }
70  }
71  }
72  values.push_back(foundPartner);
73 
74  compValues.push_back(compatibilityFiller_->fillCompatibility(*muon, iEvent, iSetup));
75  }
76 
77  // create and fill value map
78  auto out = std::make_unique<edm::ValueMap<unsigned int>>();
80  filler.insert(muons, values.begin(), values.end());
81  filler.fill();
82 
83  auto outC = std::make_unique<edm::ValueMap<reco::MuonCosmicCompatibility>>();
85  fillerC.insert(muons, compValues.begin(), compValues.end());
86  fillerC.fill();
87 
88  // put value map into event
89  iEvent.put(std::move(out));
90  iEvent.put(std::move(outC));
91 }
std::vector< edm::EDGetTokenT< reco::TrackCollection > > trackTokens_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::vector< edm::InputTag > inputTrackCollections_
auto const & tracks
cannot be loose
MuonCosmicCompatibilityFiller * compatibilityFiller_
def move
Definition: eostools.py:511
reco::MuonCosmicCompatibility fillCompatibility(const reco::Muon &muon, edm::Event &, const edm::EventSetup &)
fill cosmic compatibility variables
edm::EDGetTokenT< reco::MuonCollection > muonToken_
tuple muons
Definition: patZpeak.py:39

Member Data Documentation

MuonCosmicCompatibilityFiller* CosmicsMuonIdProducer::compatibilityFiller_
private

Definition at line 47 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), produce(), and ~CosmicsMuonIdProducer().

edm::InputTag CosmicsMuonIdProducer::inputMuonCollection_
private

Definition at line 42 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer().

std::vector<edm::InputTag> CosmicsMuonIdProducer::inputTrackCollections_
private

Definition at line 43 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), and produce().

edm::EDGetTokenT<reco::MuonCollection> CosmicsMuonIdProducer::muonToken_
private

Definition at line 44 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), and produce().

std::vector<edm::EDGetTokenT<reco::TrackCollection> > CosmicsMuonIdProducer::trackTokens_
private

Definition at line 45 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), and produce().