Belle II Software development
TOPCalTimebase.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <top/dbobjects/TOPSampleTimes.h>
12
13#include <TObject.h>
14
15#include <map>
16#include <vector>
17
18namespace Belle2 {
27 class TOPCalTimebase: public TObject {
28 public:
29
34 {}
35
40 explicit TOPCalTimebase(double syncTimeBase): m_syncTimeBase(syncTimeBase)
41 {}
42
46 TOPCalTimebase(const TOPCalTimebase& timeBase): TObject()
47 {
48 *this = timeBase;
49 m_map.clear();
50 m_sampleTime = 0;
51 }
52
57 {
58 if (this != &timeBase) {
60 m_sampleTimes = timeBase.getSampleTimes();
61 m_map.clear();
62 if (m_sampleTime) delete m_sampleTime;
63 m_sampleTime = 0;
64 }
65 return *this;
66 }
67
72 {
73 if (m_sampleTime) delete m_sampleTime;
74 }
75
83 void append(unsigned scrodID, unsigned channel,
84 const std::vector<double>& sampleTimes,
85 bool replace = true);
86
91 double getSyncTimeBase() const {return m_syncTimeBase;}
92
97 const std::vector<TOPSampleTimes>& getSampleTimes() const {return m_sampleTimes;}
98
106 const TOPSampleTimes* getSampleTimes(unsigned scrodID, unsigned channel) const;
107
108
115 bool isAvailable(unsigned scrodID, unsigned channel) const;
116
117
118 private:
119
123 void createMap() const;
124
125 double m_syncTimeBase = 0;
126 std::vector<TOPSampleTimes> m_sampleTimes;
129 mutable std::map<unsigned, size_t> m_map;
130
133
136 };
137
139} // end namespace Belle2
140
Sample time calibration constants for all channels.
TOPCalTimebase()
Default constructor.
TOPSampleTimes * m_sampleTime
cache for default (equidistant) sample times
~TOPCalTimebase()
Destructor.
double m_syncTimeBase
synchronization time base (width of 2 ASIC windows)
TOPCalTimebase & operator=(const TOPCalTimebase &timeBase)
Assignment operator.
double getSyncTimeBase() const
Returns sinchronization time base (width of 2 ASIC windows)
ClassDef(TOPCalTimebase, 1)
ClassDef.
std::vector< TOPSampleTimes > m_sampleTimes
calibration constants
TOPCalTimebase(const TOPCalTimebase &timeBase)
Copy constructor (since class includes pointers in its cache)
const std::vector< TOPSampleTimes > & getSampleTimes() const
Returns all calibration constants.
TOPCalTimebase(double syncTimeBase)
Useful constructor.
std::map< unsigned, size_t > m_map
cache for a map
Calibration constants of a singe ASIC channel: time axis (sample times)
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.
void createMap() const
Creates a map in cache.
Abstract base class for different kinds of events.