CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
CSCEventData Class Reference

#include <CSCEventData.h>

Public Member Functions

void add (const CSCStripDigi &, int layer)
 routines to add digis to the data More...
 
void add (const CSCWireDigi &, int layer)
 
void add (const CSCComparatorDigi &, int layer)
 
void add (const CSCComparatorDigi &, const CSCDetId &)
 
void add (const std::vector< CSCALCTDigi > &)
 these go in as vectors, so they get sorted right away More...
 
void add (const std::vector< CSCCLCTDigi > &)
 
void add (const std::vector< CSCCorrelatedLCTDigi > &)
 
void addALCTStructures ()
 adds an empty ALCTHeader, trailer, and anode data More...
 
CSCAnodeDataalctData () const
 user must check if nalct > 0 More...
 
CSCALCTHeaderalctHeader () const
 user must check if nalct > 0 More...
 
CSCALCTTraileralctTrailer () const
 user must check if nalct > 0 More...
 
unsigned int calcALCTcrc (std::vector< std::pair< unsigned int, unsigned short * > > &vec)
 
CSCCFEBDatacfebData (unsigned icfeb) const
 unpacked in long mode: has overflow and error bits decoded More...
 
int chamberType () const
 might not be set in real data More...
 
CSCCLCTDataclctData () const
 user must check if nclct > 0 More...
 
 CSCEventData (int chamberType, uint16_t format_version=2005)
 
 CSCEventData (unsigned short *buf, uint16_t format_version=2005)
 should make const input soon More...
 
 CSCEventData ()
 
 CSCEventData (const CSCEventData &data)
 
const CSCDMBHeaderdmbHeader () const
 the DAQ motherboard header. A good place for event and chamber info More...
 
CSCDMBHeaderdmbHeader ()
 
const CSCDMBTrailerdmbTrailer () const
 DMB trailer. More...
 
uint16_t getFormatVersion () const
 
bool isALCT (const short unsigned int *buf)
 if dealing with ALCT data More...
 
bool isTMB (const short unsigned int *buf)
 if dealing with TMB data More...
 
int nalct () const
 the flag for existence of ALCT data More...
 
int nclct () const
 the number of CLCTs More...
 
CSCEventData operator= (const CSCEventData &data)
 
boost::dynamic_bitset pack ()
 returns the packed event data. More...
 
void setEventInformation (int bxnum, int lvl1num)
 
unsigned short size () const
 size of the data buffer used, in bytes More...
 
std::vector< CSCStripDigistripDigis (const CSCDetId &idlayer) const
 returns all the strip digis in the chamber, with the comparator information. More...
 
std::vector< CSCStripDigistripDigis (unsigned idlayer, unsigned icfeb) const
 returns all the strip digis in the chamber's cfeb More...
 
std::vector< std::vector
< CSCStripDigi > > 
stripDigis () const
 deprecated. Use the above methods instead More...
 
CSCTMBDatatmbData () const
 user must check in nclct > 0 More...
 
CSCTMBHeadertmbHeader () const
 user must check if nclct > 0 More...
 
std::vector< CSCWireDigiwireDigis (unsigned ilayer) const
 
std::vector< std::vector
< CSCWireDigi > > 
wireDigis () const
 deprecated. Use the above method instead. More...
 
 ~CSCEventData ()
 

Static Public Member Functions

static void selfTest ()
 
static void setDebug (const bool value)
 

Static Public Attributes

static bool debug = false
 

Private Member Functions

void addComparatorInformation (std::vector< CSCStripDigi > &, int layer) const
 adds the comparators to the strip digis More...
 
void checkALCTClasses ()
 makes new ALCT classes, if needed More...
 
void checkTMBClasses ()
 makes new TMB classes, if needed More...
 
void copy (const CSCEventData &)
 
void destroy ()
 
void init ()
 
void unpack_data (unsigned short *buf)
 

Private Attributes

unsigned short * alctZSErecovered
 Auxiliary bufer to recove the ALCT raw payload from zero suppression. More...
 
int size_
 
CSCALCTHeadertheALCTHeader
 
CSCALCTTrailertheALCTTrailer
 
CSCAnodeDatatheAnodeData
 
CSCCFEBDatatheCFEBData [MAX_CFEB]
 for up to MAX_CFEB CFEB boards More...
 
int theChamberType
 
CSCDMBHeader theDMBHeader
 
CSCDMBTrailer theDMBTrailer
 
uint16_t theFormatVersion
 Output Format Version (2005, 2013) More...
 
CSCTMBDatatheTMBData
 
int zseEnable
 

Detailed Description

Definition at line 39 of file CSCEventData.h.

Constructor & Destructor Documentation

CSCEventData::CSCEventData ( int  chamberType,
uint16_t  format_version = 2005 
)
explicit

Definition at line 14 of file CSCEventData.cc.

References i, MAX_CFEB, and theCFEBData.

14  :
15  theDMBHeader(format_version),
16  theALCTHeader(0),
17  theAnodeData(0),
18  theALCTTrailer(0),
19  theTMBData(0),
20  theDMBTrailer(format_version),
23  zseEnable(0),
24  theFormatVersion(format_version)
25 {
26 
27  for (unsigned i = 0; i < MAX_CFEB; ++i)
28  {
29  theCFEBData[i] = 0;
30  }
31 }
int i
Definition: DBlmapReader.cc:9
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:186
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:190
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:37
CSCCFEBData * theCFEBData[MAX_CFEB]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:178
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:172
int chamberType() const
might not be set in real data
Definition: CSCEventData.h:138
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
CSCEventData::CSCEventData ( unsigned short *  buf,
uint16_t  format_version = 2005 
)

should make const input soon

Definition at line 34 of file CSCEventData.cc.

References theFormatVersion, and unpack_data().

34  : theFormatVersion(format_version)
35 {
36  theFormatVersion = format_version;
37  unpack_data(buf);
38 }
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:190
void unpack_data(unsigned short *buf)
Definition: CSCEventData.cc:41
CSCEventData::CSCEventData ( )
inline

Definition at line 44 of file CSCEventData.h.

44 {}
CSCEventData::~CSCEventData ( )

since we need deep copies, need the Big Three (destructor, copy ctor, op=)

Definition at line 306 of file CSCEventData.cc.

References destroy().

307 {
308  destroy();
309 }
CSCEventData::CSCEventData ( const CSCEventData data)

Definition at line 301 of file CSCEventData.cc.

References copy().

302 {
303  copy(data);
304 }
void copy(const CSCEventData &)

Member Function Documentation

void CSCEventData::add ( const CSCStripDigi digi,
int  layer 
)

routines to add digis to the data

Definition at line 565 of file CSCEventData.cc.

References CSCCFEBData::add(), CSCDMBHeader::addCFEB(), CSCDMBHeader::format_version(), CSCStripDigi::getADCCounts(), CSCStripDigi::getStrip(), theCFEBData, theDMBHeader, and theFormatVersion.

Referenced by CSCDigiToRaw::add(), and selfTest().

