ATLAS Offline Software
|
A smart integer class representing bunch crossings. More...
#include <BunchCrossing.h>
Public Member Functions | |
BunchCrossing (int bcid=0, float intBeam1=1.0, float intBeam2=1.0) | |
Constructor with a value. More... | |
BunchCrossing (unsigned int bcid, float intBeam1=1.0, float intBeam2=1.0) | |
Constructor with an unsigned value. More... | |
BunchCrossing (const BunchCrossing &parent) | |
Copy constructor. More... | |
BunchCrossing & | operator= (const BunchCrossing &parent) |
Assignment operator. More... | |
operator int & () | |
Automatic conversion operator. More... | |
operator const int & () const | |
Automatic conversion operator (constant version) More... | |
BunchCrossing & | operator+= (const BunchCrossing &bc) |
Operator adding another BunchCrossing object. More... | |
BunchCrossing & | operator-= (const BunchCrossing &bc) |
Operator subtracting another BunchCrossing object. More... | |
BunchCrossing & | operator++ () |
Operator pushing the object to the next bunch crossing. More... | |
BunchCrossing | operator++ (int) |
Operator pushing the object to the next bunch crossing. More... | |
BunchCrossing & | operator-- () |
Operator pushing the object to the previous bunch crossing. More... | |
BunchCrossing | operator-- (int) |
Operator pushing the object to the previous bunch crossing. More... | |
int | distance (const BunchCrossing &bc) const |
The distance from another bunch crossing. More... | |
int | gapFrom (const BunchCrossing &bc) const |
Distance from a previous bunch crossing. More... | |
int | gapTo (const BunchCrossing &bc) const |
Distance to a following bunch crossing. More... | |
int | bcid () const |
Get the BCID of this bunch crossing. More... | |
void | setBCID (int bcid) |
Set the BCID of this bunch crossing. More... | |
float | intensityBeam1 () const |
Get the "intensity" of beam 1 in this bunch crossing. More... | |
void | setIntensityBeam1 (float intensity) |
Set the "intensity" of beam 1 in this bunch crossing. More... | |
float | intensityBeam2 () const |
Get the "intensity" of beam 2 in this bunch crossing. More... | |
void | setIntensityBeam2 (float intensity) |
Set the "intensity" of beam 2 in this bunch crossing. More... | |
bool | operator== (const BunchCrossing &bc) const |
Equality operator for bunch crossings. More... | |
Static Public Attributes | |
static const int | BUNCH_SPACING = 25 |
Minimum spacing between the bunches, in nanoseconds. More... | |
static const int | MAX_BCID = 3564 |
The maximum number of bunches that can be in the LHC. More... | |
Private Attributes | |
int | m_bcid |
The BCID of this bunch crossing. More... | |
float | m_intensityBeam1 |
Intensity of the bunch in "beam 1" some measure. More... | |
float | m_intensityBeam2 |
Intensity of the bunch in "beam 2" some measure. More... | |
A smart integer class representing bunch crossings.
There can be a maximum of 3564 bunches in the LHC. And BCID #0 and #3563 are just beside each other. To have the STL algorithms take this into account, objects of this class behave as "smart" integer variables, which respect the properties of the LHC.
Definition at line 33 of file BunchCrossing.h.
Trig::BunchCrossing::BunchCrossing | ( | int | bcid = 0 , |
float | intBeam1 = 1.0 , |
||
float | intBeam2 = 1.0 |
||
) |
Constructor with a value.
The TrigConf::BunchGroup objects store the BCIDs as signed integers, hence this constructor.
bcid | The bunch crossing ID of the bunch crossing |
intBeam1 | The intensity of beam 1, or the intensity/luminosity of the crossing |
intBeam2 | The intensity of beam 2 |
Definition at line 33 of file BunchCrossing.cxx.
Trig::BunchCrossing::BunchCrossing | ( | unsigned int | bcid, |
float | intBeam1 = 1.0 , |
||
float | intBeam2 = 1.0 |
||
) |
Constructor with an unsigned value.
The EventID objects store the BCIDs as unsigned integers, so this other version has to exist as well.
(In order to define clearly what the compiler should do.)
bcid | The bunch crossing ID of the bunch crossing |
intBeam1 | The intensity of beam 1, or the intensity/luminosity of the crossing |
intBeam2 | The intensity of beam 2 |
Definition at line 55 of file BunchCrossing.cxx.
Trig::BunchCrossing::BunchCrossing | ( | const BunchCrossing & | parent | ) |
Copy constructor.
The copy constructor makes sure that only important properites are copied.
The class at one point had some transient variables. But not anymore, so this constructor is pretty useless. But at least it's not harmful...
parent | The object that is to be copied |
Definition at line 75 of file BunchCrossing.cxx.
int Trig::BunchCrossing::bcid | ( | ) | const |
Get the BCID of this bunch crossing.
Some parts of the code have to access the BCID and the bunch crossing intensity explicitly, it's just nicer (and more readable) to do it using a function than to use the dereferencing operator (*) in all those cases.
Definition at line 267 of file BunchCrossing.cxx.
int Trig::BunchCrossing::distance | ( | const BunchCrossing & | bc | ) | const |
The distance from another bunch crossing.
Function calculating the absolute value of the distance of two bunches.
If you just use something like std::abs( b1 - b2 )
, the result will depend on the order of the two bunches. Sometimes that's the expected behaviour, but for simple distance calculations this function should be used.
bc | The other BunchCrossing |
Definition at line 216 of file BunchCrossing.cxx.
int Trig::BunchCrossing::gapFrom | ( | const BunchCrossing & | bc | ) | const |
Distance from a previous bunch crossing.
As it turns out, the distance(...)
function can not be used when calculating the gaps between bunches, as the "direction" of the gap matters a lot in this case.
(So, the gap can be larger than half of the LHC ring.)
In the end, this is just a nicely named function on top of the arithmetic that was designed for this class.
bc | The "previous" bunch to which the distance should be calculated |
Definition at line 238 of file BunchCrossing.cxx.
int Trig::BunchCrossing::gapTo | ( | const BunchCrossing & | bc | ) | const |
Distance to a following bunch crossing.
As it turns out, the distance(...)
function can not be used when calculating the gaps between bunches, as the "direction" of the gap matters a lot in this case.
(So, the gap can be larger than half of the LHC ring.)
In the end, this is just a nicely named function on top of the arithmetic that was designed for this class.
bc | The "next" bunch to which the distance should be calculated |
Definition at line 255 of file BunchCrossing.cxx.
float Trig::BunchCrossing::intensityBeam1 | ( | ) | const |
Get the "intensity" of beam 1 in this bunch crossing.
The intensity of the beam in a bunch crossing means a bit different things for data and for MC, but in both cases it can be described by a floating point number.
Definition at line 291 of file BunchCrossing.cxx.
float Trig::BunchCrossing::intensityBeam2 | ( | ) | const |
Get the "intensity" of beam 2 in this bunch crossing.
The intensity of the beam in a bunch crossing means a bit different things for data and for MC, but in both cases it can be described by a floating point number.
Definition at line 321 of file BunchCrossing.cxx.
Trig::BunchCrossing::operator const int & | ( | ) | const |
Automatic conversion operator (constant version)
The automatic conversion operators are here to be able to handle bunch crossing objects like a simple integer value in the code.
This makes using the STL code much simpler in some places.
Definition at line 119 of file BunchCrossing.cxx.
Trig::BunchCrossing::operator int & | ( | ) |
Automatic conversion operator.
The automatic conversion operators are here to be able to handle bunch crossing objects like a simple integer value in the code.
This makes using the STL code much simpler in some places.
Definition at line 107 of file BunchCrossing.cxx.
BunchCrossing & Trig::BunchCrossing::operator++ | ( | ) |
Operator pushing the object to the next bunch crossing.
This operator can be used when you want to iterate over bunch crossings.
It makes sure that the bunch crossings follow each other in the right order.
Definition at line 164 of file BunchCrossing.cxx.
BunchCrossing Trig::BunchCrossing::operator++ | ( | int | ) |
Operator pushing the object to the next bunch crossing.
This operator can be used when you want to iterate over bunch crossings.
It makes sure that the bunch crossings follow each other in the right order.
Definition at line 175 of file BunchCrossing.cxx.
BunchCrossing & Trig::BunchCrossing::operator+= | ( | const BunchCrossing & | bc | ) |
Operator adding another BunchCrossing object.
This operator is overriden to take the properties of the LHC bunches into account.
bc | The bunch crossing that should be added to this one |
Definition at line 131 of file BunchCrossing.cxx.
BunchCrossing & Trig::BunchCrossing::operator-- | ( | ) |
Operator pushing the object to the previous bunch crossing.
This operator can be used when you want to iterate over bunch crossings.
It makes sure that the bunch crossings follow each other in the right order.
Definition at line 188 of file BunchCrossing.cxx.
BunchCrossing Trig::BunchCrossing::operator-- | ( | int | ) |
Operator pushing the object to the previous bunch crossing.
This operator can be used when you want to iterate over bunch crossings.
It makes sure that the bunch crossings follow each other in the right order.
Definition at line 199 of file BunchCrossing.cxx.
BunchCrossing & Trig::BunchCrossing::operator-= | ( | const BunchCrossing & | bc | ) |
Operator subtracting another BunchCrossing object.
This operator is overriden to take the properties of the LHC bunches into account.
bc | The bunch crossing that should be subtracted from this one |
Definition at line 148 of file BunchCrossing.cxx.
BunchCrossing & Trig::BunchCrossing::operator= | ( | const BunchCrossing & | parent | ) |
Assignment operator.
Just like the copy constructor, this operator isn't strictly speaking needed either.
But if I left the copy constructor in, I should have this here as well.
parent | The object whose properties are to be copied |
Definition at line 88 of file BunchCrossing.cxx.
bool Trig::BunchCrossing::operator== | ( | const BunchCrossing & | bc | ) | const |
Equality operator for bunch crossings.
The compiler would probably be able to do this same thing automatically thanks to the automatic conversion operators, but I wanted to be sure.
The equality of two BunchCrossing objects should not depend on the intensity stored in them, only the BCIDs that they describe.
bc | The bunch crossing object that this object should be compared to |
true
if the BCID of the two objects is the same, false
otherwise Definition at line 354 of file BunchCrossing.cxx.
void Trig::BunchCrossing::setBCID | ( | int | bcid | ) |
Set the BCID of this bunch crossing.
This function is not used anywhere in the code I think, but for completeness's sake it makes sense to have it here.
bcid | The BCID that this object should describe |
Definition at line 278 of file BunchCrossing.cxx.
void Trig::BunchCrossing::setIntensityBeam1 | ( | float | intensity | ) |
Set the "intensity" of beam 1 in this bunch crossing.
intensity | The value that the beam 1 intensity should be set to |
Definition at line 300 of file BunchCrossing.cxx.
void Trig::BunchCrossing::setIntensityBeam2 | ( | float | intensity | ) |
Set the "intensity" of beam 2 in this bunch crossing.
intensity | The value that the beam 2 intensity should be set to |
Definition at line 330 of file BunchCrossing.cxx.
|
static |
Minimum spacing between the bunches, in nanoseconds.
Definition at line 48 of file BunchCrossing.h.
|
private |
The BCID of this bunch crossing.
Definition at line 98 of file BunchCrossing.h.
|
private |
Intensity of the bunch in "beam 1" some measure.
Definition at line 100 of file BunchCrossing.h.
|
private |
Intensity of the bunch in "beam 2" some measure.
Definition at line 102 of file BunchCrossing.h.
|
static |
The maximum number of bunches that can be in the LHC.
Definition at line 50 of file BunchCrossing.h.