test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ObjectMultiplicityCounter< T > Class Template Reference

Matcher of number of reconstructed objects in the event to probe. More...

Inheritance diagram for ObjectMultiplicityCounter< T >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ObjectMultiplicityCounter (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
virtual ~ObjectMultiplicityCounter ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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

StringCutObjectSelector< T, true > objCut_
 
edm::EDGetTokenT< edm::View< T > > objectsToken_
 
edm::EDGetTokenT< edm::View
< reco::Candidate > > 
probesToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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

template<typename T>
class ObjectMultiplicityCounter< T >

Matcher of number of reconstructed objects in the event to probe.

Author
Kalanand Mishra

Definition at line 27 of file ObjectMultiplicityCounter.cc.

Constructor & Destructor Documentation

template<typename T >
ObjectMultiplicityCounter< T >::ObjectMultiplicityCounter ( const edm::ParameterSet iConfig)
explicit

Definition at line 41 of file ObjectMultiplicityCounter.cc.

41  :
44  objCut_(iConfig.existsAs<std::string>("objectSelection") ? iConfig.getParameter<std::string>("objectSelection") : "", true)
45 {
46  produces<edm::ValueMap<float> >();
47 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
StringCutObjectSelector< T, true > objCut_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< T > > objectsToken_
template<typename T >
ObjectMultiplicityCounter< T >::~ObjectMultiplicityCounter ( )
virtual

Definition at line 51 of file ObjectMultiplicityCounter.cc.

52 {
53 }

Member Function Documentation

template<typename T >
void ObjectMultiplicityCounter< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 57 of file ObjectMultiplicityCounter.cc.

References KineDebug3::count(), edm::Event::getByToken(), objCut_(), edm::Event::put(), and makeHLTPrescaleTable::values.

57  {
58  using namespace edm;
59 
60  // read input
62  Handle<View<T> > objects;
63  iEvent.getByToken(probesToken_, probes);
64  iEvent.getByToken(objectsToken_, objects);
65 
66  // fill
67  float count = 0.0;
68  typename View<T>::const_iterator object, endobjects = objects->end();
69  for (object = objects->begin(); object != endobjects; ++object) {
70  if ( !(objCut_(*object)) ) continue;
71  count += 1.0;
72  }
73 
74  // prepare vector for output
75  std::vector<float> values(probes->size(), count);
76 
77  // convert into ValueMap and store
78  std::auto_ptr<ValueMap<float> > valMap(new ValueMap<float>());
79  ValueMap<float>::Filler filler(*valMap);
80  filler.insert(probes, values.begin(), values.end());
81  filler.fill();
82  iEvent.put(valMap);
83 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
StringCutObjectSelector< T, true > objCut_
edm::EDGetTokenT< edm::View< T > > objectsToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81

Member Data Documentation

template<typename T >
StringCutObjectSelector<T,true> ObjectMultiplicityCounter< T >::objCut_
private

Definition at line 37 of file ObjectMultiplicityCounter.cc.

template<typename T >
edm::EDGetTokenT<edm::View<T> > ObjectMultiplicityCounter< T >::objectsToken_
private

Definition at line 36 of file ObjectMultiplicityCounter.cc.

template<typename T >
edm::EDGetTokenT<edm::View<reco::Candidate> > ObjectMultiplicityCounter< T >::probesToken_
private

Definition at line 35 of file ObjectMultiplicityCounter.cc.