CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1DataEmulDigi.cc
Go to the documentation of this file.
2 #include <iomanip>
3 
4 bool L1DataEmulDigi::empty() const {
5  if (m_sid == m_null || m_cid == m_null)
6  return true;
7  bool val = true;
8  for (int i = 0; i < 2; i++)
9  val &= (m_location[i] == m_null);
10  return val;
11 }
12 
14  m_null = -99;
15  m_sid = m_null;
16  m_cid = m_null;
17  for (int i = 0; i < 3; i++)
18  m_location[i] = m_null;
19  m_type = m_null;
20  std::fill(m_data, m_data + sizeof(m_data) / sizeof(m_data[0]), 0);
21  std::fill(m_rank, m_rank + sizeof(m_rank) / sizeof(m_rank[0]), m_null);
23  m_DEpair[0] = def;
24  m_DEpair[1] = def;
25  return m_null;
26 }
27 
29 
30 L1DataEmulDigi::L1DataEmulDigi(int sid, int cid, double x1, double x2, double x3, int n) {
31  reset();
32  m_sid = sid;
33  m_cid = cid;
34  m_location[0] = x1;
35  m_location[1] = x2;
36  m_location[2] = x3;
37  m_type = n;
38 }
39 
41  int cid,
42  double x1,
43  double x2,
44  double x3,
45  int n,
46  unsigned int dw,
47  unsigned int ew,
48  float dr,
49  float er,
50  const L1MonitorDigi& dm,
51  const L1MonitorDigi& em) {
52  reset();
53  m_sid = sid;
54  m_cid = cid;
55  m_location[0] = x1;
56  m_location[1] = x2;
57  m_location[2] = x3;
58  m_type = n;
59  m_data[0] = dw;
60  m_data[1] = ew;
61  m_rank[0] = dr;
62  m_rank[1] = er;
63  m_DEpair[0] = dm;
64  m_DEpair[1] = em;
65 }
66 
68 
69 std::ostream& operator<<(std::ostream& s, const L1DataEmulDigi& de) {
70  unsigned word[2];
71  float rankarr[2];
72  de.data(word);
73  de.rank(rankarr);
74  s << "DEdigi"
75  << " subsystem: " << std::setw(2) << de.sid() << " (cid." << std::setw(2) << de.cid() << ")"
76  << " location: "
77  << "(" << std::setw(5) << std::setprecision(2) << de.x1() << "," << std::setw(5) << std::setprecision(2) << de.x2()
78  << "," << std::setw(5) << std::setprecision(2) << de.x3() << ")"
79  << " type: " << de.type() << std::hex << std::setfill('0') << " dword:0x" << std::setw(8) << word[0] << " eword:0x"
80  << std::setw(8) << word[1] << std::dec << std::setfill(' ') << " rank:"
81  << "(" << std::setw(5) << std::setprecision(2) << rankarr[0] << "," << std::setw(5) << std::setprecision(2)
82  << rankarr[1] << ")";
83  return s;
84 }
85 
87 
89  const int w64 = 64;
90  for (int j = 0; j < 2; j++) {
91  globalDBit[j] = false;
92  gltDecBits[j].reserve(w64 * 2);
93  gltTchBits[j].reserve(w64);
94  for (int i = 0; i < w64; i++) {
95  gltDecBits[j][i] = false;
96  gltDecBits[j][i + w64] = false;
97  gltTchBits[j][i] = false;
98  }
99  }
100 }
101 
102 GltDEDigi::GltDEDigi(bool glbit[], GltBits dbits[], GltBits tbits[]) { this->set(glbit, dbits, tbits); }
103 
104 void GltDEDigi::set(bool glbit[], GltBits dbits[], GltBits tbits[]) {
105  for (int i = 0; i < 2; i++) {
106  globalDBit[i] = glbit[i];
107  gltDecBits[i] = dbits[i];
108  gltTchBits[i] = tbits[i];
109  }
110 }
111 
112 std::ostream& operator<<(std::ostream& s, const GltDEDigi& glt) {
113  GltDEDigi::GltBits dbits[2], tbits[2];
114  bool glbit[2];
115  for (int i = 0; i < 2; i++) {
116  glbit[i] = glt.globalDBit[i];
117  dbits[i] = glt.gltDecBits[i];
118  tbits[i] = glt.gltTchBits[i];
119  }
120  s << "GT DEdigi"
121  << " decision: " << glbit[0];
122  if (glbit[0] != glbit[1])
123  s << "(data), " << glbit[1] << "(emul)";
124  s << "\n data dec-word: ";
125  for (GltDEDigi::GltBits::const_iterator i = dbits[0].begin(); i != dbits[0].end(); i++)
126  s << *i;
127  s << "\n emul dec-word: ";
128  for (GltDEDigi::GltBits::const_iterator i = dbits[1].begin(); i != dbits[1].end(); i++)
129  s << *i;
130  s << "\n data techical: ";
131  for (GltDEDigi::GltBits::const_iterator i = tbits[0].begin(); i != tbits[0].end(); i++)
132  s << *i;
133  s << "\n emul technical: ";
134  for (GltDEDigi::GltBits::const_iterator i = tbits[1].begin(); i != tbits[1].end(); i++)
135  s << *i;
136  return s;
137 }
void rank(float *r) const
int def(FILE *, FILE *, int)
int sid() const
int type() const
std::vector< bool > GltBits
void set(bool glbit[], GltBits dbits[], GltBits tbits[])
GltBits gltTchBits[2]
void data(unsigned int *d) const
unsigned int m_data[2]
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
int cid() const
double x2() const
uint64_t word
double x1() const
tuple dm
Definition: symbols.py:75
L1MonitorDigi m_DEpair[2]
void reset()
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
bool empty() const
double glt
Definition: hdecay.h:102
double x3() const
double m_location[3]
bool globalDBit[2]
GltBits gltDecBits[2]