ATLAS Offline Software
Tracking
Acts
ActsEvent
Root
ParticleHypothesisEncoding.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
ActsEvent/ParticleHypothesisEncoding.h
"
5
6
#include <stdexcept>
7
8
#include "
CxxUtils/AthUnlikelyMacros.h
"
9
10
namespace
ActsTrk::ParticleHypothesis
{
11
12
xAOD::ParticleHypothesis
convert
(
Acts::ParticleHypothesis
h
) {
13
if
(
ATH_LIKELY
(
h
==
Acts::ParticleHypothesis::pion
())) {
14
return
xAOD::pion
;
15
}
else
if
(
h
==
Acts::ParticleHypothesis::muon
()) {
16
return
xAOD::muon
;
17
}
else
if
(
h
==
Acts::ParticleHypothesis::electron
()) {
18
return
xAOD::electron
;
19
}
else
if
(
h
==
Acts::ParticleHypothesis::geantino
()) {
20
return
xAOD::geantino
;
21
}
else
{
22
throw
std::domain_error(
23
"ActsTrk::ParticleHypothesis conversion to xAOD does not handle particle of abs(pdg)"
+
std::to_string
(
h
.absolutePdg()));
24
}
25
return
xAOD::undefined
;
26
}
27
28
Acts::ParticleHypothesis
convert
(
Trk::ParticleHypothesis
h
) {
29
switch
(
h
) {
30
using
enum
Trk::ParticleHypothesis
;
31
case
pion
:
32
return
Acts::ParticleHypothesis::pion
();
33
case
geantino
:
34
return
Acts::ParticleHypothesis::chargedGeantino();
35
case
electron
:
36
return
Acts::ParticleHypothesis::electron
();
37
case
muon
:
38
return
Acts::ParticleHypothesis::muon
();
39
case
kaon
:
40
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts does not handle kaon"
);
41
case
proton
:
42
return
Acts::ParticleHypothesis
(Acts::PdgParticle::eProton);
43
case
photon
:
44
return
Acts::ParticleHypothesis::photon
();
45
case
neutron
:
46
return
Acts::ParticleHypothesis
(Acts::PdgParticle::eNeutron);
47
case
pi0
:
48
return
Acts::ParticleHypothesis::pion0();
49
case
k0
:
50
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts does not handle k0"
);
51
case
nonInteractingMuon
:
52
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts does not handle nonInteractingMuon"
);
53
default
:
54
break
;
55
}
56
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts failed for"
+
std::to_string
(
h
));
57
}
58
59
Acts::ParticleHypothesis
convert
(
xAOD::ParticleHypothesis
h
) {
60
switch
(
h
) {
61
case
xAOD::geantino
:
62
return
Acts::ParticleHypothesis::geantino
();
63
case
xAOD::electron
:
64
return
Acts::ParticleHypothesis::electron
();
65
case
xAOD::muon
:
66
return
Acts::ParticleHypothesis::muon
();
67
case
xAOD::pion
:
68
return
Acts::ParticleHypothesis::pion
();
69
case
xAOD::kaon
:
70
throw
std::domain_error(
71
"ActsTrk::ParticleHypothesis conversion to Acts does not handle "
72
"kaon"
);
73
// return Acts::ParticleHypothesis(321); // TODO add in ACTS
74
case
xAOD::proton
:
75
return
Acts::ParticleHypothesis
(Acts::PdgParticle::eProton);
76
case
xAOD::photon
:
77
return
Acts::ParticleHypothesis::photon
();
78
case
xAOD::neutron
:
79
throw
std::domain_error(
80
"ActsTrk::ParticleHypothesis conversion to Acts doe not handle "
81
"neutron"
);
82
// return Acts::ParticleHypothesis(2112); // TODO add in ACTS
83
case
xAOD::pi0
:
84
return
Acts::ParticleHypothesis::pion0();
85
case
xAOD::k0
:
86
throw
std::domain_error(
87
"ActsTrk::ParticleHypothesis conversion to Acts doe not handle K0"
);
88
// return Acts::ParticleHypothesis(311); // TODO add in ACTS
89
case
xAOD::nonInteractingMuon
:
90
throw
std::domain_error(
91
"ActsTrk::ParticleHypothesis conversion to Acts does not handle "
92
"nonInteractingMuon"
);
93
case
xAOD::undefined
:
94
throw
std::domain_error(
95
"ActsTrk::ParticleHypothesis conversion to Acts does not handle "
96
"undefined/noHypothesis"
);
97
default
:
98
throw
std::domain_error(
99
"ActsTrk::ParticleHypothesis conversion to Acts failed for"
+
100
std::to_string
(
h
));
101
}
102
}
103
}
// namespace ActsTrk::ParticleHypothesis
xAOD::neutron
@ neutron
for Fatras usage
Definition:
TrackingPrimitives.h:201
xAOD::muon
@ muon
Definition:
TrackingPrimitives.h:196
ActsTrk::ParticleHypothesis
Definition:
ParticleHypothesisEncoding.h:11
xAOD::electron
@ electron
Definition:
TrackingPrimitives.h:195
ActsTrk::ParticleHypothesis::convert
xAOD::ParticleHypothesis convert(Acts::ParticleHypothesis h)
Definition:
ParticleHypothesisEncoding.cxx:12
xAOD::pion
@ pion
Definition:
TrackingPrimitives.h:197
xAOD::geantino
@ geantino
Definition:
TrackingPrimitives.h:194
Trk::ParticleHypothesis
ParticleHypothesis
Definition:
ParticleHypothesis.h:28
AthUnlikelyMacros.h
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition:
GeometryDefs.h:34
xAOD::proton
@ proton
Definition:
TrackingPrimitives.h:199
xAOD::ParticleHypothesis
ParticleHypothesis
Definition:
TrackingPrimitives.h:193
xAOD::pi0
@ pi0
for Fatras usage
Definition:
TrackingPrimitives.h:202
xAOD::nonInteractingMuon
@ nonInteractingMuon
for Fatras usage
Definition:
TrackingPrimitives.h:204
xAOD::k0
@ k0
for Fatras usage
Definition:
TrackingPrimitives.h:203
ParticleHypothesisEncoding.h
ATH_LIKELY
#define ATH_LIKELY(x)
Definition:
AthUnlikelyMacros.h:16
xAOD::photon
@ photon
Definition:
TrackingPrimitives.h:200
h
xAOD::kaon
@ kaon
Definition:
TrackingPrimitives.h:198
xAOD::EgammaParameters::electron
@ electron
Definition:
EgammaEnums.h:18
xAOD::undefined
@ undefined
Definition:
TrackingPrimitives.h:206
Generated on Mon Sep 29 2025 21:16:25 for ATLAS Offline Software by
1.8.18