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::CSCALCTTrailer ( int  size,
int  firmVersion 
)

needed for packing

needed for packing

Definition at line 43 of file CSCALCTTrailer.cc.

44 {
45  if(firmVersion == 2006)
46  {
48  firmwareVersion = 2006;
49  }
50  else if (firmVersion == 2007)
51  {
53  firmwareVersion = 2007;
54  }
55  else {
56  edm::LogError("CSCALCTTrailer|CSCRawToDigi") <<"failed to construct: undetermined ALCT firmware version!!" << firmVersion;
57  }
58 
59 }
size
Write out results.
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006
void setSize(int size)
void setSize(int size)
CSCALCTTrailer::CSCALCTTrailer ( const unsigned short *  buf)

determine the version first

Now fill data

Definition at line 61 of file CSCALCTTrailer.cc.

61  {
63  if ((buf[0]==0xDE0D)&&((buf[1]&0xF000)==0xD000)) {
64  firmwareVersion=2007;
65  }
66  else if ( (buf[2]&0xFFF)==0xE0D ) {
67  firmwareVersion=2006;
68  }
69  else {
70  edm::LogError("CSCALCTTrailer|CSCRawToDigi") <<"failed to construct: undetermined ALCT firmware version!!" << firmwareVersion;
71  }
72 
74 #ifdef LOCAL_UNPACK
75  switch (firmwareVersion) {
76 #else
77  switch (firmwareVersion.load()) {
78 #endif
79  case 2006:
81  break;
82  case 2007:
84  break;
85  default:
86  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
87  <<"couldn't construct: ALCT firmware version is bad/not defined!";
88  break;
89  }
90 }
void setFromBuffer(unsigned short const *buf)
void setFromBuffer(unsigned short const *buf)
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006
CSCALCTTrailer::CSCALCTTrailer ( const CSCALCTStatusDigi digi)
inline

Definition at line 59 of file CSCALCTTrailer.h.

References CSCALCTStatusDigi::trailer().

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

Member Function Documentation

unsigned CSCALCTTrailer::alctCRCCheck ( ) const
inline

Definition at line 159 of file CSCALCTTrailer.h.

159  {
160 #ifdef LOCAL_UNPACK
161  switch (firmwareVersion) {
162 #else
163  switch (firmwareVersion.load()) {
164 #endif
165  case 2006:
166  return trailer2006.reserved_3;
167  case 2007:
168  return trailer2007.reserved_3;
169  default:
170  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
171  <<"couldn't CRCcheck: ALCT firmware version is bad/not defined!";
172  return 0;
173  }
174  }
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006
CSCALCTTrailer2006 CSCALCTTrailer::alctTrailer2006 ( )
inline

Definition at line 178 of file CSCALCTTrailer.h.

178 {return trailer2006;}
CSCALCTTrailer2006 trailer2006
CSCALCTTrailer2007 CSCALCTTrailer::alctTrailer2007 ( )
inline

Definition at line 179 of file CSCALCTTrailer.h.

References debug.

179 {return trailer2007;}
CSCALCTTrailer2007 trailer2007
bool CSCALCTTrailer::check ( ) const
inline

Definition at line 125 of file CSCALCTTrailer.h.

125  {
126 #ifdef LOCAL_UNPACK
127  switch (firmwareVersion) {
128 #else
129  switch (firmwareVersion.load()) {
130 #endif
131  case 2006:
132  return (trailer2006.e0dLine & 0xfff) == 0xe0d;
133  case 2007:
134  return (trailer2007.e0dLine & 0xffff) == 0xde0d;
135  default:
136  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
137  <<"couldn't check: ALCT firmware version is bad/not defined!";
138  return false;
139  }
140  }
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006
unsigned short* CSCALCTTrailer::data ( )
inline

Definition at line 65 of file CSCALCTTrailer.h.

Referenced by CSCEventData::pack().

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

Definition at line 176 of file CSCALCTTrailer.h.

176 { return wordCount(); }
int wordCount() const
int CSCALCTTrailer::getCRC ( )
inline

Definition at line 108 of file CSCALCTTrailer.h.

108  {
109 #ifdef LOCAL_UNPACK
110  switch (firmwareVersion) {
111 #else
112  switch (firmwareVersion.load()) {
113 #endif
114  case 2006:
115  return ((trailer2006.crc1&0x7ff)<<11) | (trailer2006.crc0&0x7ff);
116  case 2007:
117  return ((trailer2007.crc1&0x7ff)<<11) | (trailer2007.crc0&0x7ff);
118  default:
119  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
120  <<"couldn't getCRC: ALCT firmware version is bad/not defined!";
121  return 0;
122  }
123  }
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006
void CSCALCTTrailer::setCRC ( unsigned int  crc)
inline

Definition at line 88 of file CSCALCTTrailer.h.

Referenced by CSCEventData::pack().

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

Definition at line 63 of file CSCALCTTrailer.h.

References debug.

63 {debug = debugValue;}
static std::atomic< bool > debug
static int CSCALCTTrailer::sizeInWords ( )
inlinestatic

in 16-bit frames

Definition at line 86 of file CSCALCTTrailer.h.

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

86 {return 4;}
int CSCALCTTrailer::wordCount ( ) const
inline

Definition at line 142 of file CSCALCTTrailer.h.

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

142  {
143 #ifdef LOCAL_UNPACK
144  switch (firmwareVersion) {
145 #else
146  switch (firmwareVersion.load()) {
147 #endif
148  case 2006:
149  return trailer2006.frameCount;
150  case 2007:
151  return trailer2007.frameCount;
152  default:
153  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
154  <<"couldn't wordCount: ALCT firmware version is bad/not defined!";
155  return 0;
156  }
157  }
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006

Member Data Documentation

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

Definition at line 188 of file CSCALCTTrailer.h.

unsigned short int CSCALCTTrailer::theOriginalBuffer[4]
private

Definition at line 193 of file CSCALCTTrailer.h.

CSCALCTTrailer2006 CSCALCTTrailer::trailer2006
private

Definition at line 191 of file CSCALCTTrailer.h.

CSCALCTTrailer2007 CSCALCTTrailer::trailer2007
private

Definition at line 192 of file CSCALCTTrailer.h.