CMS 3D CMS Logo

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::stream::EDProducer<>

Public Member Functions

 ObjectMultiplicityCounter (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~ObjectMultiplicityCounter () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

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 26 of file ObjectMultiplicityCounter.cc.

Constructor & Destructor Documentation

◆ ObjectMultiplicityCounter()

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

Definition at line 40 of file ObjectMultiplicityCounter.cc.

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

◆ ~ObjectMultiplicityCounter()

template<typename T >
ObjectMultiplicityCounter< T >::~ObjectMultiplicityCounter ( )
override

Definition at line 50 of file ObjectMultiplicityCounter.cc.

50 {}

Member Function Documentation

◆ produce()

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

Definition at line 53 of file ObjectMultiplicityCounter.cc.

References submitPVResolutionJobs::count, trigObjTnPSource_cfi::filler, iEvent, eostools::move(), resolutioncreator_cfi::object, L1TPhase2Offline_cfi::objects, and contentValuesCheck::values.

53  {
54  using namespace edm;
55 
56  // read input
59  iEvent.getByToken(probesToken_, probes);
60  iEvent.getByToken(objectsToken_, objects);
61 
62  // fill
63  float count = 0.0;
64  typename View<T>::const_iterator object, endobjects = objects->end();
65  for (object = objects->begin(); object != endobjects; ++object) {
66  if (!(objCut_(*object)))
67  continue;
68  count += 1.0;
69  }
70 
71  // prepare vector for output
72  std::vector<float> values(probes->size(), count);
73 
74  // convert into ValueMap and store
75  auto valMap = std::make_unique<ValueMap<float>>();
77  filler.insert(probes, values.begin(), values.end());
78  filler.fill();
79  iEvent.put(std::move(valMap));
80 }
StringCutObjectSelector< T, true > objCut_
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::View< T > > objectsToken_
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ objCut_

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

Definition at line 36 of file ObjectMultiplicityCounter.cc.

◆ objectsToken_

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

Definition at line 35 of file ObjectMultiplicityCounter.cc.

◆ probesToken_

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

Definition at line 34 of file ObjectMultiplicityCounter.cc.