CMS 3D CMS Logo

Functions
cloneDecayTree.h File Reference
#include "DataFormats/Candidate/interface/CandidateFwd.h"
#include <memory>

Go to the source code of this file.

Functions

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

Function Documentation

std::unique_ptr<reco::Candidate> cloneDecayTree ( const reco::Candidate )

Definition at line 6 of file cloneDecayTree.cc.

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

6  {
7  size_t n = c.numberOfDaughters();
8  if (n == 1) return unique_ptr<Candidate>(c.clone());
9  // pass a particle, not a candidate, to avoid cloning daughters
10  const Candidate &p = c;
12  unique_ptr<Candidate> cmpPtr(cmp);
13  for(size_t i = 0; i < n; ++ i)
14  cmp->addDaughter(cloneDecayTree(* c.daughter(i)));
15  return std::move(cmpPtr);
16 }
unique_ptr< Candidate > cloneDecayTree(const Candidate &c)
def move(src, dest)
Definition: eostools.py:511