CMS 3D CMS Logo

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 add (const std::vector< GEMPadDigiCluster > &, const GEMDetId &)
 Run3 GEM Pad Clusters obecjts. More...
 
void addALCTStructures ()
 adds an empty ALCTHeader, trailer, and anode data More...
 
void addAnodeALCTShower (const std::vector< CSCShowerDigi > &)
 Add/pack anode CSCShower objects (from ALCT board data) More...
 
void addAnodeShower (const std::vector< CSCShowerDigi > &)
 Add/pack anode CSCShower object (from OTMB header) More...
 
void addCathodeShower (const std::vector< CSCShowerDigi > &)
 Add/pack cathode CSCShower object (from OTMB header) More...
 
void addShower (const std::vector< CSCShowerDigi > &)
 Run3 CSC Shower HMT objects. 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)
 
const 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...
 
CSCComparatorDatacomparatorData () const
 user must check if nclct > 0 More...
 
 CSCEventData (int chamberType, uint16_t format_version=2005)
 
 CSCEventData (const uint16_t *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 uint16_t *buf)
 if dealing with ALCT data More...
 
bool isTMB (const uint16_t *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 std::atomic< 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 (const uint16_t *buf)
 

Private Attributes

unsigned short * alctZSErecovered
 Auxiliary bufer to recove the ALCT raw payload from zero suppression. More...
 
int size_
 
CSCALCTHeadertheALCTHeader
 
CSCALCTTrailertheALCTTrailer
 
CSCAnodeDatatheAnodeData
 
CSCCFEBDatatheCFEBData [CSCConstants::MAX_CFEBS_RUN2]
 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 26 of file CSCEventData.h.

Constructor & Destructor Documentation

◆ CSCEventData() [1/4]

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

Definition at line 18 of file CSCEventData.cc.

References mps_fire::i, CSCConstants::MAX_CFEBS_RUN2, and theCFEBData.

19  : theDMBHeader(format_version),
20  theALCTHeader(nullptr),
21  theAnodeData(nullptr),
22  theALCTTrailer(nullptr),
23  theTMBData(nullptr),
24  theDMBTrailer(format_version),
26  alctZSErecovered(nullptr),
27  zseEnable(0),
28  theFormatVersion(format_version) {
29  for (unsigned i = 0; i < CSCConstants::MAX_CFEBS_RUN2; ++i) {
30  theCFEBData[i] = nullptr;
31  }
32 }
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:175
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:179
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:165
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:167
int chamberType() const
might not be set in real data
Definition: CSCEventData.h:124
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:161
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:160

◆ CSCEventData() [2/4]

CSCEventData::CSCEventData ( const uint16_t *  buf,
uint16_t  format_version = 2005 
)

should make const input soon

Definition at line 34 of file CSCEventData.cc.

References visDQMUpload::buf, theFormatVersion, and unpack_data().

34  : theFormatVersion(format_version) {
35  theFormatVersion = format_version;
37 }
void unpack_data(const uint16_t *buf)
Definition: CSCEventData.cc:39
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:179

◆ CSCEventData() [3/4]

CSCEventData::CSCEventData ( )
inline

Definition at line 31 of file CSCEventData.h.

31 {}

◆ ~CSCEventData()

CSCEventData::~CSCEventData ( )

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

Definition at line 260 of file CSCEventData.cc.

References destroy().

260 { destroy(); }

◆ CSCEventData() [4/4]

CSCEventData::CSCEventData ( const CSCEventData data)

Definition at line 258 of file CSCEventData.cc.

References copy(), and data.

258 { copy(data); }
void copy(const CSCEventData &)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

Member Function Documentation

◆ add() [1/8]

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

routines to add digis to the data

Definition at line 466 of file CSCEventData.cc.

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

Referenced by CSCDigiToRaw::add(), counter.Counter::register(), SequenceTypes._TaskBase::remove(), SequenceTypes._TaskBase::replace(), and selfTest().

466  {
467  //@@ need special logic here for ME11
468  unsigned cfeb = digi.getCFEB();
469  bool sixteenSamples = false;
470  if (digi.getADCCounts().size() == 16)
471  sixteenSamples = true;
472  if (theCFEBData[cfeb] == nullptr) {
473  bool isDCFEB = false;
474  if (theDMBHeader.format_version() == 2)
475  isDCFEB = true;
476  theCFEBData[cfeb] = new CSCCFEBData(cfeb, sixteenSamples, theFormatVersion, isDCFEB);
477  theDMBHeader.addCFEB(cfeb);
478  }
479  theCFEBData[cfeb]->add(digi, layer);
480 }
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:179
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:165
void add(const CSCStripDigi &, int layer)
Definition: CSCCFEBData.cc:82
constexpr std::array< uint8_t, layerIndexSize > layer
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154
void addCFEB(int icfeb)
Definition: CSCDMBHeader.h:23
unsigned format_version() const
Definition: CSCDMBHeader.h:49
int getCFEB() const
Get the CFEB number. Counts from 0.
Definition: CSCStripDigi.cc:25
std::vector< int > const & getADCCounts() const
Get ADC readings.
Definition: CSCStripDigi.h:47

◆ add() [2/8]

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

Definition at line 482 of file CSCEventData.cc.

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

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

482  {
484  theAnodeData->add(digi, layer);
487 }
void checkALCTClasses()
makes new ALCT classes, if needed
void setBXNCount(unsigned int bxn)
Definition: CSCALCTHeader.h:79
int getWireGroupBX() const
return BX assigned for the wire group (16 upper bits from the wire group number)
Definition: CSCWireDigi.h:24
constexpr std::array< uint8_t, layerIndexSize > layer
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
void add(const CSCWireDigi &wireDigi, int layer)
Definition: CSCAnodeData.h:24
void setDAVForChannel(int wireGroup)
int getWireGroup() const
default
Definition: CSCWireDigi.h:22
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:160

◆ add() [3/8]

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

Definition at line 489 of file CSCEventData.cc.

References CSCComparatorData::add(), checkTMBClasses(), CSCTMBData::comparatorData(), phase1PixelTopology::layer, and theTMBData.

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

489  {
490  checkTMBClasses();
491  theTMBData->comparatorData()->add(digi, layer);
492 }
void checkTMBClasses()
makes new TMB classes, if needed
constexpr std::array< uint8_t, layerIndexSize > layer
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
CSCComparatorData * comparatorData()
Definition: CSCTMBData.h:41
void add(const CSCComparatorDigi &digi, int layer)
TODO for packing. Doesn&#39;t do flipping yet.

◆ add() [4/8]

void CSCEventData::add ( const CSCComparatorDigi digi,
const CSCDetId cid 
)

Definition at line 494 of file CSCEventData.cc.

References CSCComparatorData::add(), checkTMBClasses(), CSCTMBData::comparatorData(), and theTMBData.

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

494  {
495  checkTMBClasses();
496  theTMBData->comparatorData()->add(digi, cid);
497 }
void checkTMBClasses()
makes new TMB classes, if needed
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
CSCComparatorData * comparatorData()
Definition: CSCTMBData.h:41
void add(const CSCComparatorDigi &digi, int layer)
TODO for packing. Doesn&#39;t do flipping yet.

◆ add() [5/8]

void CSCEventData::add ( const std::vector< CSCALCTDigi > &  digis)

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

Definition at line 499 of file CSCEventData.cc.

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

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

499  {
501  theALCTHeader->add(digis);
502 }
void checkALCTClasses()
makes new ALCT classes, if needed
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
void add(const std::vector< CSCALCTDigi > &digis)

◆ add() [6/8]

void CSCEventData::add ( const std::vector< CSCCLCTDigi > &  digis)

Definition at line 504 of file CSCEventData.cc.

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

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

504  {
505  checkTMBClasses();
506  theTMBData->tmbHeader()->add(digis);
507 }
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:162
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:40

◆ add() [7/8]

void CSCEventData::add ( const std::vector< CSCCorrelatedLCTDigi > &  digis)

Definition at line 509 of file CSCEventData.cc.

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

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

509  {
510  checkTMBClasses();
511  theTMBData->tmbHeader()->add(digis);
512 }
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:162
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:40

◆ add() [8/8]

void CSCEventData::add ( const std::vector< GEMPadDigiCluster > &  clusters,
const GEMDetId gemdetid 
)

Run3 GEM Pad Clusters obecjts.

Add/pack GE11 GEM Pad Clusters trigger objects received by OTMB from GEM.

Definition at line 545 of file CSCEventData.cc.

References CSCGEMData::addEtaPadCluster(), checkTMBClasses(), bsc_activity_cfg::clusters, CSCTMBData::gemData(), CSCTMBData::hasGEM(), GEMDetId::layer(), GEMDetId::roll(), CSCTMBHeader::setALCTMatchTime(), theTMBData, and CSCTMBData::tmbHeader().

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

545  {
546  checkTMBClasses();
547  if (theTMBData->hasGEM()) {
548  int gem_layer = gemdetid.layer();
549  int eta_roll = gemdetid.roll();
550  for (const auto& it : clusters) {
551  if (it.isValid())
552  theTMBData->tmbHeader()->setALCTMatchTime(it.alctMatchTime());
553  theTMBData->gemData()->addEtaPadCluster(it, gem_layer - 1, 8 - eta_roll);
554  }
555  }
556 }
CSCGEMData * gemData()
Definition: CSCTMBData.cc:409
void addEtaPadCluster(const GEMPadDigiCluster &digi, int gem_chamber, int eta_roll)
Add and pack GEMPadDigiCluster digis.
Definition: CSCGEMData.cc:191
void checkTMBClasses()
makes new TMB classes, if needed
constexpr int layer() const
Definition: GEMDetId.h:190
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:40
constexpr int roll() const
Definition: GEMDetId.h:194
bool hasGEM() const
Definition: CSCTMBData.h:55
void setALCTMatchTime(uint16_t alctmatchtime)
Definition: CSCTMBHeader.h:45

◆ addALCTStructures()

void CSCEventData::addALCTStructures ( )

adds an empty ALCTHeader, trailer, and anode data

◆ addAnodeALCTShower()

void CSCEventData::addAnodeALCTShower ( const std::vector< CSCShowerDigi > &  digis)

Add/pack anode CSCShower objects (from ALCT board data)

Definition at line 539 of file CSCEventData.cc.

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

Referenced by CSCDigiToRaw::add().

539  {
541  theALCTHeader->addShower(digis);
542 }
void checkALCTClasses()
makes new ALCT classes, if needed
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
void addShower(const std::vector< CSCShowerDigi > &digis)
Add Run3 ALCT HMT shower bits.

◆ addAnodeShower()

void CSCEventData::addAnodeShower ( const std::vector< CSCShowerDigi > &  digis)

Add/pack anode CSCShower object (from OTMB header)

Definition at line 523 of file CSCEventData.cc.

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

Referenced by CSCDigiToRaw::add().

523  {
524  checkTMBClasses();
525  for (auto it : digis) {
527  }
528 }
void checkTMBClasses()
makes new TMB classes, if needed
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
void addAnodeShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:131
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:40

◆ addCathodeShower()

void CSCEventData::addCathodeShower ( const std::vector< CSCShowerDigi > &  digis)

Add/pack cathode CSCShower object (from OTMB header)

Definition at line 531 of file CSCEventData.cc.

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

Referenced by CSCDigiToRaw::add().

531  {
532  checkTMBClasses();
533  for (auto it : digis) {
535  }
536 }
void checkTMBClasses()
makes new TMB classes, if needed
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
void addCathodeShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:133
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:40

◆ addComparatorInformation()

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

adds the comparators to the strip digis

◆ addShower()

void CSCEventData::addShower ( const std::vector< CSCShowerDigi > &  digis)

Run3 CSC Shower HMT objects.

Add/pack LCT CSCShower object.

Definition at line 515 of file CSCEventData.cc.

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

Referenced by CSCDigiToRaw::add().

515  {
516  checkTMBClasses();
517  for (auto it : digis) {
519  }
520 }
void checkTMBClasses()
makes new TMB classes, if needed
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
void addShower(const CSCShowerDigi &digi)
Definition: CSCTMBHeader.h:129
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:40

◆ alctData()

CSCAnodeData * CSCEventData::alctData ( ) const

user must check if nalct > 0

Definition at line 381 of file CSCEventData.cc.

References Exception, nalct(), and theAnodeData.

381  {
382  if (nalct() == 0)
383  throw cms::Exception("No ALCT for this chamber");
384  return theAnodeData;
385 }
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:67
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:160

◆ alctHeader()

CSCALCTHeader * CSCEventData::alctHeader ( ) const

user must check if nalct > 0

Definition at line 369 of file CSCEventData.cc.

References Exception, nalct(), and theALCTHeader.

Referenced by pack().

369  {
370  if (nalct() == 0)
371  throw cms::Exception("No ALCT for this chamber");
372  return theALCTHeader;
373 }
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:67
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159

◆ alctTrailer()

CSCALCTTrailer * CSCEventData::alctTrailer ( ) const

user must check if nalct > 0

Definition at line 375 of file CSCEventData.cc.

References Exception, nalct(), and theALCTTrailer.

Referenced by pack().

375  {
376  if (nalct() == 0)
377  throw cms::Exception("No ALCT for this chamber");
378  return theALCTTrailer;
379 }
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:67
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:161

◆ calcALCTcrc()

unsigned int CSCEventData::calcALCTcrc ( std::vector< std::pair< unsigned int, unsigned short *> > &  vec)

Definition at line 612 of file CSCEventData.cc.

References RawDataTask_cfi::CRC, mps_fire::i, dqmiolumiharvest::j, dqmiodumpmetadata::n, edm::second(), submitPVValidationJobs::t, and w().

Referenced by pack().

612  {
613  int CRC = 0;
614 
615  for (unsigned int n = 0; n < vec.size(); n++) {
616  for (uint16_t j = 0, w = 0; j < vec[n].first; j++) {
617  if (vec[n].second != nullptr) {
618  w = vec[n].second[j] & 0xffff;
619  for (uint32_t i = 15, t = 0, ncrc = 0; i < 16; i--) {
620  t = ((w >> i) & 1) ^ ((CRC >> 21) & 1);
621  ncrc = (CRC << 1) & 0x3ffffc;
622  ncrc |= (t ^ (CRC & 1)) << 1;
623  ncrc |= t;
624  CRC = ncrc;
625  }
626  }
627  }
628  }
629 
630  return CRC;
631 }
T w() const
U second(std::pair< T, U > const &p)

◆ cfebData()

const CSCCFEBData * CSCEventData::cfebData ( unsigned  icfeb) const

unpacked in long mode: has overflow and error bits decoded

Definition at line 367 of file CSCEventData.cc.

References theCFEBData.

Referenced by pack().

367 { return theCFEBData[icfeb]; }
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:165

◆ chamberType()

int CSCEventData::chamberType ( ) const
inline

might not be set in real data

Definition at line 124 of file CSCEventData.h.

References theChamberType.

124 { return theChamberType; }

◆ checkALCTClasses()

void CSCEventData::checkALCTClasses ( )
private

makes new ALCT classes, if needed

Definition at line 430 of file CSCEventData.cc.

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

Referenced by add(), and addAnodeALCTShower().

430  {
431  if (theAnodeData == nullptr) {
432  assert(theChamberType > 0);
438  // set data available flag
440  }
441 }
unsigned short size() const
size of the data buffer used, in bytes
Definition: CSCEventData.h:39
unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
Definition: CSCAnodeData.h:18
assert(be >=bs)
void setEventInformation(const CSCDMBHeader &)
static int sizeInWords()
in 16-bit frames
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
int sizeInWords()
in 16-bit words
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:161
unsigned short int alctFirmwareVersion() const
void addNALCT()
Definition: CSCDMBHeader.h:26
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:160

◆ checkTMBClasses()

void CSCEventData::checkTMBClasses ( )
private

makes new TMB classes, if needed

Definition at line 443 of file CSCEventData.cc.

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

Referenced by add(), addAnodeShower(), addCathodeShower(), and addShower().

443  {
444  int nCFEBs = CSCConstants::MAX_CFEBS_RUN1;
445  if ((theFormatVersion >= 2013) && ((theChamberType == 1) || (theChamberType == 2))) {
447  }
448  if (theTMBData == nullptr) {
449  if (theFormatVersion == 2013) { // Set to TMB format for Post-LS1/Run2 data
450  theTMBData = new CSCTMBData(2013, 0x7a76, nCFEBs);
451  } else if (theFormatVersion == 2020) { // Set to TMB format for Run3 data
452  if ((theChamberType == 1) || (theChamberType == 2)) {
453  theTMBData = new CSCTMBData(2020, 0x602, nCFEBs); // ME11 GEM fw
454  } else {
455  theTMBData = new CSCTMBData(2020, 0x403); // MEx1 CCLUT fw
456  }
457  } else {
458  theTMBData = new CSCTMBData(2007, 0x50c3);
459  }
462  }
463  theTMBData->tmbHeader()->setNCFEBs(nCFEBs);
464 }
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:38
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:179
void addNCLCT()
Definition: CSCDMBHeader.h:24
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154
void setNCFEBs(uint16_t ncfebs)
Definition: CSCTMBHeader.h:75
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:40

◆ comparatorData()

CSCComparatorData * CSCEventData::comparatorData ( ) const

user must check if nclct > 0

Definition at line 399 of file CSCEventData.cc.

References CSCTMBData::comparatorData(), Exception, nclct(), and tmbData().

399  {
400  if ((nclct() == 0) || (tmbData() == nullptr))
401  throw cms::Exception("No CLCT data for this chamber");
402  return tmbData()->comparatorData();
403 }
CSCComparatorData * comparatorData()
Definition: CSCTMBData.h:41
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:70
CSCTMBData * tmbData() const
user must check in nclct > 0

◆ copy()

void CSCEventData::copy ( const CSCEventData data)
private

Definition at line 283 of file CSCEventData.cc.

References data, init(), CSCConstants::MAX_CFEBS_RUN2, size_, theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theChamberType, theDMBHeader, theDMBTrailer, theFormatVersion, and theTMBData.

Referenced by SequenceTypes._TaskBase::copyAndAdd(), CSCEventData(), and operator=().

283  {
284  init();
285  theFormatVersion = data.theFormatVersion;
286  theDMBHeader = data.theDMBHeader;
287  theDMBTrailer = data.theDMBTrailer;
288  if (data.theALCTHeader != nullptr)
289  theALCTHeader = new CSCALCTHeader(*(data.theALCTHeader));
290  if (data.theAnodeData != nullptr)
291  theAnodeData = new CSCAnodeData(*(data.theAnodeData));
292  if (data.theALCTTrailer != nullptr)
293  theALCTTrailer = new CSCALCTTrailer(*(data.theALCTTrailer));
294  if (data.theTMBData != nullptr)
295  theTMBData = new CSCTMBData(*(data.theTMBData));
296  for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) {
297  theCFEBData[icfeb] = nullptr;
298  if (data.theCFEBData[icfeb] != nullptr)
299  theCFEBData[icfeb] = new CSCCFEBData(*(data.theCFEBData[icfeb]));
300  }
301  size_ = data.size_;
302  theChamberType = data.theChamberType;
303 }
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:179
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:165
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:167
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:161
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:160

