Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:11

0001 #ifndef EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDBuffer_H  // {
0002 #define EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDBuffer_H
0003 
0004 #include "EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDDAQHeader.h"
0005 #include "EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDDAQTrailer.h"
0006 #include "EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDHeader.h"
0007 #include "EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDChannel.h"
0008 #include <cstdint>
0009 #include <vector>
0010 #include <map>
0011 
0012 namespace Phase2Tracker {
0013 
0014   class Phase2TrackerFEDBuffer {
0015   public:
0016     // gets data of one tracker FED to check, analyze and sort it
0017     Phase2TrackerFEDBuffer(const uint8_t* fedBuffer, const size_t fedBufferSize);
0018     ~Phase2TrackerFEDBuffer();
0019 
0020     //dump buffer to stream
0021     void dump(std::ostream& os) const { printHex(buffer_, bufferSize_, os); }
0022 
0023     //methods to get parts of the buffer
0024     FEDDAQHeader daqHeader() const { return daqHeader_; }
0025     FEDDAQTrailer daqTrailer() const { return daqTrailer_; }
0026     size_t bufferSize() const { return bufferSize_; }
0027     Phase2TrackerFEDHeader trackerHeader() const { return trackerHeader_; }
0028     const Phase2TrackerFEDChannel& channel(const uint8_t internalPhase2TrackerFEDChannelNum) const {
0029       return channels_[internalPhase2TrackerFEDChannelNum];
0030     }
0031     std::map<uint32_t, uint32_t> conditionData() const;
0032 
0033     //methods to get info from DAQ header from FEDDAQHeader class
0034     FEDDAQEventType daqEventType() const { return daqHeader_.eventType(); }
0035     uint32_t daqLvl1ID() const { return daqHeader_.l1ID(); }
0036     uint16_t daqBXID() const { return daqHeader_.bxID(); }
0037     uint16_t daqSourceID() const { return daqHeader_.sourceID(); }
0038 
0039     //methods to get info from DAQ trailer from FEDDAQTrailer class
0040     uint32_t daqEventLengthIn64bitWords() const { return daqTrailer_.eventLengthIn64BitWords(); }
0041     uint32_t daqEventLengthInBytes() const { return daqTrailer_.eventLengthInBytes(); }
0042     uint16_t daqCRC() const { return daqTrailer_.crc(); }
0043     FEDTTSBits daqTTSState() const { return daqTrailer_.ttsBits(); }
0044 
0045     //methods to get info from the tracker header using Phase2TrackerFEDHeader class
0046     FEDReadoutMode readoutMode() const;
0047     inline const uint8_t* getPointerToPayload() const { return trackerHeader_.getPointerToData(); }
0048     inline const uint8_t* getPointerToCondData() const { return condDataPointer_; }
0049     inline const uint8_t* getPointerToTriggerData() const { return triggerPointer_; }
0050 
0051   private:
0052     const uint8_t* buffer_;
0053     const size_t bufferSize_;
0054     std::vector<Phase2TrackerFEDChannel> channels_;
0055     FEDDAQHeader daqHeader_;
0056     FEDDAQTrailer daqTrailer_;
0057     Phase2TrackerFEDHeader trackerHeader_;
0058     const uint8_t* payloadPointer_;
0059     const uint8_t* condDataPointer_;
0060     const uint8_t* triggerPointer_;
0061     void findChannels();
0062 
0063     //////////////// Deprecated or dummy implemented methods ///////////////////
0064   public:
0065     // check methods
0066     inline bool doChecks() const { return true; }               // FEDBuffer
0067     inline bool checkNoFEOverflows() const { return true; }     // FEDBufferBase
0068     inline bool doCorruptBufferChecks() const { return true; }  // FEDBuffer
0069 
0070   };  // end of FEDBuffer class
0071 
0072 }  // namespace Phase2Tracker
0073 
0074 #endif  // } end def EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDBuffer_H