EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHActsInitialVertexFinder Class Reference

#include <fun4all_coresoftware/blob/master/offline/packages/trackreco/PHActsInitialVertexFinder.h>

+ Inheritance diagram for PHActsInitialVertexFinder:
+ Collaboration diagram for PHActsInitialVertexFinder:

Public Member Functions

 PHActsInitialVertexFinder (const std::string &name="PHActsInitialVertexFinder")
 
 ~PHActsInitialVertexFinder () override
 
void setMaxVertices (const int maxVertices)
 
void setSvtxVertexMapName (const std::string &name)
 
void setSvtxTrackMapName (const std::string &name)
 
void disablePtWeights (const bool weight)
 
void resetTrackCovariance (const bool initial)
 
void setCentroids (const int centroids)
 
void setIterations (const int iterations)
 
void removeSiliconSeeds (const bool removeSeeds)
 
void magFieldName (const std::string &magfield)
 
void setPCACut (const float pcaCut)
 
- Public Member Functions inherited from PHInitVertexing
 PHInitVertexing (const std::string &name="PHInitVertexing")
 
 ~PHInitVertexing () override
 
int InitRun (PHCompositeNode *topNode) override
 
int process_event (PHCompositeNode *topNode) override
 
- Public Member Functions inherited from SubsysReco
 ~SubsysReco () override
 
virtual int EndRun (const int)
 Called at the end of each run.
 
virtual int Init (PHCompositeNode *)
 
virtual int Reset (PHCompositeNode *)
 Reset.
 
void Print (const std::string &="ALL") const override
 
- Public Member Functions inherited from Fun4AllBase
virtual ~Fun4AllBase ()
 
virtual const std::string Name () const
 Returns the name of this module.
 
virtual void Name (const std::string &name)
 Sets the name of this module.
 
virtual void Verbosity (const int ival)
 Sets the verbosity of this module (0 by default=quiet).
 
virtual void Verbosity (enu_Verbosity ival)
 Sets the verbosity of this module (0 by default=quiet).
 
virtual int Verbosity () const
 Gets the verbosity of this module.
 

Protected Member Functions

int Setup (PHCompositeNode *topNode) override
 
int Process (PHCompositeNode *topNode) override
 
int ResetEvent (PHCompositeNode *topNode) override
 Clean up after each event.
 
int End (PHCompositeNode *topNode) override
 Called at the end of all processing.
 

Private Member Functions

int getNodes (PHCompositeNode *topNode)
 
int createNodes (PHCompositeNode *topNode)
 
TrackParamVec getTrackPointers (InitKeyMap &keyMap)
 Gets silicon stubs to send to Acts IVF.
 
VertexVector findVertices (TrackParamVec &tracks)
 Calls Acts IVF.
 
void fillVertexMap (VertexVector &vertices, InitKeyMap &keyMap)
 Creates SvtxVertexMap.
 
void createDummyVertex (const float x, const float y, const float z)
 
void checkTrackVertexAssociation ()
 Assigns silicon seed a vertex ID if it was left out of Acts IVF.
 
std::vector< SvtxTrack * > sortTracks ()
 
CentroidMap createCentroidMap (std::vector< Acts::Vector3D > &centroids)
 Helper functions for the k-means cluster algorithm.
 
std::vector< SvtxTrack * > getIVFTracks (CentroidMap &clusters, std::vector< Acts::Vector3D > &centroids)
 

Private Attributes

int m_nCentroids = 5
 Number of centroids for k-means clustering algorithm.
 
int m_nIterations = 15
 Number of times to iterate for clusters to converge.
 
int m_maxVertices = 5
 Max number of vertices allowed by the Acts IVF.
 
float m_pcaCut = 0.03
 Maximum centroid transverse PCA cut.
 
int m_event = 0
 Event num.
 
unsigned int m_totVertexFits = 0
 Diagnostic vertex numbers.
 
unsigned int m_successFits = 0
 
unsigned int m_seed = 0
 
std::mt19937 m_random_number_generator
 
std::string m_svtxTrackMapName = "SvtxSiliconTrackMap"
 
std::string m_svtxVertexMapName = "SvtxVertexMap"
 
std::string m_magField = ""
 
