CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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)
 
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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
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

Implements edm::EDProducer.

Definition at line 55 of file ProbeMulteplicityProducer.cc.

References reco::Candidate::daughter(), edm::View< T >::end(), edm::Event::getByToken(), i, j, edm::RefToBase< T >::key(), reco::Candidate::masterClone(), bookConverter::max, pairCut_, pairs_, probeCut_, edm::Event::put(), and makeHLTPrescaleTable::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  std::auto_ptr<ValueMap<float> > valMap(new ValueMap<float>());
84  ValueMap<float>::Filler filler(*valMap);
85  filler.insert(pairs, values.begin(), values.end());
86  filler.fill();
87  iEvent.put(valMap);
88 }
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::CandidateView > pairs_
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:462
StringCutObjectSelector< reco::Candidate, true > probeCut_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
size_t key() const
Definition: RefToBase.h:250
int j
Definition: DBlmapReader.cc:9
StringCutObjectSelector< reco::Candidate, true > pairCut_
const_iterator end() const
virtual const CandidateBaseRef & masterClone() const =0

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