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 alctHMT() const { return theHeaderFormat->alctHMT(); }
84  uint16_t clctHMT() const { return theHeaderFormat->clctHMT(); }
85  uint16_t gem_enabled_fibers() const { return theHeaderFormat->gem_enabled_fibers(); }
86  uint16_t gem_fifo_tbins() const { return theHeaderFormat->gem_fifo_tbins(); }
87  uint16_t gem_fifo_pretrig() const { return theHeaderFormat->gem_fifo_pretrig(); }
88  uint16_t gem_zero_suppress() const { return theHeaderFormat->gem_zero_suppress(); }
89  uint16_t gem_sync_dataword() const { return theHeaderFormat->gem_sync_dataword(); }
90  uint16_t gem_timing_dataword() const { return theHeaderFormat->gem_timing_dataword(); }
91  uint16_t run3_CLCT_patternID() const { return theHeaderFormat->run3_CLCT_patternID(); }
93  CSCShowerDigi showerDigi(uint32_t idlayer) const { return theHeaderFormat->showerDigi(idlayer); }
95  CSCShowerDigi anodeShowerDigi(uint32_t idlayer) const { return theHeaderFormat->anodeShowerDigi(idlayer); }
97  CSCShowerDigi cathodeShowerDigi(uint32_t idlayer) const { return theHeaderFormat->cathodeShowerDigi(idlayer); }
98 
100  std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer) { return theHeaderFormat->CLCTDigis(idlayer); }
101 
103  std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const {
104  return theHeaderFormat->CorrelatedLCTDigis(idlayer);
105  }
106 
109  unsigned short int sizeInWords() const { return theHeaderFormat->sizeInWords(); }
110 
111  unsigned short int NHeaderFrames() const { return theHeaderFormat->NHeaderFrames(); }
112 
113  unsigned short* data() { return theHeaderFormat->data(); }
114 
116  static void setDebug(const bool value) { debug = value; }
117 
118  bool check() const { return theHeaderFormat->check(); }
119 
121  void addCLCT0(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT0(digi); }
122  void addCLCT1(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT1(digi); }
123  void addALCT0(const CSCALCTDigi& digi) { theHeaderFormat->addALCT0(digi); }
124  void addALCT1(const CSCALCTDigi& digi) { theHeaderFormat->addALCT1(digi); }
125  void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT0(digi); }
126  void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT1(digi); }
127  // Add Run3 lct Shower digi for HMT
128  void addShower(const CSCShowerDigi& digi) { theHeaderFormat->addShower(digi); }
129  // Add Run3 anode Shower digi for HMT
130  void addAnodeShower(const CSCShowerDigi& digi) { theHeaderFormat->addAnodeShower(digi); }
131  // Add Run3 cathode Shower digi for HMT
132  void addCathodeShower(const CSCShowerDigi& digi) { theHeaderFormat->addCathodeShower(digi); }
133 
135  void add(const std::vector<CSCCLCTDigi>& digis);
136  void add(const std::vector<CSCCorrelatedLCTDigi>& digis);
137  void add(const std::vector<CSCShowerDigi>& digis);
138 
140  static void selfTest(int firmwwareVersion, int firmwareRevision);
141 
142  friend std::ostream& operator<<(std::ostream& os, const CSCTMBHeader& hdr);
143 
144 private:
145  //void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
146 
147 #ifdef LOCAL_UNPACK
148  static bool debug;
149 #else
150  static std::atomic<bool> debug;
151 #endif
152 
153  std::shared_ptr<CSCVTMBHeaderFormat> theHeaderFormat;
155 };
156 
157 #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:90
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:85
int FirmwareRevision() const
Definition: CSCTMBHeader.h:41
uint16_t clct1_xky() const
Definition: CSCTMBHeader.h:80
unsigned short int NHeaderFrames() const
Definition: CSCTMBHeader.h:111
uint16_t run3_CLCT_patternID() const
Definition: CSCTMBHeader.h:91
int theFirmwareVersion
Definition: CSCTMBHeader.h:154
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:103
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:153
uint16_t Bxn1Diff() const
Definition: CSCTMBHeader.h:50
uint16_t gem_fifo_tbins() const
Definition: CSCTMBHeader.h:86
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:125
uint16_t clct1_ComparatorCode() const
Definition: CSCTMBHeader.h:78
uint16_t alctHMT() const
Definition: CSCTMBHeader.h:83
void add(const std::vector< CSCCLCTDigi > &digis)
these methods need more brains to figure which one goes first
uint16_t clctHMT() const
Definition: CSCTMBHeader.h:84
CSCTMBHeader2020_CCLUT tmbHeader2020_CCLUT() const
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:126
CSCShowerDigi showerDigi(uint32_t idlayer) const
returns Run3 lct Shower Digi for HMT
Definition: CSCTMBHeader.h:93
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:88
void addCLCT1(const CSCCLCTDigi &digi)
Definition: CSCTMBHeader.h:122
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:116
uint16_t syncError() const
Definition: CSCTMBHeader.h:69
CSCTMBHeader2020_TMB tmbHeader2020_TMB() const
CSCShowerDigi cathodeShowerDigi(uint32_t idlayer) const
returns Run3 cathode Shower Digi for HMT
Definition: CSCTMBHeader.h:97
void addCathodeShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:132
unsigned short * data()
Definition: CSCTMBHeader.h:113
uint16_t ALCTOnly() const
Definition: CSCTMBHeader.h:46
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:49
static std::atomic< bool > debug
Definition: CSCTMBHeader.h:150
friend std::ostream & operator<<(std::ostream &os, const CSCTMBHeader &hdr)
void addShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:128
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:44
void addAnodeShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:130
unsigned short int sizeInWords() const
Definition: CSCTMBHeader.h:109
uint16_t sizeInBytes() const
Definition: CSCTMBHeader.h:54
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:100
CSCTMBHeader2006 tmbHeader2006() const
CSCTMBHeader2007_rev0x50c3 tmbHeader2007_rev0x50c3() const
void addCLCT0(const CSCCLCTDigi &digi)
for data packing
Definition: CSCTMBHeader.h:121
bool check() const
Definition: CSCTMBHeader.h:118
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:89
void addALCT1(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:124
CSCTMBHeader(int firmwareVersion, int firmwareRevision)
Definition: CSCTMBHeader.cc:24
uint16_t clct0_xky() const
Definition: CSCTMBHeader.h:79
CSCShowerDigi anodeShowerDigi(uint32_t idlayer) const
returns Run3 anode Shower Digi for HMT
Definition: CSCTMBHeader.h:95
uint16_t gem_fifo_pretrig() const
Definition: CSCTMBHeader.h:87
CSCTMBHeader2013 tmbHeader2013() const
void addALCT0(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:123