ATLAS Offline Software
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 $
15 #include "xAODTruth/TruthVertex.h"
17 
18 
19 namespace D3PD {
20 
21 
29  (const std::string& type,
30  const std::string& name,
31  const IInterface* 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
xAOD::TruthVertex_v1::nOutgoingParticles
size_t nOutgoingParticles() const
Get the number of outgoing particles.
fitman.sz
sz
Definition: fitman.py:527
D3PD::TruthParticleBremFillerTool::fill
virtual StatusCode fill(const xAOD::TruthParticle &p) override
Fill one block — type-safe version.
Definition: TruthParticleBremFillerTool.cxx:57
TruthParticle
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h:58
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
D3PD::AddVariable::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
Definition: AddVariable.cxx:85
D3PD
Block filler tool for noisy FEB information.
Definition: CaloCellDetailsFillerTool.cxx:29
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
D3PD::TruthParticleBremFillerTool::book
virtual StatusCode book() final
Book variables for this block.
Definition: TruthParticleBremFillerTool.cxx:41
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
D3PD::TruthParticleBremFillerTool::m_hasHardBrem
bool * m_hasHardBrem
Variable: Does this particle have a brem?
Definition: TruthParticleBremFillerTool.h:58
test_pyathena.parent
parent
Definition: test_pyathena.py:15
D3PD::BlockFillerTool
Type-safe wrapper for block filler tools.
Definition: BlockFillerTool.h:65
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
TruthVertex.h
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
errorcheck.h
Helpers for checking error return status codes and reporting errors.
D3PD::TruthParticleBremFillerTool::TruthParticleBremFillerTool
TruthParticleBremFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition: TruthParticleBremFillerTool.cxx:29
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TruthParticleBremFillerTool.h
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:119