CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
popcon::EcalDAQHandler Class Reference

#include <EcalDAQHandler.h>

Inheritance diagram for popcon::EcalDAQHandler:
popcon::PopConSourceHandler< EcalDAQTowerStatus >

Public Member Functions

int detIDToLogicID (int, int, int)
 
 EcalDAQHandler (edm::ParameterSet const &)
 
void getNewObjects () override
 
std::string id () const override
 
uint16_t OffDBStatus (uint16_t dbStatus, int pos)
 
 ~EcalDAQHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< EcalDAQTowerStatus >
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const
*, std::string const > 
operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Public Attributes

EcalCondDBInterfaceeconn
 

Private Attributes

bool m_debug
 
unsigned long m_firstRun
 
std::string m_gentag
 
unsigned long m_lastRun
 
std::string m_location
 
std::string m_name
 
std::string m_pass
 
std::string m_runtype
 
std::string m_sid
 
std::string m_user
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< EcalDAQTowerStatus >
typedef std::map< Time_t,
std::shared_ptr
< EcalDAQTowerStatus > > 
Container
 
typedef std::unique_ptr
< EcalDAQTowerStatus
Ref
 
typedef PopConSourceHandler
< EcalDAQTowerStatus
self
 
typedef cond::Time_t Time_t
 
typedef EcalDAQTowerStatus value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< EcalDAQTowerStatus >
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< EcalDAQTowerStatus >
Container m_iovs
 
std::vector< std::pair
< EcalDAQTowerStatus *, Time_t > > 
m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 45 of file EcalDAQHandler.h.

Constructor & Destructor Documentation

popcon::EcalDAQHandler::EcalDAQHandler ( edm::ParameterSet const &  ps)

Definition at line 409 of file EcalDAQHandler.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), m_debug, m_firstRun, m_gentag, m_lastRun, m_location, m_pass, m_runtype, m_sid, m_user, and AlCaHLTBitMon_QueryRunRegistry::string.

410  : m_name(ps.getUntrackedParameter<std::string>("name", "EcalDAQHandler")) {
411  std::cout << "EcalDAQ Source handler constructor\n" << std::endl;
412  m_firstRun = (unsigned long)atoi(ps.getParameter<std::string>("firstRun").c_str());
413  m_lastRun = (unsigned long)atoi(ps.getParameter<std::string>("lastRun").c_str());
414  m_sid = ps.getParameter<std::string>("OnlineDBSID");
415  m_user = ps.getParameter<std::string>("OnlineDBUser");
416  m_pass = ps.getParameter<std::string>("OnlineDBPassword");
417  m_location = ps.getParameter<std::string>("location");
418  m_runtype = ps.getParameter<std::string>("runtype");
419  m_gentag = ps.getParameter<std::string>("gentag");
420  m_debug = ps.getParameter<bool>("debug");
421 
422  std::cout << m_sid << "/" << m_user << std::endl;
423 }
unsigned long m_lastRun
unsigned long m_firstRun
tuple cout
Definition: gather_cfg.py:144
popcon::EcalDAQHandler::~EcalDAQHandler ( )
override

Definition at line 425 of file EcalDAQHandler.cc.

425 {}

Member Function Documentation

int popcon::EcalDAQHandler::detIDToLogicID ( int  ,
int  ,
int   
)
void popcon::EcalDAQHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< EcalDAQTowerStatus >.

Definition at line 434 of file EcalDAQHandler.cc.

References EcalCondTowerObjectContainer< T >::barrel(), gather_cfg::cout, EcalBarrel, test_db_connect::econn, EcalCondTowerObjectContainer< T >::end(), Exception, EcalCondTowerObjectContainer< T >::find(), ODFEDAQConfig::getBadTTId(), RunFEConfigDat::getConfigId(), EcalLogicID::getID1(), EcalLogicID::getID2(), EcalLogicID::getLogicID(), DeadROCCounter::getRunNumber(), RunList::getRuns(), EcalTrigTowerDetId::hashedIndex(), ietaEB, iphiEB, ixx, iyy, isotrackApplyRegressor::k, test_db_connect::my_locdef, test_db_connect::my_rundef, AlCaHLTBitMon_ParallelJobs::p, DetId::rawId(), RunTag::setGeneralTag(), ODFEDAQConfig::setId(), ODBadTTInfo::setId(), LocationDef::setLocation(), RunTag::setLocationDef(), RunTypeDef::setRunType(), RunTag::setRunTypeDef(), EcalCondTowerObjectContainer< T >::setValue(), findQualityFiles::size, contentValuesCheck::ss, dumpRecoGeometry_cfg::tagInfo, groupFilesInBlocks::tt, EcalTrigTowerDetId::validDetId(), and EcalScDetId::validDetId().

