CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
JetChargeProducer Class Reference

#include <JetChargeProducer.h>

Inheritance diagram for JetChargeProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef reco::JetFloatAssociation::Container JetChargeCollection
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 JetChargeProducer (const edm::ParameterSet &cfg)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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 & itemsToGetFrom (BranchType iType) 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

const JetCharge algo_
 
const edm::EDGetTokenT< reco::JetTracksAssociationCollectionsrcToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Definition at line 13 of file JetChargeProducer.h.

Member Typedef Documentation

Definition at line 15 of file JetChargeProducer.h.

Constructor & Destructor Documentation

JetChargeProducer::JetChargeProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 3 of file JetChargeProducer.cc.

3  :
4 srcToken_(consumes<reco::JetTracksAssociationCollection>(cfg.getParameter<edm::InputTag>("src"))),
5 algo_(cfg) {
6  produces<JetChargeCollection>();
7 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > srcToken_
const JetCharge algo_

Member Function Documentation

void JetChargeProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
override

Definition at line 9 of file JetChargeProducer.cc.

References algo_, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::begin(), JetCharge::charge(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::end(), edm::Event::getByToken(), edm::RefToBaseProd< T >::isNull(), metsig::jet, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::keyProduct(), eostools::move(), edm::Event::put(), reco::JetFloatAssociation::setValue(), srcToken_, l1t::tracks, and heppy_batch::val.

9  {
11  iEvent.getByToken(srcToken_, hJTAs);
14 
15  if (hJTAs->keyProduct().isNull()) {
16  // need to work around this bug someway, altough it's not stricly my fault
17  iEvent.put(std::make_unique<JetChargeCollection>());
18  return;
19  }
20  auto ret = std::make_unique<JetChargeCollection>(hJTAs->keyProduct());
21  for (IT it = hJTAs->begin(), ed = hJTAs->end(); it != ed; ++it) {
22  const JetRef &jet = it->first;
23  const reco::TrackRefVector &tracks = it->second;
24  float val = static_cast<float>( algo_.charge(jet->p4(), tracks) );
26  }
27 
28  iEvent.put(std::move(ret));
29 }
double charge(const LorentzVector &lv, const reco::TrackCollection &vec) const
Definition: JetCharge.cc:7
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
const_iterator end() const
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > srcToken_
edm::Ref< JetBxCollection > JetRef
Definition: Jet.h:13
const JetCharge algo_
std::vector< LinkConnSpec >::const_iterator IT
bool setValue(Container &, const reco::JetBaseRef &, float)
associate jet with value
KeyRefProd const & keyProduct() const
bool isNull() const
Checks for null.
Definition: RefToBaseProd.h:68
const_iterator begin() const
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

const JetCharge JetChargeProducer::algo_
private

Definition at line 21 of file JetChargeProducer.h.

Referenced by produce().

const edm::EDGetTokenT<reco::JetTracksAssociationCollection> JetChargeProducer::srcToken_
private

Definition at line 20 of file JetChargeProducer.h.

Referenced by produce().