ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonValidation
MuonTesterTree
Root
FourVectorBranch.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include <
MuonTesterTree/FourVectorBranch.h
>
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
)
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
}
38
void
PtEtaPhiEBranch::set
(
const
HepMC::FourVector
&
vec
,
size_t
pos) {
set
(
vec
.perp(),
vec
.eta(),
vec
.phi(),
vec
.e(), pos); }
39
void
PtEtaPhiEBranch::operator+=
(
const
HepMC::FourVector
&
vec
) {
push_back
(
vec
); }
40
#endif
41
size_t
PtEtaPhiEBranch::size
()
const
{
return
m_e
.size(); }
42
bool
PtEtaPhiEBranch::fill
(
const
EventContext&) {
return
true
; }
43
bool
PtEtaPhiEBranch::init
() {
return
true
; }
44
45
CartesFourVecBranch::CartesFourVecBranch
(
MuonTesterTree
&
tree
,
const
std::string& vec_name,
Type
t) :
46
MuonTesterBranch
(
tree
, vec_name),
m_mom
{t ==
Type
::Mom} {}
47
void
CartesFourVecBranch::push_back
(
const
TLorentzVector&
vec
) {
push_back
(
vec
.X(),
vec
.Y(),
vec
.Z(),
vec
.T()); }
48
void
CartesFourVecBranch::operator+=
(
const
TLorentzVector&
vec
) {
push_back
(
vec
); }
49
void
CartesFourVecBranch::set
(
const
TLorentzVector&
vec
,
size_t
pos) {
set
(
vec
.X(),
vec
.Y(),
vec
.Z(),
vec
.T(), pos); }
50
#ifndef XAOD_ANALYSIS
51
void
CartesFourVecBranch::push_back
(
const
HepMC::FourVector
&
vec
) {
push_back
(
vec
.x(),
vec
.y(),
vec
.z(),
vec
.t()); }
52
void
CartesFourVecBranch::operator+=
(
const
HepMC::FourVector
&
vec
) {
push_back
(
vec
); }
53
void
CartesFourVecBranch::set
(
const
HepMC::FourVector
&
vec
,
size_t
pos) {
set
(
vec
.x(),
vec
.y(),
vec
.z(),
vec
.t(), pos); }
54
#endif
55
size_t
CartesFourVecBranch::size
()
const
{
return
m_x
.size(); }
56
bool
CartesFourVecBranch::fill
(
const
EventContext&) {
return
true
; }
57
bool
CartesFourVecBranch::init
() {
return
true
; }
58
void
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
}
64
void
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
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
FourVectorBranch.h
y
#define y
x
#define x
z
#define z
MuonVal::CartesFourVecBranch::m_x
VectorBranch< float > & m_x
Definition
FourVectorBranch.h:68
MuonVal::CartesFourVecBranch::CartesFourVecBranch
CartesFourVecBranch(MuonTesterTree &tree, const std::string &vec_name, Type t)
Definition
FourVectorBranch.cxx:45
MuonVal::CartesFourVecBranch::Type
Type
Definition
FourVectorBranch.h:47
MuonVal::CartesFourVecBranch::m_t
VectorBranch< float > & m_t
Definition
FourVectorBranch.h:71
MuonVal::CartesFourVecBranch::set
void set(const TLorentzVector &vec, size_t pos)
Definition
FourVectorBranch.cxx:49
MuonVal::CartesFourVecBranch::m_z
VectorBranch< float > & m_z
Definition
FourVectorBranch.h:70
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:57
MuonVal::CartesFourVecBranch::push_back
void push_back(const TLorentzVector &vec)
Definition
FourVectorBranch.cxx:47
MuonVal::CartesFourVecBranch::operator+=
void operator+=(const TLorentzVector &vec)
Definition
FourVectorBranch.cxx:48
MuonVal::CartesFourVecBranch::size
size_t size() const
Definition
FourVectorBranch.cxx:55
MuonVal::CartesFourVecBranch::m_mom
bool m_mom
Definition
FourVectorBranch.h:67
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:56
MuonVal::CartesFourVecBranch::m_y
VectorBranch< float > & m_y
Definition
FourVectorBranch.h:69
MuonVal::MuonTesterBranch::MuonTesterBranch
MuonTesterBranch(MuonTesterTree &tree, const std::string &br_name)
Definition
MuonTesterBranch.cxx:33
MuonVal::MuonTesterBranch::tree
TTree * tree() override final
Returns the underlying TTree object.
Definition
MuonTesterBranch.cxx:53
MuonVal::MuonTesterTree
Definition
MuonTesterTree.h:38
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:42
MuonVal::PtEtaPhiEBranch::m_phi
VectorBranch< float > & m_phi
Definition
FourVectorBranch.h:39
MuonVal::PtEtaPhiEBranch::m_eta
VectorBranch< float > & m_eta
Definition
FourVectorBranch.h:38
MuonVal::PtEtaPhiEBranch::push_back
void push_back(const TLorentzVector &vec)
Definition
FourVectorBranch.cxx:20
MuonVal::PtEtaPhiEBranch::PtEtaPhiEBranch
PtEtaPhiEBranch(MuonTesterTree &tree, const std::string &vec_name)
Definition
FourVectorBranch.cxx:7
MuonVal::PtEtaPhiEBranch::set
void set(const TLorentzVector &vec, size_t pos)
Definition
FourVectorBranch.cxx:22
MuonVal::PtEtaPhiEBranch::m_e
VectorBranch< float > & m_e
Definition
FourVectorBranch.h:40
MuonVal::PtEtaPhiEBranch::operator+=
void operator+=(const TLorentzVector &vec)
Definition
FourVectorBranch.cxx:21
MuonVal::PtEtaPhiEBranch::m_pt
VectorBranch< float > & m_pt
Definition
FourVectorBranch.h:37
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:43
MuonVal::PtEtaPhiEBranch::size
size_t size() const
Definition
FourVectorBranch.cxx:41
HepMC::FourVector
HepMC3::FourVector FourVector
Definition
SimpleVector.h:11
MuonVal
Class to store array like branches into the n-tuples.
Definition
HitValAlg.cxx:19
Generated on
for ATLAS Offline Software by
1.17.0