Belle II Software  release-08-01-10
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 
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 
64  double getScintillatorTime(int ctime, int tdc, int triggerCTime) const;
65 
72  std::pair<int, double> getRPCTimes(int ctime, int tdc, int triggerTime) const;
73 
79  double getTimeSimulation(int tdc, bool scintillator) const;
80 
84  uint16_t getTDCByTime(double time) const;
85 
86  private:
87 
92  {
93  }
94 
99  {
100  }
101 
104 
107 
112  double m_TDCPeriod = 0.;
113 
115  double m_CTimePeriod = 0.;
116 
117  };
118 
120 }
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:112
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:66
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:73
double getTDCPeriod() const
Get TDC period.
Definition: KLMTime.h:45
double m_CTimePeriod
CTIME period.
Definition: KLMTime.h:115
~KLMTime()
Destructor.
Definition: KLMTime.h:98
void updateConstants()
Update constants from database objects.
Definition: KLMTime.cc:20
static KLMTime & Instance()
Instantiation.
Definition: KLMTime.cc:14
KLMTime()
Constructor.
Definition: KLMTime.h:91
DBObjPtr< HardwareClockSettings > m_HardwareClockSettings
Hardware clock settings.
Definition: KLMTime.h:106
DBObjPtr< KLMTimeConversion > m_KLMTimeConversion
KLM time conversion.
Definition: KLMTime.h:103
Abstract base class for different kinds of events.