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
pat::PATCompositeCandidateProducer Class Reference

Produces the pat::CompositeCandidate. More...

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

Inheritance diagram for pat::PATCompositeCandidateProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PATCompositeCandidateProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PATCompositeCandidateProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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 (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

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_, edm::EDConsumerBase::consumesCollector(), efficiencyLoader_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), resolutionLoader_, srcToken_, and useUserData_.

20  :
22 {
23  // initialize the configurables
24  srcToken_ = consumes<edm::View<reco::CompositeCandidate> >(iConfig.getParameter<InputTag>( "src" ));
25 
26  useUserData_ = false;
27  if ( iConfig.exists("userData") ) {
28  useUserData_ = true;
29  }
30 
31  // Efficiency configurables
32  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
33  if (addEfficiencies_) {
35  }
36 
37  // Resolution configurables
38  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
39  if (addResolutions_) {
41  }
42 
43 
44  // produces vector of particles
45  produces<vector<pat::CompositeCandidate> >();
46 
47 }
T getParameter(std::string const &) const
pat::PATUserDataHelper< pat::CompositeCandidate > userDataHelper_
bool exists(std::string const &parameterName) const
checks if a parameter exists
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
pat::helper::KinResolutionsLoader resolutionLoader_
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > srcToken_
pat::helper::EfficiencyLoader efficiencyLoader_
PATCompositeCandidateProducer::~PATCompositeCandidateProducer ( )

Definition at line 49 of file PATCompositeCandidateProducer.cc.

49  {
50 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 52 of file PATCompositeCandidateProducer.cc.

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

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

Member Data Documentation

bool pat::PATCompositeCandidateProducer::addEfficiencies_
private

Definition at line 57 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer().

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

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

Definition at line 52 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer(), and produce().

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

Definition at line 55 of file PATCompositeCandidateProducer.h.

Referenced by produce().

bool pat::PATCompositeCandidateProducer::useUserData_
private

Definition at line 54 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer(), and produce().