Go to the documentation of this file.
7 #include <FairLogger.h>
18 using std::lower_bound;
20 using std::stringstream;
25 : TNamed(
"MCEventList",
"List of MC events"), fEvents(), fIsSorted(kFALSE) {}
39 Double_t lastTime = 0.;
42 Double_t thisTime = 0.;
44 for (
auto& eventInfo :
fEvents) {
45 thisFile = eventInfo.GetFileId();
46 thisEvent = eventInfo.GetEventId();
47 thisTime = eventInfo.GetTime();
48 if (thisFile == lastFile && thisEvent == lastEvent) {
49 LOG(error) << fName <<
": double entry for event " << thisEvent
50 <<
", file " << thisFile <<
", first time " << lastTime
51 <<
", second time " << thisTime;
55 lastEvent = thisEvent;
67 auto it = lower_bound(
69 if (it->GetFileId() != Int_t(file))
return fEvents.end();
70 if (it->GetEventId() != Int_t(event))
return fEvents.end();
80 return fEvents[index].GetEventId();
88 auto it =
Find(fileId, eventId);
89 if (it ==
fEvents.end())
return -1.;
100 return fEvents[index].GetTime();
110 return fEvents[index].GetFileId();
117 if (time < 0.)
return kFALSE;
127 std::cout <<
ToString(opt) << std::endl;
145 ss << fName <<
": " <<
GetNofEvents() <<
" MC events in list\n";
146 if (!strcmp(option,
"long"))
147 for (std::size_t index = 0; index <
GetNofEvents(); index++)
Int_t GetFileIdByIndex(UInt_t index)
File number by index @value File number for event at given index in list.
void Sort()
Sort the list.
Bool_t Insert(UInt_t event, UInt_t file, Double_t time)
Double_t GetEventTimeByIndex(UInt_t index)
Event time by index @value Event time for event at given index in list.
Allows to access an MC event in the source file.
std::vector< CbmMCEventInfo > fEvents
std::size_t GetNofEvents() const
Number of events in the list @value Number of events.
Double_t GetEventTime(UInt_t event, UInt_t file)
Event start time.
std::string ToString(const char *option="") const
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Container class for MC events with number, file and start time.
CbmMCEventList()
Standard constructor.
std::vector< CbmMCEventInfo >::iterator Find(UInt_t file, UInt_t event)
Find an element in the list.
Int_t GetEventIdByIndex(UInt_t index)
Event number by index @value Event number for event at given index in list.
virtual ~CbmMCEventList()
Destructor.
virtual void Print(Option_t *opt="") const
Bool_t Check()
Check for double occurrences of events in list @value kTRUE is no double occurrences,...