ICP  1
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
NeXusEventCallback Class Reference

#include <NeXusEventCallback.h>

Inheritance diagram for NeXusEventCallback:
Inheritance graph

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)
 

Private Attributes

Poco::NotificationQueue m_queue
 
NeXusWorker m_worker
 
Poco::Thread m_worker_thread
 
uint_map_t m_se_uint_values
 
float_map_t m_se_float_values
 
float_map_t m_se_times
 
uint64_t m_good_uamph_sum
 
uint64_t m_raw_uamph_sum
 
uint64_t m_good_events_sum
 
uint64_t m_raw_events_sum
 
Poco::MemoryPool m_mempool
 
std::string m_entry_name
 
SimpleStore< int_map_tm_int_map_store
 
SimpleStore< float_map_tm_float_map_store
 
const ISISCRPT_STRUCTm_crpt
 
IXNeXusFilem_file
 
det_file_t m_det_file
 
int m_current_frame
 
int m_current_period
 frame number we are currently processing More...
 
int m_is_vetoing
 last period number seen, used for change period log More...
 
int m_good_frames
 1 yes, 0 no (-1 means unknown, but just used for initialisation) More...
 
int m_raw_frames
 
LONG m_discarded_events
 
LONGLONG m_monitor_events_not_saved
 events discarded as outside tcb time window More...
 
std::vector< float > m_frame_time
 monitor events we did not save to file, instead just saving histograms More...
 
std::vector< float > m_frame_proton_charge
 
std::map< int, uint32_t > m_frame_events_raw
 
std::vector< int > m_frame_number
 
std::vector< int > m_frame_period
 
std::vector< int > m_good_frame
 
NXlogWriter< int > m_period
 
NXlogWriter< int > m_vetoing
 
int m_refeventdetcard
 
std::vector< int > m_det_id
 
det_name_t m_det_name
 
time_t m_last_frame_time
 
card_frame_t m_card_frame
 
frame_events_write_t m_frame_events_write
 
std::map< std::string, uint64_t > m_events_write_total
 
std::map< std::string, int > m_det_tr
 
std::set< std::string > m_event_det
 

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
 

Detailed Description

Definition at line 32 of file NeXusEventCallback.h.

Member Typedef Documentation

typedef std::map< int,std::pair<int,time_t> > NeXusEventCallback::card_frame_t
private

Definition at line 107 of file NeXusEventCallback.h.

typedef std::map< std::string, std::vector<IXNeXusFile*> > NeXusEventCallback::det_file_t
private

Definition at line 82 of file NeXusEventCallback.h.

typedef boost::bimap<std::string,int> NeXusEventCallback::det_name_t
private

Definition at line 104 of file NeXusEventCallback.h.

typedef std::map<std::string,std::map<int,int> > NeXusEventCallback::frame_events_write_t
private

Definition at line 109 of file NeXusEventCallback.h.

Constructor & Destructor Documentation

NeXusEventCallback::NeXusEventCallback ( const ISISCRPT_STRUCT crpt,
IXNeXusFile file,
const std::vector< int > &  ev_source_ids 
)
NeXusEventCallback::~NeXusEventCallback ( )

Definition at line 305 of file NeXusEventCallback.cpp.

References close(), LOGSTR_INFORMATION, m_queue, and m_worker_thread.

Member Function Documentation

void NeXusEventCallback::allEventCallback ( const DAEEventHeader head,
const DetectorEvent32 det_ev,
int  n,
int  event_source_id,
const int *  mapping 
)
void NeXusEventCallback::allFrameCallback ( const DAEEventHeader head,
int  event_source_id 
)
void NeXusEventCallback::close ( )
private
void NeXusEventCallback::closeDataGroup ( IXNeXusFile nx,
const std::string &  name 
)
private

if name is null string, do nothing

Definition at line 913 of file NeXusEventCallback.cpp.

References IXNeXusFile::closeGroup().

Referenced by close(), and finish().

void NeXusEventCallback::closeDataGroup ( const std::string &  name)
inlineprivate

Definition at line 123 of file NeXusEventCallback.h.

References closeDataGroup(), and m_file.

Referenced by closeDataGroup().

void NeXusEventCallback::createEmptyFileStructure ( )
int NeXusEventCallback::currentWriteFrame ( ) const
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 ( )
void NeXusEventCallback::flush ( )

Definition at line 293 of file NeXusEventCallback.cpp.

References IXNeXusFile::flush(), m_det_file, and m_file.

int NeXusEventCallback::getRefEventDetCard ( const std::vector< int > &  ev_source_ids)
private