566 {
567  //@@ need special logic here for ME11
568  unsigned cfeb = (digi.getStrip()-1)/16;
569  bool sixteenSamples = false;
570  if (digi.getADCCounts().size()==16) sixteenSamples = true;
571  if (theCFEBData[cfeb] == 0)
572  {
573  bool isDCFEB = false;
574  if (theDMBHeader.format_version() == 2) isDCFEB = true;
575  theCFEBData[cfeb] = new CSCCFEBData(cfeb, sixteenSamples, theFormatVersion, isDCFEB);
576  theDMBHeader.addCFEB(cfeb);
577  }
578  theCFEBData[cfeb]->add(digi, layer);
579 
580 
581 }
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:190
std::vector< int > const & getADCCounts() const
Get ADC readings.
Definition: CSCStripDigi.h:54
void add(const CSCStripDigi &, int layer)
Definition: CSCCFEBData.cc:80
int getStrip() const
Definition: CSCStripDigi.h:51
CSCCFEBData * theCFEBData[MAX_CFEB]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
void addCFEB(int icfeb)
Definition: CSCDMBHeader.h:34
unsigned format_version() const
Definition: CSCDMBHeader.h:60
void CSCEventData::add ( const CSCWireDigi digi,
int  layer 
)

Definition at line 584 of file CSCEventData.cc.

References CSCAnodeData::add(), checkALCTClasses(), CSCWireDigi::getWireGroup(), CSCWireDigi::getWireGroupBX(), CSCALCTHeader::setBXNCount(), CSCALCTHeader::setDAVForChannel(), theALCTHeader, and theAnodeData.

585 {
587  theAnodeData->add(digi, layer);
590 
591 }
void checkALCTClasses()
makes new ALCT classes, if needed
void setBXNCount(unsigned int bxn)
Definition: CSCALCTHeader.h:78
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
void add(const CSCWireDigi &wireDigi, int layer)
Definition: CSCAnodeData.h:27
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
int getWireGroupBX() const
return BX assigned for the wire group (16 upper bits from the wire group number)
Definition: CSCWireDigi.h:26
void setDAVForChannel(int wireGroup)
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
void CSCEventData::add ( const CSCComparatorDigi digi,
int  layer 
)

Definition at line 593 of file CSCEventData.cc.

References CSCCLCTData::add(), checkTMBClasses(), CSCTMBData::clctData(), and theTMBData.

594 {
595  checkTMBClasses();
596  theTMBData->clctData()->add(digi, layer);
597 
598 }
CSCCLCTData * clctData()
Definition: CSCTMBData.h:40
void checkTMBClasses()
makes new TMB classes, if needed
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
void add(const CSCComparatorDigi &digi, int layer)
TODO for packing. Doesn&#39;t do flipping yet.
Definition: CSCCLCTData.cc:222
void CSCEventData::add ( const CSCComparatorDigi digi,
const CSCDetId cid 
)

Definition at line 600 of file CSCEventData.cc.

References CSCCLCTData::add(), checkTMBClasses(), CSCTMBData::clctData(), and theTMBData.

601 {
602  checkTMBClasses();
603  theTMBData->clctData()->add(digi, cid);
604 
605 }
CSCCLCTData * clctData()
Definition: CSCTMBData.h:40
void checkTMBClasses()
makes new TMB classes, if needed
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
void add(const CSCComparatorDigi &digi, int layer)
TODO for packing. Doesn&#39;t do flipping yet.
Definition: CSCCLCTData.cc:222
void CSCEventData::add ( const std::vector< CSCALCTDigi > &  digis)

these go in as vectors, so they get sorted right away

Definition at line 609 of file CSCEventData.cc.

References CSCALCTHeader::add(), checkALCTClasses(), and theALCTHeader.

610 {
612  theALCTHeader->add(digis);
613 }
void checkALCTClasses()
makes new ALCT classes, if needed
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
void add(const std::vector< CSCALCTDigi > &digis)
void CSCEventData::add ( const std::vector< CSCCLCTDigi > &  digis)

Definition at line 616 of file CSCEventData.cc.

References CSCTMBHeader::add(), checkTMBClasses(), theTMBData, and CSCTMBData::tmbHeader().

617 {
618  checkTMBClasses();
619  theTMBData->tmbHeader()->add(digis);
620 }
void checkTMBClasses()
makes new TMB classes, if needed
void add(const std::vector< CSCCLCTDigi > &digis)
these methods need more brains to figure which one goes first
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:39
void CSCEventData::add ( const std::vector< CSCCorrelatedLCTDigi > &  digis)

Definition at line 622 of file CSCEventData.cc.

References CSCTMBHeader::add(), checkTMBClasses(), theTMBData, and CSCTMBData::tmbHeader().

623 {
624  checkTMBClasses();
625  theTMBData->tmbHeader()->add(digis);
626 }
void checkTMBClasses()
makes new TMB classes, if needed
void add(const std::vector< CSCCLCTDigi > &digis)
these methods need more brains to figure which one goes first
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:39
void CSCEventData::addALCTStructures ( )

adds an empty ALCTHeader, trailer, and anode data

void CSCEventData::addComparatorInformation ( std::vector< CSCStripDigi > &  ,
int  layer 
) const
private

adds the comparators to the strip digis

CSCAnodeData * CSCEventData::alctData ( ) const

user must check if nalct > 0

Definition at line 466 of file CSCEventData.cc.

References edm::hlt::Exception, nalct(), and theAnodeData.

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

467 {
468  if (nalct() == 0) throw cms::Exception("No ALCT for this chamber");
469  return theAnodeData;
470 }
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:87
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
CSCALCTHeader * CSCEventData::alctHeader ( ) const

user must check if nalct > 0

Definition at line 453 of file CSCEventData.cc.

References edm::hlt::Exception, nalct(), and theALCTHeader.

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

454 {
455  if (nalct() == 0) throw cms::Exception("No ALCT for this chamber");
456  return theALCTHeader;
457 }
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:87
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
CSCALCTTrailer * CSCEventData::alctTrailer ( ) const

user must check if nalct > 0

Definition at line 459 of file CSCEventData.cc.

References edm::hlt::Exception, nalct(), and theALCTTrailer.

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

460 {
461  if (nalct() == 0) throw cms::Exception("No ALCT for this chamber");
462  return theALCTTrailer;
463 }
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:87
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:172
unsigned int CSCEventData::calcALCTcrc ( std::vector< std::pair< unsigned int, unsigned short * > > &  vec)

Definition at line 696 of file CSCEventData.cc.

References i, j, n, NULL, edm::second(), edmStreamStallGrapher::t, and w().

Referenced by pack().

