ATLAS Offline Software
Loading...
Searching...
No Matches
CP::TrackVertexAssociationTool Class Reference

General track-vertex association tool. More...

#include <TrackVertexAssociationTool.h>

Inheritance diagram for CP::TrackVertexAssociationTool:
Collaboration diagram for CP::TrackVertexAssociationTool:

Classes

class  WorkingPoint

Public Types

Public helper class for applying the difference TTVA WPs
typedef SG::AuxElement::ConstAccessor< std::vector< ElementLink< xAOD::VertexContainer > > > AMVFVerticesAcc
typedef SG::AuxElement::ConstAccessor< std::vector< float > > AMVFWeightsAcc

Public Member Functions

 TrackVertexAssociationTool (const std::string &name)
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual bool isCompatible (const xAOD::TrackParticle &trk, const xAOD::Vertex &vx) const override
 This function just return the decision of whether the track is matched to the Vertex Not sure whether the track is matched to best choice.
virtual bool isCompatible (const xAOD::TrackParticle &trk) const override
virtual xAOD::TrackVertexAssociationMap getMatchMap (std::vector< const xAOD::TrackParticle * > &trk_list, std::vector< const xAOD::Vertex * > &vx_list) const override
virtual xAOD::TrackVertexAssociationMap getMatchMap (const xAOD::TrackParticleContainer &trkCont, const xAOD::VertexContainer &vxCont) const override
virtual ElementLink< xAOD::VertexContainergetUniqueMatchVertexLink (const xAOD::TrackParticle &trk, const xAOD::VertexContainer &vxCont) const override
 This functions will return the best matched vertex.
virtual const xAOD::VertexgetUniqueMatchVertex (const xAOD::TrackParticle &trk, std::vector< const xAOD::Vertex * > &vx_list) const override
virtual xAOD::TrackVertexAssociationMap getUniqueMatchMap (std::vector< const xAOD::TrackParticle * > &trk_list, std::vector< const xAOD::Vertex * > &vx_list) const override
 This functions related to the previous functions, will return a 2D vector to store the best matched tracks for each vertex.
virtual xAOD::TrackVertexAssociationMap getUniqueMatchMap (const xAOD::TrackParticleContainer &trkCont, const xAOD::VertexContainer &vxCont) const override
template<typename U, typename V>
xAOD::TrackVertexAssociationMap getMatchMapInternal (U &trk_list, V &vx_list) const
virtual void print () const
 Print the state of the tool.
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
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

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

bool isMatch (const xAOD::TrackParticle &trk, const xAOD::Vertex &vx, const xAOD::EventInfo *evtInfo=nullptr) const
template<typename T, typename U>
xAOD::TrackVertexAssociationMap getMatchMapInternal (T &trk_list, U &vx_list) const
template<typename T, typename U>
xAOD::TrackVertexAssociationMap getUniqueMatchMapInternal (T &trk_list, U &vx_list) const
template<typename T>
const xAOD::VertexgetUniqueMatchVertexInternal (const xAOD::TrackParticle &trk, T &vx_list) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

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
The properties that can be defined via the python job options
Gaudi::Property< std::string > m_wp
Gaudi::Property< floatm_d0_cut
Gaudi::Property< boolm_use_d0sig
Gaudi::Property< floatm_d0sig_cut
Gaudi::Property< floatm_dzSinTheta_cut
Gaudi::Property< boolm_doUsedInFit
 Flag to cut on d0sig instead of d0.
Gaudi::Property< boolm_doPVPriority
Gaudi::Property< boolm_requirePriVtx
Gaudi::Property< std::string > m_hardScatterDeco {this, "HardScatterLinkDeco", "hardScatterVertexLink"}
 The decoration name of the ElementLink to the hardscatter vertex (found on xAOD::EventInfo)
SG::ReadHandleKey< xAOD::TrackParticleContainerm_trkKey {this, "TrackContName", "InDetTrackParticles"}
 The name of the xAOD::TrackParticleContainer to access the AMVF vertices+weights for (not actually read).
Truly private internal data members
SG::ReadHandleKey< xAOD::EventInfom_eventInfo {this, "EventInfo", "EventInfo", "EventInfo key"}
 EventInfo key.
