ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::ParticleHypothesis Namespace Reference

Functions

xAOD::ParticleHypothesis convert (Acts::ParticleHypothesis h)
Acts::ParticleHypothesis convert (xAOD::ParticleHypothesis h)
Acts::ParticleHypothesis convert (Trk::ParticleHypothesis h)
Trk::ParticleHypothesis convertTrk (Acts::ParticleHypothesis h)

Function Documentation

◆ convert() [1/3]

xAOD::ParticleHypothesis ActsTrk::ParticleHypothesis::convert ( Acts::ParticleHypothesis h)

Definition at line 25 of file ParticleHypothesisEncoding.cxx.

25 {
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}
Header file for AthHistogramAlgorithm.
#define likely(x)

◆ convert() [2/3]

Acts::ParticleHypothesis ActsTrk::ParticleHypothesis::convert ( Trk::ParticleHypothesis h)

Definition at line 41 of file ParticleHypothesisEncoding.cxx.

41 {
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}
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.

◆ convert() [3/3]

Acts::ParticleHypothesis ActsTrk::ParticleHypothesis::convert ( xAOD::ParticleHypothesis h)

Definition at line 72 of file ParticleHypothesisEncoding.cxx.

72 {
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
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}
@ pi0
for Fatras usage
@ nonInteractingMuon
for Fatras usage
@ neutron
for Fatras usage
@ k0
for Fatras usage

◆ convertTrk()

Trk::ParticleHypothesis ActsTrk::ParticleHypothesis::convertTrk ( Acts::ParticleHypothesis h)

Definition at line 10 of file ParticleHypothesisEncoding.cxx.

10 {
11 if (h == Acts::ParticleHypothesis::pion()) [[likely]] {
13 } else if ( h == Acts::ParticleHypothesis::muon()) {
15 } else if (h == Acts::ParticleHypothesis::electron()) {
17 } else if (h == Acts::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 }
24 }