Referenced by NeXusEventCallback().

int NeXusEventCallback::getSpectrum ( const DetectorEvent32 det_ev,
int  event_source_id,
int  i 
)
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().

float NeXusEventCallback::getTimeOffset ( const ISISCRPT_STRUCT crpt,
const DetectorEvent32 det_ev,
int  event_source_id,
int  tr,
int  i 
)
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().

float NeXusEventCallback::getTimeOffset ( const DetectorEvent32 det_ev,
int  event_source_id,
int  tr,
int  i 
)
inlineprivate

Definition at line 125 of file NeXusEventCallback.h.

References getTimeOffset(), and m_crpt.

Referenced by getTimeOffset().

void NeXusEventCallback::makeDetName ( int  spec,
std::string &  det_name 
)
private
void NeXusEventCallback::noFrameCallbackEnd ( bool  end_present,
NoFrameCallbackMode  mode,
int  event_source_id 
)
void NeXusEventCallback::noFrameCallbackNull ( bool  end_present,
NoFrameCallbackMode  mode,
int  event_source_id 
)
void NeXusEventCallback::openDataGroup ( IXNeXusFile nx,
const std::string &  name,
bool  create_zero_size_if_missing = false 
)
private
void NeXusEventCallback::openDataGroup ( const std::string &  name,
bool  create_zero_size_if_missing = false 
)
inlineprivate

Definition at line 122 of file NeXusEventCallback.h.

References m_file, and openDataGroup().

Referenced by openDataGroup().

void NeXusEventCallback::processDataDae ( const DAEEventHeader head,
const DetectorEvent32 det_ev,
int  n,
int  event_source_id 
)
private
void NeXusEventCallback::updateCurrentWriteFrame ( int  frame,
int  event_source_id 
)
private
void NeXusEventCallback::writeEvents ( const DAEEventHeader head,
int  event_source_id,
int  nev,
const int_map_t event_id,
const float_map_t event_time_offset 
)
private
void NeXusEventCallback::writeEventsImpl ( const DAEEventHeader head,
int  event_source_id,
int  nev,
const int_map_t event_id,
const float_map_t event_time_offset 
)
private

Friends And Related Function Documentation

friend class NeXusWorker
friend

Definition at line 34 of file NeXusEventCallback.h.

Member Data Documentation

const int NeXusEventCallback::INVALID_FRAME_MARKER = -1
staticprivate
card_frame_t NeXusEventCallback::m_card_frame
private
const ISISCRPT_STRUCT* NeXusEventCallback::m_crpt
private
int NeXusEventCallback::m_current_frame
private

Definition at line 85 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and processDataDae().

int NeXusEventCallback::m_current_period
private

frame number we are currently processing

Definition at line 86 of file NeXusEventCallback.h.

Referenced by allFrameCallback().

det_file_t NeXusEventCallback::m_det_file
private

Definition at line 83 of file NeXusEventCallback.h.

Referenced by close(), flush(), and writeEventsImpl().

std::vector<int> NeXusEventCallback::m_det_id
private

Definition at line 103 of file NeXusEventCallback.h.

Referenced by allEventCallback(), and NeXusEventCallback().

det_name_t NeXusEventCallback::m_det_name
private
std::map<std::string,int> NeXusEventCallback::m_det_tr
private

Definition at line 112 of file NeXusEventCallback.h.

Referenced by finish(), and NeXusEventCallback().

LONG NeXusEventCallback::m_discarded_events
private

Definition at line 91 of file NeXusEventCallback.h.

Referenced by allEventCallback(), finish(), and processDataDae().

std::string NeXusEventCallback::m_entry_name
private

Definition at line 65 of file NeXusEventCallback.h.

Referenced by NeXusEventCallback(), and writeEventsImpl().

std::set<std::string> NeXusEventCallback::m_event_det
private

Definition at line 113 of file NeXusEventCallback.h.

Referenced by finish(), and NeXusEventCallback().

Poco::Condition NeXusEventCallback::m_event_write_cond
staticprivate

Definition at line 79 of file NeXusEventCallback.h.

Referenced by updateCurrentWriteFrame(), and writeEvents().

Poco::Mutex NeXusEventCallback::m_event_write_mutex
staticprivate

Definition at line 78 of file NeXusEventCallback.h.

Referenced by updateCurrentWriteFrame(), and writeEvents().

std::map<std::string,uint64_t> NeXusEventCallback::m_events_write_total
private

Definition at line 111 of file NeXusEventCallback.h.

Referenced by finish(), openDataGroup(), and writeEventsImpl().

