本文整理汇总了C++中dataobjects::EventList::getEvents方法的典型用法代码示例。如果您正苦于以下问题:C++ EventList::getEvents方法的具体用法?C++ EventList::getEvents怎么用?C++ EventList::getEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataobjects::EventList
的用法示例。
在下文中一共展示了EventList::getEvents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeEventList
/** Write out an event list into an already-opened group
* @param el :: reference to the EventList to write.
* @param group_name :: group_name to create.
* */
int NexusFileIO::writeEventList( const DataObjects::EventList & el, std::string group_name) const
{
//write data entry
NXstatus status=NXmakegroup(fileID, group_name.c_str(), "NXdata");
if(status==NX_ERROR) return(2);
NXopengroup(fileID, group_name.c_str(), "NXdata");
// Copy the detector IDs to an array.
const std::set<detid_t>& dets = el.getDetectorIDs();
// Write out the detector IDs
if (!dets.empty())
{
std::vector<detid_t> detectorIDs(dets.begin(),dets.end());
int dims_array[1];
NXwritedata("detector_IDs", NX_INT64, 1, dims_array, (void*)(detectorIDs.data()), false );
}
std::string eventType("UNKNOWN");
size_t num = el.getNumberEvents();
switch (el.getEventType())
{
case TOF:
eventType = "TOF";
writeEventListData( el.getEvents(), true, true, false, false );
break;
case WEIGHTED:
eventType = "WEIGHTED";
writeEventListData( el.getWeightedEvents(), true, true, true, true );
break;
case WEIGHTED_NOTIME:
eventType = "WEIGHTED_NOTIME";
writeEventListData( el.getWeightedEventsNoTime(), true, false, true, true );
break;
}
// --- Save the type of sorting -----
std::string sortType;
switch (el.getSortType())
{
case TOF_SORT:
sortType = "TOF_SORT";
break;
case PULSETIME_SORT:
sortType = "PULSETIME_SORT";
break;
case UNSORTED:
default:
sortType = "UNSORTED";
break;
}
NXputattr (fileID, "sort_type", reinterpret_cast<void*>(const_cast<char*>(sortType.c_str())), static_cast<int>(sortType.size()), NX_CHAR);
// Save an attribute with the type of each event.
NXputattr (fileID, "event_type", reinterpret_cast<void*>(const_cast<char*>(eventType.c_str())), static_cast<int>(eventType.size()), NX_CHAR);
// Save an attribute with the number of events
NXputattr (fileID, "num_events", (void*)(&num), 1, NX_INT64);
// Close it up!
status=NXclosegroup(fileID);
return((status==NX_ERROR)?3:0);
}