Belle II Software  release-08-01-10
TRGSummary Class Referencefinal

Trigger Summary Information input bits input bits from subdetectors ftdl (Final Trigger Decision Logic) bits output bits of trigger logic psnm (Prescale and Mask) bits prescaled ftdl bits timType types of trigger timing source defined in b2tt firmware. More...

#include <TRGSummary.h>

Inheritance diagram for TRGSummary:
Collaboration diagram for TRGSummary:

Public Types

enum  ETimingType {
  TTYP_ECL = 0 ,
  TTYP_PID1 = 4 ,
  TTYP_PID2 = 8 ,
  TTYP_PID3 = 12 ,
  TTYP_SELF = 2 ,
  TTYP_RSV1 = 6 ,
  TTYP_RSV2 = 10 ,
  TTYP_RSV3 = 14 ,
  TTYP_TOP = 1 ,
  TTYP_CDC = 3 ,
  TTYP_DPHY = 5 ,
  TTYP_RAND = 7 ,
  TTYP_TEST = 9 ,
  TTYP_RSV4 = 11 ,
  TTYP_POIS = 13 ,
  TTYP_NONE = 15
}
 types of trigger timing source defined in b2tt firmware More...
 
enum  ETimingQuality {
  TTYQ_NONE = 0 ,
  TTYQ_CORS = 1 ,
  TTYQ_FINE = 2 ,
  TTYQ_SFIN = 3
}
 trigger timing type quality
 

Public Member Functions

 TRGSummary ()=default
 default constructor: xxx
 
 TRGSummary (unsigned int inputBits[10], unsigned int ftdlBits[10], unsigned int psnmBits[10], ETimingType timType)
 constructor: xxx
 
bool test () const
 check whether any psnm bit is set More...
 
bool testInput (unsigned int bit) const
 check whether an input bit is set More...
 
bool testInput (const std::string &name) const
 check whether an input bit is set More...
 
bool testFtdl (unsigned int bit) const
 check whether a ftdl bit is set More...
 
bool testFtdl (const std::string &name) const
 check whether a ftdl bit is set More...
 
bool testPsnm (unsigned int bit) const
 check whether a psnm bit is set More...
 
bool testPsnm (const std::string &name) const
 check whether a psnm bit is set More...
 
bool isPoissonInInjectionVeto () const
 check whether poisson random trigger is within injection veto More...
 
void setPoissonInInjectionVeto ()
 set true if poisson random trigger is within injection veto
 
void setTRGSummary (int i, int word)
 set the Final Trigger Decision Logic bit
 
void setPreScale (int i, int bit, int pre)
 set the prescale factor of each bit
 
void setInputBits (int i, int word)
 set the input bits
 
void setFtdlBits (int i, int word)
 set the ftdl bits, the same as setTRGSummary(int i, int word)
 
void setPsnmBits (int i, int word)
 set the Prescaled ftdl bits
 
unsigned int getTRGSummary (int i) const
 get the trigger result, each word has 32 bits
 
unsigned int getPreScale (int i, int bit) const
 get the prescale factor which the bit is corresponding
 
void setTimType (ETimingType timType)
 set the timType
 
void setTimQuality (ETimingQuality timQuality)
 set the timQuality
 
unsigned int getInputBits (const unsigned i) const
 get input bits More...
 
unsigned int getFtdlBits (const unsigned i) const
 get ftdl bits (directly determined by the trigger conditions) More...
 
unsigned int getPsnmBits (const unsigned i) const
 get psnm bits (prescaled ftdl bits) More...
 
ETimingType getTimType () const
 get timing source information More...
 
ETimingQuality getTimQuality () const
 get timing source quality More...
 
std::string getInfoHTML () const override
 Return a short summary of this object's contents in HTML format.
 
unsigned int getInputBitNumber (const std::string &name) const
 get number of an input trigger bit More...
 
unsigned int getOutputBitNumber (const std::string &name) const
 get number of an output trigger bit More...
 
