ATLAS Offline Software
Loading...
Searching...
No Matches
FourVectorBranch.cxx
Go to the documentation of this file.
1/*
2Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5
6namespace MuonVal {
7PtEtaPhiEBranch::PtEtaPhiEBranch(MuonTesterTree& tree, const std::string& vec_name) : MuonTesterBranch(tree, vec_name) {}
8void PtEtaPhiEBranch::push_back(const float pt, const float eta, const float phi, const float e) {
9 m_pt += pt;
10 m_eta += eta;
11 m_phi += phi;
12 m_e += e;
13}
14void PtEtaPhiEBranch::set(const float pt, const float eta, const float phi, const float e, size_t pos) {
15 m_pt[pos] = pt;
16 m_eta[pos] = eta;
17 m_phi[pos] = phi;
18 m_e[pos] = e;
19}
20void PtEtaPhiEBranch::push_back(const TLorentzVector& vec) { push_back(vec.Pt(), vec.Eta(), vec.Phi(), vec.E()); }
21void PtEtaPhiEBranch::operator+=(const TLorentzVector& vec) { push_back(vec); }
22void PtEtaPhiEBranch::set(const TLorentzVector& vec, size_t pos) { set(vec.Pt(), vec.Eta(), vec.Phi(), vec.E(), pos); }
23#ifndef XAOD_ANALYSIS
25{
26 float eta = 0;
27 if (vec.perp()/std::abs(vec.pz()) < 1e-8) {
28 if (vec.pz() > 0)
29 eta = 1e72;
30 else
31 eta = -1e72;
32 }
33 else {
34 eta = vec.eta();
35 }
36 push_back(vec.perp(), eta, vec.phi(), vec.e());
37}
38void PtEtaPhiEBranch::set(const HepMC::FourVector& vec, size_t pos) { set(vec.perp(), vec.eta(), vec.phi(), vec.e(), pos); }
40#endif
41size_t PtEtaPhiEBranch::size() const { return m_e.size(); }
42bool PtEtaPhiEBranch::fill(const EventContext&) { return true; }
43bool PtEtaPhiEBranch::init() { return true; }
44
46 MuonTesterBranch(tree, vec_name), m_mom{t == Type::Mom} {}
47void CartesFourVecBranch::push_back(const TLorentzVector& vec) { push_back(vec.X(), vec.Y(), vec.Z(), vec.T()); }
48void CartesFourVecBranch::operator+=(const TLorentzVector& vec) { push_back(vec); }
49void CartesFourVecBranch::set(const TLorentzVector& vec, size_t pos) { set(vec.X(), vec.Y(), vec.Z(), vec.T(), pos); }
50#ifndef XAOD_ANALYSIS
53void CartesFourVecBranch::set(const HepMC::FourVector& vec, size_t pos) { set(vec.x(), vec.y(), vec.z(), vec.t(), pos); }
54#endif
55size_t CartesFourVecBranch::size() const { return m_x.size(); }
56bool CartesFourVecBranch::fill(const EventContext&) { return true; }
57bool CartesFourVecBranch::init() { return true; }
58void CartesFourVecBranch::push_back(const float x, const float y, const float z, const float t) {
59 m_x += x;
60 m_y += y;
61 m_z += z;
62 m_t += t;
63}
64void CartesFourVecBranch::set(const float x, const float y, const float z, const float t, size_t pos) {
65 m_x[pos] = x;
66 m_y[pos] = y;
67 m_z[pos] = z;
68 m_t[pos] = t;
69}
70}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
std::vector< size_t > vec
#define y
#define x
#define z
VectorBranch< float > & m_x
CartesFourVecBranch(MuonTesterTree &tree, const std::string &vec_name, Type t)
VectorBranch< float > & m_t
void set(const TLorentzVector &vec, size_t pos)
VectorBranch< float > & m_z
bool init() override final
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
void push_back(const TLorentzVector &vec)
void operator+=(const TLorentzVector &vec)
bool fill(const EventContext &) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
VectorBranch< float > & m_y
MuonTesterBranch(MuonTesterTree &tree, const std::string &br_name)
TTree * tree() override final
Returns the underlying TTree object.
bool fill(const EventContext &) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
VectorBranch< float > & m_phi
VectorBranch< float > & m_eta
void push_back(const TLorentzVector &vec)
PtEtaPhiEBranch(MuonTesterTree &tree, const std::string &vec_name)
void set(const TLorentzVector &vec, size_t pos)
VectorBranch< float > & m_e
void operator+=(const TLorentzVector &vec)
VectorBranch< float > & m_pt
bool init() override final
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
HepMC3::FourVector FourVector
Class to store array like branches into the n-tuples.
Definition HitValAlg.cxx:19