Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEVIOWorkerThread Class Reference

#include <DEVIOWorkerThread.h>

Public Types

enum  JOBTYPE {
  JOB_NONE = 0x0, JOB_QUIT = 0x1, JOB_SWAP = 0x2, JOB_FULL_PARSE = 0x4,
  JOB_ASSOCIATE = 0x8
}
 

Public Member Functions

 DEVIOWorkerThread (JEventSource_EVIOpp *event_source, list< DParsedEvent * > &parsed_events, uint32_t &MAX_PARSED_EVENTS, mutex &PARSED_EVENTS_MUTEX, condition_variable &PARSED_EVENTS_CV, set< uint32_t > &ROCIDS_TO_PARSE)
 
virtual ~DEVIOWorkerThread ()
 
void Run (void)
 
void Finish (bool wait_to_complete=true)
 
void Prune (void)
 
void MakeEvents (void)
 
void PublishEvents (void)
 
void ParseBank (void)
 
void ParseEventTagBank (uint32_t *&iptr, uint32_t *iend)
 
void ParseEPICSbank (uint32_t *&iptr, uint32_t *iend)
 
void ParseBORbank (uint32_t *&iptr, uint32_t *iend)
 
void ParseTSscalerBank (uint32_t *&iptr, uint32_t *iend)
 
void Parsef250scalerBank (uint32_t rocid, uint32_t *&iptr, uint32_t *iend)
 
void ParseControlEvent (uint32_t *&iptr, uint32_t *iend)
 
void ParsePhysicsBank (uint32_t *&iptr, uint32_t *iend)
 
void ParseCDAQBank (uint32_t *&iptr, uint32_t *iend)
 
void ParseBuiltTriggerBank (uint32_t *&iptr, uint32_t *iend)
 
void ParseRawTriggerBank (uint32_t rocid, uint32_t *&iptr, uint32_t *iend)
 
void ParseDataBank (uint32_t *&iptr, uint32_t *iend)
 
void ParseDVertexBank (uint32_t *&iptr, uint32_t *iend)
 
void ParseDEventRFBunchBank (uint32_t *&iptr, uint32_t *iend)
 
void ParseJLabModuleData (uint32_t rocid, uint32_t *&iptr, uint32_t *iend)
 
void ParseTIBank (uint32_t rocid, uint32_t *&iptr, uint32_t *iend)
 
void ParseCAEN1190 (uint32_t rocid, uint32_t *&iptr, uint32_t *iend)
 
void ParseModuleConfiguration (uint32_t rocid, uint32_t *&iptr, uint32_t *iend)
 
void Parsef250Bank (uint32_t rocid, uint32_t *&iptr, uint32_t *iend)
 
void MakeDf250WindowRawData (DParsedEvent *pe, uint32_t rocid, uint32_t slot, uint32_t itrigger, uint32_t *&iptr)
 
void Parsef125Bank (uint32_t rocid, uint32_t *&iptr, uint32_t *iend)
 
void MakeDf125WindowRawData (DParsedEvent *pe, uint32_t rocid, uint32_t slot, uint32_t itrigger, uint32_t *&iptr)
 
void ParseF1TDCBank (uint32_t rocid, uint32_t *&iptr, uint32_t *iend)
 
void ParseSSPBank (uint32_t rocid, uint32_t *&iptr, uint32_t *iend)
 
void LinkAllAssociations (void)
 
uint32_t F1TDC_channel (uint32_t chip, uint32_t chan_on_chip, int modtype)
 
void DumpBinary (const uint32_t *iptr, const uint32_t *iend, uint32_t MaxWords=0, const uint32_t *imark=NULL)
 

Public Attributes

JEventSource_EVIOppevent_source
 
list< DParsedEvent * > & parsed_events
 
uint32_t & MAX_PARSED_EVENTS
 
mutex & PARSED_EVENTS_MUTEX
 
condition_variable & PARSED_EVENTS_CV
 
set< uint32_t > & ROCIDS_TO_PARSE
 
vector< DParsedEvent * > parsed_event_pool
 
