CbmRoot
Loading...
Searching...
No Matches
cbm::ca::MCModule Class Reference

Class CbmCaPerformance is an interface to communicate between. More...

#include <CbmCaMCModule.h>

Collaboration diagram for cbm::ca::MCModule:
[legend]

Public Member Functions

 MCModule (int verb=1, int perfMode=1)
 Constructor.
 
 ~MCModule ()=default
 Destructor.
 
 MCModule (const MCModule &)=delete
 Copy constructor.
 
 MCModule (MCModule &&)=delete
 Move constructor.
 
MCModuleoperator= (const MCModule &)=delete
 Copy assignment operator.
 
MCModuleoperator= (MCModule &&)=delete
 Move assignment operator.
 
void Finish ()
 Defines performance action in the end of the run.
 
const tools::MCDataGetMCData () const
 Gets a pointer to MC data object.
 
void InitEvent (CbmEvent *pEvent)
 Defines performance action in the beginning of each event or time slice.
 
bool InitRun ()
 Defines action on the module in the beginning of the run.
 
template<ca::EDetectorID DetId>
std::tuple< int, std::vector< int > > MatchHitWithMc (int iHitExt)
 Matches hit with MC point.
 
void MatchHits ()
 Match reconstructed hits and MC points.
 
void MatchTracks ()
 Match reconstructed and MC data.
 
void ProcessEvent (CbmEvent *pEvent)
 Processes event.
 
void RegisterFirstHitIndexes (const std::array< int, constants::size::MaxNdetectors+1 > &source)
 Sets first hit indexes container in different detectors.
 
void SetDetector (ca::EDetectorID detID, bool flag)
 Sets used detector subsystems.
 
void RegisterMCData (tools::MCData &mcData)
 Registers MC data object.
 
void RegisterRecoTrackContainer (ca::Vector< CbmL1Track > &vRecoTracks)
 Registers reconstructed track container.
 
void RegisterHitIndexContainer (ca::Vector< CbmL1HitId > &vHitIds)
 Registers hit index container.
 
void RegisterParameters (std::shared_ptr< ca::Parameters< float > > &pParameters)
 Registers CA parameters object.
 
void RegisterQaHitContainer (ca::Vector< CbmL1HitDebugInfo > &vQaHits)
 Registers debug hit container.
 
int GetVerbosity () const
 Gets verbosity level.
 
void CheckInit () const
 Check class initialization.
 
void InitTrackInfo ()
 Initializes MC track.
 
template<ca::EDetectorID DetID>
void MatchPointsAndHits ()
 Match sets of MC points and reconstructed hits for a given detector.
 
void MatchRecoAndMCTracks ()
 Matches reconstructed tracks with MC tracks.
 

Private Types

enum class  EMonitorKey {
  kMcTrack , kMcTrackReconstructable , kMcPoint , kRecoNevents ,
  kMissedMatchesMvd , kMissedMatchesSts , kMissedMatchesMuch , kMissedMatchesTrd ,
  kMissedMatchesTof , END
}
 Monitor keys. More...
 

Private Member Functions

void ReadMCTracks ()
 Reads MC tracks from external trees and saves them to MCDataObject.
 
void ReadMCPoints ()
 Reads MC points from external trees and saves them to MCDataObject.
 
template<ca::EDetectorID DetID>
void ReadMCPointsForDetector ()
 Reads MC points in particular detector.
 
template<ca::EDetectorID DetID>
std::optional< tools::MCPointFillMCPoint (int iExtId, int iEvent, int iFile)
 Fills a single detector-specific MC point.
 

Private Attributes

ca::Monitor< EMonitorKeyfMonitor {"CA MC Module"}
 Monitor.
 
DetIdArr_t< bool > fvbUseDet = {{false}}
 Flag: is detector subsystem used.
 
int fVerbose = 1
 Verbosity level.
 
int fPerformanceMode = -1
 Mode of performance.
 
std::shared_ptr< ca::Parameters< float > > fpParameters = nullptr
 Pointer to tracking parameters object.
 
const CbmTimeSlicefpTimeSlice = nullptr
 Current time slice.
 
CbmMCEventListfpMCEventList = nullptr
 MC event list.
 
CbmMCDataObjectfpMCEventHeader = nullptr
 MC event header.
 
CbmMCDataArrayfpMCTracks = nullptr
 MC tracks input.
 
DetIdArr_t< CbmTrackingDetectorInterfaceBase * > fvpDetInterface = {{nullptr}}
 Tracking detector interface.
 
DetIdArr_t< CbmMCDataArray * > fvpBrPoints = {{nullptr}}
 Array of points vs. detector.
 
