CMS 3D CMS Logo

DTConfigDBProducer.cc
Go to the documentation of this file.
2 
6 
13 
16 
21 
22 #include <iomanip>
23 #include <iostream>
24 
25 using std::cout;
26 using std::endl;
27 using std::unique_ptr;
28 using std::vector;
29 
30 //
31 // constructors and destructor
32 //
33 
35  // tell the framework what record is being produced
37 
38  cfgConfig = p.getParameter<bool>("cfgConfig");
39 
40  // get and store parameter set and config manager pointer
41  m_ps = p;
42 
43  // debug flags
44  m_debugDB = p.getParameter<bool>("debugDB");
45  m_debugBti = p.getParameter<int>("debugBti");
46  m_debugTraco = p.getParameter<int>("debugTraco");
47  m_debugTSP = p.getParameter<bool>("debugTSP");
48  m_debugTST = p.getParameter<bool>("debugTST");
49  m_debugTU = p.getParameter<bool>("debugTU");
50  m_debugSC = p.getParameter<bool>("debugSC");
51  m_debugLUTs = p.getParameter<bool>("debugLUTs");
52  m_debugPed = p.getParameter<bool>("debugPed");
53 
54  m_UseT0 = p.getParameter<bool>("UseT0"); // CB check for a better way to do it
55 }
56 
58 
59 //
60 // member functions
61 //
62 
63 std::unique_ptr<DTConfigManager>
65  using namespace edm;
66 
67  std::unique_ptr<DTConfigManager> dtConfig =
68  std::unique_ptr<DTConfigManager>(new DTConfigManager());
69  DTConfigManager &dttpgConfig = *(dtConfig.get());
70 
71  // DB specific requests
72  bool tracoLutsFromDB = m_ps.getParameter<bool>("TracoLutsFromDB");
73  bool useBtiAcceptParam = m_ps.getParameter<bool>("UseBtiAcceptParam");
74 
75  // set specific DB requests
76  dttpgConfig.setLutFromDB(tracoLutsFromDB);
77  dttpgConfig.setUseAcceptParam(useBtiAcceptParam);
78 
79  // set debug
80  edm::ParameterSet conf_ps =
81  m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
82  bool dttpgdebug = conf_ps.getUntrackedParameter<bool>("Debug");
83  dttpgConfig.setDTTPGDebug(dttpgdebug);
84 
85  int code;
86  if (cfgConfig) {
87  dttpgConfig.setLutFromDB(false);
88  configFromCfg(dttpgConfig);
89  code = 2;
90  } else {
91  code = readDTCCBConfig(iRecord, dttpgConfig);
92  readDBPedestalsConfig(iRecord, dttpgConfig);
93  // 110628 SV add config check
94  if (code != -1 && checkDTCCBConfig(dttpgConfig) > 0)
95  code = -1;
96  }
97  // cout << "DTConfigDBProducer::produce CODE " << code << endl;
98  if (code == -1) {
99  dttpgConfig.setCCBConfigValidity(false);
100  } else if (code == 2) {
101  LogVerbatim("DTTPG") << "DTConfigDBProducer::produce : Trivial : " << endl
102  << "configurations has been read from cfg" << endl;
103  } else if (code == 0) {
104  LogVerbatim("DTTPG") << "DTConfigDBProducer::produce : " << endl
105  << "Configurations successfully read from OMDS"
106  << endl;
107  } else {
108  LogProblem("DTTPG") << "DTConfigDBProducer::produce : " << endl
109  << "Wrong configuration return CODE" << endl;
110  }
111 
112  return dtConfig;
113 }
114 
116  const DTConfigManagerRcd &iRecord, DTConfigManager &dttpgConfig) {
117 
118  edm::ESHandle<DTTPGParameters> dttpgParams;
119  iRecord.getRecord<DTTPGParametersRcd>().get(dttpgParams);
120 
121  DTConfigPedestals pedestals;
122  pedestals.setDebug(m_debugPed);
123 
124  if (m_UseT0) {
125 
127  iRecord.getRecord<DTT0Rcd>().get(t0i);
128 
129  pedestals.setUseT0(true);
130  pedestals.setES(dttpgParams.product(), t0i.product());
131  // cout << "checkDTCCBConfig CODE is " << checkDTCCBConfig() << endl;
132 
133  } else {
134 
135  pedestals.setUseT0(false);
136  pedestals.setES(dttpgParams.product());
137  }
138 
139  dttpgConfig.setDTConfigPedestals(pedestals);
140 }
141 
143  // 110627 SV test if configuration from CCB has correct number of chips,
144  // return error code:
145  // check_cfg_code = 1 : NO correct BTI number
146  // check_cfg_code = 2 : NO correct TRACO number
147  // check_cfg_code = 3 : NO correct valid TSS number
148  // check_cfg_code = 4 : NO correct valid TSM number
149 
150  int check_cfg_code = 0;
151 
152  // do not take chambers from MuonGeometryRecord to avoid geometry dependency
153  for (int iwh = -2; iwh <= 2; iwh++) {
154  for (int ise = 1; ise <= 12; ise++) {
155  for (int ist = 1; ist <= 4; ist++) {
156 
157  check_cfg_code = 0;
158  DTChamberId chid(iwh, ist, ise);
159 
160  // retrive number of configurated chip
161  int nbti = dttpgConfig.getDTConfigBtiMap(chid).size();
162  int ntraco = dttpgConfig.getDTConfigTracoMap(chid).size();
163  int ntss = dttpgConfig.getDTConfigTSPhi(chid)->nValidTSS();
164  int ntsm = dttpgConfig.getDTConfigTSPhi(chid)->nValidTSM();
165 
166  // check BTIs
167  if ((ist == 1 && nbti != 168) || (ist == 2 && nbti != 192) ||
168  (ist == 3 && nbti != 224) ||
169  (ist == 4 &&
170  (ise == 1 || ise == 2 || ise == 3 || ise == 5 || ise == 6 ||
171  ise == 7 || ise == 8 || ise == 12) &&
172  nbti != 192) ||
173  (ist == 4 && (ise == 9 || ise == 11) && nbti != 96) ||
174  (ist == 4 && ise == 10 && nbti != 128) ||
175  (ist == 4 && ise == 4 && nbti != 160)) {
176  check_cfg_code = 1;
177  return check_cfg_code;
178  }
179 
180  // check TRACOs
181  if ((ist == 1 && ntraco != 13) || (ist == 2 && ntraco != 16) ||
182  (ist == 3 && ntraco != 20) ||
183  (ist == 4 &&
184  (ise == 1 || ise == 2 || ise == 3 || ise == 5 || ise == 6 ||
185  ise == 7 || ise == 8 || ise == 12) &&
186  ntraco != 24) ||
187  (ist == 4 && (ise == 9 || ise == 11) && ntraco != 12) ||
188  (ist == 4 && ise == 10 && ntraco != 16) ||
189  (ist == 4 && ise == 4 && ntraco != 20)) {
190  check_cfg_code = 2;
191  return check_cfg_code;
192  }
193 
194  // check TSS
195  if ((ist == 1 && ntss != 4) || (ist == 2 && ntss != 4) ||
196  (ist == 3 && ntss != 5) ||
197  (ist == 4 &&
198  (ise == 1 || ise == 2 || ise == 3 || ise == 5 || ise == 6 ||
199  ise == 7 || ise == 8 || ise == 12) &&
200  ntss != 6) ||
201  (ist == 4 && (ise == 9 || ise == 11) && ntss != 3) ||
202  (ist == 4 && ise == 10 && ntss != 4) ||
203  (ist == 4 && ise == 4 && ntss != 5)) {
204  check_cfg_code = 3;
205  return check_cfg_code;
206  }
207 
208  // check TSM
209  if (ntsm != 1) {
210  check_cfg_code = 4;
211  return check_cfg_code;
212  }
213 
214  // if(check_cfg_code){
215  // cout << "nbti " << nbti << " ntraco " << ntraco << " ntss " << ntss
216  // << " ntsm " << ntsm << endl; cout << "Check: ch " << ist << " sec "
217  // << ise << " wh " << iwh << " == >check_cfg_code " << check_cfg_code
218  // << endl;
219  //}
220  } // end st loop
221  } // end sec loop
222 
223  // SV MB4 has two more chambers
224  for (int ise = 13; ise <= 14; ise++) {
225 
226  DTChamberId chid(iwh, 4, ise);
227 
228  int nbti = dttpgConfig.getDTConfigBtiMap(chid).size();
229  int ntraco = dttpgConfig.getDTConfigTracoMap(chid).size();
230  int ntss = dttpgConfig.getDTConfigTSPhi(chid)->nValidTSS();
231  int ntsm = dttpgConfig.getDTConfigTSPhi(chid)->nValidTSM();
232 
233  if ((ise == 13 && nbti != 160) || (ise == 14 && nbti != 128)) {
234  check_cfg_code = 1;
235  return check_cfg_code;
236  }
237  if ((ise == 13 && ntraco != 20) || (ise == 14 && ntraco != 16)) {
238  check_cfg_code = 2;
239  return check_cfg_code;
240  }
241  if ((ise == 13 && ntss != 5) || (ise == 14 && ntss != 4)) {
242  check_cfg_code = 3;
243  return check_cfg_code;
244  }
245  if (ntsm != 1) {
246  check_cfg_code = 4;
247  return check_cfg_code;
248  }
249  // if(check_cfg_code){
250  // cout << "nbti " << nbti << " ntraco " << ntraco << " ntss " << ntss <<
251  // " ntsm " << ntsm << endl; cout << "Check: ch " << 4 << " sec " << ise
252  // << " wh " << iwh << " == >check_cfg_code " << check_cfg_code << endl;
253  //}
254  } // end sec 13 14
255 
256  } // end wh loop
257 
258  // cout << "CheckDTCCB: config OK! check_cfg_code = " << check_cfg_code <<
259  // endl;
260  return check_cfg_code;
261 }
262 
264  DTConfigManager &dttpgConfig) {
265  using namespace edm::eventsetup;
266 
267  // initialize CCB validity flag
268  dttpgConfig.setCCBConfigValidity(true);
269 
270  // get DTCCBConfigRcd from DTConfigManagerRcd (they are dependent records)
272  iRecord.getRecord<DTCCBConfigRcd>().get(ccb_conf);
273  int ndata = std::distance(ccb_conf->begin(), ccb_conf->end());
274 
275  const DTKeyedConfigListRcd &keyRecord =
276  iRecord.getRecord<DTKeyedConfigListRcd>();
277 
278  if (m_debugDB) {
279  cout << ccb_conf->version() << endl;
280  cout << ndata << " data in the container" << endl;
281  }
282 
285  unsigned int currValidityStart = iov.first().eventID().run();
286  unsigned int currValidityEnd = iov.last().eventID().run();
287 
288  if (m_debugDB)
289  cout << "valid since run " << currValidityStart << " to run "
290  << currValidityEnd << endl;
291 
292  // if there are no data in the container, configuration from cfg files...
293  if (ndata == 0) {
294  return -1;
295  }
296 
297  // get DTTPGMap for retrieving bti number and traco number
298  edm::ParameterSet conf_map =
300 
301  // loop over chambers
302  DTCCBConfig::ccb_config_map configKeys(ccb_conf->configKeyMap());
303  DTCCBConfig::ccb_config_iterator iter = configKeys.begin();
304  DTCCBConfig::ccb_config_iterator iend = configKeys.end();
305 
306  // 110628 SV check that number of CCB is equal to total number of chambers
307  if (ccb_conf->configKeyMap().size() != 250) // check the number of chambers!!!
308  return -1;
309 
310  // read data from CCBConfig
311  while (iter != iend) {
312  // 110628 SV moved here from constructor, to check config consistency for
313  // EVERY chamber initialize flags to check if data are present in OMDS
314  flagDBBti = false;
315  flagDBTraco = false;
316  flagDBTSS = false;
317  flagDBTSM = false;
318  flagDBLUTS = false;
319 
320  // get chamber id
321  const DTCCBId &ccbId = iter->first;
322  if (m_debugDB)
323  cout << " Filling configuration for chamber : wh " << ccbId.wheelId
324  << " st " << ccbId.stationId << " se " << ccbId.sectorId << " -> "
325  << endl;
326 
327  // get chamber type and id from ccbId
328  int mbtype =
329  DTPosNegType::getCT(ccbId.wheelId, ccbId.sectorId, ccbId.stationId);
330  int posneg =
331  DTPosNegType::getPN(ccbId.wheelId, ccbId.sectorId, ccbId.stationId);
332  if (m_debugDB)
333  cout << "Chamber type : " << mbtype << " posneg : " << posneg << endl;
334  DTChamberId chambid(ccbId.wheelId, ccbId.stationId, ccbId.sectorId);
335 
336  // get brick identifiers list
337  const std::vector<int> &ccbConf = iter->second;
338  std::vector<int>::const_iterator cfgIter = ccbConf.begin();
339  std::vector<int>::const_iterator cfgIend = ccbConf.end();
340 
341  // TSS-TSM buffers
342  unsigned short int tss_buffer[7][31];
343  unsigned short int tsm_buffer[9];
344  int ntss = 0;
345 
346  // loop over configuration bricks
347  while (cfgIter != cfgIend) {
348  // get brick identifier
349  int id = *cfgIter++;
350  if (m_debugDB)
351  cout << " BRICK " << id << endl;
352 
353  // create strings list
354  std::vector<std::string> list;
355  cfgCache.getData(keyRecord, id, list);
356 
357  // loop over strings
358  std::vector<std::string>::const_iterator s_iter = list.begin();
359  std::vector<std::string>::const_iterator s_iend = list.end();
360  while (s_iter != s_iend) {
361  if (m_debugDB)
362  cout << " ----> " << *s_iter << endl;
363 
364  // copy string in unsigned int buffer
365  std::string str = *s_iter++;
366  unsigned short int buffer[100]; // 2 bytes
367  int c = 0;
368  const char *cstr = str.c_str();
369  const char *ptr = cstr + 2;
370  const char *end = cstr + str.length();
371  while (ptr < end) {
372  char c1 = *ptr++;
373  int i1 = 0;
374  if ((c1 >= '0') && (c1 <= '9'))
375  i1 = c1 - '0';
376  if ((c1 >= 'a') && (c1 <= 'f'))
377  i1 = 10 + c1 - 'a';
378  if ((c1 >= 'A') && (c1 <= 'F'))
379  i1 = 10 + c1 - 'A';
380  char c2 = *ptr++;
381  int i2 = 0;
382  if ((c2 >= '0') && (c2 <= '9'))
383  i2 = c2 - '0';
384  if ((c2 >= 'a') && (c2 <= 'f'))
385  i2 = 10 + c2 - 'a';
386  if ((c2 >= 'A') && (c2 <= 'F'))
387  i2 = 10 + c2 - 'A';
388  buffer[c] = (i1 * 16) + i2;
389  c++;
390  } // end loop over string
391 
392  // BTI configuration string
393  if (buffer[2] == 0x54) {
394  if (m_debugDB)
395  cout << "BTI STRING found in DB" << endl;
396 
397  // BTI configuration read for BTI
398  flagDBBti = true;
399 
400  // compute sl and bti number from board and chip
401  int brd = buffer[3]; // Board Nr.
402  int chip = buffer[4]; // Chip Nr.
403 
404  if (brd > 7) {
405  cout << "Not existing board ... " << brd << endl;
406  return -1; // Non-existing board
407  }
408  if (chip > 31) {
409  cout << "Not existing chip... " << chip << endl;
410  return -1; // Non existing chip
411  }
412 
413  // Is it Phi or Theta board?
414  bool ThetaSL, PhiSL;
415  PhiSL = false;
416  ThetaSL = false;
417  switch (mbtype) {
418  case 1: // mb1
419  if (brd == 6 || brd == 7) {
420  ThetaSL = true;
421  brd -= 6;
422  } else if ((brd < 3 && chip < 32) || (brd == 3 && chip < 8))
423  PhiSL = true;
424  break;
425  case 2: // mb2
426  if (brd == 6 || brd == 7) {
427  ThetaSL = true;
428  brd -= 6;
429  } else if (brd < 4 && chip < 32)
430  PhiSL = true;
431  break;
432  case 3: // mb3
433  if (brd == 6 || brd == 7) {
434  ThetaSL = true;
435  brd -= 6;
436  } else if (brd < 5 && chip < 32)
437  PhiSL = true;
438  break;
439  case 4: // mb4-s, mb4_8
440  if (brd < 6 && chip < 32)
441  PhiSL = true;
442  break;
443  case 5: // mb4-9
444  if (brd < 3 && chip < 32)
445  PhiSL = true;
446  break;
447  case 6: // mb4-4
448  if (brd < 5 && chip < 32)
449  PhiSL = true;
450  break;
451  case 7: // mb4-10
452  if (brd < 4 && chip < 32)
453  PhiSL = true;
454  break;
455  }
456  if (!PhiSL && !ThetaSL) {
457  cout << "MB type " << mbtype << endl;
458  cout << "Board " << brd << " chip " << chip << endl;
459  cout << "Not phi SL nor Theta SL" << endl;
460  return -1; // Not PhiSL nor ThetaSL
461  }
462 
463  // compute SL number and bti number
464  int isl = 0;
465  int ibti = 0;
466  if (PhiSL) {
467  if ((chip % 8) < 4)
468  isl = 1; // Phi1
469  else
470  isl = 3; // Phi2
471  ibti = brd * 16 + (int)(chip / 8) * 4 + (chip % 4);
472  } else if (ThetaSL) {
473  isl = 2; // Theta
474  if ((chip % 8) < 4)
475  ibti = brd * 32 + chip - 4 * (int)(chip / 8);
476  else
477  ibti = brd * 32 + chip + 12 - 4 * (int)(chip / 8);
478  }
479 
480  // BTI config constructor from strings
481  DTConfigBti bticonf(m_debugBti, buffer);
482 
483  dttpgConfig.setDTConfigBti(DTBtiId(chambid, isl, ibti + 1), bticonf);
484 
485  if (m_debugDB)
486  cout << "Filling BTI config for chamber : wh " << chambid.wheel()
487  << ", st " << chambid.station() << ", se " << chambid.sector()
488  << "... sl " << isl << ", bti " << ibti + 1 << endl;
489  }
490 
491  // TRACO configuration string
492  if (buffer[2] == 0x15) {
493  if (m_debugDB)
494  cout << "TRACO STRING found in DB" << endl;
495  // TRACO configuration read from OMDS
496  flagDBTraco = true;
497 
498  // TRACO config constructor from strings
499  int traco_brd = buffer[3]; // Board Nr.;
500  int traco_chip = buffer[4]; // Chip Nr.;
501  int itraco = traco_brd * 4 + traco_chip + 1;
502  DTConfigTraco tracoconf(m_debugTraco, buffer);
503  dttpgConfig.setDTConfigTraco(DTTracoId(chambid, itraco), tracoconf);
504 
505  if (m_debugDB)
506  cout << "Filling TRACO config for chamber : wh " << chambid.wheel()
507  << ", st " << chambid.station() << ", se " << chambid.sector()
508  << ", board " << traco_brd << ", chip " << traco_chip
509  << ", traco " << itraco << endl;
510  }
511 
512  // TSS configuration string
513  if (buffer[2] == 0x16) {
514  if (m_debugDB)
515  cout << "TSS STRING found in DB" << endl;
516  // TSS configuration read from OMDS
517  flagDBTSS = true;
518 
519  unsigned short int itss = buffer[3];
520  for (int i = 0; i < 31; i++)
521  tss_buffer[itss][i] = buffer[i];
522  ntss++;
523  }
524 
525  // TSM configuration string
526  if (buffer[2] == 0x17) {
527  if (m_debugDB)
528  cout << "TSM STRING found in DB" << endl;
529 
530  // TSM configuration read from OMDS
531  flagDBTSM = true;
532 
533  for (int i = 0; i < 9; i++)
534  tsm_buffer[i] = buffer[i];
535  }
536 
537  // LUT configuration string
538  if (buffer[2] == 0xA8) {
539  if (m_debugDB)
540  cout << "LUT STRING found in DB" << endl;
541 
542  // LUT parameters read from OMDS
543  flagDBLUTS = true;
544  DTConfigLUTs lutconf(m_debugLUTs, buffer);
545  // lutconf.setDebug(m_debugLUTs);
546  dttpgConfig.setDTConfigLUTs(chambid, lutconf);
547  }
548 
549  } // end string iteration
550  } // end brick iteration
551 
552  // TSS + TSM configurations are set in DTConfigTSPhi constructor
553  if (flagDBTSM && flagDBTSS) {
554  DTConfigTSPhi tsphiconf(m_debugTSP, tss_buffer, ntss, tsm_buffer);
555  dttpgConfig.setDTConfigTSPhi(chambid, tsphiconf);
556  }
557 
558  // get configuration for TSTheta, SC and TU from .cfg
559  edm::ParameterSet conf_ps =
560  m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
561  edm::ParameterSet tups =
562  conf_ps.getParameter<edm::ParameterSet>("TUParameters");
563 
564  // TSTheta configuration from .cfg
565  DTConfigTSTheta tsthetaconf(
566  tups.getParameter<edm::ParameterSet>("TSThetaParameters"));
567  tsthetaconf.setDebug(m_debugTST);
568  dttpgConfig.setDTConfigTSTheta(chambid, tsthetaconf);
569 
570  // SC configuration from .cfg
571  DTConfigSectColl sectcollconf(
572  conf_ps.getParameter<edm::ParameterSet>("SectCollParameters"));
573  sectcollconf.setDebug(m_debugSC);
574  dttpgConfig.setDTConfigSectColl(
575  DTSectCollId(chambid.wheel(), chambid.sector()), sectcollconf);
576 
577  // TU configuration from .cfg
578  DTConfigTrigUnit trigunitconf(tups);
579  trigunitconf.setDebug(m_debugTU);
580  dttpgConfig.setDTConfigTrigUnit(chambid, trigunitconf);
581 
582  ++iter;
583 
584  // 110628 SV moved inside CCB loop to check for every chamber
585  // moved to exception handling no attempt to configure from cfg is DB is
586  // missing SV comment exception handling and activate flag in
587  // DTConfigManager
588  if (!flagDBBti || !flagDBTraco || !flagDBTSS || !flagDBTSM) {
589  return -1;
590  }
591  if (!flagDBLUTS && dttpgConfig.lutFromDB() == true) {
592  return -1;
593  }
594  } // end loop over CCB
595 
596  return 0;
597 }
598 
600  int iwh = chambid.wheel();
601  std::ostringstream os;
602  os << "wh";
603  if (iwh < 0) {
604  os << 'm' << -iwh;
605  } else {
606  os << iwh;
607  }
608  os << "st" << chambid.station() << "se" << chambid.sector();
609  return os.str();
610 }
611 
613 
614  // ... but still set CCB validity flag to let the emulator run
615  dttpgConfig.setCCBConfigValidity(true);
616 
617  // create config classes&C.
618  edm::ParameterSet conf_ps =
619  m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
620  edm::ParameterSet conf_map =
622  bool dttpgdebug = conf_ps.getUntrackedParameter<bool>("Debug");
623  DTConfigSectColl sectcollconf(
624  conf_ps.getParameter<edm::ParameterSet>("SectCollParameters"));
625  edm::ParameterSet tups =
626  conf_ps.getParameter<edm::ParameterSet>("TUParameters");
627  DTConfigBti bticonf(tups.getParameter<edm::ParameterSet>("BtiParameters"));
628  DTConfigTraco tracoconf(
629  tups.getParameter<edm::ParameterSet>("TracoParameters"));
630  DTConfigTSTheta tsthetaconf(
631  tups.getParameter<edm::ParameterSet>("TSThetaParameters"));
632  DTConfigTSPhi tsphiconf(
633  tups.getParameter<edm::ParameterSet>("TSPhiParameters"));
634  DTConfigTrigUnit trigunitconf(tups);
635  DTConfigLUTs lutconf(tups.getParameter<edm::ParameterSet>("LutParameters"));
636 
637  for (int iwh = -2; iwh <= 2; ++iwh) {
638  for (int ist = 1; ist <= 4; ++ist) {
639  for (int ise = 1; ise <= 12; ++ise) {
640  DTChamberId chambid(iwh, ist, ise);
641  vector<int> nmap = conf_map.getUntrackedParameter<vector<int>>(
642  mapEntryName(chambid).c_str());
643 
644  if (dttpgdebug) {
645  cout << " Filling configuration for chamber : wh " << chambid.wheel()
646  << ", st " << chambid.station() << ", se " << chambid.sector()
647  << endl;
648  }
649 
650  // fill the bti map
651  if (!flagDBBti) {
652  for (int isl = 1; isl <= 3; isl++) {
653  int ncell = nmap[isl - 1];
654  // cout << ncell <<" , ";
655  for (int ibti = 0; ibti < ncell; ibti++) {
656  dttpgConfig.setDTConfigBti(DTBtiId(chambid, isl, ibti + 1),
657  bticonf);
658  if (dttpgdebug)
659  cout << "Filling BTI config for chamber : wh "
660  << chambid.wheel() << ", st " << chambid.station()
661  << ", se " << chambid.sector() << "... sl " << isl
662  << ", bti " << ibti + 1 << endl;
663  }
664  }
665  }
666 
667  // fill the traco map
668  if (!flagDBTraco) {
669  int ntraco = nmap[3];
670  // cout << ntraco << " }" << endl;
671  for (int itraco = 0; itraco < ntraco; itraco++) {
672  dttpgConfig.setDTConfigTraco(DTTracoId(chambid, itraco + 1),
673  tracoconf);
674  if (dttpgdebug)
675  cout << "Filling TRACO config for chamber : wh "
676  << chambid.wheel() << ", st " << chambid.station() << ", se "
677  << chambid.sector() << ", traco " << itraco + 1 << endl;
678  }
679  }
680 
681  // fill TS & TrigUnit
682  if (!flagDBTSS || !flagDBTSM) {
683  dttpgConfig.setDTConfigTSTheta(chambid, tsthetaconf);
684  dttpgConfig.setDTConfigTSPhi(chambid, tsphiconf);
685  dttpgConfig.setDTConfigTrigUnit(chambid, trigunitconf);
686  }
687  }
688  }
689  }
690 
691  for (int iwh = -2; iwh <= 2; ++iwh) {
692  for (int ise = 13; ise <= 14; ++ise) {
693  int ist = 4;
694  DTChamberId chambid(iwh, ist, ise);
695  vector<int> nmap = conf_map.getUntrackedParameter<vector<int>>(
696  mapEntryName(chambid).c_str());
697 
698  if (dttpgdebug) {
699  cout << " Filling configuration for chamber : wh " << chambid.wheel()
700  << ", st " << chambid.station() << ", se " << chambid.sector()
701  << endl;
702  }
703 
704  // fill the bti map
705  if (!flagDBBti) {
706  for (int isl = 1; isl <= 3; isl++) {
707  int ncell = nmap[isl - 1];
708  // cout << ncell <<" , ";
709  for (int ibti = 0; ibti < ncell; ibti++) {
710  dttpgConfig.setDTConfigBti(DTBtiId(chambid, isl, ibti + 1),
711  bticonf);
712  if (dttpgdebug)
713  cout << "Filling BTI config for chamber : wh " << chambid.wheel()
714  << ", st " << chambid.station() << ", se "
715  << chambid.sector() << "... sl " << isl << ", bti "
716  << ibti + 1 << endl;
717  }
718  }
719  }
720 
721  // fill the traco map
722  if (!flagDBTraco) {
723  int ntraco = nmap[3];
724  // cout << ntraco << " }" << endl;
725  for (int itraco = 0; itraco < ntraco; itraco++) {
726  dttpgConfig.setDTConfigTraco(DTTracoId(chambid, itraco + 1),
727  tracoconf);
728  if (dttpgdebug)
729  cout << "Filling TRACO config for chamber : wh " << chambid.wheel()
730  << ", st " << chambid.station() << ", se " << chambid.sector()
731  << ", traco " << itraco + 1 << endl;
732  }
733  }
734 
735  // fill TS & TrigUnit
736  if (!flagDBTSS || !flagDBTSM) {
737  dttpgConfig.setDTConfigTSTheta(chambid, tsthetaconf);
738  dttpgConfig.setDTConfigTSPhi(chambid, tsphiconf);
739  dttpgConfig.setDTConfigTrigUnit(chambid, trigunitconf);
740  }
741  }
742  }
743 
744  // loop on Sector Collectors
745  for (int wh = -2; wh <= 2; wh++)
746  for (int se = 1; se <= 12; se++)
747  dttpgConfig.setDTConfigSectColl(DTSectCollId(wh, se), sectcollconf);
748 
749  // fake collection of pedestals
751 
752  return;
753 }
754 
756  DTTPGParameters *m_tpgParams = new DTTPGParameters();
757 
758  int counts = m_ps.getParameter<int>("bxOffset");
759  float fine = m_ps.getParameter<double>("finePhase");
760 
761  if (m_debugPed)
762  cout << "DTConfigTrivialProducer::buildPedestals()" << endl;
763 
764  // DTTPGParameters tpgParams;
765  for (int iwh = -2; iwh <= 2; ++iwh) {
766  for (int ist = 1; ist <= 4; ++ist) {
767  for (int ise = 1; ise <= 14; ++ise) {
768  if (ise > 12 && ist != 4)
769  continue;
770 
771  DTChamberId chId(iwh, ist, ise);
772  m_tpgParams->set(chId, counts, fine, DTTimeUnits::ns);
773  }
774  }
775  }
776 
777  DTConfigPedestals tpgPedestals;
778  tpgPedestals.setUseT0(false);
779  tpgPedestals.setES(m_tpgParams);
780 
781  return tpgPedestals;
782 }
RunNumber_t run() const
Definition: EventID.h:39
std::string mapEntryName(const DTChamberId &chambid) const
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
T getUntrackedParameter(std::string const &, T const &) const
int readDTCCBConfig(const DTConfigManagerRcd &iRecord, DTConfigManager &dttpgConfig)
Read CCB string configuration.
void setDTConfigTSTheta(DTChamberId chambid, DTConfigTSTheta conf)
Set DTConfigTSTheta for desired chip.
ccb_config_map::const_iterator ccb_config_iterator
Definition: DTCCBConfig.h:87
int wheelId
Definition: DTCCBConfig.h:45
const EventID & eventID() const
Definition: IOVSyncValue.h:40
edm::ParameterSet m_ps
int set(int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
void getData(const DTKeyedConfigListRcd &keyRecord, int cfgId, std::vector< std::string > &list)
void setES(DTTPGParameters const *tpgParams, DTT0 const *t0Params=nullptr)
Set parameters from ES.
DTKeyedConfigCache cfgCache
const std::string & version() const
access version
Definition: DTCCBConfig.cc:152
void setDebug(bool debug)
Set debug flag.
void setDebug(bool debug)
Set debug flag.
const_iterator end() const
Definition: DTCCBConfig.cc:291
DTConfigPedestals buildTrivialPedestals()
SV for debugging purpose ONLY.
ccb_config_map configKeyMap() const
Definition: DTCCBConfig.cc:113
DTConfigDBProducer(const edm::ParameterSet &)
Constructor.
int nValidTSM() const
Number of correctly configured TSS.
int sectorId
Definition: DTCCBConfig.h:47
void setDTConfigTraco(DTTracoId, DTConfigTraco)
Set DTConfigTraco for desired chip.
std::unique_ptr< DTConfigManager > produce(const DTConfigManagerRcd &)
ES produce method.
int checkDTCCBConfig(DTConfigManager &dttpgConfig)
110629 SV function for CCB configuration check
static int getPN(int whe, int sec, int sta)
Definition: DTPosNegType.cc:82
int stationId
Definition: DTCCBConfig.h:46
void setDTConfigBti(DTBtiId, DTConfigBti)
Set DTConfigBti for desired chip.
const std::map< DTBtiId, DTConfigBti > & getDTConfigBtiMap(DTChamberId) const
Get desired BTI configuration map for a given DTChamber.
void configFromCfg(DTConfigManager &dttpgConfig)
SV for debugging purpose ONLY.
void setDTConfigTSPhi(DTChamberId chambid, DTConfigTSPhi conf)
Set DTConfigTSPhi for desired chip.
#define end
Definition: vmac.h:39
void setUseT0(bool useT0)
Set t0i subtraction.
std::vector< std::pair< DTCCBId, std::vector< int > > > ccb_config_map
Definition: DTCCBConfig.h:86
void setDebug(bool debug)
Set debug flag.
const std::map< DTTracoId, DTConfigTraco > & getDTConfigTracoMap(DTChamberId) const
Get desired TRACO configuration map for a given DTChamber.
void setDTConfigLUTs(DTChamberId chambid, DTConfigLUTs conf)
Set DTConfigLUTs for desired chamber.
void setDTConfigPedestals(DTConfigPedestals pedestals)
Set DTConfigPedestals configuration.
static int getCT(int whe, int sec, int sta)
Definition: DTPosNegType.cc:93
void setDTConfigSectColl(DTSectCollId sectcollid, DTConfigSectColl conf)
Set DTConfigSectColl for desired chip.
void readDBPedestalsConfig(const DTConfigManagerRcd &iRecord, DTConfigManager &dttpgConfig)
Read DTTPG pedestal configuration.
bool lutFromDB() const
Lut from DB flag.
void setCCBConfigValidity(bool CCBValid)
Set the flag for CCB configuration validity.
Definition: DTT0Rcd.h:9
int nValidTSS() const
Number of correctly configured TSS.
HLT enums.
int sector() const
Definition: DTChamberId.h:61
const DTConfigTSPhi * getDTConfigTSPhi(DTChamberId) const
Get desired Trigger Server Phi configuration.
~DTConfigDBProducer() override
Destructor.
const IOVSyncValue & first() const
int station() const
Return the station number.
Definition: DTChamberId.h:51
void setDTConfigTrigUnit(DTChamberId chambid, DTConfigTrigUnit conf)
Set DTConfigTrigUnit for desired chamber.
#define str(s)
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
ValidityInterval const & validityInterval() const
const_iterator begin() const
Definition: DTCCBConfig.cc:286
T const * product() const
Definition: ESHandle.h:86
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run