Belle II Software development
KLMTime.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/* KLM headers. */
12#include <klm/dbobjects/KLMTimeConversion.h>
13
14/* Basf2 headers. */
15#include <framework/database/DBObjPtr.h>
16#include <framework/dbobjects/HardwareClockSettings.h>
17
18namespace Belle2 {
23
27 class KLMTime {
28
29 public:
30
34 static KLMTime& Instance();
35
40 void updateConstants();
41
45 double getTDCPeriod() const
46 {
47 return m_TDCPeriod;
48 }
49
53 double getCTimePeriod() const
54 {
55 return m_CTimePeriod;
56 }
57
64 double getScintillatorTime(int ctime, int tdc, int triggerCTime) const;
65
73 std::pair<int, double> getRPCTimes(int ctime, int tdc, int triggerTime) const;
74
80 double getTimeSimulation(int tdc, bool scintillator) const;
81
85 uint16_t getTDCByTime(double time) const;
86
87 private:
88
93 {
94 }
95
100 {
101 }
102
105
108
113 double m_TDCPeriod = 0.;
114
116 double m_CTimePeriod = 0.;
117
119 static const int FRAME9_MAX = 11520;
120
121 };
122
124}
Class for accessing objects in the database.
Definition DBObjPtr.h:21
double getCTimePeriod() const
Get CTIME period.
Definition KLMTime.h:53
double m_TDCPeriod
TDC period (stored here because getting it from m_HardwareClockSettings requires to search in a map).
Definition KLMTime.h:113
std::pair< int, double > getRPCTimes(int ctime, int tdc, int triggerTime) const
Get coarse and fine times for RPC.
Definition KLMTime.cc:46
double getTimeSimulation(int tdc, bool scintillator) const
Get time for simulation.
Definition KLMTime.cc:78
double getScintillatorTime(int ctime, int tdc, int triggerCTime) const
Get time for scintillator.
Definition KLMTime.cc:27
uint16_t getTDCByTime(double time) const
Get TDC by time.
Definition KLMTime.cc:85
double getTDCPeriod() const
Get TDC period.
Definition KLMTime.h:45
double m_CTimePeriod
CTIME period.
Definition KLMTime.h:116
~KLMTime()
Destructor.
Definition KLMTime.h:99
void updateConstants()
Update constants from database objects.
Definition KLMTime.cc:20
static KLMTime & Instance()
Instantiation.
Definition KLMTime.cc:14
static const int FRAME9_MAX
RPC Frame9 Clock Counter from 0 to 11519, then resets.
Definition KLMTime.h:119
KLMTime()
Constructor.
Definition KLMTime.h:92
DBObjPtr< HardwareClockSettings > m_HardwareClockSettings
Hardware clock settings.
Definition KLMTime.h:107
DBObjPtr< KLMTimeConversion > m_KLMTimeConversion
KLM time conversion.
Definition KLMTime.h:104
Abstract base class for different kinds of events.