Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
#include "DataFormats/L1Trigger/interface/L1DataEmulDigi.h"
#include <iomanip>

bool L1DataEmulDigi::empty() const {
  if (m_sid == m_null || m_cid == m_null)
    return true;
  bool val = true;
  for (int i = 0; i < 2; i++)
    val &= (m_location[i] == m_null);
  return val;
}

int L1DataEmulDigi::reset() {
  m_null = -99;
  m_sid = m_null;
  m_cid = m_null;
  for (int i = 0; i < 3; i++)
    m_location[i] = m_null;
  m_type = m_null;
  std::fill(m_data, m_data + sizeof(m_data) / sizeof(m_data[0]), 0);
  std::fill(m_rank, m_rank + sizeof(m_rank) / sizeof(m_rank[0]), m_null);
  L1MonitorDigi def;
  m_DEpair[0] = def;
  m_DEpair[1] = def;
  return m_null;
}

L1DataEmulDigi::L1DataEmulDigi() { reset(); }

L1DataEmulDigi::L1DataEmulDigi(int sid, int cid, double x1, double x2, double x3, int n) {
  reset();
  m_sid = sid;
  m_cid = cid;
  m_location[0] = x1;
  m_location[1] = x2;
  m_location[2] = x3;
  m_type = n;
}

L1DataEmulDigi::L1DataEmulDigi(int sid,
                               int cid,
                               double x1,
                               double x2,
                               double x3,
                               int n,
                               unsigned int dw,
                               unsigned int ew,
                               float dr,
                               float er,
                               const L1MonitorDigi& dm,
                               const L1MonitorDigi& em) {
  reset();
  m_sid = sid;
  m_cid = cid;
  m_location[0] = x1;
  m_location[1] = x2;
  m_location[2] = x3;
  m_type = n;
  m_data[0] = dw;
  m_data[1] = ew;
  m_rank[0] = dr;
  m_rank[1] = er;
  m_DEpair[0] = dm;
  m_DEpair[1] = em;
}

L1DataEmulDigi::~L1DataEmulDigi() {}

std::ostream& operator<<(std::ostream& s, const L1DataEmulDigi& de) {
  unsigned word[2];
  float rankarr[2];
  de.data(word);
  de.rank(rankarr);
  s << "DEdigi"
    << " subsystem: " << std::setw(2) << de.sid() << " (cid." << std::setw(2) << de.cid() << ")"
    << " location: "
    << "(" << std::setw(5) << std::setprecision(2) << de.x1() << "," << std::setw(5) << std::setprecision(2) << de.x2()
    << "," << std::setw(5) << std::setprecision(2) << de.x3() << ")"
    << " type: " << de.type() << std::hex << std::setfill('0') << " dword:0x" << std::setw(8) << word[0] << " eword:0x"
    << std::setw(8) << word[1] << std::dec << std::setfill(' ') << " rank:"
    << "(" << std::setw(5) << std::setprecision(2) << rankarr[0] << "," << std::setw(5) << std::setprecision(2)
    << rankarr[1] << ")";
  return s;
}

GltDEDigi::GltDEDigi() { this->reset(); }

void GltDEDigi::reset() {
  const int w64 = 64;
  for (int j = 0; j < 2; j++) {
    globalDBit[j] = false;
    gltDecBits[j].reserve(w64 * 2);
    gltTchBits[j].reserve(w64);
    for (int i = 0; i < w64; i++) {
      gltDecBits[j][i] = false;
      gltDecBits[j][i + w64] = false;
      gltTchBits[j][i] = false;
    }
  }
}

GltDEDigi::GltDEDigi(bool glbit[], GltBits dbits[], GltBits tbits[]) { this->set(glbit, dbits, tbits); }

void GltDEDigi::set(bool glbit[], GltBits dbits[], GltBits tbits[]) {
  for (int i = 0; i < 2; i++) {
    globalDBit[i] = glbit[i];
    gltDecBits[i] = dbits[i];
    gltTchBits[i] = tbits[i];
  }
}

std::ostream& operator<<(std::ostream& s, const GltDEDigi& glt) {
  GltDEDigi::GltBits dbits[2], tbits[2];
  bool glbit[2];
  for (int i = 0; i < 2; i++) {
    glbit[i] = glt.globalDBit[i];
    dbits[i] = glt.gltDecBits[i];
    tbits[i] = glt.gltTchBits[i];
  }
  s << "GT DEdigi"
    << " decision: " << glbit[0];
  if (glbit[0] != glbit[1])
    s << "(data), " << glbit[1] << "(emul)";
  s << "\n data dec-word: ";
  for (GltDEDigi::GltBits::const_iterator i = dbits[0].begin(); i != dbits[0].end(); i++)
    s << *i;
  s << "\n emul dec-word: ";
  for (GltDEDigi::GltBits::const_iterator i = dbits[1].begin(); i != dbits[1].end(); i++)
    s << *i;
  s << "\n data techical: ";
  for (GltDEDigi::GltBits::const_iterator i = tbits[0].begin(); i != tbits[0].end(); i++)
    s << *i;
  s << "\n emul technical: ";
  for (GltDEDigi::GltBits::const_iterator i = tbits[1].begin(); i != tbits[1].end(); i++)
    s << *i;
  return s;
}