CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes
pat::PATCompositeCandidateProducer Class Reference

Produces the pat::CompositeCandidate. More...

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

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

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 34 of file PATCompositeCandidateProducer.cc.

Constructor & Destructor Documentation

◆ PATCompositeCandidateProducer()

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

Definition at line 61 of file PATCompositeCandidateProducer.cc.

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

63  useUserData_(iConfig.exists("userData")),
64  userDataHelper_(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector()),
65  addEfficiencies_(iConfig.getParameter<bool>("addEfficiencies")),
66  addResolutions_(iConfig.getParameter<bool>("addResolutions")) {
67  // Efficiency configurables
68  if (addEfficiencies_) {
70  pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
71  }
72 
73  // Resolution configurables
74  if (addResolutions_) {
76  pat::helper::KinResolutionsLoader(iConfig.getParameter<edm::ParameterSet>("resolutions"), consumesCollector());
77  }
78 
79  // produces vector of particles
80  produces<vector<pat::CompositeCandidate> >();
81 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
bool exists(std::string const &parameterName) const
checks if a parameter exists
pat::PATUserDataHelper< pat::CompositeCandidate > userDataHelper_
pat::helper::KinResolutionsLoader resolutionLoader_
const edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > srcToken_
pat::helper::EfficiencyLoader efficiencyLoader_

◆ ~PATCompositeCandidateProducer()

PATCompositeCandidateProducer::~PATCompositeCandidateProducer ( )
override

Definition at line 83 of file PATCompositeCandidateProducer.cc.

83 {}

Member Function Documentation

◆ produce()

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

Definition at line 85 of file PATCompositeCandidateProducer.cc.

References pat::PATUserDataHelper< ObjectType >::add(), HLT_2024v10_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_.

85  {
86  // Get the vector of CompositeCandidate's from the event
88  iEvent.getByToken(srcToken_, cands);
89 
94 
95  auto myCompositeCandidates = std::make_unique<vector<pat::CompositeCandidate> >();
96 
97  if (cands.isValid()) {
98  View<reco::CompositeCandidate>::const_iterator ibegin = cands->begin(), iend = cands->end(), i = ibegin;
99  for (; i != iend; ++i) {
101 
102  if (useUserData_) {
103  userDataHelper_.add(cand, iEvent, iSetup);
104  }
105 
107  efficiencyLoader_.setEfficiencies(cand, cands->refAt(i - cands->begin()));
110 
111  myCompositeCandidates->push_back(std::move(cand));
112  }
113 
114  } // end if the two handles are valid
115 
116  iEvent.put(std::move(myCompositeCandidates));
117 }
Analysis-level particle class.
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
pat::PATUserDataHelper< pat::CompositeCandidate > userDataHelper_
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
int iEvent
Definition: GenABIO.cc:224
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
pat::helper::KinResolutionsLoader resolutionLoader_
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
const edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > srcToken_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
def move(src, dest)
Definition: eostools.py:511
pat::helper::EfficiencyLoader efficiencyLoader_

Member Data Documentation

◆ addEfficiencies_

const bool pat::PATCompositeCandidateProducer::addEfficiencies_
private

Definition at line 48 of file PATCompositeCandidateProducer.cc.

Referenced by PATCompositeCandidateProducer().

◆ addResolutions_

const bool pat::PATCompositeCandidateProducer::addResolutions_
private

Definition at line 51 of file PATCompositeCandidateProducer.cc.

Referenced by PATCompositeCandidateProducer().

◆ efficiencyLoader_

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

Definition at line 49 of file PATCompositeCandidateProducer.cc.

Referenced by PATCompositeCandidateProducer(), and produce().

◆ resolutionLoader_

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

Definition at line 52 of file PATCompositeCandidateProducer.cc.

Referenced by PATCompositeCandidateProducer(), and produce().

◆ srcToken_

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

Definition at line 43 of file PATCompositeCandidateProducer.cc.

Referenced by produce().

◆ userDataHelper_

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

Definition at line 46 of file PATCompositeCandidateProducer.cc.

Referenced by produce().

◆ useUserData_

const bool pat::PATCompositeCandidateProducer::useUserData_
private

Definition at line 45 of file PATCompositeCandidateProducer.cc.

Referenced by produce().