CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/EventFilter/CSCRawToDigi/interface/CSCTMBData.h

Go to the documentation of this file.
00001 //_______________________________________
00002 //
00003 //  Class to group TMB data  
00004 //  CSCTMBData 9/18/03  B.Mohr           
00005 //_______________________________________
00006 //
00007 
00008 #ifndef CSCTMBData_h
00009 #define CSCTMBData_h
00010 
00011 #include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h"
00012 #include "EventFilter/CSCRawToDigi/interface/CSCCLCTData.h"
00013 #include "EventFilter/CSCRawToDigi/interface/CSCTMBScope.h"
00014 #include "EventFilter/CSCRawToDigi/interface/CSCTMBMiniScope.h"
00015 #include "EventFilter/CSCRawToDigi/interface/CSCTMBBlockedCFEB.h"
00016 #include "EventFilter/CSCRawToDigi/interface/CSCTMBTrailer.h"
00017 #include "EventFilter/CSCRawToDigi/interface/CSCRPCData.h"
00018 #include <bitset>
00019 #include <boost/dynamic_bitset.hpp>
00020 
00021 
00022 class CSCTMBData {
00023 
00024  public:
00025 
00026   CSCTMBData();
00027   ~CSCTMBData();
00028   CSCTMBData(unsigned short *buf);
00029   CSCTMBData(const CSCTMBData& data);
00030   int UnpackTMB(unsigned short *buf);
00032   bool checkSize() const;
00033   static void setDebug(const bool value) {debug = value;}
00034   short unsigned int   CWordCnt()   const {return cWordCnt;}
00035   int getCRC() const {return theTMBTrailer.crc22();}
00036   const unsigned short size()       const {return size_;}
00037 
00038   CSCTMBHeader * tmbHeader()   {return &theTMBHeader;}
00039   CSCCLCTData * clctData()     {return &theCLCTData;}
00041   bool hasTMBScope() const { return theTMBScopeIsPresent;}
00042   CSCTMBScope & tmbScope() const;
00044   bool hasTMBMiniScope() const { return theTMBMiniScopeIsPresent; }
00045   CSCTMBMiniScope & tmbMiniScope() const;
00047   bool hasTMBBlockedCFEB() const { return theBlockedCFEBIsPresent; }
00048   CSCTMBBlockedCFEB & tmbBlockedCFEB() const;
00049   CSCTMBTrailer * tmbTrailer() {return &theTMBTrailer;}
00051   bool hasRPC() const {return theRPCDataIsPresent;}
00052   CSCRPCData * rpcData()       {return &theRPCData;}
00053 
00055 
00057   boost::dynamic_bitset<> pack();
00058 
00059 
00060   std::bitset<22> calCRC22(const std::vector< std::bitset<16> >& datain);
00061   std::bitset<22> nextCRC22_D16(const std::bitset<16>& D, const std::bitset<22>& C);
00062   int TMBCRCcalc();
00063   
00065   static void selfTest();
00066 
00067  private:
00068 
00071   unsigned short * theOriginalBuffer;
00074   unsigned theB0CLine;
00075   unsigned theE0FLine;
00076 
00077   CSCTMBHeader theTMBHeader;
00078   CSCCLCTData theCLCTData;
00079   CSCRPCData theRPCData;
00081   bool theTMBScopeIsPresent;
00082   CSCTMBScope * theTMBScope;
00083 
00086   bool theTMBMiniScopeIsPresent;
00087   CSCTMBMiniScope * theTMBMiniScope;
00088 
00089   bool theBlockedCFEBIsPresent;
00090   CSCTMBBlockedCFEB * theTMBBlockedCFEB;
00091 
00092   CSCTMBTrailer theTMBTrailer;
00093   static bool debug;
00094   unsigned short size_;
00095   unsigned short cWordCnt;
00096   bool theRPCDataIsPresent;
00097 };
00098 
00099 #endif