Base class for all BunchCrossingTool implementations. More...
#include <BunchCrossingToolBase.h>
Public Member Functions | |
BunchCrossingToolBase (const std::string &name="BunchCrossingToolBase") | |
Default constructor. | |
Functions implementing the IBunchCrossingTool interface | |
virtual bool | isFilled (bcid_type bcid) const |
The simplest query: Is the bunch crossing filled or not? | |
virtual bool | isInTrain (bcid_type bcid) const |
Function deciding if a given bunch crossing is in a filled train. | |
virtual bool | isUnpaired (bcid_type bcid) const |
Function deciding if a given bunch crossing has an unpaired bunch. | |
virtual bool | isBeam1 (bcid_type bcid) const |
Function deciding if there was a bunch from "beam 1" in this bunch crossing. | |
virtual bool | isBeam2 (bcid_type bcid) const |
Function deciding if there was a bunch from "beam 2" in this bunch crossing. | |
virtual float | bcIntensity (bcid_type bcid, BeamType type=Crossing) const |
Function returning the "intensity" of a given bunch crossing. | |
virtual BunchCrossingType | bcType (bcid_type bcid) const |
Get the type of the specific bunch crossing. | |
virtual int | distanceFromFront (bcid_type bcid, BunchDistanceType type=NanoSec) const |
The distance of the specific bunch crossing from the front of the train. | |
virtual int | distanceFromTail (bcid_type bcid, BunchDistanceType type=NanoSec) const |
The distance of the specific bunch crossing from the tail of the train. | |
virtual int | gapBeforeTrain (bcid_type bcid, BunchDistanceType type=NanoSec) const |
Gap before the train this BCID is in. | |
virtual int | gapAfterTrain (bcid_type bcid, BunchDistanceType type=NanoSec) const |
Gap after the train this BCID is in. | |
virtual int | gapBeforeBunch (bcid_type bcid, BunchDistanceType dtype=NanoSec, BunchFillType ftype=CollidingBunch) const |
Gap before a particular bunch. | |
virtual int | gapAfterBunch (bcid_type bcid, BunchDistanceType dtype=NanoSec, BunchFillType ftype=CollidingBunch) const |
Gap after a particular bunch. | |
virtual std::vector< bool > | bunchesInFront (bcid_type bcid, int bunches=10) const |
Function returning whether the previous bunches were filled, and how. | |
virtual std::vector< bool > | bunchesAfter (bcid_type bcid=0, int bunches=10) const |
Function returning whether the following bunches were filled, and how. | |
virtual std::vector< float > | bunchIntInFront (bcid_type bcid, int bunches=10, BeamType type=Crossing) const |
Function returning the intensities of the bunch crossings before the reference. | |
virtual std::vector< float > | bunchIntAfter (bcid_type bcid, int bunches=10, BeamType type=Crossing) const |
Function returning the intensities of the bunch crossings after the reference. | |
virtual unsigned int | numberOfFilledBunches () const |
Get the number of filled bunches in the current configuration. | |
virtual unsigned int | numberOfUnpairedBunches () const |
Get the number of unpaired bunches in the current configuration. | |
virtual unsigned int | numberOfBunchTrains () const |
Get the number of the bunch trains in the current configuration. | |
virtual int | bunchTrainSpacing (BunchDistanceType type=NanoSec) const |
Get the bunch spacing in the trains. | |
Protected Member Functions | |
StatusCode | loadSingleBunches (const std::vector< int > &bunches, const std::vector< float > &bunch_int1=std::vector< float >(), const std::vector< float > &bunch_int2=std::vector< float >()) |
Interpret the configuration for single bunches. | |
StatusCode | loadBunchTrains (const std::vector< int > &bunches, const std::vector< float > &bunch_int1=std::vector< float >(), const std::vector< float > &bunch_int2=std::vector< float >()) |
Interpret the configuration for bunch trains. | |
StatusCode | loadUnpairedBunches (const std::vector< int > &beam1, const std::vector< int > &beam2, const std::vector< float > &bunch_int1=std::vector< float >(), const std::vector< float > &bunch_int2=std::vector< float >()) |
Interpret the configuration for unpaired bunches. | |
void | printConfig () const |
Function printing the configuration of the tool. | |
Protected Attributes | |
Variables holding the decoded bunch structure | |
std::set< Trig::BunchCrossing > | m_filledBunches |
List of colliding bunches. | |
std::set< Trig::BunchCrossing > | m_singleBunches |
Internal list of single bunches. | |
std::set< Trig::BunchCrossing > | m_unpairedBunches |
Internal list of unpaired bunches. | |
std::set< Trig::BunchTrain > | m_bunchTrains |
Internal list of bunch trains. | |
Configurable tool properties | |
int | m_maxBunchSpacing |
The maximum bunch spacing that the tool should consider. | |
int | m_frontLength |
Length of the "front" of a bunch train. | |
int | m_tailLength |
Length of the "tail" of a bunch train. |
Base class for all BunchCrossingTool implementations.
This class holds the logic of the bunch crossing tool. The concrete implementations have to supply it with a vector of the filled bunches and optionally their intensities, which they can get from any location they want.
Trig::BunchCrossingToolBase::BunchCrossingToolBase | ( | const std::string & | name = "BunchCrossingToolBase" |
) |
Default constructor.
The class needs an explicit constructor because some of the member variables really need to be initialized at construction.
Declare the properties of the tool:
int Trig::BunchCrossingToolBase::distanceFromFront | ( | bcid_type | bcid, | |
BunchDistanceType | type = NanoSec | |||
) | const [virtual] |
The distance of the specific bunch crossing from the front of the train.
This is one of the most tricky functions of this class.
When the user wants to ask the distance of a bunch crossing from the front of its train in units of nano seconds or bunch crossings, the main part of the logic is propagated to the algebra defined for the BunchCrossing class.
But when the user wants to know the distance in terms of filled bunches, the code has to treat 3 different bunch train configurations:
bunchtrain->begin()
.bunchtrain->train_front()
to bunchtrain->end()
, plus the filled bunches from bunchtrain->begin()
to the bcid in question.bunchtrain->train_front()
to the bcid in question.bcid | The bcid that should be checked | |
type | The type of the requested return value |
Implements Trig::IBunchCrossingTool.
int Trig::BunchCrossingToolBase::distanceFromTail | ( | bcid_type | bcid, | |
BunchDistanceType | type = NanoSec | |||
) | const [virtual] |
The distance of the specific bunch crossing from the tail of the train.
This is one of the most tricky functions of this class.
When the user wants to ask the distance of a bunch crossing from the tail of its train in units of nano seconds or bunch crossings, the main part of the logic is propagated to the algebra defined for the BunchCrossing class.
But when the user wants to know the distance in terms of filled bunches, the code has to treat 3 different bunch train configurations:
bunchtrain->end()
.bunchtrain->end()
, plus the filled bunches from bunchtrain->begin()
to bunchtrain->train_back()
.bunchtrain->train_back()
.bcid | The bcid that should be checked | |
type | The type of the requested return value |
Implements Trig::IBunchCrossingTool.
int Trig::BunchCrossingToolBase::gapAfterBunch | ( | bcid_type | bcid, | |
BunchDistanceType | dtype = NanoSec , |
|||
BunchFillType | ftype = CollidingBunch | |||
) | const [virtual] |
Gap after a particular bunch.
The function creates a smart BunchCrossing out of the BCID provided, then it goes looking for the next bunch crossing of the specified type. Finally it just calculates the distance between the two bunch crossings in the requested units. It can return the size of the gap either in nanoseconds or in BCIDs (25 ns steps).
bcid | The bcid that should be investigated | |
dtype | The type of the requested return value | |
ftype | The type of the previous bunch to consider |
Implements Trig::IBunchCrossingTool.
Reimplemented in Trig::MCBunchCrossingTool, and Trig::D3PDBunchCrossingTool.
int Trig::BunchCrossingToolBase::gapAfterTrain | ( | bcid_type | bcid, | |
BunchDistanceType | type = NanoSec | |||
) | const [virtual] |
Gap after the train this BCID is in.
The function first finds the train that the specified BCID is in. Then it calculates the size of the gap after this train. It can return the size of the gap either in nanoseconds or in BCIDs (25 ns steps).
bcid | The bcid whose train should be investigated | |
type | The type of the requested return value |
Implements Trig::IBunchCrossingTool.
int Trig::BunchCrossingToolBase::gapBeforeBunch | ( | bcid_type | bcid, | |
BunchDistanceType | dtype = NanoSec , |
|||
BunchFillType | ftype = CollidingBunch | |||
) | const [virtual] |
Gap before a particular bunch.
The function creates a smart BunchCrossing out of the BCID provided, then it goes looking for the previous bunch crossing of the specified type. Finally it just calculates the distance between the two bunch crossings in the requested units. It can return the size of the gap either in nanoseconds or in BCIDs (25 ns steps).
bcid | The bcid that should be investigated | |
dtype | The type of the requested return value | |
ftype | The type of the previous bunch to consider |
Implements Trig::IBunchCrossingTool.
Reimplemented in Trig::MCBunchCrossingTool, and Trig::D3PDBunchCrossingTool.
int Trig::BunchCrossingToolBase::gapBeforeTrain | ( | bcid_type | bcid, | |
BunchDistanceType | type = NanoSec | |||
) | const [virtual] |
Gap before the train this BCID is in.
The function first finds the train that the specified BCID is in. Then it calculates the size of the gap before this train. It can return the size of the gap either in nanoseconds or in BCIDs (25 ns steps).
bcid | The bcid whose train should be investigated | |
type | The type of the requested return value |
Implements Trig::IBunchCrossingTool.
StatusCode Trig::BunchCrossingToolBase::loadBunchTrains | ( | const std::vector< int > & | bunches, | |
const std::vector< float > & | bunch_int1 = std::vector< float >() , |
|||
const std::vector< float > & | bunch_int2 = std::vector< float >() | |||
) | [protected] |
Interpret the configuration for bunch trains.
This function takes care of identifying the bunch trains in the configuration. The algorithm is quite simple. It starts off with all the filled bunches that have not been identified as single bunches by the loadSingleBunches(...) function. It takes the first available bunch crossing, then loops over the rest of them. When it finds a BC that's "close enough" to the current bunch train, then the bunch train is extended. From there on the algorithm continues with this extended bunch train. When the loop reaches the end of the available bunches, the created bunch train is added to the cache, and the algorithms starts again with the first still available bunch crossing.
The bunch intensity parameter is optional. If it's not specified, the code will assign an intensity of "1.0" to all the bunch crossings.
bunches | The filled bunch crossings | |
bunch_int | The "intensities" of the paired bunches |
StatusCode::SUCCESS
if the interpretation was successful, StatusCode::FAILURE
otherwise StatusCode Trig::BunchCrossingToolBase::loadSingleBunches | ( | const std::vector< int > & | bunches, | |
const std::vector< float > & | bunch_int1 = std::vector< float >() , |
|||
const std::vector< float > & | bunch_int2 = std::vector< float >() | |||
) | [protected] |
Interpret the configuration for single bunches.
This function takes care of selecting the single bunches from the paired bunches. These will then not be taken into account in the train finding algorithm.
The bunch intensity parameter is optional. If it's not specified, the code will assign an intensity of "1.0" to all the bunch crossings.
bunches | The paired bunches | |
bunch_int | The "intensities" of the paired bunches |
StatusCode::SUCCESS
if the interpretation was successful, StatusCode::FAILURE
otherwise StatusCode Trig::BunchCrossingToolBase::loadUnpairedBunches | ( | const std::vector< int > & | beam1, | |
const std::vector< int > & | beam2, | |||
const std::vector< float > & | bunch_int1 = std::vector< float >() , |
|||
const std::vector< float > & | bunch_int2 = std::vector< float >() | |||
) | [protected] |
Interpret the configuration for unpaired bunches.
This function just caches the unpaired bunches internally. It doesn't have to do anything as fancy as the other two load functions, it just takes the BCIDs as they are.
bunches | The unpaired bunch crossings | |
bunch_int | The "intensities" of the unpaired bunches |
StatusCode::SUCCESS
if the caching was successful, StatusCode::FAILURE
otherwise void Trig::BunchCrossingToolBase::printConfig | ( | ) | const [protected] |
Function printing the configuration of the tool.
This function is used to print the overall configuration in a format very similar to how atlas-runqery.cern.ch started showing this information recently.