CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
CSCALCTTrailer Class Reference

#include <CSCALCTTrailer.h>

Public Member Functions

unsigned alctCRCCheck () const
 
CSCALCTTrailer2006 alctTrailer2006 ()
 
CSCALCTTrailer2007 alctTrailer2007 ()
 
bool check () const
 
 CSCALCTTrailer (int size, int firmVersion)
 needed for packing More...
 
 CSCALCTTrailer (const unsigned short *buf)
 
 CSCALCTTrailer (const CSCALCTStatusDigi &digi)
 
unsigned short * data ()
 
unsigned FrameCount () const
 
int getCRC ()
 
void setCRC (unsigned int crc)
 
int wordCount () const
 

Static Public Member Functions

static void setDebug (bool debugValue)
 
static int sizeInWords ()
 in 16-bit frames More...
 

Private Attributes

unsigned short int theOriginalBuffer [4]
 
CSCALCTTrailer2006 trailer2006
 
CSCALCTTrailer2007 trailer2007
 

Static Private Attributes

static std::atomic< bool > debug {false}
 
static std::atomic< unsigned short int > firmwareVersion {2006}
 

Detailed Description

Definition at line 53 of file CSCALCTTrailer.h.

Constructor & Destructor Documentation

◆ CSCALCTTrailer() [1/3]

CSCALCTTrailer::CSCALCTTrailer ( int  size,
int  firmVersion 
)

needed for packing

needed for packing

Definition at line 39 of file CSCALCTTrailer.cc.

References firmwareVersion, CSCALCTTrailer2006::setSize(), CSCALCTTrailer2007::setSize(), findQualityFiles::size, trailer2006, and trailer2007.

39  {
40  if (firmVersion == 2006) {
42  firmwareVersion = 2006;
43  } else if (firmVersion == 2007) {
45  firmwareVersion = 2007;
46  } else {
47  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
48  << "failed to construct: undetermined ALCT firmware version!!" << firmVersion;
49  }
50 }
size
Write out results.
Log< level::Error, false > LogError
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006
void setSize(int size)
void setSize(int size)

◆ CSCALCTTrailer() [2/3]

CSCALCTTrailer::CSCALCTTrailer ( const unsigned short *  buf)

determine the version first

Now fill data

Definition at line 52 of file CSCALCTTrailer.cc.

References visDQMUpload::buf, firmwareVersion, CSCALCTTrailer2006::setFromBuffer(), CSCALCTTrailer2007::setFromBuffer(), trailer2006, and trailer2007.

52  {
54  if ((buf[0] == 0xDE0D) && ((buf[1] & 0xF000) == 0xD000)) {
55  firmwareVersion = 2007;
56  } else if ((buf[2] & 0xFFF) == 0xE0D) {
57  firmwareVersion = 2006;
58  } else {
59  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
60  << "failed to construct: undetermined ALCT firmware version!!" << firmwareVersion;
61  }
62 
64 #ifdef LOCAL_UNPACK
65  switch (firmwareVersion) {
66 #else
67  switch (firmwareVersion.load()) {
68 #endif
69  case 2006:
71  break;
72  case 2007:
74  break;
75  default:
76  edm::LogError("CSCALCTTrailer|CSCRawToDigi") << "couldn't construct: ALCT firmware version is bad/not defined!";
77  break;
78  }
79 }
void setFromBuffer(unsigned short const *buf)
void setFromBuffer(unsigned short const *buf)
Log< level::Error, false > LogError
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006

◆ CSCALCTTrailer() [3/3]

CSCALCTTrailer::CSCALCTTrailer ( const CSCALCTStatusDigi digi)
inline

Definition at line 58 of file CSCALCTTrailer.h.

References CSCALCTTrailer(), and CSCALCTStatusDigi::trailer().

Referenced by CSCALCTTrailer().

58 { CSCALCTTrailer(digi.trailer()); }
CSCALCTTrailer(int size, int firmVersion)
needed for packing
const uint16_t * trailer() const

Member Function Documentation

◆ alctCRCCheck()

unsigned CSCALCTTrailer::alctCRCCheck ( ) const
inline

Definition at line 151 of file CSCALCTTrailer.h.

References firmwareVersion, CSCALCTTrailer2006::reserved_3, CSCALCTTrailer2007::reserved_3, trailer2006, and trailer2007.

151  {
152 #ifdef LOCAL_UNPACK
153  switch (firmwareVersion) {
154 #else
155  switch (firmwareVersion.load()) {
156 #endif
157  case 2006:
158  return trailer2006.reserved_3;
159  case 2007:
160  return trailer2007.reserved_3;
161  default:
162  edm::LogError("CSCALCTTrailer|CSCRawToDigi") << "couldn't CRCcheck: ALCT firmware version is bad/not defined!";
163  return 0;
164  }
165  }
Log< level::Error, false > LogError
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006

◆ alctTrailer2006()

CSCALCTTrailer2006 CSCALCTTrailer::alctTrailer2006 ( )
inline

Definition at line 169 of file CSCALCTTrailer.h.

References trailer2006.

169 { return trailer2006; }
CSCALCTTrailer2006 trailer2006

◆ alctTrailer2007()

CSCALCTTrailer2007 CSCALCTTrailer::alctTrailer2007 ( )
inline

Definition at line 170 of file CSCALCTTrailer.h.

References trailer2007.

170 { return trailer2007; }
CSCALCTTrailer2007 trailer2007

◆ check()

bool CSCALCTTrailer::check ( ) const
inline

Definition at line 119 of file CSCALCTTrailer.h.

References CSCALCTTrailer2006::e0dLine, CSCALCTTrailer2007::e0dLine, firmwareVersion, trailer2006, and trailer2007.

119  {
120 #ifdef LOCAL_UNPACK
121  switch (firmwareVersion) {
122 #else
123  switch (firmwareVersion.load()) {
124 #endif
125  case 2006:
126  return (trailer2006.e0dLine & 0xfff) == 0xe0d;
127  case 2007:
128  return (trailer2007.e0dLine & 0xffff) == 0xde0d;
129  default:
130  edm::LogError("CSCALCTTrailer|CSCRawToDigi") << "couldn't check: ALCT firmware version is bad/not defined!";
131  return false;
132  }
133  }
Log< level::Error, false > LogError
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006

◆ data()

unsigned short* CSCALCTTrailer::data ( )
inline

Definition at line 62 of file CSCALCTTrailer.h.

References firmwareVersion, CSCALCTTrailer2006::sizeInWords(), CSCALCTTrailer2007::sizeInWords(), theOriginalBuffer, trailer2006, and trailer2007.

Referenced by CSCEventData::pack().

62  {
63 #ifdef LOCAL_UNPACK
64  switch (firmwareVersion) {
65 #else
66  switch (firmwareVersion.load()) {
67 #endif
68  case 2006:
70  break;
71  case 2007:
73  break;
74  default:
75  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
76  << "couldn't access data: ALCT firmware version is bad/not defined!";
77  break;
78  }
79  return theOriginalBuffer;
80  }
short unsigned int sizeInWords() const
Log< level::Error, false > LogError
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006
short unsigned int sizeInWords() const
unsigned short int theOriginalBuffer[4]

◆ FrameCount()

unsigned CSCALCTTrailer::FrameCount ( ) const
inline

Definition at line 167 of file CSCALCTTrailer.h.

References wordCount().

167 { return wordCount(); }
int wordCount() const

◆ getCRC()

int CSCALCTTrailer::getCRC ( )
inline

Definition at line 103 of file CSCALCTTrailer.h.

References CSCALCTTrailer2006::crc0, CSCALCTTrailer2007::crc0, CSCALCTTrailer2006::crc1, CSCALCTTrailer2007::crc1, firmwareVersion, trailer2006, and trailer2007.

103  {
104 #ifdef LOCAL_UNPACK
105  switch (firmwareVersion) {
106 #else
107  switch (firmwareVersion.load()) {
108 #endif
109  case 2006:
110  return ((trailer2006.crc1 & 0x7ff) << 11) | (trailer2006.crc0 & 0x7ff);
111  case 2007:
112  return ((trailer2007.crc1 & 0x7ff) << 11) | (trailer2007.crc0 & 0x7ff);
113  default:
114  edm::LogError("CSCALCTTrailer|CSCRawToDigi") << "couldn't getCRC: ALCT firmware version is bad/not defined!";
115  return 0;
116  }
117  }
Log< level::Error, false > LogError
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006

◆ setCRC()

void CSCALCTTrailer::setCRC ( unsigned int  crc)
inline

Definition at line 85 of file CSCALCTTrailer.h.

References firmwareVersion, CSCALCTTrailer2006::setCRC(), CSCALCTTrailer2007::setCRC(), trailer2006, and trailer2007.

Referenced by CSCEventData::pack().

85  {
86 #ifdef LOCAL_UNPACK
87  switch (firmwareVersion) {
88 #else
89  switch (firmwareVersion.load()) {
90 #endif
91  case 2006:
92  trailer2006.setCRC(crc);
93  break;
94  case 2007:
95  trailer2007.setCRC(crc);
96  break;
97  default:
98  edm::LogError("CSCALCTTrailer|CSCRawToDigi") << "couldn't setCRC: ALCT firmware version is bad/not defined!";
99  break;
100  }
101  }
void setCRC(unsigned int crc)
Log< level::Error, false > LogError
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006
void setCRC(unsigned int crc)

◆ setDebug()

static void CSCALCTTrailer::setDebug ( bool  debugValue)
inlinestatic

Definition at line 60 of file CSCALCTTrailer.h.

References debug.

60 { debug = debugValue; }
static std::atomic< bool > debug

◆ sizeInWords()

static int CSCALCTTrailer::sizeInWords ( )
inlinestatic

in 16-bit frames

Definition at line 83 of file CSCALCTTrailer.h.

Referenced by CSCEventData::checkALCTClasses(), CSCEventData::pack(), and CSCEventData::unpack_data().

83 { return 4; }

◆ wordCount()

int CSCALCTTrailer::wordCount ( ) const
inline

Definition at line 135 of file CSCALCTTrailer.h.

References firmwareVersion, CSCALCTTrailer2006::frameCount, CSCALCTTrailer2007::frameCount, trailer2006, and trailer2007.

Referenced by FrameCount(), and cscdqm::EventProcessor::processCSC().

135  {
136 #ifdef LOCAL_UNPACK
137  switch (firmwareVersion) {
138 #else
139  switch (firmwareVersion.load()) {
140 #endif
141  case 2006:
142  return trailer2006.frameCount;
143  case 2007:
144  return trailer2007.frameCount;
145  default:
146  edm::LogError("CSCALCTTrailer|CSCRawToDigi") << "couldn't wordCount: ALCT firmware version is bad/not defined!";
147  return 0;
148  }
149  }
Log< level::Error, false > LogError
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006

Member Data Documentation

◆ debug

std::atomic< bool > CSCALCTTrailer::debug {false}
staticprivate

◆ firmwareVersion

std::atomic< short unsigned int > CSCALCTTrailer::firmwareVersion {2006}
staticprivate

Definition at line 178 of file CSCALCTTrailer.h.

Referenced by alctCRCCheck(), check(), CSCALCTTrailer(), data(), getCRC(), setCRC(), and wordCount().

◆ theOriginalBuffer

unsigned short int CSCALCTTrailer::theOriginalBuffer[4]
private

Definition at line 183 of file CSCALCTTrailer.h.

Referenced by data().

◆ trailer2006

CSCALCTTrailer2006 CSCALCTTrailer::trailer2006
private

◆ trailer2007

CSCALCTTrailer2007 CSCALCTTrailer::trailer2007
private