436 std::cout <<
"------- Ecal DAQ - > getNewObjects\n";
438 std::ostringstream
ss;
441 unsigned long long max_since = 1;
447 std::cout <<
" max_since : " << max_since << std::endl;
449 uint16_t oldEBStatus[72][17][2];
450 uint16_t newEBStatus[72][17][2];
451 uint16_t oldEEStatus[20][20][2];
452 uint16_t newEEStatus[20][20][2];
460 std::cout <<
"retrieved last payload " << std::endl;
464 for (
int k = 0;
k < 2;
k++) {
472 uint16_t dbStatus = 0;
473 dbStatus = (daq_db->barrel(ebid.hashedIndex())).getStatusCode();
474 oldEBStatus[
iphi - 1][
ieta - 1][
k] = dbStatus;
477 if (it != daq_db->end()) {
479 std::cout <<
"*** error channel not found: eta/phi =" <<
ieta <<
"/" <<
iphi << std::endl;
483 std::cout <<
"barrel side " <<
k <<
" phi " <<
iphi <<
" eta " <<
ieta <<
" status " << dbStatus
490 for (
int ix = 1; ix < 21; ix++) {
491 for (
int iy = 1; iy < 21; iy++) {
497 uint16_t dbStatus = 0;
498 if (it != daq_db->end()) {
499 dbStatus = it->getStatusCode();
501 oldEEStatus[ix - 1][iy - 1][
k] = dbStatus;
504 std::cout <<
"endcap side " <<
k <<
" x " << ix <<
" y " << iy <<
" status " << dbStatus << std::endl;
512 std::cout <<
" No db found : set default values " << std::endl;
515 for (
int k = 0;
k < 2;
k++) {
523 uint16_t dbStatus = 0;
524 oldEBStatus[
iphi - 1][
ieta - 1][
k] = dbStatus;
530 for (
int ix = 1; ix < 21; ix++) {
531 for (
int iy = 1; iy < 21; iy++) {
534 uint16_t dbStatus = 0;
535 oldEEStatus[ix - 1][iy - 1][
k] = dbStatus;
546 std::cout <<
"Retrieving DAQ status from OMDS DB ... " << std::endl;
549 std::cout <<
"Connection done" << std::endl;
571 min_run = (
int)max_since + 1;
576 std::cout <<
"min_run " << min_run <<
" max_run " << max_run << std::endl;
581 std::vector<RunIOV> run_vec = my_list.
getRuns();
582 int num_runs = run_vec.size();
584 std::cout <<
" number of runs is : " << num_runs << std::endl;
586 unsigned long irun = 0;
594 for (
int kr = num_runs - 1; kr < num_runs; kr++) {
599 if (run_vec[kr].getRunTag().getGeneralTag() !=
"GLOBAL")
601 bool somediff =
false;
604 for (
int k = 0;
k < 2;
k++) {
610 for (
int ix = 0; ix < 20; ix++) {
611 for (
int iy = 0; iy < 20; iy++) {
612 newEEStatus[ix][iy][
k] = 0;
618 std::map<EcalLogicID, RunDat> fed_dat;
622 typedef std::map<EcalLogicID, RunDat>::const_iterator fedIter;
627 std::map<EcalLogicID, RunFEConfigDat> feconfig;
630 if (fed_dat.empty() || feconfig.empty()) {
631 std::cout <<
" run " << irun <<
" tag " << run_vec[kr].getRunTag().getGeneralTag() <<
" Run type " 632 << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
633 <<
" feconfig and/or read FED size = 0, leaving..." << std::endl;
637 if (fed_dat.size() != 54) {
638 int SM[36] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
639 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
640 int Sect[2][9] = {{0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}};
641 for (fedIter
p = fed_dat.begin();
p != fed_dat.end();
p++) {
656 Sect[izz][sm - 1] = 1;
666 for (
int sm = 0; sm < 36; sm++)
670 for (
int tt = 0;
tt < 68;
tt++)
673 for (
int tt = 0;
tt < 68;
tt++)
676 for (
int z = 0;
z < 2;
z++)
678 if (Sect[
z][
sec] != 1) {
683 for (
int sc = 0; sc < 41; sc++) {
684 if (
ixx[sec18][sc][0] != 0) {
685 newEEStatus[
ixx[sec18][sc][0] - 1][
iyy[sec18][sc][0] - 1][
z] = 1;
686 if (
ixx[sec18][sc][1] != 0) {
687 newEEStatus[
ixx[sec18][sc][1] - 1][
iyy[sec18][sc][1] - 1][
z] = 1;
688 if (
ixx[sec18][sc][2] != 0) {
689 newEEStatus[
ixx[sec18][sc][2] - 1][
iyy[sec18][sc][2] - 1][
z] = 1;
697 typedef std::map<EcalLogicID, RunFEConfigDat>::const_iterator feConfIter;
702 for (feConfIter
p = feconfig.begin();
p != feconfig.end();
p++) {
710 myconfig.
setId(fe_conf_id);
716 std::vector<ODBadTTDat> badTT_dat;
730 NbadTT = badTT_dat.size();
741 for (
size_t iTT = 0; iTT < NbadTT; iTT++) {
742 int fed_id = badTT_dat[iTT].getFedId();
743 int tt_id = badTT_dat[iTT].getTTId();
749 if (fed_id >= 610 && fed_id <= 645) {
757 std::cout <<
" phi " <<
iphiEB[fed_id - 610][tt_id - 1] <<
" eta " <<
ietaEB[fed_id - 610][tt_id - 1]
758 <<
" side " << side << std::endl;
759 newEBStatus[
iphiEB[fed_id - 610][tt_id - 1] - 1][
ietaEB[fed_id - 610][tt_id - 1] - 1][side] = 1;
760 }
else if (fed_id <= 609 || (fed_id >= 646 && fed_id <= 654)) {
767 std::cout <<
" x " <<
ixx[fed_id - 601][tt_id - 1][0] <<
" y " <<
iyy[fed_id - 601][tt_id - 1][0];
768 newEEStatus[
ixx[fed_id - 601][tt_id - 1][0] - 1][
iyy[fed_id - 601][tt_id - 1][0] - 1][side] = 1;
769 if (
ixx[fed_id - 601][tt_id - 1][1] != 0) {
771 std::cout <<
" x2 " <<
ixx[fed_id - 601][tt_id - 1][1] <<
" y2 " <<
iyy[fed_id - 601][tt_id - 1][1];
772 newEEStatus[
ixx[fed_id - 601][tt_id - 1][1] - 1][
iyy[fed_id - 601][tt_id - 1][1] - 1][side] = 1;
773 if (
ixx[fed_id - 601][tt_id - 1][2] != 0) {
775 std::cout <<
" x3 " <<
ixx[fed_id - 601][tt_id - 1][2] <<
" y3 " <<
iyy[fed_id - 601][tt_id - 1][2];
776 newEEStatus[
ixx[fed_id - 601][tt_id - 1][2] - 1][
iyy[fed_id - 601][tt_id - 1][2] - 1][side] = 1;
780 std::cout <<
" side " << side << std::endl;
784 std::cout <<
" x " <<
ixx[fed_id - 637][tt_id - 1][0] <<
" y " <<
iyy[fed_id - 637][tt_id - 1][0];
785 newEEStatus[
ixx[fed_id - 637][tt_id - 1][0] - 1][
iyy[fed_id - 637][tt_id - 1][0] - 1][side] = 1;
786 if (
ixx[fed_id - 637][tt_id - 1][1] != 0) {
788 std::cout <<
" x2 " <<
ixx[fed_id - 637][tt_id - 1][1] <<
" y2 " <<
iyy[fed_id - 637][tt_id - 1][1];
789 newEEStatus[
ixx[fed_id - 637][tt_id - 1][1] - 1][
iyy[fed_id - 637][tt_id - 1][1] - 1][side] = 1;
790 if (
ixx[fed_id - 637][tt_id - 1][2] != 0) {
792 std::cout <<
" x3 " <<
ixx[fed_id - 637][tt_id - 1][2] <<
" y3 " <<
iyy[fed_id - 637][tt_id - 1][2];
793 newEEStatus[
ixx[fed_id - 637][tt_id - 1][2] - 1][
iyy[fed_id - 637][tt_id - 1][2] - 1][side] = 1;
797 std::cout <<
" side " << side << std::endl;
800 std::cout <<
" Strange Fed " << fed_id <<
" TT/SC " << tt_id <<
" Give up " << std::endl;
807 for (
int k = 0;
k < 2;
k++) {
812 std::cout <<
" Side : " <<
k <<
" barrel " << std::endl;
820 std::cout <<
" change in EB side " << iz <<
" phi " <<
iphi + 1 <<
" eta " <<
ieta + 1 << std::endl;
831 for (
int iy = 0; iy < 20; iy++) {
832 for (
int ix = 0; ix < 20; ix++) {
834 if (newEEStatus[ix][iy][
k] != oldEEStatus[ix][iy][
k]) {
837 daq_temp->
setValue(eeid, newEEStatus[ix][iy][
k]);
839 std::cout <<
" change in EE side " << iz <<
" x " << ix + 1 <<
" y " << iy + 1 << std::endl;
843 oldEEStatus[ix][iy][
k] = newEEStatus[ix][iy][
k];
860 for (
int k = 0;
k < 2;
k++) {
867 uint16_t dbStatus = 0;
868 dbStatus = (daq_temp->
barrel(ebid.hashedIndex())).getStatusCode();
875 for (
int ix = 1; ix < 21; ix++) {
876 for (
int iy = 1; iy < 21; iy++) {
881 uint16_t dbStatus = 0;
882 if (it != daq_temp->
end()) {
883 dbStatus = it->getStatusCode();
891 std::cout <<
"Generating popcon record for run " << irun << std::endl;
895 ss <<
"Run=" << irun <<
"_DAQchanged_" << std::endl;
899 std::cout <<
"Run" << irun <<
" DAQ record was the same as previous run " << std::endl;
900 ss <<
"Run=" << irun <<
"_DAQunchanged_" << std::endl;
913 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
EcalDAQTowerStatusMap EcalDAQTowerStatus
static bool validDetId(int ix, int iy, int iz)
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
std::string m_userTextLog
const Item & barrel(size_t hashedIndex) 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)
cond::TagInfo_t const & tagInfo() const
EcalCondDBInterface * econn
std::vector< std::pair< EcalDAQTowerStatus *, Time_t > > m_to_transfer
void setLocationDef(const LocationDef &locDef)
const_iterator end() const
RunList fetchRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
def getRunNumber(filename)
const_iterator find(uint32_t rawId) const
std::unique_ptr< EcalDAQTowerStatus > Ref
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
std::vector< Item >::const_iterator const_iterator
void fetchConfigDataSet(std::vector< DATT > *fillMap, ICONF *iconf) noexcept(false)
void setGeneralTag(std::string tag)