bool m_resetTrackCovariance = true
 
bool m_disableWeights = true
 
bool m_removeSeeds = false
 
SvtxTrackMapm_trackMap = nullptr
 
SvtxVertexMapm_vertexMap = nullptr
 
ActsTrackingGeometrym_tGeometry = nullptr
 

Additional Inherited Members

- Public Types inherited from Fun4AllBase
enum  enu_Verbosity {
  VERBOSITY_QUIET = 0, VERBOSITY_SOME = 1, VERBOSITY_MORE = 2, VERBOSITY_EVEN_MORE = 3,
  VERBOSITY_A_LOT = 4, VERBOSITY_MAX = INT_MAX - 10
}
 
- Protected Attributes inherited from PHInitVertexing
TrkrClusterContainer_cluster_map
 
TrkrHitSetContainer_hitsets
 
SvtxVertexMap_vertex_map
 

Detailed Description

Definition at line 31 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 31 of file PHActsInitialVertexFinder.h

Constructor & Destructor Documentation

PHActsInitialVertexFinder::PHActsInitialVertexFinder ( const std::string &  name = "PHActsInitialVertexFinder")

Definition at line 52 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 52 of file PHActsInitialVertexFinder.cc

PHActsInitialVertexFinder::~PHActsInitialVertexFinder ( )
inlineoverride

Definition at line 35 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 35 of file PHActsInitialVertexFinder.h

Member Function Documentation

void PHActsInitialVertexFinder::checkTrackVertexAssociation ( )
private

Assigns silicon seed a vertex ID if it was left out of Acts IVF.

If the track wasn't already given a vertex ID, it wasn't included in the initial vertex finding due to Acts not liking tracks with large transverse position. So find the closest z vertex to it and assign it

Definition at line 133 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 133 of file PHActsInitialVertexFinder.cc

References dz, m_trackMap, and m_vertexMap.

Referenced by Process().

+ Here is the caller graph for this function:

CentroidMap PHActsInitialVertexFinder::createCentroidMap ( std::vector< Acts::Vector3D > &  centroids)
private

Helper functions for the k-means cluster algorithm.

reset the centroid-track map

Add this track to the map that associates centroids with tracks

Update pos centroids

Sets the centroid as the average value

Definition at line 574 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 574 of file PHActsInitialVertexFinder.cc

References m_nCentroids, m_nIterations, m_trackMap, max, and Fun4AllBase::Verbosity().

Referenced by sortTracks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PHActsInitialVertexFinder::createDummyVertex ( const float  x,
const float  y,
const float  z 
)
private

Makes a dummy vertex only if Acts returns 0 vertices or there are either 0 or 1 silicon seeds

If the Acts IVF finds 0 vertices or there weren't enough tracks for it to properly identify a good vertex. So just create a dummy vertex with large covariance for rest of track reconstruction to avoid seg faults

Definition at line 248 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 248 of file PHActsInitialVertexFinder.cc

References SvtxVertexMap::insert(), m_trackMap, and m_vertexMap.

Referenced by fillVertexMap(), and Process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int PHActsInitialVertexFinder::createNodes ( PHCompositeNode topNode)
private

Check that it is there

Get the tracking subnode

Definition at line 800 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 800 of file PHActsInitialVertexFinder.cc

References PHCompositeNode::addNode(), Fun4AllReturnCodes::EVENT_OK, PHNodeIterator::findFirst(), m_svtxVertexMapName, and m_vertexMap.

Referenced by Setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PHActsInitialVertexFinder::disablePtWeights ( const bool  weight)
inline

Definition at line 46 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 46 of file PHActsInitialVertexFinder.h

References m_disableWeights.

int PHActsInitialVertexFinder::End ( PHCompositeNode )
overrideprotectedvirtual

Called at the end of all processing.

Reimplemented from SubsysReco.

Definition at line 123 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 123 of file PHActsInitialVertexFinder.cc

References Fun4AllReturnCodes::EVENT_OK, m_successFits, and m_totVertexFits.

void PHActsInitialVertexFinder::fillVertexMap ( VertexVector vertices,
InitKeyMap keyMap 
)
private

Creates SvtxVertexMap.

