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