◆ destroy()

void CSCEventData::destroy ( )
private

Definition at line 305 of file CSCEventData.cc.

References alctZSErecovered, CSCConstants::MAX_CFEBS_RUN2, theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theTMBData, and zseEnable.

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

305  {
306  if (zseEnable) {
307  delete[] alctZSErecovered;
308  }
309  delete theALCTHeader;
310  delete theAnodeData;
311  delete theALCTTrailer;
312  delete theTMBData;
313  for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) {
314  delete theCFEBData[icfeb];
315  }
316  /*
317  std::cout << "Before delete alctZSErecovered " << std::endl;
318  delete [] alctZSErecovered;
319  std::cout << "After delete alctZSErecovered " << std::endl;
320  */
321 }
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:175
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:165
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:161
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:160

◆ dmbHeader() [1/2]

const CSCDMBHeader* CSCEventData::dmbHeader ( ) const
inline

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

Definition at line 73 of file CSCEventData.h.

References theDMBHeader.

Referenced by CSCDigiToRaw::findEventData().

73 { return &theDMBHeader; }
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154

◆ dmbHeader() [2/2]

CSCDMBHeader* CSCEventData::dmbHeader ( )
inline

Definition at line 74 of file CSCEventData.h.

References theDMBHeader.

74 { return &theDMBHeader; }
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154