Create a fail safe for (e.g.) single particle events which don't return a vertex

Fill SvtxVertexMap

Give the track the appropriate vertex id

Definition at line 167 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 167 of file PHActsInitialVertexFinder.cc

References SvtxVertexMap::clear(), Acts::UnitConstants::cm, Acts::UnitConstants::cm2, createDummyVertex(), SvtxTrackMap::find(), SvtxVertexMap::insert(), m_trackMap, m_vertexMap, and Fun4AllBase::Verbosity().

Referenced by Process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VertexVector PHActsInitialVertexFinder::findVertices ( TrackParamVec tracks)
private

Calls Acts IVF.

Determine the input mag field type from the initial geometry and run the vertex finding with the determined mag field

Setup aliases

Setup vertex finder now

Vertex fitter seems to have no performance difference when iterating once vs. default of 5 times. Additionally, iterating more than once causes vertices with low numbers of tracks to fail fitting, causing an error to be thrown and 0 vertices returned

Don't weight track contribution by pT, since the momentum resolution of the silicon seeds is poor

end lambda

end std::visit call

Definition at line 291 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 291 of file PHActsInitialVertexFinder.cc

References Acts::IntegrationTest::bField, Acts::Logging::FATAL, ActsTrackingGeometry::geoContext, Acts::getDefaultLogger(), m_disableWeights, m_maxVertices, m_successFits, m_tGeometry, m_totVertexFits, ActsTrackingGeometry::magField, ActsTrackingGeometry::magFieldContext, Acts::VectorHelpers::position(), Acts::Logging::VERBOSE, and Fun4AllBase::Verbosity().

Referenced by Process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< SvtxTrack * > PHActsInitialVertexFinder::getIVFTracks ( CentroidMap clusters,
std::vector< Acts::Vector3D > &  centroids 
)
private

Note the centroid that has the most tracks

skip centroids that have a very small number of tracks compared to the largest centroid, as these are most likely composed of only a few (bad) stubs

Skip large transverse PCA centroids

Definition at line 460 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 460 of file PHActsInitialVertexFinder.cc

References SvtxTrackMap::erase(), m_nCentroids, m_pcaCut, m_removeSeeds, m_trackMap, and Fun4AllBase::Verbosity().

Referenced by sortTracks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int PHActsInitialVertexFinder::getNodes ( PHCompositeNode topNode)
private

Definition at line 775 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 775 of file PHActsInitialVertexFinder.cc

References Fun4AllReturnCodes::ABORTEVENT, Fun4AllReturnCodes::EVENT_OK, m_svtxTrackMapName, m_tGeometry, m_trackMap, and PHWHERE.

Referenced by Setup().

+ Here is the caller graph for this function:

TrackParamVec PHActsInitialVertexFinder::getTrackPointers ( InitKeyMap keyMap)
private

Gets silicon stubs to send to Acts IVF.

If there are fewer tracks than centroids, just one with 1 centroid Otherwise algorithm does not converge. nCentroids should only be a handful, so this only affects small nTrack events.

Only vertex with stubs that have five clusters

The vertexing has an expectation about the field direction and associated charge. For the 3D map, to work with the required swap of the field for the silicon seeds, we need to flip the charge

Make a dummy covariance matrix for Acts that corresponds to the resolutions of the silicon seeds

Make a dummy perigee surface to bound the track to

Definition at line 675 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 675 of file PHActsInitialVertexFinder.cc

References Acts::UnitConstants::cm, Acts::Test::cov, Acts::UnitConstants::e, ActsTrackingGeometry::geoContext, m_magField, m_nCentroids, m_resetTrackCovariance, m_svtxTrackMapName, m_tGeometry, m_trackMap, Acts::UnitConstants::ns, p, ActsTransformations::rotateSvtxTrackCovToActs(), ActsTransformations::setVerbosity(), SvtxTrackMap::size(), sortTracks(), Acts::Test::transform, Acts::UnitConstants::um, and Fun4AllBase::Verbosity().

Referenced by Process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PHActsInitialVertexFinder::magFieldName ( const std::string &  magfield)
inline

Definition at line 60 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 60 of file PHActsInitialVertexFinder.h

