9 #include <top/dbobjects/TOPCalTimebase.h>
10 #include <framework/logging/Logger.h>
21 typedef map<unsigned, size_t>::const_iterator
Iterator;
24 void TOPCalTimebase::append(
unsigned scrodID,
unsigned channel,
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()) {
42 m_sampleTimes.push_back(
TOPSampleTimes(scrodID, channel, m_syncTimeBase));
43 m_sampleTimes.back().setTimeAxis(sampleTimes, m_syncTimeBase);
44 m_map[key] = m_sampleTimes.size() - 1;
47 m_sampleTimes[it->second].setTimeAxis(sampleTimes, m_syncTimeBase);
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()) {
69 if (!m_sampleTime) m_sampleTime =
new TOPSampleTimes(0, 0, m_syncTimeBase);
72 return &m_sampleTimes[it->second];
76 bool TOPCalTimebase::isAvailable(
unsigned scrodID,
unsigned channel)
const
80 unsigned key = (scrodID << 16) + (channel % 128);
82 return (it != m_map.end());
89 for (
size_t i = 0; i < m_sampleTimes.size(); i++) {
90 const auto& sampleTime = m_sampleTimes[i];
91 unsigned key = (sampleTime.getScrodID() << 16) + sampleTime.getChannel();
95 B2DEBUG(29,
"TOPCalTimebase: map created, size = " << m_map.size());
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.
map< unsigned, size_t >::const_iterator Iterator
Iteratior for m_map.
i2dMap createMap(int nEntries, Functor funct)
create a multimap with
Abstract base class for different kinds of events.