CMS 3D CMS Logo

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 19 of file CSCTMBScope.h.

References size_.

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

Definition at line 17 of file CSCTMBScope.cc.

References size_, and UnpackScope().

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

Member Function Documentation

int CSCTMBScope::GetPretrig ( int  ich)
private

Definition at line 190 of file CSCTMBScope.cc.

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

Referenced by setDebug(), and UnpackScope().

190  {
191 
192  unsigned int ibit,itbin,iram;
193  int value = 0;
194 
195  ibit=0;
196  itbin=0;
197  iram=ich/16;
198  while(!ibit) {
199  ibit = (scope_ram[itbin][iram] >> (ich%16) ) & 1;
200  value = itbin;
201  itbin++;
202  }
203 
204  if(debug)
205  LogTrace("CSCTMBScope|CSCRawToDigi") << "TMB SCOPE: ------- Pretrig value: " << value;
206  return value;
207 
208 } //GetPretrig
Definition: value.py:1
#define LogTrace(id)
static std::atomic< bool > debug
Definition: CSCTMBScope.h:36
unsigned int scope_ram[256][6]
Definition: CSCTMBScope.h:31
static void CSCTMBScope::setDebug ( const bool  value)
inlinestatic

Definition at line 22 of file CSCTMBScope.h.

References data, debug, GetPretrig(), UnpackScope(), and relativeConstraints::value.

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

Definition at line 21 of file CSCTMBScope.h.

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

Definition at line 24 of file CSCTMBScope.cc.

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

Referenced by CSCTMBScope(), and setDebug().

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

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 31 of file CSCTMBScope.h.

Referenced by GetPretrig(), and UnpackScope().

unsigned short CSCTMBScope::size_
private

Definition at line 32 of file CSCTMBScope.h.

Referenced by CSCTMBScope().