CbmRoot
Loading...
Searching...
No Matches
cbm::algo::ca::McData Class Reference

This class represents a package for tracking-related data. More...

#include <CaMcData.h>

Collaboration diagram for cbm::algo::ca::McData:
[legend]

Public Member Functions

 McData ()
 Default constructor.
 
 ~McData ()=default
 Destructor.
 
 McData (const McData &other)
 Copy constructor.
 
 McData (McData &&other) noexcept
 Move constructor.
 
McDataoperator= (const McData &other)
 Copy assignment operator.
 
McDataoperator= (McData &&other) noexcept
 Move assignment operator.
 
void Swap (McData &other) noexcept
 Swap method.
 
void AddPoint (const McPoint &point)
 
void AddTrack (const McTrack &track)
 
void Clear ()
 Clears contents.
 
int FindInternalPointIndex (ca::EDetectorID detID, int index, int event, int file) const
 Finds an index of MC point in internal point container.
 
int FindInternalTrackIndex (int index, int event, int file) const
 Finds an index of MC track in internal track container.
 
int GetFirstPointIndex (ca::EDetectorID detID) const
 Gets the first point index for a given detector subsystem.
 
int GetLastPointIndex (ca::EDetectorID detID) const
 Gets the next index of point, which is expected being after the last one for a given detector.
 
int GetPointGlobExtIndex (ca::EDetectorID detID, int iPointLocal) const
 Calculates global index of MC point.
 
int GetNofTracks () const
 Gets number of tracks in this event/TS.
 
int GetNofPoints () const
 Gets number of points in this event/TS.
 
int GetNofPointsOrig (ca::EDetectorID detID) const
 Gets original number of MC points in different detectors.
 
int GetNofPointsUsed (ca::EDetectorID detID) const
 Gets used number of MC points in different detectors.
 
const auto & GetPoint (int idx) const
 Gets a reference to MC point by its index.
 
auto & GetPoint (int idx)
 Gets mutual reference to MC point by its index.
 
const auto & GetPointContainer () const
 Gets a reference to the vector of points.
 
const auto & GetTrack (int idx) const
 Gets a reference to MC track by its internal index.
 
auto & GetTrack (int idx)
 Gets a mutual reference to MC track by its internal index.
 
const auto & GetTrackContainer () const
 Gets a reference to the vector of tracks.
 
auto & GetTrackContainer ()
 Gets a mutual reference to the vector of tracks.
 
void SetMcHitInfo (const ca::Vector< cbm::algo::ca::McHitInfo > &vHits)
 Initialize information about points and hits association with MC track.
 
void ReserveNofTracks (int nTracks)
 Reserves memory for tracks to avoid extra allocations.
 
void ReserveNofPoints (int nPoints)
 Reserves memory for points to avoid extra allocations.
 
void SetNofPointsOrig (ca::EDetectorID detID, int nPoints)
 Sets original number of MC points in different detectors.
 
const ca::Vector< cbm::algo::ca::McHitInfo > * GetMcHitInfo () const
 Gets pointer to MC hit info container.
 
int GetBestMcPointIdForCaHit (int iHit) const
 
int GetBestMcTrackIdForCaHit (int iHit) const
 
McMatch GetMcMatchForCaHit (int iHit) const
 
std::string ToString (int verbose=1) const
 

Private Attributes

ca::Vector< McPointfvPoints = {"ca::algo::ca::McData::fvPoints"}
 Container of points.
 
ca::Vector< McTrackfvTracks = {"ca::algo::ca::McData::fvTracks"}
 Container of tracks.
 
std::array< int, constants::size::MaxNdetectorsfvNofPointsOrig = {0}
 Total number of points by detector.
 
std::array< int, constants::size::MaxNdetectorsfvNofPointsUsed = {0}
 Number of points used vs. detector.
 
std::unordered_map< McLinkKey, int > fmPointLinkMap = {}
 MC point internal index vs. link.
 
std::unordered_map< McLinkKey, int > fmTrackLinkMap = {}
 MC track internal index vs. link.
 
const ca::Vector< cbm::algo::ca::McHitInfo > * fpMcHitInfos = {nullptr}
 

