ATLAS Offline Software
Loading...
Searching...
No Matches
IParticleFourMomBranch.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONTESTERTREE_IPARTICLEFOURMOMBRANCH_H
5#define MUONTESTERTREE_IPARTICLEFOURMOMBRANCH_H
6
11
12namespace MuonVal {
32 public:
37 IParticleFourMomBranch(MuonTesterTree& tree, const std::string& particle);
39 bool fill(const EventContext& ctx) override;
41 bool init() override;
43 std::string name() const override;
45 const TTree* tree() const override;
46 TTree* tree() override;
47
51 bool initialized() const;
53 std::vector<DataDependency> data_dependencies() override;
55 size_t size() const;
56
57 void push_back(const xAOD::IParticle* p) override;
58 void push_back(const xAOD::IParticle& p) override;
59 void operator+=(const xAOD::IParticle* p) override;
60 void operator+=(const xAOD::IParticle& p) override;
61
62
67 size_t find(const xAOD::IParticle& p) const;
68 size_t find(const xAOD::IParticle* p) const;
72 size_t find(std::function<bool(const xAOD::IParticle*)> func) const;
74 const std::vector<const xAOD::IParticle*>& getCached() const;
82 template <typename T>
83 bool addVariable(const std::string& variable,
84 const std::string& accName = "");
91 template <typename T>
92 bool addVariable(T defaultValue,
93 const std::string& variable,
94 const std::string& accName = "");
95
101 template <typename T>
102 bool addVariableGeV(const std::string& variable,
103 const std::string& accName = "");
110 template <typename T>
111 bool addVariableGeV(T defaultValue,
112 const std::string& variable,
113 const std::string& accName = "");
114
119 template <typename T>
120 std::shared_ptr<ParticleVariableBranch<T>> getBranch(const std::string& var) const;
121
122 bool addVariable(std::shared_ptr<IParticleDecorationBranch> branch);
123
124
125 private:
127 std::string m_name{};
128 bool m_init{false};
129 bool m_updated{false};
135
136 std::vector<std::shared_ptr<IParticleDecorationBranch>> m_variables{};
137 std::vector<const xAOD::IParticle*> m_cached_particles{};
138};
139
140}
142#endif
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
const std::vector< const xAOD::IParticle * > & getCached() const
Returns the list of currently cached particles.
void operator+=(const xAOD::IParticle *p) override
bool addVariable(T defaultValue, const std::string &variable, const std::string &accName="")
Write a variable of type <T> to the TTree.
bool addVariable(const std::string &variable, const std::string &accName="")
Writes a variable of type <T> which can be directly accessed via an SG::AuxElement e....
std::vector< DataDependency > data_dependencies() override
Returns a list of all Read(Coond)HandleKeys needed by the branch.
size_t size() const
How many particles have been pushed back already.
std::shared_ptr< ParticleVariableBranch< T > > getBranch(const std::string &var) const
Returns the point to the underlying ParticleVariableBranch translating the IParticle Accessors into T...
IParticleFourMomBranch(MuonTesterTree &tree, const std::string &particle)
Construct an IParticleFourMomBranch.
bool fill(const EventContext &ctx) override
Fill the branch.
MuonTesterTree & getTree()
Access to the MuonTrestTree parent.
bool addVariableGeV(T defaultValue, const std::string &variable, const std::string &accName="")
Write a variable of type <T> to the TTree, but divide it by 1k before dumping.
bool addVariableGeV(const std::string &variable, const std::string &accName="")
Write a variable of type <T> to the TTree, but divide it by 1k before dumping.
std::vector< const xAOD::IParticle * > m_cached_particles
size_t find(const xAOD::IParticle &p) const
Returns the position at which the particle has already be inserted in the chain – If the particle is ...
bool initialized() const
Has the init method been called.
void push_back(const xAOD::IParticle *p) override
Similar to the IAuxElementDecoration branch but only accepting IParticles.
std::vector< std::shared_ptr< IParticleDecorationBranch > > m_variables
std::string name() const override
Name of the four momentum branch.
const TTree * tree() const override
Return the underyling TTree pointer.
bool init() override
Initialize the branches and all children.
Class providing the definition of the 4-vector interface.
Class to store array like branches into the n-tuples.
Definition HitValAlg.cxx:19