ATLAS Offline Software
Loading...
Searching...
No Matches
TrackChi2Branch.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
6#include <xAODMuon/Muon.h>
7namespace MuonVal{
9 VectorBranch<float>(parent.tree(), parent.name() + "_chi2"),
10 m_nDoF {std::make_shared<VectorBranch<unsigned int>>(parent.tree(), parent.name() + "_nDoF")}
11 {
12 parent.getTree().addBranch(m_nDoF);
13 m_nDoF = parent.getTree().getBranch<VectorBranch<unsigned int>>(m_nDoF->name());
14 }
16 const xAOD::TrackParticle* trk = nullptr;
18 trk = static_cast<const xAOD::TrackParticle*>(p);
19 } else if (p->type() == xAOD::Type::ObjectType::Muon) {
20 trk = static_cast<const xAOD::Muon*>(p)->primaryTrackParticle();
21 } else {
22 THROW_EXCEPTION("No track particle object has been given to " <<name());
23 }
24
25 push_back(trk->chiSquared());
26 m_nDoF->push_back(trk->numberDoF());
27 }
31}
Helper class to easily to add xAOD::IParticles and associated decorator variables to the MuonTesterTr...
std::string name() const override final
TTree * tree() override final
void operator+=(const xAOD::IParticle *p) override
std::shared_ptr< VectorBranch< unsigned int > > m_nDoF
void push_back(const xAOD::IParticle *p) override
Similar to the IAuxElementDecoration branch but only accepting IParticles.
TrackChi2Branch(IParticleFourMomBranch &parent)
VectorBranch(TTree *tree, const std::string &name)
Class providing the definition of the 4-vector interface.
float numberDoF() const
Returns the number of degrees of freedom of the overall track or vertex fit as float.
float chiSquared() const
Returns the of the overall track fit.
Class to store array like branches into the n-tuples.
Definition HitValAlg.cxx:19
STL namespace.
@ TrackParticle
The object is a charged track particle.
Definition ObjectType.h:43
@ Muon
The object is a muon.
Definition ObjectType.h:48
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10