ATLAS Offline Software
Loading...
Searching...
No Matches
AuxElementBranch.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONTESTER_AUXELEMENTBRANCH_H
5#define MUONTESTER_AUXELEMENTBRANCH_H
6
8namespace MuonVal {
9template <class T> class AuxElementBranch : public VectorBranch<T>, virtual public IAuxElementDecorationBranch {
10public:
11 void setAccessor(const std::string& name);
12 void push_back(const SG::AuxElement* p) override;
13 void push_back(const SG::AuxElement& p) override;
14 void operator+=(const SG::AuxElement* p) override;
15 void operator+=(const SG::AuxElement& p) override;
16
21
22 AuxElementBranch(TTree* t, const std::string& var_name, const std::string& acc = "");
23 AuxElementBranch(MuonTesterTree& t, const std::string& var_name, const std::string& acc = "");
24
25 virtual ~AuxElementBranch() = default;
26
27private:
29};
30
33template <class T> class GenericAuxDecorationBranch: public VectorBranch<T>, virtual public IAuxElementDecorationBranch{
34 public:
35 using FuncType_t = std::function<T(const SG::AuxElement*)>;
40 GenericAuxDecorationBranch(TTree* t, const std::string& var_name, const FuncType_t& func);
45 GenericAuxDecorationBranch(MuonTesterTree& t, const std::string& var_name, const FuncType_t& func);
46
48
49 void push_back(const SG::AuxElement* p) override;
50 void push_back(const SG::AuxElement& p) override;
51 void operator+=(const SG::AuxElement* p) override;
52 void operator+=(const SG::AuxElement& p) override;
53 private:
55};
56
57template <class T> class ParticleVariableBranch : public AuxElementBranch<T>, virtual public IParticleDecorationBranch {
58public:
59 ParticleVariableBranch(TTree* t, const std::string& var_name, const std::string& acc = "");
60 ParticleVariableBranch(MuonTesterTree& t, const std::string& var_name, const std::string& acc = "");
61 virtual ~ParticleVariableBranch() = default;
62
63 void push_back(const xAOD::IParticle* p) override;
64 void push_back(const xAOD::IParticle& p) override;
66 using AuxElementBranch<T>::operator+=;
67 void operator+=(const xAOD::IParticle* p) override;
68 void operator+=(const xAOD::IParticle& p) override;
69};
70
71template <class T> class ParticleVariableBranchGeV : public ParticleVariableBranch<T> {
72public:
73 ParticleVariableBranchGeV(TTree* t, const std::string& var_name, const std::string& acc = "");
74 ParticleVariableBranchGeV(MuonTesterTree& t, const std::string& var_name, const std::string& acc = "");
75
79 void push_back(const xAOD::IParticle* p) override;
80 void push_back(const xAOD::IParticle& p) override;
81};
82}
84#endif
void push_back(const SG::AuxElement &p) override
void setAccessor(const std::string &name)
SG::ConstAccessor< T > m_acc
virtual ~AuxElementBranch()=default
AuxElementBranch(MuonTesterTree &t, const std::string &var_name, const std::string &acc="")
AuxElementBranch(TTree *t, const std::string &var_name, const std::string &acc="")
void operator+=(const SG::AuxElement &p) override
void push_back(const SG::AuxElement *p) override
Reads out a generic auxillary element and add its information to the output vector.
void operator+=(const SG::AuxElement *p) override
GenericAuxDecorationBranch(MuonTesterTree &t, const std::string &var_name, const FuncType_t &func)
Constructor taking the MuonTesterTree.
void operator+=(const SG::AuxElement *p) override
void operator+=(const SG::AuxElement &p) override
GenericAuxDecorationBranch(TTree *t, const std::string &var_name, const FuncType_t &func)
Constructor taking an ordinary tree pointer.
void push_back(const SG::AuxElement *p) override
Reads out a generic auxillary element and add its information to the output vector.
void push_back(const SG::AuxElement &p) override
std::function< T(const SG::AuxElement *)> FuncType_t
virtual std::string name() const =0
Returns the name of the branch.
bool initialized() const
Returns whether the object has been initialized or not The outcome of the variable is bound to a succ...
void push_back(const xAOD::IParticle &p) override
ParticleVariableBranchGeV(TTree *t, const std::string &var_name, const std::string &acc="")
void push_back(const xAOD::IParticle *p) override
Similar to the IAuxElementDecoration branch but only accepting IParticles.
ParticleVariableBranchGeV(MuonTesterTree &t, const std::string &var_name, const std::string &acc="")
void operator+=(const xAOD::IParticle *p) override
void push_back(const xAOD::IParticle *p) override
Similar to the IAuxElementDecoration branch but only accepting IParticles.
void push_back(const xAOD::IParticle &p) override
virtual ~ParticleVariableBranch()=default
ParticleVariableBranch(TTree *t, const std::string &var_name, const std::string &acc="")
void operator+=(const xAOD::IParticle &p) override
ParticleVariableBranch(MuonTesterTree &t, const std::string &var_name, const std::string &acc="")
size_t size() const
Returns the number of actual saved elements.
const T & getDefault() const
T & get(size_t idx)
bool hasDefault() const
VectorBranch(TTree *tree, const std::string &name)
Standard constructor.
Base class for elements of a container that can have aux data.
Definition AuxElement.h:483
Helper class to provide constant type-safe access to aux data.
Class providing the definition of the 4-vector interface.
Class to store array like branches into the n-tuples.
Definition HitValAlg.cxx:19