◆ dmbTrailer()

const CSCDMBTrailer* CSCEventData::dmbTrailer ( ) const
inline

DMB trailer.

Definition at line 95 of file CSCEventData.h.

References theDMBTrailer.

Referenced by pack().

95 { return &theDMBTrailer; }
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:167

◆ getFormatVersion()

uint16_t CSCEventData::getFormatVersion ( ) const
inline

Definition at line 126 of file CSCEventData.h.

References theFormatVersion.

126 { return theFormatVersion; }
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:179

◆ init()

void CSCEventData::init ( void  )
private

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

Definition at line 270 of file CSCEventData.cc.

References alctZSErecovered, CSCConstants::MAX_CFEBS_RUN2, theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theTMBData, and zseEnable.

Referenced by copy(), and unpack_data().

270  {
271  //dataPresent = 0;
272  theALCTHeader = nullptr;
273  theAnodeData = nullptr;
274  theALCTTrailer = nullptr;
275  theTMBData = nullptr;
276  for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) {
277  theCFEBData[icfeb] = nullptr;
278  }
279  alctZSErecovered = nullptr;
280  zseEnable = 0;
281 }
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:175
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:165
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:161
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:160

◆ isALCT()

bool CSCEventData::isALCT ( const uint16_t *  buf)

if dealing with ALCT data

