CMS 3D CMS Logo

QIE10DataFrame.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_HCALDIGI_QIE10DATAFRAME_H
2 #define DATAFORMATS_HCALDIGI_QIE10DATAFRAME_H
3 
6 #include <ostream>
7 
12 public:
13 
14  static const int WORDS_PER_SAMPLE = 2;
15  static const int HEADER_WORDS = 1;
16  static const int FLAG_WORDS = 1;
17 
19  QIE10DataFrame(edm::DataFrame const & df) : m_data(df) { }
20 
21  class Sample {
22  public:
23  typedef uint32_t wide_type;
24 
25  Sample(const edm::DataFrame& frame, edm::DataFrame::size_type i) : word1_(frame[i]), word2_(frame[i+1]) { }
26  Sample(const edm::DataFrame::data_type& word1, const edm::DataFrame::data_type& word2) : word1_(word1), word2_(word2) {}
27  explicit Sample(wide_type wide);
28 
29  static const int MASK_ADC = 0xFF;
30  static const int MASK_LE_TDC = 0x3F;
31  static const int MASK_TE_TDC = 0x1F;
32  static const int OFFSET_TE_TDC = 6;
33  static const int MASK_SOI = 0x2000;
34  static const int MASK_OK = 0x1000;
35  static const int MASK_CAPID = 0x3;
36  static const int OFFSET_CAPID = 12;
37 
38  inline int adc() const { return word1_&MASK_ADC; }
39  inline int le_tdc() const { return word2_&MASK_LE_TDC; }
40  inline int te_tdc() const { return (word2_>>OFFSET_TE_TDC)&MASK_TE_TDC; }
41  inline bool ok() const { return word1_&MASK_OK; }
42  inline bool soi() const { return word1_&MASK_SOI; }
43  inline int capid() const { return (word2_>>OFFSET_CAPID)&MASK_CAPID; }
45  { return (i > WORDS_PER_SAMPLE) ? 0 : ( (i==1) ? word2_ : word1_ ); }
46  wide_type wideRaw() const;
47 
48  private:
51  };
52 
53  void copyContent(const QIE10DataFrame& src);
54 
56  DetId detid() const { return DetId(m_data.id()); }
57  edm::DataFrame::id_type id() const { return m_data.id(); }
59  edm::DataFrame::size_type size() const { return m_data.size(); }
66  int samples() const { return (size()-HEADER_WORDS-FLAG_WORDS)/WORDS_PER_SAMPLE; }
68  int presamples() const;
70  static const int OFFSET_FLAVOR = 12;
71  static const int MASK_FLAVOR = 0x7;
72  int flavor() const { return ((m_data[0]>>OFFSET_FLAVOR)&MASK_FLAVOR); }
74  static const int MASK_LINKERROR = 0x800;
75  bool linkError() const { return m_data[0]&MASK_LINKERROR; }
77  static const int MASK_MARKPASS = 0x100;
78  bool zsMarkAndPass() const {return m_data[0]&MASK_MARKPASS; }
80  void setZSInfo(bool markAndPass);
82  inline Sample operator[](edm::DataFrame::size_type i) const { return Sample(m_data,i*WORDS_PER_SAMPLE+HEADER_WORDS); }
84  void setSample(edm::DataFrame::size_type isample, int adc, int le_tdc, int te_tdc, int capid, bool soi=false, bool ok=true);
86  uint16_t flags() const { return m_data[size()-1]; }
88  void setFlags(uint16_t v);
89 
90  private:
92 
93 };
94 
95 std::ostream& operator<<(std::ostream&, const QIE10DataFrame&);
96 
97 
98 #endif // DATAFORMATS_HCALDIGI_QIE10DATAFRAME_H
int samples() const
total number of samples in the digi
unsigned int id_type
Definition: DataFrame.h:19
static const int MASK_OK
edm::DataFrame::iterator begin()
iterators
static const int MASK_SOI
edm::DataFrame::const_iterator end() const
int flavor() const
void setFlags(uint16_t v)
set the flag word
static const int MASK_CAPID
static const int MASK_LE_TDC
int presamples() const
for backward compatibility
unsigned short data_type
Definition: DataFrame.h:20
uint16_t flags() const
get the flag word
Sample operator[](edm::DataFrame::size_type i) const
get the sample
bool linkError() const
edm::DataFrame m_data
void copyContent(const QIE10DataFrame &src)
edm::DataFrame::id_type id() const
static const int WORDS_PER_SAMPLE
edm::DataFrame::size_type size() const
more accessors
edm::DataFrame::const_iterator begin() const
void setZSInfo(bool markAndPass)
set ZS params
static const int MASK_LINKERROR
was there a link error?
static const int MASK_ADC
iterator begin()
Definition: DataFrame.h:48
unsigned int size_type
Definition: DataFrame.h:18
Sample(const edm::DataFrame &frame, edm::DataFrame::size_type i)
static const int MASK_MARKPASS
was this a mark-and-pass ZS event?
bool zsMarkAndPass() const
DetId detid() const
Get the detector id.
static const int OFFSET_TE_TDC
wide_type wideRaw() const
edm::DataFrame::data_type word1_
edm::DataFrame::iterator end()
static const int OFFSET_FLAVOR
get the flavor of the frame
edm::DataFrame::data_type word2_
iterator end()
Definition: DataFrame.h:51
Definition: DetId.h:18
static const int FLAG_WORDS
edm::DataFrame::data_type raw(edm::DataFrame::size_type i) const
static const int HEADER_WORDS
Sample(const edm::DataFrame::data_type &word1, const edm::DataFrame::data_type &word2)
data_type * iterator
Definition: DataFrame.h:21
data_type const * const_iterator
Definition: DataFrame.h:22
static const int MASK_TE_TDC
size_type size() const
Definition: DataFrame.h:64
std::ostream & operator<<(std::ostream &, const QIE10DataFrame &)
void setSample(edm::DataFrame::size_type isample, int adc, int le_tdc, int te_tdc, int capid, bool soi=false, bool ok=true)
set the sample contents
static const int MASK_FLAVOR
QIE10DataFrame(edm::DataFrame const &df)
id_type id() const
Definition: DataFrame.h:61
static const int OFFSET_CAPID