697 {
698  int CRC=0;
699 // int size=0;
700 
701  for (unsigned int n = 0; n < vec.size(); n++)
702  {
703 // size += vec[n].first;
704  for (uint16_t j=0, w=0; j<vec[n].first; j++ )
705  {
706 
707  if (vec[n].second != NULL) {
708  w = vec[n].second[j] & 0xffff;
709  for (uint32_t i=15, t=0, ncrc=0; i<16; i--)
710  {
711  t = ((w >> i) & 1) ^ ((CRC >> 21) & 1);
712  ncrc = (CRC << 1) & 0x3ffffc;
713  ncrc |= (t ^ (CRC & 1)) << 1;
714  ncrc |= t;
715  CRC = ncrc;
716  }
717 
718  }
719 
720  }
721  }
722 
723  // std::cout << "ALCT CRC vector size: " << size << ", crc: 0x" << std::hex << CRC<< std::endl;
724  return CRC;
725 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
U second(std::pair< T, U > const &p)
int j
Definition: DBlmapReader.cc:9
T w() const
CSCCFEBData * CSCEventData::cfebData ( unsigned  icfeb) const

unpacked in long mode: has overflow and error bits decoded

Definition at line 447 of file CSCEventData.cc.

References theCFEBData.

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

448 {
449  return theCFEBData[icfeb];
450 }
CSCCFEBData * theCFEBData[MAX_CFEB]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
int CSCEventData::chamberType ( ) const
inline

might not be set in real data

Definition at line 138 of file CSCEventData.h.

References theChamberType.

138 {return theChamberType;}
void CSCEventData::checkALCTClasses ( )
private

makes new ALCT classes, if needed

Definition at line 528 of file CSCEventData.cc.

References CSCDMBHeader::addNALCT(), CSCALCTHeader::alctFirmwareVersion(), NULL, CSCALCTHeader::setEventInformation(), size(), CSCAnodeData::sizeInWords(), CSCALCTTrailer::sizeInWords(), CSCALCTHeader::sizeInWords(), theALCTHeader, theALCTTrailer, theAnodeData, theChamberType, and theDMBHeader.

Referenced by add().

529 {
530  if (theAnodeData == NULL)
531  {
532  assert(theChamberType>0);
538  // set data available flag
540  }
541 }
unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
Definition: CSCAnodeData.h:21
#define NULL
Definition: scimark2.h:8
void setEventInformation(const CSCDMBHeader &)
static int sizeInWords()
in 16-bit frames
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
int sizeInWords()
in 16-bit words
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:172
unsigned short int alctFirmwareVersion() const
unsigned short size() const
size of the data buffer used, in bytes
Definition: CSCEventData.h:52
void addNALCT()
Definition: CSCDMBHeader.h:37
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
void CSCEventData::checkTMBClasses ( )
private

makes new TMB classes, if needed

Definition at line 544 of file CSCEventData.cc.

References CSCDMBHeader::addNCLCT(), NULL, CSCTMBHeader::setEventInformation(), CSCTMBHeader::setNCFEBs(), theChamberType, theDMBHeader, theFormatVersion, theTMBData, and CSCTMBData::tmbHeader().

Referenced by add().

545 {
546  int nCFEBs = 5;
547  if ((theFormatVersion == 2013) && ((theChamberType == 1) || (theChamberType == 2)) ) {
548  nCFEBs = 7;
549  }
550  if (theTMBData == NULL)
551  {
552  if (theFormatVersion == 2013) { // Set to TMB format for Post-LS1 data
553  theTMBData = new CSCTMBData(2013, 0x7a76, nCFEBs);
554  } else {
555  theTMBData = new CSCTMBData(2007, 0x50c3);
556  }
559  }
560  theTMBData->tmbHeader()->setNCFEBs(nCFEBs);
561  // std::cout << "nCFEBs: " << theTMBData->tmbHeader()->NCFEBs() << std::endl;
562 }
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:29
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:190
void addNCLCT()
Definition: CSCDMBHeader.h:35
#define NULL
Definition: scimark2.h:8
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
void setNCFEBs(uint16_t ncfebs)
Definition: CSCTMBHeader.h:81
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:39
CSCCLCTData * CSCEventData::clctData ( ) const

user must check if nclct > 0

Definition at line 485 of file CSCEventData.cc.

References CSCTMBData::clctData(), edm::hlt::Exception, nclct(), NULL, and tmbData().

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

486 {
487  if ((nclct() == 0)||(tmbData()==NULL)) throw cms::Exception("No CLCT data for this chamber");
488  return tmbData()->clctData();
489 }
CSCCLCTData * clctData()
Definition: CSCTMBData.h:40
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:90
#define NULL
Definition: scimark2.h:8
CSCTMBData * tmbData() const
user must check in nclct &gt; 0
void CSCEventData::copy ( const CSCEventData data)
private

Definition at line 337 of file CSCEventData.cc.

References init(), MAX_CFEB, NULL, size_, theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theChamberType, theDMBHeader, theDMBTrailer, theFormatVersion, and theTMBData.

Referenced by CSCEventData(), and operator=().

338 {
339  init();
341  theDMBHeader = data.theDMBHeader;
343  if (data.theALCTHeader != NULL)
345  if (data.theAnodeData != NULL)
346  theAnodeData = new CSCAnodeData(*(data.theAnodeData));
347  if (data.theALCTTrailer != NULL)
349  if (data.theTMBData != NULL)
350  theTMBData = new CSCTMBData(*(data.theTMBData));
351  for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb)
352  {
353  theCFEBData[icfeb] = 0;
354  if (data.theCFEBData[icfeb] != NULL)
355  theCFEBData[icfeb] = new CSCCFEBData(*(data.theCFEBData[icfeb]));
356  }
357  size_ = data.size_;
359 
360 
361 }
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:190
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:37
#define NULL
Definition: scimark2.h:8
CSCCFEBData * theCFEBData[MAX_CFEB]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:178
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:172
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
void CSCEventData::destroy ( )
private

Definition at line 364 of file CSCEventData.cc.

References alctZSErecovered, MAX_CFEB, theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theTMBData, and zseEnable.

Referenced by operator=(), and ~CSCEventData().

365 {
366  if (zseEnable)
367  {
368  delete [] alctZSErecovered;
369  }
370  delete theALCTHeader;
371  delete theAnodeData;
372  delete theALCTTrailer;
373  delete theTMBData;
374  for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb)
375  {
376  delete theCFEBData[icfeb];
377  }
378  /*
379  std::cout << "Before delete alctZSErecovered " << std::endl;
380  delete [] alctZSErecovered;
381  std::cout << "After delete alctZSErecovered " << std::endl;
382  */
383 }
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:186
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:37
CSCCFEBData * theCFEBData[MAX_CFEB]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:172
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
const CSCDMBHeader* CSCEventData::dmbHeader ( ) const
inline

the DAQ motherboard header. A good place for event and chamber info

Definition at line 93 of file CSCEventData.h.

References theDMBHeader.

Referenced by CSCDDUEventData::add(), CSCDigiToRaw::findEventData(), and cscdqm::EventProcessor::processCSC().

93 {return &theDMBHeader;}
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
CSCDMBHeader* CSCEventData::dmbHeader ( )
inline

Definition at line 94 of file CSCEventData.h.

References theDMBHeader.

