CbmRoot
Loading...
Searching...
No Matches
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.
 
virtual ~CbmMCEventList ()
 Destructor.
 
virtual void Clear (Option_t *)
 Delete all event entries.
 
int32_t GetEventIdByIndex (uint32_t index)
 Event number by index @value Event number for event at given index in list.
 
double GetEventTime (uint32_t event, uint32_t file)
 Event start time.
 
Double_t GetEventTime (const CbmLink &link)
 Event start time.
 
double GetEventTimeByIndex (uint32_t index)
 Event time by index @value Event time for event at given index in list.
 
int32_t GetFileIdByIndex (uint32_t index)
 File number by index @value File number for event at given index in list.
 
Int_t GetEventIndex (UInt_t event, UInt_t file)
 Event index.
 
Int_t GetEventIndex (const CbmLink &link)
 Event index.
 
CbmLink GetEventLinkByIndex (uint32_t index)
 Event file and event indices as CbmLink.
 
std::size_t GetNofEvents () const
 Number of events in the list @value Number of events.
 
bool Insert (uint32_t event, uint32_t file, double time)
 
virtual void Print (Option_t *opt="") const
 
void Sort ()
 Sort the list.
 
std::string ToString (const char *option="") const
 

Private Member Functions

bool Check ()
 Check for double occurrences of events in list @value true is no double occurrences, else false.
 
std::vector< CbmMCEventInfo >::iterator Find (uint32_t file, uint32_t event)
 Find an element in the list.
 
 ClassDef (CbmMCEventList, 3)
 

Private Attributes

std::vector< CbmMCEventInfofEvents
 
bool 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 43 of file CbmMCEventList.h.

Constructor & Destructor Documentation

◆ CbmMCEventList()

CbmMCEventList::CbmMCEventList ( )

Standard constructor.

Definition at line 28 of file CbmMCEventList.cxx.

◆ ~CbmMCEventList()

CbmMCEventList::~CbmMCEventList ( )
virtual

Destructor.

Definition at line 33 of file CbmMCEventList.cxx.

Member Function Documentation

◆ Check()

bool CbmMCEventList::Check ( )
private

Check for double occurrences of events in list @value true is no double occurrences, else false.

Definition at line 38 of file CbmMCEventList.cxx.

References fEvents.

Referenced by Sort().

◆ ClassDef()

CbmMCEventList::ClassDef ( CbmMCEventList ,
3  )
private

◆ Clear()

virtual void CbmMCEventList::Clear ( Option_t * )
inlinevirtual

Delete all event entries.

Definition at line 55 of file CbmMCEventList.h.

References fEvents.

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

◆ Find()

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

Find an element in the list.

Parameters
fileInput file ID
eventMC event number (index)

Definition at line 67 of file CbmMCEventList.cxx.

References fEvents, fIsSorted, and Sort().

Referenced by GetEventIndex(), and GetEventTime().

◆ GetEventIdByIndex()

int32_t CbmMCEventList::GetEventIdByIndex ( uint32_t index)

◆ GetEventIndex() [1/2]

Int_t CbmMCEventList::GetEventIndex ( const CbmLink & link)
inline

Event index.

Definition at line 106 of file CbmMCEventList.h.

References CbmLink::GetEntry(), GetEventIndex(), and CbmLink::GetFile().

Referenced by GetEventIndex().

◆ GetEventIndex() [2/2]

Int_t CbmMCEventList::GetEventIndex ( UInt_t event,
UInt_t file )

Event index.

Parameters
eventMC event number
fileMC input file number @value eventindex in list

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

Definition at line 100 of file CbmMCEventList.cxx.

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

Referenced by CbmKFParticleFinder::Exec(), CbmKFParticleFinderQa::Exec(), CbmSeedFinderQa::FillQaMCInfo(), and CbmTrdCalibTracker::ResolutionQa().

◆ GetEventLinkByIndex()

CbmLink CbmMCEventList::GetEventLinkByIndex ( uint32_t index)

Event file and event indices as CbmLink.

Definition at line 132 of file CbmMCEventList.cxx.

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

Referenced by CbmKFParticleFinder::Exec(), and CbmKFParticleFinderQa::Exec().

◆ GetEventTime() [1/2]

Double_t CbmMCEventList::GetEventTime ( const CbmLink & link)
inline

Event start time.

  • Parameters
    linklink to the MC event

Definition at line 78 of file CbmMCEventList.h.

References CbmLink::GetEntry(), GetEventTime(), and CbmLink::GetFile().

Referenced by GetEventTime().

◆ GetEventTime() [2/2]

◆ GetEventTimeByIndex()

double CbmMCEventList::GetEventTimeByIndex ( uint32_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 111 of file CbmMCEventList.cxx.

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

Referenced by CbmTofAnaTestbeam::FillHistos(), CbmSeedFinderQa::FillQaMCInfo(), and CbmSeedFinderSlidingWindow::FillSeedTimes().

◆ GetFileIdByIndex()

int32_t CbmMCEventList::GetFileIdByIndex ( uint32_t index)

◆ GetNofEvents()

◆ Insert()

bool CbmMCEventList::Insert ( uint32_t event,
uint32_t file,
double 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 false if (file, event) is already in the list. Else true.

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

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

Definition at line 142 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 153 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 158 of file CbmMCEventList.cxx.

References Check(), fEvents, and fIsSorted.

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

◆ ToString()

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

Status to string

Definition at line 169 of file CbmMCEventList.cxx.

References fEvents, GetNofEvents(), and ToString().

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

Member Data Documentation

◆ fEvents

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

◆ fIsSorted

bool CbmMCEventList::fIsSorted
private

Flag whether list has been sorted

Definition at line 157 of file CbmMCEventList.h.

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


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