Definition at line 252 of file CSCEventData.cc.

References visDQMUpload::buf.

Referenced by unpack_data().

252  {
253  return (((buf[0] & 0xFFFF) == 0xDB0A) || (((buf[0] & 0xF800) == 0x6000) && ((buf[1] & 0xF800) == 0)));
254 }

◆ isTMB()

bool CSCEventData::isTMB ( const uint16_t *  buf)

if dealing with TMB data

Definition at line 256 of file CSCEventData.cc.

References visDQMUpload::buf.

Referenced by unpack_data().

256 { return ((buf[0] & 0xFFF) == 0xB0C); }

◆ nalct()

int CSCEventData::nalct ( ) const
inline

the flag for existence of ALCT data

Definition at line 67 of file CSCEventData.h.

References CSCDMBHeader::nalct(), and theDMBHeader.

Referenced by alctData(), alctHeader(), alctTrailer(), and unpack_data().

67 { return theDMBHeader.nalct(); }
unsigned nalct() const
Definition: CSCDMBHeader.h:42
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154

◆ nclct()

int CSCEventData::nclct ( ) const
inline

the number of CLCTs

Definition at line 70 of file CSCEventData.h.

References CSCDMBHeader::nclct(), and theDMBHeader.

Referenced by comparatorData(), tmbData(), tmbHeader(), and unpack_data().

