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

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::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< reco::Candidate, true > pairCut_
 
edm::EDGetTokenT< reco::CandidateViewpairs_
 
StringCutObjectSelector< reco::Candidate, true > probeCut_
 

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

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 }
edm::EDGetTokenT< reco::CandidateView > pairs_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
StringCutObjectSelector< reco::Candidate, true > probeCut_
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 > pairCut_

◆ ~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 
)
override

Definition at line 50 of file ProbeMulteplicityProducer.cc.

References trigObjTnPSource_cfi::filler, mps_fire::i, iEvent, dqmiolumiharvest::j, SiStripPI::max, eostools::move(), pairCut_, pairs_, probeCut_, and contentValuesCheck::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>>();
84  filler.insert(pairs, values.begin(), values.end());
85  filler.fill();
86  iEvent.put(std::move(valMap));
87 }
edm::EDGetTokenT< reco::CandidateView > pairs_
StringCutObjectSelector< reco::Candidate, true > probeCut_
StringCutObjectSelector< reco::Candidate, true > pairCut_
int iEvent
Definition: GenABIO.cc:224
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
def move(src, dest)
Definition: eostools.py:511

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().