ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
TruthD3PDMaker
src
TruthParticleBremFillerTool.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
// $Id: TruthParticleBremFillerTool.cxx 604362 2014-07-01 05:25:22Z ssnyder $
12
13
14
#include "
TruthParticleBremFillerTool.h
"
15
#include "
xAODTruth/TruthVertex.h
"
16
#include "
AthenaKernel/errorcheck.h
"
17
18
19
namespace
D3PD
{
20
21
28
TruthParticleBremFillerTool::TruthParticleBremFillerTool
29
(
const
std::string&
type
,
30
const
std::string& name,
31
const
IInterface* parent)
32
:
BlockFillerTool
<
xAOD
::
TruthParticle
> (
type
, name, parent)
33
{
34
book
().ignore();
// Avoid coverity warnings.
35
}
36
37
41
StatusCode
TruthParticleBremFillerTool::book
()
42
{
43
CHECK
(
addVariable
(
"hasHardBrem"
,
m_hasHardBrem
) );
44
45
return
StatusCode::SUCCESS;
46
}
47
48
57
StatusCode
TruthParticleBremFillerTool::fill
(
const
xAOD::TruthParticle
& p)
58
{
59
const
xAOD::TruthVertex
* vx = p.decayVtx();
60
if
(vx) {
61
size_t
sz
= vx->
nOutgoingParticles
();
62
int
n_children = 0;
63
int
pdgid_child1 = 0;
64
int
pdgid_child2 = 0;
65
66
for
(
size_t
i = 0; i <
sz
; i++) {
67
const
xAOD::TruthParticle
* child = vx->
outgoingParticle
(i);
68
if
(child) {
69
if
(n_children==0) pdgid_child1 = child->
pdgId
();
70
if
(n_children==1) pdgid_child2 = child->
pdgId
();
71
n_children++;
72
}
73
}
74
75
if
(n_children == 2 &&
76
((std::abs(pdgid_child1)==11 && pdgid_child2==22) ||
77
(std::abs(pdgid_child2)==11 && pdgid_child1==22)))
78
{
79
*
m_hasHardBrem
=
true
;
80
}
81
}
82
return
StatusCode::SUCCESS;
83
}
84
85
86
}
// namespace D3PD
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
sz
static Double_t sz
Definition
LArPhysWaveHECTool.cxx:37
TruthParticleBremFillerTool.h
TruthVertex.h
D3PD::BlockFillerTool< xAOD::TruthParticle >::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Definition
AddVariable.cxx:85
D3PD::BlockFillerTool
Type-safe wrapper for block filler tools.
Definition
BlockFillerTool.h:65
D3PD::TruthParticleBremFillerTool::TruthParticleBremFillerTool
TruthParticleBremFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition
TruthParticleBremFillerTool.cxx:29
D3PD::TruthParticleBremFillerTool::fill
virtual StatusCode fill(const xAOD::TruthParticle &p) override
Fill one block — type-safe version.
Definition
TruthParticleBremFillerTool.cxx:57
D3PD::TruthParticleBremFillerTool::book
virtual StatusCode book() final
Book variables for this block.
Definition
TruthParticleBremFillerTool.cxx:41
D3PD::TruthParticleBremFillerTool::m_hasHardBrem
bool * m_hasHardBrem
Variable: Does this particle have a brem?
Definition
TruthParticleBremFillerTool.h:58
TruthParticle
(HepMC) Monte Carlo particle.
Definition
PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h:58
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
xAOD::TruthVertex_v1::outgoingParticle
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
Definition
TruthVertex_v1.cxx:120
xAOD::TruthVertex_v1::nOutgoingParticles
size_t nOutgoingParticles() const
Get the number of outgoing particles.
D3PD
Block filler tool for noisy FEB information.
Definition
CaloCellDetailsFillerTool.cxx:29
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
xAOD::TruthVertex
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition
TruthVertex.h:15
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
type
Generated on
for ATLAS Offline Software by
1.17.0