164 std::unique_ptr<DTConfigManager> dtConfig = std::make_unique<DTConfigManager>();
172 dttpgConfig.setLutFromDB(tracoLutsFromDB);
173 dttpgConfig.setUseAcceptParam(useBtiAcceptParam);
178 dttpgConfig.setDTTPGDebug(dttpgdebug);
182 dttpgConfig.setLutFromDB(
false);
194 dttpgConfig.setCCBConfigValidity(
false);
195 }
else if (code == 2) {
196 LogVerbatim(
"DTTPG") <<
"DTConfigDBProducer::produce : Trivial : " << endl
197 <<
"configurations has been read from cfg" << endl;
198 }
else if (code == 0) {
199 LogVerbatim(
"DTTPG") <<
"DTConfigDBProducer::produce : " << endl
200 <<
"Configurations successfully read from OMDS" << endl;
202 LogProblem(
"DTTPG") <<
"DTConfigDBProducer::produce : " << endl <<
"Wrong configuration return CODE" << endl;
221 pedestals.
setES(&dttpgParams);
235 int check_cfg_code = 0;
238 for (
int iwh = -2; iwh <= 2; iwh++) {
239 for (
int ise = 1; ise <= 12; ise++) {
240 for (
int ist = 1; ist <= 4; ist++) {
251 if ((ist == 1 && nbti != 168) || (ist == 2 && nbti != 192) || (ist == 3 && nbti != 224) ||
253 (ise == 1 || ise == 2 || ise == 3 || ise == 5 || ise == 6 || ise == 7 || ise == 8 || ise == 12) &&
255 (ist == 4 && (ise == 9 || ise == 11) && nbti != 96) || (ist == 4 && ise == 10 && nbti != 128) ||
256 (ist == 4 && ise == 4 && nbti != 160)) {
258 return check_cfg_code;
262 if ((ist == 1 && ntraco != 13) || (ist == 2 && ntraco != 16) || (ist == 3 && ntraco != 20) ||
264 (ise == 1 || ise == 2 || ise == 3 || ise == 5 || ise == 6 || ise == 7 || ise == 8 || ise == 12) &&
266 (ist == 4 && (ise == 9 || ise == 11) && ntraco != 12) || (ist == 4 && ise == 10 && ntraco != 16) ||
267 (ist == 4 && ise == 4 && ntraco != 20)) {
269 return check_cfg_code;
273 if ((ist == 1 && ntss != 4) || (ist == 2 && ntss != 4) || (ist == 3 && ntss != 5) ||
275 (ise == 1 || ise == 2 || ise == 3 || ise == 5 || ise == 6 || ise == 7 || ise == 8 || ise == 12) &&
277 (ist == 4 && (ise == 9 || ise == 11) && ntss != 3) || (ist == 4 && ise == 10 && ntss != 4) ||
278 (ist == 4 && ise == 4 && ntss != 5)) {
280 return check_cfg_code;
286 return check_cfg_code;
299 for (
int ise = 13; ise <= 14; ise++) {
307 if ((ise == 13 && nbti != 160) || (ise == 14 && nbti != 128)) {
309 return check_cfg_code;
311 if ((ise == 13 && ntraco != 20) || (ise == 14 && ntraco != 16)) {
313 return check_cfg_code;
315 if ((ise == 13 && ntss != 5) || (ise == 14 && ntss != 4)) {
317 return check_cfg_code;
321 return check_cfg_code;
334 return check_cfg_code;
338 using namespace edm::eventsetup;
350 cout << ccb_conf.version() << endl;
351 cout << ndata <<
" data in the container" << endl;
356 unsigned int currValidityEnd = iov.last().eventID().run();
359 cout <<
"valid since run " << currValidityStart <<
" to run " << currValidityEnd << endl;
375 if (ccb_conf.configKeyMap().size() != 250)
381 while (iter != iend) {
391 const DTCCBId &ccbId = iter->first;
393 cout <<
" Filling configuration for chamber : wh " << ccbId.
wheelId <<
" st " << ccbId.
stationId <<
" se "
394 << ccbId.
sectorId <<
" -> " << endl;
400 cout <<
"Chamber type : " << mbtype <<
" posneg : " << posneg << endl;
404 const std::vector<int> &ccbConf = iter->second;
405 std::vector<int>::const_iterator cfgIter = ccbConf.begin();
406 std::vector<int>::const_iterator cfgIend = ccbConf.end();
409 unsigned short int tss_buffer[7][31];
410 unsigned short int tsm_buffer[9];
414 while (cfgIter != cfgIend) {
418 cout <<
" BRICK " <<
id << endl;
421 std::vector<std::string> list;
426 std::vector<std::string>::const_iterator s_iter = list.begin();
427 std::vector<std::string>::const_iterator s_iend = list.end();
428 while (s_iter != s_iend) {
430 cout <<
" ----> " << *s_iter << endl;
434 unsigned short int buffer[100];
436 const char *cstr = str.c_str();
437 const char *ptr = cstr + 2;
438 const char *
end = cstr + str.length();
442 if ((c1 >=
'0') && (c1 <=
'9'))
444 if ((c1 >=
'a') && (c1 <=
'f'))
446 if ((c1 >=
'A') && (c1 <=
'F'))
450 if ((c2 >=
'0') && (c2 <=
'9'))
452 if ((c2 >=
'a') && (c2 <=
'f'))
454 if ((c2 >=
'A') && (c2 <=
'F'))
456 buffer[
c] = (i1 * 16) + i2;
461 if (buffer[2] == 0x54) {
463 cout <<
"BTI STRING found in DB" << endl;
470 int chip = buffer[4];
473 cout <<
"Not existing board ... " << brd << endl;
477 cout <<
"Not existing chip... " << chip << endl;
487 if (brd == 6 || brd == 7) {
490 }
else if ((brd < 3 && chip < 32) || (brd == 3 && chip < 8))
494 if (brd == 6 || brd == 7) {
497 }
else if (brd < 4 && chip < 32)
501 if (brd == 6 || brd == 7) {
504 }
else if (brd < 5 && chip < 32)
508 if (brd < 6 && chip < 32)
512 if (brd < 3 && chip < 32)
516 if (brd < 5 && chip < 32)
520 if (brd < 4 && chip < 32)
524 if (!PhiSL && !ThetaSL) {
525 cout <<
"MB type " << mbtype << endl;
526 cout <<
"Board " << brd <<
" chip " << chip << endl;
527 cout <<
"Not phi SL nor Theta SL" << endl;
539 ibti = brd * 16 + (int)(chip / 8) * 4 + (chip % 4);
540 }
else if (ThetaSL) {
543 ibti = brd * 32 + chip - 4 * (
int)(chip / 8);
545 ibti = brd * 32 + chip + 12 - 4 * (int)(chip / 8);
554 cout <<
"Filling BTI config for chamber : wh " << chambid.
wheel() <<
", st " << chambid.
station() <<
", se "
555 << chambid.
sector() <<
"... sl " << isl <<
", bti " << ibti + 1 << endl;
559 if (buffer[2] == 0x15) {
561 cout <<
"TRACO STRING found in DB" << endl;
566 int traco_brd = buffer[3];
567 int traco_chip = buffer[4];
568 int itraco = traco_brd * 4 + traco_chip + 1;
573 cout <<
"Filling TRACO config for chamber : wh " << chambid.
wheel() <<
", st " << chambid.
station()
574 <<
", se " << chambid.
sector() <<
", board " << traco_brd <<
", chip " << traco_chip <<
", traco "
579 if (buffer[2] == 0x16) {
581 cout <<
"TSS STRING found in DB" << endl;
585 unsigned short int itss = buffer[3];
586 for (
int i = 0;
i < 31;
i++)
587 tss_buffer[itss][
i] = buffer[
i];
592 if (buffer[2] == 0x17) {
594 cout <<
"TSM STRING found in DB" << endl;
599 for (
int i = 0;
i < 9;
i++)
600 tsm_buffer[
i] = buffer[
i];
604 if (buffer[2] == 0xA8) {
606 cout <<
"LUT STRING found in DB" << endl;
661 int iwh = chambid.
wheel();
662 std::ostringstream os;
690 for (
int iwh = -2; iwh <= 2; ++iwh) {
691 for (
int ist = 1; ist <= 4; ++ist) {
692 for (
int ise = 1; ise <= 12; ++ise) {
694 vector<int> nmap = conf_map.getUntrackedParameter<vector<int>>(
mapEntryName(chambid).c_str());
697 cout <<
" Filling configuration for chamber : wh " << chambid.
wheel() <<
", st " << chambid.
station()
698 <<
", se " << chambid.
sector() << endl;
703 for (
int isl = 1; isl <= 3; isl++) {
704 int ncell = nmap[isl - 1];
706 for (
int ibti = 0; ibti < ncell; ibti++) {
709 cout <<
"Filling BTI config for chamber : wh " << chambid.
wheel() <<
", st " << chambid.
station()
710 <<
", se " << chambid.
sector() <<
"... sl " << isl <<
", bti " << ibti + 1 << endl;
717 int ntraco = nmap[3];
719 for (
int itraco = 0; itraco < ntraco; itraco++) {
722 cout <<
"Filling TRACO config for chamber : wh " << chambid.
wheel() <<
", st " << chambid.
station()
723 <<
", se " << chambid.
sector() <<
", traco " << itraco + 1 << endl;
737 for (
int iwh = -2; iwh <= 2; ++iwh) {
738 for (
int ise = 13; ise <= 14; ++ise) {
741 vector<int> nmap = conf_map.getUntrackedParameter<vector<int>>(
mapEntryName(chambid).c_str());
744 cout <<
" Filling configuration for chamber : wh " << chambid.
wheel() <<
", st " << chambid.
station() <<
", se "
745 << chambid.
sector() << endl;
750 for (
int isl = 1; isl <= 3; isl++) {
751 int ncell = nmap[isl - 1];
753 for (
int ibti = 0; ibti < ncell; ibti++) {
756 cout <<
"Filling BTI config for chamber : wh " << chambid.
wheel() <<
", st " << chambid.
station()
757 <<
", se " << chambid.
sector() <<
"... sl " << isl <<
", bti " << ibti + 1 << endl;
764 int ntraco = nmap[3];
766 for (
int itraco = 0; itraco < ntraco; itraco++) {
769 cout <<
"Filling TRACO config for chamber : wh " << chambid.
wheel() <<
", st " << chambid.
station()
770 <<
", se " << chambid.
sector() <<
", traco " << itraco + 1 << endl;
784 for (
int wh = -2; wh <= 2; wh++)
785 for (
int se = 1; se <= 12; se++)
801 cout <<
"DTConfigTrivialProducer::buildPedestals()" << endl;
804 for (
int iwh = -2; iwh <= 2; ++iwh) {
805 for (
int ist = 1; ist <= 4; ++ist) {
806 for (
int ise = 1; ise <= 14; ++ise) {
807 if (ise > 12 && ist != 4)
818 tpgPedestals.
setES(m_tpgParams);
std::string mapEntryName(const DTChamberId &chambid) const
Log< level::Info, true > LogVerbatim
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
T getUntrackedParameter(std::string const &, T const &) const
int readDTCCBConfig(const DTConfigManagerRcd &iRecord, DTConfigManager &dttpgConfig)
Read CCB string configuration.
const edm::EventSetup & c
void setDTConfigTSTheta(DTChamberId chambid, DTConfigTSTheta conf)
Set DTConfigTSTheta for desired chip.
std::vector< std::pair< DTCCBId, std::vector< int > > > ccb_config_map
ccb_config_map::const_iterator ccb_config_iterator
const EventID & eventID() const
int set(int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
void setES(DTTPGParameters const *tpgParams, DTT0 const *t0Params=nullptr)
Set parameters from ES.
DTKeyedConfigCache cfgCache
edm::ESGetToken< DTTPGParameters, DTTPGParametersRcd > m_dttpgParamsToken
void setDebug(bool debug)
Set debug flag.
void setDebug(bool debug)
Set debug flag.
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
DTConfigPedestals buildTrivialPedestals()
SV for debugging purpose ONLY.
DTConfigDBProducer(const edm::ParameterSet &)
Constructor.
int nValidTSM() const
Number of correctly configured TSS.
void setDTConfigTraco(DTTracoId, DTConfigTraco)
Set DTConfigTraco for desired chip.
std::unique_ptr< DTConfigManager > produce(const DTConfigManagerRcd &)
ES produce method.
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
int checkDTCCBConfig(DTConfigManager &dttpgConfig)
110629 SV function for CCB configuration check
static int getPN(int whe, int sec, int sta)
const DepRecordT getRecord() const
void setDTConfigBti(DTBtiId, DTConfigBti)
Set DTConfigBti for desired chip.
edm::ESGetToken< DTT0, DTT0Rcd > m_t0iToken
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.
edm::ESGetToken< cond::persistency::KeyList, DTKeyedConfigListRcd > m_keyListToken
void setDTConfigTSPhi(DTChamberId chambid, DTConfigTSPhi conf)
Set DTConfigTSPhi for desired chip.
void setUseT0(bool useT0)
Set t0i subtraction.
edm::ESGetToken< DTCCBConfig, DTCCBConfigRcd > m_ccb_confToken
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)
void setDTConfigSectColl(DTSectCollId sectcollid, DTConfigSectColl conf)
Set DTConfigSectColl for desired chip.
void readDBPedestalsConfig(const DTConfigManagerRcd &iRecord, DTConfigManager &dttpgConfig)
Read DTTPG pedestal configuration.
void getData(const cond::persistency::KeyList &keyList, int cfgId, std::vector< std::string > &list)
T getParameter(std::string const &) const
bool lutFromDB() const
Lut from DB flag.
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
ValidityInterval validityInterval() const
void setCCBConfigValidity(bool CCBValid)
Set the flag for CCB configuration validity.
int nValidTSS() const
Number of correctly configured TSS.
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.
void setDTConfigTrigUnit(DTChamberId chambid, DTConfigTrigUnit conf)
Set DTConfigTrigUnit for desired chamber.
int wheel() const
Return the wheel number.
Log< level::Error, true > LogProblem