94 {return &theDMBHeader;}
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
const CSCDMBTrailer* CSCEventData::dmbTrailer ( ) const
inline

DMB trailer.

Definition at line 115 of file CSCEventData.h.

References theDMBTrailer.

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

115 {return &theDMBTrailer;}
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:178
uint16_t CSCEventData::getFormatVersion ( ) const
inline

Definition at line 140 of file CSCEventData.h.

References theFormatVersion.

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

140 { return theFormatVersion; }
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:190
void CSCEventData::init ( void  )
private

helpers for ctors, dtor, and op= zeroes all pointers

Definition at line 321 of file CSCEventData.cc.

References alctZSErecovered, MAX_CFEB, theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theTMBData, and zseEnable.

Referenced by copy(), and unpack_data().

322 {
323  //dataPresent = 0;
324  theALCTHeader = 0;
325  theAnodeData = 0;
326  theALCTTrailer = 0;
327  theTMBData = 0;
328  for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb)
329  {
330  theCFEBData[icfeb] = 0;
331  }
333  zseEnable=0;
334 }
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:186
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:37
CSCCFEBData * theCFEBData[MAX_CFEB]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:172
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
bool CSCEventData::isALCT ( const short unsigned int *  buf)

if dealing with ALCT data

Definition at line 289 of file CSCEventData.cc.

Referenced by unpack_data().

290 {
291  return (((buf[0]&0xFFFF)==0xDB0A)||(((buf[0]&0xF800)==0x6000)&&((buf[1]&0xF800)==0)));
292 }
bool CSCEventData::isTMB ( const short unsigned int *  buf)

if dealing with TMB data

Definition at line 294 of file CSCEventData.cc.

Referenced by unpack_data().

295 {
296  return ((buf[0]&0xFFF)==0xB0C);
297 }
int CSCEventData::nalct ( ) const
inline

the flag for existence of ALCT data

Definition at line 87 of file CSCEventData.h.

References CSCDMBHeader::nalct(), and theDMBHeader.

Referenced by alctData(), alctHeader(), alctTrailer(), cscdqm::EventProcessor::processCSC(), and unpack_data().

87 {return theDMBHeader.nalct();}
unsigned nalct() const
Definition: CSCDMBHeader.h:53
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
int CSCEventData::nclct ( ) const
inline

the number of CLCTs

Definition at line 90 of file CSCEventData.h.

References CSCDMBHeader::nclct(), and theDMBHeader.

Referenced by clctData(), cscdqm::EventProcessor::processCSC(), tmbData(), tmbHeader(), and unpack_data().

90 {return theDMBHeader.nclct();}
unsigned nclct() const
Definition: CSCDMBHeader.h:54
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
CSCEventData CSCEventData::operator= ( const CSCEventData data)

Definition at line 312 of file CSCEventData.cc.

References copy(), and destroy().

313 {
314  // check for self-assignment before destructing
315  if (&data != this) destroy();
316  copy(data);
317  return *this;
318 }
void copy(const CSCEventData &)
boost::dynamic_bitset CSCEventData::pack ( )

returns the packed event data.

Definition at line 644 of file CSCEventData.cc.

References alctHeader(), alctTrailer(), bitset_utilities::append(), calcALCTcrc(), cfebData(), CSCAnodeData::data(), CSCALCTTrailer::data(), CSCDMBHeader::data(), CSCDMBTrailer::data(), data, CSCALCTHeader::data(), dmbTrailer(), MAX_CFEB, NULL, CSCTMBData::pack(), CSCALCTHeader::pack(), query::result, CSCALCTTrailer::setCRC(), CSCAnodeData::sizeInWords(), CSCDMBHeader::sizeInWords(), CSCDMBTrailer::sizeInWords(), CSCALCTTrailer::sizeInWords(), CSCALCTHeader::sizeInWords(), theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theDMBHeader, theDMBTrailer, theTMBData, and bitset_utilities::ushortToBitset().

Referenced by pyrootRender.interactiveRender::draw().

645 {
646  boost::dynamic_bitset<> result = bitset_utilities::ushortToBitset( theDMBHeader.sizeInWords()*16,
647  theDMBHeader.data());
648 
649  // Container for CRC calculations
650  std::vector<std::pair<unsigned int, unsigned short*> > crcvec;
651 
652  if (theALCTHeader != NULL)
653  {
654  boost::dynamic_bitset<> alctHeader = theALCTHeader->pack();
655  result = bitset_utilities::append(result, alctHeader);
656  crcvec.push_back(std::make_pair(theALCTHeader->sizeInWords(), theALCTHeader->data()));
657  }
658  if (theAnodeData != NULL)
659  {
660  boost::dynamic_bitset<> anodeData = bitset_utilities::ushortToBitset (theAnodeData->sizeInWords()*16,
661  theAnodeData->data());
662  result = bitset_utilities::append(result, anodeData);
663  crcvec.push_back(std::make_pair(theAnodeData->sizeInWords(), theAnodeData->data()));
664 
665  }
666  if (theALCTTrailer != NULL)
667  {
668  unsigned int crc = calcALCTcrc(crcvec);
669  theALCTTrailer->setCRC(crc);
671  theALCTTrailer->data());
672  result = bitset_utilities::append(result, alctTrailer);
673 
674  }
675  if (theTMBData != NULL)
676  {
677  result = bitset_utilities::append(result, theTMBData->pack());
678  }
679 
680  for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb)
681  {
682  if (theCFEBData[icfeb] != NULL)
683  {
684  boost::dynamic_bitset<> cfebData = bitset_utilities::ushortToBitset(theCFEBData[icfeb]->sizeInWords()*16,
685  theCFEBData[icfeb]->data());
686  result = bitset_utilities::append(result, cfebData);
687  }
688  }
689 
691  theDMBTrailer.data());
692  result = bitset_utilities::append(result, dmbTrailer);
693  return result;
694 }
unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
Definition: CSCAnodeData.h:21
unsigned int calcALCTcrc(std::vector< std::pair< unsigned int, unsigned short * > > &vec)
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:37
boost::dynamic_bitset pack()
not const because it sets size int TMBTrailer
Definition: CSCTMBData.cc:429
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
Definition: CSCEventData.h:115
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 ...
unsigned sizeInWords() const
Definition: CSCDMBTrailer.h:70
#define NULL
Definition: scimark2.h:8
CSCALCTHeader * alctHeader() const
user must check if nalct &gt; 0
static int sizeInWords()
in 16-bit frames
CSCCFEBData * theCFEBData[MAX_CFEB]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
unsigned short * data()
Definition: CSCDMBTrailer.h:67
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
CSCALCTTrailer * alctTrailer() const
user must check if nalct &gt; 0
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
tuple result
Definition: query.py:137
unsigned sizeInWords() const
Definition: CSCDMBHeader.h:59
boost::dynamic_bitset pack()
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:178
unsigned short * data()
int sizeInWords()
in 16-bit words
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:172
unsigned short * data()
Definition: CSCDMBHeader.h:64
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
CSCCFEBData * cfebData(unsigned icfeb) const
unpacked in long mode: has overflow and error bits decoded
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...
unsigned short * data()
Definition: CSCAnodeData.h:19
void setCRC(unsigned int crc)
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
unsigned short int * data()
void CSCEventData::selfTest ( )
static