Detailed Description

This class represents a package for tracking-related data.

Definition at line 33 of file CaMcData.h.

Constructor & Destructor Documentation

◆ McData() [1/3]

McData::McData ( )

Default constructor.

Definition at line 22 of file CaMcData.cxx.

Referenced by McData(), McData(), operator=(), operator=(), Swap(), and ~McData().

◆ ~McData()

cbm::algo::ca::McData::~McData ( )
default

Destructor.

References McData().

◆ McData() [2/3]

McData::McData ( const McData & other)

Copy constructor.

Definition at line 26 of file CaMcData.cxx.

References fmPointLinkMap, fmTrackLinkMap, fvNofPointsOrig, fvNofPointsUsed, fvPoints, fvTracks, and McData().

◆ McData() [3/3]

McData::McData ( McData && other)
noexcept

Move constructor.

Definition at line 38 of file CaMcData.cxx.

References McData(), and Swap().

Member Function Documentation

◆ AddPoint()

void cbm::algo::ca::McData::AddPoint ( const McPoint & point)
inline

Adds an MC point to points container and a corresponding link key to the point index map

Parameters
pointMC point object

Definition at line 245 of file CaMcData.h.

References fmPointLinkMap, fvNofPointsUsed, fvPoints, cbm::algo::ca::McPoint::GetDetectorId(), cbm::algo::ca::McPoint::GetId(), and cbm::algo::ca::McPoint::GetLinkKey().

◆ AddTrack()

void cbm::algo::ca::McData::AddTrack ( const McTrack & track)
inline

Adds an MC track to tracks container and a corresponding link key to the link index map

Parameters
trackMC track object

Definition at line 254 of file CaMcData.h.

References fmTrackLinkMap, fvTracks, cbm::algo::ca::McTrack::GetId(), and cbm::algo::ca::McTrack::GetLinkKey().

◆ Clear()

void McData::Clear ( )

Clears contents.

Definition at line 76 of file CaMcData.cxx.

References fmPointLinkMap, fmTrackLinkMap, fvPoints, and fvTracks.

◆ FindInternalPointIndex()

int cbm::algo::ca::McData::FindInternalPointIndex ( ca::EDetectorID detID,
int index,
int event,
int file ) const
inline

Finds an index of MC point in internal point container.

Parameters
detIDDetector ID
indexIndex of MC point in external point container
eventIndex of MC event
fileIndex of MC file
Returns
Index of MC point in internal point container within event/TS If the point is not found the function returns -1

Definition at line 78 of file CaMcData.h.

References fmPointLinkMap, and GetPointGlobExtIndex().

◆ FindInternalTrackIndex()

int cbm::algo::ca::McData::FindInternalTrackIndex ( int index,
int event,
int file ) const
inline

Finds an index of MC track in internal track container.

Parameters
indexIndex of MC track in external track container
eventIndex of MC event
fileIndex of MC file
Returns
Index of MC track in internal track container within event/TS If the track is not found, the function returns -1

Definition at line 91 of file CaMcData.h.

References fmTrackLinkMap.

◆ GetBestMcPointIdForCaHit()

int cbm::algo::ca::McData::GetBestMcPointIdForCaHit ( int iHit) const
inline

Definition at line 180 of file CaMcData.h.

References fpMcHitInfos.

◆ GetBestMcTrackIdForCaHit()

int cbm::algo::ca::McData::GetBestMcTrackIdForCaHit ( int iHit) const
inline

Definition at line 188 of file CaMcData.h.

References fpMcHitInfos, GetNofPoints(), and GetPoint().

◆ GetFirstPointIndex()

int cbm::algo::ca::McData::GetFirstPointIndex ( ca::EDetectorID detID) const
inline

Gets the first point index for a given detector subsystem.

Parameters
detIDDetector ID

Definition at line 99 of file CaMcData.h.

References fvNofPointsUsed.

◆ GetLastPointIndex()

int cbm::algo::ca::McData::GetLastPointIndex ( ca::EDetectorID detID) const
inline

Gets the next index of point, which is expected being after the last one for a given detector.

Parameters
detIDDetector ID

Definition at line 106 of file CaMcData.h.

