CMS 3D CMS Logo

TotemTimingEventInfo.h
Go to the documentation of this file.
1 #ifndef CTPPSDigi_TotemTimingEventInfo_h
2 #define CTPPSDigi_TotemTimingEventInfo_h
3 
14 #include <cstdint>
15 #include <bitset>
16 
18 public:
19  TotemTimingEventInfo(const uint8_t hwId,
20  const uint64_t l1ATimestamp,
21  const uint16_t bunchNumber,
22  const uint32_t orbitNumber,
23  const uint32_t eventNumber,
24  const uint16_t channelMap,
25  const uint16_t l1ALatency,
26  const uint8_t numberOfSamples,
27  const uint8_t offsetOfSamples,
28  const uint8_t pllInfo);
32 
34  bool operator==(const TotemTimingEventInfo& eventInfo) const;
35 
37 
39  inline unsigned int hardwareId() const { return hwId_; }
40 
41  inline unsigned int hardwareBoardId() const { return (hwId_ & 0xE0) >> 5; }
42 
43  inline unsigned int hardwareSampicId() const { return (hwId_ & 0x10) >> 4; }
44 
45  inline unsigned int hardwareChannelId() const { return (hwId_ & 0x0F); }
46 
47  inline unsigned int l1ATimestamp() const { return l1ATimestamp_; }
48 
49  inline unsigned int bunchNumber() const { return bunchNumber_; }
50 
51  inline unsigned int orbitNumber() const { return orbitNumber_; }
52 
53  inline unsigned int eventNumber() const { return eventNumber_; }
54 
55  inline uint16_t channelMap() const { return channelMap_; }
56 
57  inline unsigned int l1ALatency() const { return l1ALatency_; }
58 
59  inline unsigned int numberOfSamples() const { return numberOfSamples_; }
60 
61  inline unsigned int offsetOfSamples() const { return offsetOfSamples_; }
62 
63  inline uint8_t pllInfo() const { return pllInfo_; }
64 
67  inline void setHardwareId(const uint8_t hwId) { hwId_ = hwId; }
68 
69  inline void setHardwareBoardId(const unsigned int boardId) {
70  hwId_ &= 0x1F; // Set board bits to 0
71  hwId_ |= ((boardId & 0x07) << 5) & 0xE0;
72  }
73 
74  inline void setHardwareSampicId(const unsigned int sampicId) {
75  hwId_ &= 0xEF; // set Sampic bit to 0
76  hwId_ |= ((sampicId & 0x01) << 4) & 0x10;
77  }
78 
79  inline void setHardwareChannelId(const unsigned int channelId) {
80  hwId_ &= 0xF0; // set Sampic bit to 0
81  hwId_ |= (channelId & 0x0F) & 0x0F;
82  }
83 
85 
86  inline void setBunchNumber(const uint16_t bunchNumber) { bunchNumber_ = bunchNumber; }
87 
88  inline void setOrbitNumber(const uint32_t orbitNumber) { orbitNumber_ = orbitNumber; }
89 
90  inline void setEventNumber(const uint32_t eventNumber) { eventNumber_ = eventNumber; }
91 
92  inline void setChannelMap(const uint16_t channelMap) { channelMap_ = channelMap; }
93 
94  inline void setL1ALatency(const uint16_t l1ALatency) { l1ALatency_ = l1ALatency; }
95 
97 
99 
100  inline void setPLLInfo(const uint8_t pllInfo) { pllInfo_ = pllInfo; }
101 
102 private:
103  uint8_t hwId_;
105  uint16_t bunchNumber_;
106  uint32_t orbitNumber_;
107  uint32_t eventNumber_;
108  uint16_t channelMap_;
109  uint16_t l1ALatency_;
112  uint8_t pllInfo_;
113 };
114 
115 #include <iostream>
116 
118  if (one.eventNumber() < other.eventNumber())
119  return true;
120  if (one.l1ATimestamp() < other.l1ATimestamp())
121  return true;
122  if (one.hardwareId() < other.hardwareId())
123  return true;
124  return false;
125 }
126 
127 inline std::ostream& operator<<(std::ostream& o, const TotemTimingEventInfo& digi) {
128  std::bitset<16> bitsPLLInfo(digi.pllInfo());
129  return o << "TotemTimingEventInfo:"
130  << "\nHardwareId:\t" << std::hex << digi.hardwareId() << "\nDB: " << std::dec << digi.hardwareBoardId()
131  << "\tSampic: " << digi.hardwareSampicId() << "\tChannel: " << digi.hardwareChannelId()
132  << "\nL1A Timestamp:\t" << std::dec << digi.l1ATimestamp() << "\nL1A Latency:\t" << std::dec
133  << digi.l1ALatency() << "\nBunch Number:\t" << std::dec << digi.bunchNumber() << "\nOrbit Number:\t"
134  << std::dec << digi.orbitNumber() << "\nEvent Number:\t" << std::dec << digi.eventNumber()
135  << "\nChannels fired:\t" << std::hex << digi.channelMap() << "\nNumber of Samples:\t" << std::dec
136  << digi.numberOfSamples() << "\nOffset of Samples:\t" << std::dec << digi.offsetOfSamples()
137  << "\nPLL Info:\t" << bitsPLLInfo.to_string() << std::endl;
138 }
139 
140 #endif
TotemTimingEventInfo::l1ATimestamp
unsigned int l1ATimestamp() const
Definition: TotemTimingEventInfo.h:47
TotemTimingEventInfo::TotemTimingEventInfo
TotemTimingEventInfo()
Definition: TotemTimingEventInfo.cc:42
TotemTimingEventInfo::pllInfo
uint8_t pllInfo() const
Definition: TotemTimingEventInfo.h:63
SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
TotemTimingEventInfo::setHardwareChannelId
void setHardwareChannelId(const unsigned int channelId)
Definition: TotemTimingEventInfo.h:79
amcDumpToRaw_cfi.boardId
boardId
Definition: amcDumpToRaw_cfi.py:9
TotemTimingEventInfo::orbitNumber_
uint32_t orbitNumber_
Definition: TotemTimingEventInfo.h:106
TotemTimingEventInfo::hardwareSampicId
unsigned int hardwareSampicId() const
Definition: TotemTimingEventInfo.h:43
TotemTimingEventInfo::eventNumber_
uint32_t eventNumber_
Definition: TotemTimingEventInfo.h:107
TotemTimingEventInfo::hardwareId
unsigned int hardwareId() const
Return digi values number.
Definition: TotemTimingEventInfo.h:39
TotemTimingEventInfo::setL1ATimestamp
void setL1ATimestamp(const uint64_t l1ATimestamp)
Definition: TotemTimingEventInfo.h:84
TotemTimingEventInfo::setHardwareSampicId
void setHardwareSampicId(const unsigned int sampicId)
Definition: TotemTimingEventInfo.h:74
TotemTimingEventInfo::eventNumber
unsigned int eventNumber() const
Definition: TotemTimingEventInfo.h:53
TotemTimingEventInfo::orbitNumber
unsigned int orbitNumber() const
Definition: TotemTimingEventInfo.h:51
TotemTimingEventInfo::setNumberOfSamples
void setNumberOfSamples(const uint8_t numberOfSamples)
Definition: TotemTimingEventInfo.h:96
TotemTimingEventInfo::numberOfSamples_
uint8_t numberOfSamples_
Definition: TotemTimingEventInfo.h:110
TotemTimingEventInfo::l1ATimestamp_
uint64_t l1ATimestamp_
Definition: TotemTimingEventInfo.h:104
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
TotemTimingEventInfo::setHardwareId
void setHardwareId(const uint8_t hwId)
Definition: TotemTimingEventInfo.h:67
TotemTimingEventInfo::setOffsetOfSamples
void setOffsetOfSamples(const uint8_t offsetOfSamples)
Definition: TotemTimingEventInfo.h:98
TotemTimingEventInfo::hardwareBoardId
unsigned int hardwareBoardId() const
Definition: TotemTimingEventInfo.h:41
TotemTimingEventInfo::setOrbitNumber
void setOrbitNumber(const uint32_t orbitNumber)
Definition: TotemTimingEventInfo.h:88
TotemTimingEventInfo::setL1ALatency
void setL1ALatency(const uint16_t l1ALatency)
Definition: TotemTimingEventInfo.h:94
operator<<
std::ostream & operator<<(std::ostream &o, const TotemTimingEventInfo &digi)
Definition: TotemTimingEventInfo.h:127
trackingPlots.other
other
Definition: trackingPlots.py:1467
TotemTimingEventInfo::~TotemTimingEventInfo
~TotemTimingEventInfo()
Definition: TotemTimingEventInfo.h:31
TotemTimingEventInfo::offsetOfSamples_
uint8_t offsetOfSamples_
Definition: TotemTimingEventInfo.h:111
ZMuMuAnalysisNtupler_cff.eventInfo
eventInfo
Definition: ZMuMuAnalysisNtupler_cff.py:15
TotemTimingEventInfo::pllInfo_
uint8_t pllInfo_
Definition: TotemTimingEventInfo.h:112
operator<
bool operator<(const TotemTimingEventInfo &one, const TotemTimingEventInfo &other)
Definition: TotemTimingEventInfo.h:117
TotemTimingEventInfo::bunchNumber_
uint16_t bunchNumber_
Definition: TotemTimingEventInfo.h:105
TotemTimingEventInfo::bunchNumber
unsigned int bunchNumber() const
Definition: TotemTimingEventInfo.h:49
TotemTimingEventInfo::hwId_
uint8_t hwId_
Definition: TotemTimingEventInfo.h:103
TotemTimingEventInfo
Definition: TotemTimingEventInfo.h:17
TotemTimingEventInfo::setPLLInfo
void setPLLInfo(const uint8_t pllInfo)
Definition: TotemTimingEventInfo.h:100
TotemTimingEventInfo::channelMap
uint16_t channelMap() const
Definition: TotemTimingEventInfo.h:55
TotemTimingEventInfo::setHardwareBoardId
void setHardwareBoardId(const unsigned int boardId)
Definition: TotemTimingEventInfo.h:69
TotemTimingEventInfo::l1ALatency
unsigned int l1ALatency() const
Definition: TotemTimingEventInfo.h:57
TotemTimingEventInfo::offsetOfSamples
unsigned int offsetOfSamples() const
Definition: TotemTimingEventInfo.h:61
TotemTimingEventInfo::numberOfSamples
unsigned int numberOfSamples() const
Definition: TotemTimingEventInfo.h:59
TotemTimingEventInfo::l1ALatency_
uint16_t l1ALatency_
Definition: TotemTimingEventInfo.h:109
TotemTimingEventInfo::operator==
bool operator==(const TotemTimingEventInfo &eventInfo) const
Digis are equal if they have all the same values, NOT checking the samples!
Definition: TotemTimingEventInfo.cc:55
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
TotemTimingEventInfo::setBunchNumber
void setBunchNumber(const uint16_t bunchNumber)
Definition: TotemTimingEventInfo.h:86
TotemTimingEventInfo::hardwareChannelId
unsigned int hardwareChannelId() const
Definition: TotemTimingEventInfo.h:45
TotemTimingEventInfo::channelMap_
uint16_t channelMap_
Definition: TotemTimingEventInfo.h:108
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
TotemTimingEventInfo::setChannelMap
void setChannelMap(const uint16_t channelMap)
Definition: TotemTimingEventInfo.h:92
TotemTimingEventInfo::setEventNumber
void setEventNumber(const uint32_t eventNumber)
Definition: TotemTimingEventInfo.h:90