ATLAS Offline Software
Loading...
Searching...
No Matches
LinkerBranch.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_LINKERBRANCH_H
5#define MUONTESTER_LINKERBRANCH_H
6
9
10namespace MuonVal{
17 class LinkerBranch : public VectorBranch<unsigned short>,
18 virtual public IParticleDecorationBranch {
19 public:
21 using ParticleBranch_ptr = std::shared_ptr<IParticleFourMomBranch>;
22
25 using Linker_t = std::function<const xAOD::IParticle*(const xAOD::IParticle*)>;
26
35 ParticleBranch_ptr linkColl,
36 Linker_t linker,
37 const std::string& altName = "");
39 using VectorBranch<unsigned short>::push_back;
41 void push_back(const xAOD::IParticle* p) override;
42 void push_back(const xAOD::IParticle& p) override;
43 void operator+=(const xAOD::IParticle* p) override;
44 void operator+=(const xAOD::IParticle& p) override;
45
46 private:
47 std::weak_ptr<IParticleFourMomBranch> m_linkColl;
49 };
50
51 class BilateralLinkerBranch: public VectorBranch<unsigned short>,
52 virtual public IParticleDecorationBranch {
53 public:
57 using VectorBranch<unsigned short>::push_back;
59 void push_back(const xAOD::IParticle* p) override;
60 void push_back(const xAOD::IParticle& p) override;
61 void operator+=(const xAOD::IParticle* p) override;
62 void operator+=(const xAOD::IParticle& p) override;
63
64 bool fill(const EventContext& ctx) override;
65
66 static bool connectCollections(ParticleBranch_ptr primColl,
67 ParticleBranch_ptr secondColl,
68 Linker_t fromPrimToSec,
69 const std::string& altPrimName ="",
70 const std::string& altSecName = "");
71 private:
73 ParticleBranch_ptr primColl,
74 Linker_t linker,
75 const std::string& altName);
77 std::weak_ptr<IParticleFourMomBranch> m_linkColl;
79
80
81 };
82}
83#endif
BilateralLinkerBranch(IParticleFourMomBranch &bilatColl, ParticleBranch_ptr primColl, Linker_t linker, const std::string &altName)
bool fill(const EventContext &ctx) override
The fill method checks if enough information is provided such that the branch is cleared from the inf...
LinkerBranch::Linker_t Linker_t
LinkerBranch::ParticleBranch_ptr ParticleBranch_ptr
static bool connectCollections(ParticleBranch_ptr primColl, ParticleBranch_ptr secondColl, Linker_t fromPrimToSec, const std::string &altPrimName="", const std::string &altSecName="")
const IParticleFourMomBranch & m_parent
std::weak_ptr< IParticleFourMomBranch > m_linkColl
void operator+=(const xAOD::IParticle *p) override
void push_back(const xAOD::IParticle *p) override
Interface methods to handle the particle.
Helper class to easily to add xAOD::IParticles and associated decorator variables to the MuonTesterTr...
std::function< const xAOD::IParticle *(const xAOD::IParticle *)> Linker_t
Typedef of the linker function.
void operator+=(const xAOD::IParticle *p) override
LinkerBranch(IParticleFourMomBranch &parent, ParticleBranch_ptr linkColl, Linker_t linker, const std::string &altName="")
Standard constructor fo the LinkerBranch.
std::shared_ptr< IParticleFourMomBranch > ParticleBranch_ptr
Abreviation of the pointer to the particle branch.
void push_back(const xAOD::IParticle *p) override
Interface methods to handle the particle.
std::weak_ptr< IParticleFourMomBranch > m_linkColl
VectorBranch(TTree *tree, const std::string &name)
Class providing the definition of the 4-vector interface.
Class to store array like branches into the n-tuples.
Definition HitValAlg.cxx:19