CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
CSCDCCEventData Class Reference

01/20/05 A.Tumanov More...

#include <CSCDCCEventData.h>

Public Member Functions

void addChamber (CSCEventData &chamber, int dduID, int dduSlot, int dduInput, int dmbID, uint16_t format_version=2005)
 
bool check () const
 for making events. Sets the bxnum and lvl1num inside the chamber event More...
 
 CSCDCCEventData (const uint16_t *buf, CSCDCCExaminer *examiner=nullptr)
 
 CSCDCCEventData (int sourceId, int nDDUs, int bx, int l1a)
 
CSCDCCHeader dccHeader () const
 
CSCDCCTrailer dccTrailer () const
 
std::vector< CSCDDUEventData > & dduData ()
 
const std::vector< CSCDDUEventData > & dduData () const
 accessor to dduData More...
 
boost::dynamic_bitset pack ()
 packs data into bits More...
 
int sizeInWords () const
 
 ~CSCDCCEventData ()
 

Static Public Member Functions

static void setDebug (bool value)
 

Static Public Attributes

static std::atomic< bool > debug {false}
 

Protected Member Functions

void unpack_data (const uint16_t *buf, CSCDCCExaminer *examiner=nullptr)
 

Protected Attributes

CSCDCCHeader theDCCHeader
 
CSCDCCTrailer theDCCTrailer
 
std::vector< CSCDDUEventDatatheDDUData
 
int theSizeInWords
 

Detailed Description

01/20/05 A.Tumanov

Definition at line 13 of file CSCDCCEventData.h.

Constructor & Destructor Documentation

◆ CSCDCCEventData() [1/2]

CSCDCCEventData::CSCDCCEventData ( int  sourceId,
int  nDDUs,
int  bx,
int  l1a 
)

Definition at line 22 of file CSCDCCEventData.cc.

22  : theDCCHeader(bx, l1a, sourceId) {
23  theDDUData.reserve(nDDUs);
24 }

References theDDUData.

◆ CSCDCCEventData() [2/2]

CSCDCCEventData::CSCDCCEventData ( const uint16_t *  buf,
CSCDCCExaminer examiner = nullptr 
)
explicit

buf may need to stay pinned in memory as long as this data is used. Not sure

Definition at line 26 of file CSCDCCEventData.cc.

26 { unpack_data(buf, examiner); }

References visDQMUpload::buf, and unpack_data().

◆ ~CSCDCCEventData()

CSCDCCEventData::~CSCDCCEventData ( )

Definition at line 28 of file CSCDCCEventData.cc.

28 {}

Member Function Documentation

◆ addChamber()

void CSCDCCEventData::addChamber ( CSCEventData chamber,
int  dduID,
int  dduSlot,
int  dduInput,
int  dmbID,
uint16_t  format_version = 2005 
)

Set DDU format_version field in header depending on desired format version

2013 Format

Definition at line 95 of file CSCDCCEventData.cc.

96  {
97  // first, find this DDU
98  int dduIndex = -1;
99  int nDDUs = theDDUData.size();
100  for (int i = 0; dduIndex == -1 && i < nDDUs; ++i) {
101  if (theDDUData[i].header().source_id() == dduID)
102  dduIndex = i;
103  }
104 
106  unsigned ddu_fmt_version = 0x6; // 2005 Format
107  if (format_version == 2013)
108  ddu_fmt_version = 0x7;
109 
110  if (dduIndex == -1) {
111  // make a new one
112  CSCDDUHeader newDDUHeader(
113  dccHeader().getCDFBunchCounter(), dccHeader().getCDFEventNumber(), dduID, ddu_fmt_version);
114  theDDUData.push_back(CSCDDUEventData(newDDUHeader));
115  dduIndex = nDDUs;
116  dccHeader().setDAV(dduSlot);
117  }
118  theDDUData[dduIndex].add(chamber, dmbID, dduInput, format_version);
119 }

References relativeConstraints::chamber, dccHeader(), RecoTauValidation_cfi::header, mps_fire::i, CSCDCCHeader::setDAV(), and theDDUData.

◆ check()

bool CSCDCCEventData::check ( ) const

for making events. Sets the bxnum and lvl1num inside the chamber event

Definition at line 86 of file CSCDCCEventData.cc.

86  {
87  // the trailer counts in 64-bit words
88  if (debug) {
89  LogTrace("CSCDCCEventData|CSCRawToDigi") << "size in Words () = " << std::dec << sizeInWords();
90  }
91 
92  return theDCCHeader.check() && theDCCTrailer.check();
93 }

References CSCDCCHeader::check(), CSCDCCTrailer::check(), debug, TauDecayModes::dec, LogTrace, sizeInWords(), theDCCHeader, and theDCCTrailer.

◆ dccHeader()

CSCDCCHeader CSCDCCEventData::dccHeader ( ) const
inline

Definition at line 28 of file CSCDCCEventData.h.

28 { return theDCCHeader; }

References theDCCHeader.

Referenced by addChamber().

◆ dccTrailer()

