Trig::BunchCrossingToolBase Class Reference

Base class for all BunchCrossingTool implementations. More...

#include <BunchCrossingToolBase.h>

Inheritance diagram for Trig::BunchCrossingToolBase:
Trig::IBunchCrossingTool asg::AsgMetadataTool asg::IAsgTool asg::AsgTool asg::IAsgTool Trig::D3PDBunchCrossingTool Trig::LHCBunchCrossingTool Trig::MCBunchCrossingTool Trig::StaticBunchCrossingTool Trig::TrigConfBunchCrossingTool Trig::WebBunchCrossingTool Trig::xAODBunchCrossingTool

List of all members.

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::BunchCrossingm_filledBunches
 List of colliding bunches.
std::set< Trig::BunchCrossingm_singleBunches
 Internal list of single bunches.
std::set< Trig::BunchCrossingm_unpairedBunches
 Internal list of unpaired bunches.
std::set< Trig::BunchTrainm_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.

Detailed Description

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.

Author:
Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
Revision
618331
Date
2014-09-24 13:55:26 +0200 (Wed, 24 Sep 2014)

Constructor & Destructor Documentation

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:


Member Function Documentation

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:

  • First is when the bunch train doesn't spread across the "BCID turnover". The code in this case just has to see how many steps it is from bunchtrain->begin().
  • If the bunch train spreads across the "BCID turnover", and the bcid is after BCID==0, the code has to count the filled bunches from bunchtrain->train_front() to bunchtrain->end(), plus the filled bunches from bunchtrain->begin() to the bcid in question.
  • If the bunch train spreads across the "BCID turnover", and the bcid is "before" BCID==0, the code has to count the filled bunches from bunchtrain->train_front() to the bcid in question.
Parameters:
bcid The bcid that should be checked
type The type of the requested return value
Returns:
The distance of the bcid in question from the front of its bunch train

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:

  • First is when the bunch train doesn't spread across the "BCID turnover". The code in this case just has to see how many steps it is from bunchtrain->end().
  • If the bunch train spreads across the "BCID turnover", and the bcid is "before" BCID==0, the code has to count the filled bunches from the bcid in question to bunchtrain->end(), plus the filled bunches from bunchtrain->begin() to bunchtrain->train_back().
  • If the bunch train spreads across the "BCID turnover", and the bcid is after BCID==0, the code has to count the filled bunches from the bcid in question to bunchtrain->train_back().
Parameters:
bcid The bcid that should be checked
type The type of the requested return value
Returns:
The distance of the bcid in question from the tail of its bunch train

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).

Parameters:
bcid The bcid that should be investigated
dtype The type of the requested return value
ftype The type of the previous bunch to consider
Returns:
The gap after the specified bcid

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).

Parameters:
bcid The bcid whose train should be investigated
type The type of the requested return value
Returns:
The gap after the train of the specified bcid

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).

Parameters:
bcid The bcid that should be investigated
dtype The type of the requested return value
ftype The type of the previous bunch to consider
Returns:
The gap before the specified bcid

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).

Parameters:
bcid The bcid whose train should be investigated
type The type of the requested return value
Returns:
The gap before the train of the specified bcid

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.

Parameters:
bunches The filled bunch crossings
bunch_int The "intensities" of the paired bunches
Returns:
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.

Parameters:
bunches The paired bunches
bunch_int The "intensities" of the paired bunches
Returns:
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.

Parameters:
bunches The unpaired bunch crossings
bunch_int The "intensities" of the unpaired bunches
Returns:
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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 15 Apr 2017 for RootCore Packages by  doxygen 1.6.1