ATLAS Offline Software
Loading...
Searching...
No Matches
AuxElementBranch.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONTESTER_AUXELEMENTBRANCH_H
5#define MUONTESTER_AUXELEMENTBRANCH_H
6
8#include <string_view>
9
10namespace MuonVal {
11template <class T> class AuxElementBranch : public VectorBranch<T>, virtual public IAuxElementDecorationBranch {
12public:
13 void setAccessor(const std::string& name);
14 void push_back(const SG::AuxElement* p) override;
15 void push_back(const SG::AuxElement& p) override;
16 void operator+=(const SG::AuxElement* p) override;
17 void operator+=(const SG::AuxElement& p) override;
18
23
24 AuxElementBranch(TTree* t, const std::string& var_name, std::string_view acc = "");
25 AuxElementBranch(MuonTesterTree& t, const std::string& var_name, std::string_view acc = "");
26
27 virtual ~AuxElementBranch() = default;
28
29private:
31};
32
35template <class T> class GenericAuxDecorationBranch: public VectorBranch<T>, virtual public IAuxElementDecorationBranch{
36 public:
37 using FuncType_t = std::function<T(const SG::AuxElement*)>;
42 GenericAuxDecorationBranch(TTree* t, const std::string& var_name, const FuncType_t& func);
47 GenericAuxDecorationBranch(MuonTesterTree& t, const std::string& var_name, const FuncType_t& func);
48
50
51 void push_back(const SG::AuxElement* p) override;
52 void push_back(const SG::AuxElement& p) override;
53 void operator+=(const SG::AuxElement* p) override;
54 void operator+=(const SG::AuxElement& p) override;
55 private:
57};
58
59template <class T> class ParticleVariableBranch : public AuxElementBranch<T>, virtual public IParticleDecorationBranch {
60public:
61 ParticleVariableBranch(TTree* t, const std::string& var_name, const std::string& acc = "");
62 ParticleVariableBranch(MuonTesterTree& t, const std::string& var_name, const std::string& acc = "");
63 virtual ~ParticleVariableBranch() = default;
64
65 void push_back(const xAOD::IParticle* p) override;
66 void push_back(const xAOD::IParticle& p) override;
68 using AuxElementBranch<T>::operator+=;
69 void operator+=(const xAOD::IParticle* p) override;
70 void operator+=(const xAOD::IParticle& p) override;
71};
72
73template <class T> class ParticleVariableBranchGeV : public ParticleVariableBranch<T> {
74public:
75 ParticleVariableBranchGeV(TTree* t, const std::string& var_name, const std::string& acc = "");
76 ParticleVariableBranchGeV(MuonTesterTree& t, const std::string& var_name, const std::string& acc = "");
77
81 void push_back(const xAOD::IParticle* p) override;
82 void push_back(const xAOD::IParticle& p) override;
83};
84}
86#endif
void push_back(const SG::AuxElement &p) override
void setAccessor(const std::string &name)
SG::ConstAccessor< T > m_acc
virtual ~AuxElementBranch()=default
AuxElementBranch(TTree *t, const std::string &var_name, std::string_view acc="")
AuxElementBranch(MuonTesterTree &t, const std::string &var_name, std::string_view 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.
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
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.