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 
7 #include <ostream>
8 
12 class QIE10DataFrame : protected edm::DataFrame {
13 public:
14 
15  static const int WORDS_PER_SAMPLE = 2;
16  static const int HEADER_WORDS = 1;
17  static const int FLAG_WORDS = 1;
18 
22 
23  class Sample {
24  public:
25  Sample(const edm::DataFrame& frame, edm::DataFrame::size_type i) : frame_(frame),i_(i) { }
26  static const int MASK_ADC = 0xFF;
27  static const int MASK_LE_TDC = 0x3F;
28  static const int MASK_TE_TDC = 0x1F;
29  static const int OFFSET_TE_TDC = 6;
30  static const int MASK_SOI = 0x2000;
31  static const int MASK_OK = 0x1000;
32  static const int MASK_CAPID = 0x3;
33  static const int OFFSET_CAPID = 12;
34  int adc() const { return frame_[i_]&MASK_ADC; }
35  int le_tdc() const { return frame_[i_+1]&MASK_LE_TDC; }
36  int te_tdc() const { return (frame_[i_+1]>>OFFSET_TE_TDC)&MASK_TE_TDC; }
37  bool ok() const { return frame_[i_]&MASK_OK; }
38  bool soi() const { return frame_[i_]&MASK_SOI; }
39  int capid() const { return (frame_[i_+1]>>OFFSET_CAPID)&MASK_CAPID; }
40  private:
43  };
44 
46  DetId detid() const { return DetId(id()); }
48  int samples() const { return (size()-HEADER_WORDS-FLAG_WORDS)/WORDS_PER_SAMPLE; }
50  static const int OFFSET_FLAVOR = 12;
51  static const int MASK_FLAVOR = 0x7;
52  int flavor() const { return ((edm::DataFrame::operator[](0)>>OFFSET_FLAVOR)&MASK_FLAVOR); }
54  static const int MASK_LINKERROR = 0x800;
57  static const int MASK_MARKPASS = 0x100;
62  void setSample(edm::DataFrame::size_type isample, int adc, int le_tdc, int fe_tdc, int capid, bool soi=false, bool ok=true);
64  uint16_t flags() const { return edm::DataFrame::operator[](size()-1); }
66  void setFlags(uint16_t v);
67 
68 };
69 
70 std::ostream& operator<<(std::ostream&, const QIE10DataFrame&);
71 
72 
73 #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
static const int MASK_OK
int i
Definition: DBlmapReader.cc:9
static const int MASK_SOI
int flavor() const
void setFlags(uint16_t v)
set the flag word
static const int MASK_CAPID
static const int MASK_LE_TDC
void setSample(edm::DataFrame::size_type isample, int adc, int le_tdc, int fe_tdc, int capid, bool soi=false, bool ok=true)
set the sample contents
uint16_t flags() const
get the flag word
Sample operator[](edm::DataFrame::size_type i) const
get the sample
bool linkError() const
static const int WORDS_PER_SAMPLE
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static const int MASK_LINKERROR
was there a link error?
static const int MASK_ADC
unsigned int size_type
Definition: DataFrame.h:18
const edm::DataFrame & frame_
bool wasMarkAndPass() const
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_
data_type & operator[](size_type i)
Definition: DataFrame.h:38
DetId detid() const
Get the detector id.
static const int OFFSET_TE_TDC
static const int OFFSET_FLAVOR
get the flavor of the frame
Definition: DetId.h:18
static const int FLAG_WORDS
static const int HEADER_WORDS
static const int MASK_TE_TDC
size_type size() const
Definition: DataFrame.h:64
static const int MASK_FLAVOR
QIE10DataFrame(edm::DataFrame df)
QIE10DataFrame(const edm::DataFrameContainer &c, edm::DataFrame::size_type i)
static const int OFFSET_CAPID