ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TruthPartonLevelAnalysisAlgorithms
VectorHelpers
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"
14
#include "
xAODTruth/TruthParticle.h
"
15
16
namespace
CP
{
17
18
// Using directives for convenience with ROOT::Math vector types
19
using
ROOT::Math::PtEtaPhiEVector;
20
using
ROOT::Math::PtEtaPhiMVector;
21
using
ROOT::Math::PxPyPzEVector;
22
using
ROOT::Math::PxPyPzMVector;
23
24
// Template function to create a PtEtaPhiMVector
25
template
<
typename
object
>
26
PtEtaPhiMVector
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
35
template
<
typename
object
>
36
PtEtaPhiEVector
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
45
template
<
typename
object
>
46
PxPyPzMVector
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
54
template
<
typename
object
>
55
PxPyPzEVector
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
66
PtEtaPhiMVector
GetPtEtaPhiMfromTruth
(
const
xAOD::TruthParticle
*
TruthParticle
);
67
PxPyPzMVector
GetPxPyPzMfromTruth
(
const
xAOD::TruthParticle
*
TruthParticle
);
68
PtEtaPhiEVector
GetPtEtaPhiEfromTruth
(
const
xAOD::TruthParticle
*
TruthParticle
);
69
PxPyPzEVector
GetPxPyPzEfromTruth
(
const
xAOD::TruthParticle
*
TruthParticle
);
70
71
}
// namespace CP
72
73
#endif
TruthParticle.h
TruthParticle
(HepMC) Monte Carlo particle.
Definition
PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h:58
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
CP::GetPtEtaPhiE
PtEtaPhiEVector GetPtEtaPhiE(const object *obj)
Definition
LorentzHelper.h:36
CP::GetPxPyPzE
PxPyPzEVector GetPxPyPzE(const object *obj)
Definition
LorentzHelper.h:55
CP::GetPtEtaPhiMfromTruth
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.
Definition
LorentzHelper.cxx:27
CP::GetPxPyPzEfromTruth
ROOT::Math::PxPyPzEVector GetPxPyPzEfromTruth(const xAOD::TruthParticle *TruthParticle)
Definition
LorentzHelper.cxx:50
CP::GetPxPyPzM
PxPyPzMVector GetPxPyPzM(const object *obj)
Definition
LorentzHelper.h:46
CP::GetPtEtaPhiM
PtEtaPhiMVector GetPtEtaPhiM(const object *obj)
Definition
LorentzHelper.h:26
CP::GetPxPyPzMfromTruth
ROOT::Math::PxPyPzMVector GetPxPyPzMfromTruth(const xAOD::TruthParticle *TruthParticle)
Definition
LorentzHelper.cxx:17
CP::GetPtEtaPhiEfromTruth
ROOT::Math::PtEtaPhiEVector GetPtEtaPhiEfromTruth(const xAOD::TruthParticle *TruthParticle)
Definition
LorentzHelper.cxx:37
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
Generated on
for ATLAS Offline Software by
1.17.0