Definition at line 729 of file CSCEventData.cc.

References add(), CSCTMBHeader::CLCTDigis(), CSCTMBHeader::CorrelatedLCTDigis(), cscPackAndUnpack(), cscPackerCompare(), CSCDetId::layer(), muon::overlap(), EcalCondDBWriter_cfi::pedestal, DetId::rawId(), stripDigis(), and tmbHeader().

730 {
731  CSCEventData chamberData(5);
732  CSCDetId detId(1, 3, 2, 1, 3);
733  std::vector<CSCCLCTDigi> clctDigis;
734  // Both CLCTs are read-out at the same (pre-trigger) bx, so the last-but-one
735  // arguments in both digis must be the same.
736  clctDigis.push_back(CSCCLCTDigi(1, 1, 4, 1, 0, 30, 3, 2, 1)); // valid for 2007
737  clctDigis.push_back(CSCCLCTDigi(1, 1, 2, 1, 1, 31, 1, 2, 2));
738 
739  // BX of LCT (8th argument) is 1-bit word (the least-significant bit
740  // of ALCT's bx).
741  std::vector<CSCCorrelatedLCTDigi> corrDigis;
742  corrDigis.push_back(CSCCorrelatedLCTDigi(1, 1, 2, 10, 98, 5, 0, 1, 0, 0, 0, 0));
743  corrDigis.push_back(CSCCorrelatedLCTDigi(2, 1, 2, 20, 15, 9, 1, 0, 0, 0, 0, 0));
744 
745  chamberData.add(clctDigis);
746  chamberData.add(corrDigis);
747 
748  CSCWireDigi wireDigi(10, 6);
749  CSCComparatorDigi comparatorDigi(30, 1, 6);
750  chamberData.add(wireDigi, 3);
751  chamberData.add(comparatorDigi, 3);
752 
753  CSCEventData newData = cscPackAndUnpack(chamberData);
754 
755  std::vector<CSCCLCTDigi> clcts = newData.tmbHeader()->CLCTDigis(detId.rawId());
756  assert(cscPackerCompare(clcts[0],clctDigis[0]));
757  assert(cscPackerCompare(clcts[1],clctDigis[1]));
758 
759  std::vector<CSCCorrelatedLCTDigi> lcts = newData.tmbHeader()->CorrelatedLCTDigis(detId.rawId());
760  assert(cscPackerCompare(lcts[0], corrDigis[0]));
761  assert(cscPackerCompare(lcts[1], corrDigis[1]));
762 
763  // test strip digis
764  CSCDetId me1adet1(1, 1, 1, 4, 1);
765  CSCDetId me1bdet1(1, 1, 4, 4, 6);
766  CSCDetId me1adet2(2, 1, 1, 4, 2);
767  CSCDetId me1bdet2(2, 1, 4, 4, 5);
768 
769  std::vector<int> sca(16, 600);
770  std::vector<unsigned short> overflow(16, 0), overlap(16, 0), errorfl(16,0);
771  CSCStripDigi me1a(5, sca, overflow, overlap, errorfl);
772  CSCStripDigi me1b(8, sca, overflow, overlap, errorfl);
773 
774  CSCEventData forward(1);
775  CSCEventData backward(1);
776 
777  forward.add(me1a, me1adet1.layer());
778  forward.add(me1b, me1bdet1.layer());
779  backward.add(me1a, me1adet2.layer());
780  backward.add(me1b, me1adet2.layer());
781  std::vector<CSCStripDigi> me1afs = forward.stripDigis(me1adet1);
782  std::vector<CSCStripDigi> me1bfs = forward.stripDigis(me1bdet1);
783  std::vector<CSCStripDigi> me1abs = backward.stripDigis(me1adet2);
784  std::vector<CSCStripDigi> me1bbs = backward.stripDigis(me1bdet2);
785  //FIXME The current code works under the assumption that ME11 and ME1A
786  // go into separate EventData. They need to be combined.
787  assert(me1afs.size() == 16);
788  assert(me1bfs.size() == 16);
789  assert(me1abs.size() == 16);
790  assert(me1bbs.size() == 16);
791 
792  assert(me1afs[4].getStrip() == 5);
793  assert(me1bfs[7].getStrip() == 8);
794  assert(me1abs[4].getStrip() == 5);
795  assert(me1bbs[7].getStrip() == 8);
796  assert(me1afs[4].pedestal() == 600);
797  assert(me1bfs[7].pedestal() == 600);
798  assert(me1abs[4].pedestal() == 600);
799  assert(me1bbs[7].pedestal() == 600);
800 
801 
802 }
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis
Definition: CSCTMBHeader.h:93
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:87
bool cscPackerCompare(const T &t1, const T &t2)
CSCTMBHeader * tmbHeader() const
user must check if nclct &gt; 0
T cscPackAndUnpack(T &t)
static void CSCEventData::setDebug ( const bool  value)
inlinestatic

turns on/off debug flag for this class

Definition at line 55 of file CSCEventData.h.

References debug, and relativeConstraints::value.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

55 {debug = value;}
static bool debug
Definition: CSCEventData.h:145
void CSCEventData::setEventInformation ( int  bxnum,
int  lvl1num 
)

this will fill the DMB header, and change all related fields in the DMBTrailer, ALCTHeader, and TMBHeader

Definition at line 492 of file CSCEventData.cc.

References CSCDMBHeader::setBXN(), CSCTMBHeader::setEventInformation(), CSCALCTHeader::setEventInformation(), CSCDMBHeader::setL1A(), CSCCFEBData::setL1A(), CSCDMBHeader::setL1A24(), CSCTMBHeader::setNCFEBs(), theALCTHeader, theCFEBData, theChamberType, theDMBHeader, theFormatVersion, theTMBData, and CSCTMBData::tmbHeader().

Referenced by CSCDDUEventData::add().

493 {
494  theDMBHeader.setBXN(bxnum);
495  theDMBHeader.setL1A(lvl1num);
496  theDMBHeader.setL1A24(lvl1num);
497  if (theALCTHeader)
498  {
500  }
501  if (theTMBData)
502  {
504 
505  assert(theChamberType>0);
506 
508 
509  // Set number of CFEBs to 7 for Post-LS1 ME11
510  if ((theFormatVersion == 2013) && ((theChamberType == 1) || (theChamberType == 2)) ) {
512  }
513 /*
514  // Set number of CFEBs to 4 for ME13 chambers
515  if (theChamberType == 4) {
516  theTMBData->tmbHeader()->setNCFEBs(4);
517  }
518 */
519 
520  }
521  for (unsigned cfeb=0; cfeb< 7; cfeb++)
522  {
523  if (theCFEBData[cfeb]) theCFEBData[cfeb]->setL1A(lvl1num);
524  }
525 }
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:29
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:190
void setL1A(unsigned l1a)
Definition: CSCCFEBData.cc:165
void setL1A(int l1a)
Definition: CSCDMBHeader.h:39
void setEventInformation(const CSCDMBHeader &)
void setBXN(int bxn)
Definition: CSCDMBHeader.h:38
CSCCFEBData * theCFEBData[MAX_CFEB]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
void setNCFEBs(uint16_t ncfebs)
Definition: CSCTMBHeader.h:81
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
void setL1A24(int l1a)
Definition: CSCDMBHeader.h:40
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:39
unsigned short CSCEventData::size ( void  ) const
inline

