Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ParticleVariables.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4 */
6 #include <StoreGate/ReadHandle.h>
7 
8 namespace MuonPRDTest {
10  const std::string& containerKey,
11  const std::string& outName,
12  MSG::Level msglvl) :
13  PrdTesterModule(tree, "Particles"+ containerKey+outName, msglvl),
14  m_key{containerKey},
15  m_branch{std::make_shared<IParticleFourMomBranch>(tree, outName)} {}
16 
17  bool ParticleVariables::fill(const EventContext& ctx) {
18  SG::ReadHandle readHandle{m_key, ctx};
19  if(!readHandle.isPresent()) {
20  ATH_MSG_FATAL("Failed to retrieve "<<m_key.fullKey());
21  return false;
22  }
23  for (const xAOD::IParticle* particle : *readHandle){
24  m_branch->push_back(particle);
25  }
26  return true;
27  }
29  return declare_dependency(m_key) &&
30  std::ranges::find_if(m_decorKeys,[this](DecorKey_t& key) {
31  return !declare_dependency(key);
32  }) == m_decorKeys.end() &&
34  }
35  void ParticleVariables::declare_decorator(const std::string& decorName) {
36  if (decorName.empty()){
37  ATH_MSG_WARNING("Empty decorator names are not allowed");
38  } else {
39  m_decorKeys.emplace_back(m_key, decorName);
40  ATH_MSG_DEBUG("Declare new dependency on "<<m_decorKeys.back().fullKey());
41  }
42  }
43  bool ParticleVariables::addVariable(std::shared_ptr<IParticleDecorationBranch> branch) {
44  return m_branch->addVariable(std::move(branch));
45  }
47  m_branch->push_back(p);
48  return m_branch->find(p);
49  }
50 
51 }
MuonPRDTest::ParticleVariables::addVariable
bool addVariable(const std::string &variable, const bool declareDep=false)
Adds a variable of the primitive data type that can be directly read-off from the xAOD::IParticle as ...
Definition: ParticleVariables.h:30
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
tree
TChain * tree
Definition: tile_monitor.h:30
ParticleVariables.h
MuonPRDTest::ParticleVariables::m_key
SG::ReadHandleKey< xAOD::IParticleContainer > m_key
Definition: ParticleVariables.h:85
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
MuonPRDTest::ParticleVariables::declare_decorator
void declare_decorator(const std::string &decorName)
Declares the dependency on a decorator.
Definition: ParticleVariables.cxx:35
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonPRDTest::ParticleVariables::declare_keys
bool declare_keys() override final
Definition: ParticleVariables.cxx:28
MuonPRDTest::ParticleVariables::push_back
size_t push_back(const xAOD::IParticle *p)
Definition: ParticleVariables.cxx:46
MuonPRDTest::ParticleVariables::ParticleVariables
ParticleVariables(MuonTesterTree &tree, const std::string &containerKey, const std::string &outName, MSG::Level msglvl)
Definition: ParticleVariables.cxx:9
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
TestSUSYToolsAlg.outName
string outName
Definition: TestSUSYToolsAlg.py:173
MuonPRDTest::ParticleVariables::fill
bool fill(const EventContext &ctx) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
Definition: ParticleVariables.cxx:17
MuonPRDTest::ParticleVariables::m_branch
std::shared_ptr< IParticleFourMomBranch > m_branch
Definition: ParticleVariables.h:88
MuonVal::MuonTesterBranch::parent
MuonTesterTree & parent()
Returns the reference to the MuonTesterTree parent.
Definition: MuonTesterBranch.cxx:38
RTTAlgmain.branch
branch
Definition: RTTAlgmain.py:61
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonPRDTest
Definition: MuonHitTesterAlg.h:15
MuonPRDTest::ParticleVariables::m_decorKeys
SG::ReadDecorHandleKeyArray< xAOD::IParticleContainer > m_decorKeys
Definition: ParticleVariables.h:87
ReadHandle.h
Handle class for reading from StoreGate.
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
MuonVal::MuonTesterTree::addBranch
bool addBranch(std::shared_ptr< IMuonTesterBranch > branch)
Branch is added to the tree without transferring the ownership.
Definition: MuonTesterTree.cxx:61
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37