test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFConcretePFCandidateProducer.cc
Go to the documentation of this file.
3 
4 
6  inputColl_ = iConfig.getParameter<edm::InputTag>("src");
7  // register products
8  produces<reco::PFCandidateCollection>();
9 }
10 
12 
14  const edm::EventSetup& iSetup) {
16  bool inputOk = iEvent.getByLabel(inputColl_,inputColl);
17 
18  if (!inputOk){
19  // nothing ... I guess we prefer to send an exception in the next lines
20  }
21 
22  auto outputColl = std::make_unique<reco::PFCandidateCollection>();
23  outputColl->resize(inputColl->size());
24 
25  for (unsigned int iCopy=0;iCopy!=inputColl->size();++iCopy){
26  const reco::PFCandidate & pf=(*inputColl)[iCopy];
27  (*outputColl)[iCopy]=pf;
28  //dereferenced internally the ref and hardcopy the value
29  (*outputColl)[iCopy].setVertex(pf.vertex());
30  //math::XYZPoint(pf.vx(),pf.vy(),pf.vz()));
31  }
32 
33  iEvent.put(std::move(outputColl));
34 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
PFConcretePFCandidateProducer(const edm::ParameterSet &)
virtual void setVertex(const math::XYZPoint &p)
set vertex
Definition: PFCandidate.h:408
int iEvent
Definition: GenABIO.cc:230
def move
Definition: eostools.py:510
virtual const Point & vertex() const
vertex position (overwritten by PF...)
Definition: PFCandidate.cc:652
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
virtual void produce(edm::Event &, const edm::EventSetup &)