CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h

Go to the documentation of this file.
00001 #ifndef CSCTMBHeader_h
00002 #define CSCTMBHeader_h
00003 
00005 
00006 #include <iosfwd>
00007 #include <vector>
00008 #include "DataFormats/CSCDigi/interface/CSCTMBStatusDigi.h"
00009 #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h"
00010 #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h"
00011 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h"
00012 #include "EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h"
00013 #include "FWCore/Utilities/interface/Exception.h"
00014 #include <boost/shared_ptr.hpp>
00015 class CSCDMBHeader;
00016 class CSCTMBHeader2006;
00017 class CSCTMBHeader2007;
00018 
00019 
00020 class CSCTMBHeader {
00021 
00022  public:
00023   CSCTMBHeader(int firmwareVersion, int firmwareRevision);
00024   CSCTMBHeader(const CSCTMBStatusDigi & digi);
00025   CSCTMBHeader(const unsigned short * buf);
00026 
00028   void setEventInformation(const CSCDMBHeader & dmbHeader)
00029   {
00030     theHeaderFormat->setEventInformation(dmbHeader);
00031   }
00032 
00033   int FirmwareVersion() const {return theFirmwareVersion;}
00034   
00035 
00036   uint16_t BXNCount() const {
00037     return theHeaderFormat->BXNCount();
00038   }
00039   uint16_t ALCTMatchTime() const {
00040     return theHeaderFormat->ALCTMatchTime();
00041   }
00042   uint16_t CLCTOnly() const {
00043     return theHeaderFormat->CLCTOnly();
00044   }
00045   uint16_t ALCTOnly() const {
00046     return theHeaderFormat->ALCTOnly();
00047   }
00048   uint16_t TMBMatch() const {
00049     return theHeaderFormat->TMBMatch();
00050   }
00051 
00052   uint16_t Bxn0Diff() const {
00053     return theHeaderFormat->Bxn0Diff();
00054   }
00055   uint16_t Bxn1Diff() const {
00056     return theHeaderFormat->Bxn1Diff();
00057   }
00058 
00059   uint16_t L1ANumber() const {
00060     return theHeaderFormat->L1ANumber();
00061   }
00062 
00063   uint16_t sizeInBytes() const {
00064     return theHeaderFormat->sizeInWords()*2;
00065   }
00066 
00068   CSCTMBHeader2007 tmbHeader2007()   const;
00069   CSCTMBHeader2006 tmbHeader2006()   const;
00070 
00071   uint16_t NTBins() const {
00072     return theHeaderFormat->NTBins();
00073   }
00074   uint16_t NCFEBs() const {
00075     return theHeaderFormat->NCFEBs();
00076   }
00077 
00078 
00080   std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer)
00081   {
00082     return theHeaderFormat->CLCTDigis(idlayer);
00083   }
00084 
00086   std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const
00087   {
00088     return theHeaderFormat->CorrelatedLCTDigis(idlayer);
00089   }
00090   
00093   unsigned short int sizeInWords() const     {return theHeaderFormat->sizeInWords();}
00094 
00095   unsigned short int NHeaderFrames() const {
00096     return theHeaderFormat->NHeaderFrames();
00097   }
00098   
00099   unsigned short * data() {
00100     return theHeaderFormat->data();
00101   }
00102   
00104   static void setDebug(const bool value) {debug = value;}
00105   
00106   bool check() const {
00107      return theHeaderFormat->check();
00108   }
00109 
00111   //void setChamberId(const CSCDetId & detId) {theChamberId = detId;}
00112 
00114   void addCLCT0(const CSCCLCTDigi & digi) {theHeaderFormat->addCLCT0(digi);}
00115   void addCLCT1(const CSCCLCTDigi & digi) {theHeaderFormat->addCLCT1(digi);}
00116   void addALCT0(const CSCALCTDigi & digi) {theHeaderFormat->addALCT0(digi);}
00117   void addALCT1(const CSCALCTDigi & digi) {theHeaderFormat->addALCT1(digi);}
00118   void addCorrelatedLCT0(const CSCCorrelatedLCTDigi & digi) {
00119     theHeaderFormat->addCorrelatedLCT0(digi);
00120   }
00121   void addCorrelatedLCT1(const CSCCorrelatedLCTDigi & digi) {
00122     theHeaderFormat->addCorrelatedLCT1(digi);
00123   }
00124 
00126   void add(const std::vector<CSCCLCTDigi> & digis);
00127   void add(const std::vector<CSCCorrelatedLCTDigi> & digis);
00128 
00129 
00131   static void selfTest();
00132   
00133   friend std::ostream & operator<<(std::ostream & os, const CSCTMBHeader & hdr);
00134 
00135 private:
00136 
00137   //void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
00138 
00139   static bool debug;
00140 
00141   boost::shared_ptr<CSCVTMBHeaderFormat> theHeaderFormat;
00142   int theFirmwareVersion;
00143 
00144 };
00145 
00146 #endif
00147