Belle II Software development
EventLevelTriggerTimeInfo Class Reference

Storage element for information from the Trigger Timing Distribution (TTD) and EventT0-related information. More...

#include <EventLevelTriggerTimeInfo.h>

Inheritance diagram for EventLevelTriggerTimeInfo:

Public Types

enum  EventT0Source : unsigned int {
  c_fromSVD = (1 << 0) ,
  c_fromCDC = (1 << 1) ,
  c_fromECL = (1 << 2)
}
 Flags for the EventT0 source. More...
 

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
 
void addEventT0SourceFromSVD ()
 Add the flag c_fromSVD to the EventT0 source mask.
 
void unsetEventT0SourceFromSVD ()
 Remove the flag c_fromSVD from the EventT0 source mask.
 
bool hasEventT0SourceFromSVD () const
 Return if the c_fromSVD flag is set in the EventT0 source mask.
 
void addEventT0SourceFromCDC ()
 Add the flag c_fromCDC to the EventT0 source mask.
 
void unsetEventT0SourceFromCDC ()
 Remove the flag c_fromCDC from the EventT0 source mask.
 
bool hasEventT0SourceFromCDC () const
 Return if the c_fromCDC flag is set in the EventT0 source mask.
 
void addEventT0SourceFromECL ()
 Add the flag c_fromECL to the EventT0 source mask.
 
void unsetEventT0SourceFromECL ()
 Remove the flag c_fromECL from the EventT0 source mask.
 
bool hasEventT0SourceFromECL () const
 Return if the c_fromECL flag is set in the EventT0 source mask.
 
void addEventT0Sources (EventT0Source sources)
 Add a specific flag (or combination of flags) to the EventT0 source mask.
 
void unsetEventT0Sources (EventT0Source sources)
 Unset a specific flag (or combination of flags) from the EventT0 source mask.
 
bool hasEventT0Sources (EventT0Source sources) const
 Return if the specific flag is set in the EventT0 source mask.
 
void resetEventT0Sources ()
 Reset all the flags from the EventT0 source mask (aka: set the "total" mask to 0)
 
bool hasAnyEventT0Sources () const
 Return if at least one flag is set in the EventT0 source mask.
 
const EventT0SourcegetEventT0Sources () const
 Return the EventT0 source mask.
 

Private Member Functions

template<EventT0Source source>
void setSources (bool setTo)
 Generic setter for the EventT0Source flags.
 

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)
 
EventT0Source m_eventT0Source
 Mask for storing which subdetectors contributed to the EventT0.
 
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.
 
static constexpr EventT0Source c_fromAllSubdetectors
 tells ROOT not to write it to file (transient)
 

Detailed Description

Storage element for information from the Trigger Timing Distribution (TTD) and EventT0-related information.

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

Definition at line 24 of file EventLevelTriggerTimeInfo.h.

Member Enumeration Documentation

◆ EventT0Source

enum EventT0Source : unsigned int

Flags for the EventT0 source.

Definition at line 29 of file EventLevelTriggerTimeInfo.h.

29 : unsigned int {
30 // In case additional subdetectors are included in the EventT0 determination,
31 // they must be added here.
32 // Flags are set in the EventT0Combiner module.
33 c_fromSVD = (1 << 0),
34 c_fromCDC = (1 << 1),
35 c_fromECL = (1 << 2)
36 };

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 46 of file EventLevelTriggerTimeInfo.h.

49 :
50 m_isValid(isValid), m_isHER(isHER), m_revo2(revo2), m_eventT0Source(EventT0Source{0}),
51 m_timeSinceLastInjection(timeSinceLastInjection), m_timeSincePrevTrigger(timeSincePrevTrigger),
52 m_bunchNumber(bunchNumber) {}

◆ ~EventLevelTriggerTimeInfo()

Destructor.

Definition at line 55 of file EventLevelTriggerTimeInfo.h.

55{}

Member Function Documentation

◆ addEventT0SourceFromCDC()

void addEventT0SourceFromCDC ( )
inline

Add the flag c_fromCDC to the EventT0 source mask.

Definition at line 114 of file EventLevelTriggerTimeInfo.h.

114{ setSources<EventT0Source::c_fromCDC>(true); }

◆ addEventT0SourceFromECL()

void addEventT0SourceFromECL ( )
inline

Add the flag c_fromECL to the EventT0 source mask.

Definition at line 123 of file EventLevelTriggerTimeInfo.h.

