9#include <top/dbobjects/TOPCalTimebase.h>
10#include <framework/logging/Logger.h>
21 typedef map<unsigned, size_t>::const_iterator
Iterator;
25 const vector<double>& sampleTimes,
29 for (
double t : sampleTimes) {
31 B2ERROR(
"TOPCalTimebase::append: sampleTimes contain NaN's - constants rejected."
32 <<
LogVar(
"scrodID", scrodID)
33 <<
LogVar(
"channel", channel));
39 unsigned key = (scrodID << 16) + (channel % 128);
41 if (it ==
m_map.end()) {
48 B2WARNING(
"TOPCalTimebase::append: constants replaced."
49 <<
LogVar(
"scrodID", scrodID)
50 <<
LogVar(
"channel", channel));
52 B2WARNING(
"TOPCalTimebase::append old constants kept."
53 <<
LogVar(
"scrodID", scrodID)
54 <<
LogVar(
"channel", channel));
62 unsigned channel)
const
66 unsigned key = (scrodID << 16) + (channel % 128);
68 if (it ==
m_map.end()) {
80 unsigned key = (scrodID << 16) + (channel % 128);
82 return (it !=
m_map.end());
91 unsigned key = (sampleTime.getScrodID() << 16) + sampleTime.getChannel();
95 B2DEBUG(29,
"TOPCalTimebase: map created, size = " <<
m_map.size());
TOPSampleTimes * m_sampleTime
cache for default (equidistant) sample times
double m_syncTimeBase
synchronization time base (width of 2 ASIC windows)
std::vector< TOPSampleTimes > m_sampleTimes
calibration constants
const std::vector< TOPSampleTimes > & getSampleTimes() const
Returns all calibration constants.
std::map< unsigned, size_t > m_map
cache for a map
Calibration constants of a singe ASIC channel: time axis (sample times)
Class to store variables with their name which were sent to the logging service.
bool isAvailable(unsigned scrodID, unsigned channel) const
Checks if calibration is available.
void append(unsigned scrodID, unsigned channel, const std::vector< double > &sampleTimes, bool replace=true)
Appends calibration of a single ASIC channel.
map< unsigned, size_t >::const_iterator Iterator
Iteratior for m_map.
void createMap() const
Creates a map in cache.
Abstract base class for different kinds of events.