53 GO4TRACE((15,
"TGo4MbsSource::TGo4MbsSource(const char *, Int_t)",__LINE__, __FILE__));
69 GO4TRACE((15,
"TGo4MbsSource::TGo4MbsSource(const char *, Int_t)",__LINE__, __FILE__));
88 GO4TRACE((15,
"TGo4MbsSource::TGo4MbsSource()",__LINE__, __FILE__));
93 GO4TRACE((15,
"TGo4MbsSource::~TGo4MbsSource()",__LINE__, __FILE__));
114 return cl->InheritsFrom(TGo4MbsEvent::Class());
132 GO4TRACE((12,
"TGo4MbsSource::BuildMbsEvent(TGo4MbsEvent *)",__LINE__, __FILE__));
143 std::cout << std::endl;
147 Char_t *endofevent = (Char_t *) (
fxEvent) +
160 Char_t *subevtpointer;
164 Int_t totalsubdatalength = 0;
170 Int_t datalength = 0;
172 while((datalength = subevent->
l_dlen) > 0) {
173 totalsubdatalength+=datalength-2+
sizeof(
s_ves10_1)/
sizeof(Short_t);
174 if(datalength>
fxEvent->l_dlen) {
175 TGo4Log::Debug(
" !!! MbsSource -- SUBEVENTS LENGTH mismatch!!! skipping event #%d",
fxEvent->l_count);
180 Int_t *subeventid= (Int_t *) (subevent) + 2;
182 Short_t *data = (Short_t *) (subevent+1);
186 subevtpointer = (Char_t*) (subevent) +
189 if ((Char_t*) subevent >= endofevent) {
194 if(totalsubdatalength!=
fxEvent->l_dlen-4) {
195 TGo4Log::Debug(
" !!! MbsSource -- SUBEVENTS TOTAL LENGTH mismatch!!! disabling event #%d",
fxEvent->l_count);
202 SetErrMess(
"!!! BuildMbsEvent: -- NO SUBEVENTS!!!");
217 Int_t subeventid = 4;
218 Short_t *data = (Short_t *) (eventfourone+1);
219 Int_t datalength = eventfourone->
l_dlen+2;
227 SetErrMess(
"!!! BuildMbsEvent: -- NO Data in event 4,1!!!");
261 GO4TRACE((12,
"TGo4MbsSource::NextEvent()",__LINE__, __FILE__));
287 while (eventstep > 0) {
297 if(status != 0)
break;
309 SetErrMess(TString::Format(
"%s name:%s", buffer, GetName()).Data());
325 gSystem->Sleep(1000);
332 printf(
"Retry %d successful\n", cnt);
338 printf(
"Retry %d failed\n", cnt);
349 GO4TRACE((12,
"TGo4MbsSource::Open()",__LINE__, __FILE__));
355 strncpy(name, GetName(),
sizeof(name) - 1);
358 char *separ = strrchr(name,
':');
360 if ((sscanf(separ+1,
"%d",&nport)==1) && (nport>0)) {
372 SetErrMess(TString::Format(
"%s name:%s port:%d", buffer, name, nport).Data());
390 SetErrMess(TString::Format(
"%s name:%s", buffer, GetName()).Data());
394 TGo4Log::Debug(
" Mbs Source -- opened input from type %d: %s . Timeout=%d s",
407 GO4TRACE((12,
"TGo4MbsSource::Close()",__LINE__, __FILE__));
void HandleAnlysisEvents()
static TGo4Analysis * Instance()
return analysis instance
void ProcessEvents()
Method should be called to process extra events in the analysis thread context.
The abstract base class for the data elements of which the unpacked events (or detector structure dat...
void SetValid(Bool_t on)
Switches the valid state of this event.
Exception to throw on event source timeout.
Exception to be thrown on error of event source.
static const Int_t fgiTIMEOUTDEFAULT
Default timeout in seconds for event input.
void SetErrMess(const char *txt)
To be used for modification of the message by the event source implementation.
void SetEventStatus(Int_t status)
Status of the last event.
const char * GetErrMess() const
Status/ error message of the last event.
Int_t GetEventStatus() const
Status of the last event.
Int_t GetCreateStatus() const
Status value of server/file open.
void SetCreateStatus(Int_t status)
Status value of event source init (file/server open).
Exception to throw on event source timeout.
static void Warn(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 2.
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.
static void Debug(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 0.
Wrapper for the standard gsi event structure as delivered from mbs.
void SetSubtype(Short_t subtype)
TGo4MbsSubEvent * AddSubEvent(Int_t fullID, Short_t *source, Int_t datalength, Bool_t copydata=kFALSE)
Add new subevent to mbs event.
void SetDummy(Short_t dummy)
void SetCount(Int_t count)
void SetTrigger(Short_t trigger)
void SetType(Short_t type)
Int_t fiMode
Mode of operation.
Bool_t BuildEvent(TGo4EventElement *dest) override
Fill the destination event.
static void SetPollingMode(Bool_t on=kTRUE)
s_evt_channel * fxInputChannel
Event channel structure used by event source.
Bool_t fbDataCopyMode
switches buildmbs event mode: if true, data buffer is copied to own buffer of subevent.
Bool_t CheckEventClass(TClass *cl) override
Check that filled event is a proper class.
static const UInt_t fguSHORTBYCHAR
ratio sizeof(short) by sizeof(char).
ULong_t fuStopEvent
Index of last event to process.
Int_t fiTimeout
Timeout in seconds for mbs getevent.
void SetPrintEvent(Int_t num=1, Int_t sid=-1, Int_t longw=1, Int_t hexw=1, Int_t dataw=0)
Set mbs source into printout (verbose) mode for the next num events.
ULong_t fuStartEvent
Index of first event to process.
virtual s_bufhe * GetBufferHeader()
User access to current event buffer header.
TGo4MbsSubEvent * BuildMbsSubEvent(TGo4MbsEvent *target, Int_t fullID, Short_t *source, Int_t datalength)
Auxiliary function to fill datalength words (Short_t) from source into the next subevent of target wi...
Bool_t fbFirstEvent
Indicates if first event should be extracted.
virtual Int_t Close()
Close the file or connection.
void BuildMbsEvent(TGo4MbsEvent *target)
This methods actually fills the target event class which is passed as pointer.
virtual Int_t NextEvent()
Requests the next event from mbs source.
static const UInt_t fguEVHEBYCHAR
ratio sizeof(s_evhe) by sizeof(char).
TGo4MbsSourcePrintPar fxPrEventPar
This structure keeps parameters for printevent mode.
ULong_t fuEventCounter
Current event index counter.
TGo4MbsSource()
default for streamer
static const UInt_t fguLONGBYCHAR
ratio sizeof(long) by sizeof(char).
void SetTimeout(Int_t time)
static const UInt_t fguLONGBYSHORT
ratio sizeof(long) by sizeof(short).
ULong_t fuEventInterval
Number of events to skip from file in between two read events.
s_filhe * fxInfoHeader
Reference to header info delivered by source.
s_bufhe * fxBuffer
Points to the current gsi buffer structure filled by the event source.
Int_t GetMode() const
number of allowed reconnect retries
Int_t fiPort
if true, use short timeout to keep gSystem->ProcessEvents() running
static Bool_t gbPollingMode
virtual Int_t Open()
Open the file or connection.
Subevent class for gsi mbs data.
void SetSubtype(Short_t subtype)
void SetType(Short_t type)
INTS4 f_evt_type(s_bufhe *ps_bufhe, s_evhe *ps_evhe, INTS4 l_subid, INTS4 l_long, INTS4 l_hex, INTS4 l_data)
s_evt_channel * f_evt_control(void)
INTS4 f_evt_get_open(INTS4 l_mode, CHARS *pc_server, s_evt_channel *ps_chan, CHARS **ps_info, INTS4 l_sample, INTS4 l_param)
INTS4 f_evt_error(INTS4 l_error, CHARS *pc_dest, INTS4 l_out)
CHARS * f_evt_get_buffer_ptr(s_evt_channel *ps_chan)
INTS4 f_evt_get_close(s_evt_channel *ps_chan)
INTS4 f_evt_timeout(s_evt_channel *ps_chan, INTS4 l_sec)
INTS4 f_evt_get_event(s_evt_channel *ps_chan, INTS4 **ppl_buffer, INTS4 **ppl_goobuf)
INTS4 f_evt_source_port(INTS4 l_port)