ATLAS Offline Software
Loading...
Searching...
No Matches
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
17
18
19namespace D3PD {
20
21
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
42{
43 CHECK( addVariable ("hasHardBrem", m_hasHardBrem) );
44
45 return StatusCode::SUCCESS;
46}
47
48
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
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
static Double_t sz
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Type-safe wrapper for block filler tools.
TruthParticleBremFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
virtual StatusCode fill(const xAOD::TruthParticle &p) override
Fill one block — type-safe version.
virtual StatusCode book() final
Book variables for this block.
bool * m_hasHardBrem
Variable: Does this particle have a brem?
int pdgId() const
PDG ID code.
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
size_t nOutgoingParticles() const
Get the number of outgoing particles.
Block filler tool for noisy FEB information.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15
TruthParticle_v1 TruthParticle
Typedef to implementation.