CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::PATCompositeCandidateProducer Class Reference

Produces the pat::CompositeCandidate. More...

#include "PhysicsTools/PatAlgos/interface/PATCompositeCandidateProducer.h"

Inheritance diagram for pat::PATCompositeCandidateProducer:
edm::stream::EDProducer<>

Public Member Functions

 PATCompositeCandidateProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PATCompositeCandidateProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

const bool addEfficiencies_
 
const bool addResolutions_
 
pat::helper::EfficiencyLoader efficiencyLoader_
 
pat::helper::KinResolutionsLoader resolutionLoader_
 
const edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > srcToken_
 
pat::PATUserDataHelper< pat::CompositeCandidateuserDataHelper_
 
const bool useUserData_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Produces the pat::CompositeCandidate.

The PATCompositeCandidateProducer produces the analysis-level pat::CompositeCandidate starting from any collection of Candidates

Author
Salvatore Rappoccio
Version
Id
PATCompositeCandidateProducer.h,v 1.3 2009/06/25 23:49:35 gpetrucc Exp

Definition at line 39 of file PATCompositeCandidateProducer.h.

Constructor & Destructor Documentation

◆ PATCompositeCandidateProducer()

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

Definition at line 19 of file PATCompositeCandidateProducer.cc.

21  useUserData_(iConfig.exists("userData")),
22  userDataHelper_(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector()),
23  addEfficiencies_(iConfig.getParameter<bool>("addEfficiencies")),
24  addResolutions_(iConfig.getParameter<bool>("addResolutions")) {
25  // Efficiency configurables
26  if (addEfficiencies_) {
28  pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
29  }
30 
31  // Resolution configurables
32  if (addResolutions_) {
34  }
35 
36  // produces vector of particles
37  produces<vector<pat::CompositeCandidate> >();
38 }

References addEfficiencies_, addResolutions_, efficiencyLoader_, edm::ParameterSet::getParameter(), and resolutionLoader_.

◆ ~PATCompositeCandidateProducer()

PATCompositeCandidateProducer::~PATCompositeCandidateProducer ( )
override

Definition at line 40 of file PATCompositeCandidateProducer.cc.

40 {}

Member Function Documentation

◆ produce()

void PATCompositeCandidateProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 42 of file PATCompositeCandidateProducer.cc.

42  {
43  // Get the vector of CompositeCandidate's from the event
45  iEvent.getByToken(srcToken_, cands);
46 
51 
52  auto myCompositeCandidates = std::make_unique<vector<pat::CompositeCandidate> >();
53 
54  if (cands.isValid()) {
55  View<reco::CompositeCandidate>::const_iterator ibegin = cands->begin(), iend = cands->end(), i = ibegin;
56  for (; i != iend; ++i) {
58 
59  if (useUserData_) {
60  userDataHelper_.add(cand, iEvent, iSetup);
61  }
62 
64  efficiencyLoader_.setEfficiencies(cand, cands->refAt(i - cands->begin()));
67 
68  myCompositeCandidates->push_back(std::move(cand));
69  }
70 
71  } // end if the two handles are valid
72 
73  iEvent.put(std::move(myCompositeCandidates));
74 }

References pat::PATUserDataHelper< ObjectType >::add(), HLT_2018_cff::cands, efficiencyLoader_, pat::helper::EfficiencyLoader::enabled(), pat::helper::KinResolutionsLoader::enabled(), mps_fire::i, iEvent, eostools::move(), pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), resolutionLoader_, pat::helper::EfficiencyLoader::setEfficiencies(), pat::helper::KinResolutionsLoader::setResolutions(), srcToken_, userDataHelper_, and useUserData_.

Member Data Documentation

◆ addEfficiencies_

const bool pat::PATCompositeCandidateProducer::addEfficiencies_
private

Definition at line 53 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer().

◆ addResolutions_

const bool pat::PATCompositeCandidateProducer::addResolutions_
private

Definition at line 56 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer().

◆ efficiencyLoader_

pat::helper::EfficiencyLoader pat::PATCompositeCandidateProducer::efficiencyLoader_
private

Definition at line 54 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer(), and produce().

◆ resolutionLoader_

pat::helper::KinResolutionsLoader pat::PATCompositeCandidateProducer::resolutionLoader_
private

Definition at line 57 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer(), and produce().

◆ srcToken_

const edm::EDGetTokenT<edm::View<reco::CompositeCandidate> > pat::PATCompositeCandidateProducer::srcToken_
private

Definition at line 48 of file PATCompositeCandidateProducer.h.

Referenced by produce().

◆ userDataHelper_

pat::PATUserDataHelper<pat::CompositeCandidate> pat::PATCompositeCandidateProducer::userDataHelper_
private

Definition at line 51 of file PATCompositeCandidateProducer.h.

Referenced by produce().

◆ useUserData_

const bool pat::PATCompositeCandidateProducer::useUserData_
private

Definition at line 50 of file PATCompositeCandidateProducer.h.

Referenced by produce().

pat::PATCompositeCandidateProducer::useUserData_
const bool useUserData_
Definition: PATCompositeCandidateProducer.h:50
mps_fire.i
i
Definition: mps_fire.py:355
pat::PATCompositeCandidateProducer::addResolutions_
const bool addResolutions_
Definition: PATCompositeCandidateProducer.h:56
pat::helper::EfficiencyLoader
Definition: EfficiencyLoader.h:16
pat::CompositeCandidate
Analysis-level particle class.
Definition: CompositeCandidate.h:31
pat::helper::EfficiencyLoader::enabled
bool enabled() const
'true' if this there is at least one efficiency configured
Definition: EfficiencyLoader.h:25
pat::PATCompositeCandidateProducer::efficiencyLoader_
pat::helper::EfficiencyLoader efficiencyLoader_
Definition: PATCompositeCandidateProducer.h:54
edm::Handle
Definition: AssociativeIterator.h:50
pat::helper::KinResolutionsLoader::enabled
bool enabled() const
'true' if this there is at least one efficiency configured
Definition: KinResolutionsLoader.h:27
pat::PATUserDataHelper::add
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
Definition: PATUserDataHelper.h:114
pat::helper::EfficiencyLoader::newEvent
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
Definition: EfficiencyLoader.cc:21
pat::helper::KinResolutionsLoader
Definition: KinResolutionsLoader.h:18
pat::PATCompositeCandidateProducer::addEfficiencies_
const bool addEfficiencies_
Definition: PATCompositeCandidateProducer.h:53
pat::helper::KinResolutionsLoader::setResolutions
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
Definition: KinResolutionsLoader.h:49
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
edm::View
Definition: CaloClusterFwd.h:14
edm::ParameterSet
Definition: ParameterSet.h:36
cand
Definition: decayParser.h:34
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::helper::KinResolutionsLoader::newEvent
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
Definition: KinResolutionsLoader.cc:27
pat::PATCompositeCandidateProducer::resolutionLoader_
pat::helper::KinResolutionsLoader resolutionLoader_
Definition: PATCompositeCandidateProducer.h:57
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
pat::helper::EfficiencyLoader::setEfficiencies
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
Definition: EfficiencyLoader.h:41
HLT_2018_cff.cands
cands
Definition: HLT_2018_cff.py:13762
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::InputTag
Definition: InputTag.h:15
pat::PATCompositeCandidateProducer::srcToken_
const edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > srcToken_
Definition: PATCompositeCandidateProducer.h:48
pat::PATCompositeCandidateProducer::userDataHelper_
pat::PATUserDataHelper< pat::CompositeCandidate > userDataHelper_
Definition: PATCompositeCandidateProducer.h:51