Gaudi::Property< std::string > m_vtxDecoName
 AMVF vertices decoration key.
SG::ReadDecorHandleKey< xAOD::TrackParticleContainerm_vtxDecoKey {this, "AMVFVerticesKey", "" , "Overwritten with the <AMVFVerticesDeco> property"}
std::unique_ptr< AMVFVerticesAccm_vtxDecoAcc {nullptr}
 AMVF vertices decoration accessor.
Gaudi::Property< std::string > m_wgtDecoName
 AMVF weights decoration key.
SG::ReadDecorHandleKey< xAOD::TrackParticleContainerm_wgtDecoKey {this, "MVWeightKey", "" , "Overwritten with the <AMVFWeightsDeco> property"}
std::unique_ptr< AMVFWeightsAccm_wgtDecoAcc {nullptr}
 AMVF weights decoration accessor.
SG::ReadDecorHandleKey< xAOD::EventInfom_hardScatterDecoKey
 Hardscatter vertex link key.
std::unique_ptr< WorkingPointm_applicator {nullptr}
 Stored WorkingPoint class.

Detailed Description

General track-vertex association tool.

Supported properties (set via setProperty):

  • WorkingPoint: Working Point to operate on.
  • d0_cut: Cut on d0. Not applied if set to -1.
  • use_d0sig: flag to cut on d0sig instead of d0.
  • d0sig_cut: Cut on d0Sig. Not applied if set to -1.
  • dzSinTheta_cut: Cut on |dz*sinTheta| (in mm). Not applied if set to -1.
  • doUsedInFit: Control whether to allow for a MatchStatus of UsedInFit.
  • requirePriVtx: Control whether a vertex must be VxType::PriVtx in order for a track (not UsedInFit) to be uniquely matched to it.
  • HardScatterLinkDeco: The decoration name of the ElementLink to the hardscatter vertex (found on xAOD::EventInfo)

To apply the recommendations, please visit https://twiki.cern.ch/twiki/bin/view/AtlasProtected/TrackingCPRecsEarly2018#Track_to_Vertex_Association_Tool

Definition at line 51 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

Member Typedef Documentation

◆ AMVFVerticesAcc

◆ AMVFWeightsAcc

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TrackVertexAssociationTool()

TrackVertexAssociationTool::TrackVertexAssociationTool ( const std::string & name)

Definition at line 240 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

240 :
241 AsgTool(name) {}
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58

Member Function Documentation

◆ 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.

◆ 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

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getMatchMap() [1/2]

xAOD::TrackVertexAssociationMap TrackVertexAssociationTool::getMatchMap ( const xAOD::TrackParticleContainer & trkCont,
const xAOD::VertexContainer & vxCont ) const
overridevirtual

Implements CP::ITrackVertexAssociationTool.

Definition at line 350 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

351{
352 return getMatchMapInternal(trkCont, vxCont);
353}
xAOD::TrackVertexAssociationMap getMatchMapInternal(T &trk_list, U &vx_list) const

◆ getMatchMap() [2/2]

xAOD::TrackVertexAssociationMap TrackVertexAssociationTool::getMatchMap ( std::vector< const xAOD::TrackParticle * > & trk_list,
std::vector< const xAOD::Vertex * > & vx_list ) const
overridevirtual

◆ getMatchMapInternal() [1/2]

template<typename T, typename U>
xAOD::TrackVertexAssociationMap CP::TrackVertexAssociationTool::getMatchMapInternal ( T & trk_list,
U & vx_list ) const
private

◆ getMatchMapInternal() [2/2]

template<typename U, typename V>
xAOD::TrackVertexAssociationMap CP::TrackVertexAssociationTool::getMatchMapInternal ( U & trk_list,
V & vx_list ) const

Definition at line 412 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

