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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MuMuForEmbeddingSelector (const edm::ParameterSet &)
 
 ~MuMuForEmbeddingSelector ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void beginStream (edm::StreamID) override
 
virtual void endStream () override
 
virtual 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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 40 of file MuMuForEmbeddingSelector.cc.

Constructor & Destructor Documentation

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

Definition at line 74 of file MuMuForEmbeddingSelector.cc.

74  :
76 {
77  //register your products
78 /* Examples
79  produces<ExampleData2>();
80 
81  //if do put with a label
82  produces<ExampleData2>("label");
83 
84  //if you want to put into the Run
85  produces<ExampleData2,InRun>();
86 */
87  produces<edm::RefVector<pat::MuonCollection>>();
88 
89  //now do what ever other initialization is needed
90 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > ZmumuCandidates_
MuMuForEmbeddingSelector::~MuMuForEmbeddingSelector ( )

Definition at line 93 of file MuMuForEmbeddingSelector.cc.

94 {
95 
96  // do anything here that needs to be done at destruction time
97  // (e.g. close files, deallocate resources etc.)
98 
99 }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 136 of file MuMuForEmbeddingSelector.cc.

137 {
138 }
void MuMuForEmbeddingSelector::endStream ( )
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 142 of file MuMuForEmbeddingSelector.cc.

142  {
143 }
void MuMuForEmbeddingSelector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 179 of file MuMuForEmbeddingSelector.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

179  {
180  //The following says we do not know what parameters are allowed so do no validation
181  // Please change this to state exactly what you do use, even if it is no parameters
183  desc.setUnknown();
184  descriptions.addDefault(desc);
185 }
void addDefault(ParameterSetDescription const &psetDescription)
void MuMuForEmbeddingSelector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 108 of file MuMuForEmbeddingSelector.cc.

References funct::abs(), edm::View< T >::begin(), edm::RefToBase< T >::castTo(), reco::CompositeCandidate::daughter(), edm::View< T >::end(), edm::Event::getByToken(), reco::Candidate::masterClone(), eostools::move(), parseEventContent::prod, edm::Event::put(), ZMass, SelectingProcedure_cff::ZmumuCandidates, and ZmumuCandidates_.

109 {
110  using namespace edm;
111  edm::Handle< edm::View<reco::CompositeCandidate> > ZmumuCandidatesHandle;
112  iEvent.getByToken(ZmumuCandidates_, ZmumuCandidatesHandle);
113  edm::View<reco::CompositeCandidate> ZmumuCandidates = *ZmumuCandidatesHandle;
114 
115  const reco::CompositeCandidate* chosenZCand = nullptr;
116  double massDifference = -1.0;
117  for (edm::View<reco::CompositeCandidate>::const_iterator iZCand = ZmumuCandidates.begin(); iZCand != ZmumuCandidates.end(); ++iZCand)
118  {
119  if (std::abs(ZMass - iZCand->mass()) < massDifference || massDifference < 0)
120  {
121  massDifference = std::abs(ZMass - iZCand->mass());
122  chosenZCand = &(*iZCand);
123  }
124 
125  }
126  std::unique_ptr<edm::RefVector<pat::MuonCollection>> prod(new edm::RefVector<pat::MuonCollection>());
127  prod->reserve(2);
128  prod->push_back(chosenZCand->daughter(0)->masterClone().castTo<pat::MuonRef>());
129  prod->push_back(chosenZCand->daughter(1)->masterClone().castTo<pat::MuonRef>());
130  iEvent.put(std::move(prod));
131 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const_iterator begin() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual const CandidateBaseRef & masterClone() const =0
REF castTo() const
Definition: RefToBase.h:286
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > ZmumuCandidates_
const_iterator end() const
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

double MuMuForEmbeddingSelector::ZMass = 91.0
private

Definition at line 59 of file MuMuForEmbeddingSelector.cc.

Referenced by produce().

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

Definition at line 58 of file MuMuForEmbeddingSelector.cc.

Referenced by produce().