CbmRoot
Loading...
Searching...
No Matches
MCModule Class Reference

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

#include <CbmCaMCModule.h>

Collaboration diagram for MCModule:
[legend]

Public Member Functions

 MCModule (int verb=1, int perfMode=1)
 Constructor.
 
 MCModule (const MCModule &)=delete
 Copy constructor.
 
 MCModule (MCModule &&)=delete
 Move constructor.
 
 ~MCModule ()=default
 Destructor.
 
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 cbm::algo::ca::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 (cbm::algo::ca::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< const ca::Parameters< double > > &pParameters)
 Registers CA parameters object.
 
void RegisterQaHitContainer (ca::Vector< cbm::algo::ca::McHitInfo > &vQaHits)
 Registers debug hit container.
 
int GetVerbosity () const
 Gets verbosity level.
 
void CheckInit () const
 Check class initialization.
 
void InitMcTrackInfo ()
 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.
 
template<ca::EDetectorID DetID>
std::optional< ca::McPointFillMCPoint (int iExtId, int iEvent, int iFile)
 

Private Types

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

Private Member Functions

template<ca::EDetectorID DetID>
std::optional< algo::ca::McPoint > FillMCPoint (int iExtId, int iEvent, int iFile)
 Fills a single detector-specific MC point.
 
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.
 

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< const ca::Parameters< double > > 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< 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.
 
algo::ca::McData * fpMcData = 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< algo::ca::McHitInfo > * fpvQaHits = nullptr
 Pointer to QA hit container.
 
std::unordered_map< uint32_t, double > fmTofRpcZpos
 A map of TOF RPC reference z-position vs. address.
 
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 54 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 189 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 61 of file CbmCaMCModule.h.

◆ MCModule() [2/3]

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

Copy constructor.

◆ MCModule() [3/3]

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

Move constructor.

◆ ~MCModule()

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

Destructor.

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 384 of file CbmCaMCModule.cxx.

◆ FillMCPoint() [1/2]

template<ca::EDetectorID DetID>
std::optional< algo::ca::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

◆ FillMCPoint() [2/2]

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

TODO: Set from track

Definition at line 324 of file CbmCaMCModule.h.

◆ Finish()

void MCModule::Finish ( )

Defines performance action in the end of the run.

Definition at line 284 of file CbmCaMCModule.cxx.

◆ GetMcData()

const cbm::algo::ca::McData * cbm::ca::MCModule::GetMcData ( ) const
inline

Gets a pointer to MC data object.

Definition at line 86 of file CbmCaMCModule.h.

◆ GetVerbosity()

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

Gets verbosity level.

Definition at line 154 of file CbmCaMCModule.h.

◆ InitEvent()

void MCModule::InitEvent ( CbmEvent * pEvent)

Defines performance action in the beginning of each event or time slice.

Note
This function should be called before hits initialization
Parameters
pEventPointer to a current CbmEvent

Definition at line 185 of file CbmCaMCModule.cxx.

◆ InitMcTrackInfo()

void MCModule::InitMcTrackInfo ( )

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 237 of file CbmCaMCModule.cxx.

◆ InitRun()

bool MCModule::InitRun ( )

Defines action on the module in the beginning of the run.

Returns
Success flag

Definition at line 59 of file CbmCaMCModule.cxx.

◆ MatchHits()

void MCModule::MatchHits ( )

Match reconstructed hits and MC points.

Definition at line 294 of file CbmCaMCModule.cxx.

◆ 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 273 of file CbmCaMCModule.h.

◆ 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 474 of file CbmCaMCModule.h.

◆ 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 321 of file CbmCaMCModule.cxx.

◆ 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 307 of file CbmCaMCModule.cxx.

◆ 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 233 of file CbmCaMCModule.cxx.

◆ ReadMCPoints()

void MCModule::ReadMCPoints ( )
private

Reads MC points from external trees and saves them to MCDataObject.

Definition at line 555 of file CbmCaMCModule.cxx.

◆ ReadMCPointsForDetector()

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

Reads MC points in particular detector.