413{
415
416 for (const auto& vertex : vx_list) {
418 trktovxlist.clear();
419 trktovxlist.reserve(trk_list.size());
420 for (const auto& track : trk_list) {
421 if (isCompatible(*track, *vertex)) {
422 trktovxlist.push_back(track);
423 }
424 }
425 trktovxmap[vertex] = trktovxlist;
426 }
427
428 return trktovxmap;
429}
virtual bool isCompatible(const xAOD::TrackParticle &trk, const xAOD::Vertex &vx) const override
This function just return the decision of whether the track is matched to the Vertex Not sure whether...
std::vector< const xAOD::TrackParticle * > TrackVertexAssociationList
std::map< const xAOD::Vertex *, xAOD::TrackVertexAssociationList > TrackVertexAssociationMap

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ getUniqueMatchMap() [1/2]

xAOD::TrackVertexAssociationMap TrackVertexAssociationTool::getUniqueMatchMap ( const xAOD::TrackParticleContainer & trkCont,
const xAOD::VertexContainer & vxCont ) const
overridevirtual

◆ getUniqueMatchMap() [2/2]

xAOD::TrackVertexAssociationMap TrackVertexAssociationTool::getUniqueMatchMap ( std::vector< const xAOD::TrackParticle * > & trk_list,
std::vector< const xAOD::Vertex * > & vx_list ) const
overridevirtual

This functions related to the previous functions, will return a 2D vector to store the best matched tracks for each vertex.

Implements CP::ITrackVertexAssociationTool.

Definition at line 370 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

371{
372 return getUniqueMatchMapInternal(trk_list, vx_list);
373}

◆ getUniqueMatchMapInternal()

template<typename T, typename U>
xAOD::TrackVertexAssociationMap TrackVertexAssociationTool::getUniqueMatchMapInternal ( T & trk_list,
U & vx_list ) const
private

Definition at line 467 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

468{
470
471 // Initialize our map
472 for (const auto& vertex : vx_list) {
474 trktovxlist.clear();
475 trktovxlist.reserve(trk_list.size());
476 trktovxmap[vertex] = trktovxlist;
477 }
478
479 for (const auto& track : trk_list) {
480 const xAOD::Vertex* vx_match = getUniqueMatchVertexInternal(*track, vx_list);
481 if (vx_match) trktovxmap[vx_match].push_back(track); // Found matched vertex
482 }
483
484 return trktovxmap;
485}
const xAOD::Vertex * getUniqueMatchVertexInternal(const xAOD::TrackParticle &trk, T &vx_list) const
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ getUniqueMatchVertex()

const xAOD::Vertex * TrackVertexAssociationTool::getUniqueMatchVertex ( const xAOD::TrackParticle & trk,
std::vector< const xAOD::Vertex * > & vx_list ) const
overridevirtual

◆ getUniqueMatchVertexInternal()

template<typename T>
const xAOD::Vertex * TrackVertexAssociationTool::getUniqueMatchVertexInternal ( const xAOD::TrackParticle & trk,
T & vx_list ) const
private

Definition at line 432 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

433{
434 FitWeight weight;
435 float dzSinTheta{0.};
436 float min_dz = ((m_dzSinTheta_cut >= 0) ? m_dzSinTheta_cut.value() : +999.0);
437 const xAOD::Vertex* bestMatchVertex = nullptr;
438
439 for (const auto& vertex : vx_list) {
440 weight = ::fitWeight(&trk, vertex, *m_vtxDecoAcc, *m_wgtDecoAcc);
441 if (m_doUsedInFit && weight.first > 0.0 && weight.first >= weight.second) {
442 bestMatchVertex = vertex;
443 break;
444 }
445 else {
446 if (m_requirePriVtx && vertex->vertexType() != xAOD::VxType::PriVtx) continue;
447 if (isCompatible(trk, *vertex)) {
448 dzSinTheta = ::absDzSinTheta(&trk, vertex);
449 if (dzSinTheta < min_dz) {
450 min_dz = dzSinTheta;
451 bestMatchVertex = vertex;
452 if(m_doPVPriority) break; //This will stop the iteration on the vertices. This works since the PV should always be the first entry in the vertex collection
453 }
454 }
455 }
456 }
457
458 // Check if get the matched vertex
459 if (!bestMatchVertex) {
460 ATH_MSG_DEBUG("Could not find any matched vertex for this track!");
461 }
462
463 return bestMatchVertex;
464}
#define ATH_MSG_DEBUG(x)
@ PriVtx
Primary vertex.