References m_magField, and magfield.

int PHActsInitialVertexFinder::Process ( PHCompositeNode topNode)
overrideprotectedvirtual

process event interface for trackers, called in process_event. implemented in derived classes

Need to check that silicon stubs which may have been skipped over still have a vertex association

Implements PHInitVertexing.

Definition at line 70 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 70 of file PHActsInitialVertexFinder.cc

References checkTrackVertexAssociation(), createDummyVertex(), Fun4AllReturnCodes::EVENT_OK, fillVertexMap(), findVertices(), SvtxTrackMap::get(), getTrackPointers(), m_event, m_trackMap, PHWHERE, SvtxTrackMap::size(), and Fun4AllBase::Verbosity().

+ Here is the call graph for this function:

void PHActsInitialVertexFinder::removeSiliconSeeds ( const bool  removeSeeds)
inline

Definition at line 58 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 58 of file PHActsInitialVertexFinder.h

References m_removeSeeds.

int PHActsInitialVertexFinder::ResetEvent ( PHCompositeNode )
overrideprotectedvirtual

Clean up after each event.

Reimplemented from SubsysReco.

Definition at line 118 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 118 of file PHActsInitialVertexFinder.cc

References Fun4AllReturnCodes::EVENT_OK.

void PHActsInitialVertexFinder::resetTrackCovariance ( const bool  initial)
inline

Definition at line 49 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 49 of file PHActsInitialVertexFinder.h

References m_resetTrackCovariance.

void PHActsInitialVertexFinder::setCentroids ( const int  centroids)
inline

Definition at line 52 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 52 of file PHActsInitialVertexFinder.h

References m_nCentroids.

void PHActsInitialVertexFinder::setIterations ( const int  iterations)
inline

Definition at line 55 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 55 of file PHActsInitialVertexFinder.h

References m_nIterations.

void PHActsInitialVertexFinder::setMaxVertices ( const int  maxVertices)
inline

Definition at line 37 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 37 of file PHActsInitialVertexFinder.h

References m_maxVertices.

void PHActsInitialVertexFinder::setPCACut ( const float  pcaCut)
inline

Definition at line 63 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 63 of file PHActsInitialVertexFinder.h

References m_pcaCut.

void PHActsInitialVertexFinder::setSvtxTrackMapName ( const std::string &  name)
inline

Definition at line 43 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 43 of file PHActsInitialVertexFinder.h

References m_svtxTrackMapName, and name.

void PHActsInitialVertexFinder::setSvtxVertexMapName ( const std::string &  name)
inline

Definition at line 40 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 40 of file PHActsInitialVertexFinder.h

References m_svtxVertexMapName, and name.

int PHActsInitialVertexFinder::Setup ( PHCompositeNode topNode)
overrideprotectedvirtual

setup interface for trackers, called in InitRun, setup things like pointers to nodes. overrided in derived classes

Reimplemented from PHInitVertexing.

Definition at line 56 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 56 of file PHActsInitialVertexFinder.cc

References Fun4AllReturnCodes::ABORTEVENT, createNodes(), Fun4AllReturnCodes::EVENT_OK, getNodes(), m_random_number_generator, and m_seed.

+ Here is the call graph for this function:

std::vector< SvtxTrack * > PHActsInitialVertexFinder::sortTracks ( )
private

Implements a k-means cluster algorithm to identify bad seeds to remove from Acts initial vertexing

Implement a simple k-means clustering algorithm. Randomly select m_nCentroid track z PCAs (centroids), assign all tracks to a centroid based on which they are closest to, and then iterate to update clusters and centroids

Get the original centroids

This map holds the centroid index as the key and a vector of SvtxTracks that correspond to that centroid

Take the map and identified centroids and remove tracks that aren't compatible

Definition at line 415 of file PHActsInitialVertexFinder.cc.

View newest version in sPHENIX GitHub at line 415 of file PHActsInitialVertexFinder.cc

References createCentroidMap(), SvtxTrackMap::get(), SvtxTrack::get_x(), SvtxTrack::get_y(), SvtxTrack::get_z(), getIVFTracks(), m_nCentroids, m_random_number_generator, m_trackMap, SvtxTrackMap::size(), and Fun4AllBase::Verbosity().