70 { return theDMBHeader.nclct(); }
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154
unsigned nclct() const
Definition: CSCDMBHeader.h:43

◆ operator=()

CSCEventData CSCEventData::operator= ( const CSCEventData data)

Definition at line 262 of file CSCEventData.cc.

References copy(), data, and destroy().

262  {
263  // check for self-assignment before destructing
264  if (&data != this)
265  destroy();
266  copy(data);
267  return *this;
268 }
void copy(const CSCEventData &)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ pack()

boost::dynamic_bitset CSCEventData::pack ( )

returns the packed event data.

Definition at line 569 of file CSCEventData.cc.

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

569  {
570  boost::dynamic_bitset<> result =
572 
573  // Container for CRC calculations
574  std::vector<std::pair<unsigned int, unsigned short*> > crcvec;
575 
576  if (theALCTHeader != nullptr) {
577  boost::dynamic_bitset<> alctHeader = theALCTHeader->pack();
579  crcvec.push_back(std::make_pair(theALCTHeader->sizeInWords(), theALCTHeader->data()));
580  }
581  if (theAnodeData != nullptr) {
582  boost::dynamic_bitset<> anodeData =
584  result = bitset_utilities::append(result, anodeData);
585  crcvec.push_back(std::make_pair(theAnodeData->sizeInWords(), theAnodeData->data()));
586  }
587  if (theALCTTrailer != nullptr) {
588  unsigned int crc = calcALCTcrc(crcvec);
589  theALCTTrailer->setCRC(crc);
590  boost::dynamic_bitset<> alctTrailer =
593  }
594  if (theTMBData != nullptr) {
596  }
597 
598  for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) {
599  if (theCFEBData[icfeb] != nullptr) {
600  boost::dynamic_bitset<> cfebData =
601  bitset_utilities::ushortToBitset(theCFEBData[icfeb]->sizeInWords() * 16, theCFEBData[icfeb]->data());
603  }
604  }
605 
606  boost::dynamic_bitset<> dmbTrailer =
609  return result;
610 }
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:165
boost::dynamic_bitset pack()
not const because it sets size int TMBTrailer
Definition: CSCTMBData.cc:444
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:61
const CSCCFEBData * cfebData(unsigned icfeb) const
unpacked in long mode: has overflow and error bits decoded
unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
Definition: CSCAnodeData.h:18
static int sizeInWords()
in 16-bit frames
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154
unsigned short * data()
Definition: CSCDMBTrailer.h:58
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
Definition: CSCEventData.h:95
boost::dynamic_bitset pack()
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:167
unsigned short * data()
int sizeInWords()
in 16-bit words
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:161
unsigned short * data()
Definition: CSCDMBHeader.h:53
unsigned sizeInWords() const
Definition: CSCDMBHeader.h:48
CSCALCTTrailer * alctTrailer() const
user must check if nalct > 0
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
CSCALCTHeader * alctHeader() const
user must check if nalct > 0
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:16
unsigned int calcALCTcrc(std::vector< std::pair< unsigned int, unsigned short *> > &vec)
void setCRC(unsigned int crc)
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:160
unsigned short int * data()