IXNeXusFile* NeXusEventCallback::m_file
private
SimpleStore<float_map_t> NeXusEventCallback::m_float_map_store
private

Definition at line 76 of file NeXusEventCallback.h.

Referenced by allEventCallback().

Poco::Mutex NeXusEventCallback::m_frame_callback_mutex
staticprivate

Definition at line 77 of file NeXusEventCallback.h.

Referenced by allFrameCallback().

std::map<int,uint32_t> NeXusEventCallback::m_frame_events_raw
private

Definition at line 95 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and finish().

frame_events_write_t NeXusEventCallback::m_frame_events_write
private

Definition at line 110 of file NeXusEventCallback.h.

Referenced by finish(), and writeEventsImpl().

std::vector<int> NeXusEventCallback::m_frame_number
private

Definition at line 96 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and finish().

std::vector<int> NeXusEventCallback::m_frame_period
private

Definition at line 97 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and finish().

std::vector<float> NeXusEventCallback::m_frame_proton_charge
private

Definition at line 94 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and finish().

std::vector<float> NeXusEventCallback::m_frame_time
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().

uint64_t NeXusEventCallback::m_good_events_sum
private

Definition at line 58 of file NeXusEventCallback.h.

Referenced by finish(), and writeEventsImpl().

std::vector<int> NeXusEventCallback::m_good_frame
private

Definition at line 98 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and finish().

int NeXusEventCallback::m_good_frames
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().

uint64_t NeXusEventCallback::m_good_uamph_sum
private

Definition at line 56 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and finish().

SimpleStore<int_map_t> NeXusEventCallback::m_int_map_store
private

Definition at line 75 of file NeXusEventCallback.h.

Referenced by allEventCallback().

int NeXusEventCallback::m_is_vetoing
private

last period number seen, used for change period log

Definition at line 87 of file NeXusEventCallback.h.

Referenced by allFrameCallback().

time_t NeXusEventCallback::m_last_frame_time
private

Definition at line 106 of file NeXusEventCallback.h.

Referenced by updateCurrentWriteFrame().

Poco::MemoryPool NeXusEventCallback::m_mempool
private

Definition at line 64 of file NeXusEventCallback.h.

Referenced by allEventCallback().

LONGLONG NeXusEventCallback::m_monitor_events_not_saved
private

events discarded as outside tcb time window

Definition at line 92 of file NeXusEventCallback.h.

Referenced by allEventCallback(), and finish().

const int NeXusEventCallback::m_nexus_chunk_length = 32000
staticprivate

number of items in NeXus event list data chunk

Definition at line 66 of file NeXusEventCallback.h.

Referenced by openDataGroup().

NXlogWriter<int> NeXusEventCallback::m_period
private

Definition at line 100 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and finish().

Poco::NotificationQueue NeXusEventCallback::m_queue
private

Definition at line 48 of file NeXusEventCallback.h.

Referenced by NeXusEventCallback(), writeEvents(), and ~NeXusEventCallback().

uint64_t NeXusEventCallback::m_raw_events_sum
private

Definition at line 59 of file NeXusEventCallback.h.

Referenced by finish(), and writeEventsImpl().

int NeXusEventCallback::m_raw_frames
private

Definition at line 90 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and finish().

uint64_t NeXusEventCallback::m_raw_uamph_sum
private

Definition at line 57 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and finish().

int NeXusEventCallback::m_refeventdetcard
private

Definition at line 102 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and NeXusEventCallback().

float_map_t NeXusEventCallback::m_se_float_values
private

Definition at line 53 of file NeXusEventCallback.h.

Referenced by finish(), and processDataDae().

float_map_t NeXusEventCallback::m_se_times
private

Definition at line 54 of file NeXusEventCallback.h.

Referenced by finish(), and processDataDae().

uint_map_t NeXusEventCallback::m_se_uint_values
private

Definition at line 52 of file NeXusEventCallback.h.

Referenced by finish(), and processDataDae().

NXlogWriter<int> NeXusEventCallback::m_vetoing
private

Definition at line 101 of file NeXusEventCallback.h.

Referenced by allFrameCallback(), and finish().

NeXusWorker NeXusEventCallback::m_worker
private

Definition at line 49 of file NeXusEventCallback.h.

Referenced by NeXusEventCallback().

Poco::Thread NeXusEventCallback::m_worker_thread
private

Definition at line 50 of file NeXusEventCallback.h.

Referenced by NeXusEventCallback(), and ~NeXusEventCallback().


The documentation for this class was generated from the following files: