00001 #include "RecoParticleFlow/PFProducer/plugins/PFConcretePFCandidateProducer.h" 00002 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" 00003 00004 00005 PFConcretePFCandidateProducer::PFConcretePFCandidateProducer(const edm::ParameterSet& iConfig) { 00006 inputColl_ = iConfig.getParameter<edm::InputTag>("src"); 00007 // register products 00008 produces<reco::PFCandidateCollection>(); 00009 } 00010 00011 PFConcretePFCandidateProducer::~PFConcretePFCandidateProducer() {} 00012 00013 void PFConcretePFCandidateProducer::produce(edm::Event& iEvent, 00014 const edm::EventSetup& iSetup) { 00015 edm::Handle<reco::PFCandidateCollection> inputColl; 00016 bool inputOk = iEvent.getByLabel(inputColl_,inputColl); 00017 00018 if (!inputOk){ 00019 // nothing ... I guess we prefer to send an exception in the next lines 00020 } 00021 00022 std::auto_ptr< reco::PFCandidateCollection > outputColl(new reco::PFCandidateCollection()); 00023 outputColl->resize(inputColl->size()); 00024 00025 for (unsigned int iCopy=0;iCopy!=inputColl->size();++iCopy){ 00026 const reco::PFCandidate & pf=(*inputColl)[iCopy]; 00027 (*outputColl)[iCopy]=pf; 00028 //dereferenced internally the ref and hardcopy the value 00029 (*outputColl)[iCopy].setVertex(pf.vertex()); 00030 //math::XYZPoint(pf.vx(),pf.vy(),pf.vz())); 00031 } 00032 00033 iEvent.put(outputColl); 00034 }