#ifndef __JDAQEVALUATOR__ #define __JDAQEVALUATOR__ #include "km3net-dataformat/online/JDAQUTCExtended.hh" #include "km3net-dataformat/online/JDAQHeader.hh" #include "km3net-dataformat/online/JDAQEvent.hh" /** * \author mdejong */ namespace KM3NETDAQ { /** * Auxiliary class to determine value of DAQ objects. */ struct JDAQEvaluator { /** * Default constructor. */ JDAQEvaluator() {} /** * Get value of object. * * \param object UTC time * \return value */ inline double operator()(const JDAQUTCExtended& object) const { return getTimeDifference(getUTC(), object) * 1.0e-9; } /** * Get value of object. * * \param object event * \return value */ inline double operator()(const JDAQHeader& object) const { return(*this)(object.getTimesliceStart()); } /** * Get value of event. * * \param object event * \return value */ inline double operator()(const JDAQEvent& object) const { return getTimeDifference(getUTC(), object.getTimesliceStart()) * 1.0e-9 + object.getCounter() * getWeight(); } /** * Get relative weight for JDAQEvent evaluation. * * This value should be less than the ratio of * the expected maximum number of events in a single data taking run and * the frame duration in units of nano seconds. * * \return weigth [ns] */ static double getWeight() { return 1.0e-6; // [ns] } /** * Get arbitrary offset. * * \return UTC time */ static const JDAQUTCExtended& getUTC() { static JDAQUTCExtended utc(1600000000, 0); return utc; } }; /** * Function object for evaluation of DAQ objects. */ static const JDAQEvaluator getDAQValue; } #endif