//============================================================================ /*! \file QuickDaqStats.cxx * \author W.F.J.Mueller/GSI */ //============================================================================ #include "boost/format.hpp" #include "nxyter/QuickDaqStats.h" using boost::format; /*! * \class nxyter::QuickDaqStats * \brief Set of statistic counters for QuickDaq environment * */ //---------------------------------------------------------------------------- //! Constructor, clears all counters. nxyter::QuickDaqStats::QuickDaqStats() : fStats(kDimDaqStat) // allocate vector { } //---------------------------------------------------------------------------- //! Copy constructor. nxyter::QuickDaqStats::QuickDaqStats(const QuickDaqStats& obj) : fStats(obj.fStats) // allocate and copy vector { } //---------------------------------------------------------------------------- nxyter::QuickDaqStats::~QuickDaqStats() { } //---------------------------------------------------------------------------- //! Clear all counters. void nxyter::QuickDaqStats::clear() { for (int i=0; i=0 && ind=kNSysMesNxParErr0 && i<=kNSysMesSyncParErr1); bool show; switch (lvl) { case kPrintAll: show = true; break; case kPrintNonZero: show = (i==0 || fStats[i] != 0); break; case kPrintError: show = errorcounter && fStats[i] != 0; break; } if (show) { os << fmt_stat % i % counterName(i) % fStats[i]; if (dtime>0.) { double rate = fStats[i] / dtime; const char* unit = " Hz"; if (rate >= 1000.) { rate = rate / 1000.; unit = "kHz"; } os << " " << fmt_rate % rate; os << " " << unit; } if (errorcounter && fStats[i] != 0) { os << " <== ERRORS!!"; } os << std::endl; } } } //---------------------------------------------------------------------------- //! Returns name for counter with index \a ind (or "" if undefined). const char* nxyter::QuickDaqStats::counterName(int ind) { switch(ind) { case kNMessage: return "messages received"; case kNNop: return "nop messages"; case kNHit: return "nXYTER hits received"; case kNHitPileup: return "hits with pileup"; case kNHitOverflow: return "hits with overflow"; case kNHitNx0: return "hits hits on nx:0"; case kNHitNx1: return "hits hits on nx:1"; case kNHitNx2: return "hits hits on nx:2"; case kNHitNx3: return "hits hits on nx:3"; case kNEpoch: return "epoch markers"; case kNEpochWithMiss: return "epochs with missed hits"; case kNMissedHit: return "missed hits (low bound)"; case kNSync0: return "sync0 messages"; case kNSync1: return "sync1 messages"; case kNAux0: return "aux0 messages"; case kNaux1: return "aux1 messages"; case kNAux2: return "aux2 messages"; case kNAux3: return "aux3 messages"; case kNAuxOverflow: return "aux with pileup"; case kNSysMesNxParErr0: return "nx:0 parity errors"; case kNSysMesNxParErr1: return "nx:1 parity errors"; case kNSysMesNxParErr2: return "nx:2 parity errors"; case kNSysMesNxParErr3: return "nx:3 parity errors"; case kNSysMesSyncParErr0:return "sync0 parity errors"; case kNSysMesSyncParErr1:return "sync1 parity errors"; case kNSysMesDaqRes: return "daq resume messages"; case kNSysMesFifoReset: return "fifo reset messages"; case kNSysMesOther: return "other system messages"; case kNEpoch2: return "epoch2 markers"; case kNGet4Hit: return "Get4 hits"; case kNGet4Event: return "Get4 events"; case kNOther: return "other message types"; } return ""; }