10#include <klm/time/KLMTime.h>
16 static KLMTime klmElementNumbers;
17 return klmElementNumbers;
35 int correctedCTime = (((ctime << cTimeShift) & 0xFFFF) << 3) + (tdc & 0x7);
36 int correctedTriggerCTime = ((triggerCTime << cTimeShift) & 0xFFFF) << 3;
38 if (correctedCTime <= correctedTriggerCTime)
39 relativeTime = correctedCTime - correctedTriggerCTime;
41 relativeTime = correctedCTime - correctedTriggerCTime - (0x10000 << 3);
49 int relativeTime = tdc & 0x7FF;
57 int trigger = ((triggerTime - 10) & 0x0FF) << 3;
58 if (relativeTime <= trigger)
59 relativeTime -= trigger;
61 relativeTime -= trigger + 0x800;
62 return std::pair<int, double>(ctime - triggerTime,
double m_TDCPeriod
TDC period (stored here because getting it from m_HardwareClockSettings requires to search in a map).
std::pair< int, double > getRPCTimes(int ctime, int tdc, int triggerTime) const
Get coarse and fine times for RPC.
double getTimeSimulation(int tdc, bool scintillator) const
Get time for simulation.
double getScintillatorTime(int ctime, int tdc, int triggerCTime) const
Get time for scintillator.
uint16_t getTDCByTime(double time) const
Get TDC by time.
double m_CTimePeriod
CTIME period.
void updateConstants()
Update constants from database objects.
static KLMTime & Instance()
Instantiation.
DBObjPtr< HardwareClockSettings > m_HardwareClockSettings
Hardware clock settings.
DBObjPtr< KLMTimeConversion > m_KLMTimeConversion
KLM time conversion.
Abstract base class for different kinds of events.