10 const std::string& altName):
12 std::format(
"{:}_{:}Link",
parent.name(), altName.empty() ? linkColl->name() : altName)},
14 m_linkerFunc{std::move(linker)} {}
28 linkColl->push_back(related);
36 const std::string& altPrimName,
37 const std::string& altSecName) {
38 return primColl->addVariable(std::make_unique<LinkerBranch>(*primColl, secondColl, fromPrimToSec, altPrimName)) &&
39 secondColl->addVariable(std::unique_ptr<IParticleDecorationBranch>{
new BilateralLinkerBranch(*secondColl, std::move(primColl), std::move(fromPrimToSec), altSecName)});
45 const std::string& altName):
47 std::format(
"{:}_{:}Link",
parent.name(), altName.empty() ? primColl->name() : altName)},
50 m_linkerFunc{std::move(linker)} {
70 const std::vector<const xAOD::IParticle*>& linkeMe = linkColl->getCached();
71 for (std::size_t primToSec = 0 ; primToSec < linkeMe.size(); ++primToSec) {
73 if (linkIdx <
size()) {
74 get(linkIdx) = primToSec;
#define ATH_MSG_VERBOSE(x)
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
MuonTesterTree & parent()
std::string name() const override final
void push_back(const T &value)
Adds a new element at the end of the vector.
bool fill(const EventContext &ctx) override
Clears vector in cases that it has not been updated in this event Retursn falls if the vector has not...
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.