123{ setSources<EventT0Source::c_fromECL>(true); }

◆ addEventT0SourceFromSVD()

void addEventT0SourceFromSVD ( )
inline

Add the flag c_fromSVD to the EventT0 source mask.

Definition at line 105 of file EventLevelTriggerTimeInfo.h.

105{ setSources<EventT0Source::c_fromSVD>(true); }

◆ addEventT0Sources()

void addEventT0Sources ( EventT0Source sources)
inline

Add a specific flag (or combination of flags) to the EventT0 source mask.

Definition at line 132 of file EventLevelTriggerTimeInfo.h.

132{ m_eventT0Source = EventT0Source(m_eventT0Source bitor sources); }

◆ getBunchNumber()

unsigned int getBunchNumber ( ) const
inline

get number of triggered bunch as provided by TTD

Definition at line 69 of file EventLevelTriggerTimeInfo.h.

69{return m_bunchNumber;}

◆ getEventT0Sources()

const EventT0Source & getEventT0Sources ( ) const
inline

Return the EventT0 source mask.

Definition at line 147 of file EventLevelTriggerTimeInfo.h.

147{ return m_eventT0Source; }

◆ 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.
unsigned int m_timeSinceLastInjection
Time since the last injection in clock ticks (127MHz=RF/4 clock) Note: A value of 0x7FFFFFFF (see c_f...

◆ 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 65 of file EventLevelTriggerTimeInfo.h.

65{return m_timeSinceLastInjection;}

◆ 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 67 of file EventLevelTriggerTimeInfo.h.

67{return m_timeSincePrevTrigger;}

◆ 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}
unsigned int m_timeSincePrevTrigger
Time since the previous trigger in clock ticks (127MHz=RF/4 clock)

◆ 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}
unsigned int m_bunchNumber
Number of triggered bunch, ranging from 0-1279 (in 127MHz clock ticks) Note: There are a maximum of 5...

◆ hasAnyEventT0Sources()

bool hasAnyEventT0Sources ( ) const
inline

Return if at least one flag is set in the EventT0 source mask.

Definition at line 144 of file EventLevelTriggerTimeInfo.h.

144{ return hasEventT0Sources(c_fromAllSubdetectors); }

◆ hasEventT0SourceFromCDC()

bool hasEventT0SourceFromCDC ( ) const
inline

Return if the c_fromCDC flag is set in the EventT0 source mask.

Definition at line 120 of file EventLevelTriggerTimeInfo.h.

120{ return hasEventT0Sources(EventT0Source::c_fromCDC); }

◆ hasEventT0SourceFromECL()

bool hasEventT0SourceFromECL ( ) const
inline

Return if the c_fromECL flag is set in the EventT0 source mask.

Definition at line 129 of file EventLevelTriggerTimeInfo.h.

129{ return hasEventT0Sources(EventT0Source::c_fromECL); }

◆ hasEventT0SourceFromSVD()

bool hasEventT0SourceFromSVD ( ) const
inline

Return if the c_fromSVD flag is set in the EventT0 source mask.

Definition at line 111 of file EventLevelTriggerTimeInfo.h.

111{ return hasEventT0Sources(EventT0Source::c_fromSVD); }

◆ hasEventT0Sources()

bool hasEventT0Sources ( EventT0Source sources) const
inline

Return if the specific flag is set in the EventT0 source mask.

Definition at line 138 of file EventLevelTriggerTimeInfo.h.

138{ return EventT0Source(m_eventT0Source bitand sources); }

◆ hasInjection()

bool hasInjection ( ) const
inline

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

Definition at line 71 of file EventLevelTriggerTimeInfo.h.

71{return m_timeSinceLastInjection != c_flagNoInjection;}

◆ isHER()

bool isHER ( ) const
inline

get if last injection was in HER/LER

Definition at line 61 of file EventLevelTriggerTimeInfo.h.

61{return m_isHER;}

◆ isRevo2()

bool isRevo2 ( ) const
inline

get lowest bit of revolution counter

Definition at line 63 of file EventLevelTriggerTimeInfo.h.

63{return m_revo2;}

◆ isValid()

bool isValid ( ) const
inline

get if stored information is valid

Definition at line 59 of file EventLevelTriggerTimeInfo.h.

59{return m_isValid;}

◆ resetEventT0Sources()

void resetEventT0Sources ( )
inline

Reset all the flags from the EventT0 source mask (aka: set the "total" mask to 0)

Definition at line 141 of file EventLevelTriggerTimeInfo.h.