◆ selfTest()

void CSCEventData::selfTest ( )
static

Definition at line 633 of file CSCEventData.cc.

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

633  {
634  CSCEventData chamberData(5);
635  CSCDetId detId(1, 3, 2, 1, 3);
636  std::vector<CSCCLCTDigi> clctDigis;
637  // Both CLCTs are read-out at the same (pre-trigger) bx, so the last-but-one
638  // arguments in both digis must be the same.
639  clctDigis.push_back(CSCCLCTDigi(1, 1, 4, 1, 0, 30, 3, 2, 1)); // valid for 2007
640  clctDigis.push_back(CSCCLCTDigi(1, 1, 2, 1, 1, 31, 1, 2, 2));
641 
642  // BX of LCT (8th argument) is 1-bit word (the least-significant bit
643  // of ALCT's bx).
644  std::vector<CSCCorrelatedLCTDigi> corrDigis;
645  corrDigis.push_back(CSCCorrelatedLCTDigi(1, 1, 2, 10, 98, 5, 0, 1, 0, 0, 0, 0));
646  corrDigis.push_back(CSCCorrelatedLCTDigi(2, 1, 2, 20, 15, 9, 1, 0, 0, 0, 0, 0));
647 
648  chamberData.add(clctDigis);
649  chamberData.add(corrDigis);
650 
651  CSCWireDigi wireDigi(10, 6);
652  CSCComparatorDigi comparatorDigi(30, 1, 6);
653  chamberData.add(wireDigi, 3);
654  chamberData.add(comparatorDigi, 3);
655 
656  CSCEventData newData = cscPackAndUnpack(chamberData);
657 
658  std::vector<CSCCLCTDigi> clcts = newData.tmbHeader()->CLCTDigis(detId.rawId());
659  assert(cscPackerCompare(clcts[0], clctDigis[0]));
660  assert(cscPackerCompare(clcts[1], clctDigis[1]));
661 
662  std::vector<CSCCorrelatedLCTDigi> lcts = newData.tmbHeader()->CorrelatedLCTDigis(detId.rawId());
663  assert(cscPackerCompare(lcts[0], corrDigis[0]));
664  assert(cscPackerCompare(lcts[1], corrDigis[1]));
665 
666  // test strip digis
667  CSCDetId me1adet1(1, 1, 1, 4, 1);
668  CSCDetId me1bdet1(1, 1, 4, 4, 6);
669  CSCDetId me1adet2(2, 1, 1, 4, 2);
670  CSCDetId me1bdet2(2, 1, 4, 4, 5);
671 
672  std::vector<int> sca(16, 600);
673  std::vector<unsigned short> overflow(16, 0), overlap(16, 0), errorfl(16, 0);
674  CSCStripDigi me1a(5, sca, overflow, overlap, errorfl);
675  CSCStripDigi me1b(8, sca, overflow, overlap, errorfl);
676 
677  CSCEventData forward(1);
678  CSCEventData backward(1);
679 
680  forward.add(me1a, me1adet1.layer());
681  forward.add(me1b, me1bdet1.layer());
682  backward.add(me1a, me1adet2.layer());
683  backward.add(me1b, me1adet2.layer());
684  std::vector<CSCStripDigi> me1afs = forward.stripDigis(me1adet1);
685  std::vector<CSCStripDigi> me1bfs = forward.stripDigis(me1bdet1);
686  std::vector<CSCStripDigi> me1abs = backward.stripDigis(me1adet2);
687  std::vector<CSCStripDigi> me1bbs = backward.stripDigis(me1bdet2);
688  //FIXME The current code works under the assumption that ME11 and ME1A
689  // go into separate EventData. They need to be combined.
690  assert(me1afs.size() == 16);
691  assert(me1bfs.size() == 16);
692  assert(me1abs.size() == 16);
693  assert(me1bbs.size() == 16);
694 
695  assert(me1afs[4].getStrip() == 5);
696  assert(me1bfs[7].getStrip() == 8);
697  assert(me1abs[4].getStrip() == 5);
698  assert(me1bbs[7].getStrip() == 8);
699  assert(me1afs[4].pedestal() == 600);
700  assert(me1bfs[7].pedestal() == 600);
701  assert(me1abs[4].pedestal() == 600);
702  assert(me1bbs[7].pedestal() == 600);
703 }
assert(be >=bs)
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:101
bool cscPackerCompare(const T &t1, const T &t2)
T cscPackAndUnpack(T &t)
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis
Definition: CSCTMBHeader.h:104
CSCTMBHeader * tmbHeader() const
user must check if nclct > 0

