164 std::ostringstream ss;
167 unsigned long long max_since = 1;
173 std::cout <<
" max_since : " << max_since << std::endl;
176 uint16_t oldEBStatus[72][17][2];
177 uint16_t newEBStatus[72][17][2];
178 uint16_t oldEEStatus[20][20][2];
179 uint16_t newEEStatus[20][20][2];
190 for(
int k = 0 ;
k < 2;
k++ ) {
192 for(
int iphi = 1 ; iphi < 73; iphi++) {
193 for(
int ieta = 1 ; ieta < 18; ieta++) {
197 uint16_t dbStatus = 0;
198 dbStatus =(daq_db->barrel( ebid.hashedIndex())).getStatusCode();
199 oldEBStatus[iphi - 1][ieta -1][
k] = dbStatus;
202 if ( it != daq_db->end() ) {
204 std::cout<<
"*** error channel not found: eta/phi ="<< ieta <<
"/" << iphi << std::endl;
206 daq_temp->
setValue( ebid, dbStatus );
207 if(
m_debug && dbStatus != 0)
std::cout <<
"barrel side " <<
k <<
" phi " << iphi <<
" eta " << ieta <<
" status " << dbStatus << std::endl;
213 for(
int ix = 1 ; ix < 21; ix++) {
214 for(
int iy = 1 ; iy < 21; iy++) {
220 uint16_t dbStatus = 0;
221 if ( it != daq_db->end() ) {
222 dbStatus = it->getStatusCode();
224 oldEEStatus[ix - 1][iy -1][
k] = dbStatus;
225 daq_temp->
setValue( eeid, dbStatus );
226 if(
m_debug && dbStatus != 0)
std::cout <<
"endcap side " <<
k <<
" x " << ix <<
" y " << iy <<
" status " << dbStatus << std::endl;
236 for(
int k = 0 ;
k < 2;
k++ ) {
238 for(
int iphi = 1 ; iphi < 73; iphi++) {
239 for(
int ieta = 1 ; ieta < 18; ieta++) {
243 uint16_t dbStatus = 0;
244 oldEBStatus[iphi - 1][ieta -1][
k] = dbStatus;
245 daq_temp->
setValue( ebid, dbStatus );
250 for(
int ix = 1 ; ix < 21; ix++) {
251 for(
int iy = 1 ; iy < 21; iy++) {
254 uint16_t dbStatus = 0;
255 oldEEStatus[ix - 1][iy -1][
k] = dbStatus;
256 daq_temp->
setValue( eeid, dbStatus );
266 if(
m_debug)
std::cout <<
"Retrieving DAQ status from OMDS DB ... " << std::endl;
290 min_run= (
int)max_since+1;
294 std::cout <<
"min_run " << min_run <<
" max_run " << max_run << std::endl;
299 std::vector<RunIOV> run_vec = my_list.
getRuns();
300 int num_runs = run_vec.size();
302 std::cout <<
" number of runs is : " << num_runs << std::endl;
304 unsigned long irun=0;
312 for(
int kr = num_runs -1; kr < num_runs; kr++){
317 if(run_vec[kr].getRunTag().getGeneralTag() !=
"GLOBAL")
continue;
318 bool somediff =
false;
321 for(
int k = 0 ;
k < 2;
k++ ) {
322 for(
int iphi = 0 ; iphi < 72; iphi++) {
323 for(
int ieta = 0 ; ieta < 17; ieta++) {
324 newEBStatus[iphi][ieta][
k] = 0;
327 for(
int ix = 0 ; ix < 20; ix++) {
328 for(
int iy = 0 ; iy < 20; iy++) {
329 newEEStatus[ix][iy][
k] = 0;
337 std::map<EcalLogicID, RunDat> fed_dat;
341 typedef std::map<EcalLogicID, RunDat>::const_iterator fedIter;
346 std::map<EcalLogicID, RunFEConfigDat> feconfig;
349 if(fed_dat.empty() || feconfig.empty()) {
350 std::cout <<
" run " << irun <<
" tag " << run_vec[kr].getRunTag().getGeneralTag()
351 <<
" Run type " << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
352 <<
" feconfig and/or read FED size = 0, leaving..." << std::endl;
357 if(fed_dat.size() != 54 ) {
358 int SM[36] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
359 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
360 int Sect[2][9] = {{0, 0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0, 0, 0}};
361 for (fedIter
p=fed_dat.begin();
p!=fed_dat.end();
p++) {
376 Sect[izz][sm - 1] = 1;
386 for(
int sm = 0; sm < 36; sm++)
390 for(
int tt = 0;
tt < 68;
tt++)
393 for(
int tt = 0;
tt < 68;
tt++)
396 for(
int z = 0; z < 2; z++)
397 for(
int sec = 0; sec < 9; sec++)
398 if(Sect[z][sec] != 1) {
401 if(z == 1) sec18 = sec + 9;
402 for(
int sc = 0 ;
sc < 41;
sc++) {
403 if(
ixx[sec18][
sc][0] != 0) {
404 newEEStatus[
ixx[sec18][
sc][0] - 1][
iyy[sec18][
sc][0] - 1][z] = 1;
405 if(
ixx[sec18][
sc][1] != 0) {
406 newEEStatus[
ixx[sec18][
sc][1] - 1][iyy[sec18][
sc][1] - 1][z] = 1;
407 if(
ixx[sec18][
sc][2] != 0) {
408 newEEStatus[
ixx[sec18][
sc][2] - 1][iyy[sec18][
sc][2] - 1][z] = 1;
416 typedef std::map<EcalLogicID, RunFEConfigDat>::const_iterator feConfIter;
421 for (feConfIter
p=feconfig.begin();
p!=feconfig.end();
p++) {
429 myconfig.
setId(fe_conf_id);
435 std::vector< ODBadTTDat > badTT_dat;
449 NbadTT = badTT_dat.size();
460 for(
size_t iTT = 0; iTT < NbadTT; iTT++){
461 int fed_id = badTT_dat[iTT].getFedId();
462 int tt_id = badTT_dat[iTT].getTTId();
468 if(fed_id >= 610 && fed_id <= 645) {
473 if(fed_id > 627) side = +1;
475 <<
" eta " <<
ietaEB[fed_id - 610][tt_id - 1]
476 <<
" side " << side << std::endl;
477 newEBStatus[
iphiEB[fed_id - 610][tt_id - 1] - 1][
ietaEB[fed_id - 610][tt_id - 1] - 1][side] = 1;
479 else if(fed_id <= 609 || (fed_id >= 646 && fed_id <= 654)) {
486 <<
" y " <<
iyy[fed_id - 601][tt_id - 1][0];
487 newEEStatus[
ixx[fed_id - 601][tt_id - 1][0] - 1][iyy[fed_id - 601][tt_id - 1][0] - 1][side] = 1;
488 if(
ixx[fed_id - 601][tt_id - 1][1] != 0) {
490 <<
" y2 " << iyy[fed_id - 601][tt_id - 1][1];
491 newEEStatus[
ixx[fed_id - 601][tt_id - 1][1] - 1][iyy[fed_id - 601][tt_id - 1][1] - 1][side] = 1;
492 if(
ixx[fed_id - 601][tt_id - 1][2] != 0) {
494 <<
" y3 " << iyy[fed_id - 601][tt_id - 1][2];
495 newEEStatus[
ixx[fed_id - 601][tt_id - 1][2] - 1][iyy[fed_id - 601][tt_id - 1][2] - 1][side] = 1;
503 <<
" y " << iyy[fed_id - 637][tt_id - 1][0];
504 newEEStatus[
ixx[fed_id - 637][tt_id - 1][0] - 1][iyy[fed_id - 637][tt_id - 1][0] - 1][side] = 1;
505 if(
ixx[fed_id - 637][tt_id - 1][1] != 0) {
507 <<
" y2 " << iyy[fed_id - 637][tt_id - 1][1];
508 newEEStatus[
ixx[fed_id - 637][tt_id - 1][1] - 1][iyy[fed_id - 637][tt_id - 1][1] - 1][side] = 1;
509 if(
ixx[fed_id - 637][tt_id - 1][2] != 0) {
511 <<
" y3 " << iyy[fed_id - 637][tt_id - 1][2];
512 newEEStatus[
ixx[fed_id - 637][tt_id - 1][2] - 1][iyy[fed_id - 637][tt_id - 1][2] - 1][side] = 1;
519 std::cout <<
" Strange Fed " << fed_id <<
" TT/SC " << tt_id <<
" Give up " << std::endl;
525 for(
int k = 0 ;
k < 2;
k++ ) {
529 for(
int iphi = 0 ; iphi < 72; iphi++) {
530 for(
int ieta = 0 ; ieta < 17; ieta++) {
531 if(newEBStatus[iphi][ieta][
k] != oldEBStatus[iphi][ieta][
k]) {
534 daq_temp->
setValue( ebid, newEBStatus[iphi][ieta][k]);
535 if(
m_debug)
std::cout <<
" change in EB side " << iz <<
" phi " << iphi +1 <<
" eta " << ieta + 1 << std::endl;
538 oldEBStatus[iphi][ieta][
k] = newEBStatus[iphi][ieta][
k];
543 for(
int iy = 0 ; iy < 20; iy++) {
544 for(
int ix = 0 ; ix < 20; ix++) {
546 if(newEEStatus[ix][iy][k] != oldEEStatus[ix][iy][k]) {
549 daq_temp->
setValue( eeid, newEEStatus[ix][iy][k]);
550 if(
m_debug)
std::cout <<
" change in EE side " << iz <<
" x " << ix +1 <<
" y " << iy + 1 << std::endl;
553 oldEEStatus[ix][iy][
k] = newEEStatus[ix][iy][
k];
571 for(
int k = 0 ; k < 2; k++ ) {
573 for(
int iphi = 1 ; iphi < 73; iphi++) {
574 for(
int ieta = 1 ; ieta < 18; ieta++) {
577 uint16_t dbStatus = 0;
578 dbStatus =(daq_temp->
barrel( ebid.hashedIndex())).getStatusCode();
579 daq_pop->
setValue( ebid, dbStatus );
585 for(
int ix = 1 ; ix < 21; ix++) {
586 for(
int iy = 1 ; iy < 21; iy++) {
591 uint16_t dbStatus = 0;
592 if ( it != daq_temp->
end() ) {
593 dbStatus = it->getStatusCode();
595 daq_pop->
setValue( eeid, dbStatus );
603 std::cout <<
"Generating popcon record for run "<< irun << std::endl;
607 ss <<
"Run=" << irun <<
"_DAQchanged_"<<std::endl;
612 std::cout<<
"Run" << irun <<
" DAQ record was the same as previous run " << std::endl;
613 ss <<
"Run=" << irun <<
"_DAQunchanged_"<<std::endl;
EcalDAQTowerStatusMap EcalDAQTowerStatus
static bool validDetId(int ix, int iy, int iz)
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
std::string m_userTextLog
edm::Ref< Container > Ref
const_iterator end() const
void fetchConfigSet(ICONF *iconf) noexcept(false)
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
void setValue(const uint32_t id, const Item &item)
const_iterator find(uint32_t rawId) const
OldContainer m_to_transfer
cond::ValidityInterval lastInterval
EcalCondDBInterface * econn
void setLocationDef(const LocationDef &locDef)
RunList fetchRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
def getRunNumber(filename)
void setRunType(std::string runtype)
const Item & barrel(size_t hashedIndex) const
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
void setLocation(std::string loc)
std::vector< Item >::const_iterator const_iterator
void fetchConfigDataSet(std::vector< DATT > *fillMap, ICONF *iconf) noexcept(false)
void setGeneralTag(std::string tag)
cond::TagInfo_t const & tagInfo() const