DetIdArr_t< TClonesArray * > fvpBrHitMatches = {{nullptr}}
 Array of hit match branches vs. detector.
 
std::set< std::pair< int, int > > fFileEventIDs
 Set of file and event indexes: first - iFile, second - iEvent.
 
int fBestMcFile = -1
 Index of bestly matched MC file.
 
int fBestMcEvent = -1
 Index of bestly matched MC event.
 
tools::MCDatafpMCData = nullptr
 MC information (hits and tracks) instance.
 
ca::Vector< CbmL1Track > * fpvRecoTracks = nullptr
 Pointer to reconstructed track container.
 
ca::Vector< CbmL1HitId > * fpvHitIds = nullptr
 Pointer to hit index container.
 
ca::Vector< CbmL1HitDebugInfo > * fpvQaHits = nullptr
 Pointer to QA hit container.
 
const std::array< int, constants::size::MaxNdetectors+1 > * fpvFstHitId = nullptr
 Pointer to array of first hit indexes in the detector subsystem.
 

Detailed Description

Class CbmCaPerformance is an interface to communicate between.

Definition at line 57 of file CbmCaMCModule.h.

Member Enumeration Documentation

◆ EMonitorKey

enum class cbm::ca::MCModule::EMonitorKey
strongprivate

Monitor keys.

Enumerator
kMcTrack 

Number of MC tracks.

kMcTrackReconstructable 

Number of reconstructable MC tracks.

kMcPoint 

Number of MC points.

kRecoNevents 

Number of events.

kMissedMatchesMvd 

Number of missed matches in MVD.

kMissedMatchesSts 

Number of missed matches in STS.

kMissedMatchesMuch 

Number of missed matches in MuCh.

kMissedMatchesTrd 

Number of missed matches in TRD.

kMissedMatchesTof 

Number of missed TOF matches.

END 

Definition at line 211 of file CbmCaMCModule.h.

Constructor & Destructor Documentation

◆ MCModule() [1/3]

cbm::ca::MCModule::MCModule ( int verb = 1,
int perfMode = 1 )
inline

Constructor.

Parameters
verbosityVerbosity level
perfModePerformance mode (defines cut on number of consecutive stations with hit or point)

Definition at line 64 of file CbmCaMCModule.h.

References fPerformanceMode.

◆ ~MCModule()

cbm::ca::MCModule::~MCModule ( )
default

Destructor.

◆ MCModule() [2/3]

cbm::ca::MCModule::MCModule ( const MCModule & )
delete

Copy constructor.

◆ MCModule() [3/3]

cbm::ca::MCModule::MCModule ( MCModule && )
delete

Move constructor.

Member Function Documentation

◆ CheckInit()

void MCModule::CheckInit ( ) const

Check class initialization.

Note
The function throws std::logic_error, if initialization is incomplete

Definition at line 345 of file CbmCaMCModule.cxx.

References fpMCData, fpMCEventHeader, fpMCEventList, fpMCTracks, fpParameters, fpTimeSlice, fpvFstHitId, fpvHitIds, fpvQaHits, fpvRecoTracks, fvbUseDet, fvpBrHitMatches, fvpBrPoints, and cbm::ca::kDetName.

Referenced by InitRun().

◆ FillMCPoint()

template<ca::EDetectorID DetID>
std::optional< tools::MCPoint > cbm::ca::MCModule::FillMCPoint ( int iExtId,
int iEvent,
int iFile )
private

Fills a single detector-specific MC point.

Template Parameters
DetIDDetector subsystem ID
Parameters
[in]iExtIdIndex of point in the external points container
[in]iEventEventID of point in the external points container
[in]iFileFileID of point int the external points container
[out]intMCPointReference to the internal tracking MC point object (ca::tools::MCData)
Returns
true Point is correct and is to be saved to the MCData object
false Point is incorrect and will be ignored

TODO: Set from track

Definition at line 322 of file CbmCaMCModule.h.

References cbm::ca::tools::MCData::FindInternalTrackIndex(), fpMCData, fpMCEventList, fpMCTracks, fpParameters, fpTimeSlice, fvpBrPoints, fvpDetInterface, CbmMCDataArray::Get(), CbmTimeSlice::GetEndTime(), CbmMCEventList::GetEventTime(), cbm::ca::tools::MCData::GetNofPoints(), cbm::ca::tools::MCData::GetPointGlobExtIndex(), CbmTimeSlice::GetStartTime(), cbm::ca::tools::MCData::GetTrack(), cbm::ca::kDetName, and CbmMCTrack::SetMotherId().

