CMS 3D CMS Logo

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::MuonCollectionmuonToken_
 
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::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_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< edm::InputTag > inputTrackCollections_
MuonCosmicCompatibilityFiller * compatibilityFiller_
edm::EDGetTokenT< reco::MuonCollection > muonToken_

◆ ~CosmicsMuonIdProducer()

CosmicsMuonIdProducer::~CosmicsMuonIdProducer ( )
inlineoverride

Definition at line 35 of file CosmicsMuonIdProducer.cc.

References compatibilityFiller_.

35  {
37  delete compatibilityFiller_;
38  }
MuonCosmicCompatibilityFiller * compatibilityFiller_

Member Function Documentation

◆ produce()

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

Definition at line 50 of file CosmicsMuonIdProducer.cc.

References compatibilityFiller_, MuonCosmicCompatibilityFiller::fillCompatibility(), trigObjTnPSource_cfi::filler, muonid::findOppositeTrack(), mps_fire::i, iEvent, inputTrackCollections_, eostools::move(), HLT_2022v14_cff::muon, PDWG_BPHSkim_cff::muons, muonToken_, MillePedeFileConverter_cfg::out, tracks, trackTokens_, and contentValuesCheck::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_
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
std::vector< edm::InputTag > inputTrackCollections_
int iEvent
Definition: GenABIO.cc:224
MuonCosmicCompatibilityFiller * compatibilityFiller_
reco::MuonCosmicCompatibility fillCompatibility(const reco::Muon &muon, edm::Event &, const edm::EventSetup &)
fill cosmic compatibility variables
auto const & tracks
cannot be loose
edm::EDGetTokenT< reco::MuonCollection > muonToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ compatibilityFiller_

MuonCosmicCompatibilityFiller* CosmicsMuonIdProducer::compatibilityFiller_
private

Definition at line 47 of file CosmicsMuonIdProducer.cc.

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

◆ inputMuonCollection_

edm::InputTag CosmicsMuonIdProducer::inputMuonCollection_
private

Definition at line 42 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer().

◆ inputTrackCollections_

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

Definition at line 43 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), and produce().

◆ muonToken_

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

Definition at line 44 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), and produce().

◆ trackTokens_

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

Definition at line 45 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), and produce().