ATLAS Offline Software
Loading...
Searching...
No Matches
LorentzHelper.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8#ifndef LORENTZHELPER_H
9#define LORENTZHELPER_H
10
11// Include necessary header files
12#include "Math/Vector4D.h"
13#include "Math/VectorUtil.h"
15
16namespace CP {
17
18// Using directives for convenience with ROOT::Math vector types
19using ROOT::Math::PtEtaPhiEVector;
20using ROOT::Math::PtEtaPhiMVector;
21using ROOT::Math::PxPyPzEVector;
22using ROOT::Math::PxPyPzMVector;
23
24// Template function to create a PtEtaPhiMVector
25template <typename object>
26PtEtaPhiMVector GetPtEtaPhiM(const object* obj) {
27 return PtEtaPhiMVector(
28 obj->pt(), // float px and py cast to double to build pT
29 obj->eta(), // double
30 obj->phi(), // double
31 obj->m()); // double
32}
33
34// Template function to create a PtEtaPhiEVector
35template <typename object>
36PtEtaPhiEVector GetPtEtaPhiE(const object* obj) {
37 return PtEtaPhiEVector(
38 obj->pt(), // float px and py cast to double to build pT
39 obj->eta(), // double
40 obj->phi(), // double
41 obj->e()); // double
42}
43
44// Template function to create a PxPyPzMVector
45template <typename object>
46PxPyPzMVector GetPxPyPzM(const object* obj) {
47 return PxPyPzMVector(obj->px(), // float
48 obj->py(), // float
49 obj->pz(), // float
50 obj->m()); // double
51}
52
53// Template function to create a PxPyPzEVector
54template <typename object>
55PxPyPzEVector GetPxPyPzE(const object* obj) {
56 return PxPyPzEVector(obj->px(), // float
57 obj->py(), // float
58 obj->pz(), // float
59 obj->e()); // double
60}
61
62// We don't template these as some will include warnings and differ slightly!
63// This shall highlight the difference w.r.t. truth particle information
70
71} // namespace CP
72
73#endif
Select isolated Photons, Electrons and Muons.
PtEtaPhiEVector GetPtEtaPhiE(const object *obj)
PxPyPzEVector GetPxPyPzE(const object *obj)
ROOT::Math::PtEtaPhiMVector GetPtEtaPhiMfromTruth(const xAOD::TruthParticle *TruthParticle)
Four-vector of a truth particle, built from (pt, eta, phi, m) so that the mass is preserved exactly.
ROOT::Math::PxPyPzEVector GetPxPyPzEfromTruth(const xAOD::TruthParticle *TruthParticle)
PxPyPzMVector GetPxPyPzM(const object *obj)
PtEtaPhiMVector GetPtEtaPhiM(const object *obj)
ROOT::Math::PxPyPzMVector GetPxPyPzMfromTruth(const xAOD::TruthParticle *TruthParticle)
ROOT::Math::PtEtaPhiEVector GetPtEtaPhiEfromTruth(const xAOD::TruthParticle *TruthParticle)
TruthParticle_v1 TruthParticle
Typedef to implementation.