void addRelationTo (const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
 Add a relation from this object to another object (with caching). More...
 
void addRelationTo (const TObject *object, float weight=1.0, const std::string &namedRelation="") const
 Add a relation from this object to another object (no caching, can be quite slow). More...
 
void copyRelations (const RelationsInterface< BASE > *sourceObj)
 Copies all relations of sourceObj (pointing from or to sourceObj) to this object (including weights). More...
 
template<class TO >
RelationVector< TO > getRelationsTo (const std::string &name="", const std::string &namedRelation="") const
 Get the relations that point from this object to another store array. More...
 
template<class FROM >
RelationVector< FROM > getRelationsFrom (const std::string &name="", const std::string &namedRelation="") const
 Get the relations that point from another store array to this object. More...
 
template<class T >
RelationVector< T > getRelationsWith (const std::string &name="", const std::string &namedRelation="") const
 Get the relations between this object and another store array. More...
 
template<class TO >
TO * getRelatedTo (const std::string &name="", const std::string &namedRelation="") const
 Get the object to which this object has a relation. More...
 
template<class FROM >
FROM * getRelatedFrom (const std::string &name="", const std::string &namedRelation="") const
 Get the object from which this object has a relation. More...
 
template<class T >
T * getRelated (const std::string &name="", const std::string &namedRelation="") const
 Get the object to or from which this object has a relation. More...
 
template<class TO >
std::pair< TO *, float > getRelatedToWithWeight (const std::string &name="", const std::string &namedRelation="") const
 Get first related object & weight of relation pointing to an array. More...
 
template<class FROM >
std::pair< FROM *, float > getRelatedFromWithWeight (const std::string &name="", const std::string &namedRelation="") const
 Get first related object & weight of relation pointing from an array. More...
 
template<class T >
std::pair< T *, float > getRelatedWithWeight (const std::string &name="", const std::string &namedRelation="") const
 Get first related object & weight of relation pointing from/to an array. More...
 
virtual std::string getName () const
 Return a short name that describes this object, e.g. More...
 
std::string getInfo () const
 Return a short summary of this object's contents in raw text format. More...
 
std::string getArrayName () const
 Get name of array this object is stored in, or "" if not found.
 
int getArrayIndex () const
 Returns this object's array index (in StoreArray), or -1 if not found.
 

Static Public Attributes

static const unsigned int c_trgWordSize = 32
 size of a l1 trigger word
 
static const unsigned int c_ntrgWords = 10
 number of l1 trigger words
 

Protected Member Functions

TClonesArray * getArrayPointer () const
 Returns the pointer to the raw DataStore array holding this object (protected since these arrays are easy to misuse).
 

Private Member Functions

std::string outputBitWithColor (bool bit) const
 return the td part of an HTML table with green of the bit is > 0
 
 ClassDefOverride (TRGSummary, 7)
 Trigger Summary Information including bit (input, ftdl, psnm), timing and trigger source.
 
 ClassDef (RelationsInterface, 0)
 defines interface for accessing relations of objects in StoreArray.
 

Private Attributes

unsigned int m_inputBits [c_ntrgWords] = {0}
 input bits from subdetectors
 
unsigned int m_ftdlBits [c_ntrgWords] = {0}
 ftdl (Final Trigger Decision Logic) bits. More...
 
unsigned int m_psnmBits [c_ntrgWords] = {0}
 psnm (PreScale aNd Mask) bits. More...
 
ETimingType m_timType = TTYP_NONE
 types of trigger timing source defined in b2tt firmware
 
ETimingQuality m_timQuality = TTYQ_NONE
 trigger timing type quality
 
unsigned int m_prescaleBits [c_ntrgWords][c_trgWordSize] = {{0}}
 the prescale factor of each bit
 
bool m_isPoissonInInjectionVeto = false
 Poisson random trigger in injection veto or not.
 
DataStore::StoreEntrym_cacheDataStoreEntry
 Cache of the data store entry to which this object belongs.
 
int m_cacheArrayIndex
 Cache of the index in the TClonesArray to which this object belongs.
 

Static Private Attributes

static const int c_Version = 1
 version of this code
 

Detailed Description

Trigger Summary Information input bits input bits from subdetectors ftdl (Final Trigger Decision Logic) bits output bits of trigger logic psnm (Prescale and Mask) bits prescaled ftdl bits timType types of trigger timing source defined in b2tt firmware.

Definition at line 32 of file TRGSummary.h.

Member Enumeration Documentation

◆ ETimingType

types of trigger timing source defined in b2tt firmware

Enumerator
TTYP_ECL 

events triggered by ECL timing

TTYP_PID1 

reserved (not defined yet)

TTYP_PID2 

reserved (not defined yet)

TTYP_PID3 

reserved (not defined yet)

TTYP_SELF 

events triggered by self trigger

TTYP_RSV1 

reserved (not defined yet)

TTYP_RSV2 

reserved (not defined yet)

TTYP_RSV3 

reserved (not defined yet)

TTYP_TOP 

events triggered by TOP timing

TTYP_CDC 

events triggered by CDC timing

TTYP_DPHY 

delayed physics events for background

TTYP_RAND 

random trigger events

TTYP_TEST 

test pulse input

TTYP_RSV4 

reserved (not defined yet)

TTYP_POIS 

poisson random trigger

TTYP_NONE 

reserved (not defined yet)

Definition at line 43 of file TRGSummary.h.

43  {
45  TTYP_ECL = 0,
47  TTYP_PID1 = 4,
49  TTYP_PID2 = 8,
51  TTYP_PID3 = 12,
53  TTYP_SELF = 2,
55  TTYP_RSV1 = 6,
57  TTYP_RSV2 = 10,
59  TTYP_RSV3 = 14,
61  TTYP_TOP = 1,
63  TTYP_CDC = 3,
65  TTYP_DPHY = 5,
67  TTYP_RAND = 7,
69  TTYP_TEST = 9,
71  TTYP_RSV4 = 11,
73  TTYP_POIS = 13,
75  TTYP_NONE = 15
76  };
@ TTYP_RSV3
reserved (not defined yet)
Definition: TRGSummary.h:59
@ TTYP_DPHY
delayed physics events for background
Definition: TRGSummary.h:65
@ TTYP_PID3
reserved (not defined yet)
Definition: TRGSummary.h:51
@ TTYP_RSV4
reserved (not defined yet)
Definition: TRGSummary.h:71
@ TTYP_SELF
events triggered by self trigger
Definition: TRGSummary.h:53
@ TTYP_POIS
poisson random trigger
Definition: TRGSummary.h:73
@ TTYP_PID1
reserved (not defined yet)
Definition: TRGSummary.h:47
@ TTYP_NONE
reserved (not defined yet)
Definition: TRGSummary.h:75
@ TTYP_TOP
events triggered by TOP timing
Definition: TRGSummary.h:61
@ TTYP_RSV2
reserved (not defined yet)
Definition: TRGSummary.h:57
@ TTYP_PID2
reserved (not defined yet)
Definition: TRGSummary.h:49
@ TTYP_CDC
events triggered by CDC timing
Definition: TRGSummary.h:63
@ TTYP_TEST
test pulse input
Definition: TRGSummary.h:69
@ TTYP_RSV1
reserved (not defined yet)
Definition: TRGSummary.h:55
@ TTYP_ECL
events triggered by ECL timing
Definition: TRGSummary.h:45
@ TTYP_RAND
random trigger events
Definition: TRGSummary.h:67

Member Function Documentation

◆ addRelationTo() [1/2]

void addRelationTo ( const RelationsInterface< BASE > *  object,
float  weight = 1.0,
const std::string &  namedRelation = "" 
) const
inlineinherited

Add a relation from this object to another object (with caching).

Parameters
objectThe object to which the relation should point.
weightThe weight of the relation.
namedRelationAdditional name for the relation, or "" for the default naming

Definition at line 142 of file RelationsObject.h.

◆ addRelationTo() [2/2]

void addRelationTo ( const TObject *  object,
float  weight = 1.0,
const std::string &  namedRelation = "" 
) const
inlineinherited

Add a relation from this object to another object (no caching, can be quite slow).

Parameters
objectThe object to which the relation should point.
weightThe weight of the relation.
namedRelationAdditional name for the relation, or "" for the default naming

Definition at line 155 of file RelationsObject.h.

◆ copyRelations()

void copyRelations ( const RelationsInterface< BASE > *  sourceObj)
inlineinherited

Copies all relations of sourceObj (pointing from or to sourceObj) to this object (including weights).

Useful if you want to make a complete copy of a StoreArray object to make modifications to it, but retain all information on linked objects.

Note: this only works if sourceObj inherits from the same base (e.g. RelationsObject), and only for related objects that also inherit from the same base.

Definition at line 170 of file RelationsObject.h.

◆ getFtdlBits()

unsigned int getFtdlBits ( const unsigned  i) const
inline

get ftdl bits (directly determined by the trigger conditions)

Parameters
iindex: 0, 1, 2 for bit 0-31, 32-63, 64-95, respectively.
Returns
ftdl bits

Definition at line 195 of file TRGSummary.h.

◆ getInfo()

std::string getInfo ( ) const
inlineinherited

Return a short summary of this object's contents in raw text format.

Returns the contents of getInfoHTML() while translating line-breaks etc.

Note
: You don't need to implement this function (it's not virtual), getInfoHTML() is enough.

