CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  Sample(const edm::DataFrame& frame, edm::DataFrame::size_type i) : frame_(frame),i_(i) { }
24  static const int MASK_ADC = 0xFF;
25  static const int MASK_LE_TDC = 0x3F;
26  static const int MASK_TE_TDC = 0x1F;
27  static const int OFFSET_TE_TDC = 6;
28  static const int MASK_SOI = 0x2000;
29  static const int MASK_OK = 0x1000;
30  static const int MASK_CAPID = 0x3;
31  static const int OFFSET_CAPID = 12;
32  int adc() const { return frame_[i_]&MASK_ADC; }
33  int le_tdc() const { return frame_[i_+1]&MASK_LE_TDC; }
34  int te_tdc() const { return (frame_[i_+1]>>OFFSET_TE_TDC)&MASK_TE_TDC; }
35  bool ok() const { return frame_[i_]&MASK_OK; }
36  bool soi() const { return frame_[i_]&MASK_SOI; }
37  int capid() const { return (frame_[i_+1]>>OFFSET_CAPID)&MASK_CAPID; }
38  private:
41  };
42 
43  void copyContent(const QIE10DataFrame& src);
44 
46  DetId detid() const { return DetId(m_data.id()); }
47  edm::DataFrame::id_type id() const { return m_data.id(); }
49  edm::DataFrame::size_type size() const { return m_data.size(); }
56  int samples() const { return (size()-HEADER_WORDS-FLAG_WORDS)/WORDS_PER_SAMPLE; }
58  int presamples() const;
60  static const int OFFSET_FLAVOR = 12;
61  static const int MASK_FLAVOR = 0x7;
62  int flavor() const { return ((m_data[0]>>OFFSET_FLAVOR)&MASK_FLAVOR); }
64  static const int MASK_LINKERROR = 0x800;
65  bool linkError() const { return m_data[0]&MASK_LINKERROR; }
67  static const int MASK_MARKPASS = 0x100;
68  bool zsMarkAndPass() const {return m_data[0]&MASK_MARKPASS; }
70  void setZSInfo(bool markAndPass);
74  void setSample(edm::DataFrame::size_type isample, int adc, int le_tdc, int te_tdc, int capid, bool soi=false, bool ok=true);
76  uint16_t flags() const { return m_data[size()-1]; }
78  void setFlags(uint16_t v);
79 
80  private:
82 
83 };
84 
85 std::ostream& operator<<(std::ostream&, const QIE10DataFrame&);
86 
87 
88 #endif // DATAFORMATS_HCALDIGI_QIE10DATAFRAME_H
int adc(sample_type sample)
get the ADC sample (12 bits)
int samples() const
total number of samples in the digi
unsigned int id_type
Definition: DataFrame.h:19
static const int MASK_OK
int i
Definition: DBlmapReader.cc:9
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
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
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
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
const edm::DataFrame & frame_
Sample(const edm::DataFrame &frame, edm::DataFrame::size_type i)
static const int MASK_MARKPASS
was this a mark-and-pass ZS event?
edm::DataFrame::size_type i_
bool zsMarkAndPass() const
DetId detid() const
Get the detector id.
static const int OFFSET_TE_TDC
edm::DataFrame::iterator end()
static const int OFFSET_FLAVOR
get the flavor of the frame
iterator end()
Definition: DataFrame.h:51
Definition: DetId.h:18
static const int FLAG_WORDS
static const int HEADER_WORDS
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
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