CMS 3D CMS Logo

Public Member Functions | Private Attributes

PFConcretePFCandidateProducer Class Reference

#include <PFConcretePFCandidateProducer.h>

Inheritance diagram for PFConcretePFCandidateProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 PFConcretePFCandidateProducer (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~PFConcretePFCandidateProducer ()

Private Attributes

edm::InputTag inputColl_

Detailed Description

Definition at line 17 of file PFConcretePFCandidateProducer.h.


Constructor & Destructor Documentation

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

Definition at line 5 of file PFConcretePFCandidateProducer.cc.

References edm::ParameterSet::getParameter(), and inputColl_.

                                                                                           {
  inputColl_ = iConfig.getParameter<edm::InputTag>("src");
  // register products
  produces<reco::PFCandidateCollection>();
}
PFConcretePFCandidateProducer::~PFConcretePFCandidateProducer ( )

Definition at line 11 of file PFConcretePFCandidateProducer.cc.

{}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 13 of file PFConcretePFCandidateProducer.cc.

References edm::Event::getByLabel(), PFEmbeddingSource_cff::inputColl, inputColl_, edm::Event::put(), reco::PFCandidate::setVertex(), and reco::PFCandidate::vertex().

                                                 {
  edm::Handle<reco::PFCandidateCollection> inputColl;
  bool inputOk = iEvent.getByLabel(inputColl_,inputColl);

  if (!inputOk){
    // nothing ... I guess we prefer to send an exception in the next lines
   }

  std::auto_ptr< reco::PFCandidateCollection > outputColl(new reco::PFCandidateCollection());
  outputColl->resize(inputColl->size());
  
  for (unsigned int iCopy=0;iCopy!=inputColl->size();++iCopy){
    const reco::PFCandidate & pf=(*inputColl)[iCopy];
    (*outputColl)[iCopy]=pf;
    //dereferenced internally the ref and hardcopy the value
    (*outputColl)[iCopy].setVertex(pf.vertex());
    //math::XYZPoint(pf.vx(),pf.vy(),pf.vz()));
  }
  
  iEvent.put(outputColl);
}

Member Data Documentation

Definition at line 26 of file PFConcretePFCandidateProducer.h.

Referenced by PFConcretePFCandidateProducer(), and produce().