ATLAS Offline Software
FourVectorBranch.cxx
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
5 
6 namespace MuonVal {
7 PtEtaPhiEBranch::PtEtaPhiEBranch(MuonTesterTree& tree, const std::string& vec_name) : MuonTesterBranch(tree, vec_name) {}
8 void 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 }
14 void 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 }
20 void PtEtaPhiEBranch::push_back(const TLorentzVector& vec) { push_back(vec.Pt(), vec.Eta(), vec.Phi(), vec.E()); }
21 void PtEtaPhiEBranch::operator+=(const TLorentzVector& vec) { push_back(vec); }
22 void PtEtaPhiEBranch::set(const TLorentzVector& vec, size_t pos) { set(vec.Pt(), vec.Eta(), vec.Phi(), vec.E(), pos); }
23 #ifndef XAOD_ANALYSIS
24 void PtEtaPhiEBranch::push_back(const HepMC::FourVector& vec) { push_back(vec.perp(), vec.eta(), vec.phi(), vec.e()); }
25 void PtEtaPhiEBranch::set(const HepMC::FourVector& vec, size_t pos) { set(vec.perp(), vec.eta(), vec.phi(), vec.e(), pos); }
26 void PtEtaPhiEBranch::operator+=(const HepMC::FourVector& vec) { push_back(vec); }
27 #endif
28 size_t PtEtaPhiEBranch::size() const { return m_e.size(); }
29 bool PtEtaPhiEBranch::fill(const EventContext&) { return true; }
30 bool PtEtaPhiEBranch::init() { return true; }
31 
33  MuonTesterBranch(tree, vec_name), m_mom{t == Type::Mom} {}
34 void CartesFourVecBranch::push_back(const TLorentzVector& vec) { push_back(vec.X(), vec.Y(), vec.Z(), vec.T()); }
35 void CartesFourVecBranch::operator+=(const TLorentzVector& vec) { push_back(vec); }
36 void CartesFourVecBranch::set(const TLorentzVector& vec, size_t pos) { set(vec.X(), vec.Y(), vec.Z(), vec.T(), pos); }
37 #ifndef XAOD_ANALYSIS
38 void CartesFourVecBranch::push_back(const HepMC::FourVector& vec) { push_back(vec.x(), vec.y(), vec.z(), vec.t()); }
39 void CartesFourVecBranch::operator+=(const HepMC::FourVector& vec) { push_back(vec); }
40 void CartesFourVecBranch::set(const HepMC::FourVector& vec, size_t pos) { set(vec.x(), vec.y(), vec.z(), vec.t(), pos); }
41 #endif
42 size_t CartesFourVecBranch::size() const { return m_x.size(); }
43 bool CartesFourVecBranch::fill(const EventContext&) { return true; }
44 bool CartesFourVecBranch::init() { return true; }
45 void CartesFourVecBranch::push_back(const float x, const float y, const float z, const float t) {
46  m_x += x;
47  m_y += y;
48  m_z += z;
49  m_t += t;
50 }
51 void CartesFourVecBranch::set(const float x, const float y, const float z, const float t, size_t pos) {
52  m_x[pos] = x;
53  m_y[pos] = y;
54  m_z[pos] = z;
55  m_t[pos] = t;
56 }
57 }
MuonVal::PtEtaPhiEBranch::m_eta
VectorBranch< float > & m_eta
Definition: FourVectorBranch.h:38
MuonVal::CartesFourVecBranch::m_y
VectorBranch< float > & m_y
Definition: FourVectorBranch.h:69
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
MuonVal::CartesFourVecBranch::fill
bool fill(const EventContext &) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
Definition: FourVectorBranch.cxx:43
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
MuonVal::MuonTesterBranch
Definition: MuonTesterBranch.h:21
tree
TChain * tree
Definition: tile_monitor.h:30
test_pyathena.pt
pt
Definition: test_pyathena.py:11
MuonVal::PtEtaPhiEBranch::set
void set(const HepMC::FourVector &vec, size_t pos)
Definition: FourVectorBranch.cxx:25
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
FourVectorBranch.h
x
#define x
MuonVal::PtEtaPhiEBranch::m_pt
VectorBranch< float > & m_pt
Definition: FourVectorBranch.h:37
MuonVal::PtEtaPhiEBranch::set
void set(const TLorentzVector &vec, size_t pos)
Definition: FourVectorBranch.cxx:22
MuonVal::CartesFourVecBranch::push_back
void push_back(const TLorentzVector &vec)
Definition: FourVectorBranch.cxx:34
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
MuonVal::PtEtaPhiEBranch::m_e
VectorBranch< float > & m_e
Definition: FourVectorBranch.h:40
z
#define z
MuonVal::PtEtaPhiEBranch::m_phi
VectorBranch< float > & m_phi
Definition: FourVectorBranch.h:39
MuonVal::CartesFourVecBranch::CartesFourVecBranch
CartesFourVecBranch(MuonTesterTree &tree, const std::string &vec_name, Type t)
Definition: FourVectorBranch.cxx:32
MuonVal::PtEtaPhiEBranch::size
size_t size() const
Definition: FourVectorBranch.cxx:28
MuonVal::PtEtaPhiEBranch::PtEtaPhiEBranch
PtEtaPhiEBranch(MuonTesterTree &tree, const std::string &vec_name)
Definition: FourVectorBranch.cxx:7
MuonVal::CartesFourVecBranch::init
bool init() override final
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
Definition: FourVectorBranch.cxx:44
MuonVal::CartesFourVecBranch::size
size_t size() const
Definition: FourVectorBranch.cxx:42
MuonVal::PtEtaPhiEBranch::fill
bool fill(const EventContext &) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
Definition: FourVectorBranch.cxx:29
xAODType
Definition: ObjectType.h:13
MuonVal::CartesFourVecBranch::set
void set(const TLorentzVector &vec, size_t pos)
Definition: FourVectorBranch.cxx:36
MuonVal
Class to store array like branches into the n-tuples.
Definition: MuonTPMetaDataAlg.cxx:25
MuonVal::PtEtaPhiEBranch::push_back
void push_back(const TLorentzVector &vec)
Definition: FourVectorBranch.cxx:20
MuonVal::CartesFourVecBranch::operator+=
void operator+=(const TLorentzVector &vec)
Definition: FourVectorBranch.cxx:35
MuonVal::CartesFourVecBranch::m_z
VectorBranch< float > & m_z
Definition: FourVectorBranch.h:70
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonVal::PtEtaPhiEBranch::operator+=
void operator+=(const TLorentzVector &vec)
Definition: FourVectorBranch.cxx:21
MuonVal::PtEtaPhiEBranch::init
bool init() override final
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
Definition: FourVectorBranch.cxx:30
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
MuonVal::CartesFourVecBranch::m_x
VectorBranch< float > & m_x
Definition: FourVectorBranch.h:68
y
#define y
MuonVal::CartesFourVecBranch::Type::Mom
@ Mom
MuonVal::VectorBranch::size
size_t size() const
Returns the number of actual saved elements.
MuonVal::CartesFourVecBranch::m_t
VectorBranch< float > & m_t
Definition: FourVectorBranch.h:71