CMS 3D CMS Logo

HcalDTCHeader.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 #ifndef HcalDTCHeader_H
3 #define HcalDTCHeader_H
4 
5 #include <iostream>
6 #include <cstdint>
8 class HcalHTRData;
9 
19 public:
20  static const int SLOT_COUNT;
21  static const int MINIMUM_SLOT;
22  static const int MAXIMUM_SLOT;
23 
24  HcalDTCHeader();
25 
27  unsigned int getTotalLengthBytes() const;
28 
30 
31  inline bool thereIsASecondCDFHeaderWord() const { return ((commondataformat0 >> 3) & 0x0001); }
33  inline short getCDFversionNumber() const { return ((commondataformat0 >> 4) & 0x0F); }
35  inline int getSourceId() const { return (commondataformat0 >> 8) & 0xFFF; }
37  inline int getBunchId() const { return (commondataformat0 >> 20) & 0xFFF; }
39  inline unsigned long getDTCEventNumber() const { return (commondataformat1 & 0x00FFFFFF); }
41  inline unsigned short getCDFEventType() const { return ((commondataformat1 >> 24) & 0x0F); }
43  inline unsigned short BOEshouldBe5Always() const { return ((commondataformat1 >> 28) & 0x0F); }
44 
46 
47  inline bool thereIsAThirdCDFHeaderWord() const { return ((commondataformat2 >> 3) & 0x0001); }
49  inline unsigned int getOrbitNumber() const { return (((commondataformat3 & 0xF) << 28) + (commondataformat2 >> 4)); }
51  inline unsigned int getSlink64ReservedBits() const { return ((commondataformat3 >> 4) & 0x00FFFFFF); }
53  inline short BOEshouldBeZeroAlways() const { return ((commondataformat3 >> 28) & 0x0F); }
54 
56  inline bool isCalibType() const { return (0 != getCalibType()); }
58  return HcalCalibrationEventType((commondataformat3 >> 24) & 0x0000000F);
59  }
60 
62  inline short getDTCDataFormatVersion() const { return (dcch0 & 0xFF); }
63  inline int nSlotWords() const { return ((dcch0 >> 20) & 0x0000000F); }
64  inline int nDTCWords() const { return ((dcch0 >> 8) & 0x00000FFF); }
65 
67  inline int getSlotSummary(int nslot) const { return slotInfo[nslot]; }
68 
73  int getSlotData(int nslot, HcalHTRData& decodeTool, int validSize) const;
74 
76  inline unsigned int getSlotDataLength(int nslot) const {
77  return (nslot < 1 || nslot > 12) ? (0) : (slotInfo[nslot - 1] & 0xfff);
78  }
79 
81  inline bool getSlotEnabled(unsigned int nslot) const {
82  return (nslot < 1 || nslot > 12) ? (false) : (slotInfo[nslot - 1] & 0x8000);
83  }
85  inline bool getSlotPresent(unsigned int nslot) const {
86  return (nslot < 1 || nslot > 12) ? (false) : (slotInfo[nslot - 1] & 0x4000);
87  }
89  inline bool getSlotValid(unsigned int nslot) const {
90  return (nslot < 1 || nslot > 12) ? (false) : (slotInfo[nslot - 1] & 0x2000);
91  }
93  inline bool getSlotCRCError(unsigned int nslot) const {
94  return (nslot < 1 || nslot > 12) ? (false) : (slotInfo[nslot - 1] & 0x1000);
95  }
96 
97  /* (for packing only) */
104  void copySlotData(unsigned int slot_id, const HcalHTRData& data, bool valid = true);
105 
107  void clear();
109  void setHeader(int sourceid, int bcn, int l1aN, int orbN);
110 
111 private:
112  // CURRENTLY VALID FOR LITTLE-ENDIAN (LINUX/x86) ONLY
117  uint32_t dcch0;
118  uint32_t dcch1;
119  uint16_t slotInfo[12];
120 };
121 
122 std::ostream& operator<<(std::ostream&, const HcalDTCHeader& head);
123 
124 #endif
HcalDTCHeader::MAXIMUM_SLOT
static const int MAXIMUM_SLOT
Definition: HcalDTCHeader.h:22
HcalDTCHeader::getSlotPresent
bool getSlotPresent(unsigned int nslot) const
Read the "PRESENT" bit for this slot.
Definition: HcalDTCHeader.h:85
HcalDTCHeader::BOEshouldBeZeroAlways
short BOEshouldBeZeroAlways() const
Definition: HcalDTCHeader.h:53
HcalCalibrationEventTypes.h
HcalDTCHeader::getSlotData
int getSlotData(int nslot, HcalHTRData &decodeTool, int validSize) const
Definition: HcalDTCHeader.cc:22
HcalDTCHeader::MINIMUM_SLOT
static const int MINIMUM_SLOT
Definition: HcalDTCHeader.h:21
HcalDTCHeader::getDTCDataFormatVersion
short getDTCDataFormatVersion() const
Definition: HcalDTCHeader.h:62
HcalDTCHeader::getBunchId
int getBunchId() const
Definition: HcalDTCHeader.h:37
HcalDTCHeader::getTotalLengthBytes
unsigned int getTotalLengthBytes() const
Definition: HcalDTCHeader.cc:15
HcalDTCHeader::BOEshouldBe5Always
unsigned short BOEshouldBe5Always() const
Definition: HcalDTCHeader.h:43
HcalDTCHeader::getCDFEventType
unsigned short getCDFEventType() const
Definition: HcalDTCHeader.h:41
HcalDTCHeader::getSlotDataLength
unsigned int getSlotDataLength(int nslot) const
Definition: HcalDTCHeader.h:76
HcalDTCHeader::copySlotData
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!
Definition: HcalDTCHeader.cc:53
HcalDTCHeader::clear
void clear()
Definition: HcalDTCHeader.cc:37
HcalDTCHeader::thereIsAThirdCDFHeaderWord
bool thereIsAThirdCDFHeaderWord() const
Definition: HcalDTCHeader.h:47
HcalDTCHeader::dcch0
uint32_t dcch0
Definition: HcalDTCHeader.h:117
HcalDTCHeader::getCalibType
HcalCalibrationEventType getCalibType() const
Definition: HcalDTCHeader.h:57
HcalDTCHeader::isCalibType
bool isCalibType() const
Definition: HcalDTCHeader.h:56
HcalDTCHeader::nSlotWords
int nSlotWords() const
Definition: HcalDTCHeader.h:63
HcalDTCHeader::SLOT_COUNT
static const int SLOT_COUNT
Definition: HcalDTCHeader.h:20
HcalCalibrationEventType
HcalCalibrationEventType
Definition: HcalCalibrationEventTypes.h:4
HcalDTCHeader::getSlotCRCError
bool getSlotCRCError(unsigned int nslot) const
Read the "CRC-Mismatch" bit for this slot.
Definition: HcalDTCHeader.h:93
HcalDTCHeader::getSlotEnabled
bool getSlotEnabled(unsigned int nslot) const
Read the "ENABLED" bit for this slot.
Definition: HcalDTCHeader.h:81
HcalDTCHeader::getOrbitNumber
unsigned int getOrbitNumber() const
Definition: HcalDTCHeader.h:49
HcalDTCHeader::getSlink64ReservedBits
unsigned int getSlink64ReservedBits() const
Definition: HcalDTCHeader.h:51
HcalDTCHeader::commondataformat2
uint32_t commondataformat2
Definition: HcalDTCHeader.h:115
HcalDTCHeader::getSlotValid
bool getSlotValid(unsigned int nslot) const
Read the "VALID" bit for this slot; TTC EvN matched HTR EvN.
Definition: HcalDTCHeader.h:89
HcalDTCHeader::getCDFversionNumber
short getCDFversionNumber() const
Definition: HcalDTCHeader.h:33
HcalDTCHeader::setHeader
void setHeader(int sourceid, int bcn, int l1aN, int orbN)
Definition: HcalDTCHeader.cc:48
HcalDTCHeader::commondataformat1
uint32_t commondataformat1
Definition: HcalDTCHeader.h:114
HcalDTCHeader::thereIsASecondCDFHeaderWord
bool thereIsASecondCDFHeaderWord() const
Definition: HcalDTCHeader.h:31
HcalDTCHeader::commondataformat3
uint32_t commondataformat3
Definition: HcalDTCHeader.h:116
HcalDTCHeader::HcalDTCHeader
HcalDTCHeader()
Definition: HcalDTCHeader.cc:13
HcalDTCHeader::getSlotSummary
int getSlotSummary(int nslot) const
Definition: HcalDTCHeader.h:67
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
HcalDTCHeader::dcch1
uint32_t dcch1
Definition: HcalDTCHeader.h:118
HcalDTCHeader::slotInfo
uint16_t slotInfo[12]
Definition: HcalDTCHeader.h:119
HcalDTCHeader::commondataformat0
uint32_t commondataformat0
Definition: HcalDTCHeader.h:113
HcalDTCHeader::nDTCWords
int nDTCWords() const
Definition: HcalDTCHeader.h:64
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
HcalHTRData
Definition: HcalHTRData.h:16
HcalDTCHeader::getSourceId
int getSourceId() const
Definition: HcalDTCHeader.h:35
HcalDTCHeader
Definition: HcalDTCHeader.h:18
HcalDTCHeader::getDTCEventNumber
unsigned long getDTCEventNumber() const
Definition: HcalDTCHeader.h:39
operator<<
std::ostream & operator<<(std::ostream &, const HcalDTCHeader &head)
Definition: HcalDTCHeader.cc:76