ATLAS Offline Software
ThreeVectorBranch.cxx
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
5 namespace MuonVal {
6 
7 bool ThreeVectorBranch::fill(const EventContext&) { return true; }
8 bool ThreeVectorBranch::init() { return true; }
9 
10 ThreeVectorBranch::ThreeVectorBranch(MuonTesterTree& tree, const std::string& vec_name) : MuonTesterBranch(tree, vec_name) {}
11 size_t ThreeVectorBranch::size() const { return m_x.size(); }
12 
13 void ThreeVectorBranch::push_back(const float x, const float y, const float z) {
14  m_x += x;
15  m_y += y;
16  m_z += z;
17 }
18 void ThreeVectorBranch::set(const float x, const float y, const float z, size_t pos) {
19  m_x[pos] = x;
20  m_y[pos] = y;
21  m_z[pos] = z;
22 }
24 void ThreeVectorBranch::set(const Amg::Vector3D& vec, size_t pos) { set(vec[0], vec[1], vec[2], pos); }
26 #ifndef HEPMC3
27 #ifndef XAOD_ANALYSIS
28 void ThreeVectorBranch::push_back(const HepMC::ThreeVector& vec) { push_back(vec.x(), vec.y(), vec.z()); }
29 void ThreeVectorBranch::set(const HepMC::ThreeVector& vec, size_t pos) { set(vec.x(), vec.y(), vec.z(), pos); }
30 void ThreeVectorBranch::operator+=(const HepMC::ThreeVector& vec) { push_back(vec); }
31 #endif
32 #endif
33 void ThreeVectorBranch::push_back(const TVector3& vec) { push_back(vec.X(), vec.Y(), vec.Z()); }
34 void ThreeVectorBranch::operator+=(const TVector3& vec) { push_back(vec); }
35 void ThreeVectorBranch::set(const TVector3& vec, size_t pos) { set(vec.X(), vec.Y(), vec.Z(), pos); }
36 }
MuonVal::MuonTesterBranch
Definition: MuonTesterBranch.h:21
tree
TChain * tree
Definition: tile_monitor.h:30
MuonVal::ThreeVectorBranch::m_z
VectorBranch< float > & m_z
Definition: ThreeVectorBranch.h:49
MuonVal::ThreeVectorBranch::ThreeVectorBranch
ThreeVectorBranch(MuonTesterTree &tree, const std::string &vec_name)
Definition: ThreeVectorBranch.cxx:10
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
ThreeVectorBranch.h
x
#define x
MuonVal::ThreeVectorBranch::init
bool init() override final
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
Definition: ThreeVectorBranch.cxx:8
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
z
#define z
MuonVal::ThreeVectorBranch::m_y
VectorBranch< float > & m_y
Definition: ThreeVectorBranch.h:48
MuonVal::ThreeVectorBranch::operator+=
void operator+=(const Amg::Vector3D &vec)
Definition: ThreeVectorBranch.cxx:25
MuonVal::ThreeVectorBranch::m_x
VectorBranch< float > & m_x
Definition: ThreeVectorBranch.h:47
MuonVal
Class to store array like branches into the n-tuples.
Definition: MuonTPMetaDataAlg.cxx:25
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
y
#define y
MuonVal::ThreeVectorBranch::set
void set(const Amg::Vector3D &vec, size_t pos)
Definition: ThreeVectorBranch.cxx:24
MuonVal::VectorBranch::size
size_t size() const
Returns the number of actual saved elements.
MuonVal::ThreeVectorBranch::size
size_t size() const
Definition: ThreeVectorBranch.cxx:11
MuonVal::ThreeVectorBranch::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: ThreeVectorBranch.cxx:7