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 Attributes | Private Attributes
HcalDTCHeader Class Reference

#include <HcalDTCHeader.h>

Public Member Functions

unsigned short BOEshouldBe5Always () const
 
short BOEshouldBeZeroAlways () const
 
void clear ()
 
void copySlotData (unsigned int slot_id, const HcalHTRData &data, bool valid=true)
 Add the given HcalHTRData as the given slot's data. This should be done in increasing slot order! More...
 
int getBunchId () const
 
HcalCalibrationEventType getCalibType () const
 
unsigned short getCDFEventType () const
 
short getCDFversionNumber () const
 
short getDTCDataFormatVersion () const
 
unsigned long getDTCEventNumber () const
 
unsigned int getOrbitNumber () const
 
unsigned int getSlink64ReservedBits () const
 
bool getSlotCRCError (unsigned int nslot) const
 Read the "CRC-Mismatch" bit for this slot. More...
 
int getSlotData (int nslot, HcalHTRData &decodeTool, int validSize) const
 
unsigned int getSlotDataLength (int nslot) const
 
bool getSlotEnabled (unsigned int nslot) const
 Read the "ENABLED" bit for this slot. More...
 
bool getSlotPresent (unsigned int nslot) const
 Read the "PRESENT" bit for this slot. More...
 
int getSlotSummary (int nslot) const
 
bool getSlotValid (unsigned int nslot) const
 Read the "VALID" bit for this slot; TTC EvN matched HTR EvN. More...
 
int getSourceId () const
 
unsigned int getTotalLengthBytes () const
 
 HcalDTCHeader ()
 
bool isCalibType () const
 
int nDTCWords () const
 
int nSlotWords () const
 
void setHeader (int sourceid, int bcn, int l1aN, int orbN)
 
bool thereIsASecondCDFHeaderWord () const
 
bool thereIsAThirdCDFHeaderWord () const
 

Static Public Attributes

static const int MAXIMUM_SLOT = 12
 
static const int MINIMUM_SLOT = 1
 
static const int SLOT_COUNT = 12
 

Private Attributes

uint32_t commondataformat0
 
uint32_t commondataformat1
 
uint32_t commondataformat2
 
uint32_t commondataformat3
 
uint32_t dcch0
 
uint32_t dcch1
 
uint16_t slotInfo [12]
 

Detailed Description

Interpretive class for the header of a FED-format data block from the DTC – the uTCA DAQ and timing card also called an AMC13

Author
J. Mans - UMD

Definition at line 18 of file HcalDTCHeader.h.

Constructor & Destructor Documentation

HcalDTCHeader::HcalDTCHeader ( )

Definition at line 13 of file HcalDTCHeader.cc.

Referenced by copySlotData(), getSlotData(), and getTotalLengthBytes().

13 { }

Member Function Documentation

unsigned short HcalDTCHeader::BOEshouldBe5Always ( ) const
inline

Get the inviolable '5' in the highest 4 bits of the CDF header.

Definition at line 43 of file HcalDTCHeader.h.

References commondataformat1.

43 { return ( (commondataformat1>>28) & 0x0F ); }
uint32_t commondataformat1
short HcalDTCHeader::BOEshouldBeZeroAlways ( ) const
inline

Get the Beginning Of Event bits. If it's not the first or last CDF Slink64 word, the high 4 bits must be zero.

Definition at line 53 of file HcalDTCHeader.h.

References commondataformat3.

53 { return ( (commondataformat3>>28) & 0x0F); }
uint32_t commondataformat3
void HcalDTCHeader::clear ( void  )

clear the contents of this header

Definition at line 35 of file HcalDTCHeader.cc.

References commondataformat0, commondataformat1, commondataformat2, commondataformat3, dcch0, dcch1, i, SLOT_COUNT, and slotInfo.

Referenced by Vispa.Views.WidgetView.WidgetView::closeEvent(), Vispa.Views.BoxDecayView.BoxDecayView::closeEvent(), Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), Vispa.Views.LineDecayView.LineDecayView::setDataObjects(), Vispa.Views.WidgetView.WidgetView::setDataObjects(), Vispa.Views.TreeView.TreeView::updateContent(), Vispa.Views.TableView.TableView::updateContent(), Vispa.Views.BoxDecayView.BoxDecayView::updateContent(), and Vispa.Views.PropertyView.PropertyView::updateContent().

