File indexing completed on 2024-09-07 04:37:04
0001 #ifndef TTUEMULATOR_H
0002 #define TTUEMULATOR_H 1
0003
0004
0005 #include "L1Trigger/RPCTechnicalTrigger/interface/RPCInputSignal.h"
0006 #include "L1Trigger/RPCTechnicalTrigger/interface/TTUConfiguration.h"
0007 #include "L1Trigger/RPCTechnicalTrigger/interface/RPCWheel.h"
0008
0009 #include "CondFormats/RPCObjects/interface/RBCBoardSpecs.h"
0010 #include "CondFormats/RPCObjects/interface/TTUBoardSpecs.h"
0011
0012 #include <map>
0013 #include <bitset>
0014 #include <array>
0015 #include <memory>
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 class TTUEmulator {
0040 public:
0041
0042 TTUEmulator() {}
0043
0044 TTUEmulator(int, int);
0045
0046 TTUEmulator(int, const char *, const char *, int);
0047
0048 TTUEmulator(int, const char *, const char *, const char *, int);
0049
0050 bool initialise();
0051
0052 void emulate();
0053
0054 void processTtu(RPCInputSignal *);
0055
0056 void processTtu(RPCInputSignal *, int);
0057
0058 void printinfo() const;
0059
0060 void setSpecifications(const TTUBoardSpecs *, const RBCBoardSpecs *);
0061
0062 void clearTriggerResponse();
0063
0064 int mode() const { return m_mode; };
0065
0066 void setmode(int mode) { m_mode = mode; };
0067
0068 int line() const { return m_line; };
0069
0070 void SetLineId(int);
0071
0072 void setSpecs();
0073
0074 int m_maxWheels;
0075
0076 std::array<RPCWheel, 2> m_Wheels;
0077 std::bitset<2> m_trigger;
0078 std::map<int, std::bitset<2> > m_triggerBx;
0079
0080 class TriggerResponse {
0081 public:
0082 TriggerResponse() {
0083 m_bx = 0;
0084 m_wedge = 0;
0085 m_trigger.reset();
0086 };
0087 ~TriggerResponse() { ; };
0088
0089 void setTriggerBits(int bx, const std::bitset<2> &inbits) {
0090 m_bx = bx;
0091 m_trigger = inbits;
0092 };
0093
0094 void setTriggerBits(int bx, int wdg, const std::bitset<2> &inbits) {
0095 m_bx = bx;
0096 m_wedge = wdg;
0097 m_trigger = inbits;
0098 };
0099
0100 int m_bx;
0101 int m_wedge;
0102 std::bitset<2> m_trigger;
0103 };
0104
0105 std::vector<TriggerResponse> m_triggerBxVec;
0106
0107 protected:
0108 private:
0109 int m_id;
0110 int m_bx;
0111 int m_mode;
0112 int m_line;
0113
0114 std::array<int, 6> m_wheelIds;
0115
0116 std::string m_logtype;
0117
0118 std::array<TTUInput, 2> m_ttuin;
0119
0120 std::unique_ptr<TTUConfiguration> m_ttuconf;
0121
0122 bool m_debug;
0123 };
0124 #endif