Definition at line 497 of file CbmCaMCModule.h.

Referenced by MCModule::ReadMCPointsForDetector< ca::EDetectorID::kTof >().

◆ ReadMCTracks()

void MCModule::ReadMCTracks ( )
private

Reads MC tracks from external trees and saves them to MCDataObject.

iFile, iEvent

Definition at line 580 of file CbmCaMCModule.cxx.

◆ 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 122 of file CbmCaMCModule.h.

◆ RegisterHitIndexContainer()

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

Registers hit index container.

Parameters
vHitIdsReference to hit index container

Definition at line 143 of file CbmCaMCModule.h.

◆ RegisterMcData()

void cbm::ca::MCModule::RegisterMcData ( cbm::algo::ca::McData & mcData)
inline

Registers MC data object.

Parameters
mcDataInstance of MC data

Definition at line 135 of file CbmCaMCModule.h.

◆ RegisterParameters()

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

Registers CA parameters object.

Parameters
pParametersA shared pointer to the parameters object

Definition at line 147 of file CbmCaMCModule.h.

◆ RegisterQaHitContainer()

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

Registers debug hit container.

Parameters
vQaHitsReference to debug hit container

Definition at line 151 of file CbmCaMCModule.h.

◆ RegisterRecoTrackContainer()

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

Registers reconstructed track container.

Parameters
vRecoTrackReference to reconstructed track container

Definition at line 139 of file CbmCaMCModule.h.

◆ 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 131 of file CbmCaMCModule.h.

Member Data Documentation

◆ fBestMcEvent

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

Index of bestly matched MC event.

Definition at line 222 of file CbmCaMCModule.h.

◆ fBestMcFile

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

Index of bestly matched MC file.

Definition at line 221 of file CbmCaMCModule.h.

◆ 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 220 of file CbmCaMCModule.h.

◆ fMonitor

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

Monitor.

Definition at line 202 of file CbmCaMCModule.h.

◆ fmTofRpcZpos

std::unordered_map<uint32_t, double> cbm::ca::MCModule::fmTofRpcZpos
private

A map of TOF RPC reference z-position vs. address.

Todo
This a use-case for geometrical module info needed in reco. This should be brought to RecoSetup in a clean way, but for now we will put it here

Definition at line 236 of file CbmCaMCModule.h.

◆ fPerformanceMode

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

Mode of performance.

Definition at line 207 of file CbmCaMCModule.h.

◆ fpMcData

algo::ca::McData* cbm::ca::MCModule::fpMcData = nullptr
private

MC information (hits and tracks) instance.

Definition at line 226 of file CbmCaMCModule.h.

◆ fpMCEventHeader

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

MC event header.

Definition at line 213 of file CbmCaMCModule.h.

◆ fpMCEventList

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

MC event list.

Definition at line 212 of file CbmCaMCModule.h.

◆ fpMCTracks

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

MC tracks input.

Definition at line 214 of file CbmCaMCModule.h.

◆ fpParameters

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

Pointer to tracking parameters object.

Definition at line 209 of file CbmCaMCModule.h.

◆ fpTimeSlice

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

Current time slice.

Definition at line 211 of file CbmCaMCModule.h.

◆ 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 241 of file CbmCaMCModule.h.

◆ fpvHitIds

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

Pointer to hit index container.

Definition at line 230 of file CbmCaMCModule.h.

◆ fpvQaHits

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

Pointer to QA hit container.

Definition at line 231 of file CbmCaMCModule.h.

◆ fpvRecoTracks

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

Pointer to reconstructed track container.

Definition at line 229 of file CbmCaMCModule.h.

◆ fvbUseDet

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

Flag: is detector subsystem used.

Definition at line 205 of file CbmCaMCModule.h.

◆ fVerbose

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

Verbosity level.

Definition at line 206 of file CbmCaMCModule.h.

◆ fvpBrHitMatches

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

Array of hit match branches vs. detector.

Definition at line 217 of file CbmCaMCModule.h.

◆ fvpBrPoints

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

Array of points vs. detector.

Definition at line 216 of file CbmCaMCModule.h.


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