35  {
37  commondataformat1=0x50000000u;
40  dcch0=0x1; // format version 1
41  dcch1=0;
42  for (int i=0; i<SLOT_COUNT; i++)
43  slotInfo[i]=0;
44 }
int i
Definition: DBlmapReader.cc:9
uint16_t slotInfo[12]
uint32_t commondataformat0
uint32_t commondataformat2
uint32_t dcch1
uint32_t commondataformat1
uint32_t dcch0
uint32_t commondataformat3
static const int SLOT_COUNT
Definition: HcalDTCHeader.h:20
void HcalDTCHeader::copySlotData ( unsigned int  slot_id,
const HcalHTRData data,
bool  valid = true 
)

Add the given HcalHTRData as the given slot's data. This should be done in increasing slot order!

Parameters
slot_id
slot_data
validflag
LRB_error_word

Definition at line 51 of file HcalDTCHeader.cc.

References HcalHTRData::getRawData(), HcalHTRData::getRawLength(), getSlotDataLength(), HcalDTCHeader(), i, SLOT_COUNT, and slotInfo.

51  {
52  if (slot_id==0 || slot_id>(unsigned int)SLOT_COUNT) return;
53  // construct the slot info
54  slotInfo[slot_id-1]=(data.getRawLength())|0xc000;
55  if (valid) slotInfo[slot_id-1]|=0x2000;
56  // status info...
57  // if (valid) dcch0|=(1<<(slot_id+14));
58  // copy
59  unsigned int lenSoFar=0;
60  for (unsigned int i=1; i<slot_id; i++) lenSoFar+=getSlotDataLength(i);
61  unsigned short* startingPoint=((unsigned short*)this)+sizeof(HcalDTCHeader)/sizeof(unsigned short)+lenSoFar;
62  memcpy(startingPoint,data.getRawData(),sizeof(unsigned short)*data.getRawLength());
63  // update the trailer...
64  lenSoFar+=data.getRawLength();
65  uint32_t* trailer=((uint32_t*)this)+sizeof(HcalDTCHeader)/sizeof(uint32_t)+lenSoFar/2;
66  int len64=sizeof(HcalDTCHeader)/8+lenSoFar/4+1;
67  trailer[1]=0;
68  trailer[0]=0xA0000000u|len64;
69 }
int i
Definition: DBlmapReader.cc:9
uint16_t slotInfo[12]
const int getRawLength() const
Get the length of the raw data.
Definition: HcalHTRData.h:39
const unsigned short * getRawData() const
Get a pointer to the raw data.
Definition: HcalHTRData.h:36
unsigned int getSlotDataLength(int nslot) const
Definition: HcalDTCHeader.h:75
static const int SLOT_COUNT
Definition: HcalDTCHeader.h:20
int HcalDTCHeader::getBunchId ( ) const
inline

get the bunch id from the CDF header

Definition at line 37 of file HcalDTCHeader.h.

References commondataformat0.

37 { return (commondataformat0>>20)&0xFFF; }
uint32_t commondataformat0
HcalCalibrationEventType HcalDTCHeader::getCalibType ( ) const
inline

Definition at line 57 of file HcalDTCHeader.h.

References commondataformat3.

Referenced by isCalibType().

57 { return HcalCalibrationEventType ((commondataformat3>>24)&0x0000000F);}
HcalCalibrationEventType
uint32_t commondataformat3
unsigned short HcalDTCHeader::getCDFEventType ( ) const
inline

Get the Event Type value (2007.11.03 - Not defined, but should stay consistent among events.)

Definition at line 41 of file HcalDTCHeader.h.

References commondataformat1.

41 { return ( (commondataformat1>>24) & 0x0F ); }
uint32_t commondataformat1
short HcalDTCHeader::getCDFversionNumber ( ) const
inline

Get the Format Version of the Common Data Format

Definition at line 33 of file HcalDTCHeader.h.

References commondataformat0.

33 {return ((commondataformat0>>4) & 0x0F); }
uint32_t commondataformat0
short HcalDTCHeader::getDTCDataFormatVersion ( ) const
inline

Definition at line 60 of file HcalDTCHeader.h.

References dcch0.

60 { return (dcch0 & 0xFF); }
uint32_t dcch0
unsigned long HcalDTCHeader::getDTCEventNumber ( ) const
inline

get the Event Number from the CDF header

Definition at line 39 of file HcalDTCHeader.h.

References commondataformat1.

