22using std::lower_bound;
24using std::stringstream;
41 int32_t lastFile = -1;
42 int32_t lastEvent = -1;
44 int32_t thisFile = -1;
45 int32_t thisEvent = -1;
48 for (
auto& eventInfo :
fEvents) {
49 thisFile = eventInfo.GetFileId();
50 thisEvent = eventInfo.GetEventId();
51 thisTime = eventInfo.GetTime();
52 if (thisFile == lastFile && thisEvent == lastEvent) {
53 LOG(error) << fName <<
": double entry for event " << thisEvent <<
", file " << thisFile <<
", first time "
54 << lastTime <<
", second time " << thisTime;
58 lastEvent = thisEvent;
71 if (it->GetFileId() != int32_t(file))
return fEvents.end();
72 if (it->GetEventId() != int32_t(event))
return fEvents.end();
83 return fEvents[index].GetEventId();
92 auto it =
Find(fileId, eventId);
93 if (it ==
fEvents.end())
return -1.;
103 auto it =
Find(fileId, eventId);
104 if (it ==
fEvents.end())
return -1.;
116 return fEvents[index].GetTime();
127 return fEvents[index].GetFileId();
136 return fEvents[index].GetCbmLink();
144 if (time < 0.)
return false;
172 ss << fName <<
": " <<
GetNofEvents() <<
" MC events in list\n";
173 if (!strcmp(option,
"long"))
174 for (std::size_t index = 0; index <
GetNofEvents(); index++)
ClassImp(CbmConverterManager)
Allows to access an MC event in the source file.
Container class for MC events with number, file and start time.
std::vector< CbmMCEventInfo > fEvents
CbmLink GetEventLinkByIndex(uint32_t index)
Event file and event indices as CbmLink.
int32_t GetFileIdByIndex(uint32_t index)
File number by index @value File number for event at given index in list.
std::string ToString(const char *option="") const
bool Check()
Check for double occurrences of events in list @value true is no double occurrences,...
virtual ~CbmMCEventList()
Destructor.
virtual void Print(Option_t *opt="") const
double GetEventTimeByIndex(uint32_t index)
Event time by index @value Event time for event at given index in list.
void Sort()
Sort the list.
int32_t GetEventIdByIndex(uint32_t index)
Event number by index @value Event number for event at given index in list.
Int_t GetEventIndex(UInt_t event, UInt_t file)
Event index.
std::size_t GetNofEvents() const
Number of events in the list @value Number of events.
double GetEventTime(uint32_t event, uint32_t file)
Event start time.
CbmMCEventList()
Standard constructor.
std::vector< CbmMCEventInfo >::iterator Find(uint32_t file, uint32_t event)
Find an element in the list.
bool Insert(uint32_t event, uint32_t file, double time)