CMS 3D CMS Logo

Functions
cloneDecayTree.cc File Reference
#include "CommonTools/CandUtils/interface/cloneDecayTree.h"
#include "DataFormats/Candidate/interface/CompositeCandidate.h"

Go to the source code of this file.

Functions

unique_ptr< CandidatecloneDecayTree (const Candidate &c)
 

Function Documentation

◆ cloneDecayTree()

unique_ptr<Candidate> cloneDecayTree ( const Candidate c)

Definition at line 6 of file cloneDecayTree.cc.

References c, fileCollector::cmp, mps_fire::i, dqmiodumpmetadata::n, and AlCaHLTBitMon_ParallelJobs::p.

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