◆ getUniqueMatchVertexLink()

ElementLink< xAOD::VertexContainer > TrackVertexAssociationTool::getUniqueMatchVertexLink ( const xAOD::TrackParticle & trk,
const xAOD::VertexContainer & vxCont ) const
overridevirtual

This functions will return the best matched vertex.

Implements CP::ITrackVertexAssociationTool.

Definition at line 360 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

361{
362 ElementLink<xAOD::VertexContainer> vx_link_tmp;
363 const xAOD::Vertex* vx_tmp = getUniqueMatchVertexInternal(trk, vxCont);
364 if (vx_tmp) {
365 vx_link_tmp.toContainedElement(vxCont, vx_tmp);
366 }
367 return vx_link_tmp;
368}

◆ initialize()

StatusCode TrackVertexAssociationTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 251 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

252{
253 static const std::set<std::string> run_2_wps = {"Loose", "Nominal", "Tight", "Electron", "Muon", "Old_Loose", "Old_Nominal", "Old_Tight", "Old_Electron", "Old_Muon"};
254 std::string wp{m_wp};
255 if (run_2_wps.count(wp)) {
256 std::string prefix = "Old_";
257 if (wp.compare(0, prefix.size(), prefix) == 0) {
258 ATH_MSG_WARNING("WorkingPoint '" << m_wp << "' corresponds to a Run 2 working point and is not recommended.");
259 }
260 else {
261 ATH_MSG_WARNING("WorkingPoint '" << m_wp << "' corresponds to a Run 2 working point and is not recommended - remapping to 'Old_" << m_wp << "' (same definition, however).");
262 wp.insert(0, "Old_");
263 }
264 m_wp = wp;
265 }
266
267 IF_WORKING_POINT(Old_Loose, true, true)
268 else IF_WORKING_POINT(Old_Nominal, false, false)
269 else IF_WORKING_POINT(Old_Tight, false, false)
270 else IF_WORKING_POINT(Old_Electron, false, false)
271 else IF_WORKING_POINT(Old_Muon, false, false)
272 else IF_WORKING_POINT(Prompt_D0Sig, true, false)
273 else IF_WORKING_POINT(Nonprompt_Hard_D0Sig, true, false)
274 else IF_WORKING_POINT(Nonprompt_Medium_D0Sig, true, false)
275 else IF_WORKING_POINT(Nonprompt_All_D0Sig, true, false)
276 else IF_WORKING_POINT(Prompt_MaxWeight, true, false)
277 else IF_WORKING_POINT(Nonprompt_Hard_MaxWeight, true, false)
278 else IF_WORKING_POINT(Nonprompt_Medium_MaxWeight, true, false)
279 else IF_WORKING_POINT(Nonprompt_All_MaxWeight, true, false)
280 // Backwards compatability for Custom WP
281 else if (m_wp == "Custom") {
282 m_applicator = std::unique_ptr<CP::TrackVertexAssociationTool::WorkingPoint>(
284 }
285 else {
286 ATH_MSG_ERROR("Invalid TVA working point '" << m_wp << "' - for a custom configuration, please provide 'Custom' for the 'WorkingPoint' property.");
287 return StatusCode::FAILURE;
288 }
289
290 if (m_wp == "Custom") {
291 ATH_MSG_INFO("TVA working point 'Custom' provided - tool properties are initialized to default values unless explicitly set by the user.");
292 }
293 else {
294 ATH_MSG_INFO("TVA working point '" << m_wp << "' provided - tool properties have been configured accordingly.");
295 }
296
297 if (m_use_d0sig) {
298 ATH_MSG_DEBUG("(For Custom WP:) cut on d0 significance: " << m_d0sig_cut << "\t(d0sig_cut).");
299 }
300 else {
301 ATH_MSG_DEBUG("(For Custom WP:) cut on d0: " << m_d0_cut << "\t(d0_cut).");
302 }
303 ATH_MSG_DEBUG("(For Custom WP:) cut on Δz * sin θ: " << m_dzSinTheta_cut << "\t(dzSinTheta_cut).");
304 ATH_MSG_DEBUG("(For Custom WP:) allow UsedInFit MatchStatus: " << m_doUsedInFit << "\t(doUsedInFit).");
305 ATH_MSG_DEBUG("Require VxType::PriVtx for unique match: " << m_requirePriVtx << "\t(requirePriVtx).");
306
307 // Initialize our EventInfo container and decoration reads
308 ATH_CHECK(m_eventInfo.initialize());
309 ATH_CHECK(m_trkKey.initialize());
310 {
311 const std::string decorName = m_hardScatterDeco;
312 m_hardScatterDecoKey = m_eventInfo.key() + "." + decorName;
313 ATH_CHECK(m_hardScatterDecoKey.initialize(!decorName.empty()));
314 }
315 m_vtxDecoAcc = std::make_unique<AMVFVerticesAcc>(m_vtxDecoName);
316 m_vtxDecoKey = m_trkKey.key() + "." + m_vtxDecoName;
317 ATH_CHECK(m_vtxDecoKey.initialize());
318 m_wgtDecoAcc = std::make_unique<AMVFWeightsAcc>(m_wgtDecoName);
319 m_wgtDecoKey = m_trkKey.key() + "." + m_wgtDecoName;
320 ATH_CHECK(m_wgtDecoKey.initialize());
321
322 return StatusCode::SUCCESS;
323}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define IF_WORKING_POINT(WORKING_POINT, DO_USED_IN_FIT, REQUIRE_PRI_VTX)
if(febId1==febId2)
Gaudi::Property< std::string > m_hardScatterDeco
The decoration name of the ElementLink to the hardscatter vertex (found on xAOD::EventInfo)
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trkKey
The name of the xAOD::TrackParticleContainer to access the AMVF vertices+weights for (not actually re...

◆ 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.

◆ isCompatible() [1/2]

bool TrackVertexAssociationTool::isCompatible ( const xAOD::TrackParticle & trk) const
overridevirtual

Implements CP::ITrackVertexAssociationTool.

Definition at line 331 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

331 {
332 const EventContext& ctx = Gaudi::Hive::currentContext();
333 SG::ReadHandle<xAOD::EventInfo> evt(m_eventInfo, ctx);
334 if (!evt.isValid()) {
335 throw std::runtime_error("ERROR in CP::TrackVertexAssociationTool::isCompatible : could not retrieve xAOD::EventInfo!");
336 }
337 SG::ReadDecorHandle<xAOD::EventInfo, ElementLink<xAOD::VertexContainer>> hardScatterDeco(m_hardScatterDecoKey, ctx);
338 const ElementLink<xAOD::VertexContainer>& vtxLink = hardScatterDeco(*evt);
339 if (!vtxLink.isValid()) {
340 throw std::runtime_error("ERROR in CP::TrackVertexAssociationTool::isCompatible : hardscatter vertex link is not valid!");
341 }
342 return isMatch(trk, **vtxLink, evt.get());
343}
bool isMatch(const xAOD::TrackParticle &trk, const xAOD::Vertex &vx, const xAOD::EventInfo *evtInfo=nullptr) const

◆ isCompatible() [2/2]

bool TrackVertexAssociationTool::isCompatible ( const xAOD::TrackParticle & trk,
const xAOD::Vertex & vx ) const
overridevirtual

This function just return the decision of whether the track is matched to the Vertex Not sure whether the track is matched to best choice.

Implements CP::ITrackVertexAssociationTool.

Definition at line 325 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

326{
327 ATH_MSG_DEBUG("In TrackVertexAssociationTool::isCompatible function.");
328 return isMatch(trk, vx);
329}

◆ isMatch()

bool TrackVertexAssociationTool::isMatch ( const xAOD::TrackParticle & trk,
const xAOD::Vertex & vx,
const xAOD::EventInfo * evtInfo = nullptr ) const
private

Definition at line 384 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx.

384 {
385
386 const EventContext& ctx = Gaudi::Hive::currentContext();
387
388 // Return false for fake vertices
389 if (vx.vertexType() == xAOD::VxType::NoVtx) {
390 return false;
391 }
392
393 // Read our EventInfo
394 const xAOD::EventInfo* evt = nullptr;
395 if (!evtInfo) {
396 SG::ReadHandle<xAOD::EventInfo> evttmp(m_eventInfo, ctx);
397 if (!evttmp.isValid()) {
398 throw std::runtime_error("ERROR in CP::TrackVertexAssociationTool::isMatch : could not retrieve xAOD::EventInfo!");
399 }
400 evt = evttmp.get();
401 }
402 else {
403 evt = evtInfo;
404 }
405
406 // Apply the working point
407 return m_applicator->apply(&trk, &vx, evt, *m_vtxDecoAcc, *m_wgtDecoAcc);
408
409}
VxType::VertexType vertexType() const
The type of the vertex.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
EventInfo_v1 EventInfo
Definition of the latest event info version.

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ 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.

◆ print()

◆ 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 >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ 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_applicator

std::unique_ptr<WorkingPoint> CP::TrackVertexAssociationTool::m_applicator {nullptr}
private

◆ m_d0_cut

Gaudi::Property<float> CP::TrackVertexAssociationTool::m_d0_cut
private
Initial value:
{this, "d0_cut", -1.,
"Cut on d0. Not applied if set to -1."}

Definition at line 113 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

113 {this, "d0_cut", -1.,
114 "Cut on d0. Not applied if set to -1."};

◆ m_d0sig_cut

Gaudi::Property<float> CP::TrackVertexAssociationTool::m_d0sig_cut
private
Initial value:
{this, "d0sig_cut", -1.,
"Cut on d0Sig. Not applied if set to -1."}

Definition at line 119 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

119 {this, "d0sig_cut", -1.,
120 "Cut on d0Sig. Not applied if set to -1."};

◆ 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_doPVPriority

Gaudi::Property<bool> CP::TrackVertexAssociationTool::m_doPVPriority
private
Initial value:
{this, "doPVPriority", false,
"Control whether to give priority to matching to PV instead of closest vertex."}

Definition at line 129 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

129 {this, "doPVPriority", false,
130 "Control whether to give priority to matching to PV instead of closest vertex."};

◆ m_doUsedInFit

Gaudi::Property<bool> CP::TrackVertexAssociationTool::m_doUsedInFit
private
Initial value:
{this, "doUsedInFit", false,
"Control whether to allow for a MatchStatus of UsedInFit."}

Flag to cut on d0sig instead of d0.

Definition at line 126 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

126 {this, "doUsedInFit", false,
127 "Control whether to allow for a MatchStatus of UsedInFit."};

◆ m_dzSinTheta_cut

Gaudi::Property<float> CP::TrackVertexAssociationTool::m_dzSinTheta_cut
private
Initial value:
{this, "dzSinTheta_cut", -1.,
"Cut on |dz*sinTheta| (in mm). Not applied if set to -1." }

Definition at line 122 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

122 {this, "dzSinTheta_cut", -1.,
123 "Cut on |dz*sinTheta| (in mm). Not applied if set to -1." };

◆ m_eventInfo

SG::ReadHandleKey<xAOD::EventInfo> CP::TrackVertexAssociationTool::m_eventInfo {this, "EventInfo", "EventInfo", "EventInfo key"}
private

EventInfo key.

Definition at line 149 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

149{this, "EventInfo", "EventInfo", "EventInfo key"};

◆ 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_hardScatterDeco

Gaudi::Property<std::string> CP::TrackVertexAssociationTool::m_hardScatterDeco {this, "HardScatterLinkDeco", "hardScatterVertexLink"}
private

The decoration name of the ElementLink to the hardscatter vertex (found on xAOD::EventInfo)

Definition at line 136 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

136{this, "HardScatterLinkDeco", "hardScatterVertexLink"};

◆ m_hardScatterDecoKey

SG::ReadDecorHandleKey<xAOD::EventInfo> CP::TrackVertexAssociationTool::m_hardScatterDecoKey
private
Initial value:
{this, "HardScatterLinkDecoKey" ,"" ,
"Will be overwritten with the <HardScatterLinkDeco> property"}

Hardscatter vertex link key.

Definition at line 166 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

166 {this, "HardScatterLinkDecoKey" ,"" ,
167 "Will be overwritten with the <HardScatterLinkDeco> property"};

◆ m_requirePriVtx

Gaudi::Property<bool> CP::TrackVertexAssociationTool::m_requirePriVtx
private
Initial value:
{this, "requirePriVtx", false,
"Control whether a vertex must be VxType::PriVtx in order for a track (not UsedInFit) to be uniquely matched to it."}

Definition at line 132 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

132 {this, "requirePriVtx", false,
133 "Control whether a vertex must be VxType::PriVtx in order for a track (not UsedInFit) to be uniquely matched to it."};

◆ m_trkKey

SG::ReadHandleKey<xAOD::TrackParticleContainer> CP::TrackVertexAssociationTool::m_trkKey {this, "TrackContName", "InDetTrackParticles"}
private

The name of the xAOD::TrackParticleContainer to access the AMVF vertices+weights for (not actually read).

Definition at line 139 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

139{this, "TrackContName", "InDetTrackParticles"};

◆ m_use_d0sig

Gaudi::Property<bool> CP::TrackVertexAssociationTool::m_use_d0sig
private
Initial value:
{this, "use_d0sig", false,
"Flag to cut on d0sig instead of d0."}

Definition at line 116 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

116 {this, "use_d0sig", false,
117 "Flag to cut on d0sig instead of d0."};

◆ 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.

◆ m_vtxDecoAcc

std::unique_ptr<AMVFVerticesAcc> CP::TrackVertexAssociationTool::m_vtxDecoAcc {nullptr}
private

AMVF vertices decoration accessor.

Definition at line 156 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

156{nullptr};

◆ m_vtxDecoKey

SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> CP::TrackVertexAssociationTool::m_vtxDecoKey {this, "AMVFVerticesKey", "" , "Overwritten with the <AMVFVerticesDeco> property"}
private

Definition at line 154 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

154{this, "AMVFVerticesKey", "" , "Overwritten with the <AMVFVerticesDeco> property"};

◆ m_vtxDecoName

Gaudi::Property<std::string> CP::TrackVertexAssociationTool::m_vtxDecoName
private
Initial value:
{this, "AMVFVerticesDeco", "TTVA_AMVFVertices",
"The per-track decoration name of the vector of AMVF used-in-fit vertex ElementLinks."}

AMVF vertices decoration key.

Definition at line 152 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

152 {this, "AMVFVerticesDeco", "TTVA_AMVFVertices",
153 "The per-track decoration name of the vector of AMVF used-in-fit vertex ElementLinks."};

◆ m_wgtDecoAcc

std::unique_ptr<AMVFWeightsAcc> CP::TrackVertexAssociationTool::m_wgtDecoAcc {nullptr}
private

AMVF weights decoration accessor.

Definition at line 163 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

163{nullptr};

◆ m_wgtDecoKey

SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> CP::TrackVertexAssociationTool::m_wgtDecoKey {this, "MVWeightKey", "" , "Overwritten with the <AMVFWeightsDeco> property"}
private

Definition at line 161 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

161{this, "MVWeightKey", "" , "Overwritten with the <AMVFWeightsDeco> property"};

◆ m_wgtDecoName

Gaudi::Property<std::string> CP::TrackVertexAssociationTool::m_wgtDecoName
private
Initial value:
{this, "AMVFWeightsDeco", "TTVA_AMVFWeights",
"The per-track decoration name of the vector of AMVF used-in-fit annealing weights." }

AMVF weights decoration key.

Definition at line 159 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

159 {this, "AMVFWeightsDeco", "TTVA_AMVFWeights",
160 "The per-track decoration name of the vector of AMVF used-in-fit annealing weights." };

◆ m_wp

Gaudi::Property<std::string> CP::TrackVertexAssociationTool::m_wp
private
Initial value:
{this, "WorkingPoint", "Old_Nominal",
"Working point to operate on."}

Definition at line 110 of file InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h.

110 {this, "WorkingPoint", "Old_Nominal",
111 "Working point to operate on."};

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