References fvNofPointsUsed.

◆ GetMcHitInfo()

const ca::Vector< cbm::algo::ca::McHitInfo > * cbm::algo::ca::McData::GetMcHitInfo ( ) const
inline

Gets pointer to MC hit info container.

Definition at line 178 of file CaMcData.h.

References fpMcHitInfos.

◆ GetMcMatchForCaHit()

McMatch cbm::algo::ca::McData::GetMcMatchForCaHit ( int iHit) const
inline

◆ GetNofPoints()

int cbm::algo::ca::McData::GetNofPoints ( ) const
inline

Gets number of points in this event/TS.

Definition at line 126 of file CaMcData.h.

References fvPoints.

Referenced by GetBestMcTrackIdForCaHit(), GetMcMatchForCaHit(), and ToString().

◆ GetNofPointsOrig()

int cbm::algo::ca::McData::GetNofPointsOrig ( ca::EDetectorID detID) const
inline

Gets original number of MC points in different detectors.

Parameters
detIDDetector ID

Definition at line 130 of file CaMcData.h.

References fvNofPointsOrig.

◆ GetNofPointsUsed()

int cbm::algo::ca::McData::GetNofPointsUsed ( ca::EDetectorID detID) const
inline

Gets used number of MC points in different detectors.

Parameters
detIDDetector ID

Definition at line 134 of file CaMcData.h.

References fvNofPointsUsed.

◆ GetNofTracks()

int cbm::algo::ca::McData::GetNofTracks ( ) const
inline

Gets number of tracks in this event/TS.

Definition at line 123 of file CaMcData.h.

References fvTracks.

Referenced by ToString().

◆ GetPoint() [1/2]

auto & cbm::algo::ca::McData::GetPoint ( int idx)
inline

Gets mutual reference to MC point by its index.

Definition at line 142 of file CaMcData.h.

References fvPoints.

◆ GetPoint() [2/2]

const auto & cbm::algo::ca::McData::GetPoint ( int idx) const
inline

Gets a reference to MC point by its index.

Definition at line 137 of file CaMcData.h.

References fvPoints.

Referenced by GetBestMcTrackIdForCaHit(), and GetMcMatchForCaHit().

◆ GetPointContainer()

const auto & cbm::algo::ca::McData::GetPointContainer ( ) const
inline

Gets a reference to the vector of points.

Definition at line 145 of file CaMcData.h.

References fvPoints.

◆ GetPointGlobExtIndex()

int cbm::algo::ca::McData::GetPointGlobExtIndex ( ca::EDetectorID detID,
int iPointLocal ) const
inline

Calculates global index of MC point.

Parameters
iPointLocalLocal index of MC psinoint
detIDDetector ID

The function calculates global external index of MC point as a sum of a given local index and total provided number of points in previous detector subsystem.

Definition at line 117 of file CaMcData.h.

References fvNofPointsOrig.

Referenced by FindInternalPointIndex().

◆ GetTrack() [1/2]

auto & cbm::algo::ca::McData::GetTrack ( int idx)
inline

Gets a mutual reference to MC track by its internal index.

Definition at line 151 of file CaMcData.h.

References fvTracks.

◆ GetTrack() [2/2]

const auto & cbm::algo::ca::McData::GetTrack ( int idx) const
inline

Gets a reference to MC track by its internal index.

Definition at line 148 of file CaMcData.h.

References fvTracks.

◆ GetTrackContainer() [1/2]

auto & cbm::algo::ca::McData::GetTrackContainer ( )
inline

Gets a mutual reference to the vector of tracks.

Definition at line 157 of file CaMcData.h.

References fvTracks.

◆ GetTrackContainer() [2/2]

const auto & cbm::algo::ca::McData::GetTrackContainer ( ) const
inline

Gets a reference to the vector of tracks.

Definition at line 154 of file CaMcData.h.

References fvTracks.

◆ operator=() [1/2]

McData & McData::operator= ( const McData & other)

Copy assignment operator.

Definition at line 42 of file CaMcData.cxx.

References McData().

◆ operator=() [2/2]

McData & McData::operator= ( McData && other)
noexcept

Move assignment operator.