list< DParsedEvent * > current_parsed_events
 
int VERBOSE
 
uint64_t Nrecycled
 
uint64_t MAX_EVENT_RECYCLES
 
uint64_t MAX_OBJECT_RECYCLES
 
atomic< bool > in_use
 
atomic< bool > done
 
JOBTYPE jobtype
 
uint64_t istreamorder
 
uint64_t run_number_seed
 
mutex mtx
 
condition_variable cv
 
thread thd
 
uint32_t buff_len
 
uint32_t * buff
 
streampos pos
 
bool PARSE_F250
 
bool PARSE_F125
 
bool PARSE_F1TDC
 
bool PARSE_CAEN1290TDC
 
bool PARSE_CONFIG
 
bool PARSE_BOR
 
bool PARSE_EPICS
 
bool PARSE_EVENTTAG
 
bool PARSE_TRIGGER
 
bool PARSE_SSP
 
bool LINK_TRIGGERTIME
 
bool LINK_CONFIG
 

Detailed Description

Definition at line 29 of file DEVIOWorkerThread.h.

Member Enumeration Documentation

Enumerator
JOB_NONE 
JOB_QUIT 
JOB_SWAP 
JOB_FULL_PARSE 
JOB_ASSOCIATE 

Definition at line 32 of file DEVIOWorkerThread.h.

Constructor & Destructor Documentation

DEVIOWorkerThread::DEVIOWorkerThread ( JEventSource_EVIOpp event_source,
list< DParsedEvent * > &  parsed_events,
uint32_t &  MAX_PARSED_EVENTS,
mutex &  PARSED_EVENTS_MUTEX,
condition_variable &  PARSED_EVENTS_CV,
set< uint32_t > &  ROCIDS_TO_PARSE 
)
DEVIOWorkerThread::~DEVIOWorkerThread ( )
virtual

Definition at line 80 of file DEVIOWorkerThread.cc.

References buff, and parsed_event_pool.

Member Function Documentation

void DEVIOWorkerThread::DumpBinary ( const uint32_t *  iptr,
const uint32_t *  iend,
uint32_t  MaxWords = 0,
const uint32_t *  imark = NULL 
)

This is used for debugging. It will print to the screen the words starting at the address given by iptr and ending just before iend or for MaxWords words, whichever comes first. If iend is NULL, then MaxWords will be printed. If MaxWords is zero then it is ignored and only iend is checked. If both iend==NULL and MaxWords==0, then only the word at iptr is printed.

Definition at line 2406 of file DEVIOWorkerThread.cc.

References Ncols, and string.

Referenced by ParseBORbank(), ParseDataBank(), and ParseEPICSbank().

uint32_t DEVIOWorkerThread::F1TDC_channel ( uint32_t  chip,
uint32_t  chan_on_chip,
int  modtype 
)
inline

Convert a F1TDC chip number and channel on the chip to the front panel channel number. This is based on "Input Channel Mapping" section at the very bottom of the document F1TDC_V2_V3_4_29_14.pdf

Definition at line 146 of file DEVIOWorkerThread.h.

References _DBG_, DModuleType::F1TDC32, DModuleType::F1TDC48, and DModuleType::GetName().

Referenced by ParseF1TDCBank().

void DEVIOWorkerThread::Finish ( bool  wait_to_complete = true)

Set the done flag so that the worker thread will exit once it is done processing its current job. The thread is notified to wake up in case it is currently idle. If the wait_to_complete flag is set (default), then the worker thread is joined to guarantee the current job's processing is completed before returning.

Definition at line 145 of file DEVIOWorkerThread.cc.

References cv, done, and thd.

void DEVIOWorkerThread::LinkAllAssociations ( void  )

Find objects that should be linked as "associated objects" of one another and add to each other's list.

Definition at line 2309 of file DEVIOWorkerThread.cc.

References current_parsed_events, LINK_CONFIG, LINK_TRIGGERTIME, LinkChannel(), LinkConfig(), LinkConfigSamplesCopy(), LinkModule(), LinkPulse(), and LinkPulsePedCopy().

