CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
JetChargeProducer Class Reference

#include <JetChargeProducer.h>

Inheritance diagram for JetChargeProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef
reco::JetFloatAssociation::Container 
JetChargeCollection
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 JetChargeProducer (const edm::ParameterSet &cfg)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

JetCharge algo_
 
edm::EDGetTokenT
< reco::JetTracksAssociationCollection
srcToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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
edm::EDGetTokenT< reco::JetTracksAssociationCollection > srcToken_

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 9 of file JetChargeProducer.cc.

References algo_, JetCharge::charge(), edm::Event::getByToken(), metsig::jet, edm::Event::put(), run_regression::ret, reco::JetFloatAssociation::setValue(), srcToken_, and testEve_cfg::tracks.

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  std::auto_ptr<JetChargeCollection> ret(new JetChargeCollection());
18  iEvent.put(ret);
19  return;
20  }
21  std::auto_ptr<JetChargeCollection> ret(new JetChargeCollection(hJTAs->keyProduct()));
22  for (IT it = hJTAs->begin(), ed = hJTAs->end(); it != ed; ++it) {
23  const JetRef &jet = it->first;
24  const reco::TrackRefVector &tracks = it->second;
25  float val = static_cast<float>( algo_.charge(jet->p4(), tracks) );
27  }
28 
29  iEvent.put(ret);
30 }
double charge(const LorentzVector &lv, const reco::TrackCollection &vec) const
Definition: JetCharge.cc:7
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::Ref< JetCollection > JetRef
Definition: Jet.h:54
edm::EDGetTokenT< reco::JetTracksAssociationCollection > srcToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::vector< LinkConnSpec >::const_iterator IT
reco::JetFloatAssociation::Container JetChargeCollection
bool setValue(Container &, const reco::JetBaseRef &, float)
associate jet with value
tuple tracks
Definition: testEve_cfg.py:39

Member Data Documentation

JetCharge JetChargeProducer::algo_
private

Definition at line 21 of file JetChargeProducer.h.

Referenced by produce().

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

Definition at line 20 of file JetChargeProducer.h.

Referenced by produce().