ATLAS Offline Software
Loading...
Searching...
No Matches
PFTrackCaloExtensionTool Class Reference

Inherits from eflowTrackExtrapolatorBaseAlgTool and AthAlgTool. More...

#include <PFTrackCaloExtensionTool.h>

Inheritance diagram for PFTrackCaloExtensionTool:
Collaboration diagram for PFTrackCaloExtensionTool:

Public Member Functions

 ~PFTrackCaloExtensionTool ()
virtual StatusCode initialize () override
virtual std::unique_ptr< eflowTrackCaloPointsexecute (const EventContext &ctx, const xAOD::TrackParticle *track) const override
virtual StatusCode finalize () override
 AthAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor with parameters:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< ActsTrk::IExtrapolationToolm_extrapolationTool
ServiceHandle< ActsTrk::ITrackingGeometrySvcm_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
std::map< Acts::GeometryIdentifier, std::string > m_caloNameGeoIDMap
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Inherits from eflowTrackExtrapolatorBaseAlgTool and AthAlgTool.

Uses ACTS to extrapolate tracks to the calorimeter, and creates an eflowTrackCaloPoints object.

Definition at line 15 of file PFTrackCaloExtensionTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~PFTrackCaloExtensionTool()

PFTrackCaloExtensionTool::~PFTrackCaloExtensionTool ( )
inline

Definition at line 20 of file PFTrackCaloExtensionTool.h.

20{};

Member Function Documentation

◆ AthAlgTool()

AthAlgTool::AthAlgTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor with parameters:

Definition at line 31 of file AthAlgTool.cxx.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

std::unique_ptr< eflowTrackCaloPoints > PFTrackCaloExtensionTool::execute ( const EventContext & ctx,
const xAOD::TrackParticle * track ) const
overridevirtual

Implements eflowTrackExtrapolatorBaseAlgTool.

Definition at line 37 of file PFTrackCaloExtensionTool.cxx.

37 {
38
39 unsigned int lastMeasIdx = 0;
40 if (!track->indexOfParameterAtPosition(lastMeasIdx, xAOD::LastMeasurement)) {
41 ATH_MSG_ERROR("TrackParticle has no last measurement parameters");
42 return nullptr;
43 }
44
45 Acts::Vector3 lastPos{track->parameterX(lastMeasIdx),
46 track->parameterY(lastMeasIdx),
47 track->parameterZ(lastMeasIdx)};
48 Acts::Vector3 lastMom{ActsTrk::energyToActs(track->parameterPX(lastMeasIdx)),
49 ActsTrk::energyToActs(track->parameterPY(lastMeasIdx)),
50 ActsTrk::energyToActs(track->parameterPZ(lastMeasIdx))};
51
52 Acts::BoundVector lastBoundParams = Acts::BoundVector::Zero();
53 lastBoundParams[Acts::eBoundPhi] = lastMom.phi();
54 lastBoundParams[Acts::eBoundTheta] = lastMom.theta();
55 lastBoundParams[Acts::eBoundQOverP] = track->charge() / lastMom.norm();
56
57 std::shared_ptr<const Acts::Surface> lastSurface = Acts::CurvilinearSurface(lastPos, lastMom.normalized()).planeSurface()->getSharedPtr();
58
59 Acts::BoundTrackParameters boundPars{
60 std::move(lastSurface),
61 lastBoundParams,
62 std::nullopt,
63 Acts::ParticleHypothesis::pion()
64 };
65
66 Acts::Result<std::pair<std::vector<Acts::detail::Step>, Acts::RecordedMaterial>> result = m_extrapolationTool.get()->propagationSteps(ctx, boundPars);
67
68 if( !result.ok() ) {
69 ATH_MSG_WARNING("Error during extrapolation: " << result.error().message());
70 return nullptr;
71 }
72
73 const auto &[steps, _] = result.value();
74
75 ATH_MSG_DEBUG("Have extrapolated track with pt, eta and phi: " << track->pt() << ", " << track->eta() << " and " << track->phi());
76
77 for(const auto &step : steps) {
78
79
80 if( step.surface == nullptr || step.surface->geometryId().sensitive() == 0 ) {
81 continue;
82 }
83
84 Acts::GeometryIdentifier thisGeoID = step.geoID;
85 ATH_MSG_DEBUG("Got step with geoID " << thisGeoID);
86
87 if (m_caloNameGeoIDMap.contains(thisGeoID)){
88 const auto &p = step.position;
89 auto eta = Acts::VectorHelpers::eta(p);
90 auto phi = Acts::VectorHelpers::phi(p);
91 ATH_MSG_DEBUG("Eta and Phi in caloLayer " << m_caloNameGeoIDMap.at(thisGeoID) << " are " << eta << " and " << phi);
92 }
93 else ATH_MSG_WARNING("Could not find this GeometryIdentifier " << thisGeoID << " in the map");
94 }
95
96 ATH_MSG_DEBUG("Finished steps loop");
97 ATH_MSG_DEBUG("");
98
99 return std::make_unique<eflowTrackCaloPoints>();
100}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
std::map< Acts::GeometryIdentifier, std::string > m_caloNameGeoIDMap
constexpr double energyToActs(const double athenaE)
Converts an energy scalar from Athena to Acts units.
@ LastMeasurement
Parameter defined at the position of the last measurement.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode PFTrackCaloExtensionTool::finalize ( )
overridevirtual

Definition at line 102 of file PFTrackCaloExtensionTool.cxx.

102 {
103 return StatusCode::SUCCESS;
104}

◆ initialize()

StatusCode PFTrackCaloExtensionTool::initialize ( )
overridevirtual

Definition at line 16 of file PFTrackCaloExtensionTool.cxx.

16 {
17
18 ATH_CHECK( AthAlgTool::initialize() );
19
22
23 std::array<std::string,3 > caloNames = {"EMB1_layer", "EMB2_layer", "EMB3_layer"};
24
25 m_trackingGeometrySvc->trackingGeometry()->visitVolumes([&](const Acts::TrackingVolume *vol) {
26 const auto & name = vol->volumeName();
27 ATH_MSG_DEBUG(name << " - " << vol->geometryId() << " - surfaces: " << vol->surfaces().size());
28 if (std::ranges::contains(caloNames, name)){
29 ATH_MSG_DEBUG("About to insert caloName " << name << " into map");
30 m_caloNameGeoIDMap[vol->geometryId()] = name;
31 }
32 });
33
34 return StatusCode::SUCCESS;
35}
#define ATH_CHECK
Evaluate an expression and check for errors.
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_caloNameGeoIDMap

std::map<Acts::GeometryIdentifier, std::string> PFTrackCaloExtensionTool::m_caloNameGeoIDMap
private

Definition at line 37 of file PFTrackCaloExtensionTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extrapolationTool

ToolHandle<ActsTrk::IExtrapolationTool> PFTrackCaloExtensionTool::m_extrapolationTool
private
Initial value:
{
this,
"ExtrapolationTool",
"ExtrapolationTool",
"Tool to run propagation in an ACTS tracking geometry"
}

Definition at line 28 of file PFTrackCaloExtensionTool.h.

28 {
29 this,
30 "ExtrapolationTool",
31 "ExtrapolationTool",
32 "Tool to run propagation in an ACTS tracking geometry"
33 };

◆ m_trackingGeometrySvc

ServiceHandle<ActsTrk::ITrackingGeometrySvc> PFTrackCaloExtensionTool::m_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
private

Definition at line 35 of file PFTrackCaloExtensionTool.h.

35{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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