CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DataFormats/L1GlobalTrigger/interface/L1GtFdlWord.h

Go to the documentation of this file.
00001 #ifndef L1GlobalTrigger_L1GtFdlWord_h
00002 #define L1GlobalTrigger_L1GtFdlWord_h
00003 
00020 // system include files
00021 #include <boost/cstdint.hpp>
00022 
00023 // user include files
00024 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00025 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
00026 
00027 // forward declarations
00028 
00029 // class interface
00030 
00031 class L1GtFdlWord
00032 {
00033 
00034 public:
00036     L1GtFdlWord();    // empty constructor, all members set to zero;
00037 
00038     // constructor from unpacked values;
00039     L1GtFdlWord(
00040         boost::uint16_t boardIdValue,
00041         int bxInEventValue,
00042         boost::uint16_t bxNrValue,
00043         boost::uint32_t eventNrValue,
00044         TechnicalTriggerWord gtTechnicalTriggerWordValue,
00045         DecisionWord gtDecisionWordValue,
00046         DecisionWordExtended gtDecisionWordExtendedValue,
00047         boost::uint16_t gtPrescaleFactorIndexTechValue,
00048         boost::uint16_t gtPrescaleFactorIndexAlgoValue,
00049         boost::uint16_t noAlgoValue,
00050         boost::uint16_t finalORValue,
00051         boost::uint32_t orbitNrValue,
00052         boost::uint16_t lumiSegmentNrValue,
00053         boost::uint16_t localBxNrValue
00054     );
00055 
00056 
00058     virtual ~L1GtFdlWord();
00059 
00061     bool operator==(const L1GtFdlWord&) const;
00062 
00064     bool operator!=(const L1GtFdlWord&) const;
00065 
00066 public:
00067 
00069 
00071     inline const boost::uint16_t boardId() const
00072     {
00073         return m_boardId;
00074     }
00075 
00077     void setBoardId(const boost::uint16_t& boardIdValue)
00078     {
00079         m_boardId = boardIdValue;
00080     }
00081 
00083     void setBoardId(const boost::uint64_t& word64);
00084 
00087     void setBoardIdWord64(boost::uint64_t& word64, const int iWord);
00088 
00089 
00090 
00092     inline const int bxInEvent() const
00093     {
00094         return m_bxInEvent;
00095     }
00096 
00097     void setBxInEvent(const int bxInEventValue)
00098     {
00099         m_bxInEvent = bxInEventValue;
00100     }
00101 
00103     void setBxInEvent(const boost::uint64_t& word64);
00104 
00107     void setBxInEventWord64(boost::uint64_t& word64, const int iWord);
00108 
00109 
00110 
00112     inline const boost::uint16_t bxNr() const
00113     {
00114         return m_bxNr;
00115     }
00116 
00117     void setBxNr(const boost::uint16_t& bxNrValue)
00118     {
00119         m_bxNr = bxNrValue;
00120     }
00121 
00123     void setBxNr(const boost::uint64_t& word64);
00124 
00127     void setBxNrWord64(boost::uint64_t& word64, const int iWord);
00128 
00129 
00130 
00132     inline const boost::uint32_t eventNr() const
00133     {
00134         return m_eventNr;
00135     }
00136 
00137     void setEventNr(const boost::uint32_t& eventNrValue)
00138     {
00139         m_eventNr = eventNrValue;
00140     }
00141 
00143     void setEventNr(const boost::uint64_t& word64);
00144 
00147     void setEventNrWord64(boost::uint64_t& word64, const int iWord);
00148 
00149 
00151     inline const TechnicalTriggerWord & gtTechnicalTriggerWord() const
00152     {
00153         return m_gtTechnicalTriggerWord;
00154     }
00155 
00156     void setGtTechnicalTriggerWord (const TechnicalTriggerWord& gtTechnicalTriggerWordValue)
00157     {
00158         m_gtTechnicalTriggerWord = gtTechnicalTriggerWordValue;
00159     }
00160 
00161     void printGtTechnicalTriggerWord(std::ostream& myCout) const;
00162 
00164     void setGtTechnicalTriggerWord(const boost::uint64_t& word64);
00165 
00168     void setGtTechnicalTriggerWordWord64(boost::uint64_t& word64, const int iWord);
00169 
00170 
00171 
00173     inline const DecisionWord & gtDecisionWord() const
00174     {
00175         return m_gtDecisionWord;
00176     }
00177 
00178     void setGtDecisionWord(const DecisionWord& gtDecisionWordValue)
00179     {
00180         m_gtDecisionWord = gtDecisionWordValue;
00181     }
00182 
00183     void printGtDecisionWord(std::ostream& myCout) const;
00184 
00187     void setGtDecisionWordA(const boost::uint64_t& word64);
00188 
00191     void setGtDecisionWordB(const boost::uint64_t& word64);
00192 
00196     void setGtDecisionWordAWord64(boost::uint64_t& word64, const int iWord);
00197 
00201     void setGtDecisionWordBWord64(boost::uint64_t& word64, const int iWord);
00202 
00203 
00205     inline const DecisionWordExtended & gtDecisionWordExtended() const
00206     {
00207         return m_gtDecisionWordExtended;
00208     }
00209 
00210     void setGtDecisionWordExtended (const DecisionWordExtended& gtDecisionWordExtendedValue)
00211     {
00212         m_gtDecisionWordExtended = gtDecisionWordExtendedValue;
00213     }
00214 
00215     void printGtDecisionWordExtended(std::ostream& myCout) const;
00216 
00218     void setGtDecisionWordExtended(const boost::uint64_t& word64);
00219 
00222     void setGtDecisionWordExtendedWord64(boost::uint64_t& word64, const int iWord);
00223 
00224 
00225 
00226 
00227 
00229     inline const boost::uint16_t physicsDeclared() const
00230     {
00231         return m_physicsDeclared;
00232     }
00233 
00234     void setPhysicsDeclared(const boost::uint16_t& physicsDeclaredValue)
00235     {
00236         m_physicsDeclared = physicsDeclaredValue;
00237     }
00238 
00240     void setPhysicsDeclared(const boost::uint64_t& word64);
00241 
00244     void setPhysicsDeclaredWord64(boost::uint64_t& word64, const int iWord);
00245 
00246 
00247 
00249 
00250     inline const boost::uint16_t gtPrescaleFactorIndexTech() const
00251     {
00252         return m_gtPrescaleFactorIndexTech;
00253     }
00254 
00255     void setGtPrescaleFactorIndexTech(const boost::uint16_t& gtPrescaleFactorIndexTechValue)
00256     {
00257         m_gtPrescaleFactorIndexTech = gtPrescaleFactorIndexTechValue;
00258     }
00259 
00261     void setGtPrescaleFactorIndexTech(const boost::uint64_t& word64);
00262 
00265     void setGtPrescaleFactorIndexTechWord64(boost::uint64_t& word64, const int iWord);
00266 
00267 
00268 
00269     inline const boost::uint16_t gtPrescaleFactorIndexAlgo() const
00270     {
00271         return m_gtPrescaleFactorIndexAlgo;
00272     }
00273 
00274     void setGtPrescaleFactorIndexAlgo(const boost::uint16_t& gtPrescaleFactorIndexAlgoValue)
00275     {
00276         m_gtPrescaleFactorIndexAlgo = gtPrescaleFactorIndexAlgoValue;
00277     }
00278 
00280     void setGtPrescaleFactorIndexAlgo(const boost::uint64_t& word64);
00281 
00284     void setGtPrescaleFactorIndexAlgoWord64(boost::uint64_t& word64, const int iWord);
00285 
00286 
00288     inline const boost::uint16_t noAlgo() const
00289     {
00290         return m_noAlgo;
00291     }
00292 
00293     void setNoAlgo(const boost::uint16_t& noAlgoValue)
00294     {
00295         m_noAlgo = noAlgoValue;
00296     }
00297 
00299     void setNoAlgo(const boost::uint64_t& word64);
00300 
00303     void setNoAlgoWord64(boost::uint64_t& word64, const int iWord);
00304 
00305 
00306 
00308     inline const boost::uint16_t finalOR() const
00309     {
00310         return m_finalOR;
00311     }
00312 
00313     void setFinalOR(const boost::uint16_t& finalORValue)
00314     {
00315         m_finalOR = finalORValue;
00316     }
00317 
00319     void setFinalOR(const boost::uint64_t& word64);
00320 
00323     void setFinalORWord64(boost::uint64_t& word64, const int iWord);
00324 
00325 
00326 
00327     inline const bool globalDecision() const
00328     {
00329         return static_cast<bool> (m_finalOR);
00330     }
00331 
00332 
00334     inline const boost::uint32_t orbitNr() const
00335     {
00336         return m_orbitNr;
00337     }
00338 
00339     void setOrbitNr(const boost::uint32_t& orbitNrValue)
00340     {
00341         m_orbitNr = orbitNrValue;
00342     }
00343 
00345     void setOrbitNr(const boost::uint64_t& word64);
00346 
00349     void setOrbitNrWord64(boost::uint64_t& word64, const int iWord);
00350 
00351 
00352 
00354     inline const boost::uint16_t lumiSegmentNr() const
00355     {
00356         return m_lumiSegmentNr;
00357     }
00358 
00359     void setLumiSegmentNr(const boost::uint16_t& lumiSegmentNrValue)
00360     {
00361         m_lumiSegmentNr = lumiSegmentNrValue;
00362     }
00363 
00365     void setLumiSegmentNr(const boost::uint64_t& word64);
00366 
00369     void setLumiSegmentNrWord64(boost::uint64_t& word64, const int iWord);
00370 
00371 
00372 
00374     inline const boost::uint16_t localBxNr() const
00375     {
00376         return m_localBxNr;
00377     }
00378 
00379     void setLocalBxNr(const boost::uint16_t& localBxNrValue)
00380     {
00381         m_localBxNr = localBxNrValue;
00382     }
00383 
00385     void setLocalBxNr(const boost::uint64_t& word64);
00386 
00389     void setLocalBxNrWord64(boost::uint64_t& word64, const int iWord);
00390 
00391 
00392 
00394     inline const unsigned int getSize() const
00395     {
00396         int unitLengthBits = L1GlobalTriggerReadoutSetup::UnitLength;
00397 
00398         return BlockSize*unitLengthBits;
00399     }
00400 
00401 public:
00402 
00404     void reset();
00405 
00407     void print(std::ostream& myCout) const;
00408 
00411     void unpack(const unsigned char* fdlPtr);
00412 
00413 private:
00414 
00415     // block description in the raw GT record
00416 
00417     // block size in 64bits words (BlockSize * 64 bits)
00418     static const int BlockSize;
00419 
00420     // word 0
00421 
00422     // index of the word in the FDL block containig the variable
00423     static const int BoardIdWord;
00424     static const int BxInEventWord;
00425     static const int BxNrWord;
00426     static const int EventNrWord;
00427 
00428     // mask to get the 64-bit-value from the corresponding word in the FDL block
00429     static const boost::uint64_t BoardIdMask;
00430     static const boost::uint64_t BxInEventMask;
00431     static const boost::uint64_t BxNrMask;
00432     static const boost::uint64_t EventNrMask;
00433 
00434     // shift to the right to get the value from the "64-bit-value"
00435     static const int BoardIdShift;
00436     static const int BxInEventShift;
00437     static const int BxNrShift;
00438     static const int EventNrShift;
00439 
00440     // word 1
00441 
00442     static const int GtTechnicalTriggerWordWord;
00443     static const boost::uint64_t GtTechnicalTriggerWordMask;
00444     static const int GtTechnicalTriggerWordShift;
00445 
00446     // word 2 - WordA: bits 0-63
00447 
00448     static const int GtDecisionWordAWord;
00449     static const boost::uint64_t GtDecisionWordAMask;
00450     static const int GtDecisionWordAShift;
00451 
00452     // word 3 - WordB: bits 64-128
00453 
00454     static const int GtDecisionWordBWord;
00455     static const boost::uint64_t GtDecisionWordBMask;
00456     static const int GtDecisionWordBShift;
00457 
00458 
00459     // word 4
00460     static const int GtDecisionWordExtendedWord;
00461     static const boost::uint64_t GtDecisionWordExtendedMask;
00462     static const int GtDecisionWordExtendedShift;
00463 
00464     // word 5
00465     static const int PhysicsDeclaredWord;
00466     static const int GtPrescaleFactorIndexTechWord;
00467     static const int GtPrescaleFactorIndexAlgoWord;
00468     static const int NoAlgoWord;
00469     static const int FinalORWord;
00470 
00471     static const boost::uint64_t PhysicsDeclaredMask;
00472     static const boost::uint64_t GtPrescaleFactorIndexTechMask;
00473     static const boost::uint64_t GtPrescaleFactorIndexAlgoMask;
00474     static const boost::uint64_t NoAlgoMask;
00475     static const boost::uint64_t FinalORMask;
00476 
00477     static const int PhysicsDeclaredShift;
00478     static const int GtPrescaleFactorIndexTechShift;
00479     static const int GtPrescaleFactorIndexAlgoShift;
00480     static const int NoAlgoShift;
00481     static const int FinalORShift;
00482 
00483     // word 6
00484     static const int OrbitNrWord;
00485     static const int LumiSegmentNrWord;
00486     static const int LocalBxNrWord;
00487 
00488     static const boost::uint64_t OrbitNrMask;
00489     static const boost::uint64_t LumiSegmentNrMask;
00490     static const boost::uint64_t LocalBxNrMask;
00491 
00492     static const int OrbitNrShift;
00493     static const int LumiSegmentNrShift;
00494     static const int LocalBxNrShift;
00495 
00496 private:
00497 
00498 
00500     boost::uint16_t m_boardId;
00501 
00503     int m_bxInEvent;
00504 
00506     boost::uint16_t m_bxNr;
00507 
00509     boost::uint32_t m_eventNr;
00510 
00511     //
00512 
00514     TechnicalTriggerWord m_gtTechnicalTriggerWord;
00515 
00517     DecisionWord m_gtDecisionWord;
00518 
00520     DecisionWordExtended m_gtDecisionWordExtended;
00521 
00522     //
00524     boost::uint16_t m_physicsDeclared;
00525 
00528     boost::uint16_t m_gtPrescaleFactorIndexTech;
00529     boost::uint16_t m_gtPrescaleFactorIndexAlgo;
00530 
00532     boost::uint16_t m_noAlgo;
00533 
00536     boost::uint16_t m_finalOR;
00537 
00538     //
00539 
00541     boost::uint32_t m_orbitNr;
00542 
00544     boost::uint16_t m_lumiSegmentNr;
00545 
00548     boost::uint16_t m_localBxNr;
00549 
00550 
00551 
00552 };
00553 
00554 #endif /*L1GlobalTrigger_L1GtFdlWord_h*/