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)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~ProbeMulteplicityProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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
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
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

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

Author
Kalanand Mishra

Definition at line 23 of file ProbeMulteplicityProducer.cc.

Constructor & Destructor Documentation

◆ ProbeMulteplicityProducer()

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

Definition at line 38 of file ProbeMulteplicityProducer.cc.

39  : pairs_(consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("pairs"))),
40  pairCut_(iConfig.existsAs<std::string>("pairSelection") ? iConfig.getParameter<std::string>("pairSelection") : "",
41  true),
42  probeCut_(
43  iConfig.existsAs<std::string>("probeSelection") ? iConfig.getParameter<std::string>("probeSelection") : "",
44  true) {
45  produces<edm::ValueMap<float>>();
46 }

◆ ~ProbeMulteplicityProducer()

ProbeMulteplicityProducer::~ProbeMulteplicityProducer ( )
override

Definition at line 48 of file ProbeMulteplicityProducer.cc.

48 {}

Member Function Documentation

◆ produce()

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

Implements edm::EDProducer.

Definition at line 50 of file ProbeMulteplicityProducer.cc.

50  {
51  using namespace edm;
52 
53  // read input
55  iEvent.getByToken(pairs_, pairs);
56 
57  // fill
58  unsigned int i = 0;
59  std::vector<unsigned int> tagKeys;
60  std::vector<float> values;
61  View<reco::Candidate>::const_iterator pair, endpairs = pairs->end();
62  for (pair = pairs->begin(); pair != endpairs; ++pair, ++i) {
63  reco::CandidateBaseRef probeRef = pair->daughter(1)->masterClone();
64  unsigned int tagKey = pair->daughter(0)->masterClone().key();
65  unsigned int copies = 1;
66  if (pairCut_(*pair) && probeCut_(*probeRef)) {
67  for (unsigned int j = 0; j < i; ++j)
68  if (tagKeys[j] == tagKey)
69  copies++;
70  for (unsigned int j = 0; j < i; ++j)
71  if (tagKeys[j] == tagKey)
72  values[j] = copies;
73  } else {
75  copies = 0;
76  }
77  tagKeys.push_back(tagKey);
78  values.push_back(copies);
79  }
80 
81  // convert into ValueMap and store
82  auto valMap = std::make_unique<ValueMap<float>>();
84  filler.insert(pairs, values.begin(), values.end());
85  filler.fill();
86  iEvent.put(std::move(valMap));
87 }

References trigObjTnPSource_cfi::filler, mps_fire::i, iEvent, dqmiolumiharvest::j, SiStripPI::max, eostools::move(), pairCut_, pairs_, probeCut_, and contentValuesCheck::values.

Member Data Documentation

◆ pairCut_

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

Definition at line 33 of file ProbeMulteplicityProducer.cc.

Referenced by produce().

◆ pairs_

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

Definition at line 31 of file ProbeMulteplicityProducer.cc.

Referenced by produce().

◆ probeCut_

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

Definition at line 35 of file ProbeMulteplicityProducer.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:428
edm
HLT enums.
Definition: AlignableModifier.h:19
ProbeMulteplicityProducer::pairCut_
StringCutObjectSelector< reco::Candidate, true > pairCut_
Definition: ProbeMulteplicityProducer.cc:33
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
edm::Handle
Definition: AssociativeIterator.h:50
ProbeMulteplicityProducer::probeCut_
StringCutObjectSelector< reco::Candidate, true > probeCut_
Definition: ProbeMulteplicityProducer.cc:35
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
eostools.move
def move(src, dest)
Definition: eostools.py:511
ProbeMulteplicityProducer::pairs_
edm::EDGetTokenT< reco::CandidateView > pairs_
Definition: ProbeMulteplicityProducer.cc:31
edm::ValueMap
Definition: ValueMap.h:107
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::RefToBase< Candidate >
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::InputTag
Definition: InputTag.h:15