141{ unsetEventT0Sources(c_fromAllSubdetectors); }

◆ setBunchNumber()

void setBunchNumber ( unsigned int bunchNumber)
inline

set number of triggered bunch

Definition at line 87 of file EventLevelTriggerTimeInfo.h.

87{m_bunchNumber = bunchNumber;}

◆ setInvalid()

void setInvalid ( )
inline

set that stored information is valid

Definition at line 77 of file EventLevelTriggerTimeInfo.h.

77{m_isValid = false;}

◆ setIsHER()

void setIsHER ( bool isHER)
inline

set if injection in HER/LER

Definition at line 79 of file EventLevelTriggerTimeInfo.h.

79{m_isHER = isHER;}

◆ setNoInjection()

void setNoInjection ( )
inline

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

Definition at line 89 of file EventLevelTriggerTimeInfo.h.

89{m_timeSinceLastInjection = c_flagNoInjection;}

◆ setRevo2()

void setRevo2 ( bool revo2)
inline

set lowest bit of revolution counter

Definition at line 81 of file EventLevelTriggerTimeInfo.h.

81{m_revo2 = revo2;}

◆ setSources()

template<EventT0Source source>
void setSources ( bool setTo)
inlineprivate

Generic setter for the EventT0Source flags.

Used only internally.

Definition at line 155 of file EventLevelTriggerTimeInfo.h.

156 {
157 if (setTo) {
158 addEventT0Sources(source);
159 } else {
160 unsetEventT0Sources(source);
161 }
162 }

◆ 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 83 of file EventLevelTriggerTimeInfo.h.

83{m_timeSinceLastInjection = timeSinceLastInjection;}

◆ setTimeSincePrevTrigger()

void setTimeSincePrevTrigger ( unsigned int timeSincePrevTrigger)
inline

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

Definition at line 85 of file EventLevelTriggerTimeInfo.h.

85{m_timeSincePrevTrigger = timeSincePrevTrigger;}

◆ setValid()

void setValid ( )
inline

set that stored information is valid

Definition at line 75 of file EventLevelTriggerTimeInfo.h.

75{m_isValid = true;}

◆ unsetEventT0SourceFromCDC()

void unsetEventT0SourceFromCDC ( )
inline

Remove the flag c_fromCDC from the EventT0 source mask.

Definition at line 117 of file EventLevelTriggerTimeInfo.h.

117{ setSources<EventT0Source::c_fromCDC>(false); }

◆ unsetEventT0SourceFromECL()

void unsetEventT0SourceFromECL ( )
inline

Remove the flag c_fromECL from the EventT0 source mask.

Definition at line 126 of file EventLevelTriggerTimeInfo.h.

126{ setSources<EventT0Source::c_fromECL>(false); }

◆ unsetEventT0SourceFromSVD()

void unsetEventT0SourceFromSVD ( )
inline

Remove the flag c_fromSVD from the EventT0 source mask.

Definition at line 108 of file EventLevelTriggerTimeInfo.h.

108{ setSources<EventT0Source::c_fromSVD>(false); }

◆ unsetEventT0Sources()

void unsetEventT0Sources ( EventT0Source sources)
inline

Unset a specific flag (or combination of flags) from the EventT0 source mask.

Definition at line 135 of file EventLevelTriggerTimeInfo.h.

135{ m_eventT0Source = EventT0Source(m_eventT0Source bitand ~sources); }

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 203 of file EventLevelTriggerTimeInfo.h.

◆ c_fromAllSubdetectors

EventT0Source c_fromAllSubdetectors
staticconstexprprivate
Initial value:
= EventT0Source(EventT0Source::c_fromSVD +
EventT0Source::c_fromCDC +
EventT0Source::c_fromECL)
EventT0Source
Flags for the EventT0 source.

tells ROOT not to write it to file (transient)

Definition at line 205 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 200 of file EventLevelTriggerTimeInfo.h.

◆ m_eventT0Source

EventT0Source m_eventT0Source
private

Mask for storing which subdetectors contributed to the EventT0.

Definition at line 180 of file EventLevelTriggerTimeInfo.h.

◆ m_isHER

bool m_isHER
private

Injection is in HER/LER.

Definition at line 171 of file EventLevelTriggerTimeInfo.h.

◆ m_isValid

bool m_isValid
private

Data stored in this TTD info object is actually valid.

Definition at line 167 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 176 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 188 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 192 of file EventLevelTriggerTimeInfo.h.


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