18 #include "TObjArray.h"
39 fiRetryCnt(par->GetRetryCnt()),
40 fxEvent(0), fxBuffer(0), fxInfoHeader(0),
41 fbIsOpen(kFALSE), fbDataCopyMode(kFALSE),
42 fuEventCounter(0), fbFirstEvent(kTRUE),
43 fuStartEvent(par->GetStartEvent()) ,
44 fuStopEvent(par->GetStopEvent()),
45 fuEventInterval(par->GetEventInterval()),
46 fiTimeout(par->GetTimeout()),
47 fiPort(par->GetPort())
50 GO4TRACE((15,
"TGo4MbsSource::TGo4MbsSource(const char*, Int_t)",__LINE__, __FILE__));
60 fxEvent(0), fxBuffer(0), fxInfoHeader(0),
61 fbIsOpen(kFALSE), fbDataCopyMode(kFALSE),
62 fuEventCounter(0), fbFirstEvent(kTRUE),
63 fuStartEvent(0) ,fuStopEvent(0), fuEventInterval(0),
64 fiTimeout(-1), fiPort(0)
67 GO4TRACE((15,
"TGo4MbsSource::TGo4MbsSource(const char*, Int_t)",__LINE__, __FILE__));
80 fxEvent(0), fxBuffer(0), fxInfoHeader(0),
81 fbIsOpen(kFALSE), fbDataCopyMode(kFALSE),
82 fuEventCounter(0), fbFirstEvent(kTRUE),
83 fuStartEvent(0) ,fuStopEvent(0), fuEventInterval(0),
84 fiTimeout(-1), fiPort(0)
87 GO4TRACE((15,
"TGo4MbsSource::TGo4MbsSource()",__LINE__, __FILE__));
92 GO4TRACE((15,
"TGo4MbsSource::~TGo4MbsSource()",__LINE__, __FILE__));
108 return cl->InheritsFrom(TGo4MbsEvent::Class());
126 GO4TRACE((12,
"TGo4MbsSource::BuildMbsEvent(TGo4MbsEvent*)",__LINE__, __FILE__));
137 std::cout << std::endl;
141 Char_t* endofevent = (Char_t*) (
fxEvent) +
155 Char_t* subevtpointer;
159 Int_t totalsubdatalength=0;
165 Int_t datalength = 0;
167 while((datalength = subevent->
l_dlen) >0 ) {
168 totalsubdatalength+=datalength-2+
sizeof(
s_ves10_1)/
sizeof(Short_t);
175 Int_t * subeventid= (Int_t *) (subevent) + 2;
177 Short_t* data = (Short_t*) (subevent+1);
181 subevtpointer = (Char_t*) (subevent) +
184 if ((Char_t*) subevent >= endofevent) {
197 SetErrMess(
"!!! BuildMbsEvent: -- NO SUBEVENTS!!!");
213 Short_t* data = (Short_t*) (eventfourone+1);
214 Int_t datalength=eventfourone->
l_dlen+2;
222 SetErrMess(
"!!! BuildMbsEvent: -- NO Data in event 4,1!!!");
250 GO4TRACE((12,
"TGo4MbsSource::NextEvent()",__LINE__, __FILE__));
275 while (eventstep > 0) {
290 SetErrMess(Form(
"%s name:%s", buffer, GetName()));
312 gSystem->Sleep(1000);
319 printf(
"Retry %d successful\n", cnt);
325 printf(
"Retry %d failed\n", cnt);
341 GO4TRACE((12,
"TGo4MbsSource::Open()",__LINE__, __FILE__));
348 strncpy(name, GetName(),
sizeof(name));
351 char* separ = strrchr(name,
':');
353 if ((sscanf(separ+1,
"%d",&nport)==1) && (nport>0)) {
365 SetErrMess(Form(
"%s name:%s port:%d", buffer, name, nport));
382 SetErrMess(Form(
"%s name:%s", buffer, GetName()));
386 TGo4Log::Debug(
" Mbs Source -- opened input from type %d: %s . Timeout=%d s",
395 GO4TRACE((12,
"TGo4MbsSource::Close()",__LINE__, __FILE__));
void SetCount(Int_t count)
TGo4MbsSubEvent * AddSubEvent(Int_t fullID, Short_t *source, Int_t datalength, Bool_t copydata=kFALSE)
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 * fxInputChannel
INTS4 f_evt_get_close(s_evt_channel *ps_chan)
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_timeout(s_evt_channel *ps_chan, INTS4 l_sec)
void SetCreateStatus(Int_t status)
const char * GetErrMess() const
s_evt_channel * f_evt_control()
static void Warn(const char *text,...)
virtual Bool_t CheckEventClass(TClass *cl)
INTS4 f_evt_source_port(INTS4 l_port)
INTS4 f_evt_error(INTS4 l_error, CHARS *pc_dest, INTS4 l_out)
CHARS * f_evt_get_buffer_ptr(s_evt_channel *ps_chan)
virtual Int_t NextEvent()
void BuildMbsEvent(TGo4MbsEvent *target)
void SetErrMess(const char *txt)
Int_t GetMode() const
number of allowed reconnect retries
void SetTimeout(Int_t time)
void SetSubtype(Short_t subtype)
Int_t GetCreateStatus() const
void SetDummy(Short_t dummy)
static const UInt_t fguLONGBYCHAR
void SetType(Short_t type)
static const UInt_t fguSHORTBYCHAR
static const UInt_t fguEVHEBYCHAR
static const Int_t fgiTIMEOUTDEFAULT
void SetType(Short_t type)
Int_t GetEventStatus() const
void SetEventStatus(Int_t status)
void SetPrintEvent(Int_t num=1, Int_t sid=-1, Int_t longw=1, Int_t hexw=1, Int_t dataw=0)
virtual Bool_t BuildEvent(TGo4EventElement *dest)
virtual s_bufhe * GetBufferHeader()
INTS4 f_evt_get_event(s_evt_channel *ps_chan, INTS4 **ppl_buffer, INTS4 **ppl_goobuf)
TGo4MbsSubEvent * BuildMbsSubEvent(TGo4MbsEvent *target, Int_t fullID, Short_t *source, Int_t datalength)
void SetSubtype(Short_t subtype)
static void Error(const char *text,...)
TGo4MbsSourcePrintPar fxPrEventPar
static void Info(const char *text,...)
static const UInt_t fguLONGBYSHORT
void SetTrigger(Short_t trigger)
static void Debug(const char *text,...)