ATLAS Offline Software
Loading...
Searching...
No Matches
TrkExtrapolator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// class header include
6#include "TrkExtrapolator.h"
7
8
10
14
15
17ISF::TrkExtrapolator::TrkExtrapolator(const std::string& t, const std::string& n, const IInterface* p)
18 : base_class(t,n,p),
19 m_extrapolator("Trk::Extrapolator/AtlasExtrapolator"),
21 m_trackingVolume(0),
22 m_pdgToParticleHypothesis(new Trk::PdgToParticleHypothesis())
23{
24 declareProperty( "TrackingVolumeName",
26 "Name of the TrackingVolume within which the extrapolation is to be carried out");
27 declareProperty( "Extrapolator",
29 "Extrapolator used for track extrapolation" );
30}
31
37
38
41{
42 ATH_MSG_VERBOSE("initialize() begin");
43
44 StatusCode sc = m_extrapolator.retrieve();
45 if (sc.isFailure()){
46 ATH_MSG_FATAL( "Could not retrieve " << m_extrapolator );
47 return StatusCode::FAILURE;
48 }
49 // initialize the TrackingGeometryReadKey
51
52 ATH_MSG_VERBOSE("initialize() successful");
53 return StatusCode::SUCCESS;
54}
55
58{
59 ATH_MSG_VERBOSE("finalize() begin");
60
61 ATH_MSG_VERBOSE("finalize() successful");
62 return StatusCode::SUCCESS;
63}
64
67
68 const EventContext& ctx = Gaudi::Hive::currentContext();
69 if( m_extrapolator.empty() ) {
70 ATH_MSG_ERROR( "Problem with extrapolator!" );
71 return 0;
72 }
73
74 if ( !m_trackingVolume.get() ) {
75 // ------------------------------- get the trackingGeometry at first place
77 if (!readHandle.isValid() || *readHandle == nullptr) {
78 ATH_MSG_ERROR("Problem with TrackingGeometry '" << m_trackingGeometryReadKey.fullKey() << "' from CondStore.");
79 return 0;
80 }
81
82 const Trk::TrackingGeometry* trackingGeometry = *readHandle;
83 const Trk::TrackingVolume* trackingVolume = trackingGeometry->trackingVolume( m_trackingVolumeName);
84 if (!trackingVolume) {
85 ATH_MSG_FATAL("Failed to retrieve TrackingVolume: " << m_trackingVolumeName);
86 return 0;
87 }
88 m_trackingVolume.set(trackingVolume);
89 }
90
91 // create objects from ISFParticle needed for extrapolation
92 Trk::CurvilinearParameters par(particle.position(),particle.momentum(),particle.charge());
93
94 int absPdg = abs(particle.pdgCode());
95 //bool photon = (absPdg == 22);
96 //bool geantino = (absPdg == 999);
97 //bool charged = photon || geantino ? false : (particle.charge()*particle.charge() > 0) ;
98
99 Trk::ParticleHypothesis particleHypo =
100 m_pdgToParticleHypothesis->convert(particle.pdgCode(),particle.charge());
101 if ( absPdg == 999 ) particleHypo = Trk::geantino;
102
103 // extrapolate to calorimeter entry
104 const Trk::TrackParameters* extrapolatedPars = m_extrapolator->extrapolateToVolume(ctx,
105 par,
106 *m_trackingVolume.get(),
108 particleHypo).release();
109
110 // create a new ISF particle representing the given particle at the extrapolated position
111 ISFParticle *extrapolatedParticle = new ISFParticle( extrapolatedPars->position(),
112 extrapolatedPars->momentum(),
113 particle.mass(),
114 particle.charge(),
115 particle.pdgCode(),
116 particle.status(),
117 particle.timeStamp(),
118 particle,
119 particle.id() // FIXME should this be undefined instead?
120 );
121
122 // cleanup
123 delete extrapolatedPars;
124
125 return extrapolatedParticle;
126}
127
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
static Double_t sc
The generic ISF particle definition,.
Definition ISFParticle.h:42
virtual StatusCode initialize() override
Athena AlgTool initialization.
ToolHandle< Trk::IExtrapolator > m_extrapolator
extrapolation to calo entry
Trk::PdgToParticleHypothesis * m_pdgToParticleHypothesis
converts PDG ID to hypothesis for TrackParameters
~TrkExtrapolator()
Destructor.
virtual StatusCode finalize() override
Athena AlgTool finalization.
TrkExtrapolator(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
std::string m_trackingVolumeName
name of the volume within the extrapolation is carried out
virtual ISF::ISFParticle * extrapolate(const ISF::ISFParticle &particle) const override
Extrapolate the given ISFParticle.
SG::ReadCondHandleKey< Trk::TrackingGeometry > m_trackingGeometryReadKey
tracking geometry for geometry signature
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
The TrackingGeometry class is the owner of the constructed TrackingVolumes.
const TrackingVolume * trackingVolume(const std::string &name) const
return the tracking Volume by name, 0 if it doesn't exist
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
Ensure that the ATLAS eigen extensions are properly loaded.
@ alongMomentum
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters