test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QIE10DataFrame.cc
Go to the documentation of this file.
3 
4 void QIE10DataFrame::setSample(edm::DataFrame::size_type isample, int adc, int le_tdc, int te_tdc, int capid, bool soi, bool ok) {
5  if (isample>=size()) return;
7  m_data[isample*WORDS_PER_SAMPLE+HEADER_WORDS+1]=(le_tdc&Sample::MASK_LE_TDC)|((te_tdc&Sample::MASK_TE_TDC)<<Sample::OFFSET_TE_TDC)|((capid&Sample::MASK_CAPID)<<Sample::OFFSET_CAPID)|0x4000; // 0x4000 marks this as second word of a pair
8 }
9 
10 void QIE10DataFrame::setFlags(uint16_t v) {
11  m_data[size()-1]=v;
12 }
13 
15  for (edm::DataFrame::size_type i=0; i<size() && i<digi.size();i++){
16  Sample sam = digi[i];
17  setSample(i, sam.adc(), sam.le_tdc(), sam.te_tdc(), sam.capid(), sam.soi(), sam.ok());
18  }
19 }
20 
22  for (int i=0; i<samples(); i++) {
23  if ((*this)[i].soi()) return i;
24  }
25  return -1;
26 }
27 
28 void QIE10DataFrame::setZSInfo(bool markAndPass){
29  if(markAndPass) m_data[0] |= MASK_MARKPASS;
30 }
31 
32 std::ostream& operator<<(std::ostream& s, const QIE10DataFrame& digi) {
33  if (digi.detid().det()==DetId::Hcal) {
34  s << HcalGenericDetId(digi.detid());
35  } else {
36  s << "DetId(" << digi.detid().rawId() << ")";
37  }
38  s << " " << digi.samples() << " samples";
39  if (digi.linkError()) s << " LinkError ";
40  if (digi.zsMarkAndPass()) s << " MaP ";
41  s << std::endl;
42  for (int i=0; i<digi.samples(); i++) {
43  QIE10DataFrame::Sample sam = digi[i];
44  s << " ADC=" << sam.adc() << " TDC(LE)=" << sam.le_tdc() << " TDC(TE)=" << sam.te_tdc() << " CAPID=" << sam.capid();
45  if (sam.soi()) s << " SOI ";
46  if (!sam.ok()) s << " !OK ";
47  s << std::endl;
48  }
49  return s;
50 }
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
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
bool linkError() const
edm::DataFrame m_data
void copyContent(const QIE10DataFrame &src)
static const int WORDS_PER_SAMPLE
edm::DataFrame::size_type size() const
more accessors
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
void setZSInfo(bool markAndPass)
set ZS params
static const int MASK_ADC
unsigned int size_type
Definition: DataFrame.h:18
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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
static const int HEADER_WORDS
static const int MASK_TE_TDC
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
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
static const int OFFSET_CAPID