CMS 3D CMS Logo

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

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

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

Public Member Functions

 ProbeMulteplicityProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
virtual ~ProbeMulteplicityProducer ()
 
- 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)
 
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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

StringCutObjectSelector< reco::Candidate, true > pairCut_
 
edm::EDGetTokenT< reco::CandidateViewpairs_
 
StringCutObjectSelector< reco::Candidate, true > probeCut_
 

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

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

Author
Kalanand Mishra

Definition at line 25 of file ProbeMulteplicityProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 39 of file ProbeMulteplicityProducer.cc.

39  :
40  pairs_(consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("pairs"))),
41  pairCut_(iConfig.existsAs<std::string>("pairSelection") ? iConfig.getParameter<std::string>("pairSelection") : "", true),
42  probeCut_(iConfig.existsAs<std::string>("probeSelection") ? iConfig.getParameter<std::string>("probeSelection") : "", true)
43 {
44  produces<edm::ValueMap<float> >();
45 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::CandidateView > pairs_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
StringCutObjectSelector< reco::Candidate, true > probeCut_
StringCutObjectSelector< reco::Candidate, true > pairCut_
ProbeMulteplicityProducer::~ProbeMulteplicityProducer ( )
virtual

Definition at line 49 of file ProbeMulteplicityProducer.cc.

50 {
51 }

Member Function Documentation

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

Definition at line 55 of file ProbeMulteplicityProducer.cc.

References DEFINE_FWK_MODULE, objects.autophobj::filler, edm::Event::getByToken(), mps_fire::i, hpstanc_transforms::max, eostools::move(), pairCut_, pairs_, probeCut_, edm::Event::put(), and MuonErrorMatrixValues_cff::values.

55  {
56  using namespace edm;
57 
58  // read input
60  iEvent.getByToken(pairs_, pairs);
61 
62  // fill
63  unsigned int i = 0;
64  std::vector<unsigned int> tagKeys;
65  std::vector<float> values;
66  View<reco::Candidate>::const_iterator pair, endpairs = pairs->end();
67  for (pair = pairs->begin(); pair != endpairs; ++pair, ++i) {
68  reco::CandidateBaseRef probeRef = pair->daughter(1)->masterClone();
69  unsigned int tagKey = pair->daughter(0)->masterClone().key();
70  unsigned int copies = 1;
71  if (pairCut_(*pair) && probeCut_(*probeRef)) {
72  for (unsigned int j = 0; j < i; ++j) if (tagKeys[j] == tagKey) copies++;
73  for (unsigned int j = 0; j < i; ++j) if (tagKeys[j] == tagKey) values[j] = copies;
74  } else {
76  copies = 0;
77  }
78  tagKeys.push_back(tagKey);
79  values.push_back(copies);
80  }
81 
82  // convert into ValueMap and store
83  auto valMap = std::make_unique<ValueMap<float>>();
85  filler.insert(pairs, values.begin(), values.end());
86  filler.fill();
87  iEvent.put(std::move(valMap));
88 }
edm::EDGetTokenT< reco::CandidateView > pairs_
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:460
StringCutObjectSelector< reco::Candidate, true > probeCut_
HLT enums.
StringCutObjectSelector< reco::Candidate, true > pairCut_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

StringCutObjectSelector<reco::Candidate,true> ProbeMulteplicityProducer::pairCut_
private

Definition at line 34 of file ProbeMulteplicityProducer.cc.

Referenced by produce().

edm::EDGetTokenT<reco::CandidateView> ProbeMulteplicityProducer::pairs_
private

Definition at line 33 of file ProbeMulteplicityProducer.cc.

Referenced by produce().

StringCutObjectSelector<reco::Candidate,true> ProbeMulteplicityProducer::probeCut_
private

Definition at line 35 of file ProbeMulteplicityProducer.cc.

Referenced by produce().