Referenced by Run().

void DEVIOWorkerThread::MakeDf125WindowRawData ( DParsedEvent pe,
uint32_t  rocid,
uint32_t  slot,
uint32_t  itrigger,
uint32_t *&  iptr 
)
void DEVIOWorkerThread::MakeDf250WindowRawData ( DParsedEvent pe,
uint32_t  rocid,
uint32_t  slot,
uint32_t  itrigger,
uint32_t *&  iptr 
)
void DEVIOWorkerThread::MakeEvents ( void  )

Make DParsedEvent objects from data currently in buff. This will look at the begining of the EVIO event to see how many L1 events are in it. It will then grab that many DParsedEvent objects from this threads pool , or create new ones and add them all to the current_parsed_events vector. These are then filled out later as the data is parsed.

Definition at line 196 of file DEVIOWorkerThread.cc.

References buff, buff_len, current_parsed_events, event_num, istreamorder, MAX_EVENT_RECYCLES, MAX_OBJECT_RECYCLES, Nrecycled, ParseBank(), parsed_event_pool, Prune(), run_number_seed, and VERBOSE.

Referenced by Run().

void DEVIOWorkerThread::ParseBank ( void  )
void DEVIOWorkerThread::ParseBORbank ( uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::ParseCAEN1190 ( uint32_t  rocid,
uint32_t *&  iptr,
uint32_t *  iend 
)

Parse data from a CAEN 1190 or 1290 module (See ppg. 72-74 of V1290_REV15.pdf manual)

Definition at line 1071 of file DEVIOWorkerThread.cc.

References _DBG_, current_parsed_events, event_count, PARSE_CAEN1290TDC, and VERBOSE.

Referenced by ParseDataBank().

void DEVIOWorkerThread::ParseCDAQBank ( uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::ParseControlEvent ( uint32_t *&  iptr,
uint32_t *  iend 
)

Definition at line 696 of file DEVIOWorkerThread.cc.

References current_parsed_events, and kSTATUS_CONTROL_EVENT.

Referenced by ParseBank().

void DEVIOWorkerThread::ParseDEventRFBunchBank ( uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::ParseDVertexBank ( uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::ParseEPICSbank ( uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::ParseEventTagBank ( uint32_t *&  iptr,
uint32_t *  iend 
)

Definition at line 365 of file DEVIOWorkerThread.cc.

References current_parsed_events.

Referenced by ParseDataBank().

void DEVIOWorkerThread::Parsef125Bank ( uint32_t  rocid,
uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::ParseF1TDCBank ( uint32_t  rocid,
uint32_t *&  iptr,
uint32_t *  iend 
)

Definition at line 1971 of file DEVIOWorkerThread.cc.

References _DBG_, current_parsed_events, F1TDC_channel(), PARSE_F1TDC, and VERBOSE.

Referenced by ParseJLabModuleData().

void DEVIOWorkerThread::Parsef250Bank ( uint32_t  rocid,
uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::Parsef250scalerBank ( uint32_t  rocid,
uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::ParseJLabModuleData ( uint32_t  rocid,
uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::ParseModuleConfiguration ( uint32_t  rocid,
uint32_t *&  iptr,
uint32_t *  iend 
)
Parse a bank of module configuration data. These are configuration values

programmed into the module at the beginning of the run that may be needed in the offline. For example, the number of samples to sum in a FADC pulse integral.

The bank has one or more sections, each describing parameters applicable to a number of modules as indicated by a 24bit slot mask.

This bank should appear only once per DAQ event which, if in multi-event block mode, may have multiple L1 events. The parameters here will apply to all L1 events in the block. This method will put the config objects into each event in current_parsed_events. The config objects are duplicated as needed so each event has its own, indepenent set of config object.

Definition at line 1187 of file DEVIOWorkerThread.cc.

References _DBG_, Df125Config::ABIT, DF1TDCConfig::BINSIZE, current_parsed_events, Df125Config::H, DF1TDCConfig::HSDIV, Df125Config::IBIT, Df125Config::IE, kPARAM125_ABIT, kPARAM125_H, kPARAM125_IBIT, kPARAM125_IE, kPARAM125_NPED, kPARAM125_NPK, kPARAM125_NSA, kPARAM125_NSA_NSB, kPARAM125_NSB, kPARAM125_NW, kPARAM125_P1, kPARAM125_P2, kPARAM125_PBIT, kPARAM125_PG, kPARAM125_PL, kPARAM125_TH, kPARAM125_TL, kPARAM125_WINWIDTH, kPARAM250_NPED, kPARAM250_NSA, kPARAM250_NSA_NSB, kPARAM250_NSB, kPARAMCAEN1290_WINOFFSET, kPARAMCAEN1290_WINWIDTH, kPARAMF1_BINSIZE, kPARAMF1_HSDIV, kPARAMF1_REFCLKDIV, kPARAMF1_REFCNT, kPARAMF1_TRIGLAT, kPARAMF1_TRIGWIN, Df250Config::NPED, Df125Config::NPED, Df125Config::NPK, Df250Config::NSA, Df125Config::NSA, Df250Config::NSA_NSB, Df125Config::NSA_NSB, Df250Config::NSB, Df125Config::NSB, Df125Config::NW, Df125Config::P1, Df125Config::P2, PARSE_CONFIG, Df125Config::PBIT, Df125Config::PG, Df125Config::PL, DF1TDCConfig::REFCLKDIV, DF1TDCConfig::REFCNT, Df125Config::TH, Df125Config::TL, DF1TDCConfig::TRIGLAT, DF1TDCConfig::TRIGWIN, VERBOSE, DCAEN1290TDCConfig::WINOFFSET, DCAEN1290TDCConfig::WINWIDTH, and Df125Config::WINWIDTH.

Referenced by ParseDataBank().

void DEVIOWorkerThread::ParsePhysicsBank ( uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::ParseRawTriggerBank ( uint32_t  rocid,
uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::ParseSSPBank ( uint32_t  rocid,
uint32_t *&  iptr,
uint32_t *  iend 
)

Definition at line 2101 of file DEVIOWorkerThread.cc.

References block_size, current_parsed_events, PARSE_SSP, and VERBOSE.

Referenced by ParseDataBank().

void DEVIOWorkerThread::ParseTIBank ( uint32_t  rocid,
uint32_t *&  iptr,
uint32_t *  iend 
)

Definition at line 1060 of file DEVIOWorkerThread.cc.

Referenced by ParseJLabModuleData().

void DEVIOWorkerThread::ParseTSscalerBank ( uint32_t *&  iptr,
uint32_t *  iend 
)
void DEVIOWorkerThread::Prune ( void  )

Delete any DParsedEvent objects not currently in use. If the DParsedEvent object pool and their internal hit object pools are allowed to continuously grow, it will appear as a though there is a memory leak. Occasional pruning will reduce the average memory footprint. This is called from MakeEvents() every MAX_EVENT_RECYCLES EVIO events processed by this worker thread. Note that this is in EVIO events (i.e. possibly a block of events) not in L1 trigger events.

NOTE: We currently do NOT reduce the size of buff here if it is too big. We may wish to do that at some point!

Definition at line 166 of file DEVIOWorkerThread.cc.

References parsed_event_pool.

Referenced by MakeEvents().

void DEVIOWorkerThread::PublishEvents ( void  )

Copy our "current_parsed_events" pointers into the global "parsed_events" list making them available for consumption.

Definition at line 284 of file DEVIOWorkerThread.cc.

References current_parsed_events, done, event_source, istreamorder, MAX_PARSED_EVENTS, JEventSource_EVIOpp::NPARSER_STALLED, parsed_events, PARSED_EVENTS_CV, and PARSED_EVENTS_MUTEX.

Referenced by Run().

Member Data Documentation

uint32_t* DEVIOWorkerThread::buff
uint32_t DEVIOWorkerThread::buff_len
condition_variable DEVIOWorkerThread::cv

Definition at line 76 of file DEVIOWorkerThread.h.

Referenced by JEventSource_EVIOpp::Dispatcher(), Finish(), and Run().

atomic<bool> DEVIOWorkerThread::done

Definition at line 70 of file DEVIOWorkerThread.h.

Referenced by Finish(), PublishEvents(), and Run().

JEventSource_EVIOpp* DEVIOWorkerThread::event_source

Definition at line 51 of file DEVIOWorkerThread.h.

Referenced by ParseBuiltTriggerBank(), ParseCDAQBank(), and PublishEvents().

atomic<bool> DEVIOWorkerThread::in_use

Definition at line 69 of file DEVIOWorkerThread.h.

Referenced by DEVIOWorkerThread(), JEventSource_EVIOpp::Dispatcher(), and Run().

uint64_t DEVIOWorkerThread::istreamorder

Definition at line 72 of file DEVIOWorkerThread.h.

Referenced by JEventSource_EVIOpp::Dispatcher(), MakeEvents(), and PublishEvents().

JOBTYPE DEVIOWorkerThread::jobtype

Definition at line 71 of file DEVIOWorkerThread.h.

Referenced by DEVIOWorkerThread(), JEventSource_EVIOpp::Dispatcher(), and Run().

bool DEVIOWorkerThread::LINK_CONFIG
bool DEVIOWorkerThread::LINK_TRIGGERTIME
uint64_t DEVIOWorkerThread::MAX_EVENT_RECYCLES
uint64_t DEVIOWorkerThread::MAX_OBJECT_RECYCLES
uint32_t& DEVIOWorkerThread::MAX_PARSED_EVENTS

Definition at line 53 of file DEVIOWorkerThread.h.

Referenced by PublishEvents().

mutex DEVIOWorkerThread::mtx

Definition at line 75 of file DEVIOWorkerThread.h.

Referenced by Run().

uint64_t DEVIOWorkerThread::Nrecycled

Definition at line 65 of file DEVIOWorkerThread.h.

Referenced by DEVIOWorkerThread(), and MakeEvents().

bool DEVIOWorkerThread::PARSE_BOR
bool DEVIOWorkerThread::PARSE_CAEN1290TDC
bool DEVIOWorkerThread::PARSE_CONFIG
bool DEVIOWorkerThread::PARSE_EPICS
bool DEVIOWorkerThread::PARSE_EVENTTAG
bool DEVIOWorkerThread::PARSE_F125
bool DEVIOWorkerThread::PARSE_F1TDC
bool DEVIOWorkerThread::PARSE_F250
bool DEVIOWorkerThread::PARSE_SSP
bool DEVIOWorkerThread::PARSE_TRIGGER
vector<DParsedEvent*> DEVIOWorkerThread::parsed_event_pool

Definition at line 59 of file DEVIOWorkerThread.h.

Referenced by MakeEvents(), Prune(), Run(), and ~DEVIOWorkerThread().

list<DParsedEvent*>& DEVIOWorkerThread::parsed_events

Definition at line 52 of file DEVIOWorkerThread.h.

Referenced by PublishEvents().

condition_variable& DEVIOWorkerThread::PARSED_EVENTS_CV

Definition at line 55 of file DEVIOWorkerThread.h.

Referenced by PublishEvents().

mutex& DEVIOWorkerThread::PARSED_EVENTS_MUTEX

Definition at line 54 of file DEVIOWorkerThread.h.

Referenced by PublishEvents().

streampos DEVIOWorkerThread::pos

Definition at line 81 of file DEVIOWorkerThread.h.

Referenced by JEventSource_EVIOpp::Dispatcher().

set<uint32_t>& DEVIOWorkerThread::ROCIDS_TO_PARSE

Definition at line 56 of file DEVIOWorkerThread.h.

Referenced by ParseDataBank().

uint64_t DEVIOWorkerThread::run_number_seed
thread DEVIOWorkerThread::thd

Definition at line 77 of file DEVIOWorkerThread.h.

Referenced by Finish().


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