本文整理汇总了C++中dataobjects::EventList::addEventQuickly方法的典型用法代码示例。如果您正苦于以下问题:C++ EventList::addEventQuickly方法的具体用法?C++ EventList::addEventQuickly怎么用?C++ EventList::addEventQuickly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataobjects::EventList
的用法示例。
在下文中一共展示了EventList::addEventQuickly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertEvents
/** Convert events to "fake" events as counts in outWS
*/
void CountEventsInPulses::convertEvents(DataObjects::EventWorkspace_sptr outWS,
bool sumspectra) {
// 1. Get run_start time
std::string runstartstr = inpWS->run().getProperty("run_start")->value();
Kernel::DateAndTime runstart(runstartstr);
int64_t runstarttime = runstart.totalNanoseconds();
// 2. Convert TOF and add to new event workspace
double margin_sec = mPulseLength * 0.01;
g_log.information() << "Pulse length = " << mPulseLength
<< " (sec). Margine = " << margin_sec
<< " For safe binning. " << std::endl;
PARALLEL_FOR2(inpWS, outWS)
for (int wsindex = 0;
wsindex < static_cast<int>(inpWS->getNumberHistograms()); wsindex++) {
DataObjects::EventList realevents = inpWS->getEventList(wsindex);
DataObjects::EventList *fakeevents;
if (sumspectra) {
fakeevents = outWS->getEventListPtr(0);
} else {
fakeevents = outWS->getEventListPtr(wsindex);
}
size_t numevents = realevents.getNumberEvents();
for (size_t ie = 0; ie < numevents; ie++) {
DataObjects::WeightedEvent event = realevents.getEvent(ie);
// Swap TOF and pulse time and add to new event list
// a) TOF (ms) -> Pulse Time
double oldtof = event.tof();
int64_t oldtofns = int64_t(oldtof * 1000);
Kernel::DateAndTime newpulsetime(oldtofns);
// b) Pulse Time (ns) -> TOF (ms) -> second
int64_t oldpulsetime =
event.pulseTime().totalNanoseconds() - runstarttime;
double newtofinsecond = double(oldpulsetime) * 1.0E-9 + margin_sec;
DataObjects::TofEvent fakeevent(newtofinsecond, newpulsetime);
fakeevents->addEventQuickly(fakeevent);
} // ENDFOR events
} // END FOR: Per Spectrum
g_log.debug() << "DBx505 Input Events = " << inpWS->getNumberEvents()
<< "; Output Events = " << outWS->getNumberEvents()
<< std::endl;
return;
}