CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <stdint.h>
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 
60  inline short getDTCDataFormatVersion() const { return (dcch0 & 0xFF); }
61  inline int nSlotWords() const { return ((dcch0>>20)& 0x0000000F); }
62  inline int nDTCWords() const { return ((dcch0>>8)& 0x00000FFF); }
63 
65  inline int getSlotSummary(int nslot) const { return slotInfo[nslot]; }
66 
71  int getSlotData(int nslot, HcalHTRData& decodeTool, int validSize) const;
72 
73 
75  inline unsigned int getSlotDataLength(int nslot) const { return (nslot<1 || nslot>12)?(0):(slotInfo[nslot-1]&0xfff); }
76 
78  inline bool getSlotEnabled(unsigned int nslot) const { return (nslot<1 || nslot>12)?(false):(slotInfo[nslot-1]&0x8000); }
80  inline bool getSlotPresent(unsigned int nslot) const { return (nslot<1 || nslot>12)?(false):(slotInfo[nslot-1]&0x4000); }
82  inline bool getSlotValid(unsigned int nslot) const { return (nslot<1 || nslot>12)?(false):(slotInfo[nslot-1]&0x2000); }
84  inline bool getSlotCRCError(unsigned int nslot) const { return (nslot<1 || nslot>12)?(false):(slotInfo[nslot-1]&0x1000); }
85 
86  /* (for packing only) */
93  void copySlotData(unsigned int slot_id, const HcalHTRData& data, bool valid=true);
94 
96  void clear();
98  void setHeader(int sourceid, int bcn, int l1aN, int orbN);
99 
100  private:
101  // CURRENTLY VALID FOR LITTLE-ENDIAN (LINUX/x86) ONLY
106  uint32_t dcch0;
107  uint32_t dcch1;
108  uint16_t slotInfo[12];
109 
110 };
111 
112 std::ostream& operator<<(std::ostream&, const HcalDTCHeader& head);
113 
114 #endif
int getSourceId() const
Definition: HcalDTCHeader.h:35
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! ...
unsigned int getSlink64ReservedBits() const
Definition: HcalDTCHeader.h:51
unsigned short getCDFEventType() const
Definition: HcalDTCHeader.h:41
bool thereIsAThirdCDFHeaderWord() const
Definition: HcalDTCHeader.h:47
unsigned long getDTCEventNumber() const
Definition: HcalDTCHeader.h:39
uint16_t slotInfo[12]
static const int MINIMUM_SLOT
Definition: HcalDTCHeader.h:21
short getCDFversionNumber() const
Definition: HcalDTCHeader.h:33
bool thereIsASecondCDFHeaderWord() const
Definition: HcalDTCHeader.h:31
HcalCalibrationEventType
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
uint32_t commondataformat0
short BOEshouldBeZeroAlways() const
Definition: HcalDTCHeader.h:53
int nSlotWords() const
Definition: HcalDTCHeader.h:61
uint32_t commondataformat2
unsigned short BOEshouldBe5Always() const
Definition: HcalDTCHeader.h:43
int getBunchId() const
Definition: HcalDTCHeader.h:37
uint32_t dcch1
bool getSlotValid(unsigned int nslot) const
Read the &quot;VALID&quot; bit for this slot; TTC EvN matched HTR EvN.
Definition: HcalDTCHeader.h:82
int nDTCWords() const
Definition: HcalDTCHeader.h:62
bool getSlotPresent(unsigned int nslot) const
Read the &quot;PRESENT&quot; bit for this slot.
Definition: HcalDTCHeader.h:80
unsigned int getTotalLengthBytes() const
bool getSlotEnabled(unsigned int nslot) const
Read the &quot;ENABLED&quot; bit for this slot.
Definition: HcalDTCHeader.h:78
uint32_t commondataformat1
unsigned int getOrbitNumber() const
Definition: HcalDTCHeader.h:49
uint32_t dcch0
HcalCalibrationEventType getCalibType() const
Definition: HcalDTCHeader.h:57
short getDTCDataFormatVersion() const
Definition: HcalDTCHeader.h:60
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int getSlotData(int nslot, HcalHTRData &decodeTool, int validSize) const
unsigned int getSlotDataLength(int nslot) const
Definition: HcalDTCHeader.h:75
uint32_t commondataformat3
bool isCalibType() const
Definition: HcalDTCHeader.h:56
int getSlotSummary(int nslot) const
Definition: HcalDTCHeader.h:65
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)
bool getSlotCRCError(unsigned int nslot) const
Read the &quot;CRC-Mismatch&quot; bit for this slot.
Definition: HcalDTCHeader.h:84