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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 40 of file PATCompositeCandidateProducer.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file PATCompositeCandidateProducer.cc.

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

20  :
22  useUserData_(iConfig.exists("userData")),
23  userDataHelper_( iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector() ),
24  addEfficiencies_(iConfig.getParameter<bool>("addEfficiencies")),
25  addResolutions_(iConfig.getParameter<bool>("addResolutions"))
26 {
27 
28  // Efficiency configurables
29  if (addEfficiencies_) {
30  efficiencyLoader_ = pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
31  }
32 
33  // Resolution configurables
34  if (addResolutions_) {
36  }
37 
38  // produces vector of particles
39  produces<vector<pat::CompositeCandidate> >();
40 
41 }
T getParameter(std::string const &) const
pat::PATUserDataHelper< pat::CompositeCandidate > userDataHelper_
bool exists(std::string const &parameterName) const
checks if a parameter exists
pat::helper::KinResolutionsLoader resolutionLoader_
const edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > srcToken_
pat::helper::EfficiencyLoader efficiencyLoader_
PATCompositeCandidateProducer::~PATCompositeCandidateProducer ( )
override

Definition at line 43 of file PATCompositeCandidateProducer.cc.

43  {
44 }

Member Function Documentation

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

Definition at line 46 of file PATCompositeCandidateProducer.cc.

References egammaForCoreTracking_cff::cands, DEFINE_FWK_MODULE, efficiencyLoader_, pat::helper::EfficiencyLoader::enabled(), pat::helper::KinResolutionsLoader::enabled(), edm::Event::getByToken(), mps_fire::i, edm::HandleBase::isValid(), eostools::move(), pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), edm::Event::put(), resolutionLoader_, pat::helper::EfficiencyLoader::setEfficiencies(), pat::helper::KinResolutionsLoader::setResolutions(), srcToken_, userDataHelper_, and useUserData_.

46  {
47  // Get the vector of CompositeCandidate's from the event
49  iEvent.getByToken(srcToken_, cands);
50 
52  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
53 
54  auto myCompositeCandidates = std::make_unique<vector<pat::CompositeCandidate> >();
55 
56  if ( cands.isValid() ) {
57 
58  View<reco::CompositeCandidate>::const_iterator ibegin = cands->begin(),
59  iend = cands->end(), i = ibegin;
60  for ( ; i != iend; ++i ) {
61 
63 
64  if ( useUserData_ ) {
65  userDataHelper_.add( cand, iEvent, iSetup );
66  }
67 
68  if (efficiencyLoader_.enabled()) efficiencyLoader_.setEfficiencies( cand, cands->refAt(i - cands->begin()) );
70 
71  myCompositeCandidates->push_back( std::move(cand) );
72  }
73 
74  }// end if the two handles are valid
75 
76  iEvent.put(std::move(myCompositeCandidates));
77 
78 }
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
Analysis-level particle class.
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
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.
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
pat::helper::KinResolutionsLoader resolutionLoader_
bool isValid() const
Definition: HandleBase.h:74
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
const edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > srcToken_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
def move(src, dest)
Definition: eostools.py:510
pat::helper::EfficiencyLoader efficiencyLoader_

Member Data Documentation

const bool pat::PATCompositeCandidateProducer::addEfficiencies_
private

Definition at line 57 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer().

const bool pat::PATCompositeCandidateProducer::addResolutions_
private

Definition at line 60 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer().

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

Definition at line 58 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer(), and produce().

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

Definition at line 61 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer(), and produce().

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

Definition at line 52 of file PATCompositeCandidateProducer.h.

Referenced by produce().

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

Definition at line 55 of file PATCompositeCandidateProducer.h.

Referenced by produce().

const bool pat::PATCompositeCandidateProducer::useUserData_
private

Definition at line 54 of file PATCompositeCandidateProducer.h.

Referenced by produce().