◆ setDebug()

static void CSCEventData::setDebug ( const bool  value)
inlinestatic

turns on/off debug flag for this class

Definition at line 42 of file CSCEventData.h.

References debug, and relativeConstraints::value.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

42 { debug = value; }
static std::atomic< bool > debug
Definition: CSCEventData.h:133

◆ setEventInformation()

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 405 of file CSCEventData.cc.

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

405  {
406  theDMBHeader.setBXN(bxnum);
407  theDMBHeader.setL1A(lvl1num);
408  theDMBHeader.setL1A24(lvl1num);
409  if (theALCTHeader) {
411  }
412  if (theTMBData) {
414 
415  assert(theChamberType > 0);
416 
418 
419  // Set number of CFEBs to 7 for Post-LS1 ME11
420  if ((theFormatVersion >= 2013) && ((theChamberType == 1) || (theChamberType == 2))) {
422  }
423  }
424  for (unsigned cfeb = 0; cfeb < CSCConstants::MAX_CFEBS_RUN2; cfeb++) {
425  if (theCFEBData[cfeb])
426  theCFEBData[cfeb]->setL1A(lvl1num);
427  }
428 }
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:38
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:179
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:165
void setL1A(unsigned l1a)
Definition: CSCCFEBData.cc:159
void setL1A(int l1a)
Definition: CSCDMBHeader.h:28
assert(be >=bs)
void setEventInformation(const CSCDMBHeader &)
void setBXN(int bxn)
Definition: CSCDMBHeader.h:27
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154
void setNCFEBs(uint16_t ncfebs)
Definition: CSCTMBHeader.h:75
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
void setL1A24(int l1a)
Definition: CSCDMBHeader.h:29
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:40

◆ size()

unsigned short CSCEventData::size ( void  ) const
inline

size of the data buffer used, in bytes

Definition at line 39 of file CSCEventData.h.

References size_.

Referenced by ntupleDataFormat._Collection::__iter__(), ntupleDataFormat._Collection::__len__(), and checkALCTClasses().

39 { return size_; }

◆ stripDigis() [1/3]

std::vector< CSCStripDigi > CSCEventData::stripDigis ( const CSCDetId idlayer) const

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

Definition at line 323 of file CSCEventData.cc.

References CSCConstants::MAX_CFEBS_RUN2, mps_fire::result, and stripDigis().

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

323  {
324  std::vector<CSCStripDigi> result;
325  for (unsigned icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) {
326  std::vector<CSCStripDigi> newDigis = stripDigis(idlayer, icfeb);
327  result.insert(result.end(), newDigis.begin(), newDigis.end());
328  }
329  return result;
330 }
std::vector< std::vector< CSCStripDigi > > stripDigis() const
deprecated. Use the above methods instead

◆ stripDigis() [2/3]

std::vector< CSCStripDigi > CSCEventData::stripDigis ( unsigned  idlayer,
unsigned  icfeb 
) const

returns all the strip digis in the chamber's cfeb

Definition at line 332 of file CSCEventData.cc.

References CSCCFEBData::digis(), mps_fire::result, and theCFEBData.

332  {
333  std::vector<CSCStripDigi> result;
334  if (theCFEBData[icfeb] != nullptr) {
335  std::vector<CSCStripDigi> newDigis = theCFEBData[icfeb]->digis(idlayer);
336  result.insert(result.end(), newDigis.begin(), newDigis.end());
337  }
338 
339  return result;
340 }
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:165
void digis(uint32_t idlayer, std::vector< CSCStripDigi > &result) const
faster way to get to digis
Definition: CSCCFEBData.cc:202

◆ stripDigis() [3/3]

std::vector< std::vector< CSCStripDigi > > CSCEventData::stripDigis ( ) const

deprecated. Use the above methods instead

Definition at line 350 of file CSCEventData.cc.

References phase1PixelTopology::layer, CSCDetId::maxLayerId(), CSCDetId::minLayerId(), and mps_fire::result.

Referenced by stripDigis().

