ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsEvent
Root
ParticleHypothesisEncoding.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
ActsEvent/ParticleHypothesisEncoding.h
"
5
6
#include <stdexcept>
7
8
namespace
ActsTrk::ParticleHypothesis
{
9
10
Trk::ParticleHypothesis
convertTrk
(Acts::ParticleHypothesis
h
) {
11
if
(
h
== Acts::ParticleHypothesis::pion()) [[
likely
]] {
12
return
Trk::ParticleHypothesis::pion
;
13
}
else
if
(
h
== Acts::ParticleHypothesis::muon()) {
14
return
Trk::ParticleHypothesis::muon
;
15
}
else
if
(
h
== Acts::ParticleHypothesis::electron()) {
16
return
Trk::ParticleHypothesis::electron
;
17
}
else
if
(
h
== Acts::ParticleHypothesis::geantino()) {
18
return
Trk::ParticleHypothesis::geantino
;
19
}
else
{
20
throw
std::domain_error(
21
"ActsTrk::ParticleHypothesis conversion to Trk does not handle particle of abs(pdg)"
+ std::to_string(
h
.absolutePdg()));
22
}
23
return
Trk::ParticleHypothesis::noHypothesis
;
24
}
25
xAOD::ParticleHypothesis
convert
(Acts::ParticleHypothesis
h
) {
26
if
(
h
== Acts::ParticleHypothesis::pion()) [[
likely
]] {
27
return
xAOD::pion
;
28
}
else
if
(
h
== Acts::ParticleHypothesis::muon()) {
29
return
xAOD::muon
;
30
}
else
if
(
h
== Acts::ParticleHypothesis::electron()) {
31
return
xAOD::electron
;
32
}
else
if
(
h
== Acts::ParticleHypothesis::geantino()) {
33
return
xAOD::geantino
;
34
}
else
{
35
throw
std::domain_error(
36
"ActsTrk::ParticleHypothesis conversion to xAOD does not handle particle of abs(pdg)"
+ std::to_string(
h
.absolutePdg()));
37
}
38
return
xAOD::undefined
;
39
}
40
41
Acts::ParticleHypothesis
convert
(
Trk::ParticleHypothesis
h
) {
42
switch
(
h
) {
43
using
enum
Trk::ParticleHypothesis
;
44
case
pion:
45
return
Acts::ParticleHypothesis::pion();
46
case
geantino:
47
return
Acts::ParticleHypothesis::chargedGeantino();
48
case
electron:
49
return
Acts::ParticleHypothesis::electron();
50
case
muon:
51
return
Acts::ParticleHypothesis::muon();
52
case
kaon:
53
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts does not handle kaon"
);
54
case
proton:
55
return
Acts::ParticleHypothesis(Acts::PdgParticle::eProton);
56
case
photon:
57
return
Acts::ParticleHypothesis::photon();
58
case
neutron:
59
return
Acts::ParticleHypothesis(Acts::PdgParticle::eNeutron);
60
case
pi0:
61
return
Acts::ParticleHypothesis::pion0();
62
case
k0:
63
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts does not handle k0"
);
64
case
nonInteractingMuon:
65
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts does not handle nonInteractingMuon"
);
66
default
:
67
break
;
68
}
69
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts failed for"
+std::to_string(
h
));
70
}
71
72
Acts::ParticleHypothesis
convert
(
xAOD::ParticleHypothesis
h
) {
73
switch
(
h
) {
74
case
xAOD::geantino
:
75
return
Acts::ParticleHypothesis::geantino();
76
case
xAOD::electron
:
77
return
Acts::ParticleHypothesis::electron();
78
case
xAOD::muon
:
79
return
Acts::ParticleHypothesis::muon();
80
case
xAOD::pion
:
81
return
Acts::ParticleHypothesis::pion();
82
case
xAOD::kaon
:
83
throw
std::domain_error(
84
"ActsTrk::ParticleHypothesis conversion to Acts does not handle "
85
"kaon"
);
86
// return Acts::ParticleHypothesis(321); // TODO add in ACTS
87
case
xAOD::proton
:
88
return
Acts::ParticleHypothesis(Acts::PdgParticle::eProton);
89
case
xAOD::photon
:
90
return
Acts::ParticleHypothesis::photon();
91
case
xAOD::neutron
:
92
throw
std::domain_error(
93
"ActsTrk::ParticleHypothesis conversion to Acts doe not handle "
94
"neutron"
);
95
// return Acts::ParticleHypothesis(2112); // TODO add in ACTS
96
case
xAOD::pi0
:
97
return
Acts::ParticleHypothesis::pion0();
98
case
xAOD::k0
:
99
throw
std::domain_error(
100
"ActsTrk::ParticleHypothesis conversion to Acts doe not handle K0"
);
101
// return Acts::ParticleHypothesis(311); // TODO add in ACTS
102
case
xAOD::nonInteractingMuon
:
103
throw
std::domain_error(
104
"ActsTrk::ParticleHypothesis conversion to Acts does not handle "
105
"nonInteractingMuon"
);
106
case
xAOD::undefined
:
107
throw
std::domain_error(
108
"ActsTrk::ParticleHypothesis conversion to Acts does not handle "
109
"undefined/noHypothesis"
);
110
default
:
111
throw
std::domain_error(
112
"ActsTrk::ParticleHypothesis conversion to Acts failed for"
+
113
std::to_string(
h
));
114
}
115
}
116
}
// namespace ActsTrk::ParticleHypothesis
ParticleHypothesisEncoding.h
h
Header file for AthHistogramAlgorithm.
ActsTrk::ParticleHypothesis
Definition
ParticleHypothesisEncoding.h:11
ActsTrk::ParticleHypothesis::convertTrk
Trk::ParticleHypothesis convertTrk(Acts::ParticleHypothesis h)
Definition
ParticleHypothesisEncoding.cxx:10
ActsTrk::ParticleHypothesis::convert
xAOD::ParticleHypothesis convert(Acts::ParticleHypothesis h)
Definition
ParticleHypothesisEncoding.cxx:25
Trk::ParticleHypothesis
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
Definition
ParticleHypothesis.h:28
Trk::pion
@ pion
Definition
ParticleHypothesis.h:32
Trk::electron
@ electron
Definition
ParticleHypothesis.h:30
Trk::noHypothesis
@ noHypothesis
Definition
ParticleHypothesis.h:40
Trk::geantino
@ geantino
Definition
ParticleHypothesis.h:29
Trk::muon
@ muon
Definition
ParticleHypothesis.h:31
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::undefined
@ undefined
Definition
TrackingPrimitives.h:206
xAOD::photon
@ photon
Definition
TrackingPrimitives.h:200
xAOD::neutron
@ neutron
for Fatras usage
Definition
TrackingPrimitives.h:201
xAOD::k0
@ k0
for Fatras usage
Definition
TrackingPrimitives.h:203
xAOD::pion
@ pion
Definition
TrackingPrimitives.h:197
xAOD::muon
@ muon
Definition
TrackingPrimitives.h:196
xAOD::geantino
@ geantino
Definition
TrackingPrimitives.h:194
xAOD::proton
@ proton
Definition
TrackingPrimitives.h:199
xAOD::kaon
@ kaon
Definition
TrackingPrimitives.h:198
xAOD::electron
@ electron
Definition
TrackingPrimitives.h:195
likely
#define likely(x)
Definition
pythonic_coracool.cxx:8
Generated on
for ATLAS Offline Software by
1.17.0