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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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.

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  }

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

◆ ~CosmicsMuonIdProducer()

CosmicsMuonIdProducer::~CosmicsMuonIdProducer ( )
inlineoverride

Definition at line 35 of file CosmicsMuonIdProducer.cc.

35  {
37  delete compatibilityFiller_;
38  }

References compatibilityFiller_.

Member Function Documentation

◆ produce()

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

Definition at line 50 of file CosmicsMuonIdProducer.cc.

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 }

References compatibilityFiller_, MuonCosmicCompatibilityFiller::fillCompatibility(), trigObjTnPSource_cfi::filler, muonid::findOppositeTrack(), mps_fire::i, iEvent, inputTrackCollections_, eostools::move(), HLT_FULL_cff::muon, PDWG_BPHSkim_cff::muons, muonToken_, MillePedeFileConverter_cfg::out, PDWG_EXOHSCP_cff::tracks, trackTokens_, and contentValuesCheck::values.

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().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:428
CosmicsMuonIdProducer::compatibilityFiller_
MuonCosmicCompatibilityFiller * compatibilityFiller_
Definition: CosmicsMuonIdProducer.cc:47
muon
Definition: MuonCocktails.h:17
edm::Handle< reco::MuonCollection >
MuonCosmicCompatibilityFiller::fillCompatibility
reco::MuonCosmicCompatibility fillCompatibility(const reco::Muon &muon, edm::Event &, const edm::EventSetup &)
fill cosmic compatibility variables
Definition: MuonCosmicCompatibilityFiller.cc:100
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11710
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
MuonCosmicCompatibilityFiller
Definition: MuonCosmicCompatibilityFiller.h:43
CosmicsMuonIdProducer::inputMuonCollection_
edm::InputTag inputMuonCollection_
Definition: CosmicsMuonIdProducer.cc:42
edm::ParameterSet
Definition: ParameterSet.h:47
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
CosmicsMuonIdProducer::trackTokens_
std::vector< edm::EDGetTokenT< reco::TrackCollection > > trackTokens_
Definition: CosmicsMuonIdProducer.cc:45
eostools.move
def move(src, dest)
Definition: eostools.py:511
CosmicsMuonIdProducer::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition: CosmicsMuonIdProducer.cc:44
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CosmicsMuonIdProducer::inputTrackCollections_
std::vector< edm::InputTag > inputTrackCollections_
Definition: CosmicsMuonIdProducer.cc:43
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
edm::helper::Filler
Definition: ValueMap.h:22
muonid::findOppositeTrack
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
Definition: MuonCosmicsId.cc:28
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45