00001
00002
00003 #ifndef TRIGBUNCHCROSSINGTOOL_BUNCHCROSSINGTOOLBASE_H
00004 #define TRIGBUNCHCROSSINGTOOL_BUNCHCROSSINGTOOLBASE_H
00005
00006
00007 #include <set>
00008 #include <vector>
00009 #include <string>
00010
00011
00012 #include "AsgTools/AsgMetadataTool.h"
00013
00014
00015 #include "TrigAnalysisInterfaces/IBunchCrossingTool.h"
00016
00017
00018 #include "TrigBunchCrossingTool/BunchCrossing.h"
00019 #include "TrigBunchCrossingTool/BunchTrain.h"
00020
00021 namespace Trig {
00022
00036 class BunchCrossingToolBase : public virtual IBunchCrossingTool,
00037 public asg::AsgMetadataTool {
00038
00039 public:
00041 BunchCrossingToolBase( const std::string& name = "BunchCrossingToolBase" );
00042
00045
00047 virtual bool isFilled( bcid_type bcid ) const;
00048
00050 virtual bool isInTrain( bcid_type bcid ) const;
00051
00053 virtual bool isUnpaired( bcid_type bcid ) const;
00054
00056 virtual bool isBeam1( bcid_type bcid ) const;
00057
00059 virtual bool isBeam2( bcid_type bcid ) const;
00060
00062 virtual float bcIntensity( bcid_type bcid,
00063 BeamType type = Crossing ) const;
00064
00066 virtual BunchCrossingType bcType( bcid_type bcid ) const;
00067
00069 virtual int distanceFromFront( bcid_type bcid,
00070 BunchDistanceType type = NanoSec ) const;
00072 virtual int distanceFromTail( bcid_type bcid,
00073 BunchDistanceType type = NanoSec ) const;
00074
00076 virtual int gapBeforeTrain( bcid_type bcid,
00077 BunchDistanceType type = NanoSec ) const;
00079 virtual int gapAfterTrain( bcid_type bcid,
00080 BunchDistanceType type = NanoSec ) const;
00081
00083 virtual int gapBeforeBunch( bcid_type bcid,
00084 BunchDistanceType dtype = NanoSec,
00085 BunchFillType ftype = CollidingBunch ) const;
00087 virtual int gapAfterBunch( bcid_type bcid,
00088 BunchDistanceType dtype = NanoSec,
00089 BunchFillType ftype = CollidingBunch ) const;
00090
00092 virtual std::vector< bool > bunchesInFront( bcid_type bcid,
00093 int bunches = 10 ) const;
00095 virtual std::vector< bool > bunchesAfter( bcid_type bcid = 0,
00096 int bunches = 10 ) const;
00097
00099 virtual std::vector< float > bunchIntInFront( bcid_type bcid,
00100 int bunches = 10,
00101 BeamType type = Crossing ) const;
00103 virtual std::vector< float > bunchIntAfter( bcid_type bcid,
00104 int bunches = 10,
00105 BeamType type = Crossing ) const;
00106
00108 virtual unsigned int numberOfFilledBunches() const;
00110 virtual unsigned int numberOfUnpairedBunches() const;
00112 virtual unsigned int numberOfBunchTrains() const;
00114 virtual int bunchTrainSpacing( BunchDistanceType type = NanoSec ) const;
00115
00117
00118 protected:
00120 StatusCode loadSingleBunches( const std::vector< int >& bunches,
00121 const std::vector< float >& bunch_int1 =
00122 std::vector< float >(),
00123 const std::vector< float >& bunch_int2 =
00124 std::vector< float >() );
00126 StatusCode loadBunchTrains( const std::vector< int >& bunches,
00127 const std::vector< float >& bunch_int1 =
00128 std::vector< float >(),
00129 const std::vector< float >& bunch_int2 =
00130 std::vector< float >() );
00132 StatusCode loadUnpairedBunches( const std::vector< int >& beam1,
00133 const std::vector< int >& beam2,
00134 const std::vector< float >& bunch_int1 =
00135 std::vector< float >(),
00136 const std::vector< float >& bunch_int2 =
00137 std::vector< float >() );
00138
00140 void printConfig() const;
00141
00144
00146 std::set< Trig::BunchCrossing > m_filledBunches;
00148 std::set< Trig::BunchCrossing > m_singleBunches;
00150 std::set< Trig::BunchCrossing > m_unpairedBunches;
00152 std::set< Trig::BunchTrain > m_bunchTrains;
00153
00155
00158
00160 int m_maxBunchSpacing;
00162 int m_frontLength;
00164 int m_tailLength;
00165
00167
00168 };
00169
00170 }
00171
00172 #endif // TRIGBUNCHCROSSINGTOOL_BUNCHCROSSINGTOOLBASE_H