CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCDQM_EventProcessor_processCSC.cc
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: EventProcessor_processCSC.cc
5  *
6  * Description: Process Chamber
7  *
8  * Version: 1.0
9  * Created: 10/03/2008 11:58:11 PM
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: Valdas Rapsevicius, valdas.rapsevicius@cern.ch
14  * Company: CERN, CH
15  *
16  * =====================================================================================
17  */
18 
20 
21 
22 
23 namespace cscdqm {
24 
25  template<typename T> inline CSCCFEBDataWord const * const
26  timeSample( T const & data, int nCFEB,int nSample,int nLayer, int nStrip) {
27  return data.cfebData(nCFEB)->timeSlice(nSample)->timeSample(nLayer,nStrip);
28  }
29 
30  template<typename T> inline CSCCFEBTimeSlice const * const
31  timeSlice( T const & data, int nCFEB, int nSample) { return (CSCCFEBTimeSlice *)(data.cfebData(nCFEB)->timeSlice(nSample));}
32 
33 
34 
43  void EventProcessor::setEmuEventDisplayBit(MonitorObject*& mo, const unsigned int x, const unsigned int y, const unsigned int bit) {
44  if (mo && x) {
46  int bitset = (int) mo->GetBinContent(x, y);
47  bitset |= 1 << bit;
48  mo->SetBinContent(x, y, bitset);
49  }
50  }
51 
52 
58 
59  // Reseting EMU level Event displays
60  MonitorObject* mo = 0;
61  if (getEMUHisto(h::EMU_EVENT_DISPLAY_ANODE, mo)) {
62  mo->getTH1Lock()->Reset("");
63  }
64 
65  if (getEMUHisto(h::EMU_EVENT_DISPLAY_CATHODE, mo)) {
66  mo->getTH1Lock()->Reset("");
67  }
68 
69  if (getEMUHisto(h::EMU_EVENT_DISPLAY_XY, mo)) {
70  mo->getTH1Lock()->Reset("");
71  }
72 
74 
75  }
76  }
77 
83  void EventProcessor::processCSC(const CSCEventData& data, const int dduID, const CSCDCCExaminer& binChecker) {
84 
86 
87  if (&data == 0) {
88  LOG_ERROR << "Zero pointer. DMB data are not available for unpacking"; //KK is->are
89  return;
90  }
91 
92  int FEBunpacked = 0;
93  int alct_unpacked = 0;
94  int tmb_unpacked = 0;
95  int cfeb_unpacked = 0;
96 
97  int alct_keywg = -1;
98  int clct_kewdistrip = -1;
99 
100  bool L1A_out_of_sync = false;
101 
102  MonitorObject* mo = NULL;
103 
106  const CSCDMBHeader* dmbHeader = data.dmbHeader();
107  const CSCDMBTrailer* dmbTrailer = data.dmbTrailer();
108  if (!dmbHeader && !dmbTrailer) {
109  LOG_ERROR << "Can not unpack DMB Header or/and Trailer";
110  return;
111  }
112 
114  unsigned int crateID = 0xFF;
115  unsigned int dmbID = 0xF;
116  unsigned int chamberID = 0xFFF;
117 
118  crateID = dmbHeader->crateID();
119  dmbID = dmbHeader->dmbID();
120  chamberID = (((crateID) << 4) + dmbID) & 0xFFF;
121 
122  const std::string cscTag = CSCHistoDef::getPath(crateID, dmbID);
123 
124  unsigned long errors = binChecker.errorsForChamber(chamberID);
125  if ((errors & config->getBINCHECK_MASK()) > 0 ) {
126  LOG_WARN << "Format Errors " << cscTag << ": 0x" << std::hex << errors << " Skipped CSC Unpacking";
127  return;
128  }
129 
130  unsigned int cscType = 0;
131  unsigned int cscPosition = 0;
132  if (!getCSCFromMap(crateID, dmbID, cscType, cscPosition )) return;
133 
134  CSCDetId cid;
135  if (!config->fnGetCSCDetId(crateID, dmbID, cid)) {
136  return;
137  }
138 
139  // Check if in standby!
140  if (summary.isChamberStandby(cid)) {
141  return;
142  }
143 
144  double DMBEvents = 0.0;
145  DMBEvents = config->getChamberCounterValue(DMB_EVENTS, crateID, dmbID);
146 
147  // Get Event display plot number and next plot object
148  uint32_t evDisplNo = config->getChamberCounterValue(EVENT_DISPLAY_PLOT, crateID, dmbID);
149  evDisplNo += 1;
150  if (evDisplNo >= 5) {
151  config->setChamberCounterValue(EVENT_DISPLAY_PLOT, crateID, dmbID, 0);
152  } else {
153  config->setChamberCounterValue(EVENT_DISPLAY_PLOT, crateID, dmbID, evDisplNo);
154  }
155  MonitorObject* mo_EventDisplay = 0;
156  if (getCSCHisto(h::CSC_EVENT_DISPLAY_NOXX, crateID, dmbID, evDisplNo, mo_EventDisplay)) {
157  mo_EventDisplay->getTH1Lock()->Reset("");
158  }
159 
160  // Receiving EMU Event displays
161  MonitorObject *mo_Emu_EventDisplay_Anode = 0, *mo_Emu_EventDisplay_Cathode = 0, *mo_Emu_EventDisplay_XY = 0;
162  getEMUHisto(h::EMU_EVENT_DISPLAY_ANODE, mo_Emu_EventDisplay_Anode);
163  getEMUHisto(h::EMU_EVENT_DISPLAY_CATHODE, mo_Emu_EventDisplay_Cathode);
164  getEMUHisto(h::EMU_EVENT_DISPLAY_XY, mo_Emu_EventDisplay_XY);
165 
166  // Global chamber index
167  uint32_t glChamberIndex = 0;
168 
169  if (mo_EventDisplay) {
170  mo_EventDisplay->SetBinContent(1, 1, cid.endcap());
171  mo_EventDisplay->SetBinContent(1, 2, cid.station());
172  mo_EventDisplay->SetBinContent(1, 3, cid.ring());
173  mo_EventDisplay->SetBinContent(1, 4, cscPosition);
174  mo_EventDisplay->SetBinContent(1, 5, crateID);
175  mo_EventDisplay->SetBinContent(1, 6, dmbID);
176  mo_EventDisplay->SetBinContent(1, 7, dmbHeader->l1a());
177  if (mo_Emu_EventDisplay_Anode || mo_Emu_EventDisplay_Cathode || mo_Emu_EventDisplay_XY) {
178  glChamberIndex = summary.getDetector().GlobalChamberIndex(cid.endcap(), cid.station(), cid.ring(), cscPosition);
179  }
180  }
181 
183 
184  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_UNPACKED, mo)){
185  mo->Fill(cscPosition, cscType);
186  }
187 
189  float DMBEff = float(DMBEvents) / float(config->getNEvents());
190  if(DMBEff > 1.0) {
191  LOG_ERROR << cscTag << " has efficiency " << DMBEff << " which is greater than 1";
192  }
193 
197  int dmbHeaderL1A = dmbHeader->l1a()%64;
199  int dmb_ddu_l1a_diff = (int)(dmbHeaderL1A-(int)(L1ANumber%64));
200  if (dmb_ddu_l1a_diff != 0) L1A_out_of_sync = true;
201 
204  if (getCSCHisto(h::CSC_DMB_L1A_DISTRIB, crateID, dmbID, mo)) mo->Fill(dmbHeaderL1A);
205 
206  if (getCSCHisto(h::CSC_DMB_DDU_L1A_DIFF, crateID, dmbID, mo)) {
207  if(dmb_ddu_l1a_diff < -32) {
208  mo->Fill(dmb_ddu_l1a_diff + 64);
209  } else {
210  if(dmb_ddu_l1a_diff >= 32) mo->Fill(dmb_ddu_l1a_diff - 64);
211  else mo->Fill(dmb_ddu_l1a_diff);
212  }
213  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
214  }
215 
216  if (getCSCHisto(h::CSC_DMB_L1A_VS_DDU_L1A, crateID, dmbID, mo)) mo->Fill((int)(L1ANumber & 0xFF), (int)dmbHeaderL1A);
217 
219  int dmbHeaderBXN = 0;
220  int dmb_ddu_bxn_diff = 0;
221 
226  dmbHeaderBXN = dmbHeader->bxn12();
230  dmb_ddu_bxn_diff = dmbHeaderBXN%64-BXN%64;
232  if (getCSCHisto(h::CSC_DMB_BXN_DISTRIB, crateID, dmbID, mo)) mo->Fill((int)(dmbHeader->bxn12()));
233 
234  if (getCSCHisto(h::CSC_DMB_DDU_BXN_DIFF, crateID, dmbID, mo)) {
235  if(dmb_ddu_bxn_diff < -32) mo->Fill(dmb_ddu_bxn_diff + 64);
236  else {
237  if(dmb_ddu_bxn_diff >= 32) mo->Fill(dmb_ddu_bxn_diff - 64);
238  else mo->Fill(dmb_ddu_bxn_diff);
239  }
240  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
241  }
242 
244  if (getCSCHisto(h::CSC_DMB_BXN_VS_DDU_BXN, crateID, dmbID, mo)) mo->Fill(((int)(BXN)) % 256, ((int)dmbHeaderBXN) % 256);
245 
247  int cfeb_dav = 0;
248  int cfeb_dav_num = 0;
249  int cfeb_movlp = 0;
250  int dmb_cfeb_sync = 0;
251 
252  cfeb_dav = (int)dmbHeader->cfebAvailable();
253  for (int i = 0; i < 5; i++) cfeb_dav_num += (cfeb_dav >> i) & 0x1;
254  cfeb_movlp = (int)dmbHeader->cfebMovlp();
255  dmb_cfeb_sync = (int)dmbHeader->dmbCfebSync();
256 
257  if (getCSCHisto(h::CSC_DMB_CFEB_DAV, crateID, dmbID, mo)) {
258  for (int i = 0; i < 5; i++) {
259  int cfeb_present = (cfeb_dav >> i) & 0x1;
260  if (cfeb_present) {
261  mo->Fill(i);
262  }
263  }
264  }
265 
266  if (getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY, crateID, dmbID, mo)) mo->Fill(cfeb_dav_num);
267  if (getCSCHisto(h::CSC_DMB_CFEB_MOVLP, crateID, dmbID, mo)) mo->Fill(cfeb_movlp);
268  if (getCSCHisto(h::CSC_DMB_CFEB_SYNC, crateID, dmbID, mo)) mo->Fill(dmb_cfeb_sync);
269 
270  if (getEMUHisto(h::EMU_DMB_UNPACKED, mo)) {
271  mo->Fill(crateID, dmbID);
273  }
274 
276  if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE, crateID, dmbID, mo)) mo->Fill(dmbHeader->cfebActive()); //KK
277 
281  if (getCSCHisto(h::CSC_DMB_L1_PIPE, crateID, dmbID, mo)) mo->Fill(dmbTrailer->dmb_l1pipe);
282 
284  if (getCSCHisto(h::CSC_DMB_FIFO_STATS, crateID, dmbID, mo)) {
285  if (dmbTrailer->tmb_empty == 1) mo->Fill(1.0, 0.0); //KK
286  if (dmbTrailer->tmb_half == 0) mo->Fill(1.0, 1.0);
287  if (dmbTrailer->tmb_full == 1) mo->Fill(1.0, 2.0); //KK
288  if (dmbTrailer->alct_empty == 1) mo->Fill(0.0, 0.0);
289  if (dmbTrailer->alct_half == 0) mo->Fill(0.0, 1.0);
290  if (dmbTrailer->alct_full == 1) mo->Fill(0.0, 2.0); //KK 0->1
291  for (int i = 0; i < 5; i++) {
292  if ((int)((dmbTrailer->cfeb_empty>>i)&0x1) == 1) mo->Fill(i + 2, 0.0);
293  if ((int)((dmbTrailer->cfeb_half>>i)&0x1) == 0) mo->Fill(i + 2, 1);
294  if ((int)((dmbTrailer->cfeb_full>>i)&0x1) == 1) {
295  mo->Fill(i + 2, 2);
296  }
297  }
298  mo->SetEntries((int)DMBEvents);
299  }
300 
302  if (getCSCHisto(h::CSC_DMB_FEB_TIMEOUTS, crateID, dmbID, mo)) {
303  if ((dmbTrailer->tmb_timeout == 0) && (dmbTrailer->alct_timeout == 0) && (dmbTrailer->cfeb_starttimeout == 0) && (dmbTrailer->cfeb_endtimeout == 0)) {
304  mo->Fill(0.0);
305  }else{
306  if (dmbTrailer->alct_timeout) mo->Fill(1);
307  if (dmbTrailer->tmb_timeout) mo->Fill(2);
308  if (dmbTrailer->alct_endtimeout) mo->Fill(8); // KK
309  if (dmbTrailer->tmb_endtimeout) mo->Fill(9); // KK
310  }
311  for (int i = 0; i < 5; i++) {
312  if ((dmbTrailer->cfeb_starttimeout >> i) & 0x1) {
313  mo->Fill(i + 3);
314  }
315  if ((dmbTrailer->cfeb_endtimeout >> i) & 0x1) {
316  mo->Fill(i + 10); // KK 8->10
317  }
318  }
319  mo->SetEntries((int)DMBEvents);
320  }
321 
323  int alct_dav = dmbHeader->nalct();
324  int tmb_dav = dmbHeader->nclct();
325  int cfeb_dav2 = 0;
326  for (int i = 0; i < 5; i++) cfeb_dav2 = cfeb_dav2 + (int)((dmbHeader->cfebAvailable() >> i) & 0x1);
327 
330  if ((alct_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
331  mo->Fill(0.0);
332  float alct_dav_number = mo->GetBinContent(1);
333  if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
334  mo->SetBinContent(1, ((float)alct_dav_number / (float)(DMBEvents) * 100.0));
335  mo->SetEntries((int)DMBEvents);
336  }
337  }
338 
339  if ((tmb_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
340  mo->Fill(1.0);
341  float tmb_dav_number = mo->GetBinContent(2);
342  if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
343  mo->SetBinContent(2, ((float)tmb_dav_number / (float)(DMBEvents) * 100.0));
344  mo->SetEntries((int)DMBEvents);
345  }
346  }
347 
348  if ((cfeb_dav2 > 0) && (getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbID, mo))) {
349  mo->Fill(2.0);
350  float cfeb_dav2_number = mo->GetBinContent(3);
351  if (getCSCHisto(h::CSC_DMB_FEB_DAV_EFFICIENCY, crateID, dmbID, mo)) {
352  mo->SetBinContent(3, ((float)cfeb_dav2_number / (float)(DMBEvents) * 100.0));
353  mo->SetEntries((int)DMBEvents);
354  }
355  }
356 
357  float feb_combination_dav = -1.0;
359  if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbID, mo)) {
360  if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav2 == 0) feb_combination_dav = 0.0; // Nothing
361  if(alct_dav > 0 && tmb_dav == 0 && cfeb_dav2 == 0) feb_combination_dav = 1.0; // ALCT Only
362  if(alct_dav == 0 && tmb_dav > 0 && cfeb_dav2 == 0) feb_combination_dav = 2.0; // TMB Only
363  if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav2 > 0) feb_combination_dav = 3.0; // CFEB Only
364  if(alct_dav == 0 && tmb_dav > 0 && cfeb_dav2 > 0) feb_combination_dav = 4.0; // TMB+CFEB
365  if(alct_dav > 0 && tmb_dav > 0 && cfeb_dav2 == 0) feb_combination_dav = 5.0; // ALCT+TMB
366  if(alct_dav > 0 && tmb_dav == 0 && cfeb_dav2 > 0) feb_combination_dav = 6.0; // ALCT+CFEB
367  if(alct_dav > 0 && tmb_dav > 0 && cfeb_dav2 > 0) feb_combination_dav = 7.0; // ALCT+TMB+CFEB
368  mo->Fill(feb_combination_dav);
369  float feb_combination_dav_number = mo->GetBinContent((int)(feb_combination_dav + 1.0));
370  if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_EFFICIENCY, crateID, dmbID, mo)) {
371  mo->SetBinContent((int)(feb_combination_dav + 1.0), ((float)feb_combination_dav_number / (float)(DMBEvents) * 100.0));
372  mo->SetEntries((int)DMBEvents);
373  }
374  }
375 
377  if (data.nalct()) {
378 
379  const CSCALCTHeader* alctHeader = data.alctHeader();
380  int fwVersion = alctHeader->alctFirmwareVersion();
381  const CSCALCTTrailer* alctTrailer = data.alctTrailer();
382  const CSCAnodeData* alctData = data.alctData();
383 
384  if (alctHeader && alctTrailer) {
385 
386  std::vector<CSCALCTDigi> alctsDatasTmp = alctHeader->ALCTDigis();
387  std::vector<CSCALCTDigi> alctsDatas;
388 
389  for (uint32_t lct = 0; lct < alctsDatasTmp.size(); lct++) {
390  if (alctsDatasTmp[lct].isValid()) alctsDatas.push_back(alctsDatasTmp[lct]);
391  }
392 
393  FEBunpacked = FEBunpacked + 1;
394  alct_unpacked = 1;
395 
397  if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
398  mo->Fill(2);
399  uint32_t ALCTEvent = (uint32_t)mo->GetBinContent(3);
400  config->setChamberCounterValue(ALCT_TRIGGERS, crateID, dmbID, ALCTEvent);
401  if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)){
402  if(config->getNEvents() > 0) {
405  mo->SetBinContent(1, ((float)ALCTEvent / (float)(DMBEvents) * 100.0));
407  mo->SetEntries((int)DMBEvents);
408  }
409  }
410  }
411 
412  if ((alct_dav >0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
413  mo->Fill(0.0, 0.0);
414  }
415 
418  if (getCSCHisto(h::CSC_ALCT_L1A, crateID, dmbID, mo)) mo->Fill((int)(alctHeader->L1Acc()));
419 
421  if (getCSCHisto(h::CSC_ALCT_DMB_L1A_DIFF, crateID, dmbID, mo)) {
423  int alct_dmb_l1a_diff = (int)(alctHeader->L1Acc() % 64 - dmbHeader->l1a() % 64);
424  if (alct_dmb_l1a_diff != 0) L1A_out_of_sync = true;
425  if(alct_dmb_l1a_diff < -32) mo->Fill(alct_dmb_l1a_diff + 64);
426  else {
427  if(alct_dmb_l1a_diff >= 32) mo->Fill(alct_dmb_l1a_diff - 64);
428  else mo->Fill(alct_dmb_l1a_diff);
429  }
430  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
431  }
432 
434  if (getCSCHisto(h::CSC_DMB_L1A_VS_ALCT_L1A, crateID, dmbID, mo)) mo->Fill(alctHeader->L1Acc() % 256, dmbHeader->l1a());
435 
438  if (getCSCHisto(h::CSC_ALCT_DMB_BXN_DIFF, crateID, dmbID, mo)) {
439  int alct_dmb_bxn_diff = (int)(alctHeader->BXNCount()-dmbHeader->bxn12());
440  if (alct_dmb_bxn_diff > 0) alct_dmb_bxn_diff -= 3564;
441  alct_dmb_bxn_diff %= 64;
442  mo->Fill(alct_dmb_bxn_diff);
443  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
444  }
445 
446  if (getCSCHisto(h::CSC_ALCT_BXN, crateID, dmbID, mo)) mo->Fill(alctHeader->BXNCount());
447 
449  if (getCSCHisto(h::CSC_ALCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill((int)((alctHeader->BXNCount()) % 256), (int)(dmbHeader->bxn12()) % 256);
450 
451  if (getCSCHisto(h::CSC_ALCT_NUMBER_RATE, crateID, dmbID, mo)) {
452  mo->Fill(alctsDatas.size());
453  int nALCT = (int)mo->GetBinContent((int)(alctsDatas.size() + 1));
454  if (getCSCHisto(h::CSC_ALCT_NUMBER_EFFICIENCY, crateID, dmbID, mo))
455  mo->SetBinContent((int)(alctsDatas.size() + 1), (float)(nALCT) / (float)(DMBEvents) * 100.0);
456  }
457 
458  if (getCSCHisto(h::CSC_ALCT_WORD_COUNT, crateID, dmbID, mo)) mo->Fill((int)(alctTrailer->wordCount()));
459 
462  if (alctsDatas.size() == 2) {
463  if (getCSCHisto(h::CSC_ALCT1_VS_ALCT0_KEYWG, crateID, dmbID, mo))
464  mo->Fill(alctsDatas[0].getKeyWG(),alctsDatas[1].getKeyWG());
465  }
466 
467  MonitorObject* mo_CSC_ALCT0_BXN_mean = 0;
468  getEMUHisto(h::EMU_CSC_ALCT0_BXN_MEAN, mo_CSC_ALCT0_BXN_mean);
469 
470  MonitorObject* mo_CSC_ALCT0_BXN_rms = 0;
471  getEMUHisto(h::EMU_CSC_ALCT0_BXN_RMS, mo_CSC_ALCT0_BXN_rms);
472 
473  MonitorObject* mo_CSC_Plus_endcap_ALCT0_dTime = 0;
474  getEMUHisto(h::EMU_CSC_ALCT0_ENDCAP_PLUS_DTIME, mo_CSC_Plus_endcap_ALCT0_dTime);
475 
476  MonitorObject* mo_CSC_Minus_endcap_ALCT0_dTime = 0;
477  getEMUHisto(h::EMU_CSC_ALCT0_ENDCAP_MINUS_DTIME, mo_CSC_Minus_endcap_ALCT0_dTime);
478 
479  for (uint32_t lct = 0; lct < alctsDatas.size(); lct++) {
480 
482  if (lct >= 2) continue;
483 
484  if (getCSCHisto(h::CSC_ALCTXX_KEYWG, crateID, dmbID, lct, mo)) {
485  mo->Fill(alctsDatas[lct].getKeyWG());
486  }
487 
488  if(lct == 0) alct_keywg = alctsDatas[lct].getKeyWG();
489 
490  int alct_dtime = 0;
491  if (fwVersion == 2007) {
492  alct_dtime = alctsDatas[lct].getBX();
493  } else {
494  // Older 2006 Format
495  alct_dtime = (int) (alctsDatas[lct].getBX() - (alctHeader->BXNCount()&0x1F));
496  }
497 
498  if (getCSCHisto(h::CSC_ALCTXX_DTIME, crateID, dmbID, lct, mo)) {
499 
500  if(alct_dtime < -16) {
501  mo->Fill(alct_dtime + 32);
502  } else {
503  if(alct_dtime >= 16) mo->Fill(alct_dtime - 32);
504  else mo->Fill(alct_dtime);
505  }
506 
507  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
508 
509  double dTime_mean = mo->getTH1()->GetMean();
510  double dTime_rms = mo->getTH1()->GetRMS();
511 
512  // == For ALCT0 Fill Summary dTime Histograms
513  if (lct == 0) {
514  if (cid.endcap() == 1) {
515  if (mo_CSC_Plus_endcap_ALCT0_dTime) mo_CSC_Plus_endcap_ALCT0_dTime->Fill(alct_dtime);
516  }
517  if (cid.endcap() == 2) {
518  if (mo_CSC_Minus_endcap_ALCT0_dTime) mo_CSC_Minus_endcap_ALCT0_dTime->Fill(alct_dtime);
519  }
520  if (cscPosition && cscType && mo_CSC_ALCT0_BXN_mean) {
521  mo_CSC_ALCT0_BXN_mean->SetBinContent(cscPosition, cscType + 1, dTime_mean);
522  }
523  if (cscPosition && cscType && mo_CSC_ALCT0_BXN_rms) {
524  mo_CSC_ALCT0_BXN_rms->SetBinContent(cscPosition, cscType + 1, dTime_rms);
525  }
526  }
527 
528  }
529 
530  if (getCSCHisto(h::CSC_ALCTXX_DTIME_VS_KEYWG, crateID, dmbID, lct, mo)) {
531  if(alct_dtime < -16) {
532  mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime + 32);
533  } else {
534  if(alct_dtime >= 16) mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime - 32);
535  else mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime);
536  }
537  }
538 
539  if (getCSCHisto(h::CSC_ALCTXX_DTIME_PROFILE, crateID, dmbID, lct, mo)) {
540  if(alct_dtime < -16) {
541  mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime + 32);
542  } else {
543  if (alct_dtime >= 16) mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime - 32);
544  else mo->Fill(alctsDatas[lct].getKeyWG(), alct_dtime);
545  }
546  }
547 
548  int alct_bxn = alctsDatas[lct].getBX();
549  if (fwVersion == 2007) {
550  alct_bxn = (alct_bxn + alctHeader->BXNCount())&0x1F;
551  }
552 
553  if (getCSCHisto(h::CSC_ALCTXX_BXN, crateID, dmbID, lct, mo)) mo->Fill(alct_bxn);
554 
555  if (getCSCHisto(h::CSC_ALCTXX_QUALITY, crateID, dmbID, lct, mo)) mo->Fill(alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());
556 
557  if (mo_EventDisplay) {
558  mo_EventDisplay->SetBinContent(2, alctsDatas[lct].getKeyWG(), alct_bxn + 1 );
559  mo_EventDisplay->SetBinContent(3, alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());
560  }
561 
562  if (getCSCHisto(h::CSC_ALCTXX_QUALITY_DISTR, crateID, dmbID, lct, mo)) {
563  mo->Fill(alctsDatas[lct].getQuality());
564  if (lct == 0) {
565  MonitorObject* mo1 = 0;
566  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT0_QUALITY, mo1)) {
567  mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
568  }
569  }
570  }
571 
572  if (getCSCHisto(h::CSC_ALCTXX_QUALITY_PROFILE, crateID, dmbID, lct, mo)) mo->Fill(alctsDatas[lct].getKeyWG(), alctsDatas[lct].getQuality());
573 
574  if (getCSCHisto(h::CSC_ALCTXX_PATTERN, crateID, dmbID, lct, mo)) {
575  int pattern = (alctsDatas[lct].getAccelerator() << 1) + alctsDatas[lct].getCollisionB();
576  int keywg = alctsDatas[lct].getKeyWG();
577  mo->Fill(keywg, pattern );
578  }
579 
580  if (getCSCHisto(h::CSC_ALCTXX_PATTERN_DISTR, crateID, dmbID, lct, mo)) {
581  int pattern = (alctsDatas[lct].getAccelerator()<<1) + alctsDatas[lct].getCollisionB();
582  mo->Fill(pattern);
583  }
584 
585  }
586 
587  int NumberOfLayersWithHitsInALCT = 0;
588  int NumberOfWireGroupsWithHitsInALCT = 0;
589 
590  if (alctData) {
591 
592  MonitorObject* mo_AFEB_RawHits_TimeBins = 0;
593  getCSCHisto(h::CSC_CFEB_AFEB_RAWHITS_TIMEBINS, crateID, dmbID, mo_AFEB_RawHits_TimeBins);
594 
595  MonitorObject* mo_CSC_Plus_endcap_AFEB_RawHits_Time = 0;
596  getEMUHisto(h::EMU_CSC_AFEB_ENDCAP_PLUS_RAWHITS_TIME, mo_CSC_Plus_endcap_AFEB_RawHits_Time);
597 
598  MonitorObject* mo_CSC_Minus_endcap_AFEB_RawHits_Time = 0;
599  getEMUHisto(h::EMU_CSC_AFEB_ENDCAP_MINUS_RAWHITS_TIME, mo_CSC_Minus_endcap_AFEB_RawHits_Time);
600 
601  MonitorObject* mo_CSC_AFEB_RawHits_Time_mean = 0;
602  getEMUHisto(h::EMU_CSC_AFEB_RAWHITS_TIME_MEAN, mo_CSC_AFEB_RawHits_Time_mean);
603 
604  MonitorObject* mo_CSC_AFEB_RawHits_Time_rms = 0;
605  getEMUHisto(h::EMU_CSC_AFEB_RAWHITS_TIME_RMS, mo_CSC_AFEB_RawHits_Time_rms);
606 
607  for (int nLayer = 1; nLayer <= 6; nLayer++) {
608 
609  int wg_previous = -1;
610  int tbin_previous = -1;
611  bool CheckLayerALCT = true;
612 
613  std::vector<CSCWireDigi> wireDigis = alctData->wireDigis(nLayer);
614  for (std::vector<CSCWireDigi>::iterator wireDigisItr = wireDigis.begin(); wireDigisItr != wireDigis.end(); ++wireDigisItr) {
615 
616  int wg = wireDigisItr->getWireGroup();
618  std::vector<int> tbins = wireDigisItr->getTimeBinsOn();
619  int tbin = wireDigisItr->getTimeBin();
620 
621  if (mo_EventDisplay) {
622  mo_EventDisplay->SetBinContent(nLayer + 3, wg - 1, tbin + 1);
623  setEmuEventDisplayBit(mo_Emu_EventDisplay_Anode, glChamberIndex, wg - 1, nLayer - 1);
624  setEmuEventDisplayBit(mo_Emu_EventDisplay_XY, glChamberIndex, wg - 1, nLayer - 1);
625  }
626 
627  if (CheckLayerALCT) {
628  NumberOfLayersWithHitsInALCT = NumberOfLayersWithHitsInALCT + 1;
629  CheckLayerALCT = false;
630  }
631 
632  for (uint32_t n = 0; n < tbins.size(); n++) {
633 
634  tbin = tbins[n];
635  if(wg != wg_previous || (tbin != tbin_previous + 1 && tbin != tbin_previous - 1) ) {
636 
637  if (getCSCHisto(h::CSC_ALCTTIME_LYXX, crateID, dmbID, nLayer, mo)) mo->Fill(wg - 1, tbin);
638 
639  if (getCSCHisto(h::CSC_ALCTTIME_LYXX_PROFILE, crateID, dmbID, nLayer, mo)) mo->Fill(wg - 1, tbin);
640 
641  if (mo_AFEB_RawHits_TimeBins) mo_AFEB_RawHits_TimeBins->Fill(tbin);
642 
643  if (cid.endcap() == 1) {
644  if (mo_CSC_Plus_endcap_AFEB_RawHits_Time) mo_CSC_Plus_endcap_AFEB_RawHits_Time->Fill(tbin);
645  }
646  if (cid.endcap() == 2) {
647  if (mo_CSC_Minus_endcap_AFEB_RawHits_Time) mo_CSC_Minus_endcap_AFEB_RawHits_Time->Fill(tbin);
648  }
649 
650  if (getCSCHisto(h::CSC_ALCT_LYXX_RATE, crateID, dmbID, nLayer, mo)) {
651  mo->Fill(wg - 1);
652  int number_wg = (int)(mo->GetBinContent(wg));
653  Double_t Number_of_entries_ALCT = mo->GetEntries();
654  if (getCSCHisto(h::CSC_ALCT_LYXX_EFFICIENCY, crateID, dmbID, nLayer, mo)) {
655  mo->SetBinContent(wg, ((float) number_wg));
656  if((Double_t)(DMBEvents) > 0.0) {
657  mo->SetNormFactor(100.0*Number_of_entries_ALCT/(Double_t)(DMBEvents));
658  } else {
659  mo->SetNormFactor(100.0);
660  }
661  mo->SetEntries((int)DMBEvents);
662  }
663  }
664  }
665  if(wg != wg_previous) {
666  NumberOfWireGroupsWithHitsInALCT = NumberOfWireGroupsWithHitsInALCT + 1;
667  }
668 
669  wg_previous = wg;
670  tbin_previous = tbin;
671  }
672  }
673 
674  // Fill Summary Anode Raw Hits Timing Plots
675  if (mo_AFEB_RawHits_TimeBins) {
676 
677  double rawhits_time_mean = mo_AFEB_RawHits_TimeBins->getTH1()->GetMean();
678  double rawhits_time_rms = mo_AFEB_RawHits_TimeBins->getTH1()->GetRMS();
679 
680  if (cscType && cscPosition && mo_CSC_AFEB_RawHits_Time_mean) {
681  mo_CSC_AFEB_RawHits_Time_mean->SetBinContent(cscPosition, cscType + 1, rawhits_time_mean);
682  }
683 
684  if (cscType && cscPosition && mo_CSC_AFEB_RawHits_Time_rms) {
685  mo_CSC_AFEB_RawHits_Time_rms->SetBinContent(cscPosition, cscType + 1, rawhits_time_rms);
686  }
687 
688  }
689 
690  }
691 
692  } else {
693  LOG_ERROR << cscTag << " Can not unpack Anode Data";
694  }
695 
696  if (getCSCHisto(h::CSC_ALCT_NUMBER_OF_LAYERS_WITH_HITS, crateID, dmbID, mo)) {
697  mo->Fill(NumberOfLayersWithHitsInALCT);
698  MonitorObject* mo1 = 0;
699  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT_PLANES_WITH_HITS, mo1)) {
700  mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
701  }
702  }
703 
704  if (getCSCHisto(h::CSC_ALCT_NUMBER_OF_WIREGROUPS_WITH_HITS, crateID, dmbID, mo)) mo->Fill(NumberOfWireGroupsWithHitsInALCT);
705 
706  } else {
707  LOG_ERROR << cscTag << " Can not unpack ALCT Header or/and Trailer";
708  }
709  } else {
712  if (getCSCHisto(h::CSC_ALCT_NUMBER_RATE, crateID, dmbID, mo)) {
713  mo->Fill(0);
714  int nALCT = (int)mo->GetBinContent(1);
715  if (getCSCHisto(h::CSC_ALCT_NUMBER_EFFICIENCY, crateID, dmbID, mo))
716  mo->SetBinContent(1, (float)(nALCT) / (float)(DMBEvents) * 100.0);
717  }
718 
719  if ((alct_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
720  mo->Fill(0.0, 1.0);
721  }
722  }
723 
725  if(data.nclct() && data.nalct()) {
726 
727  CSCALCTHeader* alctHeader = data.alctHeader();
728 
729  if (alctHeader) {
730  std::vector<CSCALCTDigi> alctsDatasTmp = alctHeader->ALCTDigis();
731  std::vector<CSCALCTDigi> alctsDatas;
732 
733  for (uint32_t lct = 0; lct < alctsDatasTmp.size(); lct++) {
734  if (alctsDatasTmp[lct].isValid())
735  alctsDatas.push_back(alctsDatasTmp[lct]);
736  }
737 
738  CSCTMBData* tmbData = data.tmbData();
739  if (tmbData) {
740  CSCTMBHeader* tmbHeader = tmbData->tmbHeader();
741  if (tmbHeader) {
743  if (getCSCHisto(h::CSC_TMB_BXN_VS_ALCT_BXN, crateID, dmbID, mo))
744  mo->Fill( ((int)(alctHeader->BXNCount())) % 256, ((int)(tmbHeader->BXNCount())) % 256 );
745 
746  if (getCSCHisto(h::CSC_TMB_ALCT_BXN_DIFF, crateID, dmbID, mo)) {
747  int clct_alct_bxn_diff = (int)(alctHeader->BXNCount() - tmbHeader->BXNCount());
748  if(clct_alct_bxn_diff < -2048) mo->Fill(clct_alct_bxn_diff + 4096);
749  else {
750  if(clct_alct_bxn_diff > 2048) mo->Fill(clct_alct_bxn_diff - 4096);
751  else mo->Fill(clct_alct_bxn_diff);
752  }
753  mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
754  }
755 
756  if (getCSCHisto(h::CSC_TMB_L1A_VS_ALCT_L1A, crateID, dmbID, mo))
757  mo->Fill((int)(alctHeader->L1Acc()%256),(int)(tmbHeader->L1ANumber()%256));
758 
759  if (getCSCHisto(h::CSC_TMB_ALCT_L1A_DIFF, crateID, dmbID, mo)) {
760  int clct_alct_l1a_diff = (int)(tmbHeader->L1ANumber() - alctHeader->L1Acc());
761  if(clct_alct_l1a_diff < -2048) mo->Fill(clct_alct_l1a_diff + 4096);
762  else {
763  if(clct_alct_l1a_diff > 2048) mo->Fill(clct_alct_l1a_diff - 4096);
764  else mo->Fill(clct_alct_l1a_diff);
765  }
766  mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
767  }
768  } else {
769  LOG_ERROR << cscTag << " Can not unpack TMB Header";
770  }
771 
772  } else {
773  LOG_ERROR << cscTag << " Can not unpack TMB Data";
774  }
775  } else {
776  LOG_ERROR << cscTag << " Can not unpack ALCT Header";
777  }
778  }
779 
781  if (data.nclct()) {
782 
785  CSCTMBData* tmbData = data.tmbData();
786  if (tmbData) {
787 
788  CSCTMBHeader* tmbHeader = tmbData->tmbHeader();
789  CSCTMBTrailer* tmbTrailer = tmbData->tmbTrailer();
790 
791  if (tmbHeader && tmbTrailer) {
792 
793  CSCCLCTData* clctData = data.clctData();
794 
795  std::vector<CSCCLCTDigi> clctsDatasTmp = tmbHeader->CLCTDigis(cid.rawId());
796  std::vector<CSCCLCTDigi> clctsDatas;
797 
798  for (uint32_t lct = 0; lct < clctsDatasTmp.size(); lct++) {
799  if (clctsDatasTmp[lct].isValid()) clctsDatas.push_back(clctsDatasTmp[lct]);
800  }
801 
802  FEBunpacked = FEBunpacked +1;
803  tmb_unpacked = 1;
804 
805  if (getCSCHisto(h::CSC_ALCT_MATCH_TIME, crateID, dmbID, mo)) {
806 
807  mo->Fill(tmbHeader->ALCTMatchTime());
808  double alct_match_mean = mo->getTH1()->GetMean();
809  double alct_match_rms = mo->getTH1()->GetRMS();
810  MonitorObject* mo1 = 0;
811 
812  if (cid.endcap() == 1) {
813  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ENDCAP_PLUS_ALCT_CLCT_MATCH_TIME, mo1)) {
814  mo1->Fill(tmbHeader->ALCTMatchTime());
815  }
816  }
817 
818  if (cid.endcap() == 2) {
819  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ENDCAP_MINUS_ALCT_CLCT_MATCH_TIME, mo1)) {
820  mo1->Fill(tmbHeader->ALCTMatchTime());
821  }
822  }
823 
824  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT_CLCT_MATCH_MEAN, mo1)) {
825  mo1->SetBinContent(cscPosition, cscType + 1, alct_match_mean);
826  }
827 
828  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_ALCT_CLCT_MATCH_RMS, mo1)) {
829  mo1->SetBinContent(cscPosition, cscType + 1, alct_match_rms);
830  }
831 
832  }
833 
834  if (getCSCHisto(h::CSC_LCT_MATCH_STATUS, crateID, dmbID, mo)) {
835  if (tmbHeader->CLCTOnly()) mo->Fill(0.0,0.0);
836  if (tmbHeader->ALCTOnly()) mo->Fill(0.0,1.0);
837  if (tmbHeader->TMBMatch()) mo->Fill(0.0,2.0);
838  }
839 
840  if (getCSCHisto(h::CSC_LCT0_MATCH_BXN_DIFFERENCE, crateID, dmbID, mo)) mo->Fill(tmbHeader->Bxn0Diff());
841  if (getCSCHisto(h::CSC_LCT1_MATCH_BXN_DIFFERENCE, crateID, dmbID, mo)) mo->Fill(tmbHeader->Bxn1Diff());
842 
843  if ((tmb_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
844  mo->Fill(1.0, 0.0);
845  }
846 
848  if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
849  mo->Fill(3);
850  uint32_t CLCTEvent = (uint32_t)mo->GetBinContent(4);
851  config->setChamberCounterValue(CLCT_TRIGGERS, crateID, dmbID, CLCTEvent);
852  if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)) {
853  if(config->getNEvents() > 0) {
854  mo->SetBinContent(2,((float)CLCTEvent/(float)(DMBEvents)*100.0));
855  mo->SetEntries(DMBEvents);
856  }
857  }
858  }
859 
860  if (getCSCHisto(h::CSC_CLCT_L1A, crateID, dmbID, mo)) mo->Fill(tmbHeader->L1ANumber());
861 
863  if (getCSCHisto(h::CSC_CLCT_DMB_L1A_DIFF, crateID, dmbID, mo)) {
864  int clct_dmb_l1a_diff = (int)((tmbHeader->L1ANumber() % 64)-dmbHeader->l1a() % 64);
865  if (clct_dmb_l1a_diff != 0) L1A_out_of_sync = true;
866  if(clct_dmb_l1a_diff < -32) mo->Fill(clct_dmb_l1a_diff + 64);
867  else {
868  if(clct_dmb_l1a_diff >= 32) mo->Fill(clct_dmb_l1a_diff - 64);
869  else mo->Fill(clct_dmb_l1a_diff);
870  }
871  mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
872  }
873 
875  if (getCSCHisto(h::CSC_DMB_L1A_VS_CLCT_L1A, crateID, dmbID, mo)) mo->Fill(tmbHeader->L1ANumber()%256,dmbHeader->l1a());
876 
877  if (getCSCHisto(h::CSC_CLCT_DMB_BXN_DIFF, crateID, dmbID, mo)) {
878  int clct_dmb_bxn_diff = (int)(tmbHeader->BXNCount()%64-dmbHeader->bxn12()%64);
879  if(clct_dmb_bxn_diff < -32) mo->Fill(clct_dmb_bxn_diff + 64);
880  else {
881  if(clct_dmb_bxn_diff >= 32) mo->Fill(clct_dmb_bxn_diff - 64);
882  else mo->Fill(clct_dmb_bxn_diff);
883  }
884  mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
885  }
886 
887  if (getCSCHisto(h::CSC_CLCT_BXN, crateID, dmbID, mo)) mo->Fill((int)(tmbHeader->BXNCount()));
888 
890  if (getCSCHisto(h::CSC_CLCT_BXN_VS_DMB_BXN, crateID, dmbID, mo)) mo->Fill(tmbHeader->BXNCount()%256,dmbHeader->bxn12()%256);
891 
892  if (getCSCHisto(h::CSC_CLCT_NUMBER_RATE, crateID, dmbID, mo)) {
893  mo->Fill(clctsDatas.size());
894  int nCLCT = (int)mo->GetBinContent((int)(clctsDatas.size()+1));
895  if (getCSCHisto(h::CSC_CLCT_NUMBER, crateID, dmbID, mo)) mo->SetBinContent((int)(clctsDatas.size() + 1), (float)(nCLCT) / (float)(DMBEvents) * 100.0);
896  }
897 
898  if (clctsDatas.size() == 1) {
899  if (getCSCHisto(h::CSC_CLCT0_CLSSIFICATION, crateID, dmbID, mo)) {
900  if (clctsDatas[0].getStripType()) mo->Fill(0.0);
901  else mo->Fill(1.0);
902  }
903  }
904 
905  if (clctsDatas.size() == 2) {
906  if (getCSCHisto(h::CSC_CLCT1_VS_CLCT0_KEY_STRIP, crateID, dmbID, mo))
907  mo->Fill(clctsDatas[0].getKeyStrip(),clctsDatas[1].getKeyStrip());
908  if (getCSCHisto(h::CSC_CLCT0_CLCT1_CLSSIFICATION, crateID, dmbID, mo)) {
909  if ( clctsDatas[0].getStripType() && clctsDatas[1].getStripType()) mo->Fill(0.0);
910  if ( clctsDatas[0].getStripType() && !clctsDatas[1].getStripType()) mo->Fill(1.0);
911  if (!clctsDatas[0].getStripType() && clctsDatas[1].getStripType()) mo->Fill(2.0);
912  if (!clctsDatas[0].getStripType() && !clctsDatas[1].getStripType()) mo->Fill(3.0);
913  }
914  }
915 
916  if (getCSCHisto(h::CSC_TMB_WORD_COUNT, crateID, dmbID, mo)) mo->Fill((int)(tmbTrailer->wordCount()));
919  MonitorObject* mo_CSC_Plus_endcap_CLCT0_dTime = 0;
920  getEMUHisto(h::EMU_CSC_ENDCAP_PLUS_CLCT0_DTIME, mo_CSC_Plus_endcap_CLCT0_dTime);
921 
922  MonitorObject* mo_CSC_Minus_endcap_CLCT0_dTime = 0;
923  getEMUHisto(h::EMU_CSC_ENDCAP_MINUS_CLCT0_DTIME, mo_CSC_Minus_endcap_CLCT0_dTime);
924 
925  MonitorObject* mo_CSC_CLCT0_BXN_mean = 0;
926  getEMUHisto(h::EMU_CSC_CLCT0_BXN_MEAN, mo_CSC_CLCT0_BXN_mean);
927 
928  MonitorObject* mo_CSC_CLCT0_BXN_rms = 0;
929  getEMUHisto(h::EMU_CSC_CLCT0_BXN_RMS, mo_CSC_CLCT0_BXN_rms);
930 
931  for (uint32_t lct = 0; lct < clctsDatas.size(); lct++) {
932 
933  if (getCSCHisto(h::CSC_CLCTXX_BXN, crateID, dmbID, lct, mo)) mo->Fill(clctsDatas[lct].getFullBX()%64);
934 
935  int clct_dtime = clctsDatas[lct].getFullBX() - tmbHeader->BXNCount();
936  if (clct_dtime > 0) {
937  clct_dtime -= 3564;
938  }
939 
940  if (getCSCHisto(h::CSC_CLCTXX_DTIME, crateID, dmbID, lct, mo)) {
941  int dTime = clct_dtime;
942  /*
943  if (clct_dtime < -16) {
944  dTime = clct_dtime + 32;
945  } else {
946  if (clct_dtime > 16) dTime = clct_dtime - 32;
947  }
948  */
949 
950  mo->Fill(dTime);
951  mo->SetAxisRange(0.1, 1.1 * (1.0 + mo->GetBinContent(mo->GetMaximumBin())), "Y");
952 
953  double dTime_mean = mo->getTH1()->GetMean();
954  double dTime_rms = mo->getTH1()->GetRMS();
955 
956  // == For CLCT0 Fill Summary dTime Histograms
957  if (lct == 0) {
958  if (cid.endcap() == 1) {
959  if (mo_CSC_Plus_endcap_CLCT0_dTime) mo_CSC_Plus_endcap_CLCT0_dTime->Fill(dTime);
960  }
961  if (cid.endcap() == 2) {
962  if (mo_CSC_Minus_endcap_CLCT0_dTime) mo_CSC_Minus_endcap_CLCT0_dTime->Fill(dTime);
963  }
964  if ( cscType && cscPosition && mo_CSC_CLCT0_BXN_mean) {
965  mo_CSC_CLCT0_BXN_mean->SetBinContent(cscPosition, cscType + 1, dTime_mean);
966  }
967  if (cscType && cscPosition && mo_CSC_CLCT0_BXN_rms) {
968  mo_CSC_CLCT0_BXN_rms->SetBinContent(cscPosition, cscType + 1, dTime_rms);
969  }
970  }
971 
972  }
973 
976  LOG_DEBUG << "LCT:" << lct << " Type:" << clctsDatas[lct].getStripType() << " Strip:" << clctsDatas[lct].getKeyStrip();
977 
978  if (clctsDatas[lct].getStripType()) { // HalfStrip Type
979 
980  if (getCSCHisto(h::CSC_CLCTXX_KEYHALFSTRIP, crateID, dmbID, lct, mo))
981  mo->Fill(clctsDatas[lct].getKeyStrip());
982 
983  if (getCSCHisto(h::CSC_CLCTXX_DTIME_VS_HALF_STRIP, crateID, dmbID, lct, mo)) {
984  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
985  /*
986  if (clct_dtime < -16) {
987  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 32);
988  } else {
989  if (clct_dtime > 16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 32);
990  else mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
991  }
992  */
993  }
994 
995  if (getCSCHisto(h::CSC_CLCTXX_DTIME_PROFILE, crateID, dmbID, lct, mo)) {
996  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
997  /*
998  if (clct_dtime < -16) {
999  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 32);
1000  } else {
1001  if (clct_dtime > 16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 32);
1002  else mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
1003  }
1004  */
1005  }
1006 
1007  if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_PATTERN, crateID, dmbID, lct, mo)) {
1008 
1009  int pattern_clct = clctsDatas[lct].getPattern();
1013  double tbin = -1;
1014 
1015  switch (pattern_clct) {
1016  case 0: tbin=0.; break;
1017  case 1: tbin=1.; break;
1018  case 2: tbin=2.; break;
1019  case 3: tbin=10.; break;
1020  case 4: tbin=3.; break;
1021  case 5: tbin=9.; break;
1022  case 6: tbin=4.; break;
1023  case 7: tbin=8.; break;
1024  case 8: tbin=5.; break;
1025  case 9: tbin=7.; break;
1026  case 10: tbin=6.; break;
1027  }
1028 
1029  if (tbin >= 0) mo->Fill(clctsDatas[lct].getKeyStrip(), tbin);
1030 
1031  MonitorObject* mo1 = 0;
1032  if (getCSCHisto(h::CSC_CLCT_HALF_STRIP_PATTERN_DISTR, crateID, dmbID, lct, mo1)) mo1->Fill(tbin);
1033 
1034  }
1035 
1036  if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY, crateID, dmbID, lct, mo))
1037  mo->Fill((int)(clctsDatas[lct].getKeyStrip()),(int)(clctsDatas[lct].getQuality()));
1038 
1039  if (mo_EventDisplay) {
1040  mo_EventDisplay->SetBinContent(10, clctsDatas[lct].getKeyStrip(), clct_dtime);
1041  mo_EventDisplay->SetBinContent(11, clctsDatas[lct].getKeyStrip(), clctsDatas[lct].getQuality());
1042  }
1043 
1044  if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY_DISTR, crateID, dmbID, lct, mo)) {
1045  mo->Fill((int)(clctsDatas[lct].getQuality()));
1046  if (lct == 0) {
1047  MonitorObject* mo1 = 0;
1048  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_CLCT0_QUALITY, mo1))
1049  mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
1050  }
1051  }
1052 
1053  if (getCSCHisto(h::CSC_CLCTXX_HALF_STRIP_QUALITY_PROFILE, crateID, dmbID, lct, mo))
1054  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), (int)(clctsDatas[lct].getQuality()));
1055 
1056  } else { // DiStrip Type
1057 
1058  LOG_INFO << "Entering block!";
1059 
1060  if (getCSCHisto(h::CSC_CLCTXX_KEYDISTRIP, crateID, dmbID, lct, mo)) mo->Fill(clctsDatas[lct].getKeyStrip());
1061  else LOG_ERROR << "Not found h::CSC_CLCTXX_KEYDISTRIP = " << h::CSC_CLCTXX_KEYDISTRIP;
1062 
1063  if(lct == 0) clct_kewdistrip = clctsDatas[lct].getKeyStrip();
1064 
1065  if (getCSCHisto(h::CSC_CLCTXX_DTIME_VS_DISTRIP, crateID, dmbID, lct, mo)) {
1066  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
1067  /*
1068  if(clct_dtime < -16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime + 32);
1069  else {
1070  if(clct_dtime > 16) mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime - 32);
1071  else mo->Fill((int)(clctsDatas[lct].getKeyStrip()), clct_dtime);
1072  }
1073  */
1074  }
1075 
1076  if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_PATTERN, crateID, dmbID, lct, mo)) {
1077  int pattern_clct = (int)((clctsDatas[lct].getPattern() >> 1) & 0x3);
1080  if(pattern_clct == 1) mo->Fill(clctsDatas[lct].getKeyStrip(), 7.0);
1081  if(pattern_clct == 3) mo->Fill(clctsDatas[lct].getKeyStrip(), 6.0);
1082  if(pattern_clct == 5) mo->Fill(clctsDatas[lct].getKeyStrip(), 5.0);
1083  if(pattern_clct == 7) mo->Fill(clctsDatas[lct].getKeyStrip(), 4.0);
1084  if(pattern_clct == 6) mo->Fill(clctsDatas[lct].getKeyStrip(), 3.0);
1085  if(pattern_clct == 4) mo->Fill(clctsDatas[lct].getKeyStrip(), 2.0);
1086  if(pattern_clct == 2) mo->Fill(clctsDatas[lct].getKeyStrip(), 1.0);
1087  if(pattern_clct == 0) mo->Fill(clctsDatas[lct].getKeyStrip(), 0.0);
1088  }
1089 
1090  if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_QUALITY, crateID, dmbID, lct, mo))
1091  mo->Fill((int)(clctsDatas[lct].getKeyStrip()),(int)(clctsDatas[lct].getQuality()));
1092 
1093  if (getCSCHisto(h::CSC_CLCTXX_DISTRIP_QUALITY_PROFILE, crateID, dmbID, lct, mo))
1094  mo->Fill((int)(clctsDatas[lct].getKeyStrip()), (int)(clctsDatas[lct].getQuality()));
1095  }
1096  }
1097 
1098  int N_CFEBs = 5;
1099 
1100  int NumberOfLayersWithHitsInCLCT = 0;
1101  int NumberOfHalfStripsWithHitsInCLCT = 0;
1102 
1103  if (clctData && clctData->check()) {
1104 
1105  MonitorObject* mo_CFEB_Comparators_TimeSamples = 0;
1106  getCSCHisto(h::CSC_CFEB_COMPARATORS_TIMESAMPLES, crateID, dmbID, mo_CFEB_Comparators_TimeSamples);
1107 
1108  MonitorObject* mo_CSC_Plus_endcap_CFEB_Comparators_Time = 0;
1109  getEMUHisto(h::EMU_CSC_ENDCAP_PLUS_CFEB_COMPARATORS_TIME, mo_CSC_Plus_endcap_CFEB_Comparators_Time);
1110 
1111  MonitorObject* mo_CSC_Minus_endcap_CFEB_Comparators_Time = 0;
1112  getEMUHisto(h::EMU_CSC_ENDCAP_MINUS_CFEB_COMPARATORS_TIME, mo_CSC_Minus_endcap_CFEB_Comparators_Time);
1113 
1114  MonitorObject* mo_CSC_CFEB_Comparators_Time_mean = 0;
1115  getEMUHisto(h::EMU_CSC_CFEB_COMPARATORS_TIME_MEAN, mo_CSC_CFEB_Comparators_Time_mean);
1116 
1117  MonitorObject* mo_CSC_CFEB_Comparators_Time_rms = 0;
1118  getEMUHisto(h::EMU_CSC_CFEB_COMPARATORS_TIME_RMS, mo_CSC_CFEB_Comparators_Time_rms);
1119 
1120  for(int nCFEB = 0; nCFEB < N_CFEBs; ++nCFEB) {
1121  for (int nLayer = 1; nLayer <= 6; nLayer++) {
1122 
1123  int hstrip_previous = -1;
1124  int tbin_clct_previous = -1;
1125  bool CheckLayerCLCT = true;
1126 
1127  std::vector<CSCComparatorDigi> compOutData = clctData->comparatorDigis(nLayer, nCFEB);
1128 
1129  for (std::vector<CSCComparatorDigi>::iterator compOutDataItr = compOutData.begin(); compOutDataItr != compOutData.end(); ++compOutDataItr) {
1131  int hstrip = 2 * (compOutDataItr->getStrip() - 1) + compOutDataItr->getComparator();
1132  std::vector<int> tbins_clct = compOutDataItr->getTimeBinsOn();
1133  int tbin_clct = (int)compOutDataItr->getTimeBin();
1134 
1135  if (mo_EventDisplay) {
1136  mo_EventDisplay->SetBinContent(nLayer + 11, hstrip, tbin_clct + 1);
1137  setEmuEventDisplayBit(mo_Emu_EventDisplay_Anode, glChamberIndex, 160 + hstrip, nLayer - 1);
1138  setEmuEventDisplayBit(mo_Emu_EventDisplay_XY, glChamberIndex, 160 + hstrip, nLayer - 1);
1139  }
1140 
1141  if(CheckLayerCLCT) {
1142  NumberOfLayersWithHitsInCLCT = NumberOfLayersWithHitsInCLCT + 1;
1143  CheckLayerCLCT = false;
1144  }
1145 
1146  for (uint32_t n=0; n < tbins_clct.size(); n++) {
1147  tbin_clct = tbins_clct[n];
1148  if(hstrip != hstrip_previous || (tbin_clct != tbin_clct_previous + 1 && tbin_clct != tbin_clct_previous - 1) ) {
1149 
1150  if (getCSCHisto(h::CSC_CLCTTIME_LYXX, crateID, dmbID, nLayer, mo)) mo->Fill(hstrip, tbin_clct);
1151 
1152  if (mo_CFEB_Comparators_TimeSamples) mo_CFEB_Comparators_TimeSamples->Fill(tbin_clct);
1153 
1154  if (cid.endcap() == 1) {
1155  if (mo_CSC_Plus_endcap_CFEB_Comparators_Time) mo_CSC_Plus_endcap_CFEB_Comparators_Time->Fill(tbin_clct);
1156  }
1157 
1158  if (cid.endcap() == 2) {
1159  if (mo_CSC_Minus_endcap_CFEB_Comparators_Time) mo_CSC_Minus_endcap_CFEB_Comparators_Time->Fill(tbin_clct);
1160  }
1161 
1162  if (getCSCHisto(h::CSC_CLCTTIME_LYXX_PROFILE, crateID, dmbID, nLayer, mo)) mo->Fill(hstrip, tbin_clct);
1163 
1164  if (getCSCHisto(h::CSC_CLCT_LYXX_RATE, crateID, dmbID, nLayer, mo)) {
1165 
1166  mo->Fill(hstrip);
1167 
1168  double number_hstrip = mo->GetBinContent(hstrip+1);
1169  double Number_of_entries_CLCT = mo->GetEntries();
1170 
1171  if (getCSCHisto(h::CSC_CLCT_LYXX_EFFICIENCY, crateID, dmbID, nLayer, mo)) {
1172  mo->SetBinContent(hstrip + 1, number_hstrip);
1173  if(DMBEvents > 0) {
1174  double norm = (100.0 * Number_of_entries_CLCT) / ((double)(DMBEvents));
1176  mo->SetNormFactor(norm);
1177  } else {
1178  mo->SetNormFactor(100.0);
1179  }
1180  mo->SetEntries(DMBEvents);
1181  }
1182  }
1183  }
1184 
1185  if(hstrip != hstrip_previous) {
1186  NumberOfHalfStripsWithHitsInCLCT = NumberOfHalfStripsWithHitsInCLCT + 1;
1187  }
1188  hstrip_previous = hstrip;
1189  tbin_clct_previous = tbin_clct;
1190  }
1191  }
1192  }
1193  }
1194 
1195  if (mo_CFEB_Comparators_TimeSamples) {
1196 
1197  double comps_time_mean = mo_CFEB_Comparators_TimeSamples->getTH1()->GetMean();
1198  double comps_time_rms = mo_CFEB_Comparators_TimeSamples->getTH1()->GetRMS();
1199 
1200  if ( cscType && cscPosition && mo_CSC_CFEB_Comparators_Time_mean) {
1201  mo_CSC_CFEB_Comparators_Time_mean->SetBinContent(cscPosition, cscType + 1, comps_time_mean);
1202  }
1203  if ( cscType && cscPosition && mo_CSC_CFEB_Comparators_Time_rms) {
1204  mo_CSC_CFEB_Comparators_Time_rms->SetBinContent(cscPosition, cscType + 1, comps_time_rms);
1205  }
1206 
1207  }
1208 
1209  } else {
1210  LOG_ERROR << cscTag << " Can not unpack CLCT Data";
1211  }
1212 
1213  if (getCSCHisto(h::CSC_CLCT_NUMBER_OF_LAYERS_WITH_HITS, crateID, dmbID, mo)) {
1214  mo->Fill(NumberOfLayersWithHitsInCLCT);
1215  MonitorObject* mo1 = 0;
1216  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_CLCT_PLANES_WITH_HITS, mo1)) {
1217  mo1->SetBinContent(cscPosition, cscType + 1, mo->getTH1()->GetMean());
1218  }
1219  }
1220 
1221  if (getCSCHisto(h::CSC_CLCT_NUMBER_OF_HALFSTRIPS_WITH_HITS, crateID, dmbID, mo))
1222  mo->Fill(NumberOfHalfStripsWithHitsInCLCT);
1223  } else {
1224  LOG_ERROR << cscTag << " Can not unpack TMB Header or/and Trailer";
1225  }
1226  } else {
1227  LOG_ERROR << cscTag << " Can not unpack TMB Data";
1228  }
1229 
1230  } else {
1233  if (getCSCHisto(h::CSC_CLCT_NUMBER_RATE, crateID, dmbID, mo)) {
1234  mo->Fill(0);
1235  int nCLCT = (int)mo->GetBinContent(1);
1236  if (getCSCHisto(h::CSC_CLCT_NUMBER, crateID, dmbID, mo)) mo->SetBinContent(1, (float)(nCLCT) / (float)(DMBEvents) * 100.0);
1237  }
1238  if ((tmb_dav > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
1239  mo->Fill(1.0, 1.0);
1240  }
1241  }
1242 
1244  int NumberOfUnpackedCFEBs = 0;
1245  const int N_CFEBs = 5, N_Samples = 16, N_Layers = 6, N_Strips = 16;
1246  int ADC = 0, OutOffRange, Threshold = 30;
1248 // CSCCFEBData * cfebData[5];
1249 // CSCCFEBTimeSlice * timeSlice[5][16];
1250 // CSCCFEBDataWord * timeSample[5][16][6][16];
1251  int Pedestal[5][6][16];
1252  std::pair<int,int> CellPeak[5][6][16];
1253  memset(CellPeak, 0, sizeof(CellPeak));
1254 // float PedestalError[5][6][16];
1255 // CSCCFEBSCAControllerWord scaControllerWord[5][16][6];
1256  bool CheckCFEB = true;
1258  float Clus_Sum_Charge;
1259  int TrigTime, L1APhase, UnpackedTrigTime, LCTPhase, SCA_BLK, NmbTimeSamples;
1261  int FreeCells, LCT_Pipe_Empty, LCT_Pipe_Full, LCT_Pipe_Count, L1_Pipe_Empty, L1_Pipe_Full, Buffer_Count;
1264  bool CheckThresholdStripInTheLayer[6][80];
1265  for(int i=0; i<6; i++) {
1266  for(int j = 0; j < 80; j++) CheckThresholdStripInTheLayer[i][j] = true;
1267  }
1268 
1269  bool CheckOutOffRangeStripInTheLayer[6][80];
1270  for(int i=0; i<6; i++) {
1271  for(int j=0; j<80; j++) CheckOutOffRangeStripInTheLayer[i][j] = true;
1272  }
1273 
1275  float cscdata[N_CFEBs * 16][N_Samples][N_Layers];
1277  int SCABlockData[N_CFEBs * 16][N_Samples][N_Layers];
1278  memset(cscdata, 0, sizeof(cscdata));
1280  memset(SCABlockData, 0, sizeof(SCABlockData));
1283  char hbuf[255];
1284  memset(hbuf, 0, sizeof(hbuf));
1285 
1286  MonitorObject* mo_CFEB_SCA_CellPeak_Time = 0;
1287  getCSCHisto(h::CSC_CFEB_SCA_CELLPEAK_TIME, crateID, dmbID, mo_CFEB_SCA_CellPeak_Time);
1288 
1289  MonitorObject* mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time = 0;
1290  getEMUHisto(h::EMU_CSC_PLUS_ENDCAP_CFEB_SCA_CELLPEAK_TIME, mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time);
1291 
1292  MonitorObject* mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time = 0;
1293  getEMUHisto(h::EMU_CSC_MINUS_ENDCAP_CFEB_SCA_CELLPEAK_TIME, mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time);
1294 
1295  MonitorObject* mo_CSC_CFEB_SCA_CellPeak_Time_mean = 0;
1296  getEMUHisto(h::EMU_CSC_CFEB_SCA_CELLPEAK_TIME_MEAN, mo_CSC_CFEB_SCA_CellPeak_Time_mean);
1297 
1298  MonitorObject* mo_CSC_CFEB_SCA_CellPeak_Time_rms = 0;
1299  getEMUHisto(h::EMU_CSC_CFEB_SCA_CELLPEAK_TIME_RMS, mo_CSC_CFEB_SCA_CellPeak_Time_rms);
1300 
1301  for(int nCFEB = 0; nCFEB < N_CFEBs; ++nCFEB) {
1302 
1303 // cfebData[nCFEB] = data.cfebData(nCFEB);
1304  if (data.cfebData(nCFEB) !=0) {
1305  if (!data.cfebData(nCFEB)->check()) continue;
1307  FEBunpacked = FEBunpacked +1; // Increment number of unpacked FED
1308  NumberOfUnpackedCFEBs = NumberOfUnpackedCFEBs + 1; // Increment number of unpaked CFEB
1309  cfeb_unpacked = 1;
1310  if(CheckCFEB == true){
1311  if (getCSCHisto(h::CSC_CSC_RATE, crateID, dmbID, mo)) {
1312  mo->Fill(4);
1313  uint32_t CFEBEvent = (uint32_t)mo->GetBinContent(5);
1314  config->setChamberCounterValue(CFEB_TRIGGERS, crateID, dmbID, CFEBEvent);
1315  if (getCSCHisto(h::CSC_CSC_EFFICIENCY, crateID, dmbID, mo)) {
1316  if(config->getNEvents() > 0) {
1317  mo->SetBinContent(3, ((float)CFEBEvent/(float)(DMBEvents)*100.0));
1318  mo->SetEntries((int)DMBEvents);
1319  }
1320  }
1321  }
1322 
1323  if ((cfeb_dav2 > 0) && (getCSCHisto(h::CSC_DMB_FEB_UNPACKED_VS_DAV, crateID, dmbID, mo))) {
1324  mo->Fill(2.0, 0.0);
1325  }
1326  CheckCFEB = false;
1327  }
1329  NmbTimeSamples= (data.cfebData(nCFEB))->nTimeSamples();
1335  MonitorObject* mo_CFEB_SCA_Block_Occupancy = 0;
1336  getCSCHisto(h::CSC_CFEBXX_SCA_BLOCK_OCCUPANCY, crateID, dmbID, nCFEB + 1, mo_CFEB_SCA_Block_Occupancy);
1337  MonitorObject* mo_CFEB_Free_SCA_Cells = 0;
1338  getCSCHisto(h::CSC_CFEBXX_FREE_SCA_CELLS, crateID, dmbID, nCFEB + 1, mo_CFEB_Free_SCA_Cells);
1339  MonitorObject* mo_CFEB_SCA_Blocks_Locked_by_LCTs = 0;
1340  getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTS, crateID, dmbID, nCFEB + 1, mo_CFEB_SCA_Blocks_Locked_by_LCTs);
1341  MonitorObject* mo_CFEB_SCA_Blocks_Locked_by_LCTxL1 = 0;
1342  getCSCHisto(h::CSC_CFEBXX_SCA_BLOCKS_LOCKED_BY_LCTXL1, crateID, dmbID, nCFEB + 1, mo_CFEB_SCA_Blocks_Locked_by_LCTxL1);
1343  MonitorObject* mo_CFEB_DMB_L1A_diff = 0;
1344  getCSCHisto(h::CSC_CFEBXX_DMB_L1A_DIFF, crateID, dmbID, nCFEB + 1, mo_CFEB_DMB_L1A_diff);
1345 
1348  for(int nLayer = 1; nLayer <= N_Layers; ++nLayer) {
1350  MonitorObject * mo_CFEB_Out_Off_Range_Strips = 0;
1351  getCSCHisto(h::CSC_CFEB_OUT_OFF_RANGE_STRIPS_LYXX, crateID, dmbID, nLayer, mo_CFEB_Out_Off_Range_Strips);
1352  MonitorObject * mo_CFEB_Active_Samples_vs_Strip = 0;
1353  getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX, crateID, dmbID, nLayer, mo_CFEB_Active_Samples_vs_Strip);
1354  MonitorObject * mo_CFEB_Active_Samples_vs_Strip_Profile = 0;
1355  getCSCHisto(h::CSC_CFEB_ACTIVE_SAMPLES_VS_STRIP_LYXX_PROFILE, crateID, dmbID, nLayer, mo_CFEB_Active_Samples_vs_Strip_Profile);
1356  MonitorObject * mo_CFEB_ActiveStrips = 0;
1357  getCSCHisto(h::CSC_CFEB_ACTIVESTRIPS_LYXX, crateID, dmbID, nLayer, mo_CFEB_ActiveStrips);
1358  MonitorObject * mo_CFEB_SCA_Cell_Peak = 0;
1359  getCSCHisto(h::CSC_CFEB_SCA_CELL_PEAK_LY_XX, crateID, dmbID, nLayer, mo_CFEB_SCA_Cell_Peak);
1360 
1361  MonitorObject * mo_CFEB_Pedestal_withEMV_Sample = 0;
1362  getCSCHisto(h::CSC_CFEB_PEDESTAL_WITHEMV_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_Pedestal_withEMV_Sample);
1363  MonitorObject * mo_CFEB_Pedestal_withRMS_Sample = 0;
1364  getCSCHisto(h::CSC_CFEB_PEDESTAL_WITHRMS_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_Pedestal_withRMS_Sample);
1365  MonitorObject * mo_CFEB_PedestalRMS_Sample = 0;
1366  getCSCHisto(h::CSC_CFEB_PEDESTALRMS_SAMPLE_01_LYXX, crateID, dmbID, nLayer, mo_CFEB_PedestalRMS_Sample);
1367 
1368  for(int nSample = 0; nSample < NmbTimeSamples; ++nSample) {
1369 // timeSlice[nCFEB][nSample] = (CSCCFEBTimeSlice * )((cfebData[nCFEB])->timeSlice(nSample));
1370  if (timeSlice(data, nCFEB, nSample) == 0) {
1371  LOG_WARN << "CFEB" << nCFEB << " nSample: " << nSample << " - B-Word";
1372  continue;
1373  }
1374 
1375  if (mo_CFEB_DMB_L1A_diff && !fCloseL1As ) {
1377  int cfeb_dmb_l1a_diff = (int)((timeSlice(data, nCFEB, nSample)->get_L1A_number())-dmbHeader->l1a()%64);
1378  if (cfeb_dmb_l1a_diff != 0) {
1379  L1A_out_of_sync = true;
1380  }
1381  if(cfeb_dmb_l1a_diff < -32) mo->Fill(cfeb_dmb_l1a_diff + 64);
1382  else {
1383  if(cfeb_dmb_l1a_diff >= 32) mo->Fill(cfeb_dmb_l1a_diff - 64);
1384  else mo_CFEB_DMB_L1A_diff->Fill(cfeb_dmb_l1a_diff);
1385  }
1386  mo_CFEB_DMB_L1A_diff->SetAxisRange(0.1, 1.1*(1.0+mo_CFEB_DMB_L1A_diff->GetBinContent(mo_CFEB_DMB_L1A_diff->GetMaximumBin())), "Y");
1387  }
1388 
1391 // scaControllerWord[nCFEB][nSample][nLayer-1] = timeSlice(cfebData, nCFEB, nSample)->scaControllerWord(nLayer);
1392 
1393  TrigTime = (int)(timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).trig_time);
1395  FreeCells = timeSlice(data, nCFEB, nSample)->get_n_free_sca_blocks();
1396  LCT_Pipe_Empty = timeSlice(data, nCFEB, nSample)->get_lctpipe_empty();
1397  LCT_Pipe_Full = timeSlice(data, nCFEB, nSample)->get_lctpipe_full();
1398  LCT_Pipe_Count = timeSlice(data, nCFEB, nSample)->get_lctpipe_count();
1399  L1_Pipe_Empty = timeSlice(data, nCFEB, nSample)->get_l1pipe_empty();
1400  L1_Pipe_Full = timeSlice(data, nCFEB, nSample)->get_l1pipe_full();
1402  Buffer_Count = timeSlice(data, nCFEB, nSample)->get_buffer_count();
1403 
1404  SCA_BLK = (int)(timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).sca_blk);
1408  for(int nStrip = 0; nStrip < N_Strips; ++nStrip) {
1409  SCABlockData[nCFEB*16+nStrip][nSample][nLayer-1] = SCA_BLK;
1411  }
1416  if (mo_CFEB_SCA_Block_Occupancy) mo_CFEB_SCA_Block_Occupancy->Fill(SCA_BLK);
1417 
1420  if (mo_CFEB_Free_SCA_Cells) {
1421  if (timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).sca_full == 1) mo_CFEB_Free_SCA_Cells->Fill(-1);
1422  mo_CFEB_Free_SCA_Cells->Fill(FreeCells);
1423  }
1424 
1427  if (mo_CFEB_SCA_Blocks_Locked_by_LCTs) {
1428  if (LCT_Pipe_Empty == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(-0.5);
1429  if (LCT_Pipe_Full == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(16.5);
1430  mo_CFEB_SCA_Blocks_Locked_by_LCTs->Fill(LCT_Pipe_Count);
1431  }
1432 
1435  if (mo_CFEB_SCA_Blocks_Locked_by_LCTxL1) {
1436  if (L1_Pipe_Empty == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(-0.5);
1437  if (L1_Pipe_Full == 1) mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(31.5);
1438  mo_CFEB_SCA_Blocks_Locked_by_LCTxL1->Fill(Buffer_Count);
1439  }
1440 
1443  if(nSample == 0 && nLayer == 1) {
1444  TrigTime = (int)(timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).trig_time);
1445  int k = 1;
1446  while (((TrigTime >> (k-1)) & 0x1) != 1 && k <= 8) {
1447  k = k + 1;
1448  }
1449  L1APhase = (int)((timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).l1a_phase) & 0x1);
1450  UnpackedTrigTime = ((k << 1) & 0xE) + L1APhase;
1451 
1452  if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME, crateID, dmbID, nCFEB + 1, mo))
1453  mo->Fill((int)UnpackedTrigTime);
1454  LCTPhase = (int)((timeSlice(data, nCFEB, nSample)->scaControllerWord(nLayer).lct_phase)&0x1);
1455 
1456  if (getCSCHisto(h::CSC_CFEBXX_LCT_PHASE_VS_L1A_PHASE, crateID, dmbID, nCFEB + 1, mo))
1457  mo->Fill(LCTPhase, L1APhase);
1458 
1461  if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME_VS_DMB, crateID, dmbID, nCFEB + 1, mo))
1462  mo->Fill((int)(dmbHeader->dmbCfebSync()), (int)UnpackedTrigTime);
1463 
1464  if (getCSCHisto(h::CSC_CFEBXX_L1A_SYNC_TIME_DMB_DIFF, crateID, dmbID, nCFEB + 1, mo)) {
1465  int cfeb_dmb_L1A_sync_time = (int)(dmbHeader->dmbCfebSync()) - (int)UnpackedTrigTime;
1466  if(cfeb_dmb_L1A_sync_time < -8) mo->Fill(cfeb_dmb_L1A_sync_time+16);
1467  else {
1468  if(cfeb_dmb_L1A_sync_time >= 8) mo->Fill(cfeb_dmb_L1A_sync_time-16);
1469  else mo->Fill(cfeb_dmb_L1A_sync_time);
1470  }
1471  mo->SetAxisRange(0.1, 1.1*(1.0+mo->GetBinContent(mo->GetMaximumBin())), "Y");
1472  }
1473 
1474  }
1475 
1476 
1477  for(int nStrip = 1; nStrip <= N_Strips; ++nStrip) {
1478 // timeSample[nCFEB][nSample][nLayer - 1][nStrip - 1]=(data.cfebData(nCFEB)->timeSlice(nSample))->timeSample(nLayer,nStrip);
1479  ADC = (int) ((timeSample(data, nCFEB, nSample, nLayer, nStrip)->adcCounts) & 0xFFF);
1481  OutOffRange = (int) ((timeSample(data, nCFEB, nSample, nLayer, nStrip)->adcOverflow) & 0x1);
1482 
1483  if(nSample == 0) { // nSample == 0
1484  CellPeak[nCFEB][nLayer-1][nStrip-1] = std::make_pair(nSample,ADC);
1485  Pedestal[nCFEB][nLayer-1][nStrip-1] = ADC;
1487  }
1488 
1489  if(OutOffRange == 1 && CheckOutOffRangeStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] == true) {
1491  if ( mo_CFEB_Out_Off_Range_Strips)
1492  mo_CFEB_Out_Off_Range_Strips->Fill((int)(nCFEB * 16 + nStrip - 1));
1493  CheckOutOffRangeStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] = false;
1494  }
1495  if(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1] > Threshold && OutOffRange != 1) {
1497  if (mo_CFEB_Active_Samples_vs_Strip)
1498  mo_CFEB_Active_Samples_vs_Strip->Fill((int)(nCFEB * 16 + nStrip - 1), nSample);
1499 
1501  if (mo_CFEB_Active_Samples_vs_Strip_Profile)
1502  mo_CFEB_Active_Samples_vs_Strip_Profile->Fill((int)(nCFEB * 16 + nStrip - 1), nSample);
1503 
1504  if(CheckThresholdStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] == true) {
1506  if (mo_CFEB_ActiveStrips)
1507  mo_CFEB_ActiveStrips->Fill((int)(nCFEB * 16 + nStrip));
1508  CheckThresholdStripInTheLayer[nLayer - 1][nCFEB * 16 + nStrip - 1] = false;
1509  }
1511  if(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1] > Threshold) {
1513  cscdata[nCFEB * 16 + nStrip - 1][nSample][nLayer - 1] = ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1];
1514  }
1516  if(ADC > CellPeak[nCFEB][nLayer - 1][nStrip - 1].second) {
1517  CellPeak[nCFEB][nLayer - 1][nStrip - 1].first = nSample;
1518  CellPeak[nCFEB][nLayer - 1][nStrip - 1].second = ADC;
1519  }
1520  }
1523  if(nSample == 1) {
1524  int channel_threshold = 40;
1525  if (std::abs(ADC - Pedestal[nCFEB][nLayer - 1][nStrip - 1]) < channel_threshold) {
1527  if (mo_CFEB_Pedestal_withEMV_Sample)
1528  mo_CFEB_Pedestal_withEMV_Sample->Fill((int)(nCFEB * 16 + nStrip - 1), Pedestal[nCFEB][nLayer - 1][nStrip - 1]);
1529 
1531  if (mo_CFEB_Pedestal_withRMS_Sample) {
1532  mo_CFEB_Pedestal_withRMS_Sample->Fill((int)(nCFEB * 16 + nStrip - 1), Pedestal[nCFEB][nLayer - 1][nStrip - 1]);
1533 // PedestalError[nCFEB][nLayer - 1][nStrip - 1] = mo_CFEB_Pedestal_withRMS_Sample->GetBinError(nCFEB * 16 + nStrip);
1534 
1536  if (mo_CFEB_PedestalRMS_Sample) {
1537  mo_CFEB_PedestalRMS_Sample->SetBinContent(nCFEB * 16 + nStrip - 1, mo_CFEB_Pedestal_withRMS_Sample->GetBinError(nCFEB * 16 + nStrip));
1538  mo_CFEB_PedestalRMS_Sample->SetBinError(nCFEB * 16 + nStrip - 1, 0.00000000001);
1539  }
1540  }
1541  }
1542  Pedestal[nCFEB][nLayer-1][nStrip-1] += ADC;
1543  Pedestal[nCFEB][nLayer-1][nStrip-1] /= 2;
1544  }
1546  }
1547  }
1548 
1549  for(int nStrip = 1; nStrip <= N_Strips; ++nStrip) {
1550  if (mo_CFEB_SCA_Cell_Peak && CellPeak[nCFEB][nLayer - 1][nStrip - 1].first) {
1551  mo_CFEB_SCA_Cell_Peak->Fill((int)(nCFEB * 16 + nStrip - 1), CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
1552  if (mo_CFEB_SCA_CellPeak_Time) {
1553  mo_CFEB_SCA_CellPeak_Time->Fill(CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
1554  }
1555 
1556  if (mo_EventDisplay) {
1557  int peak_sample = CellPeak[nCFEB][nLayer-1][nStrip-1].first;
1558  int peak_adc = CellPeak[nCFEB][nLayer-1][nStrip-1].second;
1559  int pedestal = Pedestal[nCFEB][nLayer-1][nStrip-1];
1560  int peak_sca_charge = peak_adc - pedestal;
1561 
1562  if (peak_adc - pedestal > Threshold) {
1563  if (peak_sample >=1) {
1564  peak_sca_charge += ((timeSample(data, nCFEB, peak_sample-1, nLayer, nStrip)->adcCounts)&0xFFF)-pedestal;
1565  }
1566  if (peak_sample < NmbTimeSamples-1) {
1567  peak_sca_charge += ((timeSample(data, nCFEB, peak_sample+1, nLayer, nStrip)->adcCounts)&0xFFF)-pedestal;
1568  }
1569  mo_EventDisplay->SetBinContent(nLayer + 17, nCFEB * 16 + nStrip - 1, peak_sca_charge);
1570  setEmuEventDisplayBit(mo_Emu_EventDisplay_Cathode, glChamberIndex, nCFEB * 16 + nStrip - 1, nLayer - 1);
1571  }
1572  }
1573 
1574  if (cid.endcap() == 1) {
1575  if (mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time)
1576  mo_CSC_Plus_endcap_CFEB_SCA_CellPeak_Time->Fill(CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
1577  }
1578  if (cid.endcap() == 2) {
1579  if (mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time)
1580  mo_CSC_Minus_endcap_CFEB_SCA_CellPeak_Time->Fill(CellPeak[nCFEB][nLayer - 1][nStrip - 1].first);
1581  }
1582  }
1583  }
1584 
1585  }
1586  }
1587 
1588  }
1589 
1590  // Fill Summary CFEB Raw Hits Timing Plots
1591  if (mo_CFEB_SCA_CellPeak_Time) {
1592  double cellpeak_time_mean = mo_CFEB_SCA_CellPeak_Time->getTH1()->GetMean();
1593  double cellpeak_time_rms = mo_CFEB_SCA_CellPeak_Time->getTH1()->GetRMS();
1594  if (cscType && cscPosition && mo_CSC_CFEB_SCA_CellPeak_Time_mean) {
1595  mo_CSC_CFEB_SCA_CellPeak_Time_mean->SetBinContent(cscPosition, cscType + 1, cellpeak_time_mean);
1596  }
1597  if (cscType && cscPosition && mo_CSC_CFEB_SCA_CellPeak_Time_rms) {
1598  mo_CSC_CFEB_SCA_CellPeak_Time_rms->SetBinContent(cscPosition, cscType + 1 ,cellpeak_time_rms);
1599  }
1600  }
1601 
1604  const int a = N_CFEBs * N_Strips;
1605  const int b = a * N_Samples;
1606  float Cathodes[b * N_Layers];
1607  for(int i = 0; i < N_Layers; ++i) {
1608  const int b1 = i * b;
1609  for(int j = 0; j < a; ++j) {
1610  const int b2 = b1 + j;
1611  for(int k = 0; k < N_Samples; ++k) {
1612  Cathodes[b2 + a * k] = cscdata[j][k][i];
1613  }
1614  }
1615  }
1616 
1617  std::vector<StripCluster> Clus;
1618  Clus.clear();
1619  StripClusterFinder ClusterFinder(N_Layers, N_Samples, N_CFEBs, N_Strips);
1620 
1621  for(int nLayer = 1; nLayer <= N_Layers; ++nLayer) {
1622 
1625  ClusterFinder.DoAction(nLayer - 1, Cathodes);
1626  Clus = ClusterFinder.getClusters();
1627 
1630  if (getCSCHisto(h::CSC_CFEB_NUMBER_OF_CLUSTERS_LY_XX, crateID, dmbID, nLayer, mo)) {
1631  // Allways true because Clus.size() = unsigned
1632  // if (Clus.size() >= 0)
1633  mo->Fill(Clus.size());
1634  }
1635 
1636  for(uint32_t u = 0; u < Clus.size(); u++){
1637 
1638  Clus_Sum_Charge = 0.0;
1639 
1640  for(uint32_t k = 0;k < Clus[u].ClusterPulseMapHeight.size(); k++) {
1641 
1644  for(int n = Clus[u].LFTBNDTime; n < Clus[u].IRTBNDTime; n++) {
1645  Clus_Sum_Charge = Clus_Sum_Charge + Clus[u].ClusterPulseMapHeight[k].height_[n];
1646  }
1647 
1648  }
1649 
1651  if (getCSCHisto(h::CSC_CFEB_CLUSTERS_CHARGE_LY_XX, crateID, dmbID, nLayer, mo)) {
1652  mo->Fill(Clus_Sum_Charge);
1653  }
1654 
1656  if (getCSCHisto(h::CSC_CFEB_WIDTH_OF_CLUSTERS_LY_XX, crateID, dmbID, nLayer, mo)) {
1657  mo->Fill(Clus[u].IRTBNDStrip - Clus[u].LFTBNDStrip + 1);
1658  }
1659 
1661  if (getCSCHisto(h::CSC_CFEB_CLUSTER_DURATION_LY_XX, crateID, dmbID, nLayer, mo)) {
1662  mo->Fill(Clus[u].IRTBNDTime - Clus[u].LFTBNDTime + 1);
1663  }
1664 
1665  }
1666 
1667  Clus.clear();
1668 
1670  }
1671 
1675  if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_UNPACKED_VS_DAV, crateID, dmbID, mo)) {
1676  float feb_combination_unpacked = -1.0;
1677  if(alct_unpacked == 0 && tmb_unpacked == 0 && cfeb_unpacked == 0) feb_combination_unpacked = 0.0;
1678  if(alct_unpacked > 0 && tmb_unpacked == 0 && cfeb_unpacked == 0) feb_combination_unpacked = 1.0;
1679  if(alct_unpacked == 0 && tmb_unpacked > 0 && cfeb_unpacked == 0) feb_combination_unpacked = 2.0;
1680  if(alct_unpacked == 0 && tmb_unpacked == 0 && cfeb_unpacked > 0) feb_combination_unpacked = 3.0;
1681  if(alct_unpacked > 0 && tmb_unpacked > 0 && cfeb_unpacked == 0) feb_combination_unpacked = 4.0;
1682  if(alct_unpacked > 0 && tmb_unpacked == 0 && cfeb_unpacked > 0) feb_combination_unpacked = 5.0;
1683  if(alct_unpacked == 0 && tmb_unpacked > 0 && cfeb_unpacked > 0) feb_combination_unpacked = 6.0;
1684  if(alct_unpacked > 0 && tmb_unpacked > 0 && cfeb_unpacked > 0) feb_combination_unpacked = 7.0;
1685  mo->Fill(feb_combination_dav, feb_combination_unpacked);
1686  }
1687 
1688  if((clct_kewdistrip > -1 && alct_keywg > -1) && (getCSCHisto(h::CSC_CLCT0_KEYDISTRIP_VS_ALCT0_KEYWIREGROUP, crateID, dmbID, mo))) {
1689  mo->Fill(alct_keywg, clct_kewdistrip);
1690  }
1691 
1692  if (L1A_out_of_sync && cscType && cscPosition && getEMUHisto(h::EMU_CSC_L1A_OUT_OF_SYNC, mo)){
1693  mo->Fill(cscPosition, cscType);
1694  }
1695 
1696  if (L1A_out_of_sync && getEMUHisto(h::EMU_DMB_L1A_OUT_OF_SYNC, mo)){
1697  mo->Fill(crateID, dmbID);
1698  }
1699 
1700  }
1701 
1702 }
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:36
CSCTMBTrailer * tmbTrailer()
Definition: CSCTMBData.h:49
const bool getCSCFromMap(const unsigned int &crateId, const unsigned int &dmbId, unsigned int &cscType, unsigned int &cscPosition) const
Get CSC type and position from crate and dmb identifiers.
int i
Definition: DBlmapReader.cc:9
int wordCount() const
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:87
unsigned l1a() const
Definition: CSCDMBHeader.cc:74
const unsigned long getNEvents() const
virtual void SetAxisRange(const double from, const double to, const std::string &axis)=0
unsigned alct_endtimeout
Definition: CSCDMBTrailer.h:47
unsigned nclct() const
Definition: CSCDMBHeader.cc:46
std::vector< StripCluster > getClusters()
virtual void SetEntries(const double value)=0
#define LOG_INFO
Definition: CSCDQM_Logger.h:43
bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
Check if chamber is in standby?
unsigned cfeb_half
Definition: CSCDMBTrailer.h:32
unsigned short adcOverflow
unsigned tmb_endtimeout
Definition: CSCDMBTrailer.h:46
unsigned cfebActive() const
Definition: CSCDMBHeader.h:31
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
Definition: CSCEventData.h:112
virtual void Fill(float x)=0
Monitoring Object interface used to cover Root object and provide common interface to EventProcessor ...
uint16_t CLCTOnly() const
Definition: CSCTMBHeader.h:42
uint16_t L1ANumber() const
Definition: CSCTMBHeader.h:59
unsigned tmb_timeout
Definition: CSCDMBTrailer.h:38
unsigned get_l1pipe_full() const
unsigned alct_full
Definition: CSCDMBTrailer.h:55
virtual const double GetBinError(const int bin)=0
virtual const double GetEntries()=0
uint16_t Bxn1Diff() const
Definition: CSCTMBHeader.h:55
unsigned cfeb_full
Definition: CSCDMBTrailer.h:53
Object used to find Strip Clusters.
ExaminerStatusType errorsForChamber(CSCIdType chamber) const
unsigned nalct() const
Definition: CSCDMBHeader.cc:41
void processCSC(const CSCEventData &data, const int dduID, const CSCDCCExaminer &binChecker)
Process Chamber Data and fill MOs.
#define abs(x)
Definition: mlp_lapack.h:159
#define NULL
Definition: scimark2.h:8
const std::string getPath() const
Get path part of the histogram (used only for DDUs and CSCs)
unsigned cfebMovlp() const
Definition: CSCDMBHeader.cc:18
void setEmuEventDisplayBit(MonitorObject *&mo, const unsigned int x, const unsigned int y, const unsigned int bit)
Set a single bit in the 3D Histogram (aka EMU level event display). Checks if mo and x != null...
virtual const TH1 * getTH1(void) const =0
CSCAnodeData * alctData() const
user must check if nalct &gt; 0
virtual const int GetMaximumBin()=0
virtual void SetNormFactor(const double factor=1)=0
CSCALCTHeader * alctHeader() const
user must check if nalct &gt; 0
bool check() const
makes sure each time slice has a trailer
Definition: CSCCFEBData.cc:290
CSCCFEBSCAControllerWord scaControllerWord(int layer) const
unpacked from the controller words for each channel in the layer
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:84
int wordCount() const
const bool getCSCHisto(const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, MonitorObject *&me)
Get CSC (Chamber) Level Monitoring Object.
unsigned get_buffer_count() const
unsigned cfeb_empty
Definition: CSCDMBTrailer.h:52
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int endcap() const
Definition: CSCDetId.h:95
U second(std::pair< T, U > const &p)
CSCCLCTData * clctData() const
user must check if nclct &gt; 0
CSCALCTTrailer * alctTrailer() const
user must check if nalct &gt; 0
virtual TH1 * getTH1Lock(void)=0
unsigned get_lctpipe_empty() const
unsigned alct_timeout
Definition: CSCDMBTrailer.h:39
unsigned cfeb_starttimeout
Definition: CSCDMBTrailer.h:45
virtual void SetBinContent(const int binX, const double value)=0
CSCTMBData * tmbData() const
user must check in nclct &gt; 0
uint16_t ALCTOnly() const
Definition: CSCTMBHeader.h:45
boost::function< bool(const unsigned int, const unsigned int, CSCDetId &) > fnGetCSCDetId
int j
Definition: DBlmapReader.cc:9
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:52
unsigned alct_empty
Definition: CSCDMBTrailer.h:41
CSCDetId chamberID(const CSCDetId &cscDetId)
takes layer ID, converts to chamber ID, switching ME1A to ME11
Definition: CSCDigiToRaw.cc:32
void setChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId, const uint32_t value)
Set Chamber counter value.
const Detector getDetector() const
unsigned tmb_half
Definition: CSCDMBTrailer.h:33
bool first
Definition: L1TdeRCT.cc:94
unsigned bxn12() const
Definition: CSCDMBHeader.cc:66
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:39
std::vector< CSCComparatorDigi > comparatorDigis(int layer)
layers count from one
Definition: CSCCLCTData.cc:167
unsigned get_n_free_sca_blocks() const
void DoAction(int layerId, float *cathodes)
int k[5][pyjets_maxn]
unsigned get_l1pipe_empty() const
std::vector< CSCALCTDigi > ALCTDigis() const
int ring() const
Definition: CSCDetId.h:77
unsigned crateID() const
Definition: CSCDMBHeader.cc:51
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:80
unsigned short int alctFirmwareVersion() const
Definition: CSCALCTHeader.h:86
unsigned dmb_l1pipe
Definition: CSCDMBTrailer.h:42
virtual void SetBinError(const int bin, const double error)=0
unsigned short int L1Acc() const
Definition: CSCALCTHeader.h:68
std::vector< CSCWireDigi > wireDigis(int layer) const
input layer is from 1 to 6
Definition: CSCAnodeData.h:24
unsigned cfeb_endtimeout
Definition: CSCDMBTrailer.h:48
double b
Definition: hdecay.h:120
bool check() const
Definition: CSCCLCTData.cc:212
const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
Get Chamber counter value.
CSCCFEBTimeSlice const *const timeSlice(T const &data, int nCFEB, int nSample)
void copyChamberCounterValue(const ChamberCounterType counter_from, const ChamberCounterType counter_to, const HwId crateId, const HwId dmbId)
Copy Chamber counter value from one counter to another.
#define LOG_WARN
Definition: CSCDQM_Logger.h:42
unsigned tmb_full
Definition: CSCDMBTrailer.h:54
unsigned dmbID() const
Definition: CSCDMBHeader.cc:56
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:38
virtual double GetBinContent(const int binX)=0
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
uint16_t TMBMatch() const
Definition: CSCTMBHeader.h:48
CSCCFEBDataWord const *const timeSample(T const &data, int nCFEB, int nSample, int nLayer, int nStrip)
double a
Definition: hdecay.h:121
CSCCFEBData * cfebData(unsigned icfeb) const
unpacked in long mode: has overflow and error bits decoded
void resetEmuEventDisplays()
Reset Emu level EventDisplay histograms once per event.
bool fCloseL1As
Total Number of TMBs per event from DMB DAV.
int station() const
Definition: CSCDetId.h:88
unsigned int GlobalChamberIndex(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
Return global chamber index on his geometric location.
unsigned alct_half
Definition: CSCDMBTrailer.h:34
unsigned tmb_empty
Definition: CSCDMBTrailer.h:40
unsigned short adcCounts
struct ADC ADC
x
Definition: VDTMath.h:216
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.
unsigned short int BXNCount() const
Definition: CSCALCTHeader.h:55
long double T
const CSCDMBHeader * dmbHeader() const
the DAQ motherboard header. A good place for event and chamber info
Definition: CSCEventData.h:90
unsigned dmbCfebSync() const
Definition: CSCDMBHeader.cc:24
unsigned get_lctpipe_count() const
bool cfebAvailable(unsigned icfeb)
counts from zero
#define LOG_ERROR
Definition: CSCDQM_Logger.h:41
unsigned get_lctpipe_full() const