39 { return (commondataformat1 & 0x00FFFFFF); }
uint32_t commondataformat1
unsigned int HcalDTCHeader::getOrbitNumber ( ) const
inline

Get the Orbit Number from the CDF.

Definition at line 49 of file HcalDTCHeader.h.

References commondataformat2, and commondataformat3.

49 { return ( ((commondataformat3 && 0xF) << 28) + ( commondataformat2>>4) ); }
uint32_t commondataformat2
uint32_t commondataformat3
unsigned int HcalDTCHeader::getSlink64ReservedBits ( ) const
inline

get the (undefined) 'Reserved' part of the second Slink64 CDF word

Definition at line 51 of file HcalDTCHeader.h.

References commondataformat3.

51 { return ( (commondataformat3>>4)&0x00FFFFFF ); }
uint32_t commondataformat3
bool HcalDTCHeader::getSlotCRCError ( unsigned int  nslot) const
inline

Read the "CRC-Mismatch" bit for this slot.

Definition at line 84 of file HcalDTCHeader.h.

References slotInfo.

Referenced by operator<<(), and HcalUnpacker::unpackVME().

84 { return (nslot<1 || nslot>12)?(false):(slotInfo[nslot-1]&0x1000); }
uint16_t slotInfo[12]
int HcalDTCHeader::getSlotData ( int  nslot,
HcalHTRData decodeTool,
int  validSize 
) const

Load the given decoder with the pointer and length from this slot Returns 0 on success Returns -1 if slot points to data area beyond validSize

Definition at line 22 of file HcalDTCHeader.cc.

References HcalHTRData::adoptData(), newFWLiteAna::base, HcalDTCHeader(), i, hltrates_dqm_sourceclient-live_cfg::offset, and slotInfo.

Referenced by HcalUnpacker::unpackVME().

22  {
23  const unsigned short* base=((unsigned short*)this)+sizeof(HcalDTCHeader)/sizeof(unsigned short);
24  int offset=0,i,len=0;
25  for (i=1; i<=nslot; i++) {
26  offset+=len;
27  len=(slotInfo[i-1]&0xFFF);
28  }
29  if ((offset+len+sizeof(HcalDTCHeader)/sizeof(unsigned short))<(validSize/sizeof(unsigned short))) {
30  decodeTool.adoptData(base+offset,len);
31  return 0;
32  } else { return -1; }
33 }
tuple base
Main Program
Definition: newFWLiteAna.py:92
int i
Definition: DBlmapReader.cc:9
uint16_t slotInfo[12]
void adoptData(const unsigned short *data, int length)
Definition: HcalHTRData.cc:47
unsigned int HcalDTCHeader::getSlotDataLength ( int  nslot) const
inline

Get the size (in 16-bit words) of the data from this slot

Definition at line 75 of file HcalDTCHeader.h.

References slotInfo.

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

75 { return (nslot<1 || nslot>12)?(0):(slotInfo[nslot-1]&0xfff); }
uint16_t slotInfo[12]
bool HcalDTCHeader::getSlotEnabled ( unsigned int  nslot) const
inline

Read the "ENABLED" bit for this slot.

Definition at line 78 of file HcalDTCHeader.h.

References slotInfo.

Referenced by operator<<().

78 { return (nslot<1 || nslot>12)?(false):(slotInfo[nslot-1]&0x8000); }
uint16_t slotInfo[12]
bool HcalDTCHeader::getSlotPresent ( unsigned int  nslot) const
inline

Read the "PRESENT" bit for this slot.

Definition at line 80 of file HcalDTCHeader.h.

References slotInfo.

Referenced by operator<<(), and HcalUnpacker::unpackVME().

80 { return (nslot<1 || nslot>12)?(false):(slotInfo[nslot-1]&0x4000); }
uint16_t slotInfo[12]
int HcalDTCHeader::getSlotSummary ( int  nslot) const
inline

Get a given slot summary from the DTC Header

Definition at line 65 of file HcalDTCHeader.h.

References slotInfo.

65 { return slotInfo[nslot]; }
uint16_t slotInfo[12]
bool HcalDTCHeader::getSlotValid ( unsigned int  nslot) const
inline

Read the "VALID" bit for this slot; TTC EvN matched HTR EvN.

Definition at line 82 of file HcalDTCHeader.h.

References slotInfo.

Referenced by operator<<().

