ATLAS Offline Software
FourVectorBranch.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef MUONTESTER_MUONFOURVECTORBRANCH_H
5 #define MUONTESTER_MUONFOURVECTORBRANCH_H
6 #ifndef XAOD_ANALYSIS
8 #endif
10 #include <TLorentzVector.h>
11 
12 namespace MuonVal {
16 public:
17  PtEtaPhiEBranch(MuonTesterTree& tree, const std::string& vec_name);
18 
19  void push_back(const TLorentzVector& vec);
20  void operator+=(const TLorentzVector& vec);
21  void set(const TLorentzVector& vec, size_t pos);
22 #ifndef XAOD_ANALYSIS
23  void push_back(const HepMC::FourVector& vec);
24  void operator+=(const HepMC::FourVector& vec);
25  void set(const HepMC::FourVector& vec, size_t pos);
26 #endif
27 
28  void push_back(const float pt, const float eta, const float phi, const float e);
29  void set(const float pt, const float eta, const float phi, const float e, size_t pos);
30 
31  size_t size() const;
32 
33  bool fill(const EventContext&) override final;
34  bool init() override final;
35 
36 private:
41 };
42 
46 public:
47  enum class Type { Mom, Pos };
48  CartesFourVecBranch(MuonTesterTree& tree, const std::string& vec_name, Type t);
49 
50  void push_back(const TLorentzVector& vec);
51  void operator+=(const TLorentzVector& vec);
52  void set(const TLorentzVector& vec, size_t pos);
53 #ifndef XAOD_ANALYSIS
54  void push_back(const HepMC::FourVector& vec);
55  void operator+=(const HepMC::FourVector& vec);
56  void set(const HepMC::FourVector& vec, size_t pos);
57 #endif
58  void push_back(const float x, const float y, const float z, const float t);
59  void set(const float x, const float y, const float z, const float t, size_t pos);
60 
61  size_t size() const;
62 
63  bool fill(const EventContext&) override final;
64  bool init() override final;
65 
66 private:
67  bool m_mom{false};
68  VectorBranch<float>& m_x{parent().newVector<float>(name() + (m_mom ? "Px" : "X"))};
69  VectorBranch<float>& m_y{parent().newVector<float>(name() + (m_mom ? "Py" : "Y"))};
70  VectorBranch<float>& m_z{parent().newVector<float>(name() + (m_mom ? "Pz" : "Z"))};
71  VectorBranch<float>& m_t{parent().newVector<float>(name() + (m_mom ? "E" : "T"))};
72 };
73 }
74 #endif
MuonVal::CartesFourVecBranch::m_mom
bool m_mom
Definition: FourVectorBranch.h:67
MuonVal::CartesFourVecBranch::Type::Pos
@ Pos
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
test_pyathena.pt
pt
Definition: test_pyathena.py:11
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
MuonVal::VectorBranch< float >
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ThreeVectorBranch.h
x
#define x
MuonVal::MuonTesterBranch::tree
TTree * tree() override final
Returns the underlying TTree object.
Definition: MuonTesterBranch.cxx:53
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
SimpleVector.h
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
MuonVal::MuonTesterTree::newVector
VectorBranch< T > & newVector(const std::string &name)
Creates new branches and returns their reference.
xAODType
Definition: ObjectType.h:13
MuonVal::MuonTesterBranch::name
std::string name() const override final
Returns the name of the branch.
Definition: MuonTesterBranch.cxx:51
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
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
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::MuonTesterBranch::parent
MuonTesterTree & parent()
Returns the reference to the MuonTesterTree parent.
Definition: MuonTesterBranch.cxx:38
MuonVal::PtEtaPhiEBranch
Helper class to store the four-momentum in a TTree using the Pt, Eta, Phi, E representation.
Definition: FourVectorBranch.h:15
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
Helper class to store the four-momentum in a TTree using the X,Y,Z,T or Px,Py,Pz,E representation.
Definition: FourVectorBranch.h:45
MuonVal::CartesFourVecBranch::Type::Mom
@ Mom
MuonVal::CartesFourVecBranch::m_t
VectorBranch< float > & m_t
Definition: FourVectorBranch.h:71