350  {
351  std::vector<std::vector<CSCStripDigi> > result;
353  std::vector<CSCStripDigi> digis = stripDigis(layer);
354  result.push_back(digis);
355  }
356  return result;
357 }
constexpr std::array< uint8_t, layerIndexSize > layer
static int minLayerId()
Definition: CSCDetId.h:242
std::vector< std::vector< CSCStripDigi > > stripDigis() const
deprecated. Use the above methods instead
static int maxLayerId()
Definition: CSCDetId.h:243

◆ tmbData()

CSCTMBData * CSCEventData::tmbData ( ) const

user must check in nclct > 0

Definition at line 387 of file CSCEventData.cc.

References Exception, nclct(), and theTMBData.

Referenced by comparatorData(), and tmbHeader().

387  {
388  if (nclct() == 0)
389  throw cms::Exception("No CLCT for this chamber");
390  return theTMBData;
391 }
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:70

◆ tmbHeader()

CSCTMBHeader * CSCEventData::tmbHeader ( ) const

user must check if nclct > 0

Definition at line 393 of file CSCEventData.cc.

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

Referenced by selfTest().

393  {
394  if ((nclct() == 0) || (tmbData() == nullptr))
395  throw cms::Exception("No CLCT header for this chamber");
396  return tmbData()->tmbHeader();
397 }
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:40
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:70
CSCTMBData * tmbData() const
user must check in nclct > 0

◆ unpack_data()

void CSCEventData::unpack_data ( const uint16_t *  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 39 of file CSCEventData.cc.

References CSCALCTHeader::ALCTDigis(), alctZSErecovered, visDQMUpload::buf, CSCDMBTrailer::cfeb_endtimeout(), CSCDMBTrailer::cfeb_starttimeout(), CSCDMBHeader::cfebAvailable(), CSCDMBHeader::check(), CSCALCTHeader::check(), CSCALCTHeader::data(), debug, CSCDMBHeader::format_version(), mps_fire::i, init(), createfilelist::int, isALCT(), isTMB(), dqmiolumiharvest::j, cmsLHEtoEOSManager::l, LogTrace, CSCConstants::MAX_CFEBS_RUN2, 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().

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

◆ wireDigis() [1/2]

std::vector< CSCWireDigi > CSCEventData::wireDigis ( unsigned  ilayer) const

Definition at line 342 of file CSCEventData.cc.

References theAnodeData, and CSCAnodeData::wireDigis().

Referenced by operator<<().

342  {
343  if (theAnodeData == nullptr) {
344  return std::vector<CSCWireDigi>();
345  } else {
346  return theAnodeData->wireDigis(ilayer);
347  }
348 }
std::vector< CSCWireDigi > wireDigis(int layer) const
input layer is from 1 to 6
Definition: CSCAnodeData.h:21
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:160

◆ wireDigis() [2/2]

std::vector< std::vector< CSCWireDigi > > CSCEventData::wireDigis ( ) const

deprecated. Use the above method instead.

Definition at line 359 of file CSCEventData.cc.

References phase1PixelTopology::layer, CSCDetId::maxLayerId(), CSCDetId::minLayerId(), and mps_fire::result.

359  {
360  std::vector<std::vector<CSCWireDigi> > result;
362  result.push_back(wireDigis(layer));
363  }
364  return result;
365 }
constexpr std::array< uint8_t, layerIndexSize > layer
static int minLayerId()
Definition: CSCDetId.h:242
std::vector< std::vector< CSCWireDigi > > wireDigis() const
deprecated. Use the above method instead.
static int maxLayerId()
Definition: CSCDetId.h:243

Member Data Documentation

◆ alctZSErecovered

unsigned short* CSCEventData::alctZSErecovered
private

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

Definition at line 175 of file CSCEventData.h.

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

◆ debug

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

◆ size_

int CSCEventData::size_
private

Definition at line 169 of file CSCEventData.h.

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

◆ theALCTHeader

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 159 of file CSCEventData.h.

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

◆ theALCTTrailer

CSCALCTTrailer* CSCEventData::theALCTTrailer
private

Definition at line 161 of file CSCEventData.h.

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

◆ theAnodeData

CSCAnodeData* CSCEventData::theAnodeData
private

◆ theCFEBData

CSCCFEBData* CSCEventData::theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
private

for up to MAX_CFEB CFEB boards

Definition at line 165 of file CSCEventData.h.

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

◆ theChamberType

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 172 of file CSCEventData.h.

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

◆ theDMBHeader

CSCDMBHeader CSCEventData::theDMBHeader
private

◆ theDMBTrailer

CSCDMBTrailer CSCEventData::theDMBTrailer
private

Definition at line 167 of file CSCEventData.h.

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

◆ theFormatVersion

uint16_t CSCEventData::theFormatVersion
private

Output Format Version (2005, 2013)

Definition at line 179 of file CSCEventData.h.

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

◆ theTMBData

CSCTMBData* CSCEventData::theTMBData
private

◆ zseEnable

int CSCEventData::zseEnable
private

Definition at line 176 of file CSCEventData.h.

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