434  {
435  if (m_debug)
436  std::cout << "------- Ecal DAQ - > getNewObjects\n";
437 
438  std::ostringstream ss;
439  ss << "ECAL ";
440 
441  unsigned long long max_since = 1;
442 
443  // this is the last inserted run
444  max_since = tagInfo().lastInterval.since;
445 
446  // this is the last object in the DB
447  std::cout << " max_since : " << max_since << std::endl;
448 
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];
453 
454  // we copy the last valid record to a temporary object peds
455  EcalDAQTowerStatus* daq_temp = new EcalDAQTowerStatus();
456 
457  if (tagInfo().size) {
458  Ref daq_db = lastPayload();
459  if (m_debug)
460  std::cout << "retrieved last payload " << std::endl;
461 
462  // barrel
463  int iz = -1;
464  for (int k = 0; k < 2; k++) {
465  if (k == 1)
466  iz = 1;
467  for (int iphi = 1; iphi < 73; iphi++) {
468  for (int ieta = 1; ieta < 18; ieta++) {
469  if (EcalTrigTowerDetId::validDetId(iz, EcalBarrel, ieta, iphi)) {
470  EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta, iphi);
471 
472  uint16_t dbStatus = 0;
473  dbStatus = (daq_db->barrel(ebid.hashedIndex())).getStatusCode();
474  oldEBStatus[iphi - 1][ieta - 1][k] = dbStatus;
475 
476  EcalDAQTowerStatus::const_iterator it = daq_db->find(ebid.rawId());
477  if (it != daq_db->end()) {
478  } else {
479  std::cout << "*** error channel not found: eta/phi =" << ieta << "/" << iphi << std::endl;
480  }
481  daq_temp->setValue(ebid, dbStatus);
482  if (m_debug && dbStatus != 0)
483  std::cout << "barrel side " << k << " phi " << iphi << " eta " << ieta << " status " << dbStatus
484  << std::endl;
485  }
486  } // end loop over ieta
487  } // end loop over iphi
488 
489  // endcap
490  for (int ix = 1; ix < 21; ix++) {
491  for (int iy = 1; iy < 21; iy++) {
492  if (EcalScDetId::validDetId(ix, iy, iz)) {
493  EcalScDetId eeid(ix, iy, iz);
494 
495  EcalDAQTowerStatus::const_iterator it = daq_db->find(eeid.rawId());
496 
497  uint16_t dbStatus = 0;
498  if (it != daq_db->end()) {
499  dbStatus = it->getStatusCode();
500  }
501  oldEEStatus[ix - 1][iy - 1][k] = dbStatus;
502  daq_temp->setValue(eeid, dbStatus);
503  if (m_debug && dbStatus != 0)
504  std::cout << "endcap side " << k << " x " << ix << " y " << iy << " status " << dbStatus << std::endl;
505  }
506  } // end loop over iy
507  } // end loop over ix
508  } // end loop over k (side)
509  } // check if there is already a payload
510  else {
511  if (m_debug)
512  std::cout << " No db found : set default values " << std::endl;
513  // barrel
514  int iz = -1;
515  for (int k = 0; k < 2; k++) {
516  if (k == 1)
517  iz = 1;
518  for (int iphi = 1; iphi < 73; iphi++) {
519  for (int ieta = 1; ieta < 18; ieta++) {
520  if (EcalTrigTowerDetId::validDetId(iz, EcalBarrel, ieta, iphi)) {
521  EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta, iphi);
522 
523  uint16_t dbStatus = 0;
524  oldEBStatus[iphi - 1][ieta - 1][k] = dbStatus;
525  daq_temp->setValue(ebid, dbStatus);
526  } // valid Id
527  } // end loop over ieta
528  } // end loop over iphi
529  // endcap
530  for (int ix = 1; ix < 21; ix++) {
531  for (int iy = 1; iy < 21; iy++) {
532  if (EcalScDetId::validDetId(ix, iy, iz)) {
533  EcalScDetId eeid(ix, iy, iz);
534  uint16_t dbStatus = 0;
535  oldEEStatus[ix - 1][iy - 1][k] = dbStatus;
536  daq_temp->setValue(eeid, dbStatus);
537  } // valid Id
538  } // end loop over iy
539  } // end loop over ix
540  } // end loop over k (side)
541  } // no payload set default values
542 
543  // now read the actual status from the online DB
544 
545  if (m_debug)
546  std::cout << "Retrieving DAQ status from OMDS DB ... " << std::endl;
548  if (m_debug)
549  std::cout << "Connection done" << std::endl;
550 
551  if (!econn) {
552  std::cout << " Problem with OMDS: connection parameters " << m_sid << "/" << m_user << "/" << m_pass << std::endl;
553  throw cms::Exception("OMDS not available");
554  }
555 
556  // code from EcalTPGBadTTHandler.cc
558  my_locdef.setLocation(m_location);
559 
561  my_rundef.setRunType(m_runtype);
562 
563  RunTag my_runtag;
564  my_runtag.setLocationDef(my_locdef);
565  my_runtag.setRunTypeDef(my_rundef);
566  my_runtag.setGeneralTag(m_gentag);
567 
568  // range of validity
569  int min_run = 0;
570  if (m_firstRun < (unsigned long)max_since) {
571  min_run = (int)max_since + 1; // we have to add 1 to the last transferred one
572  } else {
573  min_run = (int)m_firstRun;
574  }
575  int max_run = (int)m_lastRun;
576  std::cout << "min_run " << min_run << " max_run " << max_run << std::endl;
577 
578  RunList my_list;
579  my_list = econn->fetchRunListByLocation(my_runtag, min_run, max_run, my_locdef);
580 
581  std::vector<RunIOV> run_vec = my_list.getRuns();
582  int num_runs = run_vec.size();
583 
584  std::cout << " number of runs is : " << num_runs << std::endl;
585 
586  unsigned long irun = 0;
587  if (num_runs > 0) {
588  // char outfile[800];
589  //sprintf(outfile,"BadChannelsEB_run%d.txt",min_run);
590  //ofstream *daqFile;
591  //daqFile = new ofstream(outfile,ios::out);
592 
593  //hlt for(int kr = 0; kr < num_runs; kr++){
594  for (int kr = num_runs - 1; kr < num_runs; kr++) {
595  // int krmax = std::min(num_runs, 1000);
596  // for(int kr = 0; kr < krmax; kr++){
597  //hlt if(m_to_transfer.size() < 20 ) {
598 
599  if (run_vec[kr].getRunTag().getGeneralTag() != "GLOBAL")
600  continue;
601  bool somediff = false;
602  // initialize this run status to all OK
603  irun = (unsigned long)run_vec[kr].getRunNumber();
604  for (int k = 0; k < 2; k++) {
605  for (int iphi = 0; iphi < 72; iphi++) {
606  for (int ieta = 0; ieta < 17; ieta++) {
607  newEBStatus[iphi][ieta][k] = 0;
608  }
609  }
610  for (int ix = 0; ix < 20; ix++) {
611  for (int iy = 0; iy < 20; iy++) {
612  newEEStatus[ix][iy][k] = 0;
613  }
614  }
615  } // loop over side
616 
617  // these are the online conditions DB classes readout FEDs
618  std::map<EcalLogicID, RunDat> fed_dat;
619  econn->fetchDataSet(&fed_dat, &run_vec[kr]);
620 
621  // these are the online conditions DB classes unread FEs
622  typedef std::map<EcalLogicID, RunDat>::const_iterator fedIter;
623  // EcalLogicID ecid_xt;
624  RunDat rdat_fe;
625  EcalLogicID idfed;
626 
627  std::map<EcalLogicID, RunFEConfigDat> feconfig;
628  econn->fetchDataSet(&feconfig, &run_vec[kr]);
629 
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;
634  continue;
635  }
636 
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++) {
642  idfed = p->first;
643  int sm = 0;
644  int z = 0;
645  if (idfed.getLogicID() < 2000000000) { // eb
646  sm = idfed.getID1();
647  // std::cout << " EB " << sm;
648  SM[sm - 1] = 1;
649  } else { // ee
650  z = idfed.getID1();
651  sm = idfed.getID2();
652  // std::cout << " EE " << z << " " << sm;
653  int izz = z;
654  if (z == -1)
655  izz = 0;
656  Sect[izz][sm - 1] = 1;
657  }
658  } // loop over all FED
660  /* if(irun == 124089) {
661  Sect[0][2] = 0;
662  Sect[1][7] = 0;
663  } */
665  // mark all TT/SC in the not read out FEDs
666  for (int sm = 0; sm < 36; sm++) // barrel
667  if (SM[sm] != 1) {
668  //std::cout << " missing EB " << sm + 1 << std::endl;
669  if (sm < 18)
670  for (int tt = 0; tt < 68; tt++)
671  newEBStatus[iphiEB[sm][tt] - 1][ietaEB[sm][tt] - 1][0] = 1;
672  else
673  for (int tt = 0; tt < 68; tt++)
674  newEBStatus[iphiEB[sm - 18][tt] - 1][ietaEB[sm - 18][tt] - 1][1] = 1;
675  }
676  for (int z = 0; z < 2; z++) // endcaps
677  for (int sec = 0; sec < 9; sec++)
678  if (Sect[z][sec] != 1) {
679  //std::cout << " missing EE " << z << " " << sec + 1 << std::endl;
680  int sec18 = sec;
681  if (z == 1)
682  sec18 = sec + 9;
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;
690  }
691  }
692  }
693  } // loop over all possible SC in a sector
694  } // not read out sector
695  } // not all FED are read out
696 
697  typedef std::map<EcalLogicID, RunFEConfigDat>::const_iterator feConfIter;
698  // EcalLogicID ecid_xt;
699  RunFEConfigDat rd_fe;
700 
701  int fe_conf_id = 0;
702  for (feConfIter p = feconfig.begin(); p != feconfig.end(); p++) {
703  // ecid_xt = p->first;
704  rd_fe = p->second;
705  fe_conf_id = rd_fe.getConfigId();
706  }
707 
708  // reading this configuration
709  ODFEDAQConfig myconfig;
710  myconfig.setId(fe_conf_id);
711  econn->fetchConfigSet(&myconfig);
712 
713  // list of bad towers
714  int myTT = myconfig.getBadTTId();
715  ODBadTTInfo mybadTT;
716  std::vector<ODBadTTDat> badTT_dat;
717  unsigned NbadTT = 0;
718 
719  /* if(myTT == 0) {
720  std::cout << " myTT = 0" << std::endl;
721  continue;
722  }
723  else {
724  */
725  if (myTT != 0) {
726  mybadTT.setId(myTT);
727  econn->fetchConfigSet(&mybadTT);
728 
729  econn->fetchConfigDataSet(&badTT_dat, &mybadTT);
730  NbadTT = badTT_dat.size();
731  }
732 
733  /* std::cout << " run " << irun << " tag " << run_vec[kr].getRunTag().getGeneralTag()
734  << " Run type " << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
735  << " number of read FEDs " << fed_dat.size()
736  << " number of bad FEs " << NbadTT
737  << " fe_conf_id " << fe_conf_id << std::endl;
738  */
739 
740  // *daqFile << " run " << irun << " bad TT number " << NbadTT << "\n" << "Towers : ";
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();
744  // int SM = badTT_dat[iTT].getSMId(); // SM always 0!
745  int side = 0; // EB/EE-
746  //*daqFile << fed_id << "/" << tt_id << " ";
747  // std::cout << fed_id << "/" << tt_id << "/" << SM << "/" ;
748  // std::cout << fed_id << "/" << tt_id << "/";
749  if (fed_id >= 610 && fed_id <= 645) { // barrel
750  if (tt_id > 68) {
751  //std::cout << " Problem in Fed " << fed_id << " TT " << tt_id << " Give up " << std::endl;
752  continue;
753  }
754  if (fed_id > 627)
755  side = +1; // EB+
756  if (m_debug)
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)) { // endcap
761  if (tt_id > 41) {
762  //std::cout << " Problem in Fed " << fed_id << " SC " << tt_id << " Give up " << std::endl;
763  continue;
764  }
765  if (fed_id < 610) { // EE-
766  if (m_debug)
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) { // partial SC
770  if (m_debug)
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) { // partial SC
774  if (m_debug)
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;
777  }
778  }
779  if (m_debug)
780  std::cout << " side " << side << std::endl;
781  } else { // EE+
782  side = +1;
783  if (m_debug)
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) { // partial SC
787  if (m_debug)
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) { // partial SC
791  if (m_debug)
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;
794  }
795  }
796  if (m_debug)
797  std::cout << " side " << side << std::endl;
798  }
799  } else {
800  std::cout << " Strange Fed " << fed_id << " TT/SC " << tt_id << " Give up " << std::endl;
801  continue;
802  }
803  } // end loop over iTT
804  if (m_debug)
805  std::cout << std::endl;
806  //*daqFile << std::endl;
807  for (int k = 0; k < 2; k++) {
808  int iz = -1;
809  if (k == 1)
810  iz = 1;
811  if (m_debug)
812  std::cout << " Side : " << k << " barrel " << std::endl; // barrel
813  for (int iphi = 0; iphi < 72; iphi++) {
814  for (int ieta = 0; ieta < 17; ieta++) {
815  if (newEBStatus[iphi][ieta][k] != oldEBStatus[iphi][ieta][k]) {
816  somediff = true;
817  EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta + 1, iphi + 1);
818  daq_temp->setValue(ebid, newEBStatus[iphi][ieta][k]);
819  if (m_debug)
820  std::cout << " change in EB side " << iz << " phi " << iphi + 1 << " eta " << ieta + 1 << std::endl;
821  } // new status
822  if (m_debug)
823  std::cout << newEBStatus[iphi][ieta][k] << " ";
824  oldEBStatus[iphi][ieta][k] = newEBStatus[iphi][ieta][k];
825  }
826  if (m_debug)
827  std::cout << std::endl;
828  }
829  if (m_debug)
830  std::cout << " endcaps " << std::endl; // endcap
831  for (int iy = 0; iy < 20; iy++) {
832  for (int ix = 0; ix < 20; ix++) {
833  if (EcalScDetId::validDetId(ix + 1, iy + 1, iz)) {
834  if (newEEStatus[ix][iy][k] != oldEEStatus[ix][iy][k]) {
835  somediff = true;
836  EcalScDetId eeid(ix + 1, iy + 1, iz);
837  daq_temp->setValue(eeid, newEEStatus[ix][iy][k]);
838  if (m_debug)
839  std::cout << " change in EE side " << iz << " x " << ix + 1 << " y " << iy + 1 << std::endl;
840  } // new status
841  if (m_debug)
842  std::cout << newEEStatus[ix][iy][k] << " ";
843  oldEEStatus[ix][iy][k] = newEEStatus[ix][iy][k];
844  } // valid SC
845  else {
846  if (m_debug)
847  std::cout << ". ";
848  }
849  }
850  if (m_debug)
851  std::cout << std::endl;
852  }
853  } // loop over side
854 
855  if (somediff) {
856  // we copy the last valid record to the object that is sent to the DB
857  EcalDAQTowerStatus* daq_pop = new EcalDAQTowerStatus();
858 
859  int iz = -1;
860  for (int k = 0; k < 2; k++) {
861  if (k == 1)
862  iz = 1;
863  for (int iphi = 1; iphi < 73; iphi++) {
864  for (int ieta = 1; ieta < 18; ieta++) {
865  if (EcalTrigTowerDetId::validDetId(iz, EcalBarrel, ieta, iphi)) {
866  EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta, iphi);
867  uint16_t dbStatus = 0;
868  dbStatus = (daq_temp->barrel(ebid.hashedIndex())).getStatusCode();
869  daq_pop->setValue(ebid, dbStatus);
870  }
871  } // end loop over ieta
872  } // end loop over iphi
873 
874  // endcap
875  for (int ix = 1; ix < 21; ix++) {
876  for (int iy = 1; iy < 21; iy++) {
877  if (EcalScDetId::validDetId(ix, iy, iz)) {
878  EcalScDetId eeid(ix, iy, iz);
879 
880  EcalDAQTowerStatus::const_iterator it = daq_temp->find(eeid.rawId());
881  uint16_t dbStatus = 0;
882  if (it != daq_temp->end()) {
883  dbStatus = it->getStatusCode();
884  }
885  daq_pop->setValue(eeid, dbStatus);
886  }
887  } // end loop over iy
888  } // end loop over ix
889  } // end loop over k (side)
890 
891  std::cout << "Generating popcon record for run " << irun << std::endl;
892 
893  m_to_transfer.push_back(std::make_pair((EcalDAQTowerStatus*)daq_pop, irun));
894 
895  ss << "Run=" << irun << "_DAQchanged_" << std::endl;
896  m_userTextLog = ss.str() + ";";
897  } // some change found
898  else {
899  std::cout << "Run" << irun << " DAQ record was the same as previous run " << std::endl;
900  ss << "Run=" << irun << "_DAQunchanged_" << std::endl;
901  m_userTextLog = ss.str() + ";";
902 
903  } // no change
904 
905  // hlt } // check on number of already transferred runs
906  } // loop over runs
907  } // check on run number > 0
908 
909  // disconnect from DB
910  delete econn;
911  delete daq_temp;
912  if (m_debug)
913  std::cout << "Ecal - > end of getNewObjects -----------\n";
914 }
EcalDAQTowerStatusMap EcalDAQTowerStatus
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:59
void setRunTypeDef(const RunTypeDef &runTypeDef)
Definition: RunTag.cc:42
std::vector< RunIOV > getRuns()
Definition: RunList.cc:25
unsigned long m_lastRun
Iov_t lastInterval
Definition: Types.h:73
void setId(int id)
Definition: ODFEDAQConfig.h:18
Definition: RunTag.h:13
Time_t since
Definition: Types.h:53
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
const int iyy[18][41][3]
const int ixx[18][41][3]
int getID2() const
Definition: EcalLogicID.cc:32
EcalCondDBInterface * econn
const int iphiEB[36][68]
std::vector< std::pair< EcalDAQTowerStatus *, Time_t > > m_to_transfer
int getID1() const
Definition: EcalLogicID.cc:30
int getLogicID() const
Definition: EcalLogicID.cc:28
void setLocationDef(const LocationDef &locDef)
Definition: RunTag.cc:33
int getBadTTId() const
Definition: ODFEDAQConfig.h:36
void setId(int id)
Definition: ODBadTTInfo.h:18
RunList fetchRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
void setRunType(std::string runtype)
Definition: RunTypeDef.cc:21
int getConfigId() const
const int ietaEB[36][68]
unsigned long m_firstRun
const Item & barrel(size_t hashedIndex) const
Definition: RunDat.h:11
std::unique_ptr< EcalDAQTowerStatus > Ref
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
void setLocation(std::string loc)
Definition: LocationDef.cc:20
tuple cout
Definition: gather_cfg.py:144
std::vector< Item >::const_iterator const_iterator
void fetchConfigDataSet(std::vector< DATT > *fillMap, ICONF *iconf) noexcept(false)
void setGeneralTag(std::string tag)
Definition: RunTag.cc:24
tuple size
Write out results.
std::string popcon::EcalDAQHandler::id ( ) const
inlineoverridevirtual

