CbmRoot
|
Class CbmCaPerformance is an interface to communicate between. More...
#include <CbmCaMCModule.h>
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. | |
MCModule & | operator= (const MCModule &)=delete |
Copy assignment operator. | |
MCModule & | operator= (MCModule &&)=delete |
Move assignment operator. | |
void | Finish () |
Defines performance action in the end of the run. | |
const tools::MCData * | GetMCData () 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::MCPoint > | FillMCPoint (int iExtId, int iEvent, int iFile) |
Fills a single detector-specific MC point. | |
Private Attributes | |
ca::Monitor< EMonitorKey > | fMonitor {"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 CbmTimeSlice * | fpTimeSlice = nullptr |
Current time slice. | |
CbmMCEventList * | fpMCEventList = nullptr |
MC event list. | |
CbmMCDataObject * | fpMCEventHeader = nullptr |
MC event header. | |
CbmMCDataArray * | fpMCTracks = 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::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< 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. | |
Class CbmCaPerformance is an interface to communicate between.
Definition at line 57 of file CbmCaMCModule.h.
|
strongprivate |
Monitor keys.
Definition at line 211 of file CbmCaMCModule.h.
|
inline |
Constructor.
verbosity | Verbosity level |
perfMode | Performance mode (defines cut on number of consecutive stations with hit or point) |
Definition at line 64 of file CbmCaMCModule.h.
References fPerformanceMode.
|
default |
Destructor.
|
delete |
Copy constructor.
|
delete |
Move constructor.
void MCModule::CheckInit | ( | ) | const |
Check class initialization.
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().
|
private |
Fills a single detector-specific MC point.
DetID | Detector subsystem ID |
[in] | iExtId | Index of point in the external points container |
[in] | iEvent | EventID of point in the external points container |
[in] | iFile | FileID of point int the external points container |
[out] | intMCPoint | Reference to the internal tracking MC point object (ca::tools::MCData) |
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().
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().
|
inline |
Gets a pointer to MC data object.
Definition at line 89 of file CbmCaMCModule.h.
References fpMCData.
|
inline |
void MCModule::InitEvent | ( | CbmEvent * | pEvent | ) |
Defines performance action in the beginning of each event or time slice.
pEvent | Pointer to a current CbmEvent |
Definition at line 147 of file CbmCaMCModule.cxx.
References cbm::ca::tools::MCData::Clear(), fBestMcEvent, fBestMcFile, fFileEventIDs, fMonitor, fpMCData, fpMCEventList, CbmMCEventList::GetEventIdByIndex(), CbmLink::GetFile(), CbmMCEventList::GetFileIdByIndex(), CbmMatch::GetLink(), CbmEvent::GetMatch(), CbmMatch::GetMatchedLink(), CbmMCEventList::GetNofEvents(), CbmMatch::GetNofLinks(), cbm::ca::tools::MCData::GetNofPoints(), cbm::ca::tools::MCData::GetNofTracks(), cbm::ca::tools::MCData::GetPoint(), cbm::ca::tools::MCData::GetTrackContainer(), cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::IncrementCounter(), kMcPoint, kMcTrack, kRecoNevents, ReadMCPoints(), and ReadMCTracks().
bool MCModule::InitRun | ( | ) |
Defines action on the module in the beginning of the run.
Definition at line 53 of file CbmCaMCModule.cxx.
References CheckInit(), fFileEventIDs, fMonitor, fpMCEventHeader, fpMCEventList, fpMCTracks, fpTimeSlice, fvbUseDet, fVerbose, fvpBrHitMatches, fvpBrPoints, fvpDetInterface, CbmMuchTrackingInterface::Instance(), CbmMvdTrackingInterface::Instance(), CbmStsTrackingInterface::Instance(), CbmTofTrackingInterface::Instance(), CbmTrdTrackingInterface::Instance(), kMcPoint, kMcTrack, kMcTrackReconstructable, kMissedMatchesMuch, kMissedMatchesMvd, kMissedMatchesSts, kMissedMatchesTof, kMissedMatchesTrd, kRecoNevents, cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::SetCounterName(), and cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::SetRatioKeys().
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().
void MCModule::MatchHits | ( | ) |
Match reconstructed hits and MC points.
Definition at line 258 of file CbmCaMCModule.cxx.
References MatchPointsAndHits().
std::tuple< int, std::vector< int > > cbm::ca::MCModule::MatchHitWithMc | ( | int | iHitExt | ) |
Matches hit with MC point.
DetId | Detector ID |
iHitExt | External index of hit |
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().
void cbm::ca::MCModule::MatchPointsAndHits | ( | ) |
Match sets of MC points and reconstructed hits for a given detector.
DetID | Index 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().
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().
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().
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.
|
private |
Reads MC points from external trees and saves them to MCDataObject.
Definition at line 515 of file CbmCaMCModule.cxx.
References fFileEventIDs, fpMCData, fpParameters, fvbUseDet, fvpBrPoints, cbm::ca::tools::MCData::GetNofTracks(), MCModule::ReadMCPointsForDetector< ca::EDetectorID::kTof >(), ReadMCPointsForDetector(), cbm::ca::tools::MCData::ReserveNofPoints(), and cbm::ca::tools::MCData::SetNofPointsOrig().
Referenced by InitEvent().
|
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().
|
private |
Reads MC tracks from external trees and saves them to MCDataObject.
iFile, iEvent
Definition at line 540 of file CbmCaMCModule.cxx.
References cbm::ca::tools::MCData::AddTrack(), fFileEventIDs, cbm::ca::tools::MCData::FindInternalTrackIndex(), fpMCData, fpMCEventHeader, fpMCEventList, fpMCTracks, CbmMCDataArray::Get(), CbmMCDataObject::Get(), CbmMCTrack::GetCharge(), CbmMCEventList::GetEventTime(), CbmMCTrack::GetGeantProcessId(), CbmMCTrack::GetMass(), CbmMCTrack::GetMotherId(), cbm::ca::tools::MCData::GetNofTracks(), CbmMCTrack::GetPdgCode(), CbmMCTrack::GetPx(), CbmMCTrack::GetPy(), CbmMCTrack::GetPz(), CbmMCTrack::GetStartT(), CbmMCTrack::GetStartX(), CbmMCTrack::GetStartY(), CbmMCTrack::GetStartZ(), cbm::ca::tools::MCData::ReserveNofTracks(), cbm::ca::tools::MCTrack::SetId(), and CbmMCDataArray::Size().
Referenced by InitEvent().
|
inline |
Sets first hit indexes container in different detectors.
source | Array of indexes |
Definition at line 125 of file CbmCaMCModule.h.
References fpvFstHitId.
|
inline |
Registers hit index container.
vHitIds | Reference to hit index container |
Definition at line 146 of file CbmCaMCModule.h.
References fpvHitIds.
|
inline |
Registers MC data object.
mcData | Instance of MC data |
Definition at line 138 of file CbmCaMCModule.h.
References fpMCData.
|
inline |
Registers CA parameters object.
pParameters | A shared pointer to the parameters object |
Definition at line 150 of file CbmCaMCModule.h.
References fpParameters.
|
inline |
Registers debug hit container.
vQaHits | Reference to debug hit container |
Definition at line 154 of file CbmCaMCModule.h.
References fpvQaHits.
|
inline |
Registers reconstructed track container.
vRecoTrack | Reference to reconstructed track container |
Definition at line 142 of file CbmCaMCModule.h.
References fpvRecoTracks.
|
inline |
Sets used detector subsystems.
detID | Id of detector |
flag | Flag: true - detector is used |
Definition at line 134 of file CbmCaMCModule.h.
References fvbUseDet.
|
private |
Index of bestly matched MC event.
Definition at line 246 of file CbmCaMCModule.h.
Referenced by InitEvent(), and InitTrackInfo().
|
private |
Index of bestly matched MC file.
Definition at line 245 of file CbmCaMCModule.h.
Referenced by InitEvent(), and InitTrackInfo().
|
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().
|
private |
Monitor.
Definition at line 224 of file CbmCaMCModule.h.
Referenced by Finish(), InitEvent(), InitRun(), MatchHitWithMc(), and MatchTracks().
|
private |
Mode of performance.
Definition at line 229 of file CbmCaMCModule.h.
Referenced by InitTrackInfo(), and MCModule().
|
private |
MC information (hits and tracks) instance.
Definition at line 250 of file CbmCaMCModule.h.
Referenced by CheckInit(), FillMCPoint(), GetMCData(), InitEvent(), InitTrackInfo(), MatchHitWithMc(), MatchPointsAndHits(), MatchRecoAndMCTracks(), MatchTracks(), ReadMCPoints(), ReadMCPointsForDetector(), ReadMCTracks(), and RegisterMCData().
|
private |
MC event header.
Definition at line 235 of file CbmCaMCModule.h.
Referenced by CheckInit(), InitRun(), and ReadMCTracks().
|
private |
MC event list.
Definition at line 234 of file CbmCaMCModule.h.
Referenced by CheckInit(), FillMCPoint(), InitEvent(), InitRun(), and ReadMCTracks().
|
private |
MC tracks input.
Definition at line 236 of file CbmCaMCModule.h.
Referenced by CheckInit(), FillMCPoint(), InitRun(), and ReadMCTracks().
|
private |
Pointer to tracking parameters object.
Definition at line 231 of file CbmCaMCModule.h.
Referenced by CheckInit(), FillMCPoint(), ReadMCPoints(), and RegisterParameters().
|
private |
Current time slice.
Definition at line 233 of file CbmCaMCModule.h.
Referenced by CheckInit(), FillMCPoint(), and InitRun().
|
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().
|
private |
Pointer to hit index container.
Definition at line 254 of file CbmCaMCModule.h.
Referenced by CheckInit(), and RegisterHitIndexContainer().
|
private |
Pointer to QA hit container.
Definition at line 255 of file CbmCaMCModule.h.
Referenced by CheckInit(), InitTrackInfo(), and RegisterQaHitContainer().
|
private |
Pointer to reconstructed track container.
Definition at line 253 of file CbmCaMCModule.h.
Referenced by CheckInit(), MatchRecoAndMCTracks(), and RegisterRecoTrackContainer().
|
private |
Flag: is detector subsystem used.
Definition at line 227 of file CbmCaMCModule.h.
Referenced by CheckInit(), InitRun(), MatchPointsAndHits(), ReadMCPoints(), ReadMCPointsForDetector(), and SetDetector().
|
private |
Verbosity level.
Definition at line 228 of file CbmCaMCModule.h.
Referenced by GetVerbosity(), and InitRun().
|
private |
Array of hit match branches vs. detector.
Definition at line 241 of file CbmCaMCModule.h.
Referenced by CheckInit(), InitRun(), and MatchHitWithMc().
|
private |
Array of points vs. detector.
Definition at line 240 of file CbmCaMCModule.h.
Referenced by CheckInit(), FillMCPoint(), InitRun(), ReadMCPoints(), and ReadMCPointsForDetector().
|
private |
Tracking detector interface.
Definition at line 238 of file CbmCaMCModule.h.
Referenced by FillMCPoint(), and InitRun().