Definition at line 370 of file RelationsObject.h.

◆ getInputBitNumber()

unsigned int getInputBitNumber ( const std::string &  name) const

get number of an input trigger bit

Parameters
nameinput trigger bit name
Returns
input trigger bit number

Definition at line 77 of file TRGSummary.cc.

78 {
79  // Instead of returning a magic number, let's throw an exception:
80  // this will help us to distinguish "trigger not fired" cases
81  // from "trigger not found" at analysis level.
82  static DBObjPtr<TRGGDLDBInputBits> inputBits;
83 
84  if (not inputBits) {
85  B2WARNING("The mapping of input trigger names does not exist in the given globaltags");
86  throw std::runtime_error("No input trigger map in the given globaltags");
87  }
88 
89  for (unsigned int bit = 0; bit < c_trgWordSize * c_ntrgWords; bit++) {
90  if (std::string(inputBits->getinbitname((int)bit)) == name) {
91  return bit;
92  }
93  }
94 
95  B2WARNING("The requested input trigger name does not exist" << LogVar("name", name));
96  throw std::invalid_argument("The requested input trigger name does not exist: " + name);
97 }
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
static const unsigned int c_trgWordSize
size of a l1 trigger word
Definition: TRGSummary.h:37
static const unsigned int c_ntrgWords
number of l1 trigger words
Definition: TRGSummary.h:40
Class to store variables with their name which were sent to the logging service.