Referenced by ReadMCPointsForDetector().

◆ Finish()

void MCModule::Finish ( )

Defines performance action in the end of the run.

Definition at line 248 of file CbmCaMCModule.cxx.

References fMonitor, and cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::ToString().

◆ GetMCData()

const tools::MCData * cbm::ca::MCModule::GetMCData ( ) const
inline

Gets a pointer to MC data object.

Definition at line 89 of file CbmCaMCModule.h.

References fpMCData.

◆ GetVerbosity()

int cbm::ca::MCModule::GetVerbosity ( ) const
inline

Gets verbosity level.

Definition at line 157 of file CbmCaMCModule.h.

References fVerbose.

◆ InitEvent()

◆ InitRun()

◆ InitTrackInfo()

void MCModule::InitTrackInfo ( )

Initializes MC track.

Initializes information about arrangement of points and hits of MC tracks within stations and the status of track ability to be reconstructed, 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 199 of file CbmCaMCModule.cxx.

References fBestMcEvent, fBestMcFile, fPerformanceMode, fpMCData, fpvQaHits, cbm::ca::tools::MCData::GetPoint(), cbm::ca::tools::MCData::GetTrackContainer(), cbm::ca::tools::MCData::InitTrackInfo(), CbmL1Constants::MinNStations, and CbmL1Constants::MinRecoMom.

Referenced by MatchTracks().

◆ MatchHits()

void MCModule::MatchHits ( )

Match reconstructed hits and MC points.

Definition at line 258 of file CbmCaMCModule.cxx.

References MatchPointsAndHits().

◆ MatchHitWithMc()

template<ca::EDetectorID DetID>
std::tuple< int, std::vector< int > > cbm::ca::MCModule::MatchHitWithMc ( int iHitExt)

Matches hit with MC point.

Template Parameters
DetIdDetector ID
Parameters
iHitExtExternal index of hit
Returns
MC-point index in fvMCPoints array

This method finds a match for a given hit or matches for hits clusters (in case of STS), finds the best link in the match and returns the corresponding global ID of the MC points.

Definition at line 271 of file CbmCaMCModule.h.

References cbm::ca::tools::MCData::FindInternalPointIndex(), fMonitor, fpMCData, fvpBrHitMatches, cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::IncrementCounter(), cbm::ca::kDetName, kMissedMatchesMuch, kMissedMatchesMvd, kMissedMatchesSts, kMissedMatchesTof, and kMissedMatchesTrd.

Referenced by MatchPointsAndHits().

◆ MatchPointsAndHits()

template<ca::EDetectorID DetID>
void cbm::ca::MCModule::MatchPointsAndHits ( )

Match sets of MC points and reconstructed hits for a given detector.

Template Parameters
DetIDIndex of the detector

Writes indexes of MC points to each hit and indexes of hits to each MC point.

Definition at line 471 of file CbmCaMCModule.h.

References fpMCData, fpvFstHitId, fvbUseDet, cbm::ca::tools::MCData::GetPoint(), and MatchHitWithMc().

Referenced by MatchHits().

◆ MatchRecoAndMCTracks()

void MCModule::MatchRecoAndMCTracks ( )

Matches reconstructed tracks with MC tracks.

In the procedure, the maps of associated MC track indexes to corresponding number of hits are filled out and the max purity is calculated for each reconstructed track in the TS/event. If the value of purity for a given MC track is larger then a threshold, the corresponding track index is saved to the reconstructed track object, in the same time the index of the reconstructed track object is saved to this MC track object. If purity for the MC track does not pass the threshold, its index will not be accounted as a matched track, and the index of reconstructed track will be added as an index of "touched" track.

Definition at line 283 of file CbmCaMCModule.cxx.

References fpMCData, fpvRecoTracks, cbm::ca::tools::MCData::GetPoint(), cbm::ca::tools::MCData::GetTrack(), and CbmL1Constants::MinPurity.

Referenced by MatchTracks().

◆ MatchTracks()

void MCModule::MatchTracks ( )

Match reconstructed and MC data.

Runs matching of reconstructed tracks with MC ones. Reconstructed tracks are updated with true information.

Definition at line 269 of file CbmCaMCModule.cxx.

References fMonitor, fpMCData, cbm::ca::tools::MCData::GetTrackContainer(), cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::IncrementCounter(), InitTrackInfo(), kMcTrackReconstructable, and MatchRecoAndMCTracks().

◆ operator=() [1/2]

MCModule & cbm::ca::MCModule::operator= ( const MCModule & )
delete

Copy assignment operator.

◆ operator=() [2/2]

