Belle II Software  release-06-01-15
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 /* Belle 2 headers. */
15 #include <framework/database/DBObjPtr.h>
16 #include <framework/dbobjects/HardwareClockSettings.h>
17 
18 namespace Belle2 {
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 
63  double getScintillatorTime(int ctime, int triggerCTime) const;
64 
71  std::pair<int, double> getRPCTimes(int ctime, int tdc, int triggerTime) const;
72 
78  double getTimeSimulation(int tdc, bool scintillator) const;
79 
83  uint16_t getTDCByTime(double time) const;
84 
85  private:
86 
91  {
92  }
93 
98  {
99  }
100 
103 
106 
111  double m_TDCPeriod = 0.;
112 
114  double m_CTimePeriod = 0.;
115 
116  };
117 
119 }
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
KLM time conversion.
Definition: KLMTime.h:27
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:111
std::pair< int, double > getRPCTimes(int ctime, int tdc, int triggerTime) const
Get coarse and fine times for RPC.
Definition: KLMTime.cc:47
double getTimeSimulation(int tdc, bool scintillator) const
Get time for simulation.
Definition: KLMTime.cc:67
uint16_t getTDCByTime(double time) const
Get TDC by time.
Definition: KLMTime.cc:74
double getTDCPeriod() const
Get TDC period.
Definition: KLMTime.h:45
double m_CTimePeriod
CTIME period.
Definition: KLMTime.h:114
~KLMTime()
Destructor.
Definition: KLMTime.h:97
double getScintillatorTime(int ctime, int triggerCTime) const
Get time for scintillator.
Definition: KLMTime.cc:27
void updateConstants()
Update constants from database objects.
Definition: KLMTime.cc:20
static KLMTime & Instance()
Instantiation.
Definition: KLMTime.cc:14
KLMTime()
Constructor.
Definition: KLMTime.h:90
DBObjPtr< HardwareClockSettings > m_HardwareClockSettings
Hardware clock settings.
Definition: KLMTime.h:105
DBObjPtr< KLMTimeConversion > m_KLMTimeConversion
KLM time conversion.
Definition: KLMTime.h:102
Abstract base class for different kinds of events.