Referenced by getTrackPointers().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

bool PHActsInitialVertexFinder::m_disableWeights = true
private

Definition at line 123 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 123 of file PHActsInitialVertexFinder.h

Referenced by disablePtWeights(), and findVertices().

int PHActsInitialVertexFinder::m_event = 0
private

Event num.

Definition at line 111 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 111 of file PHActsInitialVertexFinder.h

Referenced by Process().

std::string PHActsInitialVertexFinder::m_magField = ""
private

Definition at line 121 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 121 of file PHActsInitialVertexFinder.h

Referenced by getTrackPointers(), and magFieldName().

int PHActsInitialVertexFinder::m_maxVertices = 5
private

Max number of vertices allowed by the Acts IVF.

Definition at line 107 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 107 of file PHActsInitialVertexFinder.h

Referenced by findVertices(), and setMaxVertices().

int PHActsInitialVertexFinder::m_nCentroids = 5
private

Number of centroids for k-means clustering algorithm.

Definition at line 103 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 103 of file PHActsInitialVertexFinder.h

Referenced by createCentroidMap(), getIVFTracks(), getTrackPointers(), setCentroids(), and sortTracks().

int PHActsInitialVertexFinder::m_nIterations = 15
private

Number of times to iterate for clusters to converge.

Definition at line 105 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 105 of file PHActsInitialVertexFinder.h

Referenced by createCentroidMap(), and setIterations().

float PHActsInitialVertexFinder::m_pcaCut = 0.03
private

Maximum centroid transverse PCA cut.

Definition at line 109 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 109 of file PHActsInitialVertexFinder.h

Referenced by getIVFTracks(), and setPCACut().

std::mt19937 PHActsInitialVertexFinder::m_random_number_generator
private

Definition at line 117 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 117 of file PHActsInitialVertexFinder.h

Referenced by Setup(), and sortTracks().

bool PHActsInitialVertexFinder::m_removeSeeds = false
private

Definition at line 124 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 124 of file PHActsInitialVertexFinder.h

Referenced by getIVFTracks(), and removeSiliconSeeds().

bool PHActsInitialVertexFinder::m_resetTrackCovariance = true
private

Definition at line 122 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 122 of file PHActsInitialVertexFinder.h

Referenced by getTrackPointers(), and resetTrackCovariance().

unsigned int PHActsInitialVertexFinder::m_seed = 0
private

Definition at line 116 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 116 of file PHActsInitialVertexFinder.h

Referenced by Setup().

unsigned int PHActsInitialVertexFinder::m_successFits = 0
private

Definition at line 114 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 114 of file PHActsInitialVertexFinder.h

Referenced by End(), and findVertices().

std::string PHActsInitialVertexFinder::m_svtxTrackMapName = "SvtxSiliconTrackMap"
private

Definition at line 119 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 119 of file PHActsInitialVertexFinder.h

Referenced by getNodes(), getTrackPointers(), and setSvtxTrackMapName().

std::string PHActsInitialVertexFinder::m_svtxVertexMapName = "SvtxVertexMap"
private

Definition at line 120 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 120 of file PHActsInitialVertexFinder.h

Referenced by createNodes(), and setSvtxVertexMapName().

ActsTrackingGeometry* PHActsInitialVertexFinder::m_tGeometry = nullptr
private

Definition at line 128 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 128 of file PHActsInitialVertexFinder.h

Referenced by findVertices(), getNodes(), and getTrackPointers().

unsigned int PHActsInitialVertexFinder::m_totVertexFits = 0
private

Diagnostic vertex numbers.

Definition at line 113 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 113 of file PHActsInitialVertexFinder.h

Referenced by End(), and findVertices().

SvtxTrackMap* PHActsInitialVertexFinder::m_trackMap = nullptr
private
SvtxVertexMap* PHActsInitialVertexFinder::m_vertexMap = nullptr
private

Definition at line 127 of file PHActsInitialVertexFinder.h.

View newest version in sPHENIX GitHub at line 127 of file PHActsInitialVertexFinder.h

Referenced by checkTrackVertexAssociation(), createDummyVertex(), createNodes(), and fillVertexMap().


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