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 
57  uint16_t L1AMatchTime() const { return theHeaderFormat->L1AMatchTime(); }
67 
68  uint16_t NTBins() const { return theHeaderFormat->NTBins(); }
69  uint16_t NCFEBs() const { return theHeaderFormat->NCFEBs(); }
70 
71  uint16_t syncError() const { return theHeaderFormat->syncError(); }
72  uint16_t syncErrorCLCT() const { return theHeaderFormat->syncErrorCLCT(); }
73  uint16_t syncErrorMPC0() const { return theHeaderFormat->syncErrorMPC0(); }
74  uint16_t syncErrorMPC1() const { return theHeaderFormat->syncErrorMPC1(); }
75 
76  void setNCFEBs(uint16_t ncfebs) { theHeaderFormat->setNCFEBs(ncfebs); }
77 
79  uint16_t clct0_ComparatorCode() const { return theHeaderFormat->clct0_ComparatorCode(); }
80  uint16_t clct1_ComparatorCode() const { return theHeaderFormat->clct1_ComparatorCode(); }
81  uint16_t clct0_xky() const { return theHeaderFormat->clct0_xky(); }
82  uint16_t clct1_xky() const { return theHeaderFormat->clct1_xky(); }
83  uint16_t hmt_nhits() const { return theHeaderFormat->hmt_nhits(); }
84  uint16_t hmt_ALCTMatchTime() const { return theHeaderFormat->hmt_ALCTMatchTime(); }
85  uint16_t alctHMT() const { return theHeaderFormat->alctHMT(); }
86  uint16_t clctHMT() const { return theHeaderFormat->clctHMT(); }
87  uint16_t gem_enabled_fibers() const { return theHeaderFormat->gem_enabled_fibers(); }
88  uint16_t gem_fifo_tbins() const { return theHeaderFormat->gem_fifo_tbins(); }
89  uint16_t gem_fifo_pretrig() const { return theHeaderFormat->gem_fifo_pretrig(); }
90  uint16_t gem_zero_suppress() const { return theHeaderFormat->gem_zero_suppress(); }
91  uint16_t gem_sync_dataword() const { return theHeaderFormat->gem_sync_dataword(); }
92  uint16_t gem_timing_dataword() const { return theHeaderFormat->gem_timing_dataword(); }
93  uint16_t run3_CLCT_patternID() const { return theHeaderFormat->run3_CLCT_patternID(); }
95  CSCShowerDigi showerDigi(uint32_t idlayer) const { return theHeaderFormat->showerDigi(idlayer); }
97  CSCShowerDigi anodeShowerDigi(uint32_t idlayer) const { return theHeaderFormat->anodeShowerDigi(idlayer); }
99  CSCShowerDigi cathodeShowerDigi(uint32_t idlayer) const { return theHeaderFormat->cathodeShowerDigi(idlayer); }
100 
102  std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer) { return theHeaderFormat->CLCTDigis(idlayer); }
103 
105  std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const {
106  return theHeaderFormat->CorrelatedLCTDigis(idlayer);
107  }
108 
111  unsigned short int sizeInWords() const { return theHeaderFormat->sizeInWords(); }
112 
113  unsigned short int NHeaderFrames() const { return theHeaderFormat->NHeaderFrames(); }
114 
115  unsigned short* data() { return theHeaderFormat->data(); }
116 
118  static void setDebug(const bool value) { debug = value; }
119 
120  bool check() const { return theHeaderFormat->check(); }
121 
123  void addCLCT0(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT0(digi); }
124  void addCLCT1(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT1(digi); }
125  void addALCT0(const CSCALCTDigi& digi) { theHeaderFormat->addALCT0(digi); }
126  void addALCT1(const CSCALCTDigi& digi) { theHeaderFormat->addALCT1(digi); }
127  void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT0(digi); }
128  void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT1(digi); }
129  // Add Run3 lct Shower digi for HMT
130  void addShower(const CSCShowerDigi& digi) { theHeaderFormat->addShower(digi); }
131  // Add Run3 anode Shower digi for HMT
132  void addAnodeShower(const CSCShowerDigi& digi) { theHeaderFormat->addAnodeShower(digi); }
133  // Add Run3 cathode Shower digi for HMT
134  void addCathodeShower(const CSCShowerDigi& digi) { theHeaderFormat->addCathodeShower(digi); }
135 
137  void add(const std::vector<CSCCLCTDigi>& digis);
138  void add(const std::vector<CSCCorrelatedLCTDigi>& digis);
139  void add(const std::vector<CSCShowerDigi>& digis);
140 
142  static void selfTest(int firmwwareVersion, int firmwareRevision);
143 
144  friend std::ostream& operator<<(std::ostream& os, const CSCTMBHeader& hdr);
145 
146 private:
147  //void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
148 
149 #ifdef LOCAL_UNPACK
150  static bool debug;
151 #else
152  static std::atomic<bool> debug;
153 #endif
154 
155  std::shared_ptr<CSCVTMBHeaderFormat> theHeaderFormat;
157 };
158 
159 #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:72
int theFirmwareVersion
Definition: CSCTMBHeader.h:156
uint16_t clct1_ComparatorCode() const
Definition: CSCTMBHeader.h:80
uint16_t L1AMatchTime() const
Definition: CSCTMBHeader.h:57
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:155
CSCTMBHeader2020_Run2 tmbHeader2020_Run2() const
uint16_t sizeInBytes() const
Definition: CSCTMBHeader.h:55
uint16_t clct1_xky() const
Definition: CSCTMBHeader.h:82
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:127
uint16_t alctHMT() const
Definition: CSCTMBHeader.h:85
int FirmwareRevision() const
Definition: CSCTMBHeader.h:41
uint16_t NTBins() const
Definition: CSCTMBHeader.h:68
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:50
uint16_t gem_timing_dataword() const
Definition: CSCTMBHeader.h:92
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:128
CSCShowerDigi cathodeShowerDigi(uint32_t idlayer) const
returns Run3 cathode Shower Digi for HMT
Definition: CSCTMBHeader.h:99
uint16_t L1ANumber() const
Definition: CSCTMBHeader.h:53
uint16_t ALCTOnly() const
Definition: CSCTMBHeader.h:47
void addCLCT1(const CSCCLCTDigi &digi)
Definition: CSCTMBHeader.h:124
void setNCFEBs(uint16_t ncfebs)
Definition: CSCTMBHeader.h:76
uint16_t clct0_ComparatorCode() const
== Run 3 CSC-GEM Trigger Format
Definition: CSCTMBHeader.h:79
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:44
static void setDebug(const bool value)
Definition: CSCTMBHeader.h:118
uint16_t hmt_ALCTMatchTime() const
Definition: CSCTMBHeader.h:84
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:43
bool check() const
Definition: CSCTMBHeader.h:120
unsigned short int sizeInWords() const
Definition: CSCTMBHeader.h:111
void addCathodeShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:134
unsigned short * data()
Definition: CSCTMBHeader.h:115
static std::atomic< bool > debug
Definition: CSCTMBHeader.h:152
friend std::ostream & operator<<(std::ostream &os, const CSCTMBHeader &hdr)
unsigned short int NHeaderFrames() const
Definition: CSCTMBHeader.h:113
uint16_t syncErrorMPC1() const
Definition: CSCTMBHeader.h:74
void addShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:130
Definition: value.py:1
uint16_t syncErrorMPC0() const
Definition: CSCTMBHeader.h:73
void addAnodeShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:132
int FirmwareVersion() const
Definition: CSCTMBHeader.h:40
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:102
uint16_t syncError() const
Definition: CSCTMBHeader.h:71
uint16_t NCFEBs() const
Definition: CSCTMBHeader.h:69
void addCLCT0(const CSCCLCTDigi &digi)
for data packing
Definition: CSCTMBHeader.h:123
uint16_t TMBMatch() const
Definition: CSCTMBHeader.h:48
CSCShowerDigi anodeShowerDigi(uint32_t idlayer) const
returns Run3 anode Shower Digi for HMT
Definition: CSCTMBHeader.h:97
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:93
uint16_t Bxn1Diff() const
Definition: CSCTMBHeader.h:51
void addALCT1(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:126
uint16_t gem_fifo_pretrig() const
Definition: CSCTMBHeader.h:89
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:105
CSCTMBHeader2020_CCLUT tmbHeader2020_CCLUT() const
uint16_t gem_enabled_fibers() const
Definition: CSCTMBHeader.h:87
uint16_t gem_fifo_tbins() const
Definition: CSCTMBHeader.h:88
uint16_t clct0_xky() const
Definition: CSCTMBHeader.h:81
uint16_t hmt_nhits() const
Definition: CSCTMBHeader.h:83
uint16_t clctHMT() const
Definition: CSCTMBHeader.h:86
uint16_t gem_zero_suppress() const
Definition: CSCTMBHeader.h:90
CSCTMBHeader2013 tmbHeader2013() const
void addALCT0(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:125
CSCShowerDigi showerDigi(uint32_t idlayer) const
returns Run3 lct Shower Digi for HMT
Definition: CSCTMBHeader.h:95
uint16_t gem_sync_dataword() const
Definition: CSCTMBHeader.h:91