#include <PhysicsTools/PatAlgos/interface/PATCompositeCandidateProducer.h>
Public Member Functions | |
PATCompositeCandidateProducer (const edm::ParameterSet &iConfig) | |
virtual void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
~PATCompositeCandidateProducer () | |
Private Attributes | |
edm::InputTag | src_ |
pat::PATUserDataHelper < pat::CompositeCandidate > | userDataHelper_ |
bool | useUserData_ |
The PATCompositeCandidateProducer produces the analysis-level pat::CompositeCandidate starting from any collection of Candidates
Definition at line 40 of file PATCompositeCandidateProducer.h.
PATCompositeCandidateProducer::PATCompositeCandidateProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 21 of file PATCompositeCandidateProducer.cc.
References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), src_, and useUserData_.
00021 : 00022 userDataHelper_( iConfig.getParameter<edm::ParameterSet>("userData") ) 00023 { 00024 // initialize the configurables 00025 src_ = iConfig.getParameter<InputTag>( "src" ); 00026 00027 useUserData_ = false; 00028 if ( iConfig.exists("userData") ) { 00029 useUserData_ = true; 00030 } 00031 00032 // produces vector of particles 00033 produces<vector<pat::CompositeCandidate> >(); 00034 00035 }
PATCompositeCandidateProducer::~PATCompositeCandidateProducer | ( | ) |
void PATCompositeCandidateProducer::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 40 of file PATCompositeCandidateProducer.cc.
References pat::PATUserDataHelper< ObjectType >::add(), edm::Event::getByLabel(), i, edm::Handle< T >::isValid(), edm::Event::put(), src_, userDataHelper_, and useUserData_.
00040 { 00041 // Get the vector of CompositeCandidate's from the event 00042 Handle<View<reco::CompositeCandidate> > cands; 00043 iEvent.getByLabel(src_, cands); 00044 00045 auto_ptr<vector<pat::CompositeCandidate> > myCompositeCandidates ( new vector<pat::CompositeCandidate>() ); 00046 00047 if ( cands.isValid() ) { 00048 00049 View<reco::CompositeCandidate>::const_iterator ibegin = cands->begin(), 00050 iend = cands->end(), i = ibegin; 00051 for ( ; i != iend; ++i ) { 00052 00053 pat::CompositeCandidate cand(*i); 00054 00055 if ( useUserData_ ) { 00056 userDataHelper_.add( cand, iEvent, iSetup ); 00057 } 00058 00059 myCompositeCandidates->push_back( cand ); 00060 } 00061 00062 }// end if the two handles are valid 00063 00064 iEvent.put(myCompositeCandidates); 00065 00066 }
Definition at line 52 of file PATCompositeCandidateProducer.h.
Referenced by PATCompositeCandidateProducer(), and produce().
Definition at line 54 of file PATCompositeCandidateProducer.h.
Referenced by PATCompositeCandidateProducer(), and produce().