ATLAS Offline Software
Functions
ActsTrk::ParticleHypothesis Namespace Reference

Functions

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

Function Documentation

◆ convert() [1/3]

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

Definition at line 12 of file ParticleHypothesisEncoding.cxx.

12  {
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 }

◆ convert() [2/3]

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

Definition at line 28 of file ParticleHypothesisEncoding.cxx.

28  {
29  switch (h) {
30  using enum Trk::ParticleHypothesis;
31  case pion:
33  case geantino:
34  return Acts::ParticleHypothesis::chargedGeantino();
35  case electron:
37  case 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:
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 }

◆ convert() [3/3]

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

Definition at line 59 of file ParticleHypothesisEncoding.cxx.

59  {
60  switch (h) {
61  case xAOD::geantino:
63  case xAOD::electron:
65  case xAOD::muon:
67  case xAOD::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:
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
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 }
xAOD::neutron
@ neutron
for Fatras usage
Definition: TrackingPrimitives.h:201
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:196
xAOD::electron
@ electron
Definition: TrackingPrimitives.h:195
xAOD::pion
@ pion
Definition: TrackingPrimitives.h:197
xAOD::geantino
@ geantino
Definition: TrackingPrimitives.h:194
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:28
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
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