CbmRoot
Loading...
Searching...
No Matches
cbm::ca::tools::MCData Class Reference

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

#include <CaToolsMCData.h>

Collaboration diagram for cbm::ca::tools::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 InitTrackInfo (const ca::Vector< CbmL1HitDebugInfo > &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.
 
std::string ToString (int verbose=1) const
 

Private Attributes

ca::Vector< MCPointfvPoints = {"ca::tools::MCData::fvPoints"}
 Container of points.
 
ca::Vector< MCTrackfvTracks = {"ca::tools::MCData::fvTracks"}
 Container of tracks.
 
std::array< int, constants::size::MaxNdetectors > fvNofPointsOrig = {0}
 Total number of points by detector.
 
std::array< int, constants::size::MaxNdetectors > fvNofPointsUsed = {0}
 Number of points used vs. detector.
 
std::unordered_map< LinkKey, int > fmPointLinkMap = {}
 MC point internal index vs. link.
 
std::unordered_map< LinkKey, int > fmTrackLinkMap = {}
 MC track internal index vs. link.
 

Detailed Description

This class represents a package for tracking-related data.

Definition at line 34 of file CaToolsMCData.h.

Constructor & Destructor Documentation

◆ MCData() [1/3]

MCData::MCData ( )

Default constructor.

Definition at line 22 of file CaToolsMCData.cxx.

Referenced by operator=().

◆ ~MCData()

cbm::ca::tools::MCData::~MCData ( )
default

Destructor.

◆ MCData() [2/3]

MCData::MCData ( const MCData & other)

Copy constructor.

Definition at line 26 of file CaToolsMCData.cxx.

◆ MCData() [3/3]

MCData::MCData ( MCData && other)
noexcept

Move constructor.

Definition at line 38 of file CaToolsMCData.cxx.

Member Function Documentation

◆ AddPoint()

void cbm::ca::tools::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 207 of file CaToolsMCData.h.

References fmPointLinkMap, fvNofPointsUsed, fvPoints, cbm::ca::tools::MCPoint::GetDetectorId(), cbm::ca::tools::MCPoint::GetId(), and cbm::ca::tools::MCPoint::GetLinkKey().

Referenced by cbm::ca::MCModule::ReadMCPointsForDetector().

◆ AddTrack()

void cbm::ca::tools::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 216 of file CaToolsMCData.h.

References fmTrackLinkMap, fvTracks, cbm::ca::tools::MCTrack::GetId(), and cbm::ca::tools::MCTrack::GetLinkKey().

Referenced by cbm::ca::MCModule::ReadMCTracks().

◆ Clear()

void MCData::Clear ( )

Clears contents.

Definition at line 76 of file CaToolsMCData.cxx.

References fmPointLinkMap, fmTrackLinkMap, fvPoints, and fvTracks.

Referenced by cbm::ca::MCModule::InitEvent().

◆ FindInternalPointIndex()

int cbm::ca::tools::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 79 of file CaToolsMCData.h.

References fmPointLinkMap, and GetPointGlobExtIndex().

Referenced by cbm::ca::MCModule::MatchHitWithMc().

◆ FindInternalTrackIndex()

int cbm::ca::tools::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 92 of file CaToolsMCData.h.

References fmTrackLinkMap.

Referenced by cbm::ca::MCModule::FillMCPoint(), and cbm::ca::MCModule::ReadMCTracks().

◆ GetFirstPointIndex()

int cbm::ca::tools::MCData::GetFirstPointIndex ( ca::EDetectorID detID) const
inline

Gets the first point index for a given detector subsystem.

Parameters
detIDDetector ID

Definition at line 100 of file CaToolsMCData.h.

References fvNofPointsUsed.

◆ GetLastPointIndex()

int cbm::ca::tools::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 107 of file CaToolsMCData.h.

References fvNofPointsUsed.

◆ GetNofPoints()

int cbm::ca::tools::MCData::GetNofPoints ( ) const
inline

Gets number of points in this event/TS.

Definition at line 127 of file CaToolsMCData.h.

References fvPoints.

Referenced by cbm::ca::OutputQa::DrawEvent(), cbm::ca::OutputQa::ExecQa(), cbm::ca::MCModule::FillMCPoint(), cbm::ca::MCModule::InitEvent(), and ToString().

◆ GetNofPointsOrig()

int cbm::ca::tools::MCData::GetNofPointsOrig ( ca::EDetectorID detID) const
inline

Gets original number of MC points in different detectors.

Parameters
detIDDetector ID

Definition at line 131 of file CaToolsMCData.h.

References fvNofPointsOrig.

◆ GetNofPointsUsed()

int cbm::ca::tools::MCData::GetNofPointsUsed ( ca::EDetectorID detID) const
inline

Gets used number of MC points in different detectors.

Parameters
detIDDetector ID

Definition at line 135 of file CaToolsMCData.h.

References fvNofPointsUsed.

◆ GetNofTracks()

int cbm::ca::tools::MCData::GetNofTracks ( ) const
inline

◆ GetPoint() [1/2]

auto & cbm::ca::tools::MCData::GetPoint ( int idx)
inline

Gets mutual reference to MC point by its index.

Definition at line 143 of file CaToolsMCData.h.

References fvPoints.

◆ GetPoint() [2/2]

◆ GetPointContainer()

const auto & cbm::ca::tools::MCData::GetPointContainer ( ) const
inline

Gets a reference to the vector of points.

Definition at line 146 of file CaToolsMCData.h.

References fvPoints.

◆ GetPointGlobExtIndex()

int cbm::ca::tools::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 118 of file CaToolsMCData.h.

References fvNofPointsOrig.

Referenced by cbm::ca::MCModule::FillMCPoint(), and FindInternalPointIndex().

◆ GetTrack() [1/2]

auto & cbm::ca::tools::MCData::GetTrack ( int idx)
inline

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

Definition at line 152 of file CaToolsMCData.h.

References fvTracks.

◆ GetTrack() [2/2]

◆ GetTrackContainer() [1/2]

auto & cbm::ca::tools::MCData::GetTrackContainer ( )
inline

Gets a mutual reference to the vector of tracks.

Definition at line 158 of file CaToolsMCData.h.

References fvTracks.

◆ GetTrackContainer() [2/2]

const auto & cbm::ca::tools::MCData::GetTrackContainer ( ) const
inline

◆ InitTrackInfo()

void MCData::InitTrackInfo ( const ca::Vector< CbmL1HitDebugInfo > & 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 CaToolsMCData.cxx.

References fvPoints, and fvTracks.

Referenced by cbm::ca::MCModule::InitTrackInfo().

◆ operator=() [1/2]

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

Copy assignment operator.

Definition at line 42 of file CaToolsMCData.cxx.

References MCData().

◆ operator=() [2/2]

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

Move assignment operator.

Definition at line 52 of file CaToolsMCData.cxx.

◆ ReserveNofPoints()

void cbm::ca::tools::MCData::ReserveNofPoints ( int nPoints)
inline

Reserves memory for points to avoid extra allocations.

Definition at line 171 of file CaToolsMCData.h.

References fvPoints.

Referenced by cbm::ca::MCModule::ReadMCPoints().

◆ ReserveNofTracks()

void cbm::ca::tools::MCData::ReserveNofTracks ( int nTracks)
inline

Reserves memory for tracks to avoid extra allocations.

Definition at line 168 of file CaToolsMCData.h.

References fvTracks.

Referenced by cbm::ca::MCModule::ReadMCTracks().

◆ SetNofPointsOrig()

void cbm::ca::tools::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 176 of file CaToolsMCData.h.

References fvNofPointsOrig.

Referenced by cbm::ca::MCModule::ReadMCPoints().

◆ Swap()

void MCData::Swap ( MCData & other)
noexcept

Swap method.

Definition at line 63 of file CaToolsMCData.cxx.

◆ 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 108 of file CaToolsMCData.cxx.

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

Member Data Documentation

◆ fmPointLinkMap

std::unordered_map<LinkKey, int> cbm::ca::tools::MCData::fmPointLinkMap = {}
private

MC point internal index vs. link.

Definition at line 196 of file CaToolsMCData.h.

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

◆ fmTrackLinkMap

std::unordered_map<LinkKey, int> cbm::ca::tools::MCData::fmTrackLinkMap = {}
private

MC track internal index vs. link.

Definition at line 197 of file CaToolsMCData.h.

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

◆ fvNofPointsOrig

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

Total number of points by detector.

Definition at line 193 of file CaToolsMCData.h.

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

◆ fvNofPointsUsed

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

Number of points used vs. detector.

Definition at line 194 of file CaToolsMCData.h.

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

◆ fvPoints

ca::Vector<MCPoint> cbm::ca::tools::MCData::fvPoints = {"ca::tools::MCData::fvPoints"}
private

Container of points.

Definition at line 190 of file CaToolsMCData.h.

Referenced by AddPoint(), Clear(), GetNofPoints(), GetPoint(), GetPoint(), GetPointContainer(), InitTrackInfo(), ReserveNofPoints(), and ToString().

◆ fvTracks

ca::Vector<MCTrack> cbm::ca::tools::MCData::fvTracks = {"ca::tools::MCData::fvTracks"}
private

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