CSCDCCTrailer CSCDCCEventData::dccTrailer ( ) const
inline

Definition at line 29 of file CSCDCCEventData.h.

29 { return theDCCTrailer; }

References theDCCTrailer.

Referenced by pack().

◆ dduData() [1/2]

std::vector<CSCDDUEventData>& CSCDCCEventData::dduData ( )
inline

Definition at line 26 of file CSCDCCEventData.h.

26 { return theDDUData; }

References theDDUData.

◆ dduData() [2/2]

const std::vector<CSCDDUEventData>& CSCDCCEventData::dduData ( ) const
inline

◆ pack()

boost::dynamic_bitset CSCDCCEventData::pack ( )

packs data into bits

Definition at line 121 of file CSCDCCEventData.cc.

121  {
122  boost::dynamic_bitset<> result(theDCCHeader.sizeInWords() * 16);
124  //std::cout <<"SANDRIK DCC size of header in words"<< theDCCHeader.sizeInWords()*16 <<std::endl;
125  //std::cout <<"SANDRIK DCC size of header in bits"<< result.size()<<std::endl;
126  //for(size_t i = 0; i < result.size(); ++i) {
127  // std::cout<<result[i];
128  // if (((i+1)%32)==0) std::cout<<std::endl;
129  //}
130 
131  for (size_t i = 0; i < theDDUData.size(); ++i) {
133  //std::cout <<"SANDRIK here is ddu data check ";
134  //theDDUData[i].header().check();
135  //std::cout <<std::endl;
136  //bitset_utilities::printWords(result);
137  }
138 
139  //std::cout <<"SANDRIK packed dcc size is "<<result.size()<<std::endl;
140  //for(size_t i = 0; i < result.size(); ++i) {
141  // std::cout<<result[i];
142  // if (((i+1)%32)==0) std::cout<<std::endl;
143  //}
144 
145  boost::dynamic_bitset<> dccTrailer =
148  // bitset_utilities::printWords(result);
149  return result;
150 }

References bitset_utilities::append(), CSCDCCHeader::data(), CSCDCCTrailer::data(), dccTrailer(), mps_fire::i, mps_fire::result, CSCDCCHeader::sizeInWords(), CSCDCCTrailer::sizeInWords(), theDCCHeader, theDCCTrailer, theDDUData, and bitset_utilities::ushortToBitset().

◆ setDebug()

static void CSCDCCEventData::setDebug ( bool  value)
inlinestatic

Definition at line 22 of file CSCDCCEventData.h.

22 { debug = value; }

References debug, and relativeConstraints::value.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

◆ sizeInWords()

int CSCDCCEventData::sizeInWords ( ) const
inline

prints out the error associated with this status from the header or trailer

Definition at line 38 of file CSCDCCEventData.h.

38 { return theSizeInWords; }

References theSizeInWords.

Referenced by check().

◆ unpack_data()

void CSCDCCEventData::unpack_data ( const uint16_t *  buf,
CSCDCCExaminer examiner = nullptr 
)
protected

loop over DDUEventDatas

Definition at line 30 of file CSCDCCEventData.cc.

30  {
31  /*
32  for (int i=0;i<20;i++) {
33  printf("%04x %04x %04x %04x\n",buf[i+3],buf[i+2],buf[i+1],buf[i]);
34  i+=3;
35  }
36 */
37 
38  theDDUData.clear();
39  if (debug)
40  LogTrace("CSCDCCEventData|CSCRawToDigi") << "CSCDCCEventData::unpack_data() is called";
41 
42  // decode DCC header (128 bits)
43  if (debug)
44  LogTrace("CSCDCCEventData|CSCRawToDigi") << "unpacking dcc header...";
46  //theDCCHeader = CSCDCCHeader(buf); // direct unpacking instead of bitfields
48 
49  //std::cout <<"Sandrik DCC Id = " << theDCCHeader.getCDFSourceId() << std::endl;
50 
52  while ((buf[7] == 0x8000) && (buf[6] == 0x0001) && (buf[5] == 0x8000)) {
53  CSCDDUEventData dduEventData(buf, examiner);
54  // CSCDDUEventData dduEventData(buf);
55 
56  if (debug)
57  LogTrace("CSCDCCEventData|CSCRawToDigi") << " checking ddu data integrity ";
58  if (dduEventData.check()) {
59  theDDUData.push_back(dduEventData);
60  buf += dduEventData.sizeInWords();
61  } else {
62  if (debug)
63  LogTrace("CSCDCCEventData|CSCRawToDigi") << "DDU Data Check failed! ";
64  break;
65  }
66  }
67 
68  if (debug) {
69  LogTrace("CSCDCCEventData|CSCRawToDigi") << "unpacking dcc trailer ";
70  LogTrace("CSCDCCEventData|CSCRawToDigi") << std::hex << buf[3] << " " << buf[2] << " " << buf[1] << " " << buf[0];
71  }
72 
73  //decode dcc trailer (128 bits)
74  if (debug)
75  LogTrace("CSCDCCEventData|CSCRawToDigi") << "decoding DCC trailer";
77  if (debug)
78  LogTrace("CSCDCCEventData|CSCRawToDigi") << "checking DDU Trailer" << theDCCTrailer.check();
79 
80  // buf += theDCCTrailer.sizeInWords(); /* =VB= Commented out to please static analyzer */
81 
82  //std::cout << " DCC Size: " << std::dec << theSizeInWords << std::endl;
83  //std::cout << "LastBuf: " << std::hex << inputBuf[theSizeInWords-4] << std::endl;
84 }