◆ getInputBits()

unsigned int getInputBits ( const unsigned  i) const
inline

get input bits

Parameters
iindex: 0, 1, 2 for bit 0-31, 32-63, 64-95, respectively.
Returns
input bits

Definition at line 186 of file TRGSummary.h.

◆ getName()

virtual std::string getName ( ) const
inlinevirtualinherited

Return a short name that describes this object, e.g.

pi+ for an MCParticle.

Reimplemented in SpacePoint, MCParticle, and Particle.

Definition at line 344 of file RelationsObject.h.

◆ getOutputBitNumber()

unsigned int getOutputBitNumber ( const std::string &  name) const

get number of an output trigger bit

Parameters
nameoutput trigger bit name
Returns
output trigger bit number

Definition at line 99 of file TRGSummary.cc.

◆ getPsnmBits()

unsigned int getPsnmBits ( const unsigned  i) const
inline

get psnm bits (prescaled ftdl bits)

Parameters
iindex: 0, 1, 2 for bit 0-31, 32-63, 64-95, respectively.
Returns
psnm bits

Definition at line 204 of file TRGSummary.h.

◆ getRelated()

T* getRelated ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the object to or from which this object has a relation.

Template Parameters
TThe class of objects to or from which the relation points.
Parameters
nameThe name of the store array to or from which the relation points. If empty the default store array name for class T will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
The first related object or a null pointer.

Definition at line 278 of file RelationsObject.h.

◆ getRelatedFrom()

FROM* getRelatedFrom ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the object from which this object has a relation.

Template Parameters
FROMThe class of objects from which the relation points.
Parameters
nameThe name of the store array from which the relation points. If empty the default store array name for class FROM will be used. If the special name "ALL" is given all store arrays containing objects of type FROM are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
The first related object or a null pointer.

Definition at line 263 of file RelationsObject.h.

◆ getRelatedFromWithWeight()

std::pair<FROM*, float> getRelatedFromWithWeight ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get first related object & weight of relation pointing from an array.

Template Parameters
FROMThe class of objects from which the relation points.
Parameters
nameThe name of the store array from which the relation points. If empty the default store array name for class FROM will be used. If the special name "ALL" is given all store arrays containing objects of type FROM are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
Pair of first related object and the relation weight, or (NULL, 1.0) if none found.

Definition at line 314 of file RelationsObject.h.

◆ getRelatedTo()

TO* getRelatedTo ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the object to which this object has a relation.

Template Parameters
TOThe class of objects to which the relation points.
Parameters
nameThe name of the store array to which the relation points. If empty the default store array name for class TO will be used. If the special name "ALL" is given all store arrays containing objects of type TO are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
The first related object or a null pointer.

Definition at line 248 of file RelationsObject.h.

◆ getRelatedToWithWeight()

std::pair<TO*, float> getRelatedToWithWeight ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get first related object & weight of relation pointing to an array.

Template Parameters
TOThe class of objects to which the relation points.
Parameters
nameThe name of the store array to which the relation points. If empty the default store array name for class TO will be used. If the special name "ALL" is given all store arrays containing objects of type TO are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
Pair of first related object and the relation weight, or (NULL, 1.0) if none found.

