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"
19
20// Using directives for convenience with ROOT::Math vector types
21using ROOT::Math::PtEtaPhiEVector;
22using ROOT::Math::PtEtaPhiMVector;
23using ROOT::Math::PxPyPzEVector;
24using ROOT::Math::PxPyPzMVector;
25
26// Template function to create a PtEtaPhiMVector
27template <typename object>
28PtEtaPhiMVector GetPtEtaPhiM(const object* obj) {
29 return PtEtaPhiMVector(
30 obj->pt(), // float px and py cast to double to build pT
31 obj->eta(), // double
32 obj->phi(), // double
33 obj->m()); // double
34}
35
36// Template function to create a PtEtaPhiEVector
37template <typename object>
38PtEtaPhiEVector GetPtEtaPhiE(const object* obj) {
39 return PtEtaPhiEVector(
40 obj->pt(), // float px and py cast to double to build pT
41 obj->eta(), // double
42 obj->phi(), // double
43 obj->e()); // double
44}
45
46// Template function to create a PxPyPzMVector
47template <typename object>
48PxPyPzMVector GetPxPyPzM(const object* obj) {
49 return PxPyPzMVector(obj->px(), // float
50 obj->py(), // float
51 obj->pz(), // float
52 obj->m()); // double
53}
54
55// Template function to create a PxPyPzEVector
56template <typename object>
57PxPyPzEVector GetPxPyPzE(const object* obj) {
58 return PxPyPzEVector(obj->px(), // float
59 obj->py(), // float
60 obj->pz(), // float
61 obj->e()); // double
62}
63
64// We don't template these as some will include warnings and differ slightly!
65// This shall highlight the difference w.r.t. truth particle information
70
71#endif
PxPyPzEVector GetPxPyPzEfromTruth(const xAOD::TruthParticle *TruthParticle)
PxPyPzMVector GetPxPyPzM(const object *obj)
PtEtaPhiMVector GetPtEtaPhiM(const object *obj)
PtEtaPhiEVector GetPtEtaPhiEfromTruth(const xAOD::TruthParticle *TruthParticle)
PxPyPzEVector GetPxPyPzE(const object *obj)
PtEtaPhiMVector GetPtEtaPhiMfromTruth(const xAOD::TruthParticle *TruthParticle)
PtEtaPhiEVector GetPtEtaPhiE(const object *obj)
PxPyPzMVector GetPxPyPzMfromTruth(const xAOD::TruthParticle *TruthParticle)
TruthParticle_v1 TruthParticle
Typedef to implementation.