ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ParticleJetTools
Root
CopyBosonTopLabelTruthParticles.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ParticleJetTools/CopyBosonTopLabelTruthParticles.h
"
6
#include "
xAODTruth/TruthParticleContainer.h
"
7
#include "
xAODTruth/TruthParticleAuxContainer.h
"
8
#include "
xAODTruth/TruthEventContainer.h
"
9
#include "
AthContainers/ConstDataVector.h
"
10
#include "
TruthUtils/HepMCHelpers.h
"
11
12
using namespace
std
;
13
14
15
CopyBosonTopLabelTruthParticles::CopyBosonTopLabelTruthParticles
(
const
std::string& name)
16
:
CopyTruthParticles
(name)
17
{
18
declareProperty
(
"ParticleType"
,
m_ptype
=
"None"
,
"Sort of particles to pick: WBosons | ZBosons | HBosons | TQuarksFinal"
);
19
}
20
21
22
// Unnamed namespace for helpers: only visible to this compilation unit
23
namespace
{
24
inline
bool
isWBoson(
const
xAOD::TruthParticle
* tp) {
return
(abs(tp->pdgId()) ==
MC::WPLUSBOSON
); }
25
inline
bool
isZBoson(
const
xAOD::TruthParticle
* tp) {
return
(abs(
tp
->pdgId()) ==
MC::Z0BOSON
); }
26
inline
bool
isHBoson(
const
xAOD::TruthParticle
* tp) {
return
(abs(
tp
->pdgId()) ==
MC::HIGGSBOSON
); }
27
inline
bool
isTQuark(
const
xAOD::TruthParticle
* tp) {
return
(abs(
tp
->pdgId()) ==
MC::TQUARK
); }
28
29
template
<
typename
FN>
30
inline
bool
isFinalWith(
const
xAOD::TruthParticle
* tp,
const
FN& f) {
31
if
(!
f
(tp))
return
false
;
32
if
(!
tp
->hasDecayVtx())
return
false
;
33
for
(
unsigned
int
i = 0;
i
<
tp
->decayVtx()->nOutgoingParticles(); ++
i
) {
34
if
(
f
(
tp
->decayVtx()->outgoingParticle(i)))
return
false
;
35
}
36
return
true
;
37
}
38
}
39
40
41
bool
CopyBosonTopLabelTruthParticles::classify
(
const
xAOD::TruthParticle
* tp)
const
{
42
// Cut on particle type
43
if
(
m_ptype
==
"WBosons"
) {
44
return
isFinalWith(tp, isWBoson);
45
}
else
if
(
m_ptype
==
"ZBosons"
) {
46
return
isFinalWith(tp, isZBoson);
47
}
else
if
(
m_ptype
==
"HBosons"
) {
48
return
isFinalWith(tp, isHBoson);
49
}
else
if
(
m_ptype
==
"TQuarksFinal"
) {
50
return
isFinalWith(tp, isTQuark);
51
}
52
53
// not good.
54
throw
std::runtime_error(
"Requested unknown particle classification type: "
+
m_ptype
);
55
return
false
;
56
}
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
CopyBosonTopLabelTruthParticles.h
TruthParticleContainer.h
HepMCHelpers.h
ATLAS-specific HepMC functions.
TruthEventContainer.h
TruthParticleAuxContainer.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
CopyBosonTopLabelTruthParticles::m_ptype
std::string m_ptype
Particle selection mode.
Definition
CopyBosonTopLabelTruthParticles.h:25
CopyBosonTopLabelTruthParticles::CopyBosonTopLabelTruthParticles
CopyBosonTopLabelTruthParticles(const std::string &name)
Constructor.
Definition
CopyBosonTopLabelTruthParticles.cxx:15
CopyBosonTopLabelTruthParticles::classify
bool classify(const xAOD::TruthParticle *tp) const
Classifier function(s)
Definition
CopyBosonTopLabelTruthParticles.cxx:41
CopyTruthParticles::CopyTruthParticles
CopyTruthParticles(const std::string &name)
Constructor.
Definition
CopyTruthParticles.cxx:15
MC::Z0BOSON
static const int Z0BOSON
Definition
HepMCHelpers.h:89
MC::TQUARK
static const int TQUARK
Definition
HepMCHelpers.h:70
MC::HIGGSBOSON
static const int HIGGSBOSON
Definition
HepMCHelpers.h:91
MC::WPLUSBOSON
static const int WPLUSBOSON
Definition
HepMCHelpers.h:90
ParticleTest.tp
tp
Definition
ParticleTest.py:25
hist_file_dump.f
f
Definition
hist_file_dump.py:140
lumiFormat.i
int i
Definition
lumiFormat.py:85
std
STL namespace.
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
Generated on
for ATLAS Offline Software by
1.14.0