ATLAS Offline Software
Loading...
Searching...
No Matches
ISF::TrkExtrapolator Class Reference

An Athena AlgTool wrapper for the Tracking Extrapolator engine. More...

#include <TrkExtrapolator.h>

Inheritance diagram for ISF::TrkExtrapolator:
Collaboration diagram for ISF::TrkExtrapolator:

Public Member Functions

 TrkExtrapolator (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters.
 ~TrkExtrapolator ()
 Destructor.
virtual StatusCode initialize () override
 Athena AlgTool initialization.
virtual StatusCode finalize () override
 Athena AlgTool finalization.
virtual ISF::ISFParticleextrapolate (const ISF::ISFParticle &particle) const override
 Extrapolate the given ISFParticle.

Private Attributes

SG::ReadCondHandleKey< Trk::TrackingGeometrym_trackingGeometryReadKey {this, "TrackingGeometryReadKey", "AtlasTrackingGeometry", "Key of input TrackingGeometry"}
 tracking geometry for geometry signature
ToolHandle< Trk::IExtrapolatorm_extrapolator
 extrapolation to calo entry
std::string m_trackingVolumeName
 name of the volume within the extrapolation is carried out
CxxUtils::CachedPointer< const Trk::TrackingVolume > m_trackingVolume ATLAS_THREAD_SAFE
 volume within the extrapolation is carried out
Trk::PdgToParticleHypothesism_pdgToParticleHypothesis
 converts PDG ID to hypothesis for TrackParameters

Detailed Description

An Athena AlgTool wrapper for the Tracking Extrapolator engine.

Author
Elmar.nosp@m..Rit.nosp@m.sch@c.nosp@m.ern..nosp@m.ch (refactored original implementation by Robert Harrington rober.nosp@m.th@c.nosp@m.ern.c.nosp@m.h)

Definition at line 46 of file TrkExtrapolator.h.

Constructor & Destructor Documentation

◆ TrkExtrapolator()

ISF::TrkExtrapolator::TrkExtrapolator ( const std::string & t,
const std::string & n,
const IInterface * p )

Constructor with parameters.

Constructor.

Definition at line 17 of file TrkExtrapolator.cxx.

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}
ToolHandle< Trk::IExtrapolator > m_extrapolator
extrapolation to calo entry
Trk::PdgToParticleHypothesis * m_pdgToParticleHypothesis
converts PDG ID to hypothesis for TrackParameters
std::string m_trackingVolumeName
name of the volume within the extrapolation is carried out

◆ ~TrkExtrapolator()

ISF::TrkExtrapolator::~TrkExtrapolator ( )

Destructor.

Definition at line 33 of file TrkExtrapolator.cxx.

34{
36}

Member Function Documentation

◆ extrapolate()

ISF::ISFParticle * ISF::TrkExtrapolator::extrapolate ( const ISF::ISFParticle & particle) const
overridevirtual

Extrapolate the given ISFParticle.

Extrapolate the given ISFParticle to the given TrackingVolume name.

Definition at line 66 of file TrkExtrapolator.cxx.

66 {
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
76 SG::ReadCondHandle<Trk::TrackingGeometry> readHandle{m_trackingGeometryReadKey};
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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
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.
const TrackingVolume * trackingVolume(const std::string &name) const
return the tracking Volume by name, 0 if it doesn't exist
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
@ alongMomentum
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ finalize()

StatusCode ISF::TrkExtrapolator::finalize ( )
overridevirtual

Athena AlgTool finalization.

Definition at line 57 of file TrkExtrapolator.cxx.

58{
59 ATH_MSG_VERBOSE("finalize() begin");
60
61 ATH_MSG_VERBOSE("finalize() successful");
62 return StatusCode::SUCCESS;
63}
#define ATH_MSG_VERBOSE(x)

◆ initialize()

StatusCode ISF::TrkExtrapolator::initialize ( )
overridevirtual

Athena AlgTool initialization.

Definition at line 40 of file TrkExtrapolator.cxx.

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}
#define ATH_CHECK
Evaluate an expression and check for errors.
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.

Member Data Documentation

◆ ATLAS_THREAD_SAFE

CxxUtils::CachedPointer<const Trk::TrackingVolume> m_trackingVolume ISF::TrkExtrapolator::ATLAS_THREAD_SAFE
mutableprivate

volume within the extrapolation is carried out

Definition at line 72 of file TrkExtrapolator.h.

◆ m_extrapolator

ToolHandle<Trk::IExtrapolator> ISF::TrkExtrapolator::m_extrapolator
private

extrapolation to calo entry

ToolHandle for track extrapolator

Definition at line 69 of file TrkExtrapolator.h.

◆ m_pdgToParticleHypothesis

Trk::PdgToParticleHypothesis* ISF::TrkExtrapolator::m_pdgToParticleHypothesis
private

converts PDG ID to hypothesis for TrackParameters

Definition at line 74 of file TrkExtrapolator.h.

◆ m_trackingGeometryReadKey

SG::ReadCondHandleKey<Trk::TrackingGeometry> ISF::TrkExtrapolator::m_trackingGeometryReadKey {this, "TrackingGeometryReadKey", "AtlasTrackingGeometry", "Key of input TrackingGeometry"}
private

tracking geometry for geometry signature

Definition at line 66 of file TrkExtrapolator.h.

66{this, "TrackingGeometryReadKey", "AtlasTrackingGeometry", "Key of input TrackingGeometry"};

◆ m_trackingVolumeName

std::string ISF::TrkExtrapolator::m_trackingVolumeName
private

name of the volume within the extrapolation is carried out

Definition at line 71 of file TrkExtrapolator.h.


The documentation for this class was generated from the following files: