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 (const CSCALCTStatusDigi &digi)
 
 CSCALCTTrailer (const unsigned short *buf)
 
 CSCALCTTrailer (int size, int firmVersion)
 needed for packing More...
 
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.

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 }

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

◆ CSCALCTTrailer() [2/3]

CSCALCTTrailer::CSCALCTTrailer ( const unsigned short *  buf)

determine the version first

Now fill data

Definition at line 52 of file CSCALCTTrailer.cc.

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 }

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

◆ CSCALCTTrailer() [3/3]

CSCALCTTrailer::CSCALCTTrailer ( const CSCALCTStatusDigi digi)
inline

Definition at line 58 of file CSCALCTTrailer.h.

58 { CSCALCTTrailer(digi.trailer()); }

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

Referenced by CSCALCTTrailer().

Member Function Documentation

◆ alctCRCCheck()

unsigned CSCALCTTrailer::alctCRCCheck ( ) const
inline

Definition at line 151 of file CSCALCTTrailer.h.

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  }

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

◆ alctTrailer2006()

CSCALCTTrailer2006 CSCALCTTrailer::alctTrailer2006 ( )
inline

Definition at line 169 of file CSCALCTTrailer.h.

169 { return trailer2006; }

References trailer2006.

◆ alctTrailer2007()

CSCALCTTrailer2007 CSCALCTTrailer::alctTrailer2007 ( )
inline

Definition at line 170 of file CSCALCTTrailer.h.

170 { return trailer2007; }

References trailer2007.

◆ check()

bool CSCALCTTrailer::check ( ) const
inline

Definition at line 119 of file CSCALCTTrailer.h.

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  }

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

◆ data()

unsigned short* CSCALCTTrailer::data ( )
inline

Definition at line 62 of file CSCALCTTrailer.h.

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  }

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

Referenced by CSCEventData::pack().

◆ FrameCount()

unsigned CSCALCTTrailer::FrameCount ( ) const
inline

Definition at line 167 of file CSCALCTTrailer.h.

167 { return wordCount(); }

References wordCount().

◆ getCRC()

int CSCALCTTrailer::getCRC ( )
inline

Definition at line 103 of file CSCALCTTrailer.h.

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  }

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

◆ setCRC()

void CSCALCTTrailer::setCRC ( unsigned int  crc)
inline

Definition at line 85 of file CSCALCTTrailer.h.

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  }

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

Referenced by CSCEventData::pack().

◆ setDebug()

static void CSCALCTTrailer::setDebug ( bool  debugValue)
inlinestatic

Definition at line 60 of file CSCALCTTrailer.h.

60 { debug = debugValue; }

References debug.

◆ sizeInWords()

static int CSCALCTTrailer::sizeInWords ( )
inlinestatic

in 16-bit frames

Definition at line 83 of file CSCALCTTrailer.h.

83 { return 4; }

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

◆ wordCount()

int CSCALCTTrailer::wordCount ( ) const
inline

Definition at line 135 of file CSCALCTTrailer.h.

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  }

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

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

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
CSCALCTTrailer2006::setCRC
void setCRC(unsigned int crc)
Definition: CSCALCTTrailer.h:21
CSCALCTTrailer2007::reserved_3
unsigned reserved_3
Definition: CSCALCTTrailer.h:50
CSCALCTTrailer2007::setFromBuffer
void setFromBuffer(unsigned short const *buf)
Definition: CSCALCTTrailer.h:37
CSCALCTTrailer::trailer2006
CSCALCTTrailer2006 trailer2006
Definition: CSCALCTTrailer.h:181
CSCALCTTrailer2006::reserved_3
unsigned reserved_3
Definition: CSCALCTTrailer.h:31
CSCALCTTrailer2006::e0dLine
unsigned e0dLine
Definition: CSCALCTTrailer.h:30
CSCALCTTrailer2006::setFromBuffer
void setFromBuffer(unsigned short const *buf)
Definition: CSCALCTTrailer.h:18
CSCALCTTrailer::theOriginalBuffer
unsigned short int theOriginalBuffer[4]
Definition: CSCALCTTrailer.h:183
CSCALCTTrailer::firmwareVersion
static std::atomic< unsigned short int > firmwareVersion
Definition: CSCALCTTrailer.h:178
CSCALCTTrailer::trailer2007
CSCALCTTrailer2007 trailer2007
Definition: CSCALCTTrailer.h:182
CSCALCTTrailer2006::frameCount
unsigned frameCount
Definition: CSCALCTTrailer.h:31
CSCALCTTrailer2006::crc1
unsigned crc1
Definition: CSCALCTTrailer.h:29
CSCALCTTrailer2007::crc0
unsigned crc0
Definition: CSCALCTTrailer.h:48
CSCALCTTrailer2007::sizeInWords
short unsigned int sizeInWords() const
Definition: CSCALCTTrailer.h:44
CSCALCTTrailer2007::e0dLine
unsigned e0dLine
Definition: CSCALCTTrailer.h:47
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCALCTTrailer2007::setCRC
void setCRC(unsigned int crc)
Definition: CSCALCTTrailer.h:40
CSCALCTStatusDigi::trailer
const uint16_t * trailer() const
Definition: CSCALCTStatusDigi.h:25
CSCALCTTrailer::wordCount
int wordCount() const
Definition: CSCALCTTrailer.h:135
CSCALCTTrailer2006::setSize
void setSize(int size)
Definition: CSCALCTTrailer.h:20
CSCALCTTrailer2006::sizeInWords
short unsigned int sizeInWords() const
Definition: CSCALCTTrailer.h:25
CSCALCTTrailer2007::setSize
void setSize(int size)
Definition: CSCALCTTrailer.h:39
CSCALCTTrailer2007::frameCount
unsigned frameCount
Definition: CSCALCTTrailer.h:50
CSCALCTTrailer2007::crc1
unsigned crc1
Definition: CSCALCTTrailer.h:49
CSCALCTTrailer2006::crc0
unsigned crc0
Definition: CSCALCTTrailer.h:28
CSCALCTTrailer::CSCALCTTrailer
CSCALCTTrailer(int size, int firmVersion)
needed for packing
Definition: CSCALCTTrailer.cc:39
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
CSCALCTTrailer::debug
static std::atomic< bool > debug
Definition: CSCALCTTrailer.h:177