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 &)
 
 ~MuMuForEmbeddingSelector () 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginStream (edm::StreamID) override
 
void endStream () override
 
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<>
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

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 72 of file MuMuForEmbeddingSelector.cc.

74  iConfig.getParameter<edm::InputTag>("ZmumuCandidatesCollection"))) {
75  //register your products
76  /* Examples
77  produces<ExampleData2>();
78 
79  //if do put with a label
80  produces<ExampleData2>("label");
81 
82  //if you want to put into the Run
83  produces<ExampleData2,InRun>();
84 */
85  produces<edm::RefVector<pat::MuonCollection>>();
86 
87  //now do what ever other initialization is needed
88 }

◆ ~MuMuForEmbeddingSelector()

MuMuForEmbeddingSelector::~MuMuForEmbeddingSelector ( )
override

Definition at line 90 of file MuMuForEmbeddingSelector.cc.

90  {
91  // do anything here that needs to be done at destruction time
92  // (e.g. close files, deallocate resources etc.)
93 }

Member Function Documentation

◆ beginStream()

void MuMuForEmbeddingSelector::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 124 of file MuMuForEmbeddingSelector.cc.

124 {}

◆ endStream()

void MuMuForEmbeddingSelector::endStream ( )
overrideprivate

Definition at line 127 of file MuMuForEmbeddingSelector.cc.

127 {}

◆ fillDescriptions()

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

Definition at line 162 of file MuMuForEmbeddingSelector.cc.

162  {
163  //The following says we do not know what parameters are allowed so do no validation
164  // Please change this to state exactly what you do use, even if it is no parameters
166  desc.setUnknown();
167  descriptions.addDefault(desc);
168 }

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

◆ produce()

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

Definition at line 100 of file MuMuForEmbeddingSelector.cc.

100  {
101  using namespace edm;
103  iEvent.getByToken(ZmumuCandidates_, ZmumuCandidatesHandle);
104  edm::View<reco::CompositeCandidate> ZmumuCandidates = *ZmumuCandidatesHandle;
105 
106  const reco::CompositeCandidate* chosenZCand = nullptr;
107  double massDifference = -1.0;
109  iZCand != ZmumuCandidates.end();
110  ++iZCand) {
111  if (std::abs(ZMass - iZCand->mass()) < massDifference || massDifference < 0) {
112  massDifference = std::abs(ZMass - iZCand->mass());
113  chosenZCand = &(*iZCand);
114  }
115  }
116  std::unique_ptr<edm::RefVector<pat::MuonCollection>> prod(new edm::RefVector<pat::MuonCollection>());
117  prod->reserve(2);
118  prod->push_back(chosenZCand->daughter(0)->masterClone().castTo<pat::MuonRef>());
119  prod->push_back(chosenZCand->daughter(1)->masterClone().castTo<pat::MuonRef>());
120  iEvent.put(std::move(prod));
121 }

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_.

Member Data Documentation

◆ ZMass

double MuMuForEmbeddingSelector::ZMass = 91.0
private

Definition at line 58 of file MuMuForEmbeddingSelector.cc.

Referenced by produce().

◆ ZmumuCandidates_

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

Definition at line 57 of file MuMuForEmbeddingSelector.cc.

Referenced by produce().

SelectingProcedure_cff.ZmumuCandidates
ZmumuCandidates
Definition: SelectingProcedure_cff.py:57
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::RefVector
Definition: EDProductfwd.h:27
edm::Handle
Definition: AssociativeIterator.h:50
MuMuForEmbeddingSelector::ZmumuCandidates_
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > ZmumuCandidates_
Definition: MuMuForEmbeddingSelector.cc:57
edm::Ref< MuonCollection >
MuMuForEmbeddingSelector::ZMass
double ZMass
Definition: MuMuForEmbeddingSelector.cc:58
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
edm::View
Definition: CaloClusterFwd.h:14
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::RefToBase::castTo
REF castTo() const
Definition: RefToBase.h:257
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
reco::Candidate::masterClone
virtual const CandidateBaseRef & masterClone() const =0
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
reco::CompositeCandidate::daughter
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
Definition: CompositeCandidate.cc:30
edm::InputTag
Definition: InputTag.h:15
reco::CompositeCandidate
Definition: CompositeCandidate.h:21