CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DataFormats/L1GlobalTrigger/interface/L1GtfeWord.h

Go to the documentation of this file.
00001 #ifndef L1GlobalTrigger_L1GtfeWord_h
00002 #define L1GlobalTrigger_L1GtfeWord_h
00003 
00020 // system include files
00021 #include <boost/cstdint.hpp>
00022 #include <iosfwd>
00023 
00024 // user include files
00025 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00026 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
00027 
00028 // forward declarations
00029 
00030 // class interface
00031 
00032 class L1GtfeWord
00033 {
00034 
00035 public:
00036 
00038     L1GtfeWord();    // empty constructor, all members set to zero;
00039 
00041     L1GtfeWord(
00042         boost::uint16_t boardIdValue,
00043         boost::uint16_t recordLength1Value,
00044         boost::uint16_t recordLengthValue,
00045         boost::uint16_t bxNrValue,
00046         boost::uint32_t setupVersionValue,
00047         boost::uint16_t activeBoardsValue,
00048         boost::uint16_t altNrBxBoardValue,
00049         boost::uint32_t totalTriggerNrValue
00050     );
00051 
00052 
00054     virtual ~L1GtfeWord();
00055 
00057     bool operator==(const L1GtfeWord&) const;
00058 
00060     bool operator!=(const L1GtfeWord&) const;
00061 
00062 public:
00063 
00065 
00067     inline const boost::uint16_t boardId() const
00068     {
00069         return m_boardId;
00070     }
00071 
00073     void setBoardId(boost::uint16_t boardIdValue)
00074     {
00075         m_boardId = boardIdValue;
00076     }
00077 
00079     void setBoardId(const boost::uint64_t& word64);
00080 
00083     void setBoardIdWord64(boost::uint64_t& word64, int iWord);
00084 
00085 
00087     inline const boost::uint16_t recordLength1() const
00088     {
00089         return m_recordLength1;
00090     }
00091 
00092     void setRecordLength1(boost::uint16_t recordLengthValue)
00093     {
00094         m_recordLength1 = recordLengthValue;
00095     }
00096 
00097     void setRecordLength1(const boost::uint64_t& word64);
00098 
00101     void setRecordLength1Word64(boost::uint64_t& word64, int iWord);
00102 
00103 
00104 
00106     inline const boost::uint16_t recordLength() const
00107     {
00108         return m_recordLength;
00109     }
00110 
00111     void setRecordLength(boost::uint16_t recordLengthValue)
00112     {
00113         m_recordLength = recordLengthValue;
00114     }
00115 
00116     void setRecordLength(const boost::uint64_t& word64);
00117 
00120     void setRecordLengthWord64(boost::uint64_t& word64, int iWord);
00121 
00122 
00124     inline const boost::uint16_t bxNr() const
00125     {
00126         return m_bxNr;
00127     }
00128 
00129     void setBxNr(boost::uint16_t bxNrValue)
00130     {
00131         m_bxNr = bxNrValue;
00132     }
00133 
00134     void setBxNr(const boost::uint64_t& word64);
00135 
00138     void setBxNrWord64(boost::uint64_t& word64, int iWord);
00139 
00140 
00142     inline const boost::uint32_t setupVersion() const
00143     {
00144         return m_setupVersion;
00145     }
00146 
00147     void setSetupVersion(boost::uint32_t setupVersionValue)
00148     {
00149         m_setupVersion = setupVersionValue;
00150     }
00151 
00152     void setSetupVersion(const boost::uint64_t& word64);
00153 
00156     void setSetupVersionWord64(boost::uint64_t& word64, int iWord);
00157 
00158 
00160     const int bstFlag() const;
00161     void setBstFlag(const int);
00162 
00163 
00165     inline const boost::uint16_t activeBoards() const
00166     {
00167         return m_activeBoards;
00168     }
00169 
00170     void setActiveBoards(boost::uint16_t activeBoardsValue)
00171     {
00172         m_activeBoards = activeBoardsValue;
00173     }
00174 
00175     void setActiveBoards(const boost::uint64_t& word64);
00176 
00179     void setActiveBoardsWord64(boost::uint64_t& word64, int iWord);
00180 
00183     void setActiveBoardsWord64(boost::uint64_t& word64, int iWord,
00184                                boost::int16_t activeBoardsValue);
00185 
00186 
00187 
00189     inline const boost::uint16_t altNrBxBoard() const
00190     {
00191         return m_altNrBxBoard;
00192     }
00193 
00194     void setAltNrBxBoard(boost::uint16_t altNrBxBoardValue)
00195     {
00196         m_altNrBxBoard = altNrBxBoardValue;
00197     }
00198 
00199     void setAltNrBxBoard(const boost::uint64_t& word64);
00200 
00203     void setAltNrBxBoardWord64(boost::uint64_t& word64, int iWord);
00204 
00207     void setAltNrBxBoardWord64(boost::uint64_t& word64, int iWord,
00208                                boost::int16_t altNrBxBoardValue);
00209 
00210 
00211 
00213     inline const boost::uint32_t totalTriggerNr() const
00214     {
00215         return m_totalTriggerNr;
00216     }
00217 
00218     void setTotalTriggerNr(boost::uint32_t totalTriggerNrValue)
00219     {
00220         m_totalTriggerNr = totalTriggerNrValue;
00221     }
00222 
00223     void setTotalTriggerNr(const boost::uint64_t& word64);
00224 
00227     void setTotalTriggerNrWord64(boost::uint64_t& word64, int iWord);
00228 
00229 
00231     inline const unsigned int getSize() const
00232     {
00233         int unitLengthBits = L1GlobalTriggerReadoutSetup::UnitLength;
00234 
00235         return BlockSize*unitLengthBits;
00236     }
00237 
00238 public:
00239 
00241     virtual void reset();
00242 
00244     virtual void print(std::ostream& myCout) const;
00245 
00248     virtual void unpack(const unsigned char* gtfePtr);
00249 
00250 private:
00251 
00252     // block description in the raw GT record
00253 
00254     // block size in 64bits words
00255     static const int BlockSize;
00256 
00257     static const int BoardIdWord;
00258     static const int RecordLength1Word;
00259     static const int RecordLengthWord;
00260     static const int BxNrWord;
00261     static const int SetupVersionWord;
00262 
00263     static const boost::uint64_t BoardIdMask;
00264     static const boost::uint64_t RecordLength1Mask;
00265     static const boost::uint64_t RecordLengthMask;
00266     static const boost::uint64_t BxNrMask;
00267     static const boost::uint64_t SetupVersionMask;
00268 
00269     static const boost::uint32_t BstFlagMask;
00270 
00271     // shifts could be computed from masks...
00272     static const int BoardIdShift;
00273     static const int RecordLength1Shift;
00274     static const int RecordLengthShift;
00275     static const int BxNrShift;
00276     static const int SetupVersionShift;
00277 
00278     //
00279     static const int ActiveBoardsWord;
00280     static const int AltNrBxBoardWord;
00281     static const int TotalTriggerNrWord;
00282 
00283     static const boost::uint64_t ActiveBoardsMask;
00284     static const boost::uint64_t AltNrBxBoardMask;
00285     static const boost::uint64_t TotalTriggerNrMask;
00286 
00287     static const int ActiveBoardsShift;
00288     static const int AltNrBxBoardShift;
00289     static const int TotalTriggerNrShift;
00290 
00291 
00292 private:
00293 
00295     boost::uint16_t m_boardId;
00296 
00298     boost::uint16_t m_recordLength1;
00299 
00301     boost::uint16_t m_recordLength;
00302 
00304     boost::uint16_t m_bxNr;
00305     boost::uint32_t m_setupVersion;
00306 
00308     boost::uint16_t m_activeBoards;
00309 
00314     boost::uint16_t m_altNrBxBoard;
00315 
00317     boost::uint32_t m_totalTriggerNr;
00318 
00319 };
00320 
00321 #endif /*L1GlobalTrigger_L1GtfeWord_h*/