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 43 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:
80  memcpy(&trailer2006, buf, trailer2006.sizeInWords()*2);
81  break;
82  case 2007:
83  memcpy(&trailer2007, buf, trailer2007.sizeInWords()*2);
84  break;
85  default:
86  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
87  <<"couldn't construct: ALCT firmware version is bad/not defined!";
88  break;
89  }
90 }
short unsigned int sizeInWords() const
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006
short unsigned int sizeInWords() const
CSCALCTTrailer::CSCALCTTrailer ( const CSCALCTStatusDigi digi)
inline

Definition at line 49 of file CSCALCTTrailer.h.

References CSCALCTStatusDigi::trailer().

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

Member Function Documentation

unsigned CSCALCTTrailer::alctCRCCheck ( ) const
inline

Definition at line 149 of file CSCALCTTrailer.h.

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

Definition at line 168 of file CSCALCTTrailer.h.

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

Definition at line 169 of file CSCALCTTrailer.h.

References debug.

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

Definition at line 115 of file CSCALCTTrailer.h.

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

Definition at line 55 of file CSCALCTTrailer.h.

Referenced by CSCEventData::pack().

55  {
56 #ifdef LOCAL_UNPACK
57  switch (firmwareVersion) {
58 #else
59  switch (firmwareVersion.load()) {
60 #endif
61  case 2006:
63  break;
64  case 2007:
66  break;
67  default:
68  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
69  <<"couldn't access data: ALCT firmware version is bad/not defined!";
70  break;
71  }
72  return theOriginalBuffer;
73  }
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 166 of file CSCALCTTrailer.h.

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

Definition at line 98 of file CSCALCTTrailer.h.

98  {
99 #ifdef LOCAL_UNPACK
100  switch (firmwareVersion) {
101 #else
102  switch (firmwareVersion.load()) {
103 #endif
104  case 2006:
105  return ((trailer2006.crc1&0x7ff)<<11) | (trailer2006.crc0&0x7ff);
106  case 2007:
107  return ((trailer2007.crc1&0x7ff)<<11) | (trailer2007.crc0&0x7ff);
108  default:
109  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
110  <<"couldn't getCRC: ALCT firmware version is bad/not defined!";
111  return 0;
112  }
113  }
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer2006 trailer2006
void CSCALCTTrailer::setCRC ( unsigned int  crc)
inline

Definition at line 78 of file CSCALCTTrailer.h.

Referenced by CSCEventData::pack().

78  {
79 #ifdef LOCAL_UNPACK
80  switch (firmwareVersion) {
81 #else
82  switch (firmwareVersion.load()) {
83 #endif
84  case 2006:
85  trailer2006.setCRC(crc);
86  break;
87  case 2007:
88  trailer2007.setCRC(crc);
89  break;
90  default:
91  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
92  <<"couldn't setCRC: ALCT firmware version is bad/not defined!";
93  break;
94  }
95  }
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 53 of file CSCALCTTrailer.h.

References debug.

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

in 16-bit frames

Definition at line 76 of file CSCALCTTrailer.h.

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

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

Definition at line 132 of file CSCALCTTrailer.h.

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

132  {
133 #ifdef LOCAL_UNPACK
134  switch (firmwareVersion) {
135 #else
136  switch (firmwareVersion.load()) {
137 #endif
138  case 2006:
139  return trailer2006.frameCount;
140  case 2007:
141  return trailer2007.frameCount;
142  default:
143  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
144  <<"couldn't wordCount: ALCT firmware version is bad/not defined!";
145  return 0;
146  }
147  }
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 178 of file CSCALCTTrailer.h.

unsigned short int CSCALCTTrailer::theOriginalBuffer[4]
private

Definition at line 183 of file CSCALCTTrailer.h.

CSCALCTTrailer2006 CSCALCTTrailer::trailer2006
private

Definition at line 181 of file CSCALCTTrailer.h.

CSCALCTTrailer2007 CSCALCTTrailer::trailer2007
private

Definition at line 182 of file CSCALCTTrailer.h.