82 { return (nslot<1 || nslot>12)?(false):(slotInfo[nslot-1]&0x2000); }
uint16_t slotInfo[12]
int HcalDTCHeader::getSourceId ( ) const
inline

get the source id from the CDF header

Definition at line 35 of file HcalDTCHeader.h.

References commondataformat0.

Referenced by HcalUnpacker::unpackVME().

35 { return (commondataformat0>>8)&0xFFF; }
uint32_t commondataformat0
unsigned int HcalDTCHeader::getTotalLengthBytes ( ) const

Determine the expected total length of this packet in bytes

Definition at line 15 of file HcalDTCHeader.cc.

References HcalDTCHeader(), i, SLOT_COUNT, and slotInfo.

15  {
16  unsigned int totalSize=sizeof(HcalDTCHeader);
17  for (int i=0; i<SLOT_COUNT; i++)
18  totalSize+=(slotInfo[i]&0xFFF)*sizeof(uint16_t);
19  return totalSize;
20 }
int i
Definition: DBlmapReader.cc:9
uint16_t slotInfo[12]
static const int SLOT_COUNT
Definition: HcalDTCHeader.h:20
bool HcalDTCHeader::isCalibType ( ) const
inline

Get the Calibration Type

Definition at line 56 of file HcalDTCHeader.h.

References getCalibType().

56 { return ( 0 != getCalibType ());}
HcalCalibrationEventType getCalibType() const
Definition: HcalDTCHeader.h:57
int HcalDTCHeader::nDTCWords ( ) const
inline

Definition at line 62 of file HcalDTCHeader.h.

References dcch0.

62 { return ((dcch0>>8)& 0x00000FFF); }
uint32_t dcch0
int HcalDTCHeader::nSlotWords ( ) const
inline

Definition at line 61 of file HcalDTCHeader.h.

References dcch0.

61 { return ((dcch0>>20)& 0x0000000F); }
uint32_t dcch0
void HcalDTCHeader::setHeader ( int  sourceid,
int  bcn,
int  l1aN,
int  orbN 
)

setup the header

Definition at line 46 of file HcalDTCHeader.cc.

References commondataformat0, and commondataformat1.

46  {
47  commondataformat0=0x8|((sourceid&0xFFF)<<8)|((bcn&0xFFF)<<20);
48  commondataformat1=0x50000000u|(l1aN&0xFFFFFF);
49 }
uint32_t commondataformat0
uint32_t commondataformat1
bool HcalDTCHeader::thereIsASecondCDFHeaderWord ( ) const
inline

get the bit indicating that another CDF header Slink64 word follows the first one.

Definition at line 31 of file HcalDTCHeader.h.

References commondataformat0.

31 {return ((commondataformat0>>3) & 0x0001); }
uint32_t commondataformat0
bool HcalDTCHeader::thereIsAThirdCDFHeaderWord ( ) const
inline

Check the third bit of second Slink64 CDF word

Definition at line 47 of file HcalDTCHeader.h.

References commondataformat2.

47 {return ((commondataformat2>>3) & 0x0001); }
uint32_t commondataformat2

Member Data Documentation

uint32_t HcalDTCHeader::commondataformat0
private
uint32_t HcalDTCHeader::commondataformat1
private
uint32_t HcalDTCHeader::commondataformat2
private

Definition at line 104 of file HcalDTCHeader.h.

Referenced by clear(), getOrbitNumber(), and thereIsAThirdCDFHeaderWord().

uint32_t HcalDTCHeader::commondataformat3
private
uint32_t HcalDTCHeader::dcch0
private

Definition at line 106 of file HcalDTCHeader.h.

Referenced by clear(), getDTCDataFormatVersion(), nDTCWords(), and nSlotWords().

uint32_t HcalDTCHeader::dcch1
private

Definition at line 107 of file HcalDTCHeader.h.

Referenced by clear().

const int HcalDTCHeader::MAXIMUM_SLOT = 12
static

Definition at line 22 of file HcalDTCHeader.h.

Referenced by HcalUnpacker::unpackVME().

const int HcalDTCHeader::MINIMUM_SLOT = 1
static

Definition at line 21 of file HcalDTCHeader.h.

const int HcalDTCHeader::SLOT_COUNT = 12
static

Definition at line 20 of file HcalDTCHeader.h.

Referenced by clear(), copySlotData(), getTotalLengthBytes(), and operator<<().

uint16_t HcalDTCHeader::slotInfo[12]
private