CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
CSCTMBScope Class Reference

#include <CSCTMBScope.h>

Public Member Functions

 CSCTMBScope ()
 
 CSCTMBScope (const uint16_t *buf, int b05Line, int e05Line)
 

Static Public Member Functions

static void setDebug (const bool value)
 
static unsigned short sizeInWords ()
 

Public Attributes

unsigned int data [52]
 

Private Member Functions

int GetPretrig (int ich)
 
int UnpackScope (const uint16_t *buf, int b05Line, int e05Line)
 

Private Attributes

unsigned int scope_ram [256][6]
 
unsigned short size_
 

Static Private Attributes

static std::atomic< bool > debug {false}
 

Detailed Description

Definition at line 15 of file CSCTMBScope.h.

Constructor & Destructor Documentation

CSCTMBScope::CSCTMBScope ( )
inline

Definition at line 17 of file CSCTMBScope.h.

References size_.

17 { size_ = 0; } //default constructor
unsigned short size_
Definition: CSCTMBScope.h:29
CSCTMBScope::CSCTMBScope ( const uint16_t *  buf,
int  b05Line,
int  e05Line 
)

Definition at line 17 of file CSCTMBScope.cc.

References size_, and UnpackScope().

17  {
18  size_ = UnpackScope(buf, b05Line, e05Line);
19 
20 } //CSCTMBScope
unsigned short size_
Definition: CSCTMBScope.h:29
int UnpackScope(const uint16_t *buf, int b05Line, int e05Line)
Definition: CSCTMBScope.cc:22

Member Function Documentation

int CSCTMBScope::GetPretrig ( int  ich)
private

Definition at line 184 of file CSCTMBScope.cc.

References debug, LogTrace, scope_ram, and relativeConstraints::value.

Referenced by UnpackScope().

184  {
185  unsigned int ibit, itbin, iram;
186  int value = 0;
187 
188  ibit = 0;
189  itbin = 0;
190  iram = ich / 16;
191  while (!ibit) {
192  ibit = (scope_ram[itbin][iram] >> (ich % 16)) & 1;
193  value = itbin;
194  itbin++;
195  }
196 
197  if (debug)
198  LogTrace("CSCTMBScope|CSCRawToDigi") << "TMB SCOPE: ------- Pretrig value: " << value;
199  return value;
200 
201 } //GetPretrig
#define LogTrace(id)
static std::atomic< bool > debug
Definition: CSCTMBScope.h:33
unsigned int scope_ram[256][6]
Definition: CSCTMBScope.h:28
static void CSCTMBScope::setDebug ( const bool  value)
inlinestatic

Definition at line 20 of file CSCTMBScope.h.

References debug, and relativeConstraints::value.

20 { debug = value; };
static std::atomic< bool > debug
Definition: CSCTMBScope.h:33
static unsigned short CSCTMBScope::sizeInWords ( )
inlinestatic

Definition at line 19 of file CSCTMBScope.h.

19 { return 1538; }
int CSCTMBScope::UnpackScope ( const uint16_t *  buf,
int  b05Line,
int  e05Line 
)
private

Definition at line 22 of file CSCTMBScope.cc.

References data, debug, GetPretrig(), ntuplemaker::iline, LogTrace, and scope_ram.

Referenced by CSCTMBScope().

