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< eflowTrackCaloPoints > execute (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< StoreGateSvc > StoreGateSvc_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

ActsTrk::ContextUtility m_ctxProvider {this}
 The ContextUtility will give us access to the Acts geometry context.
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_extensionReadDecorKey {this, "ExtensionDecoration", "InDetTrackParticles.caloExtensionLink"}
std::map< Acts::GeometryIdentifier, CaloSampling::CaloSample > m_geoIdCaloSampleMap
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 19 of file PFTrackCaloExtensionTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~PFTrackCaloExtensionTool()

PFTrackCaloExtensionTool::~PFTrackCaloExtensionTool ( )
inline

Definition at line 24 of file PFTrackCaloExtensionTool.h.

24{};

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 51 of file PFTrackCaloExtensionTool.cxx.

51 {
52
53 ATH_MSG_DEBUG("About to extrapolate track with pt, eta and phi: " << track->pt() << ", " << track->eta() << " and " << track->phi());
54
55 SG::ReadDecorHandle<xAOD::TrackParticleContainer, ElementLink<ActsTrk::CaloExtensionContainer>> extensionReadDecorHandle(m_extensionReadDecorKey, ctx);
56 ElementLink<ActsTrk::CaloExtensionContainer> trackCaloExtensionLink = extensionReadDecorHandle(*track);
57
58 std::map<eflowCalo::LAYER, const Acts::BoundTrackParameters*> parametersMap;
59 const Acts::GeometryContext gctx = m_ctxProvider.getGeometryContext(ctx);
60
61 if (!trackCaloExtensionLink.isValid()) {
62 ATH_MSG_DEBUG("Decoration exists, but this track has no valid CaloExtension link (null link)");
63 }
64 else{
65 const ActsTrk::CaloExtension* trackCaloExtension = *trackCaloExtensionLink;
66 ATH_MSG_DEBUG("Have CaloExtensions with size " << trackCaloExtension->size() << " for this track");
67 ATH_MSG_DEBUG("Are the parameters empty?: " << trackCaloExtension->parameters().empty());
68
69 for (const Acts::BoundTrackParameters& pars : trackCaloExtension->parameters()) {
70 const Acts::Surface& surface = pars.referenceSurface();
71 ATH_MSG_DEBUG("Geometry ID of surface is " << surface.geometryId());
72
73 const auto thisGeoID = surface.geometryId();
74
75 if (m_geoIdCaloSampleMap.contains(thisGeoID)) {
76 CaloSampling::CaloSample caloSample = m_geoIdCaloSampleMap.at(thisGeoID);
77 ATH_MSG_DEBUG("This surface is in the calorimeter with CaloSample " << caloSample << " and eta, phi: " << pars.position(gctx).eta() << ", " << pars.position(gctx).phi());
78 /* parametersMap may have several entries for Tile1,2,3
79 due to the simplfification of eflowCalo::LAYER which only considers
80 Tile in general and not barrel, exctended barrel and gap.
81 The impact is negligible as the eta/phi of these entries are very similar
82 https://its.cern.ch/jira/browse/ATLJETMET-242
83 */
84 parametersMap[eflowCalo::translateSampl(caloSample)] = &pars;
85 }
86 }
87 }
88
89 return std::make_unique<eflowTrackCaloPoints>(parametersMap, gctx);
90}
#define ATH_MSG_DEBUG(x,...)
std::size_t size() const
Number of extensions stored in the instance.
const Acts::BoundTrackParameters & parameters(const std::size_t parIdx) const
Returns the extension parameters associated with the n-th extension.
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_extensionReadDecorKey
ActsTrk::ContextUtility m_ctxProvider
The ContextUtility will give us access to the Acts geometry context.
std::map< Acts::GeometryIdentifier, CaloSampling::CaloSample > m_geoIdCaloSampleMap
static LAYER translateSampl(CaloCell_ID::CaloSample sampl)

◆ 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 92 of file PFTrackCaloExtensionTool.cxx.

92 {
93 return StatusCode::SUCCESS;
94}

◆ initialize()

StatusCode PFTrackCaloExtensionTool::initialize ( )
overridevirtual

Definition at line 19 of file PFTrackCaloExtensionTool.cxx.

19 {
20
21 ATH_CHECK( AthAlgTool::initialize() );
22 ATH_CHECK(m_ctxProvider.initialize());
23
25
27
28 std::array<std::string, 7 > caloNames = {"EMB1_Layer", "EMB2_Layer", "EMB3_Layer",
29 "TileBar0_Layer", "TileBar1_Layer",
30 "CaloLayerDiscNegativeZ", "CaloLayerDiscPositiveZ"};
31
32
33 m_trackingGeometrySvc->trackingGeometry()->visitVolumes([&](const Acts::TrackingVolume *vol) {
34
35 //get geo identifier
36 Acts::GeometryIdentifier geoId = vol->geometryId();
37 const auto & name = vol->volumeName();
38 ATH_MSG_DEBUG(name << " - " << geoId << " - surfaces: " << vol->surfaces().size());
39
40 if (std::ranges::contains(caloNames, name)){
41 vol->visitSurfaces([&](const Acts::Surface *surface){
42 ATH_MSG_DEBUG("This surface has ID" << surface->geometryId());
43 m_geoIdCaloSampleMap[surface->geometryId()] = static_cast<CaloSampling::CaloSample>(surface->geometryId().layer());
44 });
45 };
46 });
47
48 return StatusCode::SUCCESS;
49}
#define ATH_CHECK
Evaluate an expression and check for errors.
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
@ layer
Definition HitInfo.h:79

◆ 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 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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 352 of file AthCommonDataStore.h.

352 {
354 }

◆ 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 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_ctxProvider

ActsTrk::ContextUtility PFTrackCaloExtensionTool::m_ctxProvider {this}
private

The ContextUtility will give us access to the Acts geometry context.

Definition at line 33 of file PFTrackCaloExtensionTool.h.

33{this};

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_extensionReadDecorKey

SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> PFTrackCaloExtensionTool::m_extensionReadDecorKey {this, "ExtensionDecoration", "InDetTrackParticles.caloExtensionLink"}
private

Definition at line 37 of file PFTrackCaloExtensionTool.h.

37{this, "ExtensionDecoration", "InDetTrackParticles.caloExtensionLink"};

◆ m_geoIdCaloSampleMap

std::map<Acts::GeometryIdentifier, CaloSampling::CaloSample> PFTrackCaloExtensionTool::m_geoIdCaloSampleMap
private

Definition at line 40 of file PFTrackCaloExtensionTool.h.

◆ 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 387 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.


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