#include "DataFormats/Candidate/interface/CandidateFwd.h"
#include <memory>
Go to the source code of this file.
Functions | |
std::auto_ptr< reco::Candidate > | cloneDecayTree (const reco::Candidate &) |
std::auto_ptr<reco::Candidate> cloneDecayTree | ( | const reco::Candidate & | ) |
Definition at line 6 of file cloneDecayTree.cc.
References reco::CompositeCandidate::addDaughter(), reco::Candidate::clone(), cloneDecayTree(), reco::Candidate::daughter(), i, n, reco::Candidate::numberOfDaughters(), and p.
Referenced by cloneDecayTree().
00006 { 00007 size_t n = c.numberOfDaughters(); 00008 if (n == 1) return auto_ptr<Candidate>(c.clone()); 00009 // pass a particle, not a candidate, to avoid cloning daughters 00010 const Particle &p = c; 00011 CompositeCandidate * cmp(new CompositeCandidate(p)); 00012 auto_ptr<Candidate> cmpPtr(cmp); 00013 for(size_t i = 0; i < n; ++ i) 00014 cmp->addDaughter(cloneDecayTree(* c.daughter(i))); 00015 return cmpPtr; 00016 }