ATLAS Offline Software
ParticleHypothesisEncoding.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
5 
6 #include <stdexcept>
7 
9 
11 
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 
29  switch (h) {
30  case xAOD::geantino:
32  case xAOD::electron:
34  case xAOD::muon:
36  case xAOD::pion:
38  case xAOD::kaon:
39  throw std::domain_error(
40  "ActsTrk::ParticleHypothesis conversion to Acts does not handle "
41  "kaon");
42  // return Acts::ParticleHypothesis(321); // TODO add in ACTS
43  case xAOD::proton:
44  return Acts::ParticleHypothesis(Acts::PdgParticle::eProton);
45  case xAOD::photon:
47  case xAOD::neutron:
48  throw std::domain_error(
49  "ActsTrk::ParticleHypothesis conversion to Acts doe not handle "
50  "neutron");
51  // return Acts::ParticleHypothesis(2112); // TODO add in ACTS
52  case xAOD::pi0:
53  return Acts::ParticleHypothesis::pion0();
54  case xAOD::k0:
55  throw std::domain_error(
56  "ActsTrk::ParticleHypothesis conversion to Acts doe not handle K0");
57  // return Acts::ParticleHypothesis(311); // TODO add in ACTS
59  throw std::domain_error(
60  "ActsTrk::ParticleHypothesis conversion to Acts does not handle "
61  "nonInteractingMuon");
62  case xAOD::undefined:
63  throw std::domain_error(
64  "ActsTrk::ParticleHypothesis conversion to Acts does not handle "
65  "undefined/noHypothesis");
66  default:
67  throw std::domain_error(
68  "ActsTrk::ParticleHypothesis conversion to Acts failed for" +
69  std::to_string(h));
70  }
71 }
72 } // namespace ActsTrk::ParticleHypothesis
xAOD::neutron
@ neutron
for Fatras usage
Definition: TrackingPrimitives.h:200
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
ActsTrk::ParticleHypothesis
Definition: ParticleHypothesisEncoding.h:11
xAOD::electron
@ electron
Definition: TrackingPrimitives.h:194
ActsTrk::ParticleHypothesis::convert
xAOD::ParticleHypothesis convert(Acts::ParticleHypothesis h)
Definition: ParticleHypothesisEncoding.cxx:12
xAOD::pion
@ pion
Definition: TrackingPrimitives.h:196
xAOD::geantino
@ geantino
Definition: TrackingPrimitives.h:193
AthUnlikelyMacros.h
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
xAOD::proton
@ proton
Definition: TrackingPrimitives.h:198
xAOD::ParticleHypothesis
ParticleHypothesis
Definition: TrackingPrimitives.h:192
xAOD::pi0
@ pi0
for Fatras usage
Definition: TrackingPrimitives.h:201
xAOD::nonInteractingMuon
@ nonInteractingMuon
for Fatras usage
Definition: TrackingPrimitives.h:203
xAOD::k0
@ k0
for Fatras usage
Definition: TrackingPrimitives.h:202
ParticleHypothesisEncoding.h
ATH_LIKELY
#define ATH_LIKELY(x)
Definition: AthUnlikelyMacros.h:16
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:199
h
xAOD::kaon
@ kaon
Definition: TrackingPrimitives.h:197
xAOD::EgammaParameters::electron
@ electron
Definition: EgammaEnums.h:18
xAOD::undefined
@ undefined
Definition: TrackingPrimitives.h:205