CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | Friends
CSCTMBHeader Class Reference

#include <CSCTMBHeader.h>

Public Member Functions

void add (const std::vector< CSCCLCTDigi > &digis)
 these methods need more brains to figure which one goes first More...
 
void add (const std::vector< CSCCorrelatedLCTDigi > &digis)
 
void add (const std::vector< CSCShowerDigi > &digis)
 
void addALCT0 (const CSCALCTDigi &digi)
 
void addALCT1 (const CSCALCTDigi &digi)
 
void addCLCT0 (const CSCCLCTDigi &digi)
 for data packing More...
 
void addCLCT1 (const CSCCLCTDigi &digi)
 
void addCorrelatedLCT0 (const CSCCorrelatedLCTDigi &digi)
 
void addCorrelatedLCT1 (const CSCCorrelatedLCTDigi &digi)
 
void addShower (const CSCShowerDigi &digi)
 
uint16_t ALCTMatchTime () const
 
uint16_t ALCTOnly () const
 
uint16_t Bxn0Diff () const
 
uint16_t Bxn1Diff () const
 
uint16_t BXNCount () const
 
bool check () const
 
uint16_t clct0_ComparatorCode () const
 == Run 3 CSC-GEM Trigger Format More...
 
uint16_t clct0_xky () const
 
uint16_t clct1_ComparatorCode () const
 
uint16_t clct1_xky () const
 
std::vector< CSCCLCTDigiCLCTDigis (uint32_t idlayer)
 returns CLCT digis More...
 
uint16_t CLCTOnly () const
 
std::vector< CSCCorrelatedLCTDigiCorrelatedLCTDigis (uint32_t idlayer) const
 returns CorrelatedLCT digis More...
 
 CSCTMBHeader (int firmwareVersion, int firmwareRevision)
 
 CSCTMBHeader (const CSCTMBStatusDigi &digi)
 
 CSCTMBHeader (const unsigned short *buf)
 
unsigned short * data ()
 
int FirmwareRevision () const
 
int FirmwareVersion () const
 
uint16_t gem_enabled_fibers () const
 
uint16_t gem_fifo_pretrig () const
 
uint16_t gem_fifo_tbins () const
 
uint16_t gem_sync_dataword () const
 
uint16_t gem_timing_dataword () const
 
uint16_t gem_zero_suppress () const
 
uint16_t hmt_ALCTMatchTime () const
 
uint16_t hmt_nhits () const
 
uint16_t L1ANumber () const
 
uint16_t NCFEBs () const
 
unsigned short int NHeaderFrames () const
 
uint16_t NTBins () const
 
uint16_t run3_CLCT_patternID () const
 
void setEventInformation (const CSCDMBHeader &dmbHeader)
 fills fields like bxn and l1a More...
 
void setNCFEBs (uint16_t ncfebs)
 
CSCShowerDigi showerDigi (uint32_t idlayer) const
 returns Run3 Shower Digi for HMT More...
 
uint16_t sizeInBytes () const
 
unsigned short int sizeInWords () const
 
uint16_t syncError () const
 
uint16_t syncErrorCLCT () const
 
uint16_t syncErrorMPC0 () const
 
uint16_t syncErrorMPC1 () const
 
CSCTMBHeader2006 tmbHeader2006 () const
 
CSCTMBHeader2007 tmbHeader2007 () const
 will throw if the cast fails More...
 
CSCTMBHeader2007_rev0x50c3 tmbHeader2007_rev0x50c3 () const
 
CSCTMBHeader2013 tmbHeader2013 () const
 
CSCTMBHeader2020_CCLUT tmbHeader2020_CCLUT () const
 
CSCTMBHeader2020_GEM tmbHeader2020_GEM () const
 
CSCTMBHeader2020_Run2 tmbHeader2020_Run2 () const
 
CSCTMBHeader2020_TMB tmbHeader2020_TMB () const
 
uint16_t TMBMatch () const
 

Static Public Member Functions

static void selfTest (int firmwwareVersion, int firmwareRevision)
 tests that packing and unpacking give same results More...
 
static void setDebug (const bool value)
 

Private Attributes

int theFirmwareVersion
 
std::shared_ptr
< CSCVTMBHeaderFormat
theHeaderFormat
 

Static Private Attributes

static std::atomic< bool > debug {false}
 

Friends

std::ostream & operator<< (std::ostream &os, const CSCTMBHeader &hdr)
 

Detailed Description

Definition at line 31 of file CSCTMBHeader.h.

