Belle II Software light-2406-ragdoll
EventLevelTriggerTimeInfo Class Reference

Storage element for information from the Trigger Timing Distribution (TTD) More...

#include <EventLevelTriggerTimeInfo.h>

Inheritance diagram for EventLevelTriggerTimeInfo:
Collaboration diagram for EventLevelTriggerTimeInfo:

Public Member Functions

 EventLevelTriggerTimeInfo (bool isValid=false, bool isHER=false, bool revo2=false, unsigned int timeSinceLastInjection=c_flagNoInjection, unsigned int timeSincePrevTrigger=0, unsigned int bunchNumber=0)
 Constructor.
 
 ~EventLevelTriggerTimeInfo ()
 Destructor.
 
bool isValid () const
 get if stored information is valid
 
bool isHER () const
 get if last injection was in HER/LER
 
bool isRevo2 () const
 get lowest bit of revolution counter
 
unsigned int getTimeSinceLastInjection () const
 get time since the last injection (i.e. the injection-pre-kick signal) in clock ticks (FTSW clock)
 
unsigned int getTimeSincePrevTrigger () const
 get time since the previous trigger in clock ticks (FTSW clock)
 
unsigned int getBunchNumber () const
 get number of triggered bunch as provided by TTD
 
bool hasInjection () const
 get if an injection happened recently (and the corresponding stored data is actually valid)
 
void setValid ()
 set that stored information is valid
 
void setInvalid ()
 set that stored information is valid
 
void setIsHER (bool isHER)
 set if injection in HER/LER
 
void setRevo2 (bool revo2)
 set lowest bit of revolution counter
 
void setTimeSinceLastInjection (unsigned int timeSinceLastInjection)
 set time since the last injection (i.e. the injection-pre-kick signal) in clock ticks (FTSW clock)
 
void setTimeSincePrevTrigger (unsigned int timeSincePrevTrigger)
 set time since the previous trigger in clock ticks (FTSW clock)
 
void setBunchNumber (unsigned int bunchNumber)
 set number of triggered bunch
 
void setNoInjection ()
 set that no injection happened recently (and the corresponding stored data is actually invalid)
 
double getTimeSinceLastInjectionInMicroSeconds () const
 get time since the last injection (i.e. the injection-pre-kick signal) in microseconds
 
double getTimeSincePrevTriggerInMicroSeconds () const
 get time since the previous trigger in microseconds
 
int getTimeSinceInjectedBunch () const
 get time since the injected bunch passed the detector in clock ticks (FTSW clock)
 
double getTimeSinceInjectedBunchInMicroSeconds () const
 get time since the injected bunch passed the detector in microseconds
 
int getTriggeredBunchNumberGlobal () const
 get the actual (=global) number of the triggered bunch
 

Private Attributes

bool m_isValid
 Data stored in this TTD info object is actually valid.
 
bool m_isHER
 Injection is in HER/LER.
 
bool m_revo2
 Lowest bit of revolution counter (PXD needs ~2 revolutions to readout one frame)
 
unsigned int m_timeSinceLastInjection
 Time since the last injection in clock ticks (127MHz=RF/4 clock) Note: A value of 0x7FFFFFFF (see c_flagNoInjection) means no injection took place recently (value is defined by the RawFTSW) Note: This is actually the time since the injection-pre-kick signal was received so there is some offset (different for HER/LER) that will be handled by the analysis variable.
 
unsigned int m_timeSincePrevTrigger
 Time since the previous trigger in clock ticks (127MHz=RF/4 clock)
 
unsigned int m_bunchNumber
 Number of triggered bunch, ranging from 0-1279 (in 127MHz clock ticks) Note: There are a maximum of 5120 buckets, which could each carry one bunch of e+/e-, but we only have 1280 clock ticks (=5120/4) to identify the bunches Note: This is the bunch number as given by the TTD.
 

Static Private Attributes

static const unsigned int c_flagNoInjection = 0x7FFFFFFF
 This number is defined by the FTSW to indicate no injection happened recently.
 

Detailed Description

