CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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::CandidateView
pairs_
 
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
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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 ( 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 }
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:171
StringCutObjectSelector< reco::Candidate, true > probeCut_
StringCutObjectSelector< reco::Candidate, true > pairCut_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ProbeMulteplicityProducer::~ProbeMulteplicityProducer ( )
override

Definition at line 48 of file ProbeMulteplicityProducer.cc.

48 {}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 50 of file ProbeMulteplicityProducer.cc.

References reco::Candidate::daughter(), edm::Event::getByToken(), mps_fire::i, dqmiolumiharvest::j, edm::RefToBase< T >::key(), reco::Candidate::masterClone(), SiStripPI::max, eostools::move(), pairCut_, pairs_, probeCut_, edm::Event::put(), and makeHLTPrescaleTable::values.

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>>();
83  ValueMap<float>::Filler filler(*valMap);
84  filler.insert(pairs, values.begin(), values.end());
85  filler.fill();
86  iEvent.put(std::move(valMap));
87 }
edm::EDGetTokenT< reco::CandidateView > pairs_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
StringCutObjectSelector< reco::Candidate, true > probeCut_
StringCutObjectSelector< reco::Candidate, true > pairCut_
size_t key() const
Definition: RefToBase.h:219
def move
Definition: eostools.py:511
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
virtual const CandidateBaseRef & masterClone() const =0

Member Data Documentation

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

Definition at line 33 of file ProbeMulteplicityProducer.cc.

Referenced by produce().

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

Definition at line 31 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().