Constructor & Destructor Documentation

CSCTMBHeader::CSCTMBHeader ( int  firmwareVersion,
int  firmwareRevision 
)

Definition at line 24 of file CSCTMBHeader.cc.

References theHeaderFormat.

25  : theHeaderFormat(), theFirmwareVersion(firmwareVersion) {
26  if (firmwareVersion == 2020) {
27  if ((firmwareRevision < 0x4000) && (firmwareRevision > 0x0)) { /* New (O)TMB firmware revision format */
28  bool isGEM_fw = false;
29  bool isCCLUT_HMT_fw = false;
30  bool isOTMB_Run2_fw = false;
31  bool isTMB_Run3_fw = false;
32  bool isTMB_Run2_fw = false;
33  bool isRun2_df = false;
34  unsigned df_version = (firmwareRevision >> 9) & 0xF; // 4-bits Data Format version
35  unsigned major_ver = (firmwareRevision >> 5) & 0xF; // 4-bits major version part
36  // unsigned minor_ver = firmwareRevision & 0x1F; // 5-bits minor version part
37  switch (df_version) {
38  case 0x3:
39  isGEM_fw = true;
40  break;
41  case 0x2:
42  isCCLUT_HMT_fw = true;
43  break;
44  case 0x1:
45  isOTMB_Run2_fw = true;
46  break;
47  case 0x0:
48  if (major_ver == 1)
49  isTMB_Run2_fw = true;
50  else
51  isTMB_Run3_fw = true;
52  break;
53  default:
54  isGEM_fw = true;
55  }
56  if (major_ver == 1) {
57  isRun2_df = true;
58  }
59 
60  if (isGEM_fw) {
61  if (isRun2_df) {
62  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_Run2(firmwareRevision));
63  } else {
64  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_GEM());
65  }
66  } else if (isCCLUT_HMT_fw) {
67  if (isRun2_df) {
68  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_Run2(firmwareRevision));
69  } else {
70  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_CCLUT());
71  }
72  } else if (isOTMB_Run2_fw || isTMB_Run2_fw || isRun2_df) {
73  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_Run2(firmwareRevision));
74  } else if (isTMB_Run3_fw) {
75  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_TMB());
76  }
77  }
78  } else if (firmwareVersion == 2013) {
79  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2013());
80  } else if (firmwareVersion == 2006) {
81  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2006());
82  } else if (firmwareVersion == 2007) {
83  /* Checks for TMB2007 firmware revisions ranges to detect data format
84  * rev.0x50c3 - first revision with changed format
85  * rev.0x42D5 - oldest known from 06/21/2007
86  * There is 4-bits year value rollover in revision number (0 in 2016)
87  */
88  if ((firmwareRevision >= 0x50c3) || (firmwareRevision < 0x42D5)) {
89  // if (firmwareRevision >= 0x7a76) // First OTMB firmware revision with 2013 format
90  /* Revisions > 0x6000 - OTMB firmwares, < 0x42D5 - new TMB revisions in 2016 */
91  if ((firmwareRevision >= 0x6000) || (firmwareRevision < 0x42D5)) {
92  bool isGEMfirmware = false;
93  /* There are OTMB2013 firmware versions exist, which reports firmwareRevision code = 0x0 */
94  if ((firmwareRevision < 0x4000) && (firmwareRevision > 0x0)) { /* New (O)TMB firmware revision format */
95  if (((firmwareRevision >> 9) & 0x3) == 0x3)
96  isGEMfirmware = true;
97  if (isGEMfirmware) {
98  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_GEM());
99  } else {
100  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2013());
101  }
102  }
103  } else {
104  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2007_rev0x50c3());
105  }
106  } else {
107  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2007());
108  }
109  } else {
110  edm::LogError("CSCTMBHeader|CSCRawToDigi") << "failed to determine TMB firmware version!!";
111  }
112 }
int theFirmwareVersion
Definition: CSCTMBHeader.h:144
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
Log< level::Error, false > LogError
CSCTMBHeader::CSCTMBHeader ( const CSCTMBStatusDigi digi)
CSCTMBHeader::CSCTMBHeader ( const unsigned short *  buf)

first determine the format

Definition at line 118 of file CSCTMBHeader.cc.

References theFirmwareVersion, and theHeaderFormat.