Definition at line 297 of file RelationsObject.h.

◆ getRelatedWithWeight()

std::pair<T*, float> getRelatedWithWeight ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get first related object & weight of relation pointing from/to an array.

Template Parameters
TThe class of objects to or from which the relation points.
Parameters
nameThe name of the store array to or from which the relation points. If empty the default store array name for class T will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
Pair of first related object and the relation weight, or (NULL, 1.0) if none found.

Definition at line 331 of file RelationsObject.h.

◆ getRelationsFrom()

RelationVector<FROM> getRelationsFrom ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the relations that point from another store array to this object.

Template Parameters
FROMThe class of objects from which the relations point.
Parameters
nameThe name of the store array from which the relations point. If empty the default store array name for class FROM will be used. If the special name "ALL" is given all store arrays containing objects of type FROM are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
A vector of relations.

Definition at line 212 of file RelationsObject.h.

◆ getRelationsTo()

RelationVector<TO> getRelationsTo ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the relations that point from this object to another store array.

Template Parameters
TOThe class of objects to which the relations point.
Parameters
nameThe name of the store array to which the relations point. If empty the default store array name for class TO will be used. If the special name "ALL" is given all store arrays containing objects of type TO are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
A vector of relations.

Definition at line 197 of file RelationsObject.h.

◆ getRelationsWith()

RelationVector<T> getRelationsWith ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the relations between this object and another store array.

Relations in both directions are returned.

Template Parameters
TThe class of objects to or from which the relations point.
Parameters
nameThe name of the store array to or from which the relations point. If empty the default store array name for class T will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
A vector of relations.

Definition at line 230 of file RelationsObject.h.

◆ getTimQuality()

ETimingQuality getTimQuality ( ) const
inline

get timing source quality

Returns
timing type quality

Definition at line 220 of file TRGSummary.h.

◆ getTimType()

ETimingType getTimType ( ) const
inline

get timing source information

Returns
timing source type

Definition at line 212 of file TRGSummary.h.

◆ isPoissonInInjectionVeto()

bool isPoissonInInjectionVeto ( ) const
inline

check whether poisson random trigger is within injection veto

Returns
True if poisson random trigger is within injection veto

Definition at line 143 of file TRGSummary.h.

◆ test()

bool test ( ) const

check whether any psnm bit is set

Returns
True if triggered by L1

Definition at line 36 of file TRGSummary.cc.

◆ testFtdl() [1/2]

bool testFtdl ( const std::string &  name) const
inline

check whether a ftdl bit is set

Parameters
namename of ftdl bit.
Returns
True if the bit is set

Definition at line 126 of file TRGSummary.h.

◆ testFtdl() [2/2]

bool testFtdl ( unsigned int  bit) const

check whether a ftdl bit is set

Parameters
bitindex of ftdl bit.
Returns
True if the bit is set

Definition at line 55 of file TRGSummary.cc.

◆ testInput() [1/2]

bool testInput ( const std::string &  name) const
inline

check whether an input bit is set

Parameters
namename of input bit.
Returns
True if the bit is set

Definition at line 114 of file TRGSummary.h.

◆ testInput() [2/2]

bool testInput ( unsigned int  bit) const

check whether an input bit is set

Parameters
bitindex of input bit.
Returns
True if the bit is set

Definition at line 44 of file TRGSummary.cc.

◆ testPsnm() [1/2]

bool testPsnm ( const std::string &  name) const
inline

check whether a psnm bit is set

Parameters
namename of psnm bit.
Returns
True if the bit is set

Definition at line 138 of file TRGSummary.h.

◆ testPsnm() [2/2]

bool testPsnm ( unsigned int  bit) const

check whether a psnm bit is set

Parameters
bitindex of psnm bit.
Returns
True if the bit is set

Definition at line 66 of file TRGSummary.cc.

Member Data Documentation

◆ m_ftdlBits

unsigned int m_ftdlBits[c_ntrgWords] = {0}
private

ftdl (Final Trigger Decision Logic) bits.

Outputs of trigger logic

Definition at line 254 of file TRGSummary.h.

◆ m_psnmBits

unsigned int m_psnmBits[c_ntrgWords] = {0}
private

psnm (PreScale aNd Mask) bits.

Prescaled ftdl bits For instance, if the prescale factor is 20 of a ftdl bit, only 1/20 of its psnm bit would be fired.

Definition at line 259 of file TRGSummary.h.


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