Storage element for information from the Trigger Timing Distribution (TTD)

Data is required to study injections and injection backgrounds, as well as for the analysis and simulation of PXD Gated Mode

Definition at line 23 of file EventLevelTriggerTimeInfo.h.

Constructor & Destructor Documentation

◆ EventLevelTriggerTimeInfo()

EventLevelTriggerTimeInfo ( bool  isValid = false,
bool  isHER = false,
bool  revo2 = false,
unsigned int  timeSinceLastInjection = c_flagNoInjection,
unsigned int  timeSincePrevTrigger = 0,
unsigned int  bunchNumber = 0 
)
inlineexplicit

Constructor.

Parameters
isValidThe information stored in this object is valid
isHERInjection in HER/LER
revo2Lowest bit of the revolution counter
timeSinceLastInjectionTime since the last injection in clock ticks (127MHz=RF/4 clock)
timeSincePrevTriggerTime since the previous trigger in clock ticks (127MHz=RF/4 clock)
bunchNumberNumber of the triggered bunch (ranging from 0-1279)

Definition at line 34 of file EventLevelTriggerTimeInfo.h.

37 :
38 m_isValid(isValid), m_isHER(isHER), m_revo2(revo2), m_timeSinceLastInjection(timeSinceLastInjection),
39 m_timeSincePrevTrigger(timeSincePrevTrigger), m_bunchNumber(bunchNumber) {}
bool m_isHER
Injection is in HER/LER.
unsigned int m_timeSincePrevTrigger
Time since the previous trigger in clock ticks (127MHz=RF/4 clock)
bool isValid() const
get if stored information is valid
unsigned int m_bunchNumber
Number of triggered bunch, ranging from 0-1279 (in 127MHz clock ticks) Note: There are a maximum of 5...
unsigned int m_timeSinceLastInjection
Time since the last injection in clock ticks (127MHz=RF/4 clock) Note: A value of 0x7FFFFFFF (see c_f...
bool m_revo2
Lowest bit of revolution counter (PXD needs ~2 revolutions to readout one frame)
bool isHER() const
get if last injection was in HER/LER
bool m_isValid
Data stored in this TTD info object is actually valid.

◆ ~EventLevelTriggerTimeInfo()

Destructor.

Definition at line 41 of file EventLevelTriggerTimeInfo.h.

41{}

Member Function Documentation

◆ getBunchNumber()

unsigned int getBunchNumber ( ) const
inline

get number of triggered bunch as provided by TTD

Definition at line 55 of file EventLevelTriggerTimeInfo.h.

55{return m_bunchNumber;}

◆ getTimeSinceInjectedBunch()

int getTimeSinceInjectedBunch ( ) const

get time since the injected bunch passed the detector in clock ticks (FTSW clock)

Definition at line 35 of file EventLevelTriggerTimeInfo.cc.

36{
37 // Use the 'TTDOffsets' to get the delay between injection pre-kick signal and passage of the bunch at the IP
38 static DBObjPtr<TTDOffsets> m_ttdOffsets;
39 int delay = 0;
40 if (m_ttdOffsets.isValid()) {
41 delay = m_isHER ? m_ttdOffsets->getInjectionDelayHER() : m_ttdOffsets->getInjectionDelayLER();
42 } else {
43 B2ERROR("Payload 'TTDOffsets' not found. To get the (uncorrected) information from TTD, use 'getTimeSinceLastInjection() or 'getTimeSinceLastInjectionInMicroSeconds()'.");
44 }
45 // a negative number means the "just" injected bunch has not yet passed the detector
46 return m_timeSinceLastInjection - delay;
47}
bool isValid() const
Check whether a valid object was obtained from the database.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21

◆ getTimeSinceInjectedBunchInMicroSeconds()

double getTimeSinceInjectedBunchInMicroSeconds ( ) const

get time since the injected bunch passed the detector in microseconds

Definition at line 50 of file EventLevelTriggerTimeInfo.cc.

51{
52 // use the 'HardwareClockSettings' to get the frequency the clock
53 static DBObjPtr<HardwareClockSettings> m_clockSettings;
54 // GlobalClockFrequency is in GHz, so we need an additional factor to convert to microseconds
55 return ((double)getTimeSinceInjectedBunch()) / (m_clockSettings->getGlobalClockFrequency() * 1e3);
56}
int getTimeSinceInjectedBunch() const
get time since the injected bunch passed the detector in clock ticks (FTSW clock)

◆ getTimeSinceLastInjection()

unsigned int getTimeSinceLastInjection ( ) const
inline

get time since the last injection (i.e. the injection-pre-kick signal) in clock ticks (FTSW clock)

Definition at line 51 of file EventLevelTriggerTimeInfo.h.

◆ getTimeSinceLastInjectionInMicroSeconds()

double getTimeSinceLastInjectionInMicroSeconds ( ) const

get time since the last injection (i.e. the injection-pre-kick signal) in microseconds

Definition at line 17 of file EventLevelTriggerTimeInfo.cc.

18{
19 // use the 'HardwareClockSettings' to get the frequency the clock
20 static DBObjPtr<HardwareClockSettings> m_clockSettings;
21 // GlobalClockFrequency is in GHz, so we need an additional factor to convert to microseconds
22 return ((double)m_timeSinceLastInjection) / (m_clockSettings->getGlobalClockFrequency() * 1e3);
23}

◆ getTimeSincePrevTrigger()

unsigned int getTimeSincePrevTrigger ( ) const
inline

get time since the previous trigger in clock ticks (FTSW clock)

Definition at line 53 of file EventLevelTriggerTimeInfo.h.

◆ getTimeSincePrevTriggerInMicroSeconds()

double getTimeSincePrevTriggerInMicroSeconds ( ) const

get time since the previous trigger in microseconds

Definition at line 26 of file EventLevelTriggerTimeInfo.cc.

27{
28 // use the 'HardwareClockSettings' to get the frequency the clock
29 static DBObjPtr<HardwareClockSettings> m_clockSettings;
30 // GlobalClockFrequency is in GHz, so we need an additional factor to convert to microseconds
31 return ((double)m_timeSincePrevTrigger) / (m_clockSettings->getGlobalClockFrequency() * 1e3);
32}

◆ getTriggeredBunchNumberGlobal()

int getTriggeredBunchNumberGlobal ( ) const

get the actual (=global) number of the triggered bunch

Definition at line 59 of file EventLevelTriggerTimeInfo.cc.

60{
61 // Use the 'TTDOffsets' to get the offset between TTD and SKB bunch numbering
62 static DBObjPtr<TTDOffsets> m_ttdOffsets;
63 int offset = 0;
64 if (m_ttdOffsets.isValid()) {
65 offset = m_isHER ? m_ttdOffsets->getTriggeredBunchOffsetHER() : m_ttdOffsets->getTriggeredBunchOffsetLER();
66 } else {
67 B2ERROR("Payload 'TTDOffsets' not found. To get the (uncorrected) information from TTD, use 'getBunchNumber()'.");
68 }
69 return m_bunchNumber + offset;
70}

◆ hasInjection()

bool hasInjection ( ) const
inline

get if an injection happened recently (and the corresponding stored data is actually valid)

Definition at line 57 of file EventLevelTriggerTimeInfo.h.

static const unsigned int c_flagNoInjection
This number is defined by the FTSW to indicate no injection happened recently.

◆ isHER()

bool isHER ( ) const
inline

get if last injection was in HER/LER

Definition at line 47 of file EventLevelTriggerTimeInfo.h.

47{return m_isHER;}

◆ isRevo2()

bool isRevo2 ( ) const
inline

get lowest bit of revolution counter

Definition at line 49 of file EventLevelTriggerTimeInfo.h.

49{return m_revo2;}

◆ isValid()

bool isValid ( ) const
inline

get if stored information is valid

Definition at line 45 of file EventLevelTriggerTimeInfo.h.

45{return m_isValid;}

◆ setBunchNumber()

void setBunchNumber ( unsigned int  bunchNumber)
inline

set number of triggered bunch

Definition at line 73 of file EventLevelTriggerTimeInfo.h.

73{m_bunchNumber = bunchNumber;}

◆ setInvalid()

void setInvalid ( )
inline

set that stored information is valid

Definition at line 63 of file EventLevelTriggerTimeInfo.h.

63{m_isValid = false;}

◆ setIsHER()

void setIsHER ( bool  isHER)
inline

set if injection in HER/LER

Definition at line 65 of file EventLevelTriggerTimeInfo.h.

65{m_isHER = isHER;}

◆ setNoInjection()

void setNoInjection ( )
inline

set that no injection happened recently (and the corresponding stored data is actually invalid)

Definition at line 75 of file EventLevelTriggerTimeInfo.h.

◆ setRevo2()

void setRevo2 ( bool  revo2)
inline

set lowest bit of revolution counter

Definition at line 67 of file EventLevelTriggerTimeInfo.h.

67{m_revo2 = revo2;}

◆ setTimeSinceLastInjection()

void setTimeSinceLastInjection ( unsigned int  timeSinceLastInjection)
inline

set time since the last injection (i.e. the injection-pre-kick signal) in clock ticks (FTSW clock)

Definition at line 69 of file EventLevelTriggerTimeInfo.h.

69{m_timeSinceLastInjection = timeSinceLastInjection;}

◆ setTimeSincePrevTrigger()

void setTimeSincePrevTrigger ( unsigned int  timeSincePrevTrigger)
inline

set time since the previous trigger in clock ticks (FTSW clock)

Definition at line 71 of file EventLevelTriggerTimeInfo.h.

71{m_timeSincePrevTrigger = timeSincePrevTrigger;}

◆ setValid()

void setValid ( )
inline

set that stored information is valid

Definition at line 61 of file EventLevelTriggerTimeInfo.h.

61{m_isValid = true;}

Member Data Documentation

◆ c_flagNoInjection

const unsigned int c_flagNoInjection = 0x7FFFFFFF
staticprivate

This number is defined by the FTSW to indicate no injection happened recently.

Definition at line 125 of file EventLevelTriggerTimeInfo.h.

◆ m_bunchNumber

unsigned int m_bunchNumber
private

Number of triggered bunch, ranging from 0-1279 (in 127MHz clock ticks) Note: There are a maximum of 5120 buckets, which could each carry one bunch of e+/e-, but we only have 1280 clock ticks (=5120/4) to identify the bunches Note: This is the bunch number as given by the TTD.

This might not be the 'global' bunch number, but the offset is taken into account by the method getTriggeredBunchNumberGlobal().

Definition at line 122 of file EventLevelTriggerTimeInfo.h.

◆ m_isHER

bool m_isHER
private

Injection is in HER/LER.

Definition at line 97 of file EventLevelTriggerTimeInfo.h.

◆ m_isValid

bool m_isValid
private

Data stored in this TTD info object is actually valid.

Definition at line 93 of file EventLevelTriggerTimeInfo.h.

◆ m_revo2

bool m_revo2
private

Lowest bit of revolution counter (PXD needs ~2 revolutions to readout one frame)

Definition at line 102 of file EventLevelTriggerTimeInfo.h.

◆ m_timeSinceLastInjection

unsigned int m_timeSinceLastInjection
private

Time since the last injection in clock ticks (127MHz=RF/4 clock) Note: A value of 0x7FFFFFFF (see c_flagNoInjection) means no injection took place recently (value is defined by the RawFTSW) Note: This is actually the time since the injection-pre-kick signal was received so there is some offset (different for HER/LER) that will be handled by the analysis variable.

Definition at line 110 of file EventLevelTriggerTimeInfo.h.

◆ m_timeSincePrevTrigger

unsigned int m_timeSincePrevTrigger
private

Time since the previous trigger in clock ticks (127MHz=RF/4 clock)

Definition at line 114 of file EventLevelTriggerTimeInfo.h.


The documentation for this class was generated from the following files: