4#ifndef TRUTHUTILS_DECAYPRODUCTS_H
5#define TRUTHUTILS_DECAYPRODUCTS_H
17 int pd(
int i1,
int i2)
const {
int ret = 0;
for (
auto &
a:
m_pids)
if (i1 <=
a.first &&
a.first <= i2) ret +=
a.second;
return ret; }
18 int apd(
int i1,
int i2)
const {
int ret = 0;
for (
auto &
a:
m_apids)
if (i1 <=
a.first &&
a.first <= i2) ret +=
a.second;
return ret; }
20 int pd(
const std::vector<int>& i)
const {
int ret = 0;
for (
auto ii: i) ret +=
pd(ii);
return ret;}
21 int apd(
const std::vector<int>& i)
const {
int ret = 0;
for (
auto ii: i) ret +=
apd(ii);
return ret; }
23 int apply(
bool (*func)(
const int&))
const {
int ret = 0;
for (
auto &
a:
m_pids)
if (func(
a.first)) ret+=
a.second;
return ret; }
28#ifdef ATLASHEPMC_GENEVENT_H
29#ifdef ATLASHEPMC_GENPARTICLE_H
30 template <class Y,std::enable_if_t<std::is_same<Y, HepMC::GenParticlePtr>::value ||std::is_same<Y, HepMC::ConstGenParticlePtr>::value,
bool > =
true >
33 auto v = p->end_vertex();
34 if (v)
for (
auto prod: *v)
if (prod) t.count(prod->pdg_id());
38#ifdef ATLASHEPMC_GENVERTEX_H
39 template <class Y,std::enable_if_t<std::is_same<Y, HepMC::GenVertexPtr>::value ||std::is_same<Y, HepMC::ConstGenVertexPtr>::value,
bool > =
true>
42 if (p)
for (
auto prod: *p)
if (prod)
t.count(prod->pdg_id());
47#ifdef XAODTRUTH_TRUTHPARTICLE_H
48 template <class Y,std::enable_if_t<std::is_same<Y, xAOD::TruthParticle>::value,
bool > =
true>
51 auto v =
p.end_vertex();
52 if (v)
for (
auto prod:
v->particles_out())
if (prod)
t.count(prod->pdg_id());
55 template <class Y,std::enable_if_t<std::is_same<Y, xAOD::TruthParticle*>::value || std::is_same<Y, xAOD::TruthParticle const*>::value ,
bool > =
true>
58 auto v =
p->end_vertex();
59 if (v)
for (
auto prod:
v->particles_out())
if (prod)
t.count(prod->pdg_id());
62 template <
class Y,std::enable_if_t<std::is_same<Y, std::vector<const xAOD::TruthParticle*> >::value,
bool > = true>
65 for (
auto prod: p)
if (prod)
t.count(prod->pdg_id());
69#ifdef XAODTRUTH_TRUTHVERTEX_H
70 template <class Y,std::enable_if_t<std::is_same<Y, xAOD::TruthVertex*>::value || std::is_same<Y, xAOD::TruthVertex const*>::value ,
bool > =
true>
73 if (p)
for (
auto prod:
p->particles_out())
if (prod)
t.count(prod->pdg_id());
A class that allows for a fast calculation of the flavours of the descendants of a vertex,...
int apply(bool(*func)(const int &)) const
int pd(int i1, int i2) const
int apd(const std::vector< int > &i) const
std::map< int, int > m_apids
int apd(int i1, int i2) const
int pd(const std::vector< int > &i) const
std::map< int, int > m_pids