Implements popcon::PopConSourceHandler< EcalDAQTowerStatus >.

Definition at line 51 of file EcalDAQHandler.h.

References m_name.

51 { return m_name; }
uint16_t popcon::EcalDAQHandler::OffDBStatus ( uint16_t  dbStatus,
int  pos 
)

Definition at line 427 of file EcalDAQHandler.cc.

427  {
428  uint16_t hv_off_dbstatus = (dbStatus & (1 << pos));
429  if (hv_off_dbstatus > 0)
430  hv_off_dbstatus = 1;
431  return hv_off_dbstatus;
432 }

Member Data Documentation

EcalCondDBInterface* popcon::EcalDAQHandler::econn

Definition at line 52 of file EcalDAQHandler.h.

bool popcon::EcalDAQHandler::m_debug
private

Definition at line 67 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

unsigned long popcon::EcalDAQHandler::m_firstRun
private

Definition at line 58 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_gentag
private

Definition at line 66 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

unsigned long popcon::EcalDAQHandler::m_lastRun
private

Definition at line 59 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_location
private

Definition at line 64 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_name
private

Definition at line 63 of file EcalDAQHandler.h.

Referenced by id().

std::string popcon::EcalDAQHandler::m_pass
private

Definition at line 62 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_runtype
private

Definition at line 65 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_sid
private

Definition at line 60 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_user
private

Definition at line 61 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().