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 
7 #include <ostream>
8 
12 class QIE11DataFrame : protected edm::DataFrame {
13 public:
14 
15  static const int WORDS_PER_SAMPLE = 1;
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_TDC = 0x3F;
28  static const int OFFSET_TDC = 8; // 8 bits
29  static const int MASK_SOI = 0x4000;
30  static const int MASK_CAPID = 0x3;
31  static const int OFFSET_CAPID = 8;
32  int adc() const { return frame_[i_]&MASK_ADC; }
33  int tdc() const { return (frame_[i_]>>8)&MASK_TDC; }
34  bool soi() const { return frame_[i_]&MASK_SOI; }
35  int capid() const { return ((((frame_[0]>>OFFSET_CAPID)&MASK_CAPID)+i_)&MASK_CAPID); }
36  private:
39  };
40 
42  DetId detid() const { return DetId(id()); }
44  int samples() const { return (size()-HEADER_WORDS-FLAG_WORDS)/WORDS_PER_SAMPLE; }
46  static const int OFFSET_FLAVOR = 12;
47  static const int MASK_FLAVOR = 0x7;
48  int flavor() const { return ((edm::DataFrame::operator[](0)>>OFFSET_FLAVOR)&MASK_FLAVOR); }
50  static const int MASK_LINKERROR = 0x800;
53  static const int MASK_CAPIDERROR = 0x400;
56  bool wasMarkAndPass() const {return (flavor()==1); }
58  inline Sample operator[](edm::DataFrame::size_type i) const { return Sample(*this,i+HEADER_WORDS); }
59  void setCapid0(int cap0);
61  void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi=false);
63  uint16_t flags() const { return edm::DataFrame::operator[](size()-1); }
65  void setFlags(uint16_t v);
66 
67 };
68 
69 std::ostream& operator<<(std::ostream&, const QIE11DataFrame&);
70 
71 
72 #endif // DATAFORMATS_HCALDIGI_QIE11DATAFRAME_H
int adc(sample_type sample)
get the ADC sample (12 bits)
DetId detid() const
Get the detector id.
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)
static const int OFFSET_CAPID
edm::DataFrame::size_type i_
void setCapid0(int cap0)
static const int MASK_CAPID
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:187
static const int WORDS_PER_SAMPLE
static const int MASK_LINKERROR
was there a link error?
static const int MASK_CAPIDERROR
was there a capid rotation error?
unsigned int size_type
Definition: DataFrame.h:17
static const int MASK_TDC
bool linkError() const
Sample operator[](edm::DataFrame::size_type i) const
get the sample
data_type & operator[](size_type i)
Definition: DataFrame.h:37
const edm::DataFrame & frame_
static const int OFFSET_FLAVOR
get the flavor of the frame
bool capidError() const
bool wasMarkAndPass() const
was this a mark-and-pass ZS event?
Definition: DetId.h:18
static const int OFFSET_TDC
QIE11DataFrame(const edm::DataFrameContainer &c, edm::DataFrame::size_type i)
static const int MASK_SOI
size_type size() const
Definition: DataFrame.h:63
int samples() const
total number of samples in the digi
QIE11DataFrame(edm::DataFrame df)