CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCDMBHeader.cc
Go to the documentation of this file.
5 #include <iostream>
6 
7 CSCDMBHeader::CSCDMBHeader(uint16_t firmware_version) : theHeaderFormat(), theFirmwareVersion(firmware_version) {
8  if (theFirmwareVersion == 2013) {
9  theHeaderFormat = std::make_shared<CSCDMBHeader2013>();
10  } else {
11  theHeaderFormat = std::make_shared<CSCDMBHeader2005>();
12  }
13 }
14 
15 CSCDMBHeader::CSCDMBHeader(const uint16_t *buf, uint16_t firmware_version)
16  : theHeaderFormat(), theFirmwareVersion(firmware_version) {
17  if (theFirmwareVersion == 2013) {
18  theHeaderFormat = std::make_shared<CSCDMBHeader2013>(buf);
19  } else {
20  theHeaderFormat = std::make_shared<CSCDMBHeader2005>(buf);
21  }
22 }
23 
25  const CSCDMBHeader2005 *result = dynamic_cast<const CSCDMBHeader2005 *>(theHeaderFormat.get());
26  if (result == nullptr) {
27  throw cms::Exception("Could not get 2005 DMB header format");
28  }
29  return *result;
30 }
31 
33  const CSCDMBHeader2013 *result = dynamic_cast<const CSCDMBHeader2013 *>(theHeaderFormat.get());
34  if (result == nullptr) {
35  throw cms::Exception("Could not get 2013 DMB header format");
36  }
37  return *result;
38 }
int theFirmwareVersion
Definition: CSCDMBHeader.h:64
CSCDMBHeader2005 dmbHeader2005() const
will throw if the cast fails
Definition: CSCDMBHeader.cc:24
tuple result
Definition: mps_fire.py:311
std::shared_ptr< CSCVDMBHeaderFormat > theHeaderFormat
Definition: CSCDMBHeader.h:63
CSCDMBHeader2013 dmbHeader2013() const
Definition: CSCDMBHeader.cc:32
CSCDMBHeader(uint16_t firmware_version=2005)
Definition: CSCDMBHeader.cc:7