MCModule & cbm::ca::MCModule::operator= ( MCModule && )
delete

Move assignment operator.

◆ ProcessEvent()

void MCModule::ProcessEvent ( CbmEvent * pEvent)

Processes event.

Fills histograms and tables, should be called after the tracking done

Definition at line 195 of file CbmCaMCModule.cxx.

◆ ReadMCPoints()

◆ ReadMCPointsForDetector()

template<ca::EDetectorID DetID>
void cbm::ca::MCModule::ReadMCPointsForDetector ( )
private

Reads MC points in particular detector.

Definition at line 494 of file CbmCaMCModule.h.

References cbm::ca::tools::MCData::AddPoint(), fFileEventIDs, FillMCPoint(), fpMCData, fvbUseDet, and fvpBrPoints.

Referenced by ReadMCPoints().

◆ ReadMCTracks()

◆ RegisterFirstHitIndexes()

void cbm::ca::MCModule::RegisterFirstHitIndexes ( const std::array< int, constants::size::MaxNdetectors+1 > & source)
inline

Sets first hit indexes container in different detectors.

Parameters
sourceArray of indexes

Definition at line 125 of file CbmCaMCModule.h.

References fpvFstHitId.

◆ RegisterHitIndexContainer()

void cbm::ca::MCModule::RegisterHitIndexContainer ( ca::Vector< CbmL1HitId > & vHitIds)
inline

Registers hit index container.

Parameters
vHitIdsReference to hit index container

Definition at line 146 of file CbmCaMCModule.h.

References fpvHitIds.

◆ RegisterMCData()

void cbm::ca::MCModule::RegisterMCData ( tools::MCData & mcData)
inline

Registers MC data object.

Parameters
mcDataInstance of MC data

Definition at line 138 of file CbmCaMCModule.h.

References fpMCData.

◆ RegisterParameters()

void cbm::ca::MCModule::RegisterParameters ( std::shared_ptr< ca::Parameters< float > > & pParameters)
inline

Registers CA parameters object.

Parameters
pParametersA shared pointer to the parameters object

Definition at line 150 of file CbmCaMCModule.h.

References fpParameters.

◆ RegisterQaHitContainer()

void cbm::ca::MCModule::RegisterQaHitContainer ( ca::Vector< CbmL1HitDebugInfo > & vQaHits)
inline

Registers debug hit container.

Parameters
vQaHitsReference to debug hit container

Definition at line 154 of file CbmCaMCModule.h.

References fpvQaHits.

◆ RegisterRecoTrackContainer()

void cbm::ca::MCModule::RegisterRecoTrackContainer ( ca::Vector< CbmL1Track > & vRecoTracks)
inline

Registers reconstructed track container.

Parameters
vRecoTrackReference to reconstructed track container

Definition at line 142 of file CbmCaMCModule.h.

References fpvRecoTracks.

◆ SetDetector()

void cbm::ca::MCModule::SetDetector ( ca::EDetectorID detID,
bool flag )
inline

Sets used detector subsystems.

Parameters
detIDId of detector
flagFlag: true - detector is used
Note
Should be called before this->Init()

Definition at line 134 of file CbmCaMCModule.h.

References fvbUseDet.

Member Data Documentation

◆ fBestMcEvent

int cbm::ca::MCModule::fBestMcEvent = -1
private

Index of bestly matched MC event.

Definition at line 246 of file CbmCaMCModule.h.

Referenced by InitEvent(), and InitTrackInfo().

◆ fBestMcFile

int cbm::ca::MCModule::fBestMcFile = -1
private

Index of bestly matched MC file.

Definition at line 245 of file CbmCaMCModule.h.

Referenced by InitEvent(), and InitTrackInfo().

◆ fFileEventIDs

std::set<std::pair<int, int> > cbm::ca::MCModule::fFileEventIDs
private

Set of file and event indexes: first - iFile, second - iEvent.

Definition at line 244 of file CbmCaMCModule.h.

Referenced by InitEvent(), InitRun(), ReadMCPoints(), ReadMCPointsForDetector(), and ReadMCTracks().

◆ fMonitor

ca::Monitor<EMonitorKey> cbm::ca::MCModule::fMonitor {"CA MC Module"}
private

Monitor.

Definition at line 224 of file CbmCaMCModule.h.

Referenced by Finish(), InitEvent(), InitRun(), MatchHitWithMc(), and MatchTracks().

◆ fPerformanceMode

int cbm::ca::MCModule::fPerformanceMode = -1
private

Mode of performance.

Definition at line 229 of file CbmCaMCModule.h.

Referenced by InitTrackInfo(), and MCModule().

