Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
CommonTools
CandUtils
src
cloneDecayTree.cc
Go to the documentation of this file.
1
#include "
CommonTools/CandUtils/interface/cloneDecayTree.h
"
2
#include "
DataFormats/Candidate/interface/CompositeCandidate.h
"
3
using namespace
std;
4
using namespace
reco
;
5
6
unique_ptr<Candidate>
cloneDecayTree
(
const
Candidate
&
c
) {
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
}
reco::Candidate::daughter
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
c
const edm::EventSetup & c
Definition:
SiStripLAProfileBooker.cc:66
mps_fire.i
i
Definition:
mps_fire.py:428
reco::Candidate
Definition:
Candidate.h:27
dt_dqm_sourceclient_common_cff.reco
tuple reco
Definition:
dt_dqm_sourceclient_common_cff.py:111
CompositeCandidate.h
reco::Candidate::numberOfDaughters
virtual size_type numberOfDaughters() const =0
number of daughters
cloneDecayTree
std::unique_ptr< reco::Candidate > cloneDecayTree(const reco::Candidate &)
Definition:
cloneDecayTree.cc:6
reco::Candidate::clone
virtual Candidate * clone() const =0
returns a clone of the Candidate object
cloneDecayTree.h
AlCaHLTBitMon_ParallelJobs.p
tuple p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
dqmiodumpmetadata.n
int n
Definition:
dqmiodumpmetadata.py:28
Generated for CMSSW Reference Manual by
1.8.5