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
void copySlotData(unsigned int slot_id, const HcalHTRData &data, bool valid=true)
Add the given HcalHTRData as the given slot&#39;s data. This should be done in increasing slot order! ...
std::ostream & operator<<(std::ostream &, const HcalDTCHeader &head)
bool thereIsAThirdCDFHeaderWord() const
Definition: HcalDTCHeader.h:47
int getSourceId() const
Definition: HcalDTCHeader.h:35
int nSlotWords() const
Definition: HcalDTCHeader.h:63
bool getSlotEnabled(unsigned int nslot) const
Read the "ENABLED" bit for this slot.
Definition: HcalDTCHeader.h:81
uint16_t slotInfo[12]
static const int MINIMUM_SLOT
Definition: HcalDTCHeader.h:21
HcalCalibrationEventType
short getCDFversionNumber() const
Definition: HcalDTCHeader.h:33
uint32_t commondataformat0
unsigned short getCDFEventType() const
Definition: HcalDTCHeader.h:41
unsigned int getSlink64ReservedBits() const
Definition: HcalDTCHeader.h:51
int nDTCWords() const
Definition: HcalDTCHeader.h:64
unsigned short BOEshouldBe5Always() const
Definition: HcalDTCHeader.h:43
uint32_t commondataformat2
int getSlotSummary(int nslot) const
Definition: HcalDTCHeader.h:67
uint32_t dcch1
bool getSlotCRCError(unsigned int nslot) const
Read the "CRC-Mismatch" bit for this slot.
Definition: HcalDTCHeader.h:93
bool getSlotPresent(unsigned int nslot) const
Read the "PRESENT" bit for this slot.
Definition: HcalDTCHeader.h:85
unsigned int getTotalLengthBytes() const
bool thereIsASecondCDFHeaderWord() const
Definition: HcalDTCHeader.h:31
unsigned int getSlotDataLength(int nslot) const
Definition: HcalDTCHeader.h:76
uint32_t commondataformat1
unsigned long getDTCEventNumber() const
Definition: HcalDTCHeader.h:39
uint32_t dcch0
bool isCalibType() const
Definition: HcalDTCHeader.h:56
short BOEshouldBeZeroAlways() const
Definition: HcalDTCHeader.h:53
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
uint32_t commondataformat3
int getSlotData(int nslot, HcalHTRData &decodeTool, int validSize) const
short getDTCDataFormatVersion() const
Definition: HcalDTCHeader.h:62
HcalCalibrationEventType getCalibType() const
Definition: HcalDTCHeader.h:57
bool getSlotValid(unsigned int nslot) const
Read the "VALID" bit for this slot; TTC EvN matched HTR EvN.
Definition: HcalDTCHeader.h:89
int getBunchId() const
Definition: HcalDTCHeader.h:37
unsigned int getOrbitNumber() const
Definition: HcalDTCHeader.h:49
static const int SLOT_COUNT
Definition: HcalDTCHeader.h:20
static const int MAXIMUM_SLOT
Definition: HcalDTCHeader.h:22
void setHeader(int sourceid, int bcn, int l1aN, int orbN)