// $Id$ // // File: L3farm_out.h // Created: Wed Aug 21 17:38:21 EDT 2013 // Creator: davidl (on Darwin harriet.local 11.4.2 i386) // #ifndef _L3farm_out_ #define _L3farm_out_ #include #include using namespace std; #include //#include using namespace evio; #ifdef HAVE_ET //#include #include #endif // HAVE_ET #include // C-style wrapper void* L3OutputThread(void *l3out); class L3farm_out{ public: enum EVIOSinkType{ kNoSink, kFileSink, kETSink }; L3farm_out(string sink_name); virtual ~L3farm_out(); void* L3OutputThread(void); vector* GetBufferFromPool(void); void ReturnBufferToPool(vector *buff); void AddBufferToOutput(vector *buff); void FlushOutput(uint32_t Nwords, deque< vector* > &my_output_deque); void Quit(void); protected: void ConnectToET(string sink_name); bool quit; // Manage list of buffers for output uint32_t MAX_OUTPUT_QUEUE_SIZE; // in number of buffers (=events) uint32_t MAX_OUTPUT_BUFFER_SIZE; // in 32bit words in the EVIO block uint32_t MAX_HOLD_TIME; // in seconds uint32_t NEVENTS_PER_BLOCK; bool DEBUG_FILES; deque< vector* > output_deque; pthread_mutex_t output_deque_mutex; // Single event buffer pool. Used by JEventProcessor_L3proc pthread_mutex_t buff_pool_mutex; vector< vector* > buff_pool; // Output buffer for EVIO block vector output_block; ofstream *evioout; ofstream *ofs_debug_output; EVIOSinkType sink_type; uint32_t events_written_to_output; uint32_t blocks_written_to_output; #ifdef HAVE_ET et_sys_id sys_id; et_att_id att_id; #endif }; #endif // _L3farm_out_