CbmRoot
CbmMCEventList Class Reference

Container class for MC events with number, file and start time. More...

#include <CbmMCEventList.h>

Inheritance diagram for CbmMCEventList:
[legend]
Collaboration diagram for CbmMCEventList:
[legend]

Public Member Functions

 CbmMCEventList ()
 Standard constructor. More...
 
virtual ~CbmMCEventList ()
 Destructor. More...
 
virtual void Clear (Option_t *)
 Delete all event entries. More...
 
Int_t GetEventIdByIndex (UInt_t index)
 Event number by index @value Event number for event at given index in list. More...
 
Double_t GetEventTime (UInt_t event, UInt_t file)
 Event start time. More...
 
Double_t GetEventTimeByIndex (UInt_t index)
 Event time by index @value Event time for event at given index in list. More...
 
Int_t GetFileIdByIndex (UInt_t index)
 File number by index @value File number for event at given index in list. More...
 
std::size_t GetNofEvents () const
 Number of events in the list @value Number of events. More...
 
Bool_t Insert (UInt_t event, UInt_t file, Double_t time)
 
virtual void Print (Option_t *opt="") const
 
void Sort ()
 Sort the list. More...
 
std::string ToString (const char *option="") const
 

Private Member Functions

Bool_t Check ()
 Check for double occurrences of events in list @value kTRUE is no double occurrences, else kFALSE. More...
 
std::vector< CbmMCEventInfo >::iterator Find (UInt_t file, UInt_t event)
 Find an element in the list. More...
 
 ClassDef (CbmMCEventList, 3)
 

Private Attributes

std::vector< CbmMCEventInfofEvents
 
Bool_t fIsSorted
 

Detailed Description

Container class for MC events with number, file and start time.

Author
Volker Friese v.fri.nosp@m.ese@.nosp@m.gsi.d.nosp@m.e
Date
24.11.2015
Version
18.06.2018

Definition at line 38 of file CbmMCEventList.h.

Constructor & Destructor Documentation

◆ CbmMCEventList()

CbmMCEventList::CbmMCEventList ( )

Standard constructor.

Definition at line 24 of file CbmMCEventList.cxx.

◆ ~CbmMCEventList()

CbmMCEventList::~CbmMCEventList ( )
virtual

Destructor.

Definition at line 30 of file CbmMCEventList.cxx.

Member Function Documentation

◆ Check()

Bool_t CbmMCEventList::Check ( )
private

Check for double occurrences of events in list @value kTRUE is no double occurrences, else kFALSE.

Definition at line 35 of file CbmMCEventList.cxx.

References fEvents.

Referenced by Sort().

◆ ClassDef()

CbmMCEventList::ClassDef ( CbmMCEventList  ,
 
)
private

◆ Clear()

virtual void CbmMCEventList::Clear ( Option_t *  )
inlinevirtual

Delete all event entries.

Definition at line 50 of file CbmMCEventList.h.

References fEvents.

Referenced by CbmTofBuildDigiEvents::Exec(), CbmTofBuildDigiEvents::ProcessIdealEvents(), and CbmDaq::StartNextTimeSlice().

◆ Find()

vector< CbmMCEventInfo >::iterator CbmMCEventList::Find ( UInt_t  file,
UInt_t  event 
)
private

Find an element in the list.

Parameters
fileInput file ID
eventMC event number (index)

Definition at line 64 of file CbmMCEventList.cxx.

References fEvents, fIsSorted, and Sort().

Referenced by GetEventTime().

◆ GetEventIdByIndex()

Int_t CbmMCEventList::GetEventIdByIndex ( UInt_t  index)

Event number by index @value Event number for event at given index in list.

Returns -1 if the index is out of bounds.

Definition at line 77 of file CbmMCEventList.cxx.

References fEvents, fIsSorted, GetNofEvents(), and Sort().

Referenced by CbmRichRingFinderIdeal::DoFind(), CbmTofAnaTestbeam::FillHistos(), CbmRichUrqmdTest::NofHitsAndPoints(), CbmRichUrqmdTest::PmtXYSource(), CbmRichGeoTest::ProcessMc(), CbmL1::Reconstruct(), and CbmRichUrqmdTest::Vertex().

◆ GetEventTime()