◆ fpMCData

tools::MCData* cbm::ca::MCModule::fpMCData = nullptr
private

◆ fpMCEventHeader

CbmMCDataObject* cbm::ca::MCModule::fpMCEventHeader = nullptr
private

MC event header.

Definition at line 235 of file CbmCaMCModule.h.

Referenced by CheckInit(), InitRun(), and ReadMCTracks().

◆ fpMCEventList

CbmMCEventList* cbm::ca::MCModule::fpMCEventList = nullptr
private

MC event list.

Definition at line 234 of file CbmCaMCModule.h.

Referenced by CheckInit(), FillMCPoint(), InitEvent(), InitRun(), and ReadMCTracks().

◆ fpMCTracks

CbmMCDataArray* cbm::ca::MCModule::fpMCTracks = nullptr
private

MC tracks input.

Definition at line 236 of file CbmCaMCModule.h.

Referenced by CheckInit(), FillMCPoint(), InitRun(), and ReadMCTracks().

◆ fpParameters

std::shared_ptr<ca::Parameters<float> > cbm::ca::MCModule::fpParameters = nullptr
private

Pointer to tracking parameters object.

Definition at line 231 of file CbmCaMCModule.h.

Referenced by CheckInit(), FillMCPoint(), ReadMCPoints(), and RegisterParameters().

◆ fpTimeSlice

const CbmTimeSlice* cbm::ca::MCModule::fpTimeSlice = nullptr
private

Current time slice.

Definition at line 233 of file CbmCaMCModule.h.

Referenced by CheckInit(), FillMCPoint(), and InitRun().

◆ fpvFstHitId

const std::array<int, constants::size::MaxNdetectors + 1>* cbm::ca::MCModule::fpvFstHitId = nullptr
private

Pointer to array of first hit indexes in the detector subsystem.

This array must be initialized in the run initialization function.

Definition at line 260 of file CbmCaMCModule.h.

Referenced by CheckInit(), MatchPointsAndHits(), and RegisterFirstHitIndexes().

◆ fpvHitIds

ca::Vector<CbmL1HitId>* cbm::ca::MCModule::fpvHitIds = nullptr
private

Pointer to hit index container.

Definition at line 254 of file CbmCaMCModule.h.

Referenced by CheckInit(), and RegisterHitIndexContainer().

◆ fpvQaHits

ca::Vector<CbmL1HitDebugInfo>* cbm::ca::MCModule::fpvQaHits = nullptr
private

Pointer to QA hit container.

Definition at line 255 of file CbmCaMCModule.h.

Referenced by CheckInit(), InitTrackInfo(), and RegisterQaHitContainer().

◆ fpvRecoTracks

ca::Vector<CbmL1Track>* cbm::ca::MCModule::fpvRecoTracks = nullptr
private

Pointer to reconstructed track container.

Definition at line 253 of file CbmCaMCModule.h.

Referenced by CheckInit(), MatchRecoAndMCTracks(), and RegisterRecoTrackContainer().

◆ fvbUseDet

DetIdArr_t<bool> cbm::ca::MCModule::fvbUseDet = {{false}}
private

Flag: is detector subsystem used.

Definition at line 227 of file CbmCaMCModule.h.

Referenced by CheckInit(), InitRun(), MatchPointsAndHits(), ReadMCPoints(), ReadMCPointsForDetector(), and SetDetector().

◆ fVerbose

int cbm::ca::MCModule::fVerbose = 1
private

Verbosity level.

Definition at line 228 of file CbmCaMCModule.h.

Referenced by GetVerbosity(), and InitRun().

◆ fvpBrHitMatches

DetIdArr_t<TClonesArray*> cbm::ca::MCModule::fvpBrHitMatches = {{nullptr}}
private

Array of hit match branches vs. detector.

Definition at line 241 of file CbmCaMCModule.h.

Referenced by CheckInit(), InitRun(), and MatchHitWithMc().

◆ fvpBrPoints

DetIdArr_t<CbmMCDataArray*> cbm::ca::MCModule::fvpBrPoints = {{nullptr}}
private

Array of points vs. detector.

Definition at line 240 of file CbmCaMCModule.h.

Referenced by CheckInit(), FillMCPoint(), InitRun(), ReadMCPoints(), and ReadMCPointsForDetector().

◆ fvpDetInterface

DetIdArr_t<CbmTrackingDetectorInterfaceBase*> cbm::ca::MCModule::fvpDetInterface = {{nullptr}}
private

Tracking detector interface.

Definition at line 238 of file CbmCaMCModule.h.

Referenced by FillMCPoint(), and InitRun().


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