Definition at line 52 of file CaMcData.cxx.

References McData(), and Swap().

◆ ReserveNofPoints()

void cbm::algo::ca::McData::ReserveNofPoints ( int nPoints)
inline

Reserves memory for points to avoid extra allocations.

Definition at line 170 of file CaMcData.h.

References fvPoints.

◆ ReserveNofTracks()

void cbm::algo::ca::McData::ReserveNofTracks ( int nTracks)
inline

Reserves memory for tracks to avoid extra allocations.

Definition at line 167 of file CaMcData.h.

References fvTracks.

◆ SetMcHitInfo()

void McData::SetMcHitInfo ( const ca::Vector< cbm::algo::ca::McHitInfo > & vHits)

Initialize information about points and hits association with MC track.

Parameters
vHitsVector of hit objects Initialize tracks: defines indexes of hits and points related to the track, calculates max number of points and hits on a station, number of consecutive stations containing a hit or point and number of stations and points with hits.

Definition at line 86 of file CaMcData.cxx.

References fpMcHitInfos, fvPoints, and fvTracks.

◆ SetNofPointsOrig()

void cbm::algo::ca::McData::SetNofPointsOrig ( ca::EDetectorID detID,
int nPoints )
inline

Sets original number of MC points in different detectors.

Parameters
detIDDetector ID
nPointsNumber of points

Definition at line 175 of file CaMcData.h.

References fvNofPointsOrig.

◆ Swap()

void McData::Swap ( McData & other)
noexcept

Swap method.

Definition at line 63 of file CaMcData.cxx.

References fmPointLinkMap, fmTrackLinkMap, fvNofPointsOrig, fvNofPointsUsed, fvPoints, fvTracks, and McData().

Referenced by McData(), and operator=().

◆ ToString()

std::string McData::ToString ( int verbose = 1) const

Prints an example of tracks and points

Parameters
verboseVerbose level:
  • #0: Nothing is printed
  • #1: Only numbers of tracks and points are printed
  • #2: First five tracks and points are printed (partially)

Definition at line 109 of file CaMcData.cxx.

References fmPointLinkMap, fmTrackLinkMap, fvPoints, fvTracks, GetNofPoints(), and GetNofTracks().

Member Data Documentation

◆ fmPointLinkMap

std::unordered_map<McLinkKey, int> cbm::algo::ca::McData::fmPointLinkMap = {}
private

MC point internal index vs. link.

Definition at line 232 of file CaMcData.h.

Referenced by AddPoint(), Clear(), FindInternalPointIndex(), McData(), Swap(), and ToString().

◆ fmTrackLinkMap

std::unordered_map<McLinkKey, int> cbm::algo::ca::McData::fmTrackLinkMap = {}
private

MC track internal index vs. link.

Definition at line 233 of file CaMcData.h.

Referenced by AddTrack(), Clear(), FindInternalTrackIndex(), McData(), Swap(), and ToString().

◆ fpMcHitInfos

const ca::Vector<cbm::algo::ca::McHitInfo>* cbm::algo::ca::McData::fpMcHitInfos = {nullptr}
private

◆ fvNofPointsOrig

std::array<int, constants::size::MaxNdetectors> cbm::algo::ca::McData::fvNofPointsOrig = {0}
private

Total number of points by detector.

Definition at line 229 of file CaMcData.h.

Referenced by GetNofPointsOrig(), GetPointGlobExtIndex(), McData(), SetNofPointsOrig(), and Swap().

◆ fvNofPointsUsed

std::array<int, constants::size::MaxNdetectors> cbm::algo::ca::McData::fvNofPointsUsed = {0}
private

Number of points used vs. detector.

Definition at line 230 of file CaMcData.h.

Referenced by AddPoint(), GetFirstPointIndex(), GetLastPointIndex(), GetNofPointsUsed(), McData(), and Swap().

◆ fvPoints

ca::Vector<McPoint> cbm::algo::ca::McData::fvPoints = {"ca::algo::ca::McData::fvPoints"}
private

◆ fvTracks

ca::Vector<McTrack> cbm::algo::ca::McData::fvTracks = {"ca::algo::ca::McData::fvTracks"}
private

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