size of the data buffer used, in bytes

Definition at line 52 of file CSCEventData.h.

References size_.

Referenced by checkALCTClasses().

52 {return size_;}
std::vector< CSCStripDigi > CSCEventData::stripDigis ( const CSCDetId idlayer) const

returns all the strip digis in the chamber, with the comparator information.

Definition at line 386 of file CSCEventData.cc.

References MAX_CFEB, query::result, and stripDigis().

Referenced by operator<<(), and selfTest().

387 {
388  std::vector<CSCStripDigi> result;
389  for (unsigned icfeb = 0; icfeb < MAX_CFEB; ++icfeb)
390  {
391  std::vector<CSCStripDigi> newDigis = stripDigis(idlayer, icfeb);
392  result.insert(result.end(), newDigis.begin(), newDigis.end());
393  }
394  return result;
395 }
std::vector< std::vector< CSCStripDigi > > stripDigis() const
deprecated. Use the above methods instead
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:37
tuple result
Definition: query.py:137
std::vector< CSCStripDigi > CSCEventData::stripDigis ( unsigned  idlayer,
unsigned  icfeb 
) const

returns all the strip digis in the chamber's cfeb

Definition at line 398 of file CSCEventData.cc.

References CSCCFEBData::digis(), NULL, query::result, and theCFEBData.

399 {
400  // assert(ilayer > 0 && ilayer <= 6); // off because now idlayer is raw cscdetid
401  std::vector<CSCStripDigi> result;
402  if (theCFEBData[icfeb] != NULL)
403  {
404  std::vector<CSCStripDigi> newDigis = theCFEBData[icfeb]->digis(idlayer);
405  result.insert(result.end(), newDigis.begin(), newDigis.end());
406  }
407 
408  return result;
409 }
void digis(uint32_t idlayer, std::vector< CSCStripDigi > &result)
faster way to get to digis
Definition: CSCCFEBData.cc:218
#define NULL
Definition: scimark2.h:8
CSCCFEBData * theCFEBData[MAX_CFEB]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
tuple result
Definition: query.py:137
std::vector< std::vector< CSCStripDigi > > CSCEventData::stripDigis ( ) const

deprecated. Use the above methods instead

Definition at line 425 of file CSCEventData.cc.

References query::result.

Referenced by stripDigis().

426 {
427  std::vector < std::vector<CSCStripDigi> > result;
428  for (int layer = 1; layer <= 6; ++layer)
429  {
430  std::vector<CSCStripDigi> digis = stripDigis(layer);
431  result.push_back(digis);
432  }
433  return result;
434 }
std::vector< std::vector< CSCStripDigi > > stripDigis() const
deprecated. Use the above methods instead
tuple result
Definition: query.py:137
CSCTMBData * CSCEventData::tmbData ( ) const

user must check in nclct > 0

Definition at line 472 of file CSCEventData.cc.

References edm::hlt::Exception, nclct(), and theTMBData.

Referenced by clctData(), cscdqm::EventProcessor::processCSC(), and tmbHeader().

473 {
474  if (nclct() == 0) throw cms::Exception("No CLCT for this chamber");
475  return theTMBData;
476 }
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:90
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
CSCTMBHeader * CSCEventData::tmbHeader ( ) const

user must check if nclct > 0

Definition at line 479 of file CSCEventData.cc.

References edm::hlt::Exception, nclct(), NULL, tmbData(), and CSCTMBData::tmbHeader().

Referenced by selfTest().

480 {
481  if ((nclct() == 0)||(tmbData()==NULL)) throw cms::Exception("No CLCT header for this chamber");
482  return tmbData()->tmbHeader();
483 }
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:90
#define NULL
Definition: scimark2.h:8
CSCTMBData * tmbData() const
user must check in nclct &gt; 0
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:39
void CSCEventData::unpack_data ( unsigned short *  buf)
private

The size of the ALCT payload is determined here

Check if Zero Suppression ALCT Enabled

Aauxilary variables neede to recover zero suppression Calculate the number of wire groups per layer

Calculate the number of words in the layer

unsigned short * posZSEtmpALCT = pos; This is just to dump the actual ALCT payload ** begin ** For debuggin purposes

to_rm (8 lines)

This is just to dump the actual ALCT payload ** end **

Actual word counting and recovering the original ALCT payload

Convert the recovered vector into the array

This is to check the content of the recovered ALCT payload to_rm (7 lines)

Definition at line 41 of file CSCEventData.cc.

References CSCALCTHeader::ALCTDigis(), alctZSErecovered, CSCDMBTrailer::cfeb_endtimeout(), CSCDMBTrailer::cfeb_starttimeout(), CSCDMBHeader::cfebAvailable(), CSCDMBHeader::check(), CSCALCTHeader::check(), CSCALCTHeader::data(), debug, CSCDMBHeader::format_version(), i, init(), isALCT(), isTMB(), j, ConfigFiles::l, LogTrace, MAX_CFEB, nalct(), nclct(), CSCTMBData::size(), size_, CSCAnodeData::sizeInWords(), CSCCFEBData::sizeInWords(), CSCDMBHeader::sizeInWords(), CSCDMBTrailer::sizeInWords(), CSCALCTTrailer::sizeInWords(), CSCALCTHeader::sizeInWords(), theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theDMBHeader, theDMBTrailer, theFormatVersion, theTMBData, and zseEnable.

Referenced by CSCEventData().

