ICP
1
|
#include <NeXusEventCallback.h>
Classes | |
class | myallocator |
Public Member Functions | |
NeXusEventCallback (const ISISCRPT_STRUCT *crpt, IXNeXusFile *file, const std::vector< int > &ev_source_ids) | |
void | allEventCallback (const DAEEventHeader *head, const DetectorEvent32 *det_ev, int n, int event_source_id, const int *mapping) |
void | allFrameCallback (const DAEEventHeader *head, int event_source_id) |
this will get called for each frame for EACH event source More... | |
void | noFrameCallbackEnd (bool end_present, NoFrameCallbackMode mode, int event_source_id) |
void | noFrameCallbackNull (bool end_present, NoFrameCallbackMode mode, int event_source_id) |
void | finish () |
void | flush () |
~NeXusEventCallback () | |
void | createEmptyFileStructure () |
Static Public Member Functions | |
static float | getTimeOffset (const ISISCRPT_STRUCT *crpt, const DetectorEvent32 *det_ev, int event_source_id, int tr, int i) |
Private Types | |
typedef std::map< std::string, std::vector< IXNeXusFile * > > | det_file_t |
typedef boost::bimap < std::string, int > | det_name_t |
typedef std::map< int, std::pair< int, time_t > > | card_frame_t |
typedef std::map< std::string, std::map< int, int > > | frame_events_write_t |
Private Member Functions | |
void | close () |
int | getSpectrum (const DetectorEvent32 *det_ev, int event_source_id, int i) |
returns -1 if spectrum out of range More... | |
void | writeEvents (const DAEEventHeader *head, int event_source_id, int nev, const int_map_t &event_id, const float_map_t &event_time_offset) |
void | writeEventsImpl (const DAEEventHeader *head, int event_source_id, int nev, const int_map_t &event_id, const float_map_t &event_time_offset) |
int | currentWriteFrame () const |
void | updateCurrentWriteFrame (int frame, int event_source_id) |
void | makeDetName (int spec, std::string &det_name) |
void | openDataGroup (IXNeXusFile *nx, const std::string &name, bool create_zero_size_if_missing=false) |
void | closeDataGroup (IXNeXusFile *nx, const std::string &name) |
if name is null string, do nothing More... | |
void | openDataGroup (const std::string &name, bool create_zero_size_if_missing=false) |
void | closeDataGroup (const std::string &name) |
int | getRefEventDetCard (const std::vector< int > &ev_source_ids) |
float | getTimeOffset (const DetectorEvent32 *det_ev, int event_source_id, int tr, int i) |
void | processDataDae (const DAEEventHeader *head, const DetectorEvent32 *det_ev, int n, int event_source_id) |
Static Private Attributes | |
static const int | INVALID_FRAME_MARKER = -1 |
static const int | m_nexus_chunk_length = 32000 |
number of items in NeXus event list data chunk More... | |
static Poco::Mutex | m_frame_callback_mutex |
static Poco::Mutex | m_event_write_mutex |
static Poco::Condition | m_event_write_cond |
Friends | |
class | NeXusWorker |
Additional Inherited Members | |
Protected Member Functions inherited from ISIS::Base | |
Base (const std::string &logger_name="UNKNOWN") | |
void | setLoggerName (const std::string &logger_name) |
virtual | ~Base () |
virtual std::string | loggingPrefix () const |
void | setThisLoggerLevel (int level) |
Static Protected Member Functions inherited from ISIS::Base | |
static void | setAllLoggerLevel (int level) |
Protected Attributes inherited from ISIS::Base | |
Poco::Logger * | m_logger |
Poco::LogStream * | m_logstr |
Poco::Mutex | m_logger_lock |
Definition at line 32 of file NeXusEventCallback.h.
|
private |
Definition at line 107 of file NeXusEventCallback.h.
|
private |
Definition at line 82 of file NeXusEventCallback.h.
|
private |
Definition at line 104 of file NeXusEventCallback.h.
|
private |
Definition at line 109 of file NeXusEventCallback.h.
NeXusEventCallback::NeXusEventCallback | ( | const ISISCRPT_STRUCT * | crpt, |
IXNeXusFile * | file, | ||
const std::vector< int > & | ev_source_ids | ||
) |
Definition at line 18 of file NeXusEventCallback.cpp.
References ISISCRPT_STRUCT::getNumSpectra(), getRefEventDetCard(), ISISCRPT_STRUCT::isEventSpectrum(), m_card_frame, m_crpt, m_det_id, m_det_name, m_det_tr, m_entry_name, m_event_det, m_queue, m_refeventdetcard, m_worker, m_worker_thread, makeDetName(), ISIS::Base::setLoggerName(), and ISISCRPT_STRUCT::spectrumDAETR().
NeXusEventCallback::~NeXusEventCallback | ( | ) |
Definition at line 305 of file NeXusEventCallback.cpp.
References close(), LOGSTR_INFORMATION, m_queue, and m_worker_thread.
void NeXusEventCallback::allEventCallback | ( | const DAEEventHeader * | head, |
const DetectorEvent32 * | det_ev, | ||
int | n, | ||
int | event_source_id, | ||
const int * | mapping | ||
) |
this is called by multiple threads can also be called with n=0
Definition at line 492 of file NeXusEventCallback.cpp.
References DAEEventHeaderInfo::bad_frame, data_dae_t::crate, ISISCRPT_STRUCT::data_dae, DAEEventHeader::frame_number, SimpleStore< T >::get(), getSpectrum(), getTimeOffset(), DAEEventHeader::info, m_crpt, m_det_id, m_det_name, m_discarded_events, m_float_map_store, m_int_map_store, ISIS::Base::m_logstr, m_mempool, m_monitor_events_not_saved, ISISCRPT_STRUCT::n_data_dae, processDataDae(), SimpleStore< T >::put(), ISISCRPT_STRUCT::saveMonitorEvents(), ISISCRPT_STRUCT::spectrumDAETR(), ISISCRPT_STRUCT::spectrumToMonitorNumber(), DetectorEvent32::time_channel, updateCurrentWriteFrame(), and writeEvents().
Referenced by NeXusEventWriter::start(), and ICPEventWriter::start().
void NeXusEventCallback::allFrameCallback | ( | const DAEEventHeader * | head, |
int | event_source_id | ||
) |
this will get called for each frame for EACH event source
< DAE PPP value for 300uA beam at 50Hz
< number of seconds in a month
Definition at line 607 of file NeXusEventCallback.cpp.
References NXlogWriter< T >::addValue(), DAEEventHeaderInfo::bad_frame, DAEEventList::DAETimeToOffset(), DAEEventHeader::frame_number, DAEEventHeader::info, LOGSTR_WARNING, m_crpt, m_current_frame, m_current_period, m_frame_callback_mutex, m_frame_events_raw, m_frame_number, m_frame_period, m_frame_proton_charge, m_frame_time, m_good_frame, m_good_frames, m_good_uamph_sum, m_is_vetoing, m_period, m_raw_frames, m_raw_uamph_sum, m_refeventdetcard, m_vetoing, DAEEventHeader::num_events, DAEEventHeader::period, PPP_TO_UAMPH, DAEEventHeader::protons, ISISCRPT_STRUCT::start_time, and DAEEventHeader::time.
Referenced by NeXusEventWriter::start(), and ICPEventWriter::start().
|
private |
Definition at line 278 of file NeXusEventCallback.cpp.
References IXNeXusFile::close(), IXNeXusFile::closeData(), closeDataGroup(), and m_det_file.
Referenced by finish(), and ~NeXusEventCallback().
|
private |
if name is null string, do nothing
Definition at line 913 of file NeXusEventCallback.cpp.
References IXNeXusFile::closeGroup().
|
inlineprivate |
Definition at line 123 of file NeXusEventCallback.h.
References closeDataGroup(), and m_file.
Referenced by closeDataGroup().
void NeXusEventCallback::createEmptyFileStructure | ( | ) |
Definition at line 343 of file NeXusEventCallback.cpp.
References IXNeXusFile::closeGroup(), m_crpt, m_det_name, m_file, IXNeXusFile::makeNewGroup(), ISISCRPT_STRUCT::ntc, ISISCRPT_STRUCT::ntrg, IXNeXusFile::openGroup(), ISISCRPT_STRUCT::rtcb, ISISCRPT_STRUCT::tcb, IXNeXusFile::writeAttribute(), and IXNeXusFile::writeData().
Referenced by NeXusEventWriter::start(), and ICPEventWriter::start().
|
private |
Definition at line 767 of file NeXusEventCallback.cpp.
References INVALID_FRAME_MARKER, and m_card_frame.
Referenced by writeEvents(), and writeEventsImpl().
void NeXusEventCallback::finish | ( | ) |
Definition at line 105 of file NeXusEventCallback.cpp.
References IXNeXusFile::addLog(), close(), closeDataGroup(), IXNeXusFile::closeGroup(), ISISCRPT_STRUCT::data_dae, detector_base, IXNeXusFile::getLink(), IXNeXusFile::ISOtime(), LOGSTR_ERROR, LOGSTR_INFORMATION, LOGSTR_WARNING, m_crpt, m_det_tr, m_discarded_events, m_event_det, m_events_write_total, m_file, m_frame_events_raw, m_frame_events_write, m_frame_number, m_frame_period, m_frame_proton_charge, m_frame_time, m_good_events_sum, m_good_frame, m_good_frames, m_good_uamph_sum, m_monitor_events_not_saved, m_period, m_raw_events_sum, m_raw_frames, m_raw_uamph_sum, m_se_float_values, m_se_times, m_se_uint_values, m_vetoing, IXNeXusFile::makeLink(), IXNeXusFile::makeNewGroup(), ISISCRPT_STRUCT::n_data_dae, data_dae_t::name, openDataGroup(), IXNeXusFile::openGroup(), PPP_TO_UAMPH, data_dae_t::raw_units, data_dae_t::scaled_units, NXlogWriter< T >::setOffset(), ISISCRPT_STRUCT::start_time, sum_map_values(), NXlogWriter< T >::write(), IXNeXusFile::writeAttribute(), and IXNeXusFile::writeData().
Referenced by ICPEventWriter::stop(), and NeXusEventWriter::wait().
void NeXusEventCallback::flush | ( | ) |
Definition at line 293 of file NeXusEventCallback.cpp.
References IXNeXusFile::flush(), m_det_file, and m_file.
|
private |
Referenced by NeXusEventCallback().
|
inlineprivate |
returns -1 if spectrum out of range
Definition at line 130 of file NeXusEventCallback.h.
References ISISCRPT_STRUCT::dae1SpecForCard(), and m_crpt.
Referenced by allEventCallback().
|
inlinestatic |
computer the time at which the event occurred from the bin boundaries time channel 0 is dummy meaning out of range, hence subtract 1
Definition at line 177 of file NeXusEventCallback.h.
References ISISCRPT_STRUCT::rtcb, and DetectorEvent32::time_channel.
Referenced by allEventCallback(), TCPEventStreamConnection::allEventCallback(), and processDataDae().
|
inlineprivate |
Definition at line 125 of file NeXusEventCallback.h.
References getTimeOffset(), and m_crpt.
Referenced by getTimeOffset().
|
private |
Definition at line 329 of file NeXusEventCallback.cpp.
References detector_format, m_crpt, ISISCRPT_STRUCT::spectrumGroup(), and ISISCRPT_STRUCT::spectrumToMonitorNumber().
Referenced by NeXusEventCallback().
void NeXusEventCallback::noFrameCallbackEnd | ( | bool | end_present, |
NoFrameCallbackMode | mode, | ||
int | event_source_id | ||
) |
Definition at line 733 of file NeXusEventCallback.cpp.
References INVALID_FRAME_MARKER, LOGSTR_WARNING, m_card_frame, and updateCurrentWriteFrame().
Referenced by noFrameCallbackNull(), and NeXusEventWriter::start().
void NeXusEventCallback::noFrameCallbackNull | ( | bool | end_present, |
NoFrameCallbackMode | mode, | ||
int | event_source_id | ||
) |
Definition at line 751 of file NeXusEventCallback.cpp.
References LOGSTR_WARNING, m_card_frame, noFrameCallbackEnd(), and NoFrameRunning.
Referenced by ICPEventWriter::start().
|
private |
Definition at line 879 of file NeXusEventCallback.cpp.
References IXNeXusFile::flush(), m_events_write_total, m_nexus_chunk_length, IXNeXusFile::makeData(), IXNeXusFile::makeDataChunked(), IXNeXusFile::openGroup(), and IXNeXusFile::writeAttribute().
Referenced by finish(), and writeEventsImpl().
|
inlineprivate |
Definition at line 122 of file NeXusEventCallback.h.
References m_file, and openDataGroup().
Referenced by openDataGroup().
|
private |
< number of seconds in a month
Definition at line 390 of file NeXusEventCallback.cpp.
References DAEEventHeaderInfo::bad_frame, DAEEventList::DAETimeToOffset(), ISISCRPT_STRUCT::daeTR(), data_dae_t::data_bytes, ISISCRPT_STRUCT::data_dae, data_dae_t::data_type, DAEEventHeader::frame_number, getTimeOffset(), data_dae_t::id, DAEEventHeader::info, LOGSTR_ERROR, LOGSTR_WARNING, m_crpt, m_current_frame, m_discarded_events, m_se_float_values, m_se_times, m_se_uint_values, ISISCRPT_STRUCT::n_data_dae, data_dae_t::name, data_dae_t::offset, data_dae_t::scale, DetectorEvent32::spectrum, ISISCRPT_STRUCT::start_time, DAEEventHeader::time, DetectorEvent32::time_channel, and data_dae_t::tr.
Referenced by allEventCallback().
|
private |
Definition at line 692 of file NeXusEventCallback.cpp.
References INVALID_FRAME_MARKER, LOGSTR_WARNING, m_card_frame, m_event_write_cond, m_event_write_mutex, and m_last_frame_time.
Referenced by allEventCallback(), noFrameCallbackEnd(), and writeEvents().
|
private |
<
Definition at line 787 of file NeXusEventCallback.cpp.
References currentWriteFrame(), DAEEventHeader::frame_number, LOGSTR_WARNING, m_event_write_cond, m_event_write_mutex, m_queue, updateCurrentWriteFrame(), and writeEventsImpl().
Referenced by allEventCallback().
|
private |
Definition at line 816 of file NeXusEventCallback.cpp.
References DAEEventHeaderInfo::bad_frame, IXNeXusFile::clone(), currentWriteFrame(), DAEEventHeader::frame_number, DAEEventHeader::info, m_det_file, m_entry_name, m_events_write_total, m_file, m_frame_events_write, m_good_events_sum, m_raw_events_sum, openDataGroup(), and IXNeXusFile::openGroup().
Referenced by NeXusWorker::doWork(), and writeEvents().
|
friend |
Definition at line 34 of file NeXusEventCallback.h.
|
staticprivate |
Definition at line 61 of file NeXusEventCallback.h.
Referenced by currentWriteFrame(), noFrameCallbackEnd(), and updateCurrentWriteFrame().
|
private |
Definition at line 108 of file NeXusEventCallback.h.
Referenced by currentWriteFrame(), NeXusEventCallback(), noFrameCallbackEnd(), noFrameCallbackNull(), and updateCurrentWriteFrame().
|
private |
Definition at line 80 of file NeXusEventCallback.h.
Referenced by allEventCallback(), allFrameCallback(), createEmptyFileStructure(), finish(), getSpectrum(), getTimeOffset(), makeDetName(), NeXusEventCallback(), and processDataDae().
|
private |
Definition at line 85 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and processDataDae().
|
private |
frame number we are currently processing
Definition at line 86 of file NeXusEventCallback.h.
Referenced by allFrameCallback().
|
private |
Definition at line 83 of file NeXusEventCallback.h.
Referenced by close(), flush(), and writeEventsImpl().
|
private |
Definition at line 103 of file NeXusEventCallback.h.
Referenced by allEventCallback(), and NeXusEventCallback().
|
private |
Definition at line 105 of file NeXusEventCallback.h.
Referenced by allEventCallback(), createEmptyFileStructure(), and NeXusEventCallback().
|
private |
Definition at line 112 of file NeXusEventCallback.h.
Referenced by finish(), and NeXusEventCallback().
|
private |
Definition at line 91 of file NeXusEventCallback.h.
Referenced by allEventCallback(), finish(), and processDataDae().
|
private |
Definition at line 65 of file NeXusEventCallback.h.
Referenced by NeXusEventCallback(), and writeEventsImpl().
|
private |
Definition at line 113 of file NeXusEventCallback.h.
Referenced by finish(), and NeXusEventCallback().
|
staticprivate |
Definition at line 79 of file NeXusEventCallback.h.
Referenced by updateCurrentWriteFrame(), and writeEvents().
|
staticprivate |
Definition at line 78 of file NeXusEventCallback.h.
Referenced by updateCurrentWriteFrame(), and writeEvents().
|
private |
Definition at line 111 of file NeXusEventCallback.h.
Referenced by finish(), openDataGroup(), and writeEventsImpl().
|
private |
Definition at line 81 of file NeXusEventCallback.h.
Referenced by closeDataGroup(), createEmptyFileStructure(), finish(), flush(), openDataGroup(), and writeEventsImpl().
|
private |
Definition at line 76 of file NeXusEventCallback.h.
Referenced by allEventCallback().
|
staticprivate |
Definition at line 77 of file NeXusEventCallback.h.
Referenced by allFrameCallback().
|
private |
Definition at line 95 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
Definition at line 110 of file NeXusEventCallback.h.
Referenced by finish(), and writeEventsImpl().
|
private |
Definition at line 96 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
Definition at line 97 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
Definition at line 94 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
monitor events we did not save to file, instead just saving histograms
Definition at line 93 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
Definition at line 58 of file NeXusEventCallback.h.
Referenced by finish(), and writeEventsImpl().
|
private |
Definition at line 98 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
1 yes, 0 no (-1 means unknown, but just used for initialisation)
Definition at line 89 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
Definition at line 56 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
Definition at line 75 of file NeXusEventCallback.h.
Referenced by allEventCallback().
|
private |
last period number seen, used for change period log
Definition at line 87 of file NeXusEventCallback.h.
Referenced by allFrameCallback().
|
private |
Definition at line 106 of file NeXusEventCallback.h.
Referenced by updateCurrentWriteFrame().
|
private |
Definition at line 64 of file NeXusEventCallback.h.
Referenced by allEventCallback().
|
private |
events discarded as outside tcb time window
Definition at line 92 of file NeXusEventCallback.h.
Referenced by allEventCallback(), and finish().
|
staticprivate |
number of items in NeXus event list data chunk
Definition at line 66 of file NeXusEventCallback.h.
Referenced by openDataGroup().
|
private |
Definition at line 100 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
Definition at line 48 of file NeXusEventCallback.h.
Referenced by NeXusEventCallback(), writeEvents(), and ~NeXusEventCallback().
|
private |
Definition at line 59 of file NeXusEventCallback.h.
Referenced by finish(), and writeEventsImpl().
|
private |
Definition at line 90 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
Definition at line 57 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
Definition at line 102 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and NeXusEventCallback().
|
private |
Definition at line 53 of file NeXusEventCallback.h.
Referenced by finish(), and processDataDae().
|
private |
Definition at line 54 of file NeXusEventCallback.h.
Referenced by finish(), and processDataDae().
|
private |
Definition at line 52 of file NeXusEventCallback.h.
Referenced by finish(), and processDataDae().
|
private |
Definition at line 101 of file NeXusEventCallback.h.
Referenced by allFrameCallback(), and finish().
|
private |
Definition at line 49 of file NeXusEventCallback.h.
Referenced by NeXusEventCallback().
|
private |
Definition at line 50 of file NeXusEventCallback.h.
Referenced by NeXusEventCallback(), and ~NeXusEventCallback().