CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCTMBHeader.h
Go to the documentation of this file.
1 #ifndef EventFilter_CSCRawToDigi_CSCTMBHeader_h
2 #define EventFilter_CSCRawToDigi_CSCTMBHeader_h
3 
5 
6 #include <iosfwd>
7 #include <vector>
8 #include <memory>
17 
18 #ifndef LOCAL_UNPACK
19 #include <atomic>
20 #endif
21 class CSCDMBHeader;
22 struct CSCTMBHeader2006;
23 struct CSCTMBHeader2007;
25 struct CSCTMBHeader2013;
30 
31 class CSCTMBHeader {
32 public:
33  CSCTMBHeader(int firmwareVersion, int firmwareRevision);
34  CSCTMBHeader(const CSCTMBStatusDigi& digi);
35  CSCTMBHeader(const unsigned short* buf);
36 
38  void setEventInformation(const CSCDMBHeader& dmbHeader) { theHeaderFormat->setEventInformation(dmbHeader); }
39 
40  int FirmwareVersion() const { return theFirmwareVersion; }
41  int FirmwareRevision() const { return theHeaderFormat->firmwareRevision(); }
42 
43  uint16_t BXNCount() const { return theHeaderFormat->BXNCount(); }
44  uint16_t ALCTMatchTime() const { return theHeaderFormat->ALCTMatchTime(); }
45  uint16_t CLCTOnly() const { return theHeaderFormat->CLCTOnly(); }
46  uint16_t ALCTOnly() const { return theHeaderFormat->ALCTOnly(); }
47  uint16_t TMBMatch() const { return theHeaderFormat->TMBMatch(); }
48 
49  uint16_t Bxn0Diff() const { return theHeaderFormat->Bxn0Diff(); }
50  uint16_t Bxn1Diff() const { return theHeaderFormat->Bxn1Diff(); }
51 
52  uint16_t L1ANumber() const { return theHeaderFormat->L1ANumber(); }
53 
54  uint16_t sizeInBytes() const { return theHeaderFormat->sizeInWords() * 2; }
55 
65 
66  uint16_t NTBins() const { return theHeaderFormat->NTBins(); }
67  uint16_t NCFEBs() const { return theHeaderFormat->NCFEBs(); }
68 
69  uint16_t syncError() const { return theHeaderFormat->syncError(); }
70  uint16_t syncErrorCLCT() const { return theHeaderFormat->syncErrorCLCT(); }
71  uint16_t syncErrorMPC0() const { return theHeaderFormat->syncErrorMPC0(); }
72  uint16_t syncErrorMPC1() const { return theHeaderFormat->syncErrorMPC1(); }
73 
74  void setNCFEBs(uint16_t ncfebs) { theHeaderFormat->setNCFEBs(ncfebs); }
75 
77  uint16_t clct0_ComparatorCode() const { return theHeaderFormat->clct0_ComparatorCode(); }
78  uint16_t clct1_ComparatorCode() const { return theHeaderFormat->clct1_ComparatorCode(); }
79  uint16_t clct0_xky() const { return theHeaderFormat->clct0_xky(); }
80  uint16_t clct1_xky() const { return theHeaderFormat->clct1_xky(); }
81  uint16_t hmt_nhits() const { return theHeaderFormat->hmt_nhits(); }
82  uint16_t hmt_ALCTMatchTime() const { return theHeaderFormat->hmt_ALCTMatchTime(); }
83  uint16_t gem_enabled_fibers() const { return theHeaderFormat->gem_enabled_fibers(); }
84  uint16_t gem_fifo_tbins() const { return theHeaderFormat->gem_fifo_tbins(); }
85  uint16_t gem_fifo_pretrig() const { return theHeaderFormat->gem_fifo_pretrig(); }
86  uint16_t gem_zero_suppress() const { return theHeaderFormat->gem_zero_suppress(); }
87  uint16_t gem_sync_dataword() const { return theHeaderFormat->gem_sync_dataword(); }
88  uint16_t gem_timing_dataword() const { return theHeaderFormat->gem_timing_dataword(); }
89  uint16_t run3_CLCT_patternID() const { return theHeaderFormat->run3_CLCT_patternID(); }
91  CSCShowerDigi showerDigi(uint32_t idlayer) const { return theHeaderFormat->showerDigi(idlayer); }
92 
94  std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer) { return theHeaderFormat->CLCTDigis(idlayer); }
95 
97  std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const {
98  return theHeaderFormat->CorrelatedLCTDigis(idlayer);
99  }
100 
103  unsigned short int sizeInWords() const { return theHeaderFormat->sizeInWords(); }
104 
105  unsigned short int NHeaderFrames() const { return theHeaderFormat->NHeaderFrames(); }
106 
107  unsigned short* data() { return theHeaderFormat->data(); }
108 
110  static void setDebug(const bool value) { debug = value; }
111 
112  bool check() const { return theHeaderFormat->check(); }
113 
115  void addCLCT0(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT0(digi); }
116  void addCLCT1(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT1(digi); }
117  void addALCT0(const CSCALCTDigi& digi) { theHeaderFormat->addALCT0(digi); }
118  void addALCT1(const CSCALCTDigi& digi) { theHeaderFormat->addALCT1(digi); }
119  void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT0(digi); }
120  void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT1(digi); }
121  // Add Run3 Shower digi for HMT
122  void addShower(const CSCShowerDigi& digi) { theHeaderFormat->addShower(digi); }
123 
125  void add(const std::vector<CSCCLCTDigi>& digis);
126  void add(const std::vector<CSCCorrelatedLCTDigi>& digis);
127  void add(const std::vector<CSCShowerDigi>& digis);
128 
130  static void selfTest(int firmwwareVersion, int firmwareRevision);
131 
132  friend std::ostream& operator<<(std::ostream& os, const CSCTMBHeader& hdr);
133 
134 private:
135  //void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
136 
137 #ifdef LOCAL_UNPACK
138  static bool debug;
139 #else
140  static std::atomic<bool> debug;
141 #endif
142 
143  std::shared_ptr<CSCVTMBHeaderFormat> theHeaderFormat;
145 };
146 
147 #endif
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:43
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:38
uint16_t gem_timing_dataword() const
Definition: CSCTMBHeader.h:88
CSCTMBHeader2007 tmbHeader2007() const
will throw if the cast fails
uint16_t NTBins() const
Definition: CSCTMBHeader.h:66
uint16_t hmt_ALCTMatchTime() const
Definition: CSCTMBHeader.h:82
uint16_t gem_enabled_fibers() const
Definition: CSCTMBHeader.h:83
int FirmwareRevision() const
Definition: CSCTMBHeader.h:41
uint16_t clct1_xky() const
Definition: CSCTMBHeader.h:80
unsigned short int NHeaderFrames() const
Definition: CSCTMBHeader.h:105
uint16_t run3_CLCT_patternID() const
Definition: CSCTMBHeader.h:89
int theFirmwareVersion
Definition: CSCTMBHeader.h:144
uint16_t syncErrorCLCT() const
Definition: CSCTMBHeader.h:70
uint16_t CLCTOnly() const
Definition: CSCTMBHeader.h:45
uint16_t L1ANumber() const
Definition: CSCTMBHeader.h:52
uint16_t syncErrorMPC0() const
Definition: CSCTMBHeader.h:71
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis
Definition: CSCTMBHeader.h:97
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t Bxn1Diff() const
Definition: CSCTMBHeader.h:50
uint16_t gem_fifo_tbins() const
Definition: CSCTMBHeader.h:84
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:119
uint16_t clct1_ComparatorCode() const
Definition: CSCTMBHeader.h:78
void add(const std::vector< CSCCLCTDigi > &digis)
these methods need more brains to figure which one goes first
CSCTMBHeader2020_CCLUT tmbHeader2020_CCLUT() const
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:120
CSCShowerDigi showerDigi(uint32_t idlayer) const
returns Run3 Shower Digi for HMT
Definition: CSCTMBHeader.h:91
uint16_t clct0_ComparatorCode() const
== Run 3 CSC-GEM Trigger Format
Definition: CSCTMBHeader.h:77
uint16_t NCFEBs() const
Definition: CSCTMBHeader.h:67
uint16_t gem_zero_suppress() const
Definition: CSCTMBHeader.h:86
void addCLCT1(const CSCCLCTDigi &digi)
Definition: CSCTMBHeader.h:116
void setNCFEBs(uint16_t ncfebs)
Definition: CSCTMBHeader.h:74
uint16_t syncErrorMPC1() const
Definition: CSCTMBHeader.h:72
static void setDebug(const bool value)
Definition: CSCTMBHeader.h:110
uint16_t syncError() const
Definition: CSCTMBHeader.h:69
CSCTMBHeader2020_TMB tmbHeader2020_TMB() const
unsigned short * data()
Definition: CSCTMBHeader.h:107
uint16_t ALCTOnly() const
Definition: CSCTMBHeader.h:46
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:49
static std::atomic< bool > debug
Definition: CSCTMBHeader.h:140
friend std::ostream & operator<<(std::ostream &os, const CSCTMBHeader &hdr)
void addShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:122
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:44
unsigned short int sizeInWords() const
Definition: CSCTMBHeader.h:103
uint16_t sizeInBytes() const
Definition: CSCTMBHeader.h:54
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:94
CSCTMBHeader2006 tmbHeader2006() const
CSCTMBHeader2007_rev0x50c3 tmbHeader2007_rev0x50c3() const
void addCLCT0(const CSCCLCTDigi &digi)
for data packing
Definition: CSCTMBHeader.h:115
bool check() const
Definition: CSCTMBHeader.h:112
static void selfTest(int firmwwareVersion, int firmwareRevision)
tests that packing and unpacking give same results
CSCTMBHeader2020_Run2 tmbHeader2020_Run2() const
CSCTMBHeader2020_GEM tmbHeader2020_GEM() const
uint16_t TMBMatch() const
Definition: CSCTMBHeader.h:47
uint16_t hmt_nhits() const
Definition: CSCTMBHeader.h:81
int FirmwareVersion() const
Definition: CSCTMBHeader.h:40
uint16_t gem_sync_dataword() const
Definition: CSCTMBHeader.h:87
void addALCT1(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:118
CSCTMBHeader(int firmwareVersion, int firmwareRevision)
Definition: CSCTMBHeader.cc:24
uint16_t clct0_xky() const
Definition: CSCTMBHeader.h:79
uint16_t gem_fifo_pretrig() const
Definition: CSCTMBHeader.h:85
CSCTMBHeader2013 tmbHeader2013() const
void addALCT0(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:117