diff --git a/DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h b/DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h index ae554c5ec6105..23ea39c082535 100644 --- a/DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h +++ b/DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h @@ -13,76 +13,80 @@ #include #include "DataFormats/CTPPSDigi/interface/HPTDCErrorFlags.h" -class CTPPSDiamondDigi { -public: - CTPPSDiamondDigi( - unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt, bool mhit_, unsigned short hptdcerror_); - CTPPSDiamondDigi(); - ~CTPPSDiamondDigi() {} - - /// Digis are equal if they are have same ledt and tedt, threshold voltage, multihit flag, hptdcerror flags - bool operator==(const CTPPSDiamondDigi& digi) const; - - /// Return digi values number - - unsigned int leadingEdge() const { return ledgt; } - - unsigned int trailingEdge() const { return tedgt; } - - unsigned int thresholdVoltage() const { return threvolt; } - - bool multipleHit() const { return mhit; } - - HPTDCErrorFlags hptdcErrorFlags() const { return hptdcerror; } - - /// Set digi values - inline void setLeadingEdge(unsigned int ledgt_) { ledgt = ledgt_; } - inline void setTrailingEdge(unsigned int tedgt_) { tedgt = tedgt_; } - inline void setThresholdVoltage(unsigned int threvolt_) { threvolt = threvolt_; } - inline void setMultipleHit(bool mhit_) { mhit = mhit_; } - inline void setHPTDCErrorFlags(const HPTDCErrorFlags& hptdcerror_) { hptdcerror = hptdcerror_; } - -private: - // variable represents leading edge time - unsigned int ledgt; - // variable represents trailing edge time - unsigned int tedgt; - // variable represents threshold voltage - unsigned int threvolt; - // variable represents multi-hit - bool mhit; - HPTDCErrorFlags hptdcerror; -}; +namespace io_v1 { + class CTPPSDiamondDigi { + public: + CTPPSDiamondDigi( + unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt, bool mhit_, unsigned short hptdcerror_); + CTPPSDiamondDigi(); + ~CTPPSDiamondDigi() {} + + /// Digis are equal if they are have same ledt and tedt, threshold voltage, multihit flag, hptdcerror flags + bool operator==(const CTPPSDiamondDigi& digi) const; + + /// Return digi values number + + unsigned int leadingEdge() const { return ledgt; } + + unsigned int trailingEdge() const { return tedgt; } + + unsigned int thresholdVoltage() const { return threvolt; } + + bool multipleHit() const { return mhit; } + + HPTDCErrorFlags hptdcErrorFlags() const { return hptdcerror; } + + /// Set digi values + inline void setLeadingEdge(unsigned int ledgt_) { ledgt = ledgt_; } + inline void setTrailingEdge(unsigned int tedgt_) { tedgt = tedgt_; } + inline void setThresholdVoltage(unsigned int threvolt_) { threvolt = threvolt_; } + inline void setMultipleHit(bool mhit_) { mhit = mhit_; } + inline void setHPTDCErrorFlags(const HPTDCErrorFlags& hptdcerror_) { hptdcerror = hptdcerror_; } + + private: + // variable represents leading edge time + unsigned int ledgt; + // variable represents trailing edge time + unsigned int tedgt; + // variable represents threshold voltage + unsigned int threvolt; + // variable represents multi-hit + bool mhit; + HPTDCErrorFlags hptdcerror; + }; +} // namespace io_v1 +using CTPPSDiamondDigi = io_v1::CTPPSDiamondDigi; #include -inline bool operator<(const CTPPSDiamondDigi& one, const CTPPSDiamondDigi& other) { - if (one.leadingEdge() < other.leadingEdge()) - return true; - if (one.leadingEdge() > other.leadingEdge()) - return false; - if (one.trailingEdge() < other.trailingEdge()) - return true; - if (one.trailingEdge() > other.trailingEdge()) - return false; - if (one.multipleHit() < other.multipleHit()) - return true; - if (one.multipleHit() > other.multipleHit()) +namespace io_v1 { + inline bool operator<(const CTPPSDiamondDigi& one, const CTPPSDiamondDigi& other) { + if (one.leadingEdge() < other.leadingEdge()) + return true; + if (one.leadingEdge() > other.leadingEdge()) + return false; + if (one.trailingEdge() < other.trailingEdge()) + return true; + if (one.trailingEdge() > other.trailingEdge()) + return false; + if (one.multipleHit() < other.multipleHit()) + return true; + if (one.multipleHit() > other.multipleHit()) + return false; + if (one.hptdcErrorFlags().errorFlag() < other.hptdcErrorFlags().errorFlag()) + return true; + if (one.hptdcErrorFlags().errorFlag() > other.hptdcErrorFlags().errorFlag()) + return false; + if (one.thresholdVoltage() < other.thresholdVoltage()) + return true; + if (one.thresholdVoltage() > other.thresholdVoltage()) + return false; return false; - if (one.hptdcErrorFlags().errorFlag() < other.hptdcErrorFlags().errorFlag()) - return true; - if (one.hptdcErrorFlags().errorFlag() > other.hptdcErrorFlags().errorFlag()) - return false; - if (one.thresholdVoltage() < other.thresholdVoltage()) - return true; - if (one.thresholdVoltage() > other.thresholdVoltage()) - return false; - return false; -} - -inline std::ostream& operator<<(std::ostream& o, const CTPPSDiamondDigi& digi) { - return o << " " << digi.leadingEdge() << " " << digi.trailingEdge() << " " << digi.thresholdVoltage() << " " - << digi.multipleHit() << " " << digi.hptdcErrorFlags().errorFlag(); -} + } + inline std::ostream& operator<<(std::ostream& o, const CTPPSDiamondDigi& digi) { + return o << " " << digi.leadingEdge() << " " << digi.trailingEdge() << " " << digi.thresholdVoltage() << " " + << digi.multipleHit() << " " << digi.hptdcErrorFlags().errorFlag(); + } +} // namespace io_v1 #endif diff --git a/DataFormats/CTPPSDigi/interface/CTPPSPixelDataError.h b/DataFormats/CTPPSDigi/interface/CTPPSPixelDataError.h index a0a2b0c7e3596..69d3514fc0a49 100644 --- a/DataFormats/CTPPSDigi/interface/CTPPSPixelDataError.h +++ b/DataFormats/CTPPSDigi/interface/CTPPSPixelDataError.h @@ -15,44 +15,46 @@ #include #include -class CTPPSPixelDataError { -public: - /// Default constructor - CTPPSPixelDataError(); - /// Constructor for 32-bit error word - CTPPSPixelDataError(uint32_t errorWord32, const int errorType, int fedId); - /// Constructor with 64-bit error word and type included (header or trailer word) - CTPPSPixelDataError(uint64_t errorWord64, const int errorType, int fedId); - /// Destructor - ~CTPPSPixelDataError(); - - /// the 32-bit word that contains the error information - inline uint32_t errorWord32() const { return errorWord32_; } - /// the 64-bit word that contains the error information - inline uint64_t errorWord64() const { return errorWord64_; } - /// the number associated with the error type (26-31 for ROC number errors, 32-33 for calibration errors) - inline int errorType() const { return errorType_; } - /// the fedId where the error occured - inline int fedId() const { return fedId_; } - /// the error message to be displayed with the error - inline const std::string& errorMessage() const { - if (errorType_ >= 25 && errorType_ <= 37) - return errorMessages_[errorType_ - 24]; - return errorMessages_[0]; +namespace io_v1 { + class CTPPSPixelDataError { + public: + /// Default constructor + CTPPSPixelDataError(); + /// Constructor for 32-bit error word + CTPPSPixelDataError(uint32_t errorWord32, const int errorType, int fedId); + /// Constructor with 64-bit error word and type included (header or trailer word) + CTPPSPixelDataError(uint64_t errorWord64, const int errorType, int fedId); + /// Destructor + ~CTPPSPixelDataError(); + + /// the 32-bit word that contains the error information + inline uint32_t errorWord32() const { return errorWord32_; } + /// the 64-bit word that contains the error information + inline uint64_t errorWord64() const { return errorWord64_; } + /// the number associated with the error type (26-31 for ROC number errors, 32-33 for calibration errors) + inline int errorType() const { return errorType_; } + /// the fedId where the error occured + inline int fedId() const { return fedId_; } + /// the error message to be displayed with the error + inline const std::string& errorMessage() const { + if (errorType_ >= 25 && errorType_ <= 37) + return errorMessages_[errorType_ - 24]; + return errorMessages_[0]; + } + + private: + static const std::array errorMessages_; + + uint64_t errorWord64_; + uint32_t errorWord32_; + int errorType_; + int fedId_; + }; + + /// Comparison operators + inline bool operator<(const CTPPSPixelDataError& one, const CTPPSPixelDataError& other) { + return one.fedId() < other.fedId(); } - -private: - static const std::array errorMessages_; - - uint64_t errorWord64_; - uint32_t errorWord32_; - int errorType_; - int fedId_; -}; - -/// Comparison operators -inline bool operator<(const CTPPSPixelDataError& one, const CTPPSPixelDataError& other) { - return one.fedId() < other.fedId(); -} - +} // namespace io_v1 +using CTPPSPixelDataError = io_v1::CTPPSPixelDataError; #endif diff --git a/DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h b/DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h index 43568708d8067..0190da94cccc6 100644 --- a/DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h +++ b/DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h @@ -7,60 +7,65 @@ #include "FWCore/Utilities/interface/Exception.h" -class CTPPSPixelDigi { -public: - CTPPSPixelDigi(int packed_value) : theData(packed_value) {} +namespace io_v1 { + class CTPPSPixelDigi { + public: + CTPPSPixelDigi(int packed_value) : theData(packed_value) {} - CTPPSPixelDigi(int row, int col, int adc) { init(row, col, adc); } + CTPPSPixelDigi(int row, int col, int adc) { init(row, col, adc); } - CTPPSPixelDigi(int chan, int adc) { - std::pair rc = channelToPixel(chan); - init(rc.first, rc.second, adc); - } + CTPPSPixelDigi(int chan, int adc) { + std::pair rc = channelToPixel(chan); + init(rc.first, rc.second, adc); + } - CTPPSPixelDigi() : theData(0) {} + CTPPSPixelDigi() : theData(0) {} - /// Access to digi information - int row() const { return (theData >> row_shift) & row_mask; } - int column() const { return (theData >> column_shift) & column_mask; } - unsigned short adc() const { return (theData >> adc_shift) & adc_mask; } - uint32_t packedData() const { return theData; } + /// Access to digi information + int row() const { return (theData >> row_shift) & row_mask; } + int column() const { return (theData >> column_shift) & column_mask; } + unsigned short adc() const { return (theData >> adc_shift) & adc_mask; } + uint32_t packedData() const { return theData; } - static std::pair channelToPixel(int ch) { - int row = (ch >> column_width_ch) & row_mask_ch; - int col = ch & column_mask_ch; - return std::pair(row, col); - } + static std::pair channelToPixel(int ch) { + int row = (ch >> column_width_ch) & row_mask_ch; + int col = ch & column_mask_ch; + return std::pair(row, col); + } - static int pixelToChannel(int row, int col) { return (row << column_width_ch) | col; } + static int pixelToChannel(int row, int col) { return (row << column_width_ch) | col; } - int channel() const { return pixelToChannel(row(), column()); } + int channel() const { return pixelToChannel(row(), column()); } - /// const values for digi packing with bit structure: adc_bits+col_bits+row_bits - static const uint32_t row_shift, column_shift, adc_shift; - static const uint32_t row_mask, column_mask, adc_mask, rowcol_mask; - static const uint32_t row_width, column_width, adc_width; - static const uint32_t max_row, max_column, max_adc; + /// const values for digi packing with bit structure: adc_bits+col_bits+row_bits + static const uint32_t row_shift, column_shift, adc_shift; + static const uint32_t row_mask, column_mask, adc_mask, rowcol_mask; + static const uint32_t row_width, column_width, adc_width; + static const uint32_t max_row, max_column, max_adc; - /// const values for channel definition with bit structure: row_bits+col_bits - static const uint32_t column_width_ch; - static const uint32_t column_mask_ch; - static const uint32_t row_mask_ch; + /// const values for channel definition with bit structure: row_bits+col_bits + static const uint32_t column_width_ch; + static const uint32_t column_mask_ch; + static const uint32_t row_mask_ch; -private: - void init(int row, int col, int adc); - uint32_t theData; -}; + private: + void init(int row, int col, int adc); + uint32_t theData; + }; -/// Comparison operator + /// Comparison operator -inline bool operator<(const CTPPSPixelDigi& one, const CTPPSPixelDigi& other) { - return (one.packedData() & CTPPSPixelDigi::rowcol_mask) < (other.packedData() & CTPPSPixelDigi::rowcol_mask); -} + inline bool operator<(const CTPPSPixelDigi& one, const CTPPSPixelDigi& other) { + return (one.packedData() & CTPPSPixelDigi::rowcol_mask) < (other.packedData() & CTPPSPixelDigi::rowcol_mask); + } +} // namespace io_v1 +using CTPPSPixelDigi = io_v1::CTPPSPixelDigi; #include -inline std::ostream& operator<<(std::ostream& o, const CTPPSPixelDigi& digi) { - return o << " " << digi.row() << " " << digi.column() << " " << digi.adc(); -} +namespace io_v1 { + inline std::ostream& operator<<(std::ostream& o, const CTPPSPixelDigi& digi) { + return o << " " << digi.row() << " " << digi.column() << " " << digi.adc(); + } +} // namespace io_v1 #endif diff --git a/DataFormats/CTPPSDigi/interface/TotemFEDInfo.h b/DataFormats/CTPPSDigi/interface/TotemFEDInfo.h index 9a52a130ab510..a7c43c5e425f3 100644 --- a/DataFormats/CTPPSDigi/interface/TotemFEDInfo.h +++ b/DataFormats/CTPPSDigi/interface/TotemFEDInfo.h @@ -14,37 +14,39 @@ /** * \brief OptoRx headers and footers. **/ -class TotemFEDInfo { -public: - TotemFEDInfo(int id = 0) : fedId_(id), header(0), orbitCounter_(0), footer(0) {} - - void setFEDId(int f) { fedId_ = f; } - int fedId() const { return fedId_; } - - void setHeader(uint64_t _h) { header = _h; } - uint8_t boe() const { return (header >> 60) & 0xF; } - uint32_t lv1() const { return (header >> 32) & 0xFFFFFF; } - uint16_t bx() const { return (header >> 20) & 0xFFF; } - uint16_t optoRxId() const { return (header >> 8) & 0xFFF; } - uint8_t fov() const { return (header >> 4) & 0xF; } - uint8_t h0() const { return (header >> 0) & 0xF; } - - void setOrbitCounter(uint32_t oc) { orbitCounter_ = oc; } - uint32_t orbitCounter() const { return orbitCounter_; } - - void setFooter(uint64_t _f) { footer = _f; } - uint8_t eoe() const { return (footer >> 60) & 0xF; } - uint16_t fSize() const { return (footer >> 32) & 0x3FF; } - uint8_t f0() const { return (footer >> 0) & 0xF; } - -private: - /// Id from FEDRawDataCollection. - int fedId_; - - /// Data from OptoRx headers and footer. - uint64_t header; - uint32_t orbitCounter_; - uint64_t footer; -}; - +namespace io_v1 { + class TotemFEDInfo { + public: + TotemFEDInfo(int id = 0) : fedId_(id), header(0), orbitCounter_(0), footer(0) {} + + void setFEDId(int f) { fedId_ = f; } + int fedId() const { return fedId_; } + + void setHeader(uint64_t _h) { header = _h; } + uint8_t boe() const { return (header >> 60) & 0xF; } + uint32_t lv1() const { return (header >> 32) & 0xFFFFFF; } + uint16_t bx() const { return (header >> 20) & 0xFFF; } + uint16_t optoRxId() const { return (header >> 8) & 0xFFF; } + uint8_t fov() const { return (header >> 4) & 0xF; } + uint8_t h0() const { return (header >> 0) & 0xF; } + + void setOrbitCounter(uint32_t oc) { orbitCounter_ = oc; } + uint32_t orbitCounter() const { return orbitCounter_; } + + void setFooter(uint64_t _f) { footer = _f; } + uint8_t eoe() const { return (footer >> 60) & 0xF; } + uint16_t fSize() const { return (footer >> 32) & 0x3FF; } + uint8_t f0() const { return (footer >> 0) & 0xF; } + + private: + /// Id from FEDRawDataCollection. + int fedId_; + + /// Data from OptoRx headers and footer. + uint64_t header; + uint32_t orbitCounter_; + uint64_t footer; + }; +} // namespace io_v1 +using TotemFEDInfo = io_v1::TotemFEDInfo; #endif diff --git a/DataFormats/CTPPSDigi/interface/TotemRPDigi.h b/DataFormats/CTPPSDigi/interface/TotemRPDigi.h index 4daf60af5c44e..b6b76f61b6214 100644 --- a/DataFormats/CTPPSDigi/interface/TotemRPDigi.h +++ b/DataFormats/CTPPSDigi/interface/TotemRPDigi.h @@ -13,19 +13,21 @@ /** * Digi structure for TOTEM RP silicon strip sensors. **/ -class TotemRPDigi { -public: - TotemRPDigi(unsigned short strip_no = 0) : strip_no_(strip_no) {} +namespace io_v1 { + class TotemRPDigi { + public: + TotemRPDigi(unsigned short strip_no = 0) : strip_no_(strip_no) {} - unsigned short stripNumber() const { return strip_no_; } + unsigned short stripNumber() const { return strip_no_; } -private: - /// index of the activated strip - unsigned short strip_no_; -}; - -inline bool operator<(const TotemRPDigi& one, const TotemRPDigi& other) { - return one.stripNumber() < other.stripNumber(); -} + private: + /// index of the activated strip + unsigned short strip_no_; + }; + inline bool operator<(const TotemRPDigi& one, const TotemRPDigi& other) { + return one.stripNumber() < other.stripNumber(); + } +} // namespace io_v1 +using TotemRPDigi = io_v1::TotemRPDigi; #endif diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h index e5858355153a6..bd1cadd3614bd 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h @@ -16,126 +16,129 @@ #include -class TotemTimingDigi { -public: - TotemTimingDigi(const uint8_t hwId, - const uint64_t fpgaTimestamp, - const uint16_t timestampA, - const uint16_t timestampB, - const uint16_t cellInfo, - const std::vector& samples, - const TotemTimingEventInfo& totemTimingEventInfo); - TotemTimingDigi(); +namespace io_v1 { + class TotemTimingDigi { + public: + TotemTimingDigi(const uint8_t hwId, + const uint64_t fpgaTimestamp, + const uint16_t timestampA, + const uint16_t timestampB, + const uint16_t cellInfo, + const std::vector& samples, + const TotemTimingEventInfo& totemTimingEventInfo); + TotemTimingDigi(); - /// Digis are equal if they have all the same values, NOT checking the samples! - bool operator==(const TotemTimingDigi& digi) const; + /// Digis are equal if they have all the same values, NOT checking the samples! + bool operator==(const TotemTimingDigi& digi) const; - /// Return digi values number + /// Return digi values number - /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id - inline unsigned int hardwareId() const { return hwId_; } + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline unsigned int hardwareId() const { return hwId_; } - inline unsigned int hardwareBoardId() const { return (hwId_ & 0xE0) >> 5; } + inline unsigned int hardwareBoardId() const { return (hwId_ & 0xE0) >> 5; } - inline unsigned int hardwareSampicId() const { return (hwId_ & 0x10) >> 4; } + inline unsigned int hardwareSampicId() const { return (hwId_ & 0x10) >> 4; } - inline unsigned int hardwareChannelId() const { return (hwId_ & 0x0F); } + inline unsigned int hardwareChannelId() const { return (hwId_ & 0x0F); } - inline unsigned int fpgaTimestamp() const { return fpgaTimestamp_; } + inline unsigned int fpgaTimestamp() const { return fpgaTimestamp_; } - inline unsigned int timestampA() const { return timestampA_; } + inline unsigned int timestampA() const { return timestampA_; } - inline unsigned int timestampB() const { return timestampB_; } + inline unsigned int timestampB() const { return timestampB_; } - inline unsigned int cellInfo() const { return cellInfo_; } + inline unsigned int cellInfo() const { return cellInfo_; } - inline std::vector samples() const { return samples_; } + inline std::vector samples() const { return samples_; } - inline std::vector::const_iterator samplesBegin() const { return samples_.cbegin(); } + inline std::vector::const_iterator samplesBegin() const { return samples_.cbegin(); } - inline std::vector::const_iterator samplesEnd() const { return samples_.cend(); } + inline std::vector::const_iterator samplesEnd() const { return samples_.cend(); } - inline unsigned int numberOfSamples() const { return samples_.size(); } + inline unsigned int numberOfSamples() const { return samples_.size(); } - inline int sampleAt(const unsigned int i) const { - int sampleValue = -1; - if (i < samples_.size()) - sampleValue = (int)samples_.at(i); - return sampleValue; - } + inline int sampleAt(const unsigned int i) const { + int sampleValue = -1; + if (i < samples_.size()) + sampleValue = (int)samples_.at(i); + return sampleValue; + } - inline TotemTimingEventInfo eventInfo() const { return totemTimingEventInfo_; } + inline TotemTimingEventInfo eventInfo() const { return totemTimingEventInfo_; } - /// Set digi values - /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id - inline void setHardwareId(const uint8_t hwId) { hwId_ = hwId; } + /// Set digi values + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline void setHardwareId(const uint8_t hwId) { hwId_ = hwId; } - inline void setHardwareBoardId(const unsigned int boardId) { - hwId_ &= 0x1F; // set board bits to 0 - hwId_ |= ((boardId & 0x07) << 5) & 0xE0; - } + inline void setHardwareBoardId(const unsigned int boardId) { + hwId_ &= 0x1F; // set board bits to 0 + hwId_ |= ((boardId & 0x07) << 5) & 0xE0; + } - inline void setHardwareSampicId(const unsigned int sampicId) { - hwId_ &= 0xEF; // set Sampic bit to 0 - hwId_ |= ((sampicId & 0x01) << 4) & 0x10; - } + inline void setHardwareSampicId(const unsigned int sampicId) { + hwId_ &= 0xEF; // set Sampic bit to 0 + hwId_ |= ((sampicId & 0x01) << 4) & 0x10; + } - inline void setHardwareChannelId(const unsigned int channelId) { - hwId_ &= 0xF0; // Set Sampic bit to 0 - hwId_ |= (channelId & 0x0F) & 0x0F; - } + inline void setHardwareChannelId(const unsigned int channelId) { + hwId_ &= 0xF0; // Set Sampic bit to 0 + hwId_ |= (channelId & 0x0F) & 0x0F; + } - inline void setFPGATimestamp(const uint64_t fpgaTimestamp) { fpgaTimestamp_ = fpgaTimestamp; } + inline void setFPGATimestamp(const uint64_t fpgaTimestamp) { fpgaTimestamp_ = fpgaTimestamp; } - inline void setTimestampA(const uint16_t timestampA) { timestampA_ = timestampA; } + inline void setTimestampA(const uint16_t timestampA) { timestampA_ = timestampA; } - inline void setTimestampB(const uint16_t timestampB) { timestampB_ = timestampB; } + inline void setTimestampB(const uint16_t timestampB) { timestampB_ = timestampB; } - inline void setCellInfo(const uint16_t cellInfo) { cellInfo_ = cellInfo & 0x3F; } + inline void setCellInfo(const uint16_t cellInfo) { cellInfo_ = cellInfo & 0x3F; } - inline void setSamples(const std::vector& samples) { samples_ = samples; } + inline void setSamples(const std::vector& samples) { samples_ = samples; } - inline void addSample(const uint8_t sampleValue) { samples_.emplace_back(sampleValue); } + inline void addSample(const uint8_t sampleValue) { samples_.emplace_back(sampleValue); } - inline void setSampleAt(const unsigned int i, const uint8_t sampleValue) { - if (i < samples_.size()) - samples_.at(i) = sampleValue; - } + inline void setSampleAt(const unsigned int i, const uint8_t sampleValue) { + if (i < samples_.size()) + samples_.at(i) = sampleValue; + } - inline void setEventInfo(const TotemTimingEventInfo& totemTimingEventInfo) { - totemTimingEventInfo_ = totemTimingEventInfo; - } - -private: - uint8_t hwId_; - uint64_t fpgaTimestamp_; - uint16_t timestampA_; - uint16_t timestampB_; - uint16_t cellInfo_; + inline void setEventInfo(const TotemTimingEventInfo& totemTimingEventInfo) { + totemTimingEventInfo_ = totemTimingEventInfo; + } - std::vector samples_; + private: + uint8_t hwId_; + uint64_t fpgaTimestamp_; + uint16_t timestampA_; + uint16_t timestampB_; + uint16_t cellInfo_; - TotemTimingEventInfo totemTimingEventInfo_; -}; + std::vector samples_; + TotemTimingEventInfo totemTimingEventInfo_; + }; +} // namespace io_v1 #include -inline bool operator<(const TotemTimingDigi& one, const TotemTimingDigi& other) { - if (one.eventInfo() < other.eventInfo()) - return true; - if (one.hardwareId() < other.hardwareId()) - return true; - return false; -} - -inline std::ostream& operator<<(std::ostream& os, const TotemTimingDigi& digi) { - return os << "TotemTimingDigi:" - << "\nHardwareId:\t" << std::hex << digi.hardwareId() << "\nDB: " << std::dec << digi.hardwareBoardId() - << "\tSampic: " << digi.hardwareSampicId() << "\tChannel: " << digi.hardwareChannelId() - << "\nFPGATimestamp:\t" << std::dec << digi.fpgaTimestamp() << "\nTimestampA:\t" << std::dec - << digi.timestampA() << "\nTimestampB:\t" << std::dec << digi.timestampB() << "\nCellInfo:\t" << std::hex - << digi.cellInfo() << "\nNumberOfSamples:\t" << std::dec << digi.numberOfSamples() << std::endl - << digi.eventInfo() << std::endl; -} +namespace io_v1 { + inline bool operator<(const TotemTimingDigi& one, const TotemTimingDigi& other) { + if (one.eventInfo() < other.eventInfo()) + return true; + if (one.hardwareId() < other.hardwareId()) + return true; + return false; + } + inline std::ostream& operator<<(std::ostream& os, const TotemTimingDigi& digi) { + return os << "TotemTimingDigi:" + << "\nHardwareId:\t" << std::hex << digi.hardwareId() << "\nDB: " << std::dec << digi.hardwareBoardId() + << "\tSampic: " << digi.hardwareSampicId() << "\tChannel: " << digi.hardwareChannelId() + << "\nFPGATimestamp:\t" << std::dec << digi.fpgaTimestamp() << "\nTimestampA:\t" << std::dec + << digi.timestampA() << "\nTimestampB:\t" << std::dec << digi.timestampB() << "\nCellInfo:\t" << std::hex + << digi.cellInfo() << "\nNumberOfSamples:\t" << std::dec << digi.numberOfSamples() << std::endl + << digi.eventInfo() << std::endl; + } +} // namespace io_v1 +using TotemTimingDigi = io_v1::TotemTimingDigi; #endif diff --git a/DataFormats/CTPPSDigi/interface/TotemVFATStatus.h b/DataFormats/CTPPSDigi/interface/TotemVFATStatus.h index 6ea77011258f7..523ceaa0194d2 100644 --- a/DataFormats/CTPPSDigi/interface/TotemVFATStatus.h +++ b/DataFormats/CTPPSDigi/interface/TotemVFATStatus.h @@ -19,81 +19,83 @@ /** * Class which contains information about conversion from RAW to DIGI for a single read-out chip (VFAT). */ -class TotemVFATStatus { -public: - TotemVFATStatus(uint8_t cp = 0) - : chipPosition_(cp), status(0), numberOfClustersSpecified(false), numberOfClusters_(0), eventCounter(0) {} +namespace io_v1 { + class TotemVFATStatus { + public: + TotemVFATStatus(uint8_t cp = 0) + : chipPosition_(cp), status(0), numberOfClustersSpecified(false), numberOfClusters_(0), eventCounter(0) {} - /// Chip position - inline uint8_t chipPosition() const { return chipPosition_; } - inline void setChipPosition(uint8_t cp) { chipPosition_ = cp; } + /// Chip position + inline uint8_t chipPosition() const { return chipPosition_; } + inline void setChipPosition(uint8_t cp) { chipPosition_ = cp; } - /// VFAT is present in mapping but no data is present int raw event - inline bool isMissing() const { return status[0]; } - inline void setMissing(bool val = true) { status[0] = val; } + /// VFAT is present in mapping but no data is present int raw event + inline bool isMissing() const { return status[0]; } + inline void setMissing(bool val = true) { status[0] = val; } - /// 12-bit hw id from the header of the vfat frame is diffrent from the 16-bit one from hw mapping - inline bool isIDMismatch() const { return status[1]; } - inline void setIDMismatch(bool val = true) { status[1] = val; } + /// 12-bit hw id from the header of the vfat frame is diffrent from the 16-bit one from hw mapping + inline bool isIDMismatch() const { return status[1]; } + inline void setIDMismatch(bool val = true) { status[1] = val; } - /// Footprint error - inline bool isFootprintError() const { return status[2]; } - inline void setFootprintError(bool val = true) { status[2] = val; } + /// Footprint error + inline bool isFootprintError() const { return status[2]; } + inline void setFootprintError(bool val = true) { status[2] = val; } - /// CRC error - inline bool isCRCError() const { return status[3]; } - inline void setCRCError(bool val = true) { status[3] = val; } + /// CRC error + inline bool isCRCError() const { return status[3]; } + inline void setCRCError(bool val = true) { status[3] = val; } - /// VFATFrame event number doesn't follow the number derived from DAQ - inline bool isECProgressError() const { return status[4]; } - inline void setECProgressError(bool val = true) { status[4] = val; } + /// VFATFrame event number doesn't follow the number derived from DAQ + inline bool isECProgressError() const { return status[4]; } + inline void setECProgressError(bool val = true) { status[4] = val; } - /// BC number is incorrect - inline bool isBCProgressError() const { return status[5]; } - inline void setBCProgressError(bool val = true) { status[5] = val; } + /// BC number is incorrect + inline bool isBCProgressError() const { return status[5]; } + inline void setBCProgressError(bool val = true) { status[5] = val; } - /// All channels from that VFAT are not taken into account - inline bool isFullyMaskedOut() const { return status[6]; } - inline void setFullyMaskedOut() { status[6] = true; } + /// All channels from that VFAT are not taken into account + inline bool isFullyMaskedOut() const { return status[6]; } + inline void setFullyMaskedOut() { status[6] = true; } - /// Some channels from VFAT ale masked out, but not all - inline bool isPartiallyMaskedOut() const { return status[7]; } - inline void setPartiallyMaskedOut() { status[7] = true; } + /// Some channels from VFAT ale masked out, but not all + inline bool isPartiallyMaskedOut() const { return status[7]; } + inline void setPartiallyMaskedOut() { status[7] = true; } - /// No channels are masked out - inline bool isNotMasked() const { return !(status[6] || status[7]); } - inline void setNotMasked() { status[6] = status[7] = false; } + /// No channels are masked out + inline bool isNotMasked() const { return !(status[6] || status[7]); } + inline void setNotMasked() { status[6] = status[7] = false; } - bool isOK() const { return !(status[0] || status[1] || status[2] || status[3] || status[4] || status[5]); } + bool isOK() const { return !(status[0] || status[1] || status[2] || status[3] || status[4] || status[5]); } - /// number of clusters - inline bool isNumberOfClustersSpecified() const { return numberOfClustersSpecified; } - inline void setNumberOfClustersSpecified(bool v) { numberOfClustersSpecified = v; } + /// number of clusters + inline bool isNumberOfClustersSpecified() const { return numberOfClustersSpecified; } + inline void setNumberOfClustersSpecified(bool v) { numberOfClustersSpecified = v; } - inline uint8_t numberOfClusters() const { return numberOfClusters_; } - inline void setNumberOfClusters(uint8_t v) { numberOfClusters_ = v; } + inline uint8_t numberOfClusters() const { return numberOfClusters_; } + inline void setNumberOfClusters(uint8_t v) { numberOfClusters_ = v; } - bool operator<(const TotemVFATStatus& cmp) const { return (status.to_ulong() < cmp.status.to_ulong()); } + bool operator<(const TotemVFATStatus& cmp) const { return (status.to_ulong() < cmp.status.to_ulong()); } - friend std::ostream& operator<<(std::ostream& s, const TotemVFATStatus& st); + friend std::ostream& operator<<(std::ostream& s, const TotemVFATStatus& st); - /// event Counter - inline uint8_t ec() const { return eventCounter; } - inline void setEC(const uint8_t ec) { eventCounter = ec; } + /// event Counter + inline uint8_t ec() const { return eventCounter; } + inline void setEC(const uint8_t ec) { eventCounter = ec; } -private: - /// describes placement of the VFAT within the detector - uint8_t chipPosition_; + private: + /// describes placement of the VFAT within the detector + uint8_t chipPosition_; - /// the status bits - std::bitset<8> status; + /// the status bits + std::bitset<8> status; - /// the number of hit clusters before DAQ trimming - bool numberOfClustersSpecified; - uint8_t numberOfClusters_; - - /// event counter in the VFAT frame - uint8_t eventCounter; -}; + /// the number of hit clusters before DAQ trimming + bool numberOfClustersSpecified; + uint8_t numberOfClusters_; + /// event counter in the VFAT frame + uint8_t eventCounter; + }; +} // namespace io_v1 +using TotemVFATStatus = io_v1::TotemVFATStatus; #endif diff --git a/DataFormats/CTPPSDigi/src/TotemVFATStatus.cc b/DataFormats/CTPPSDigi/src/TotemVFATStatus.cc index 30fe737fb5ae1..fb2b8d6795f7b 100644 --- a/DataFormats/CTPPSDigi/src/TotemVFATStatus.cc +++ b/DataFormats/CTPPSDigi/src/TotemVFATStatus.cc @@ -11,7 +11,9 @@ #include -std::ostream& operator<<(std::ostream& s, const TotemVFATStatus& st) { - return s << "miss=" << st.status[0] << ",ID=" << st.status[1] << ",foot=" << st.status[2] << ",CRC=" << st.status[3] - << ",EC=" << st.status[4] << ",BC=" << st.status[5] << ",fm=" << st.status[6] << ",pm=" << st.status[7]; -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const TotemVFATStatus& st) { + return s << "miss=" << st.status[0] << ",ID=" << st.status[1] << ",foot=" << st.status[2] << ",CRC=" << st.status[3] + << ",EC=" << st.status[4] << ",BC=" << st.status[5] << ",fm=" << st.status[6] << ",pm=" << st.status[7]; + } +} // namespace io_v1 diff --git a/DataFormats/CTPPSDigi/src/classes_def.xml b/DataFormats/CTPPSDigi/src/classes_def.xml index c104fb5708ec1..d9853c4c0f2f0 100644 --- a/DataFormats/CTPPSDigi/src/classes_def.xml +++ b/DataFormats/CTPPSDigi/src/classes_def.xml @@ -1,75 +1,59 @@ - - + + - - - - - - + + + + + + - - - - - + + - - - - - - - - - - - - + + + + + + - - - + + - - - - - - - - + + - - + + - - - - - - + + + + + + - - + + - - - - - - + + + + + + @@ -85,34 +69,34 @@ - - + + - + - - - - - - - + + + + + + + - - + + - - - - - - - - - - + + + + + + + + + +