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-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
Trk::ParticleHypothesis
convertTrk
(Acts::ParticleHypothesis
h
) {
13
if
(
ATH_LIKELY
(
h
== Acts::ParticleHypothesis::pion())) {
14
return
Trk::ParticleHypothesis::pion
;
15
}
else
if
(
h
== Acts::ParticleHypothesis::muon()) {
16
return
Trk::ParticleHypothesis::muon
;
17
}
else
if
(
h
== Acts::ParticleHypothesis::electron()) {
18
return
Trk::ParticleHypothesis::electron
;
19
}
else
if
(
h
== Acts::ParticleHypothesis::geantino()) {
20
return
Trk::ParticleHypothesis::geantino
;
21
}
else
{
22
throw
std::domain_error(
23
"ActsTrk::ParticleHypothesis conversion to Trk does not handle particle of abs(pdg)"
+ std::to_string(
h
.absolutePdg()));
24
}
25
return
Trk::ParticleHypothesis::noHypothesis
;
26
}
27
xAOD::ParticleHypothesis
convert
(Acts::ParticleHypothesis
h
) {
28
if
(
ATH_LIKELY
(
h
== Acts::ParticleHypothesis::pion())) {
29
return
xAOD::pion
;
30
}
else
if
(
h
== Acts::ParticleHypothesis::muon()) {
31
return
xAOD::muon
;
32
}
else
if
(
h
== Acts::ParticleHypothesis::electron()) {
33
return
xAOD::electron
;
34
}
else
if
(
h
== Acts::ParticleHypothesis::geantino()) {
35
return
xAOD::geantino
;
36
}
else
{
37
throw
std::domain_error(
38
"ActsTrk::ParticleHypothesis conversion to xAOD does not handle particle of abs(pdg)"
+ std::to_string(
h
.absolutePdg()));
39
}
40
return
xAOD::undefined
;
41
}
42
43
Acts::ParticleHypothesis
convert
(
Trk::ParticleHypothesis
h
) {
44
switch
(
h
) {
45
using
enum
Trk::ParticleHypothesis
;
46
case
pion:
47
return
Acts::ParticleHypothesis::pion();
48
case
geantino:
49
return
Acts::ParticleHypothesis::chargedGeantino();
50
case
electron:
51
return
Acts::ParticleHypothesis::electron();
52
case
muon:
53
return
Acts::ParticleHypothesis::muon();
54
case
kaon:
55
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts does not handle kaon"
);
56
case
proton:
57
return
Acts::ParticleHypothesis(Acts::PdgParticle::eProton);
58
case
photon:
59
return
Acts::ParticleHypothesis::photon();
60
case
neutron:
61
return
Acts::ParticleHypothesis(Acts::PdgParticle::eNeutron);
62
case
pi0:
63
return
Acts::ParticleHypothesis::pion0();
64
case
k0:
65
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts does not handle k0"
);
66
case
nonInteractingMuon:
67
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts does not handle nonInteractingMuon"
);
68
default
:
69
break
;
70
}
71
throw
std::domain_error(
"ActsTrk::ParticleHypothesis conversion to Acts failed for"
+std::to_string(
h
));
72
}
73
74
Acts::ParticleHypothesis
convert
(
xAOD::ParticleHypothesis
h
) {
75
switch
(
h
) {
76
case
xAOD::geantino
:
77
return
Acts::ParticleHypothesis::geantino();
78
case
xAOD::electron
:
79
return
Acts::ParticleHypothesis::electron();
80
case
xAOD::muon
:
81
return
Acts::ParticleHypothesis::muon();
82
case
xAOD::pion
:
83
return
Acts::ParticleHypothesis::pion();
84
case
xAOD::kaon
:
85
throw
std::domain_error(
86
"ActsTrk::ParticleHypothesis conversion to Acts does not handle "
87
"kaon"
);
88
// return Acts::ParticleHypothesis(321); // TODO add in ACTS
89
case
xAOD::proton
:
90
return
Acts::ParticleHypothesis(Acts::PdgParticle::eProton);
91
case
xAOD::photon
:
92
return
Acts::ParticleHypothesis::photon();
93
case
xAOD::neutron
:
94
throw
std::domain_error(
95
"ActsTrk::ParticleHypothesis conversion to Acts doe not handle "
96
"neutron"
);
97
// return Acts::ParticleHypothesis(2112); // TODO add in ACTS
98
case
xAOD::pi0
:
99
return
Acts::ParticleHypothesis::pion0();
100
case
xAOD::k0
:
101
throw
std::domain_error(
102
"ActsTrk::ParticleHypothesis conversion to Acts doe not handle K0"
);
103
// return Acts::ParticleHypothesis(311); // TODO add in ACTS
104
case
xAOD::nonInteractingMuon
:
105
throw
std::domain_error(
106
"ActsTrk::ParticleHypothesis conversion to Acts does not handle "
107
"nonInteractingMuon"
);
108
case
xAOD::undefined
:
109
throw
std::domain_error(
110
"ActsTrk::ParticleHypothesis conversion to Acts does not handle "
111
"undefined/noHypothesis"
);
112
default
:
113
throw
std::domain_error(
114
"ActsTrk::ParticleHypothesis conversion to Acts failed for"
+
115
std::to_string(
h
));
116
}
117
}
118
}
// namespace ActsTrk::ParticleHypothesis
AthUnlikelyMacros.h
ATH_LIKELY
#define ATH_LIKELY(x)
Definition
AthUnlikelyMacros.h:16
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:12
ActsTrk::ParticleHypothesis::convert
xAOD::ParticleHypothesis convert(Acts::ParticleHypothesis h)
Definition
ParticleHypothesisEncoding.cxx:27
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
Generated on
for ATLAS Offline Software by
1.17.0