References visDQMUpload::buf, CSCDDUEventData::check(), CSCDCCTrailer::check(), debug, LogTrace, CSCDCCHeader::setFromBuffer(), CSCDCCTrailer::setFromBuffer(), CSCDCCHeader::sizeInWords(), CSCDDUEventData::sizeInWords(), theDCCHeader, theDCCTrailer, and theDDUData.

Referenced by CSCDCCEventData().

Member Data Documentation

◆ debug

std::atomic< bool > CSCDCCEventData::debug {false}
static

◆ theDCCHeader

CSCDCCHeader CSCDCCEventData::theDCCHeader
protected

Definition at line 54 of file CSCDCCEventData.h.

Referenced by check(), dccHeader(), pack(), and unpack_data().

◆ theDCCTrailer

CSCDCCTrailer CSCDCCEventData::theDCCTrailer
protected

Definition at line 57 of file CSCDCCEventData.h.

Referenced by check(), dccTrailer(), pack(), and unpack_data().

◆ theDDUData

std::vector<CSCDDUEventData> CSCDCCEventData::theDDUData
protected

Definition at line 56 of file CSCDCCEventData.h.

Referenced by addChamber(), CSCDCCEventData(), dduData(), pack(), and unpack_data().

◆ theSizeInWords

int CSCDCCEventData::theSizeInWords
protected

Definition at line 58 of file CSCDCCEventData.h.

Referenced by sizeInWords().

mps_fire.i
i
Definition: mps_fire.py:428
CSCDCCEventData::theDCCHeader
CSCDCCHeader theDCCHeader
Definition: CSCDCCEventData.h:54
CSCDCCEventData::debug
static std::atomic< bool > debug
Definition: CSCDCCEventData.h:49
CSCDCCTrailer::sizeInWords
static unsigned sizeInWords()
Definition: CSCDCCTrailer.h:46
CSCDDUHeader
Definition: CSCDDUHeader.h:11
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
CSCDCCTrailer::setFromBuffer
void setFromBuffer(uint16_t const *buf)
Definition: CSCDCCTrailer.h:24
CSCDCCHeader::sizeInWords
static unsigned sizeInWords()
Definition: CSCDCCHeader.h:29
CSCDCCEventData::theSizeInWords
int theSizeInWords
Definition: CSCDCCEventData.h:58
bitset_utilities::append
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1
Definition: bitset_append.cc:10
CSCDCCHeader::setFromBuffer
void setFromBuffer(uint16_t const *buf)
Definition: CSCDCCHeader.h:19
CSCDCCHeader::check
bool check() const
Definition: CSCDCCHeader.h:27
CSCDCCHeader::data
unsigned short * data()
Definition: CSCDCCHeader.h:28
CSCDCCEventData::dccHeader
CSCDCCHeader dccHeader() const
Definition: CSCDCCEventData.h:28
CSCDCCEventData::pack
boost::dynamic_bitset pack()
packs data into bits
Definition: CSCDCCEventData.cc:121
CSCDCCTrailer::data
unsigned short * data()
Definition: CSCDCCTrailer.h:49
CSCDCCEventData::theDCCTrailer
CSCDCCTrailer theDCCTrailer
Definition: CSCDCCEventData.h:57
CSCDCCTrailer::check
bool check() const
Definition: CSCDCCTrailer.h:48
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCDCCEventData::sizeInWords
int sizeInWords() const
Definition: CSCDCCEventData.h:38
objects.autophobj.sourceId
sourceId
Definition: autophobj.py:239
CSCDCCHeader::setDAV
void setDAV(int dduSlot)
Definition: CSCDCCHeader.cc:28
CSCDDUEventData
Definition: CSCDDUEventData.h:19
bitset_utilities::ushortToBitset
boost::dynamic_bitset ushortToBitset(const unsigned int numberOfBits, unsigned short *buf)
this method takes numberOfBits bits from unsigned short * array and returns them in the bitset obj.
Definition: bitset_append.cc:23
relativeConstraints.value
value
Definition: relativeConstraints.py:53
CSCDCCEventData::theDDUData
std::vector< CSCDDUEventData > theDDUData
Definition: CSCDCCEventData.h:56
CSCDCCEventData::dccTrailer
CSCDCCTrailer dccTrailer() const
Definition: CSCDCCEventData.h:29
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
CSCDCCEventData::unpack_data
void unpack_data(const uint16_t *buf, CSCDCCExaminer *examiner=nullptr)
Definition: CSCDCCEventData.cc:30
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143