118  : theHeaderFormat() {
120  if (buf[0] == 0xDB0C) {
121  theFirmwareVersion = 2007;
122  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2007(buf));
123  /* Checks for TMB2007 firmware revisions ranges to detect data format
124  * rev.0x50c3 - first revision with changed format
125  * rev.0x42D5 - oldest known from 06/21/2007
126  * There is 4-bits year value rollover in revision number (0 in 2016)
127  */
128  if ((theHeaderFormat->firmwareRevision() >= 0x50c3) || (theHeaderFormat->firmwareRevision() < 0x42D5)) {
129  // if (theHeaderFormat->firmwareRevision() >= 0x7a76) // First OTMB firmware revision with 2013 format
130  /* Revisions > 0x6000 - OTMB firmwares, < 0x42D5 - new TMB revisions in 2016 */
131  if ((theHeaderFormat->firmwareRevision() >= 0x6000) || (theHeaderFormat->firmwareRevision() < 0x42D5)) {
132  theFirmwareVersion = 2013;
133  bool isGEM_fw = false;
134  bool isCCLUT_HMT_fw = false;
135  bool isOTMB_Run2_fw = false;
136  bool isTMB_Run3_fw = false;
137  bool isTMB_Run2_fw = false;
138  bool isRun2_df = false;
139  unsigned firmwareRevision = theHeaderFormat->firmwareRevision();
140  /* There are OTMB2013 firmware versions exist, which reports firmwareRevision code = 0x0 */
141  if ((firmwareRevision < 0x4000) && (firmwareRevision > 0x0)) { /* New (O)TMB firmware revision format */
142  theFirmwareVersion = 2020;
143  unsigned df_version = (firmwareRevision >> 9) & 0xF; // 4-bits Data Format version
144  unsigned major_ver = (firmwareRevision >> 5) & 0xF; // 4-bits major version part
145  // unsigned minor_ver = firmwareRevision & 0x1F; // 5-bits minor version part
146  switch (df_version) {
147  case 0x3:
148  isGEM_fw = true;
149  break;
150  case 0x2:
151  isCCLUT_HMT_fw = true;
152  break;
153  case 0x1:
154  isOTMB_Run2_fw = true;
155  break;
156  case 0x0:
157  if (major_ver == 1)
158  isTMB_Run2_fw = true;
159  else
160  isTMB_Run3_fw = true;
161  break;
162  default:
163  isGEM_fw = true;
164  }
165  if (major_ver == 1) {
166  isRun2_df = true;
167  }
168  }
169  if (theFirmwareVersion == 2020) {
170  if (isGEM_fw) {
171  if (isRun2_df) {
172  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_Run2(buf));
173  } else {
174  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_GEM(buf));
175  }
176  } else if (isCCLUT_HMT_fw) {
177  if (isRun2_df) {
178  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_Run2(buf));
179  } else {
180  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_CCLUT(buf));
181  }
182  } else if (isOTMB_Run2_fw || isTMB_Run2_fw || isRun2_df) {
183  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_Run2(buf));
184  } else if (isTMB_Run3_fw) {
185  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2020_TMB(buf));
186  }
187 
188  } else {
189  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2013(buf));
190  }
191 
192  } else {
193  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2007_rev0x50c3(buf));
194  }
195  }
196 
197  } else if (buf[0] == 0x6B0C) {
198  theFirmwareVersion = 2006;
199  theHeaderFormat = std::shared_ptr<CSCVTMBHeaderFormat>(new CSCTMBHeader2006(buf));
200  } else {
201  edm::LogError("CSCTMBHeader|CSCRawToDigi") << "failed to determine TMB firmware version!!";
202  }
203 }
int theFirmwareVersion
Definition: CSCTMBHeader.h:144
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
Log< level::Error, false > LogError

Member Function Documentation

void CSCTMBHeader::add ( const std::vector< CSCCLCTDigi > &  digis)

these methods need more brains to figure which one goes first

Definition at line 238 of file CSCTMBHeader.cc.

References addCLCT0(), and addCLCT1().