Double_t CbmMCEventList::GetEventTime ( UInt_t  event,
UInt_t  file 
)

Event start time.

Parameters
eventMC event number
fileMC input file number @value MC event start time [ns]

Returns -1. if the event is not present in the list.

Definition at line 86 of file CbmMCEventList.cxx.

References fEvents, Find(), fIsSorted, and Sort().

Referenced by CbmDaq::CopyEventList(), CbmTofHitFinderTBQA::Exec(), CbmEventBuilderQA::Exec(), CbmTofAnaTestbeam::FillHistos(), CbmTofBuildDigiEvents::FillMCEventList(), CbmLitClusteringQa::FillResidualAndPullHistograms(), CbmL1::InputPerformance(), CbmRichRecoTbQa::ProcessMc(), CbmL1::ReadMCPoint(), and CbmRecoQa::record().

◆ GetEventTimeByIndex()

Double_t CbmMCEventList::GetEventTimeByIndex ( UInt_t  index)

Event time by index @value Event time for event at given index in list.

Returns -1. if the index is out of bounds.

Definition at line 96 of file CbmMCEventList.cxx.

References fEvents, fIsSorted, GetNofEvents(), and Sort().

Referenced by CbmTofAnaTestbeam::FillHistos().

◆ GetFileIdByIndex()

Int_t CbmMCEventList::GetFileIdByIndex ( UInt_t  index)

File number by index @value File number for event at given index in list.

Returns -1 if the index is out of bounds.

Definition at line 106 of file CbmMCEventList.cxx.

References fEvents, fIsSorted, GetNofEvents(), and Sort().

Referenced by CbmRichRingFinderIdeal::DoFind(), CbmTofAnaTestbeam::FillHistos(), CbmRichUrqmdTest::NofHitsAndPoints(), CbmRichUrqmdTest::PmtXYSource(), CbmRichGeoTest::ProcessMc(), CbmL1::Reconstruct(), and CbmRichUrqmdTest::Vertex().

◆ GetNofEvents()

◆ Insert()

Bool_t CbmMCEventList::Insert ( UInt_t  event,
UInt_t  file,
Double_t  time 
)

Insert an event with its start time into the event list

Parameters
eventMC event number
fileMC input file number
timeMC event start time [ns] @value kFALSE if (file, event) is already in the list. Else kTRUE.

If the event from the given file is already in the list, the list will not be modified and kFALSE is returned.

Negative event times are not allowed. In that case, kFALSE is returned and the list will not be modified.

Definition at line 116 of file CbmMCEventList.cxx.

References fEvents, and fIsSorted.

Referenced by CbmDaq::CopyEventList(), CbmDaq::Exec(), and CbmTofBuildDigiEvents::FillMCEventList().

◆ Print()

void CbmMCEventList::Print ( Option_t *  opt = "") const
virtual

Print to screen

Definition at line 126 of file CbmMCEventList.cxx.

References ToString().

◆ Sort()

void CbmMCEventList::Sort ( )

Sort the list.

The sorting uses the comparison operator of std::tuple, i.e. the list is first sorted w.r.t. fileId, then w.r.t. the event Id. Double occurrences of a pair (fileId, eventId) will throw an exception.

Definition at line 133 of file CbmMCEventList.cxx.

References Check(), fEvents, and fIsSorted.

Referenced by CbmDaq::CloseTimeSlice(), CbmTofBuildDigiEvents::FillMCEventList(), Find(), GetEventIdByIndex(), GetEventTime(), GetEventTimeByIndex(), and GetFileIdByIndex().

◆ ToString()

string CbmMCEventList::ToString ( const char *  option = "") const

Status to string

Definition at line 143 of file CbmMCEventList.cxx.

References fEvents, and GetNofEvents().

Referenced by CbmDaq::Finish(), and Print().

Member Data Documentation

◆ fEvents

std::vector<CbmMCEventInfo> CbmMCEventList::fEvents
private

◆ fIsSorted

Bool_t CbmMCEventList::fIsSorted
private

Flag whether list has been sorted

Definition at line 131 of file CbmMCEventList.h.

Referenced by Find(), GetEventIdByIndex(), GetEventTime(), GetEventTimeByIndex(), GetFileIdByIndex(), Insert(), and Sort().


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