42 {
43  // zero everything
44  init();
45  unsigned short * pos = buf;
46  if (debug)
47  {
48  LogTrace ("CSCEventData|CSCRawToDigi") << "The event data ";
49  for (int i = 0; i < 16; ++i)
50  {
51  LogTrace ("CSCEventData|CSCRawToDigi") << std::hex << pos[i ] << " ";
52  }
53  }
54 
56  if (!(theDMBHeader.check()))
57  {
58  LogTrace ("CSCEventData|CSCRawToDigi") << "Bad DMB Header??? " << " first four words: ";
59  for (int i = 0; i < 4; ++i)
60  {
61  LogTrace ("CSCEventData|CSCRawToDigi") << std::hex << pos[i ] << " ";
62  }
63  }
64 
65 
66  if (debug)
67  {
68  LogTrace ("CSCEventData|CSCRawToDigi") << "nalct = " << nalct();
69  LogTrace ("CSCEventData|CSCRawToDigi") << "nclct = " << nclct();
70  }
71 
72  if (debug)
73  {
74  LogTrace ("CSCEventData|CSCRawToDigi") << "size in words of DMBHeader" << theDMBHeader.sizeInWords();
75  LogTrace ("CSCEventData|CSCRawToDigi") << "sizeof(DMBHeader)" << sizeof(theDMBHeader);
76  }
77 
78  pos += theDMBHeader.sizeInWords();
79 
80  if (nalct() ==1)
81  {
82  if (isALCT(pos)) //checking for ALCTData
83  {
84  theALCTHeader = new CSCALCTHeader( pos );
85  if (!theALCTHeader->check())
86  {
87  LogTrace ("CSCEventData|CSCRawToDigi") <<"+++WARNING: Corrupt ALCT data - won't attempt to decode";
88  }
89  else
90  {
91  //dataPresent|=0x40;
92  pos += theALCTHeader->sizeInWords(); //size of the header
93  //fill ALCT Digis
95 
96  //theAnodeData = new CSCAnodeData(*theALCTHeader, pos);
97 
98 
100  /*
101  std::cout << " ****The ALCT information from CSCEventData.cc (begin)**** " << std::endl; ///to_rm
102  std::cout << " alctHeader2007().size: " << theALCTHeader->alctHeader2007().sizeInWords() << std::endl; ///to_rm
103  std::cout << " ALCT Header Content: " << std::endl; ///to_rm
105  for(int k=0; k<theALCTHeader->sizeInWords(); k+=4){
106  std::cout << std::hex << theALCTHeader->data()[k+3]
107  << " " << theALCTHeader->data()[k+2]
108  << " " << theALCTHeader->data()[k+1]
109  << " " << theALCTHeader->data()[k] << std::dec << std::endl;
110  }
111  */
112  //std::cout << " ALCT Size: " << theAnodeData->sizeInWords() << std::endl;
114  // int zseEnable = 0;
115  zseEnable = (theALCTHeader->data()[5] & 0x1000) >> 12;
116  //std::cout << " ZSE Bit: " << zseEnable << std::endl; /// to_rm
117  int sizeInWord_ZSE =0;
118 
119  //alctZSErecovered = new unsigned short [theAnodeData->sizeInWords()];
120 
121  if (zseEnable)
122  {
125  int nWGs_per_layer = ( (theALCTHeader->data()[6]&0x0007) + 1 ) * 16 ;
127  int nWG_round_up = int(nWGs_per_layer/12)+(nWGs_per_layer%3?1:0);
128  //std::cout << " Words per layer: " << nWG_round_up << std::endl; ///to_rm
129  unsigned short * posZSE = pos;
130  std::vector<unsigned short> alctZSErecoveredVector;
131  alctZSErecoveredVector.clear();
132 
133  //alctZSErecovered = new unsigned short [theAnodeData->sizeInWords()];
134  //delete [] alctZSErecovered;
135  //std::cout << " ALCT Buffer with ZSE: " << std::endl; ///to_rm
139  //unsigned short * posZSEdebug = pos; ///to_rm
140 
142  /*
143  while (*posZSEdebug != 0xDE0D){
144  unsigned short d = *posZSEdebug;
145  unsigned short c = *(posZSEdebug+1);
146  unsigned short b = *(posZSEdebug+2);
147  unsigned short a = *(posZSEdebug+3);
148  posZSEdebug+=4;
149  std::cout << std::hex << a << " " << b << " " << c << " " << d << std::dec << std::endl;
150  }
151  */
153 
155  int alctZSErecoveredPos=0;
156  while (*posZSE != 0xDE0D)
157  {
158  if ( (*posZSE == 0x1000) && (*posZSE != 0x3000))
159  {
160  for (int j=0; j<nWG_round_up; j++)
161  {
162  alctZSErecoveredVector.push_back(0x0000);
163  }
164  alctZSErecoveredPos+=nWG_round_up;
165  }
166  else
167  {
168  alctZSErecoveredVector.push_back(*posZSE);
169  ++alctZSErecoveredPos;
170  }
171  posZSE++;
172  sizeInWord_ZSE++;
173  }
174 
175  alctZSErecovered = new unsigned short [alctZSErecoveredVector.size()];
176 
178  for (int l=0; l<(int)alctZSErecoveredVector.size(); l++)
179  {
180  alctZSErecovered[l]=alctZSErecoveredVector[l];
181  }
182 
183  unsigned short *posRecovered = alctZSErecovered;
184  theAnodeData = new CSCAnodeData(*theALCTHeader, posRecovered);
185 
188  /*
189  std::cout << " The ALCT payload recovered: " << std::endl;
190  for(int k=0; k<theAnodeData->sizeInWords(); k+=4){
191  std::cout << std::hex << alctZSErecovered[k+3] << " "
192  << alctZSErecovered[k+2] << " "
193  << alctZSErecovered[k+1] << " "
194  << alctZSErecovered[k] << std::dec << std::endl;
195  }
196  */
197  //delete [] alctZSErecovered;
198  //std::cout << " ALCT SizeZSE : " << sizeInWord_ZSE << std::endl; ///to_rm
199  //std::cout << " ALCT SizeZSE Recovered: " << alctZSErecoveredPos << std::endl; ///to_rm
200  //std::cout << " ALCT Size Expected: " << theAnodeData->sizeInWords() << std::endl; ///to_rm
201  pos +=sizeInWord_ZSE;
202  }
203  else
204  {
205  //pos +=sizeInWord_ZSE;
207  pos += theAnodeData->sizeInWords(); // size of the data is determined during unpacking
208  }
209  //std::cout << " ****The ALCT information from CSCEventData.cc (end)**** " << std::endl; ///to_rm
210  theALCTTrailer = new CSCALCTTrailer( pos );
211  pos += theALCTTrailer->sizeInWords();
212  }
213  }
214  else
215  {
216  LogTrace ("CSCEventData|CSCRawToDigi") << "Error:nalct reported but no ALCT data found!!!";
217  }
218  }
219 
220  if (nclct() ==1)
221  {
222  if (isTMB(pos))
223  {
224  //dataPresent|=0x20;
225  theTMBData = new CSCTMBData(pos); //fill all TMB data
226  pos += theTMBData->size();
227  }
228  else
229  {
230  LogTrace ("CSCEventData|CSCRawToDigi") << "Error:nclct reported but no TMB data found!!!";
231  }
232  }
233 
234  //now let's try to find and unpack the DMBTrailer
235  bool dmbTrailerReached= false;
236  for (int i=0; i<12000; ++i) //8000 max for cfeb + 1980ALCT + 287 TMB
237  {
238  dmbTrailerReached =
239  (*(i+pos) & 0xF000) == 0xF000 && (*(i+pos+1) & 0xF000) == 0xF000
240  && (*(i+pos+2) & 0xF000) == 0xF000 && (*(i+pos+3) & 0xF000) == 0xF000
241  && (*(i+pos+4) & 0xF000) == 0xE000 && (*(i+pos+5) & 0xF000) == 0xE000
242  && (*(i+pos+6) & 0xF000) == 0xE000 && (*(i+pos+7) & 0xF000) == 0xE000;
243  if (dmbTrailerReached)
244  {
245  // theDMBTrailer = *( (CSCDMBTrailer *) (pos+i) );
247  break;
248  }
249  }
250  if (dmbTrailerReached)
251  {
252  for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb)
253  {
254  theCFEBData[icfeb] = 0;
255  int cfeb_available = theDMBHeader.cfebAvailable(icfeb);
256  unsigned int cfebTimeout = theDMBTrailer.cfeb_starttimeout() | theDMBTrailer.cfeb_endtimeout();
257  //cfeb_available cannot be trusted - need additional verification!
258  if ( cfeb_available==1 )
259  {
260  if ((cfebTimeout >> icfeb) & 1)
261  {
262  if (debug) LogTrace ("CSCEventData|CSCRawToDigi") << "CFEB Timed out! ";
263  }
264  else
265  {
266  //dataPresent|=(0x1>>icfeb);
267  // Fill CFEB data and convert it into cathode digis
268 
269  // Check if we have here DCFEB using DMB format version field (new ME11 with DCFEBs - 0x2, other chamber types 0x1)
270  bool isDCFEB = false;
271  if (theDMBHeader.format_version() == 2) isDCFEB = true;
272 
273  theCFEBData[icfeb] = new CSCCFEBData(icfeb, pos, theFormatVersion, isDCFEB);
274  pos += theCFEBData[icfeb]->sizeInWords();
275  }
276  }
277  }
278  pos += theDMBTrailer.sizeInWords();
279  size_ = pos-buf;
280  }
281  else
282  {
283  LogTrace ("CSCEventData|CSCRawToDigi") << "Critical Error: DMB Trailer was not found!!! ";
284  }
285 
286  // std::cout << "CSC format: " << theFormatVersion << " " << getFormatVersion() << std::endl;
287 }
int i
Definition: DBlmapReader.cc:9
bool isALCT(const short unsigned int *buf)
if dealing with ALCT data
bool check() const
Definition: CSCDMBHeader.h:62
unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
Definition: CSCAnodeData.h:21
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:186
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:90
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:190
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:37
unsigned cfeb_endtimeout() const
Definition: CSCDMBTrailer.h:42
const unsigned short size() const
Definition: CSCTMBData.h:37
unsigned sizeInWords() const
Definition: CSCDMBTrailer.h:70
bool check() const
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:87
static int sizeInWords()
in 16-bit frames
CSCCFEBData * theCFEBData[MAX_CFEB]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
static bool debug
Definition: CSCEventData.h:145
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
unsigned cfeb_starttimeout() const
Definition: CSCDMBTrailer.h:46
int j
Definition: DBlmapReader.cc:9
unsigned sizeInWords() const
Definition: CSCDMBHeader.h:59
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:178
#define LogTrace(id)
int sizeInWords()
in 16-bit words
std::vector< CSCALCTDigi > ALCTDigis() const
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:172
unsigned format_version() const
Definition: CSCDMBHeader.h:60
bool isTMB(const short unsigned int *buf)
if dealing with TMB data
unsigned sizeInWords() const
Definition: CSCCFEBData.h:47
bool cfebAvailable(unsigned icfeb)
Definition: CSCDMBHeader.h:29
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
unsigned short int * data()
std::vector< CSCWireDigi > CSCEventData::wireDigis ( unsigned  ilayer) const

