CMS 3D CMS Logo

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  void setALCTMatchTime(uint16_t alctmatchtime) { theHeaderFormat->setALCTMatchTime(alctmatchtime); }
46  uint16_t CLCTOnly() const { return theHeaderFormat->CLCTOnly(); }
47  uint16_t ALCTOnly() const { return theHeaderFormat->ALCTOnly(); }
48  uint16_t TMBMatch() const { return theHeaderFormat->TMBMatch(); }
49 
50  uint16_t Bxn0Diff() const { return theHeaderFormat->Bxn0Diff(); }
51  uint16_t Bxn1Diff() const { return theHeaderFormat->Bxn1Diff(); }
52 
53  uint16_t L1ANumber() const { return theHeaderFormat->L1ANumber(); }
54 
55  uint16_t sizeInBytes() const { return theHeaderFormat->sizeInWords() * 2; }
56 
66 
67  uint16_t NTBins() const { return theHeaderFormat->NTBins(); }
68  uint16_t NCFEBs() const { return theHeaderFormat->NCFEBs(); }
69 
70  uint16_t syncError() const { return theHeaderFormat->syncError(); }
71  uint16_t syncErrorCLCT() const { return theHeaderFormat->syncErrorCLCT(); }
72  uint16_t syncErrorMPC0() const { return theHeaderFormat->syncErrorMPC0(); }
73  uint16_t syncErrorMPC1() const { return theHeaderFormat->syncErrorMPC1(); }
74 
75  void setNCFEBs(uint16_t ncfebs) { theHeaderFormat->setNCFEBs(ncfebs); }
76 
78  uint16_t clct0_ComparatorCode() const { return theHeaderFormat->clct0_ComparatorCode(); }
79  uint16_t clct1_ComparatorCode() const { return theHeaderFormat->clct1_ComparatorCode(); }
80  uint16_t clct0_xky() const { return theHeaderFormat->clct0_xky(); }
81  uint16_t clct1_xky() const { return theHeaderFormat->clct1_xky(); }
82  uint16_t hmt_nhits() const { return theHeaderFormat->hmt_nhits(); }
83  uint16_t hmt_ALCTMatchTime() const { return theHeaderFormat->hmt_ALCTMatchTime(); }
84  uint16_t alctHMT() const { return theHeaderFormat->alctHMT(); }
85  uint16_t clctHMT() const { return theHeaderFormat->clctHMT(); }
86  uint16_t gem_enabled_fibers() const { return theHeaderFormat->gem_enabled_fibers(); }
87  uint16_t gem_fifo_tbins() const { return theHeaderFormat->gem_fifo_tbins(); }
88  uint16_t gem_fifo_pretrig() const { return theHeaderFormat->gem_fifo_pretrig(); }
89  uint16_t gem_zero_suppress() const { return theHeaderFormat->gem_zero_suppress(); }
90  uint16_t gem_sync_dataword() const { return theHeaderFormat->gem_sync_dataword(); }
91  uint16_t gem_timing_dataword() const { return theHeaderFormat->gem_timing_dataword(); }
92  uint16_t run3_CLCT_patternID() const { return theHeaderFormat->run3_CLCT_patternID(); }
94  CSCShowerDigi showerDigi(uint32_t idlayer) const { return theHeaderFormat->showerDigi(idlayer); }
96  CSCShowerDigi anodeShowerDigi(uint32_t idlayer) const { return theHeaderFormat->anodeShowerDigi(idlayer); }
98  CSCShowerDigi cathodeShowerDigi(uint32_t idlayer) const { return theHeaderFormat->cathodeShowerDigi(idlayer); }
99 
101  std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer) { return theHeaderFormat->CLCTDigis(idlayer); }
102 
104  std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const {
105  return theHeaderFormat->CorrelatedLCTDigis(idlayer);
106  }
107 
110  unsigned short int sizeInWords() const { return theHeaderFormat->sizeInWords(); }
111 
112  unsigned short int NHeaderFrames() const { return theHeaderFormat->NHeaderFrames(); }
113 
114  unsigned short* data() { return theHeaderFormat->data(); }
115 
117  static void setDebug(const bool value) { debug = value; }
118 
119  bool check() const { return theHeaderFormat->check(); }
120 
122  void addCLCT0(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT0(digi); }
123  void addCLCT1(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT1(digi); }
124  void addALCT0(const CSCALCTDigi& digi) { theHeaderFormat->addALCT0(digi); }
125  void addALCT1(const CSCALCTDigi& digi) { theHeaderFormat->addALCT1(digi); }
126  void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT0(digi); }
127  void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT1(digi); }
128  // Add Run3 lct Shower digi for HMT
129  void addShower(const CSCShowerDigi& digi) { theHeaderFormat->addShower(digi); }
130  // Add Run3 anode Shower digi for HMT
131  void addAnodeShower(const CSCShowerDigi& digi) { theHeaderFormat->addAnodeShower(digi); }
132  // Add Run3 cathode Shower digi for HMT
133  void addCathodeShower(const CSCShowerDigi& digi) { theHeaderFormat->addCathodeShower(digi); }
134 
136  void add(const std::vector<CSCCLCTDigi>& digis);
137  void add(const std::vector<CSCCorrelatedLCTDigi>& digis);
138  void add(const std::vector<CSCShowerDigi>& digis);
139 
141  static void selfTest(int firmwwareVersion, int firmwareRevision);
142 
143  friend std::ostream& operator<<(std::ostream& os, const CSCTMBHeader& hdr);
144 
145 private:
146  //void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
147 
148 #ifdef LOCAL_UNPACK
149  static bool debug;
150 #else
151  static std::atomic<bool> debug;
152 #endif
153 
154  std::shared_ptr<CSCVTMBHeaderFormat> theHeaderFormat;
156 };
157 
158 #endif
CSCTMBHeader2007_rev0x50c3 tmbHeader2007_rev0x50c3() const
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:38
uint16_t CLCTOnly() const
Definition: CSCTMBHeader.h:46
CSCTMBHeader2020_TMB tmbHeader2020_TMB() const
uint16_t syncErrorCLCT() const
Definition: CSCTMBHeader.h:71
int theFirmwareVersion
Definition: CSCTMBHeader.h:155
uint16_t clct1_ComparatorCode() const
Definition: CSCTMBHeader.h:79
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:154
CSCTMBHeader2020_Run2 tmbHeader2020_Run2() const
uint16_t sizeInBytes() const
Definition: CSCTMBHeader.h:55
uint16_t clct1_xky() const
Definition: CSCTMBHeader.h:81
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:126
uint16_t alctHMT() const
Definition: CSCTMBHeader.h:84
int FirmwareRevision() const
Definition: CSCTMBHeader.h:41
uint16_t NTBins() const
Definition: CSCTMBHeader.h:67
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:50
uint16_t gem_timing_dataword() const
Definition: CSCTMBHeader.h:91
void add(const std::vector< CSCCLCTDigi > &digis)
these methods need more brains to figure which one goes first
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:127
CSCShowerDigi cathodeShowerDigi(uint32_t idlayer) const
returns Run3 cathode Shower Digi for HMT
Definition: CSCTMBHeader.h:98
uint16_t L1ANumber() const
Definition: CSCTMBHeader.h:53
uint16_t ALCTOnly() const
Definition: CSCTMBHeader.h:47
void addCLCT1(const CSCCLCTDigi &digi)
Definition: CSCTMBHeader.h:123
void setNCFEBs(uint16_t ncfebs)
Definition: CSCTMBHeader.h:75
uint16_t clct0_ComparatorCode() const
== Run 3 CSC-GEM Trigger Format
Definition: CSCTMBHeader.h:78
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:44
static void setDebug(const bool value)
Definition: CSCTMBHeader.h:117
uint16_t hmt_ALCTMatchTime() const
Definition: CSCTMBHeader.h:83
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:43
bool check() const
Definition: CSCTMBHeader.h:119
unsigned short int sizeInWords() const
Definition: CSCTMBHeader.h:110
void addCathodeShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:133
unsigned short * data()
Definition: CSCTMBHeader.h:114
static std::atomic< bool > debug
Definition: CSCTMBHeader.h:151
friend std::ostream & operator<<(std::ostream &os, const CSCTMBHeader &hdr)
unsigned short int NHeaderFrames() const
Definition: CSCTMBHeader.h:112
uint16_t syncErrorMPC1() const
Definition: CSCTMBHeader.h:73
void addShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:129
Definition: value.py:1
uint16_t syncErrorMPC0() const
Definition: CSCTMBHeader.h:72
void addAnodeShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:131
int FirmwareVersion() const
Definition: CSCTMBHeader.h:40
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:101
uint16_t syncError() const
Definition: CSCTMBHeader.h:70
uint16_t NCFEBs() const
Definition: CSCTMBHeader.h:68
void addCLCT0(const CSCCLCTDigi &digi)
for data packing
Definition: CSCTMBHeader.h:122
uint16_t TMBMatch() const
Definition: CSCTMBHeader.h:48
CSCShowerDigi anodeShowerDigi(uint32_t idlayer) const
returns Run3 anode Shower Digi for HMT
Definition: CSCTMBHeader.h:96
static void selfTest(int firmwwareVersion, int firmwareRevision)
tests that packing and unpacking give same results
CSCTMBHeader2006 tmbHeader2006() const
CSCTMBHeader2020_GEM tmbHeader2020_GEM() const
uint16_t run3_CLCT_patternID() const
Definition: CSCTMBHeader.h:92
uint16_t Bxn1Diff() const
Definition: CSCTMBHeader.h:51
void addALCT1(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:125
uint16_t gem_fifo_pretrig() const
Definition: CSCTMBHeader.h:88
CSCTMBHeader(int firmwareVersion, int firmwareRevision)
Definition: CSCTMBHeader.cc:24
CSCTMBHeader2007 tmbHeader2007() const
will throw if the cast fails
void setALCTMatchTime(uint16_t alctmatchtime)
Definition: CSCTMBHeader.h:45
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis
Definition: CSCTMBHeader.h:104
CSCTMBHeader2020_CCLUT tmbHeader2020_CCLUT() const
uint16_t gem_enabled_fibers() const
Definition: CSCTMBHeader.h:86
uint16_t gem_fifo_tbins() const
Definition: CSCTMBHeader.h:87
uint16_t clct0_xky() const
Definition: CSCTMBHeader.h:80
uint16_t hmt_nhits() const
Definition: CSCTMBHeader.h:82
uint16_t clctHMT() const
Definition: CSCTMBHeader.h:85
uint16_t gem_zero_suppress() const
Definition: CSCTMBHeader.h:89
CSCTMBHeader2013 tmbHeader2013() const
void addALCT0(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:124
CSCShowerDigi showerDigi(uint32_t idlayer) const
returns Run3 lct Shower Digi for HMT
Definition: CSCTMBHeader.h:94
uint16_t gem_sync_dataword() const
Definition: CSCTMBHeader.h:90