-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.159 2012-02-22 15:05:20 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.160 2012-03-07 14:35:23 hadaq Exp $";
#define _POSIX_C_SOURCE 199309L
#define SYSLOG_NAMES
} else {
if (lastTrigNr) {
/* check how many events we did lose since last complete one: */
- (*theStats->evtsDiscarded) += currTrigNr - lastTrigNr;
+ uint32_t delta;
+ delta = 1;
+ if (currTrigNr > lastTrigNr)
+ delta = currTrigNr - lastTrigNr;
+ if (delta > 16)
+ delta = delta / 16;
+ else if (delta > 8)
+ delta = delta / 8;
+ else if (delta > 4)
+ delta = delta / 4;
+ /* worst case estimation for a n eventbuilder setup
+ * offset between trigger numbers should be # active EBs
+ * the error is underestimated such most likely...*/
+
+
+
+ (*theStats->evtsDiscarded) += delta;
/*sprintf(msglog, "<I> Discarded %d events at TrigNr: 0x%06x", currTrigNr - lastTrigNr, currTrigNr);
storeLogInfo(theArgs, msglog); */
lastTrigNr = 0;