Definition at line 412 of file CSCEventData.cc.

References theAnodeData, and CSCAnodeData::wireDigis().

Referenced by operator<<().

413 {
414  if (theAnodeData == 0)
415  {
416  return std::vector<CSCWireDigi>();
417  }
418  else
419  {
420  return theAnodeData->wireDigis(ilayer);
421  }
422 }
std::vector< CSCWireDigi > wireDigis(int layer) const
input layer is from 1 to 6
Definition: CSCAnodeData.h:24
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
std::vector< std::vector< CSCWireDigi > > CSCEventData::wireDigis ( ) const

deprecated. Use the above method instead.

Definition at line 436 of file CSCEventData.cc.

References query::result.

437 {
438  std::vector < std::vector<CSCWireDigi> > result;
439  for (int layer = 1; layer <= 6; ++layer)
440  {
441  result.push_back(wireDigis(layer));
442  }
443  return result;
444 }
std::vector< std::vector< CSCWireDigi > > wireDigis() const
deprecated. Use the above method instead.
tuple result
Definition: query.py:137

Member Data Documentation

unsigned short* CSCEventData::alctZSErecovered
private

Auxiliary bufer to recove the ALCT raw payload from zero suppression.

Definition at line 186 of file CSCEventData.h.

Referenced by destroy(), init(), and unpack_data().

bool CSCEventData::debug = false
static
int CSCEventData::size_
private

Definition at line 180 of file CSCEventData.h.

Referenced by copy(), size(), and unpack_data().

CSCALCTHeader* CSCEventData::theALCTHeader
private

these may or may not be present. I decided to make them dynamic because most CSC chambers don't have LCTs, therefore don't have data, except for DMB headers and trailers.

Definition at line 170 of file CSCEventData.h.

Referenced by add(), alctHeader(), checkALCTClasses(), copy(), destroy(), init(), pack(), setEventInformation(), and unpack_data().

CSCALCTTrailer* CSCEventData::theALCTTrailer
private

Definition at line 172 of file CSCEventData.h.

Referenced by alctTrailer(), checkALCTClasses(), copy(), destroy(), init(), pack(), and unpack_data().

CSCAnodeData* CSCEventData::theAnodeData
private
CSCCFEBData* CSCEventData::theCFEBData[MAX_CFEB]
private

for up to MAX_CFEB CFEB boards

Definition at line 176 of file CSCEventData.h.

Referenced by add(), cfebData(), copy(), CSCEventData(), destroy(), init(), pack(), setEventInformation(), stripDigis(), and unpack_data().

int CSCEventData::theChamberType
private

this won't be filled when real data is read it. It's only used when packing simulated data, so we know how many wire and strip channels to make.

Definition at line 183 of file CSCEventData.h.

Referenced by chamberType(), checkALCTClasses(), checkTMBClasses(), copy(), and setEventInformation().

CSCDMBHeader CSCEventData::theDMBHeader
private
CSCDMBTrailer CSCEventData::theDMBTrailer
private

Definition at line 178 of file CSCEventData.h.

Referenced by copy(), dmbTrailer(), pack(), and unpack_data().

uint16_t CSCEventData::theFormatVersion
private

Output Format Version (2005, 2013)

Definition at line 190 of file CSCEventData.h.

Referenced by add(), checkTMBClasses(), copy(), CSCEventData(), getFormatVersion(), setEventInformation(), and unpack_data().

CSCTMBData* CSCEventData::theTMBData
private
int CSCEventData::zseEnable
private

Definition at line 187 of file CSCEventData.h.

Referenced by destroy(), init(), and unpack_data().