Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDHeader_H  // {
0002 #define EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDHeader_H
0003 
0004 #include "EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDDAQHeader.h"
0005 #include "EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDDAQTrailer.h"
0006 #include <cstdint>
0007 #include <vector>
0008 
0009 namespace Phase2Tracker {
0010 
0011   // tracker headers for new CBC system
0012   class Phase2TrackerFEDHeader {
0013   public:
0014     Phase2TrackerFEDHeader() {}
0015 
0016     explicit Phase2TrackerFEDHeader(const uint8_t* headerPointer);
0017 
0018     // getters:
0019     inline uint8_t getDataFormatVersion() const { return dataFormatVersion_; }
0020     inline READ_MODE getDebugMode() const { return debugMode_; }
0021 
0022     inline uint8_t getEventType() const { return eventType_; }
0023     inline FEDReadoutMode getReadoutMode() const { return readoutMode_; }
0024     inline uint8_t getConditionData() const { return conditionData_; }
0025     inline uint8_t getDataType() const { return dataType_; }
0026 
0027     inline uint64_t getGlibStatusCode() const { return glibStatusCode_; }
0028     inline uint16_t getNumberOfCBC() const { return numberOfCBC_; }
0029 
0030     // get pointer to Payload data after tracker head
0031     const uint8_t* getPointerToData() const { return pointerToData_; }
0032     // get Front-End Status (16 bits) ==> 16 bool
0033     std::vector<bool> frontendStatus() const;
0034 
0035     inline uint8_t getTrackerHeaderSize() const { return trackerHeaderSize_; }
0036 
0037     // CBC status bits, according to debug mode
0038     // (empty, 1bit per CBC, 8bits per CBC)
0039     std::vector<uint8_t> CBCStatus() const;
0040 
0041   private:
0042     // readers: read info from Tracker Header and store in local variables
0043 
0044     // version number (4 bits)
0045     uint8_t dataFormatVersion() const;
0046     // debug level (2 bits) :
0047     // 01 = full debug, 10 = CBC error mode, 00 = summary mode
0048     READ_MODE debugMode() const;
0049     // event type (4 bits):
0050     // RAW/ZS, condition data, data type (real or simulated)
0051     uint8_t eventType() const;
0052     // get readout mode (first bit of the above)
0053     FEDReadoutMode readoutMode() const;
0054     uint8_t conditionData() const;
0055     uint8_t dataType() const;
0056     // glib status registers code (38 bits)
0057     uint64_t glibStatusCode() const;
0058     // number of CBC chips (8 bits)
0059     uint16_t numberOfCBC() const;
0060     // get tracker size (see function) and pointer to end of header. Also sets the TrackerHeaderSize.
0061     const uint8_t* pointerToData();
0062 
0063   private:
0064     void init();
0065     const uint8_t* trackerHeader_;  // pointer to the begining of Tracker Header
0066     const uint8_t* pointerToData_;  // pointer next to end of Tracker Header
0067     uint8_t trackerHeaderSize_;     // Tracker Header in bytes
0068     uint64_t header_first_word_;
0069     uint64_t header_second_word_;
0070     uint8_t dataFormatVersion_;   // shoud be 1
0071     READ_MODE debugMode_;         // debug, error, sumary ...
0072     uint8_t eventType_;           // contains readoutMode_, conditionData_ and dataType_
0073     FEDReadoutMode readoutMode_;  // proc raw or zero suppress
0074     uint8_t conditionData_;       // condition data present or not
0075     uint8_t dataType_;            // data fake or real
0076     uint64_t glibStatusCode_;     // glib status registers
0077     uint16_t numberOfCBC_;        // Total number of connected CBC
0078 
0079   };  // end of Phase2TrackerFEDHeader class
0080 }  // namespace Phase2Tracker
0081 #endif  // } end def EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDHeader_H