CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
cloneDecayTree.cc File Reference
#include "PhysicsTools/CandUtils/interface/cloneDecayTree.h"
#include "DataFormats/Candidate/interface/CompositeCandidate.h"

Go to the source code of this file.

Functions

auto_ptr< CandidatecloneDecayTree (const Candidate &c)
 

Function Documentation

auto_ptr<Candidate> cloneDecayTree ( const Candidate c)

Definition at line 6 of file cloneDecayTree.cc.

References reco::CompositeCandidate::addDaughter(), EnergyCorrector::c, reco::Candidate::clone(), cloneDecayTree(), reco::Candidate::daughter(), i, n, reco::Candidate::numberOfDaughters(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by cloneDecayTree().

6  {
7  size_t n = c.numberOfDaughters();
8  if (n == 1) return auto_ptr<Candidate>(c.clone());
9  // pass a particle, not a candidate, to avoid cloning daughters
10  const Candidate &p = c;
12  auto_ptr<Candidate> cmpPtr(cmp);
13  for(size_t i = 0; i < n; ++ i)
14  cmp->addDaughter(cloneDecayTree(* c.daughter(i)));
15  return cmpPtr;
16 }
int i
Definition: DBlmapReader.cc:9
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
std::auto_ptr< reco::Candidate > cloneDecayTree(const reco::Candidate &)
virtual size_type numberOfDaughters() const =0
number of daughters
virtual Candidate * clone() const =0
returns a clone of the Candidate object