File indexing completed on 2024-04-06 12:04:02
0001 #ifndef DTDigi_DTControlData_h
0002 #define DTDigi_DTControlData_h
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "DataFormats/DTDigi/interface/DTDDUWords.h"
0012 #include "DataFormats/FEDRawData/interface/FEDHeader.h"
0013 #include "DataFormats/FEDRawData/interface/FEDTrailer.h"
0014
0015 #include <vector>
0016
0017 typedef std::pair<int, DTROBHeaderWord> DTROBHeader;
0018 typedef std::pair<int, DTTDCMeasurementWord> DTTDCData;
0019 typedef std::pair<int, DTTDCErrorWord> DTTDCError;
0020 typedef std::pair<DTLocalTriggerDataWord, int> DTSectorCollectorData;
0021
0022 class DTROS25Data {
0023 public:
0024
0025 DTROS25Data(int ROSId = 0) : theROSId(ROSId) {}
0026
0027
0028 virtual ~DTROS25Data() {}
0029
0030
0031 inline void setROSId(const int& ID) { theROSId = ID; }
0032
0033 inline void addROSHeader(const DTROSHeaderWord& word) { theROSHeader = DTROSHeaderWord(word); }
0034 inline void addROSTrailer(const DTROSTrailerWord& word) { theROSTrailer = DTROSTrailerWord(word); }
0035 inline void addROSError(const DTROSErrorWord& word) { theROSErrors.push_back(word); }
0036 inline void addROSDebug(const DTROSDebugWord& word) { theROSDebugs.push_back(word); }
0037 inline void addROBHeader(const DTROBHeader& robHeader) { theROBHeaders.push_back(robHeader); }
0038 inline void addROBTrailer(const DTROBTrailerWord& word) { theROBTrailers.push_back(word); }
0039 inline void addTDCMeasurement(const DTTDCMeasurementWord& word) { theTDCMeasurements.push_back(word); }
0040 inline void addTDCData(const DTTDCData& tdcData) { theTDCData.push_back(tdcData); }
0041 inline void addTDCError(const DTTDCError& tdcError) { theTDCError.push_back(tdcError); }
0042 inline void addSCData(const DTSectorCollectorData& scData) { theSCData.push_back(scData); }
0043 inline void addSCHeader(const DTLocalTriggerHeaderWord& scHeader) { theSCHeader = scHeader; }
0044 inline void addSCPrivHeader(const DTLocalTriggerSectorCollectorHeaderWord& scPrivHeader) {
0045 theSCPrivateHeader = scPrivHeader;
0046 }
0047 inline void addSCPrivSubHeader(const DTLocalTriggerSectorCollectorSubHeaderWord& scPrivSubHeader) {
0048 theSCPrivateSubHeader = scPrivSubHeader;
0049 }
0050 inline void addSCTrailer(const DTLocalTriggerTrailerWord& scTrailer) { theSCTrailer = scTrailer; }
0051
0052
0053 inline int getROSID() const { return theROSId; }
0054
0055 inline const DTROSTrailerWord& getROSTrailer() const { return theROSTrailer; }
0056 inline const DTROSHeaderWord& getROSHeader() const { return theROSHeader; }
0057 inline const std::vector<DTROSErrorWord>& getROSErrors() const { return theROSErrors; }
0058 inline const std::vector<DTROSDebugWord>& getROSDebugs() const { return theROSDebugs; }
0059 inline const std::vector<DTROBHeader>& getROBHeaders() const { return theROBHeaders; }
0060 inline const std::vector<DTROBTrailerWord>& getROBTrailers() const { return theROBTrailers; }
0061 inline const std::vector<DTTDCMeasurementWord>& getTDCMeasurements() const { return theTDCMeasurements; }
0062 inline const std::vector<DTTDCData>& getTDCData() const { return theTDCData; }
0063 inline const std::vector<DTTDCError>& getTDCError() const { return theTDCError; }
0064 inline const std::vector<DTSectorCollectorData>& getSCData() const { return theSCData; }
0065 inline const DTLocalTriggerHeaderWord& getSCHeader() const { return theSCHeader; }
0066 inline const DTLocalTriggerSectorCollectorHeaderWord& getSCPrivHeader() const { return theSCPrivateHeader; }
0067 inline const DTLocalTriggerTrailerWord& getSCTrailer() const { return theSCTrailer; }
0068 inline const DTLocalTriggerSectorCollectorSubHeaderWord& getSCPrivSubHeader() const { return theSCPrivateSubHeader; }
0069
0070 inline void clean() {
0071 theROSHeader = 0;
0072 theROSTrailer = 0;
0073 theROSErrors.clear();
0074 theROSDebugs.clear();
0075 theROBHeaders.clear();
0076 theROBTrailers.clear();
0077 theTDCMeasurements.clear();
0078 theTDCData.clear();
0079 theTDCError.clear();
0080 theSCData.clear();
0081 theSCHeader = 0;
0082 theSCTrailer = 0;
0083 }
0084
0085 private:
0086 int theROSId;
0087
0088 DTROSHeaderWord theROSHeader;
0089 DTROSTrailerWord theROSTrailer;
0090 std::vector<DTROSErrorWord> theROSErrors;
0091 std::vector<DTROSDebugWord> theROSDebugs;
0092 std::vector<DTROBHeader> theROBHeaders;
0093 std::vector<DTROBTrailerWord> theROBTrailers;
0094 std::vector<DTTDCMeasurementWord> theTDCMeasurements;
0095 std::vector<DTTDCData> theTDCData;
0096 std::vector<DTTDCError> theTDCError;
0097 std::vector<DTSectorCollectorData> theSCData;
0098 DTLocalTriggerHeaderWord theSCHeader;
0099 DTLocalTriggerSectorCollectorHeaderWord theSCPrivateHeader;
0100 DTLocalTriggerTrailerWord theSCTrailer;
0101 DTLocalTriggerSectorCollectorSubHeaderWord theSCPrivateSubHeader;
0102 };
0103
0104 class DTDDUData {
0105 public:
0106
0107 DTDDUData(const FEDHeader& dduHeader, const FEDTrailer& dduTrailer)
0108 : theDDUHeader(dduHeader), theDDUTrailer(dduTrailer), crcErrorBitSet(false) {}
0109
0110 DTDDUData() : theDDUHeader(nullptr), theDDUTrailer(nullptr), crcErrorBitSet(false) {}
0111
0112
0113 virtual ~DTDDUData() {}
0114
0115
0116 inline void addDDUHeader(const FEDHeader& word) { theDDUHeader = word; }
0117 inline void addDDUTrailer(const FEDTrailer& word) { theDDUTrailer = word; }
0118 inline void addROSStatusWord(const DTDDUFirstStatusWord& word) { theROSStatusWords.push_back(word); }
0119 inline void addDDUStatusWord(const DTDDUSecondStatusWord& word) { theDDUStatusWord = word; }
0120 inline void checkCRCBit(const unsigned char* trailer) {
0121 const FEDTrailer fedTrailer(trailer);
0122 crcErrorBitSet = fedTrailer.crcModified();
0123 }
0124
0125
0126 inline const FEDHeader& getDDUHeader() const { return theDDUHeader; }
0127 inline const FEDTrailer& getDDUTrailer() const { return theDDUTrailer; }
0128 inline const std::vector<DTDDUFirstStatusWord>& getFirstStatusWord() const { return theROSStatusWords; }
0129 inline const DTDDUSecondStatusWord& getSecondStatusWord() const { return theDDUStatusWord; }
0130 inline bool crcErrorBit() const { return crcErrorBitSet; }
0131
0132
0133 inline void clean() { theROSStatusWords.clear(); }
0134
0135 private:
0136 FEDHeader theDDUHeader;
0137 FEDTrailer theDDUTrailer;
0138 std::vector<DTDDUFirstStatusWord> theROSStatusWords;
0139 DTDDUSecondStatusWord theDDUStatusWord;
0140 bool crcErrorBitSet;
0141 };
0142
0143 typedef std::vector<std::vector<DTROS25Data> > DTROS25Collection;
0144 typedef std::vector<DTDDUData> DTDDUCollection;
0145
0146 #endif