CMS 3D CMS Logo

CTPPSDiamondDigi.h
Go to the documentation of this file.
1 #ifndef CTPPSDigi_CTPPSDiamondDigi_h
2 #define CTPPSDigi_CTPPSDiamondDigi_h
3 
13 #include <cstdint>
15 
17 public:
19  unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt, bool mhit_, unsigned short hptdcerror_);
22 
24  bool operator==(const CTPPSDiamondDigi& digi) const;
25 
27 
28  unsigned int leadingEdge() const { return ledgt; }
29 
30  unsigned int trailingEdge() const { return tedgt; }
31 
32  unsigned int thresholdVoltage() const { return threvolt; }
33 
34  bool multipleHit() const { return mhit; }
35 
37 
39  inline void setLeadingEdge(unsigned int ledgt_) { ledgt = ledgt_; }
40  inline void setTrailingEdge(unsigned int tedgt_) { tedgt = tedgt_; }
41  inline void setThresholdVoltage(unsigned int threvolt_) { threvolt = threvolt_; }
42  inline void setMultipleHit(bool mhit_) { mhit = mhit_; }
43  inline void setHPTDCErrorFlags(const HPTDCErrorFlags& hptdcerror_) { hptdcerror = hptdcerror_; }
44 
45 private:
46  // variable represents leading edge time
47  unsigned int ledgt;
48  // variable represents trailing edge time
49  unsigned int tedgt;
50  // variable represents threshold voltage
51  unsigned int threvolt;
52  // variable represents multi-hit
53  bool mhit;
55 };
56 
57 #include <iostream>
58 
59 inline bool operator<(const CTPPSDiamondDigi& one, const CTPPSDiamondDigi& other) {
60  if (one.leadingEdge() < other.leadingEdge())
61  return true;
62  if (one.leadingEdge() > other.leadingEdge())
63  return false;
64  if (one.trailingEdge() < other.trailingEdge())
65  return true;
66  if (one.trailingEdge() > other.trailingEdge())
67  return false;
68  if (one.multipleHit() < other.multipleHit())
69  return true;
70  if (one.multipleHit() > other.multipleHit())
71  return false;
72  if (one.hptdcErrorFlags().errorFlag() < other.hptdcErrorFlags().errorFlag())
73  return true;
74  if (one.hptdcErrorFlags().errorFlag() > other.hptdcErrorFlags().errorFlag())
75  return false;
76  if (one.thresholdVoltage() < other.thresholdVoltage())
77  return true;
78  if (one.thresholdVoltage() > other.thresholdVoltage())
79  return false;
80  return false;
81 }
82 
83 inline std::ostream& operator<<(std::ostream& o, const CTPPSDiamondDigi& digi) {
84  return o << " " << digi.leadingEdge() << " " << digi.trailingEdge() << " " << digi.thresholdVoltage() << " "
85  << digi.multipleHit() << " " << digi.hptdcErrorFlags().errorFlag();
86 }
87 
88 #endif
unsigned int thresholdVoltage() const
bool operator<(const CTPPSDiamondDigi &one, const CTPPSDiamondDigi &other)
unsigned int leadingEdge() const
Return digi values number.
void setTrailingEdge(unsigned int tedgt_)
unsigned int trailingEdge() const
unsigned int ledgt
void setMultipleHit(bool mhit_)
unsigned short errorFlag() const
bool operator==(const CTPPSDiamondDigi &digi) const
Digis are equal if they are have same ledt and tedt, threshold voltage, multihit flag, hptdcerror flags.
unsigned int tedgt
HPTDCErrorFlags hptdcErrorFlags() const
unsigned int threvolt
HPTDCErrorFlags hptdcerror
std::ostream & operator<<(std::ostream &o, const CTPPSDiamondDigi &digi)
bool multipleHit() const
void setHPTDCErrorFlags(const HPTDCErrorFlags &hptdcerror_)
void setThresholdVoltage(unsigned int threvolt_)
void setLeadingEdge(unsigned int ledgt_)
Set digi values.