CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QIE11DataFrame.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_HCALDIGI_QIE11DATAFRAME_H
2 #define DATAFORMATS_HCALDIGI_QIE11DATAFRAME_H
3 
6 #include <ostream>
7 
12 public:
13 
14  static const int WORDS_PER_SAMPLE = 1;
15  static const int HEADER_WORDS = 1;
16  static const int FLAG_WORDS = 1;
17 
19  QIE11DataFrame(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_TDC = 0x3F;
26  static const int OFFSET_TDC = 8; // 8 bits
27  static const int MASK_SOI = 0x4000;
28  static const int MASK_CAPID = 0x3;
29  static const int OFFSET_CAPID = 8;
30  int adc() const { return frame_[i_]&MASK_ADC; }
31  int tdc() const { return (frame_[i_]>>8)&MASK_TDC; }
32  bool soi() const { return frame_[i_]&MASK_SOI; }
33  int capid() const { return ((((frame_[0]>>OFFSET_CAPID)&MASK_CAPID)+i_)&MASK_CAPID); }
34  private:
37  };
38 
39  void copyContent(const QIE11DataFrame&);
40 
42  DetId detid() const { return DetId(m_data.id()); }
43  edm::DataFrame::id_type id() const { return m_data.id(); }
45  edm::DataFrame::size_type size() const { return m_data.size(); }
52  int samples() const { return (size()-HEADER_WORDS-FLAG_WORDS)/WORDS_PER_SAMPLE; }
54  int presamples() const;
56  static const int OFFSET_FLAVOR = 12;
57  static const int MASK_FLAVOR = 0x7;
58  int flavor() const { return ((m_data[0]>>OFFSET_FLAVOR)&MASK_FLAVOR); }
60  static const int MASK_LINKERROR = 0x800;
61  bool linkError() const { return m_data[0]&MASK_LINKERROR; }
63  static const int MASK_CAPIDERROR = 0x400;
64  bool capidError() const { return m_data[0]&MASK_CAPIDERROR; }
66  bool zsMarkAndPass() const {return (flavor()==1); }
69  void setCapid0(int cap0);
71  void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi=false);
73  uint16_t flags() const { return m_data[size()-1]; }
75  void setFlags(uint16_t v);
76 
77  private:
79 
80 };
81 
82 std::ostream& operator<<(std::ostream&, const QIE11DataFrame&);
83 
84 
85 #endif // DATAFORMATS_HCALDIGI_QIE11DATAFRAME_H
int adc(sample_type sample)
get the ADC sample (12 bits)
DetId detid() const
Get the detector id.
unsigned int id_type
Definition: DataFrame.h:19
void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi=false)
set the sample contents
int i
Definition: DBlmapReader.cc:9
static const int FLAG_WORDS
Sample(const edm::DataFrame &frame, edm::DataFrame::size_type i)
edm::DataFrame::size_type size() const
more accessors
static const int OFFSET_CAPID
QIE11DataFrame(edm::DataFrame const &df)
edm::DataFrame::const_iterator end() const
edm::DataFrame::size_type i_
void setCapid0(int cap0)
static const int MASK_CAPID
void copyContent(const QIE11DataFrame &)
static const int HEADER_WORDS
int flavor() const
static const int MASK_ADC
static const int MASK_FLAVOR
void setFlags(uint16_t v)
set the flag word
uint16_t flags() const
get the flag word
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
static const int WORDS_PER_SAMPLE
static const int MASK_LINKERROR
was there a link error?
iterator begin()
Definition: DataFrame.h:48
static const int MASK_CAPIDERROR
was there a capid rotation error?
unsigned int size_type
Definition: DataFrame.h:18
static const int MASK_TDC
bool linkError() const
bool zsMarkAndPass() const
was this a mark-and-pass ZS event?
Sample operator[](edm::DataFrame::size_type i) const
get the sample
edm::DataFrame::const_iterator begin() const
edm::DataFrame::id_type id() const
const edm::DataFrame & frame_
static const int OFFSET_FLAVOR
get the flavor of the frame
bool capidError() const
edm::DataFrame m_data
iterator end()
Definition: DataFrame.h:51
Definition: DetId.h:18
static const int OFFSET_TDC
static const int MASK_SOI
int presamples() const
for backward compatibility
data_type * iterator
Definition: DataFrame.h:21
data_type const * const_iterator
Definition: DataFrame.h:22
edm::DataFrame::iterator begin()
iterators
size_type size() const
Definition: DataFrame.h:64
edm::DataFrame::iterator end()
int samples() const
total number of samples in the digi
id_type id() const
Definition: DataFrame.h:61