CMS 3D CMS Logo

CSCTMBHeader.h
Go to the documentation of this file.
1 #ifndef CSCTMBHeader_h
2 #define CSCTMBHeader_h
3 
5 
6 #include <iosfwd>
7 #include <vector>
8 #include <memory>
15 
16 #ifndef LOCAL_UNPACK
17 #include <atomic>
18 #endif
19 class CSCDMBHeader;
20 struct CSCTMBHeader2006;
21 struct CSCTMBHeader2007;
23 struct CSCTMBHeader2013;
24 
25 class CSCTMBHeader {
26 public:
27  CSCTMBHeader(int firmwareVersion, int firmwareRevision);
28  CSCTMBHeader(const CSCTMBStatusDigi& digi);
29  CSCTMBHeader(const unsigned short* buf);
30 
32  void setEventInformation(const CSCDMBHeader& dmbHeader) { theHeaderFormat->setEventInformation(dmbHeader); }
33 
34  int FirmwareVersion() const { return theFirmwareVersion; }
35  int FirmwareRevision() const { return theHeaderFormat->firmwareRevision(); }
36 
37  uint16_t BXNCount() const { return theHeaderFormat->BXNCount(); }
38  uint16_t ALCTMatchTime() const { return theHeaderFormat->ALCTMatchTime(); }
39  uint16_t CLCTOnly() const { return theHeaderFormat->CLCTOnly(); }
40  uint16_t ALCTOnly() const { return theHeaderFormat->ALCTOnly(); }
41  uint16_t TMBMatch() const { return theHeaderFormat->TMBMatch(); }
42 
43  uint16_t Bxn0Diff() const { return theHeaderFormat->Bxn0Diff(); }
44  uint16_t Bxn1Diff() const { return theHeaderFormat->Bxn1Diff(); }
45 
46  uint16_t L1ANumber() const { return theHeaderFormat->L1ANumber(); }
47 
48  uint16_t sizeInBytes() const { return theHeaderFormat->sizeInWords() * 2; }
49 
55 
56  uint16_t NTBins() const { return theHeaderFormat->NTBins(); }
57  uint16_t NCFEBs() const { return theHeaderFormat->NCFEBs(); }
58 
59  uint16_t syncError() const { return theHeaderFormat->syncError(); }
60  uint16_t syncErrorCLCT() const { return theHeaderFormat->syncErrorCLCT(); }
61  uint16_t syncErrorMPC0() const { return theHeaderFormat->syncErrorMPC0(); }
62  uint16_t syncErrorMPC1() const { return theHeaderFormat->syncErrorMPC1(); }
63 
64  void setNCFEBs(uint16_t ncfebs) { theHeaderFormat->setNCFEBs(ncfebs); }
65 
67  std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer) { return theHeaderFormat->CLCTDigis(idlayer); }
68 
70  std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const {
71  return theHeaderFormat->CorrelatedLCTDigis(idlayer);
72  }
73 
76  unsigned short int sizeInWords() const { return theHeaderFormat->sizeInWords(); }
77 
78  unsigned short int NHeaderFrames() const { return theHeaderFormat->NHeaderFrames(); }
79 
80  unsigned short* data() { return theHeaderFormat->data(); }
81 
83  static void setDebug(const bool value) { debug = value; }
84 
85  bool check() const { return theHeaderFormat->check(); }
86 
88  //void setChamberId(const CSCDetId & detId) {theChamberId = detId;}
89 
91  void addCLCT0(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT0(digi); }
92  void addCLCT1(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT1(digi); }
93  void addALCT0(const CSCALCTDigi& digi) { theHeaderFormat->addALCT0(digi); }
94  void addALCT1(const CSCALCTDigi& digi) { theHeaderFormat->addALCT1(digi); }
95  void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT0(digi); }
96  void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT1(digi); }
97 
99  void add(const std::vector<CSCCLCTDigi>& digis);
100  void add(const std::vector<CSCCorrelatedLCTDigi>& digis);
101 
103  static void selfTest();
104 
105  friend std::ostream& operator<<(std::ostream& os, const CSCTMBHeader& hdr);
106 
107 private:
108  //void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
109 
110 #ifdef LOCAL_UNPACK
111  static bool debug;
112 #else
113  static std::atomic<bool> debug;
114 #endif
115 
116  std::shared_ptr<CSCVTMBHeaderFormat> theHeaderFormat;
118 };
119 
120 #endif
CSCTMBHeader::sizeInBytes
uint16_t sizeInBytes() const
Definition: CSCTMBHeader.h:48
CSCTMBHeader::addALCT1
void addALCT1(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:94
CSCTMBHeader::operator<<
friend std::ostream & operator<<(std::ostream &os, const CSCTMBHeader &hdr)
Definition: CSCTMBHeader.cc:219
CSCTMBHeader::FirmwareVersion
int FirmwareVersion() const
Definition: CSCTMBHeader.h:34
CSCTMBHeader::CorrelatedLCTDigis
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis
Definition: CSCTMBHeader.h:70
CSCTMBHeader::debug
static std::atomic< bool > debug
Definition: CSCTMBHeader.h:113
CSCTMBHeader::NHeaderFrames
unsigned short int NHeaderFrames() const
Definition: CSCTMBHeader.h:78
CSCVTMBHeaderFormat.h
CSCTMBStatusDigi
Definition: CSCTMBStatusDigi.h:15
CSCTMBHeader::tmbHeader2013
CSCTMBHeader2013 tmbHeader2013() const
Definition: CSCTMBHeader.cc:147
CSCTMBHeader::addALCT0
void addALCT0(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:93
CSCTMBHeader::setEventInformation
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:32
CSCTMBHeader2007_rev0x50c3
Definition: CSCTMBHeader2007_rev0x50c3.h:6
CSCTMBHeader::tmbHeader2006
CSCTMBHeader2006 tmbHeader2006() const
Definition: CSCTMBHeader.cc:155
CSCCorrelatedLCTDigi.h
CSCTMBHeader::selfTest
static void selfTest()
tests that packing and unpacking give same results
Definition: CSCTMBHeader.cc:163
CSCTMBHeader::CLCTDigis
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:67
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
CSCTMBHeader::CSCTMBHeader
CSCTMBHeader(int firmwareVersion, int firmwareRevision)
Definition: CSCTMBHeader.cc:20
CSCTMBHeader::Bxn1Diff
uint16_t Bxn1Diff() const
Definition: CSCTMBHeader.h:44
CSCTMBHeader2007
Definition: CSCTMBHeader2007.h:6
simCaloStage2Layer1Digis_cfi.firmwareVersion
firmwareVersion
Definition: simCaloStage2Layer1Digis_cfi.py:21
CSCTMBHeader::syncErrorMPC1
uint16_t syncErrorMPC1() const
Definition: CSCTMBHeader.h:62
CSCALCTDigi.h
CSCTMBHeader::FirmwareRevision
int FirmwareRevision() const
Definition: CSCTMBHeader.h:35
CSCTMBHeader::tmbHeader2007
CSCTMBHeader2007 tmbHeader2007() const
will throw if the cast fails
Definition: CSCTMBHeader.cc:131
CSCTMBHeader::addCorrelatedLCT0
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:95
CSCTMBHeader::NTBins
uint16_t NTBins() const
Definition: CSCTMBHeader.h:56
CSCTMBHeader::tmbHeader2007_rev0x50c3
CSCTMBHeader2007_rev0x50c3 tmbHeader2007_rev0x50c3() const
Definition: CSCTMBHeader.cc:139
CSCTMBHeader::NCFEBs
uint16_t NCFEBs() const
Definition: CSCTMBHeader.h:57
CSCTMBHeader::addCorrelatedLCT1
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:96
CSCTMBHeader::addCLCT1
void addCLCT1(const CSCCLCTDigi &digi)
Definition: CSCTMBHeader.h:92
CSCTMBHeader::addCLCT0
void addCLCT0(const CSCCLCTDigi &digi)
Needed before data packing.
Definition: CSCTMBHeader.h:91
CSCTMBHeader::syncError
uint16_t syncError() const
Definition: CSCTMBHeader.h:59
CSCTMBHeader::TMBMatch
uint16_t TMBMatch() const
Definition: CSCTMBHeader.h:41
CSCTMBHeader::CLCTOnly
uint16_t CLCTOnly() const
Definition: CSCTMBHeader.h:39
CSCTMBStatusDigi.h
value
Definition: value.py:1
CSCTMBHeader::syncErrorCLCT
uint16_t syncErrorCLCT() const
Definition: CSCTMBHeader.h:60
CSCTMBHeader2006
Definition: CSCTMBHeader2006.h:6
CSCTMBHeader::check
bool check() const
Definition: CSCTMBHeader.h:85
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCTMBHeader
Definition: CSCTMBHeader.h:25
CSCTMBHeader::syncErrorMPC0
uint16_t syncErrorMPC0() const
Definition: CSCTMBHeader.h:61
CSCTMBHeader::Bxn0Diff
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:43
CSCDMBHeader
Definition: CSCDMBHeader.h:15
CSCTMBHeader::theHeaderFormat
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:116
relativeConstraints.value
value
Definition: relativeConstraints.py:53
CSCALCTDigi
Definition: CSCALCTDigi.h:16
CSCTMBHeader2013
Definition: CSCTMBHeader2013.h:6
CSCCLCTDigi.h
CSCTMBHeader::setNCFEBs
void setNCFEBs(uint16_t ncfebs)
Definition: CSCTMBHeader.h:64
Exception.h
CSCTMBHeader::BXNCount
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:37
CSCTMBHeader::add
void add(const std::vector< CSCCLCTDigi > &digis)
these methods need more brains to figure which one goes first
Definition: CSCTMBHeader.cc:114
CSCTMBHeader::ALCTOnly
uint16_t ALCTOnly() const
Definition: CSCTMBHeader.h:40
CSCTMBHeader::ALCTMatchTime
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:38
CSCTMBHeader::L1ANumber
uint16_t L1ANumber() const
Definition: CSCTMBHeader.h:46
CSCTMBHeader::sizeInWords
unsigned short int sizeInWords() const
Definition: CSCTMBHeader.h:76
CSCTMBHeader::data
unsigned short * data()
Definition: CSCTMBHeader.h:80
CSCTMBHeader::theFirmwareVersion
int theFirmwareVersion
Definition: CSCTMBHeader.h:117
CSCCorrelatedLCTDigi
Definition: CSCCorrelatedLCTDigi.h:19
CSCTMBHeader::setDebug
static void setDebug(const bool value)
Definition: CSCTMBHeader.h:83