CMS 3D CMS Logo

cloneDecayTree.h File Reference

#include "DataFormats/Candidate/interface/CandidateFwd.h"
#include <memory>

Go to the source code of this file.

Functions

std::auto_ptr< reco::CandidatecloneDecayTree (const reco::Candidate &)


Function Documentation

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 }


Generated on Tue Jun 9 17:54:45 2009 for CMSSW by  doxygen 1.5.4