26 dabc::DataInput (), fURL (url), fNumEvents(0)
29 DOUT2 (
"Created new user::Input\n");
40 if(
fDebug)
DOUT0 (
"Created new user::Input with read length %d, crate:%d, procid:%d, control:%d\n",
54 DOUT1 (
"Read_Init is executed...");
55 if(User_Init()!=0)
return false;
69 return ( GetReadLength ());
81 int trigtype=User_WaitForTrigger ();
85 EOUT((
"**** Timout of trigger, retry dabc request.. \n"));
88 if(fEarlyTriggerClear) User_ResetTrigger ();
96 iter.
NewSubevent(fSubeventSize, fSubeventSubcrate, fSubeventControl, fSubeventProcid);
97 uint32_t* pldat = (uint32_t*) iter.
rawdata();
98 unsigned long subsize=0;
99 int res = User_Readout(pldat, subsize);
101 if(!fEarlyTriggerClear) User_ResetTrigger ();
108 if(fDebug)
DOUT1 (
"user::Input() returns with timeout\n");
113 EOUT(
"user::Input() returns with Error\n");
119 EOUT(
"user::Input() could not finish subevent with size:%d\n",subsize);
124 EOUT(
"user::Input() could not finish event \n");
130 if(fNumEvents % 10000 ==0)
132 DOUT0 (
"UserReadout has send %d events to input, last size:%d, return value:%d, total buffers size:%d\n",
137 return (
unsigned) res;
149 DOUT0(
"Executing User_Init() function for crate:%d, procid:%d, control:%d",
150 fSubeventSubcrate, fSubeventProcid, fSubeventControl);
158 DOUT0(
"Executing User_Cleanup() function");
179 unsigned numval = 100;
180 for (
unsigned nval=0;nval<numval;nval++)
182 if(size>=fSubeventSize)
184 DOUT0(
"User_Readout: data would exceed subevent size %d ,please adjust setup",fSubeventSize);
187 *pdat++ = (uint32_t)
Gauss_Rnd(nval*500 + 1000, 500./(nval+1));
188 size+=
sizeof(uint32_t);
199 z = 1.* rand() / RAND_MAX;
200 y = 1.* rand() / RAND_MAX;
201 x = z * 6.28318530717958623;
202 return mean + sigma*sin(x)*sqrt(-2*log(y));
Reference on memory from memory pool.
BufferSize_t GetTotalSize() const
Return total size of all buffer segments.
void SetTypeId(unsigned tid)
Represents command with its arguments.
Uniform Resource Locator interpreter.
bool HasOption(const std::string &optname) const
int GetOptionInt(const std::string &optname, int dflt=0) const
Reference on dabc::Worker
Write iterator for MBS events/subevents.
bool FinishSubEvent(uint32_t rawdatasz=0)
bool NewSubevent(uint32_t minrawsize=0, uint8_t crate=0, uint16_t procid=0, uint8_t control=0)
bool NewEvent(EventNumType event_number=0, uint32_t subeventsize=0)