22  {
23  int pretrig_chan[4] = {0, 0, 0, 0};
24  unsigned int tbin_strt, tbin_stop;
25  unsigned int ibit, jbit, itbin, ich, iram, iline, iadr;
26  unsigned int lct_bxn;
27 
28  if (debug) {
29  LogTrace("CSCTMBScope|CSCRawToDigi") << " .....TMBHeader -- unpacking Logic Analyzer......";
30  }
31 
32  if ((e05Line - b05Line) == 1537) {
33  if (debug)
34  LogTrace("CSCTMBScope|CSCRawToDigi") << "Scope data found";
35 
36  //load scope_ram from raw-hits format readout
37  iline = b05Line + 1;
38  for (iram = 0; iram < 6; iram++) {
39  for (iadr = 0; iadr < 256; iadr++) {
40  itbin = iadr; //ram_sel*256
41  scope_ram[itbin][iram] = buf[iline];
42  iline++;
43  }
44  }
45 
46  for (ich = 0; ich < 51; ich++)
47  data[ich] = 0; //clear all data
48 
49  //----- find pretrig chan offset -----------------
50  pretrig_chan[0] = GetPretrig(0);
51  pretrig_chan[1] = GetPretrig(32);
52  pretrig_chan[2] = GetPretrig(48);
53  pretrig_chan[3] = GetPretrig(64);
54 
55  //----- ram 1 ------------------------------------
56  tbin_strt = pretrig_chan[0] - 7;
57  tbin_stop = pretrig_chan[0] + 24;
58 
59  for (ich = 0; ich <= 14; ich++) {
60  iram = ich / 16;
61  jbit = 0;
62  for (itbin = tbin_strt; itbin <= tbin_stop; itbin++) {
63  ibit = (scope_ram[itbin][iram] >> (ich % 16)) & 1;
64  data[ich] = (ibit << jbit) | data[ich];
65  jbit++;
66  }
67  }
68 
69  //----- ram 2 ------------------------------------
70  for (ich = 16; ich <= 30; ich++) {
71  iram = ich / 16;
72  jbit = 0;
73  for (itbin = tbin_strt; itbin <= tbin_stop; itbin++) {
74  ibit = (scope_ram[itbin][iram] >> (ich % 16)) & 1;
75  data[ich - 1] = (ibit << jbit) | data[ich - 1];
76  jbit++;
77  }
78  }
79 
80  //----- ram 3 ------------------------------------
81  tbin_strt = pretrig_chan[1] - 7;
82  tbin_stop = pretrig_chan[1] + 24;
83 
84  for (ich = 32; ich <= 36; ich++) {
85  iram = ich / 16;
86  jbit = 0;
87  for (itbin = tbin_strt; itbin <= tbin_stop; itbin++) {
88  ibit = (scope_ram[itbin][iram] >> (ich % 16)) & 1;
89  data[ich - 2] = (ibit << jbit) | data[ich - 2];
90  jbit++;
91  }
92  }
93 
94  tbin_strt = pretrig_chan[1] - 7 + 120;
95  tbin_stop = pretrig_chan[1] + 24 + 120;
96 
97  for (ich = 37; ich <= 40; ich++) {
98  iram = ich / 16;
99  jbit = 0;
100  for (itbin = tbin_strt; itbin <= tbin_stop; itbin++) {
101  ibit = (scope_ram[itbin][iram] >> (ich % 16)) & 1;
102  data[ich - 2] = (ibit << jbit) | data[ich - 2];
103  jbit++;
104  }
105  }
106 
107  tbin_strt = pretrig_chan[1] - 7;
108  tbin_stop = pretrig_chan[1] + 24;
109 
110  for (ich = 41; ich <= 46; ich++) {
111  iram = ich / 16;
112  jbit = 0;
113  for (itbin = tbin_strt; itbin <= tbin_stop; itbin++) {
114  ibit = (scope_ram[itbin][iram] >> (ich % 16)) & 1;
115  data[ich - 2] = (ibit << jbit) | data[ich - 2];
116  jbit++;
117  }
118  }
119 
120  //----- ram 4 ------------------------------------
121  tbin_strt = pretrig_chan[2] - 7;
122  tbin_stop = pretrig_chan[2] + 24;
123 
124  for (ich = 48; ich <= 53; ich++) {
125  iram = ich / 16;
126  jbit = 0;
127  for (itbin = tbin_strt; itbin <= tbin_stop; itbin++) {
128  ibit = (scope_ram[itbin][iram] >> (ich % 16)) & 1;
129  data[ich - 3] = (ibit << jbit) | data[ich - 3];
130  jbit++;
131  }
132  }
133 
134  //----- ram 5 - bxn ------------------------------
135  lct_bxn = 0;
136  jbit = 0;
137 
138  for (ich = 65; ich <= 76; ich++) {
139  iram = ich / 16;
140  itbin = pretrig_chan[3];
141  ibit = (scope_ram[itbin][iram] >> (ich % 16)) & 1;
142  lct_bxn = (ibit << jbit) | lct_bxn;
143  jbit++;
144  }
145  data[51] = lct_bxn;
146 
147  if (debug)
148  LogTrace("CSCTMBScope|CSCRawToDigi") << "Scope bxn at LCT (seq_pretrig): " << lct_bxn;
149 
150  //----- now read back decoded scope data ---------
151  if (debug) {
152  for (ich = 0; ich <= 50; ich++) {
153  for (itbin = 0; itbin < 32; itbin++) {
154  ibit = (data[ich] >> itbin) & 1;
155  if (ibit == 0)
156  LogTrace("CSCTMBScope|CSCRawToDigi") << "_"; //display symbol for logic 0
157  if (ibit == 1)
158  LogTrace("CSCTMBScope|CSCRawToDigi") << "-"; //display symbol for logic 1
159  }
160  }
161  }
162 
163  } //end if(b05-e05)
164 
165  //-------------- if no scope data: fill everything with 0 --------------------
166  else {
167  for (ich = 0; ich < 51; ich++)
168  data[ich] = 0;
169  lct_bxn = 0xff0000; //value not possible for real data (short)
170  data[51] = lct_bxn;
171 
172  if (debug)
173  LogTrace("CSCTMBScope|CSCRawToDigi") << "No scope data found: wrdcnt: " << (e05Line - b05Line);
174  }
175 
176  if (debug) {
177  LogTrace("CSCTMBScope|CSCRawToDigi") << " .....END -- unpacking Logic Analyzer...........";
178  }
179 
180  return (e05Line - b05Line + 1);
181 
182 } //UnpackScope
#define LogTrace(id)
unsigned int data[52]
Definition: CSCTMBScope.h:20
static std::atomic< bool > debug
Definition: CSCTMBScope.h:33
int GetPretrig(int ich)
Definition: CSCTMBScope.cc:184
unsigned int scope_ram[256][6]
Definition: CSCTMBScope.h:28

Member Data Documentation

unsigned int CSCTMBScope::data[52]
std::atomic< bool > CSCTMBScope::debug {false}
staticprivate
unsigned int CSCTMBScope::scope_ram[256][6]
private

Definition at line 28 of file CSCTMBScope.h.

Referenced by GetPretrig(), and UnpackScope().

unsigned short CSCTMBScope::size_
private

Definition at line 29 of file CSCTMBScope.h.

Referenced by CSCTMBScope().