ATLAS Offline Software
BunchCrossingToolBase.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef TRIGBUNCHCROSSINGTOOL_BUNCHCROSSINGTOOLBASE_H
8 #define TRIGBUNCHCROSSINGTOOL_BUNCHCROSSINGTOOLBASE_H
9 
10 // STL include(s):
11 #include <set>
12 #include <vector>
13 #include <string>
14 
15 // Gaudi/Athena include(s):
17 
18 // Interface include(s):
20 
21 // Local include(s):
24 
25 namespace Trig {
26 
40  class BunchCrossingToolBase : public virtual IBunchCrossingTool,
41  public asg::AsgMetadataTool {
42 
43  public:
45  BunchCrossingToolBase( const std::string& name = "BunchCrossingToolBase" );
46 
49 
51  virtual bool isFilled( bcid_type bcid ) const;
52 
54  virtual bool isInTrain( bcid_type bcid ) const;
55 
57  virtual bool isUnpaired( bcid_type bcid ) const;
58 
60  virtual bool isBeam1( bcid_type bcid ) const;
61 
63  virtual bool isBeam2( bcid_type bcid ) const;
64 
66  virtual float bcIntensity( bcid_type bcid,
67  BeamType type = Crossing ) const;
68 
70  virtual BunchCrossingType bcType( bcid_type bcid ) const;
71 
73  virtual int distanceFromFront( bcid_type bcid,
74  BunchDistanceType type = NanoSec ) const;
76  virtual int distanceFromTail( bcid_type bcid,
77  BunchDistanceType type = NanoSec ) const;
78 
80  virtual int gapBeforeTrain( bcid_type bcid,
81  BunchDistanceType type = NanoSec ) const;
83  virtual int gapAfterTrain( bcid_type bcid,
84  BunchDistanceType type = NanoSec ) const;
85 
87  virtual int gapBeforeBunch( bcid_type bcid,
89  BunchFillType ftype = CollidingBunch ) const;
91  virtual int gapAfterBunch( bcid_type bcid,
93  BunchFillType ftype = CollidingBunch ) const;
94 
96  virtual std::vector< bool > bunchesInFront( bcid_type bcid,
97  int bunches = 10 ) const;
99  virtual std::vector< bool > bunchesAfter( bcid_type bcid = 0,
100  int bunches = 10 ) const;
101 
103  virtual std::vector< float > bunchIntInFront( bcid_type bcid,
104  int bunches = 10,
105  BeamType type = Crossing ) const;
107  virtual std::vector< float > bunchIntAfter( bcid_type bcid,
108  int bunches = 10,
109  BeamType type = Crossing ) const;
110 
112  virtual unsigned int numberOfFilledBunches() const;
114  virtual unsigned int numberOfUnpairedBunches() const;
116  virtual unsigned int numberOfBunchTrains() const;
118  virtual int bunchTrainSpacing( BunchDistanceType type = NanoSec ) const;
119 
121 
122  protected:
124  StatusCode loadSingleBunches( const std::vector< int >& bunches,
125  const std::vector< float >& bunch_int1 =
126  std::vector< float >(),
127  const std::vector< float >& bunch_int2 =
128  std::vector< float >() );
130  StatusCode loadBunchTrains( const std::vector< int >& bunches,
131  const std::vector< float >& bunch_int1 =
132  std::vector< float >(),
133  const std::vector< float >& bunch_int2 =
134  std::vector< float >() );
136  StatusCode loadUnpairedBunches( const std::vector< int >& beam1,
137  const std::vector< int >& beam2,
138  const std::vector< float >& bunch_int1 =
139  std::vector< float >(),
140  const std::vector< float >& bunch_int2 =
141  std::vector< float >() );
142 
144  void printConfig() const;
145 
148 
150  std::set< Trig::BunchCrossing > m_filledBunches;
152  std::set< Trig::BunchCrossing > m_singleBunches;
154  std::set< Trig::BunchCrossing > m_unpairedBunches;
156  std::set< Trig::BunchTrain > m_bunchTrains;
157 
159 
162 
169 
171 
172  private:
174  int bunchSpacing( const std::vector< int >& bunches ) const;
175 
176  }; // class BunchCrossingToolBase
177 
178 } // namespace Trig
179 
180 #endif // TRIGBUNCHCROSSINGTOOL_BUNCHCROSSINGTOOLBASE_H
Trig::BunchCrossingToolBase::bunchIntInFront
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.
Definition: BunchCrossingToolBase.cxx:750
IBunchCrossingTool.h
Trig::BunchCrossingToolBase
Base class for all BunchCrossingTool implementations.
Definition: BunchCrossingToolBase.h:41
ForwardTracker::beam1
@ beam1
Definition: ForwardTrackerConstants.h:13
Trig::BunchCrossingToolBase::bcType
virtual BunchCrossingType bcType(bcid_type bcid) const
Get the type of the specific bunch crossing.
Definition: BunchCrossingToolBase.cxx:166
Trig::IBunchCrossingTool
Interface for all the bunch crossing tools.
Definition: IBunchCrossingTool.h:40
ForwardTracker::beam2
@ beam2
Definition: ForwardTrackerConstants.h:13
Trig::BunchCrossingToolBase::BunchCrossingToolBase
BunchCrossingToolBase(const std::string &name="BunchCrossingToolBase")
Default constructor.
Definition: BunchCrossingToolBase.cxx:21
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
Trig::BunchCrossingToolBase::m_singleBunches
std::set< Trig::BunchCrossing > m_singleBunches
Internal list of single bunches.
Definition: BunchCrossingToolBase.h:152
PlotCalibFromCool.dtype
dtype
Definition: PlotCalibFromCool.py:495
BunchTrain.h
Trig::BunchCrossingToolBase::isInTrain
virtual bool isInTrain(bcid_type bcid) const
Function deciding if a given bunch crossing is in a filled train.
Definition: BunchCrossingToolBase.cxx:42
Trig::BunchCrossingToolBase::bunchSpacing
int bunchSpacing(const std::vector< int > &bunches) const
Get the apparent bunch spacing in the current configuration.
Definition: BunchCrossingToolBase.cxx:1226
Trig::BunchCrossingToolBase::isBeam1
virtual bool isBeam1(bcid_type bcid) const
Function deciding if there was a bunch from "beam 1" in this bunch crossing.
Definition: BunchCrossingToolBase.cxx:66
Trig::BunchCrossingToolBase::m_filledBunches
std::set< Trig::BunchCrossing > m_filledBunches
List of colliding bunches.
Definition: BunchCrossingToolBase.h:150
Trig::BunchCrossingToolBase::m_tailLength
int m_tailLength
Length of the "tail" of a bunch train.
Definition: BunchCrossingToolBase.h:168
Trig::IBunchCrossingTool::Crossing
@ Crossing
The returned intensity should describe the BC.
Definition: IBunchCrossingTool.h:121
Trig::BunchCrossingToolBase::m_bunchTrains
std::set< Trig::BunchTrain > m_bunchTrains
Internal list of bunch trains.
Definition: BunchCrossingToolBase.h:156
Trig::BunchCrossingToolBase::m_unpairedBunches
std::set< Trig::BunchCrossing > m_unpairedBunches
Internal list of unpaired bunches.
Definition: BunchCrossingToolBase.h:154
BunchCrossing.h
Trig::BunchCrossingToolBase::printConfig
void printConfig() const
Function printing the configuration of the tool.
Definition: BunchCrossingToolBase.cxx:1199
Trig::BunchCrossingToolBase::bunchIntAfter
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.
Definition: BunchCrossingToolBase.cxx:781
Trig::BunchCrossingToolBase::bunchesAfter
virtual std::vector< bool > bunchesAfter(bcid_type bcid=0, int bunches=10) const
Function returning whether the following bunches were filled, and how.
Definition: BunchCrossingToolBase.cxx:734
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trig::IBunchCrossingTool::BunchCrossingType
BunchCrossingType
Simplified type for a given bunch crossing.
Definition: IBunchCrossingTool.h:145
Trig::IBunchCrossingTool::CollidingBunch
@ CollidingBunch
The gap should be calculated wrt. the closest colling bunch.
Definition: IBunchCrossingTool.h:276
Trig::BunchCrossingToolBase::numberOfUnpairedBunches
virtual unsigned int numberOfUnpairedBunches() const
Get the number of unpaired bunches in the current configuration.
Definition: BunchCrossingToolBase.cxx:816
Trig::BunchCrossingToolBase::distanceFromTail
virtual int distanceFromTail(bcid_type bcid, BunchDistanceType type=NanoSec) const
The distance of the specific bunch crossing from the tail of the train.
Definition: BunchCrossingToolBase.cxx:316
Trig::IBunchCrossingTool::NanoSec
@ NanoSec
Distance in nanoseconds.
Definition: IBunchCrossingTool.h:175
Trig::BunchCrossingToolBase::distanceFromFront
virtual int distanceFromFront(bcid_type bcid, BunchDistanceType type=NanoSec) const
The distance of the specific bunch crossing from the front of the train.
Definition: BunchCrossingToolBase.cxx:239
Trig::IBunchCrossingTool::bcid_type
unsigned int bcid_type
Declare the interface that this class provides.
Definition: IBunchCrossingTool.h:47
Trig::BunchCrossingToolBase::bunchTrainSpacing
virtual int bunchTrainSpacing(BunchDistanceType type=NanoSec) const
Get the bunch spacing in the trains.
Definition: BunchCrossingToolBase.cxx:827
Trig::IBunchCrossingTool::BeamType
BeamType
Types of the return values of the bcIntensity function.
Definition: IBunchCrossingTool.h:118
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trig::BunchCrossingToolBase::isFilled
virtual bool isFilled(bcid_type bcid) const
The simplest query: Is the bunch crossing filled or not?
Definition: BunchCrossingToolBase.cxx:32
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
Trig::BunchCrossingToolBase::bcIntensity
virtual float bcIntensity(bcid_type bcid, BeamType type=Crossing) const
Function returning the "intensity" of a given bunch crossing.
Definition: BunchCrossingToolBase.cxx:106
Trig::BunchCrossingToolBase::m_maxBunchSpacing
int m_maxBunchSpacing
The maximum bunch spacing that the tool should consider.
Definition: BunchCrossingToolBase.h:164
Trig::BunchCrossingToolBase::gapBeforeTrain
virtual int gapBeforeTrain(bcid_type bcid, BunchDistanceType type=NanoSec) const
Gap before the train this BCID is in.
Definition: BunchCrossingToolBase.cxx:374
Trig::BunchCrossingToolBase::gapAfterBunch
virtual int gapAfterBunch(bcid_type bcid, BunchDistanceType dtype=NanoSec, BunchFillType ftype=CollidingBunch) const
Gap after a particular bunch.
Definition: BunchCrossingToolBase.cxx:608
Trig::BunchCrossingToolBase::loadUnpairedBunches
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.
Definition: BunchCrossingToolBase.cxx:1118
Trig::BunchCrossingToolBase::loadSingleBunches
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.
Definition: BunchCrossingToolBase.cxx:871
Trig::BunchCrossingToolBase::bunchesInFront
virtual std::vector< bool > bunchesInFront(bcid_type bcid, int bunches=10) const
Function returning whether the previous bunches were filled, and how.
Definition: BunchCrossingToolBase.cxx:718
asg::AsgMetadataTool
Base class for dual-use tools that provide file metadata access.
Definition: AsgMetadataTool.h:48
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AsgMetadataTool.h
Trig::BunchCrossingToolBase::gapAfterTrain
virtual int gapAfterTrain(bcid_type bcid, BunchDistanceType type=NanoSec) const
Gap after the train this BCID is in.
Definition: BunchCrossingToolBase.cxx:429
Trig::BunchCrossingToolBase::isUnpaired
virtual bool isUnpaired(bcid_type bcid) const
Function deciding if a given bunch crossing has an unpaired bunch.
Definition: BunchCrossingToolBase.cxx:56
Trig::BunchCrossingToolBase::numberOfFilledBunches
virtual unsigned int numberOfFilledBunches() const
Get the number of filled bunches in the current configuration.
Definition: BunchCrossingToolBase.cxx:811
Trig::IBunchCrossingTool::BunchDistanceType
BunchDistanceType
Enumeration specifying the units in which to expect the bunch distance type.
Definition: IBunchCrossingTool.h:174
Trig::BunchCrossingToolBase::loadBunchTrains
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.
Definition: BunchCrossingToolBase.cxx:987
Trig::BunchCrossingToolBase::gapBeforeBunch
virtual int gapBeforeBunch(bcid_type bcid, BunchDistanceType dtype=NanoSec, BunchFillType ftype=CollidingBunch) const
Gap before a particular bunch.
Definition: BunchCrossingToolBase.cxx:487
Trig::IBunchCrossingTool::BunchFillType
BunchFillType
Enumeration specifying what kind of bunch to use in the gap functions.
Definition: IBunchCrossingTool.h:274
Trig::BunchCrossingToolBase::m_frontLength
int m_frontLength
Length of the "front" of a bunch train.
Definition: BunchCrossingToolBase.h:166
Trig::BunchCrossingToolBase::isBeam2
virtual bool isBeam2(bcid_type bcid) const
Function deciding if there was a bunch from "beam 2" in this bunch crossing.
Definition: BunchCrossingToolBase.cxx:86
Trig::BunchCrossingToolBase::numberOfBunchTrains
virtual unsigned int numberOfBunchTrains() const
Get the number of the bunch trains in the current configuration.
Definition: BunchCrossingToolBase.cxx:821