Referenced by CSCEventData::add(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

238  {
239  // sort???
240  if (!digis.empty()) {
241  addCLCT0(digis[0]);
242  }
243  if (digis.size() > 1)
244  addCLCT1(digis[1]);
245 }
void addCLCT1(const CSCCLCTDigi &digi)
Definition: CSCTMBHeader.h:116
void addCLCT0(const CSCCLCTDigi &digi)
for data packing
Definition: CSCTMBHeader.h:115
void CSCTMBHeader::add ( const std::vector< CSCCorrelatedLCTDigi > &  digis)

Definition at line 247 of file CSCTMBHeader.cc.

References addCorrelatedLCT0(), and addCorrelatedLCT1().

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

247  {
248  // sort???
249  if (!digis.empty())
250  addCorrelatedLCT0(digis[0]);
251  if (digis.size() > 1)
252  addCorrelatedLCT1(digis[1]);
253 }
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:119
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:120
void CSCTMBHeader::add ( const std::vector< CSCShowerDigi > &  digis)

Definition at line 255 of file CSCTMBHeader.cc.

References theHeaderFormat.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

255  {
256  if (!digis.empty())
257  theHeaderFormat->addShower(digis[0]);
258 }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
void CSCTMBHeader::addALCT0 ( const CSCALCTDigi digi)
inline

Definition at line 117 of file CSCTMBHeader.h.

References theHeaderFormat.

117 { theHeaderFormat->addALCT0(digi); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
void CSCTMBHeader::addALCT1 ( const CSCALCTDigi digi)
inline

Definition at line 118 of file CSCTMBHeader.h.

References theHeaderFormat.

118 { theHeaderFormat->addALCT1(digi); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
void CSCTMBHeader::addCLCT0 ( const CSCCLCTDigi digi)
inline

for data packing

Definition at line 115 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by add(), and selfTest().

115 { theHeaderFormat->addCLCT0(digi); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
void CSCTMBHeader::addCLCT1 ( const CSCCLCTDigi digi)
inline

Definition at line 116 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by add(), and selfTest().

116 { theHeaderFormat->addCLCT1(digi); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
void CSCTMBHeader::addCorrelatedLCT0 ( const CSCCorrelatedLCTDigi digi)
inline

Definition at line 119 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by add(), and selfTest().

119 { theHeaderFormat->addCorrelatedLCT0(digi); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
void CSCTMBHeader::addCorrelatedLCT1 ( const CSCCorrelatedLCTDigi digi)
inline

Definition at line 120 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by add(), and selfTest().

120 { theHeaderFormat->addCorrelatedLCT1(digi); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
void CSCTMBHeader::addShower ( const CSCShowerDigi digi)
inline

Definition at line 122 of file CSCTMBHeader.h.

References theHeaderFormat.

122 { theHeaderFormat->addShower(digi); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::ALCTMatchTime ( ) const
inline

Definition at line 44 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and cscdqm::EventProcessor::processCSC().

44 { return theHeaderFormat->ALCTMatchTime(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::ALCTOnly ( ) const
inline

Definition at line 46 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by cscdqm::EventProcessor::processCSC().

46 { return theHeaderFormat->ALCTOnly(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::Bxn0Diff ( ) const
inline

Definition at line 49 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by cscdqm::EventProcessor::processCSC().

49 { return theHeaderFormat->Bxn0Diff(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::Bxn1Diff ( ) const
inline

Definition at line 50 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by cscdqm::EventProcessor::processCSC().

50 { return theHeaderFormat->Bxn1Diff(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::BXNCount ( ) const
inline

Definition at line 43 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and cscdqm::EventProcessor::processCSC().

43 { return theHeaderFormat->BXNCount(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
bool CSCTMBHeader::check ( ) const
inline

Definition at line 112 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by CSCTMBData::UnpackTMB().

112 { return theHeaderFormat->check(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::clct0_ComparatorCode ( ) const
inline

== Run 3 CSC-GEM Trigger Format

Definition at line 77 of file CSCTMBHeader.h.

References theHeaderFormat.

77 { return theHeaderFormat->clct0_ComparatorCode(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::clct0_xky ( ) const
inline

Definition at line 79 of file CSCTMBHeader.h.

References theHeaderFormat.

79 { return theHeaderFormat->clct0_xky(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::clct1_ComparatorCode ( ) const
inline

Definition at line 78 of file CSCTMBHeader.h.

References theHeaderFormat.

78 { return theHeaderFormat->clct1_ComparatorCode(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::clct1_xky ( ) const
inline

Definition at line 80 of file CSCTMBHeader.h.

References theHeaderFormat.

80 { return theHeaderFormat->clct1_xky(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
std::vector<CSCCLCTDigi> CSCTMBHeader::CLCTDigis ( uint32_t  idlayer)
inline

returns CLCT digis

Definition at line 94 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by cscdqm::EventProcessor::processCSC(), selfTest(), and CSCEventData::selfTest().

94 { return theHeaderFormat->CLCTDigis(idlayer); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::CLCTOnly ( ) const
inline

Definition at line 45 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by cscdqm::EventProcessor::processCSC().

45 { return theHeaderFormat->CLCTOnly(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
std::vector<CSCCorrelatedLCTDigi> CSCTMBHeader::CorrelatedLCTDigis ( uint32_t  idlayer) const
inline

returns CorrelatedLCT digis

Definition at line 97 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by selfTest(), and CSCEventData::selfTest().

97  {
98  return theHeaderFormat->CorrelatedLCTDigis(idlayer);
99  }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
unsigned short* CSCTMBHeader::data ( )
inline

Definition at line 107 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by CSCTMBData::pack(), and selfTest().

107 { return theHeaderFormat->data(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
int CSCTMBHeader::FirmwareRevision ( ) const
inline

Definition at line 41 of file CSCTMBHeader.h.

References theHeaderFormat.

41 { return theHeaderFormat->firmwareRevision(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
int CSCTMBHeader::FirmwareVersion ( ) const
inline

Definition at line 40 of file CSCTMBHeader.h.

References theFirmwareVersion.

Referenced by CSCComparatorData::CSCComparatorData(), and CSCTMBData::UnpackTMB().

40 { return theFirmwareVersion; }
int theFirmwareVersion
Definition: CSCTMBHeader.h:144
uint16_t CSCTMBHeader::gem_enabled_fibers ( ) const
inline

Definition at line 83 of file CSCTMBHeader.h.

References theHeaderFormat.

83 { return theHeaderFormat->gem_enabled_fibers(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::gem_fifo_pretrig ( ) const
inline

Definition at line 85 of file CSCTMBHeader.h.

References theHeaderFormat.

85 { return theHeaderFormat->gem_fifo_pretrig(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::gem_fifo_tbins ( ) const
inline

Definition at line 84 of file CSCTMBHeader.h.

References theHeaderFormat.

84 { return theHeaderFormat->gem_fifo_tbins(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::gem_sync_dataword ( ) const
inline

Definition at line 87 of file CSCTMBHeader.h.

References theHeaderFormat.

87 { return theHeaderFormat->gem_sync_dataword(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::gem_timing_dataword ( ) const
inline

Definition at line 88 of file CSCTMBHeader.h.

References theHeaderFormat.

88 { return theHeaderFormat->gem_timing_dataword(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::gem_zero_suppress ( ) const
inline

Definition at line 86 of file CSCTMBHeader.h.

References theHeaderFormat.

86 { return theHeaderFormat->gem_zero_suppress(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::hmt_ALCTMatchTime ( ) const
inline

Definition at line 82 of file CSCTMBHeader.h.

References theHeaderFormat.

82 { return theHeaderFormat->hmt_ALCTMatchTime(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::hmt_nhits ( ) const
inline

Definition at line 81 of file CSCTMBHeader.h.

References theHeaderFormat.

81 { return theHeaderFormat->hmt_nhits(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::L1ANumber ( ) const
inline

Definition at line 52 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by cscdqm::EventProcessor::processCSC().

52 { return theHeaderFormat->L1ANumber(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::NCFEBs ( ) const
inline

Definition at line 67 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by cscdqm::EventProcessor::processCSC(), and CSCTMBData::UnpackTMB().

67 { return theHeaderFormat->NCFEBs(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
unsigned short int CSCTMBHeader::NHeaderFrames ( ) const
inline

Definition at line 105 of file CSCTMBHeader.h.

References theHeaderFormat.

105 { return theHeaderFormat->NHeaderFrames(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::NTBins ( ) const
inline

Definition at line 66 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by CSCTMBData::UnpackTMB().

66 { return theHeaderFormat->NTBins(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::run3_CLCT_patternID ( ) const
inline

Definition at line 89 of file CSCTMBHeader.h.

References theHeaderFormat.

89 { return theHeaderFormat->run3_CLCT_patternID(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
void CSCTMBHeader::selfTest ( int  firmwwareVersion,
int  firmwareRevision 
)
static

tests that packing and unpacking give same results

Definition at line 324 of file CSCTMBHeader.cc.

References addCLCT0(), addCLCT1(), addCorrelatedLCT0(), addCorrelatedLCT1(), cms::cuda::assert(), CLCTDigis(), CorrelatedLCTDigis(), gather_cfg::cout, cscPackerCompare(), data(), debug, DetId::rawId(), CSCCorrelatedLCTDigi::Run3, CSCCLCTDigi::Run3, and relativeConstraints::station.

324  {
325  constexpr bool debug = false;
326 
327  // tests packing and unpacking
328  for (int station = 1; station <= 4; ++station) {
329  for (int iendcap = 1; iendcap <= 2; ++iendcap) {
330  CSCDetId detId(iendcap, station, 1, 1, 0);
331 
332  // the next-to-last is the BX, which only gets
333  // saved in two bits and must be the same for clct0 and clct1.
334  //CSCCLCTDigi clct0(1, 1, 4, 0, 0, 30, 3, 0, 1); // valid for 2006
335  // In 2007 firmware, there are no distrips, so the 4th argument (strip
336  // type) should always be set to 1 (halfstrips).
337  CSCCLCTDigi clct0(1, 1, 4, 1, 0, 30, 4, 2, 1); // valid for 2007
338  CSCCLCTDigi clct1(1, 1, 3, 1, 1, 31, 1, 2, 2);
339 
340  // BX of LCT (8th argument) is 1-bit word (the least-significant bit
341  // of ALCT's bx).
342  CSCCorrelatedLCTDigi lct0(1, 1, 2, 10, 98, 5, 0, 1, 0, 0, 0, 0);
343  CSCCorrelatedLCTDigi lct1(2, 1, 2, 20, 15, 9, 1, 0, 0, 0, 0, 0);
344 
345  // Use Run3 format digis for TMB firmwareVersion 2020
346  // and revision codes for MEx1 CCLUT, ME11 CCLUT/GEM
347  if (firmwareVersion >= 2020) {
348  bool isGEM_fw = false;
349  bool isCCLUT_HMT_fw = false;
350  bool isOTMB_Run2_fw = false;
351  bool isTMB_Run3_fw = false;
352  bool isTMB_Run2_fw = false;
353  bool isRun2_df = false;
354  unsigned df_version = (firmwareRevision >> 9) & 0xF; // 4-bits Data Format version
355  unsigned major_ver = (firmwareRevision >> 5) & 0xF; // 4-bits major version part
356  // unsigned minor_ver = firmwareRevision & 0x1F; // 5-bits minor version part
357  switch (df_version) {
358  case 0x3:
359  isGEM_fw = true;
360  break;
361  case 0x2:
362  isCCLUT_HMT_fw = true;
363  break;
364  case 0x1:
365  isOTMB_Run2_fw = true;
366  break;
367  case 0x0:
368  if (major_ver == 1)
369  isTMB_Run2_fw = true;
370  else
371  isTMB_Run3_fw = true;
372  break;
373  default:
374  isGEM_fw = true;
375  }
376  if (major_ver == 1) {
377  isRun2_df = true;
378  }
379  if ((isGEM_fw || isCCLUT_HMT_fw) && !isRun2_df && !isOTMB_Run2_fw && !isTMB_Run2_fw) {
380  clct0 = CSCCLCTDigi(
381  1, 6, 6, 1, 0, (120 % 32), (120 / 32), 2, 1, 3, 0xebf, CSCCLCTDigi::Version::Run3, true, false, 2, 6);
382  clct1 = CSCCLCTDigi(
383  1, 6, 3, 1, 1, (132 % 32), (132 / 32), 2, 2, 3, 0xe54, CSCCLCTDigi::Version::Run3, false, true, 1, 15);
384  }
385  if ((isGEM_fw || isCCLUT_HMT_fw || isTMB_Run3_fw) && !isRun2_df && !isOTMB_Run2_fw && !isTMB_Run2_fw) {
386  lct0 = CSCCorrelatedLCTDigi(
387  1, 1, 3, 85, 120, 6, 0, 0, 0, 0, 0, 0, CSCCorrelatedLCTDigi::Version::Run3, true, false, 2, 6);
388  lct1 = CSCCorrelatedLCTDigi(
389  2, 1, 2, 81, 132, 3, 1, 0, 0, 0, 0, 0, CSCCorrelatedLCTDigi::Version::Run3, false, true, 0, 15);
390  }
391  }
392 
393  CSCTMBHeader tmbHeader(firmwareVersion, firmwareRevision);
394  tmbHeader.addCLCT0(clct0);
395  tmbHeader.addCLCT1(clct1);
396  tmbHeader.addCorrelatedLCT0(lct0);
397  tmbHeader.addCorrelatedLCT1(lct1);
398  std::vector<CSCCLCTDigi> clcts = tmbHeader.CLCTDigis(detId.rawId());
399  // guess they got reordered
400  assert(cscPackerCompare(clcts[0], clct0));
401  assert(cscPackerCompare(clcts[1], clct1));
402  if (debug) {
403  std::cout << "Match for: " << clct0 << "\n";
404  std::cout << " " << clct1 << "\n \n";
405  }
406 
407  std::vector<CSCCorrelatedLCTDigi> lcts = tmbHeader.CorrelatedLCTDigis(detId.rawId());
408  assert(cscPackerCompare(lcts[0], lct0));
409  assert(cscPackerCompare(lcts[1], lct1));
410  if (debug) {
411  std::cout << "Match for: " << lct0 << "\n";
412  std::cout << " " << lct1 << "\n";
413  }
414 
415  // try packing and re-packing, to make sure they're the same
416  unsigned short int *data = tmbHeader.data();
417  CSCTMBHeader newHeader(data);
418  clcts = newHeader.CLCTDigis(detId.rawId());
419  assert(cscPackerCompare(clcts[0], clct0));
420  assert(cscPackerCompare(clcts[1], clct1));
421  lcts = newHeader.CorrelatedLCTDigis(detId.rawId());
422  assert(cscPackerCompare(lcts[0], lct0));
423  assert(cscPackerCompare(lcts[1], lct1));
424  }
425  }
426 }
assert(be >=bs)
unsigned short * data()
Definition: CSCTMBHeader.h:107
static std::atomic< bool > debug
Definition: CSCTMBHeader.h:140
bool cscPackerCompare(const T &t1, const T &t2)
tuple cout
Definition: gather_cfg.py:144
static void CSCTMBHeader::setDebug ( const bool  value)
inlinestatic

turns on/off debug flag for this class

Definition at line 110 of file CSCTMBHeader.h.

References debug, and relativeConstraints::value.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

110 { debug = value; }
static std::atomic< bool > debug
Definition: CSCTMBHeader.h:140
void CSCTMBHeader::setEventInformation ( const CSCDMBHeader dmbHeader)
inline

fills fields like bxn and l1a

Definition at line 38 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by CSCEventData::checkTMBClasses(), and CSCEventData::setEventInformation().

38 { theHeaderFormat->setEventInformation(dmbHeader); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
void CSCTMBHeader::setNCFEBs ( uint16_t  ncfebs)
inline

Definition at line 74 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by CSCEventData::checkTMBClasses(), CSCTMBData::CSCTMBData(), and CSCEventData::setEventInformation().

74 { theHeaderFormat->setNCFEBs(ncfebs); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
CSCShowerDigi CSCTMBHeader::showerDigi ( uint32_t  idlayer) const
inline

returns Run3 Shower Digi for HMT

Definition at line 91 of file CSCTMBHeader.h.

References theHeaderFormat.

91 { return theHeaderFormat->showerDigi(idlayer); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::sizeInBytes ( ) const
inline

Definition at line 54 of file CSCTMBHeader.h.

References theHeaderFormat.

54 { return theHeaderFormat->sizeInWords() * 2; }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
unsigned short int CSCTMBHeader::sizeInWords ( ) const
inline

in 16-bit words. Add olne because we include beginning(b0c) and end (e0c) flags

Definition at line 103 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by CSCTMBData::CSCTMBData(), CSCTMBData::pack(), and CSCTMBData::UnpackTMB().

103 { return theHeaderFormat->sizeInWords(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::syncError ( ) const
inline

Definition at line 69 of file CSCTMBHeader.h.

References theHeaderFormat.

69 { return theHeaderFormat->syncError(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::syncErrorCLCT ( ) const
inline

Definition at line 70 of file CSCTMBHeader.h.

References theHeaderFormat.

70 { return theHeaderFormat->syncErrorCLCT(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::syncErrorMPC0 ( ) const
inline

Definition at line 71 of file CSCTMBHeader.h.

References theHeaderFormat.

71 { return theHeaderFormat->syncErrorMPC0(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
uint16_t CSCTMBHeader::syncErrorMPC1 ( ) const
inline

Definition at line 72 of file CSCTMBHeader.h.

References theHeaderFormat.

72 { return theHeaderFormat->syncErrorMPC1(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
CSCTMBHeader2006 CSCTMBHeader::tmbHeader2006 ( ) const

Definition at line 316 of file CSCTMBHeader.cc.

References Exception, mps_fire::result, and theHeaderFormat.

316  {
317  CSCTMBHeader2006 *result = dynamic_cast<CSCTMBHeader2006 *>(theHeaderFormat.get());
318  if (result == nullptr) {
319  throw cms::Exception("Could not get 2006 TMB header format");
320  }
321  return *result;
322 }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
tuple result
Definition: mps_fire.py:311
CSCTMBHeader2007 CSCTMBHeader::tmbHeader2007 ( ) const

will throw if the cast fails

Definition at line 260 of file CSCTMBHeader.cc.

References Exception, mps_fire::result, and theHeaderFormat.

260  {
261  CSCTMBHeader2007 *result = dynamic_cast<CSCTMBHeader2007 *>(theHeaderFormat.get());
262  if (result == nullptr) {
263  throw cms::Exception("Could not get 2007 TMB header format");
264  }
265  return *result;
266 }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
tuple result
Definition: mps_fire.py:311
CSCTMBHeader2007_rev0x50c3 CSCTMBHeader::tmbHeader2007_rev0x50c3 ( ) const

Definition at line 268 of file CSCTMBHeader.cc.

References Exception, mps_fire::result, and theHeaderFormat.

268  {
270  if (result == nullptr) {
271  throw cms::Exception("Could not get 2007 rev0x50c3 TMB header format");
272  }
273  return *result;
274 }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
tuple result
Definition: mps_fire.py:311
CSCTMBHeader2013 CSCTMBHeader::tmbHeader2013 ( ) const

Definition at line 276 of file CSCTMBHeader.cc.

References Exception, mps_fire::result, and theHeaderFormat.

276  {
277  CSCTMBHeader2013 *result = dynamic_cast<CSCTMBHeader2013 *>(theHeaderFormat.get());
278  if (result == nullptr) {
279  throw cms::Exception("Could not get 2013 TMB header format");
280  }
281  return *result;
282 }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
tuple result
Definition: mps_fire.py:311
CSCTMBHeader2020_CCLUT CSCTMBHeader::tmbHeader2020_CCLUT ( ) const

Definition at line 292 of file CSCTMBHeader.cc.

References Exception, mps_fire::result, and theHeaderFormat.

292  {
294  if (result == nullptr) {
295  throw cms::Exception("Could not get 2020 (O)TMB CCLUT header format");
296  }
297  return *result;
298 }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
tuple result
Definition: mps_fire.py:311
CSCTMBHeader2020_GEM CSCTMBHeader::tmbHeader2020_GEM ( ) const

Definition at line 300 of file CSCTMBHeader.cc.

References Exception, mps_fire::result, and theHeaderFormat.

300  {
302  if (result == nullptr) {
303  throw cms::Exception("Could not get 2020 (O)TMB GEM header format");
304  }
305  return *result;
306 }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
tuple result
Definition: mps_fire.py:311
CSCTMBHeader2020_Run2 CSCTMBHeader::tmbHeader2020_Run2 ( ) const

Definition at line 308 of file CSCTMBHeader.cc.

References Exception, mps_fire::result, and theHeaderFormat.

308  {
310  if (result == nullptr) {
311  throw cms::Exception("Could not get 2020 (O)TMB legacy Run2 header format");
312  }
313  return *result;
314 }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
tuple result
Definition: mps_fire.py:311
CSCTMBHeader2020_TMB CSCTMBHeader::tmbHeader2020_TMB ( ) const

Definition at line 284 of file CSCTMBHeader.cc.

References Exception, mps_fire::result, and theHeaderFormat.

284  {
286  if (result == nullptr) {
287  throw cms::Exception("Could not get 2020 TMB Run3 header format");
288  }
289  return *result;
290 }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143
tuple result
Definition: mps_fire.py:311
uint16_t CSCTMBHeader::TMBMatch ( ) const
inline

Definition at line 47 of file CSCTMBHeader.h.

References theHeaderFormat.

Referenced by cscdqm::EventProcessor::processCSC().

47 { return theHeaderFormat->TMBMatch(); }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CSCTMBHeader hdr 
)
friend

Definition at line 428 of file CSCTMBHeader.cc.

428  {
429  hdr.theHeaderFormat->print(os);
430  return os;
431 }
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:143

Member Data Documentation

std::atomic< bool > CSCTMBHeader::debug {false}
staticprivate
int CSCTMBHeader::theFirmwareVersion
private

Definition at line 144 of file CSCTMBHeader.h.

Referenced by CSCTMBHeader(), and FirmwareVersion().

std::shared_ptr<CSCVTMBHeaderFormat> CSCTMBHeader::theHeaderFormat
private