CMS 3D CMS Logo

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

List of all members.

Public Member Functions

 PATCompositeCandidateProducer (const edm::ParameterSet &iConfig)
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 ~PATCompositeCandidateProducer ()

Private Attributes

bool addEfficiencies_
bool addResolutions_
pat::helper::EfficiencyLoader efficiencyLoader_
pat::helper::KinResolutionsLoader resolutionLoader_
edm::InputTag src_
pat::PATUserDataHelper
< pat::CompositeCandidate
userDataHelper_
bool useUserData_

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 41 of file PATCompositeCandidateProducer.h.


Constructor & Destructor Documentation

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

Definition at line 21 of file PATCompositeCandidateProducer.cc.

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

                                                                                         :
  userDataHelper_( iConfig.getParameter<edm::ParameterSet>("userData") )
{
  // initialize the configurables
  src_ = iConfig.getParameter<InputTag>( "src" );

  useUserData_ = false;
  if ( iConfig.exists("userData") ) {
    useUserData_ = true;
  }

  // Efficiency configurables
  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
  if (addEfficiencies_) {
     efficiencyLoader_ = pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"));
  }

  // Resolution configurables
  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
  if (addResolutions_) {
     resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter<edm::ParameterSet>("resolutions"));
  }


  // produces vector of particles
  produces<vector<pat::CompositeCandidate> >();

}
PATCompositeCandidateProducer::~PATCompositeCandidateProducer ( )

Definition at line 50 of file PATCompositeCandidateProducer.cc.

                                                              {
}

Member Function Documentation

void PATCompositeCandidateProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 53 of file PATCompositeCandidateProducer.cc.

References pat::PATUserDataHelper< ObjectType >::add(), efficiencyLoader_, pat::helper::KinResolutionsLoader::enabled(), pat::helper::EfficiencyLoader::enabled(), edm::Event::getByLabel(), i, edm::HandleBase::isValid(), pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), edm::Event::put(), resolutionLoader_, pat::helper::EfficiencyLoader::setEfficiencies(), pat::helper::KinResolutionsLoader::setResolutions(), src_, userDataHelper_, and useUserData_.

                                                                                     {
  // Get the vector of CompositeCandidate's from the event
  Handle<View<reco::CompositeCandidate> > cands;
  iEvent.getByLabel(src_, cands);

  if (efficiencyLoader_.enabled()) efficiencyLoader_.newEvent(iEvent);
  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);

  auto_ptr<vector<pat::CompositeCandidate> > myCompositeCandidates ( new vector<pat::CompositeCandidate>() );

  if ( cands.isValid() ) {

    View<reco::CompositeCandidate>::const_iterator ibegin = cands->begin(),
      iend = cands->end(), i = ibegin;
    for ( ; i != iend; ++i ) {

      pat::CompositeCandidate cand(*i);
      
      if ( useUserData_ ) {
        userDataHelper_.add( cand, iEvent, iSetup );
      }

      if (efficiencyLoader_.enabled()) efficiencyLoader_.setEfficiencies( cand, cands->refAt(i - cands->begin()) );
      if (resolutionLoader_.enabled()) resolutionLoader_.setResolutions(cand);

      myCompositeCandidates->push_back( cand );
    }

  }// end if the two handles are valid

  iEvent.put(myCompositeCandidates);

}

Member Data Documentation

Definition at line 58 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer().

Definition at line 61 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer().

Definition at line 59 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer(), and produce().

Definition at line 62 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer(), and produce().

Definition at line 53 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer(), and produce().

Definition at line 56 of file PATCompositeCandidateProducer.h.

Referenced by produce().

Definition at line 55 of file PATCompositeCandidateProducer.h.

Referenced by PATCompositeCandidateProducer(), and produce().