CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #ifndef L1GlobalTrigger_L1GtPsbWord_h
00002 #define L1GlobalTrigger_L1GtPsbWord_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 declaration
00031 class L1GtPsbWord
00032 {
00033 
00034 public:
00035 
00036     static const int NumberAData = 8;
00037     static const int NumberBData = 8;
00038 
00039 public:
00041     L1GtPsbWord();    // empty constructor, all members set to zero;
00042 
00044     L1GtPsbWord(
00045         boost::uint16_t boardIdValue,
00046         int bxInEventValue,
00047         boost::uint16_t bxNrValue,
00048         boost::uint32_t eventNrValue,
00049         boost::uint16_t aDataValue[NumberAData],
00050         boost::uint16_t bDataValue[NumberBData],
00051         boost::uint16_t localBxNrValue
00052     );
00053 
00054 
00056     virtual ~L1GtPsbWord();
00057 
00059     bool operator==(const L1GtPsbWord&) const;
00060 
00062     bool operator!=(const L1GtPsbWord&) const;
00063 
00064 
00065 public:
00066 
00068     inline const boost::uint16_t boardId() const
00069     {
00070         return m_boardId;
00071     }
00072 
00073     void setBoardId(boost::uint16_t boardIdValue)
00074     {
00075         m_boardId = boardIdValue;
00076     }
00077 
00080     void setBoardId(const boost::uint64_t& word64, int iWord);
00081 
00084     void setBoardIdWord64(boost::uint64_t& word64, int iWord);
00085 
00086 
00087 
00089     inline const int bxInEvent() const
00090     {
00091         return m_bxInEvent;
00092     }
00093 
00094     void setBxInEvent(int bxInEventValue)
00095     {
00096         m_bxInEvent = bxInEventValue;
00097     }
00098 
00101     void setBxInEvent(const boost::uint64_t& word64, int iWord);
00102 
00105     void setBxInEventWord64(boost::uint64_t& word64, int iWord);
00106 
00107 
00108 
00110     inline const boost::uint16_t bxNr() const
00111     {
00112         return m_bxNr;
00113     }
00114 
00115     void setBxNr(boost::uint16_t bxNrValue)
00116     {
00117         m_bxNr = bxNrValue;
00118     }
00119 
00122     void setBxNr(const boost::uint64_t& word64, int iWord);
00123 
00126     void setBxNrWord64(boost::uint64_t& word64, int iWord);
00127 
00128 
00129 
00131     inline const boost::uint32_t eventNr() const
00132     {
00133         return m_eventNr;
00134     }
00135 
00136     void setEventNr(boost::uint32_t eventNrValue)
00137     {
00138         m_eventNr = eventNrValue;
00139     }
00140 
00143     void setEventNr(const boost::uint64_t& word64, int iWord);
00144 
00147     void setEventNrWord64(boost::uint64_t& word64, int iWord);
00148 
00149 
00150 
00152     const boost::uint16_t aData(int iA) const;
00153     void setAData(boost::uint16_t aDataVal, int iA);
00154 
00157     void setAData(const boost::uint64_t& word64, int iWord);
00158 
00161     void setADataWord64(boost::uint64_t& word64, int iWord);
00162 
00163 
00164 
00166     const boost::uint16_t bData(int iB) const;
00167     void setBData(boost::uint16_t bDataVal, int iB);
00168 
00171     void setBData(const boost::uint64_t& word64, int iWord);
00172 
00175     void setBDataWord64(boost::uint64_t& word64, int iWord);
00176 
00177 
00178 
00180     inline const boost::uint16_t localBxNr() const
00181     {
00182         return m_localBxNr;
00183     }
00184 
00185     void setLocalBxNr(boost::uint16_t localBxNrValue)
00186     {
00187         m_localBxNr = localBxNrValue;
00188     }
00189 
00192     void setLocalBxNr(const boost::uint64_t& word64, int iWord);
00193 
00196     void setLocalBxNrWord64(boost::uint64_t& word64, int iWord);
00197 
00198 
00200     inline const unsigned int getSize() const
00201     {
00202         int unitLengthBits = L1GlobalTriggerReadoutSetup::UnitLength;
00203 
00204         return BlockSize*unitLengthBits;
00205     }
00206 
00207 
00208 public:
00209 
00211     void reset();
00212 
00214     void print(std::ostream& myCout) const;
00215 
00216 private:
00217 
00218     // block description in the raw GT record
00219 
00220     // block size in 64bits words (BlockSize * 64 bits)
00221     static const int BlockSize = 6;
00222 
00223     // word 0
00224 
00225     // index of the word in the PSB block containig the variable
00226     static const int BoardIdWord =   0;
00227     static const int BxInEventWord = 0;
00228     static const int BxNrWord =      0;
00229     static const int EventNrWord =   0;
00230 
00231     // mask to get the 64-bit-value from the corresponding word in the PSB block
00232     static const boost::uint64_t BoardIdMask =   0xFFFF000000000000ULL;
00233     static const boost::uint64_t BxInEventMask = 0x0000F00000000000ULL;
00234     static const boost::uint64_t BxNrMask =      0x00000FFF00000000ULL;
00235     static const boost::uint64_t EventNrMask =   0x0000000000FFFFFFULL;
00236 
00237     // shift to the right to get the value from the "64-bit-value"
00238     static const int BoardIdShift =   48;
00239     static const int BxInEventShift = 44;
00240     static const int BxNrShift =      32;
00241     static const int EventNrShift =    0;
00242 
00243     // assume uniform size od A_Data and B_Data
00244     static const int DataCHSize = 16; // bits
00245     static const boost::uint64_t DataCHMask = 0x000000000000FFFFULL;
00246 
00247     // word 1
00248     static const int ADataCH0Word =  1;
00249 
00250     // word 2
00251     static const int ADataCH4Word =  2;
00252 
00253     // word 3
00254     static const int BDataCH0Word =  3;
00255 
00256     // word 4
00257     static const int BDataCH4Word =  4;
00258 
00259     // word 5
00260     static const int LocalBxNrWord = 5;
00261     static const boost::uint64_t LocalBxNrMask =  0x0000000000000FFFULL;
00262     static const int LocalBxNrShift = 0;
00263 
00264 
00265 
00266 
00267 
00268 private:
00269 
00270     // first number in the comment represents number of bits
00271 
00272     boost::uint16_t m_boardId;        // 16: board identifier
00273     //
00274     int m_bxInEvent;      //  4: bunch cross in the GT event record
00275     //     one keeps 3 bx (F, 0, 1) for standard record,
00276     //               5 bx (E, F, 0, 1) for debug record
00277     //
00278     boost::uint16_t m_bxNr;           // 12: bunch cross number of the actual bx
00279     boost::uint32_t m_eventNr;        // 24: event number since last L1 reset generated in PSB
00280     //
00281     boost::uint16_t m_aData[NumberAData];    // 16: A_Data_ChX
00282     //
00283     boost::uint16_t m_bData[NumberBData];    // 16: B_Data_ChX
00284     //
00285     boost::uint16_t m_localBxNr;      // 12: local bunch cross number of the actual bx
00286     //     bx number at which the data were written into the ringbuffer
00287 
00288 
00289 };
00290 
00291 #endif /*L1GlobalTrigger_L1GtPsbWord_h*/