CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
MuMuForEmbeddingSelector Class Reference

#include <TauAnalysis/EmbeddingProducer/plugins/MuMuForEmbeddingSelector.cc>

Inheritance diagram for MuMuForEmbeddingSelector:
edm::stream::EDProducer<>

Public Member Functions

 MuMuForEmbeddingSelector (const edm::ParameterSet &)
 
- 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

double ZMass = 91.0
 
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > ZmumuCandidates_
 

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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 39 of file MuMuForEmbeddingSelector.cc.

Constructor & Destructor Documentation

◆ MuMuForEmbeddingSelector()

MuMuForEmbeddingSelector::MuMuForEmbeddingSelector ( const edm::ParameterSet iConfig)
explicit

Definition at line 64 of file MuMuForEmbeddingSelector.cc.

66  iConfig.getParameter<edm::InputTag>("ZmumuCandidatesCollection"))) {
67  //register your products
68  /* Examples
69  produces<ExampleData2>();
70 
71  //if do put with a label
72  produces<ExampleData2>("label");
73 
74  //if you want to put into the Run
75  produces<ExampleData2,InRun>();
76 */
77  produces<edm::RefVector<pat::MuonCollection>>();
78 
79  //now do what ever other initialization is needed
80 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > ZmumuCandidates_

Member Function Documentation

◆ fillDescriptions()

void MuMuForEmbeddingSelector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 111 of file MuMuForEmbeddingSelector.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

111  {
112  //The following says we do not know what parameters are allowed so do no validation
113  // Please change this to state exactly what you do use, even if it is no parameters
115  desc.setUnknown();
116  descriptions.addDefault(desc);
117 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 87 of file MuMuForEmbeddingSelector.cc.

References funct::abs(), edm::RefToBase< T >::castTo(), reco::CompositeCandidate::daughter(), iEvent, reco::Candidate::masterClone(), eostools::move(), dumpMFGeometry_cfg::prod, ZMass, SelectingProcedure_cff::ZmumuCandidates, and ZmumuCandidates_.

87  {
88  using namespace edm;
90  iEvent.getByToken(ZmumuCandidates_, ZmumuCandidatesHandle);
92 
93  const reco::CompositeCandidate* chosenZCand = nullptr;
94  double massDifference = -1.0;
96  iZCand != ZmumuCandidates.end();
97  ++iZCand) {
98  if (std::abs(ZMass - iZCand->mass()) < massDifference || massDifference < 0) {
99  massDifference = std::abs(ZMass - iZCand->mass());
100  chosenZCand = &(*iZCand);
101  }
102  }
103  std::unique_ptr<edm::RefVector<pat::MuonCollection>> prod(new edm::RefVector<pat::MuonCollection>());
104  prod->reserve(2);
105  prod->push_back(chosenZCand->daughter(0)->masterClone().castTo<pat::MuonRef>());
106  prod->push_back(chosenZCand->daughter(1)->masterClone().castTo<pat::MuonRef>());
107  iEvent.put(std::move(prod));
108 }
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
REF castTo() const
Definition: RefToBase.h:259
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > ZmumuCandidates_
def move(src, dest)
Definition: eostools.py:511
virtual const CandidateBaseRef & masterClone() const =0

Member Data Documentation

◆ ZMass

double MuMuForEmbeddingSelector::ZMass = 91.0
private

Definition at line 50 of file MuMuForEmbeddingSelector.cc.

Referenced by produce().

◆ ZmumuCandidates_

edm::EDGetTokenT<edm::View<reco::CompositeCandidate> > MuMuForEmbeddingSelector::ZmumuCandidates_
private

Definition at line 49 of file MuMuForEmbeddingSelector.cc.

Referenced by produce().