CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EcalTPGDBApp Class Reference

#include <EcalTPGDBApp.h>

Inheritance diagram for EcalTPGDBApp:
EcalCondDBInterface EcalDBConnection

List of all members.

Public Member Functions

 EcalTPGDBApp (std::string host, std::string sid, std::string user, std::string pass, int port)
 EcalTPGDBApp (std::string sid, std::string user, std::string pass)
int readFromCondDB_Pedestals (std::map< EcalLogicID, MonPedestalsDat > &pedset, int runNb)
void readFromConfDB_TPGPedestals (int iconf_req)
std::string to_string (char value[])
int writeToConfDB_Delay (const std::map< EcalLogicID, FEConfigTimingDat > &delaygroupset, std::string tag)
int writeToConfDB_Spike (const std::map< EcalLogicID, FEConfigSpikeDat > &spikegroupset, std::string tag)
int writeToConfDB_TPGFgr (const std::map< EcalLogicID, FEConfigFgrGroupDat > &lutgroup, const std::map< EcalLogicID, FEConfigFgrDat > &lutdat, const std::map< EcalLogicID, FEConfigFgrParamDat > &fgrparamset, const std::map< EcalLogicID, FEConfigFgrEETowerDat > &dataset3, const std::map< EcalLogicID, FEConfigFgrEEStripDat > &dataset4, int iovId, std::string tag)
int writeToConfDB_TPGLinearCoef (const std::map< EcalLogicID, FEConfigLinDat > &linset, const std::map< EcalLogicID, FEConfigLinParamDat > &linparamset, int iovId, std::string tag)
int writeToConfDB_TPGLUT (const std::map< EcalLogicID, FEConfigLUTGroupDat > &lutgroup, const std::map< EcalLogicID, FEConfigLUTDat > &lutdat, const std::map< EcalLogicID, FEConfigLUTParamDat > &lutparamset, int iovId, std::string tag)
int writeToConfDB_TPGMain (int ped, int lin, int lut, int fgr, int sli, int wei, int spi, int tim, int bxt, int btt, int bst, std::string tag, int ver)
int writeToConfDB_TPGPedestals (const std::map< EcalLogicID, FEConfigPedDat > &pedset, int iovId, std::string tag)
int writeToConfDB_TPGSliding (const std::map< EcalLogicID, FEConfigSlidingDat > &sliset, int iovId, std::string tag)
int writeToConfDB_TPGWeight (const std::map< EcalLogicID, FEConfigWeightGroupDat > &lutgroup, const std::map< EcalLogicID, FEConfigWeightDat > &lutdat, int iovId, std::string tag)

Private Member Functions

void printIOV (const RunIOV *iov) const
void printTag (const RunTag *tag) const

Private Attributes

uint64_t endmicros
run_t endrun
uint64_t startmicros
run_t startrun

Detailed Description

Definition at line 16 of file EcalTPGDBApp.h.


Constructor & Destructor Documentation

EcalTPGDBApp::EcalTPGDBApp ( std::string  host,
std::string  sid,
std::string  user,
std::string  pass,
int  port 
)
EcalTPGDBApp::EcalTPGDBApp ( std::string  sid,
std::string  user,
std::string  pass 
)

Member Function Documentation

void EcalTPGDBApp::printIOV ( const RunIOV iov) const [private]

Definition at line 394 of file EcalTPGDBApp.cc.

References gather_cfg::cout, RunIOV::getRunEnd(), RunIOV::getRunNumber(), RunIOV::getRunStart(), RunIOV::getRunTag(), printTag(), Tm::str(), and GlobalPosition_Frontier_DevDB_cff::tag.

{
  cout << endl;
  cout << "=============RunIOV:" << endl;
  RunTag tag = iov->getRunTag();
  printTag(&tag);
  cout << "Run Number:         " << iov->getRunNumber() << endl;
  cout << "Run Start:          " << iov->getRunStart().str() << endl;
  cout << "Run End:            " << iov->getRunEnd().str() << endl;
  cout << "====================" << endl;
}
void EcalTPGDBApp::printTag ( const RunTag tag) const [private]

Definition at line 384 of file EcalTPGDBApp.cc.

References gather_cfg::cout, RunTag::getGeneralTag(), LocationDef::getLocation(), RunTag::getLocationDef(), RunTypeDef::getRunType(), and RunTag::getRunTypeDef().

Referenced by printIOV().

{
  cout << endl;
  cout << "=============RunTag:" << endl;
  cout << "GeneralTag:         " << tag->getGeneralTag() << endl;
  cout << "Location:           " << tag->getLocationDef().getLocation() << endl;
  cout << "Run Type:           " << tag->getRunTypeDef().getRunType() << endl;
  cout << "====================" << endl;
}
int EcalTPGDBApp::readFromCondDB_Pedestals ( std::map< EcalLogicID, MonPedestalsDat > &  pedset,
int  runNb 
)

Definition at line 142 of file EcalTPGDBApp.cc.

References gather_cfg::cout, EcalCondDBInterface::fetchDataSet(), EcalCondDBInterface::fetchMonRunListLastNRuns(), MonRunList::getRuns(), cuy::ii, DTTTrigCorrFirst::run, RunTag::setGeneralTag(), MonRunTag::setGeneralTag(), LocationDef::setLocation(), RunTag::setLocationDef(), MonVersionDef::setMonitoringVersion(), MonRunList::setMonRunTag(), MonRunTag::setMonVersionDef(), MonRunList::setRunTag(), RunTypeDef::setRunType(), and RunTag::setRunTypeDef().

                                                                                                 {


  int iovId = 0 ;
  
  cout << "Retrieving run list from DB from run nb ... "<< runNb << endl;
  RunTag  my_runtag;
  LocationDef my_locdef;
  RunTypeDef my_rundef;
  my_locdef.setLocation("P5_Co");
  my_rundef.setRunType("PEDESTAL");
  my_runtag.setLocationDef(my_locdef);
  my_runtag.setRunTypeDef(my_rundef);
  my_runtag.setGeneralTag("LOCAL");
  
  // here we retrieve the Monitoring results
  MonVersionDef monverdef;
  monverdef.setMonitoringVersion("test01");
  MonRunTag montag;
  montag.setMonVersionDef(monverdef);
  montag.setGeneralTag("CMSSW");
  
  MonRunList mon_list;
  mon_list.setMonRunTag(montag);
  mon_list.setRunTag(my_runtag);

  std::cout<<"we are in read ped from condDB and runNb is "<< runNb<<endl;

  mon_list = fetchMonRunListLastNRuns(my_runtag, montag, runNb , 10 );

  std::cout<<"we are in read ped from condDB"<<endl;

  std::vector<MonRunIOV> mon_run_vec =  mon_list.getRuns();
  cout <<"number of ped runs is : "<< mon_run_vec.size()<< endl;
  int mon_runs = mon_run_vec.size();  
  //int sm_num = 0;  

  if(mon_runs>0) {
    for (int ii=0 ; ii<(int)mon_run_vec.size(); ii++) cout << "here is the run number: "<< mon_run_vec[ii].getRunIOV().getRunNumber() << endl;
    
    // for the first run of the list we retrieve the pedestals
    int run=0;
    cout <<" retrieve the data for a given run"<< endl;
    cout << "here is the run number: "<< mon_run_vec[run].getRunIOV().getRunNumber() << endl;
    iovId = mon_run_vec[run].getID();
    
    fetchDataSet(&dataset, &mon_run_vec[run]) ;   
  }
  return iovId ;
}
void EcalTPGDBApp::readFromConfDB_TPGPedestals ( int  iconf_req)

Definition at line 102 of file EcalTPGDBApp.cc.

References gather_cfg::cout, EcalCondDBInterface::fetchConfigSet(), EcalCondDBInterface::fetchDataSet(), EcalLogicID::getID2(), FEConfigPedDat::getPedMeanG1(), FEConfigPedDat::getPedMeanG12(), FEConfigPedDat::getPedMeanG6(), AlCaHLTBitMon_ParallelJobs::p, and FEConfigPedInfo::setId().

                                                             {
  // now we do something else 
  // this is an example for reading the pedestals 
  // for a given config iconf_req 

  // FC alternatively a config set can be retrieved by the tag and version
  
  cout << "*****************************************" << endl;
  cout << "test readinf fe_ped with id="<<iconf_req  << endl;
  cout << "*****************************************" << endl;
  
  FEConfigPedInfo fe_ped_info;
  fe_ped_info.setId(iconf_req);

  fetchConfigSet(&fe_ped_info);

  map<EcalLogicID, FEConfigPedDat> dataset_ped;
  fetchDataSet(&dataset_ped, &fe_ped_info);
  
  typedef map<EcalLogicID, FEConfigPedDat>::const_iterator CIfeped;
  EcalLogicID ecid_xt;
  FEConfigPedDat  rd_ped;
  
  for (CIfeped p = dataset_ped.begin(); p != dataset_ped.end(); p++) {
    ecid_xt = p->first;
    rd_ped  = p->second;
    //int sm_num=ecid_xt.getID1();
    ecid_xt.getID2();
    rd_ped.getPedMeanG12();
    rd_ped.getPedMeanG6();
    rd_ped.getPedMeanG1();
  }
  
  cout << "*****************************************" << endl;
  cout << "test read done"<<iconf_req  << endl;
  cout << "*****************************************" << endl;
  
}
std::string EcalTPGDBApp::to_string ( char  value[]) [inline]

Definition at line 22 of file EcalTPGDBApp.h.

References relativeConstraints::value.

    {
      std::ostringstream streamOut;
      streamOut << value;
      return streamOut.str();    
    }
int EcalTPGDBApp::writeToConfDB_Delay ( const std::map< EcalLogicID, FEConfigTimingDat > &  delaygroupset,
std::string  tag 
)

Definition at line 355 of file EcalTPGDBApp.cc.

References gather_cfg::cout, FEConfigTimingInfo::getId(), EcalCondDBInterface::insertConfigSet(), EcalCondDBInterface::insertDataArraySet(), query::result, and IODConfig::setConfigTag().

Referenced by EcalTPGParamBuilder::analyze().

{
  cout << "*****************************************" << endl;
  cout << "************Inserting Delays************" << endl;
  cout << "*****************************************" << endl;
  int result=0; 

  FEConfigTimingInfo fe_time_info ;
  fe_time_info.setConfigTag(tag);
  insertConfigSet(&fe_time_info);
  
  //  Tm tdb = fe_fgr_info.getDBTime();
  //tdb.dumpTm();
  
  // Insert the dataset
  insertDataArraySet(&timegroupset, &fe_time_info);
  
  result=fe_time_info.getId();

  cout << "*****************************************" << endl;
  cout << "************Delays done******************" << endl;
  cout << "*****************************************" << endl;
  return result;

}
int EcalTPGDBApp::writeToConfDB_Spike ( const std::map< EcalLogicID, FEConfigSpikeDat > &  spikegroupset,
std::string  tag 
)

Definition at line 328 of file EcalTPGDBApp.cc.

References gather_cfg::cout, FEConfigSpikeInfo::getId(), EcalCondDBInterface::insertConfigSet(), EcalCondDBInterface::insertDataArraySet(), query::result, and IODConfig::setConfigTag().

Referenced by EcalTPGParamBuilder::analyze().

{
  cout << "*****************************************" << endl;
  cout << "************Inserting Spike************" << endl;
  cout << "*****************************************" << endl;
  int result=0; 

  FEConfigSpikeInfo fe_spike_info ;
  fe_spike_info.setConfigTag(tag);
  insertConfigSet(&fe_spike_info);
  
  //  Tm tdb = fe_fgr_info.getDBTime();
  //tdb.dumpTm();
  
  // Insert the dataset
  insertDataArraySet(&spikegroupset, &fe_spike_info);
  
  result=fe_spike_info.getId();

  cout << "*****************************************" << endl;
  cout << "************Spike done*******************" << endl;
  cout << "*****************************************" << endl;
  return result;

}
int EcalTPGDBApp::writeToConfDB_TPGFgr ( const std::map< EcalLogicID, FEConfigFgrGroupDat > &  lutgroup,
const std::map< EcalLogicID, FEConfigFgrDat > &  lutdat,
const std::map< EcalLogicID, FEConfigFgrParamDat > &  fgrparamset,
const std::map< EcalLogicID, FEConfigFgrEETowerDat > &  dataset3,
const std::map< EcalLogicID, FEConfigFgrEEStripDat > &  dataset4,
int  iovId,
std::string  tag 
)

Definition at line 288 of file EcalTPGDBApp.cc.

References gather_cfg::cout, FEConfigFgrInfo::getId(), EcalCondDBInterface::insertConfigSet(), EcalCondDBInterface::insertDataArraySet(), query::result, IODConfig::setConfigTag(), and FEConfigFgrInfo::setNumberOfGroups().

Referenced by EcalTPGParamBuilder::analyze().

{
  cout << "*****************************************" << endl;
  cout << "************Inserting Fgr************" << endl;
  cout << "*****************************************" << endl;
  int result=0; 

  FEConfigFgrInfo fe_fgr_info ;
  fe_fgr_info.setNumberOfGroups(iovId); // this eventually refers to some other table 
  fe_fgr_info.setConfigTag(tag);
  insertConfigSet(&fe_fgr_info);
  
  //  Tm tdb = fe_fgr_info.getDBTime();
  //tdb.dumpTm();
  
  // Insert the dataset
  insertDataArraySet(&fgrgroupset, &fe_fgr_info);
  // Insert the dataset
  insertDataArraySet(&fgrset, &fe_fgr_info);
  // Insert the parameters
  insertDataArraySet(&fgrparamset, &fe_fgr_info);
  // Insert the parameters
  insertDataArraySet(&dataset3, &fe_fgr_info);
  // Insert the parameters
  insertDataArraySet(&dataset4, &fe_fgr_info);
  
  result=fe_fgr_info.getId();

  cout << "*****************************************" << endl;
  cout << "************Fgr done*********************" << endl;
  cout << "*****************************************" << endl;
  return result;

}
int EcalTPGDBApp::writeToConfDB_TPGLinearCoef ( const std::map< EcalLogicID, FEConfigLinDat > &  linset,
const std::map< EcalLogicID, FEConfigLinParamDat > &  linparamset,
int  iovId,
std::string  tag 
)

Definition at line 42 of file EcalTPGDBApp.cc.

References gather_cfg::cout, FEConfigLinInfo::getID(), EcalCondDBInterface::insertConfigSet(), EcalCondDBInterface::insertDataArraySet(), query::result, IODConfig::setConfigTag(), and FEConfigLinInfo::setIOVId().

Referenced by EcalTPGParamBuilder::analyze().

                                                                                                                                 {
  
  int result=0;

  cout << "*********************************************" << endl;
  cout << "**Inserting Linarization coeff in conf-OMDS**" << endl;
  cout << "*********************************************" << endl;
  
  cout << "creating fe record " <<endl;
  FEConfigLinInfo fe_lin_info ;
  fe_lin_info.setIOVId(iovId) ;
  fe_lin_info.setConfigTag(tag) ;
  insertConfigSet(&fe_lin_info) ;
  result = fe_lin_info.getID() ;
  
  // Insert the dataset, identifying by iov
  cout << "*********about to insert linearization coeff *********" << endl;
  cout << " map size = "<<linset.size()<<endl ;
  insertDataArraySet(&linset, &fe_lin_info);
  insertDataArraySet(&linparamset, &fe_lin_info);
  cout << "*********Done lineraization coeff            *********" << endl;
  
  return result;
}
int EcalTPGDBApp::writeToConfDB_TPGLUT ( const std::map< EcalLogicID, FEConfigLUTGroupDat > &  lutgroup,
const std::map< EcalLogicID, FEConfigLUTDat > &  lutdat,
const std::map< EcalLogicID, FEConfigLUTParamDat > &  lutparamset,
int  iovId,
std::string  tag 
)

Definition at line 222 of file EcalTPGDBApp.cc.

References gather_cfg::cout, FEConfigLUTInfo::getId(), EcalCondDBInterface::insertConfigSet(), EcalCondDBInterface::insertDataArraySet(), query::result, IODConfig::setConfigTag(), and FEConfigLUTInfo::setNumberOfGroups().

Referenced by EcalTPGParamBuilder::analyze().

{
  cout << "*****************************************" << endl;
  cout << "************Inserting LUT************" << endl;
  cout << "*****************************************" << endl;
  int result=0; 

  FEConfigLUTInfo fe_lut_info ;
  fe_lut_info.setNumberOfGroups(iovId); 
  fe_lut_info.setConfigTag(tag);
  insertConfigSet(&fe_lut_info);
  
  //  Tm tdb = fe_lut_info.getDBTime();
  //tdb.dumpTm();
  
  // Insert the dataset
  insertDataArraySet(&lutgroupset, &fe_lut_info);
  // Insert the dataset
  insertDataArraySet(&lutset, &fe_lut_info);
  // insert the parameters
  insertDataArraySet(&lutparamset, &fe_lut_info);
  
  result=fe_lut_info.getId();

  cout << "*****************************************" << endl;
  cout << "************LUT done*********************" << endl;
  cout << "*****************************************" << endl;
  return result;

}
int EcalTPGDBApp::writeToConfDB_TPGMain ( int  ped,
int  lin,
int  lut,
int  fgr,
int  sli,
int  wei,
int  spi,
int  tim,
int  bxt,
int  btt,
int  bst,
std::string  tag,
int  ver 
)

Definition at line 68 of file EcalTPGDBApp.cc.

References gather_cfg::cout, FEConfigMainInfo::getId(), EcalCondDBInterface::insertConfigSet(), query::result, FEConfigMainInfo::setBstId(), FEConfigMainInfo::setBttId(), FEConfigMainInfo::setBxtId(), IODConfig::setConfigTag(), FEConfigMainInfo::setFgrId(), FEConfigMainInfo::setLinId(), FEConfigMainInfo::setLUTId(), FEConfigMainInfo::setPedId(), FEConfigMainInfo::setSliId(), FEConfigMainInfo::setSpiId(), FEConfigMainInfo::setTimId(), FEConfigMainInfo::setVersion(), and FEConfigMainInfo::setWeiId().

Referenced by EcalTPGParamBuilder::analyze().

                                                                                                                                                              {
  
  int result=0;

  cout << "*********************************************" << endl;
  cout << "**Inserting Main FE table in conf-OMDS     **" << endl;
  cout << "*********************************************" << endl;
  
  cout << "creating fe record " <<endl;

  FEConfigMainInfo fe_main ;
  fe_main.setPedId(ped) ;
  fe_main.setLinId(lin) ;
  fe_main.setLUTId(lut) ;
  fe_main.setFgrId(fgr) ;
  fe_main.setSliId(sli) ;
  fe_main.setWeiId(wei) ;
  fe_main.setSpiId(spi) ;
  fe_main.setTimId(tim) ;
  fe_main.setBxtId(bxt) ;
  fe_main.setBttId(btt) ;
  fe_main.setBstId(bst) ;
  fe_main.setConfigTag(tag) ;
  fe_main.setVersion(ver) ;

  insertConfigSet(&fe_main) ;
  result = fe_main.getId() ;
  
  cout << "*********Done Main           *********" << endl;
  
  return result;
}
int EcalTPGDBApp::writeToConfDB_TPGPedestals ( const std::map< EcalLogicID, FEConfigPedDat > &  pedset,
int  iovId,
std::string  tag 
)

Definition at line 17 of file EcalTPGDBApp.cc.

References gather_cfg::cout, FEConfigPedInfo::getID(), EcalCondDBInterface::insertConfigSet(), EcalCondDBInterface::insertDataArraySet(), query::result, IODConfig::setConfigTag(), and FEConfigPedInfo::setIOVId().

Referenced by EcalTPGParamBuilder::analyze().

                                                                                                                    {
  
  int result=0;

  cout << "*****************************************" << endl;
  cout << "******** Inserting Peds in conf-OMDS*****" << endl;
  cout << "*****************************************" << endl;
  
  cout << "creating fe record " <<endl;
  FEConfigPedInfo fe_ped_info ;
  fe_ped_info.setIOVId(iovId) ;
  fe_ped_info.setConfigTag(tag) ;
  insertConfigSet(&fe_ped_info) ;
  result = fe_ped_info.getID() ;


  // Insert the dataset, identifying by iov
  cout << "*********about to insert peds *********" << endl;
  cout << " map size = "<<pedset.size()<<endl ;
  insertDataArraySet(&pedset, &fe_ped_info);
  cout << "*********Done peds            *********" << endl;
  
  return result;
}
int EcalTPGDBApp::writeToConfDB_TPGSliding ( const std::map< EcalLogicID, FEConfigSlidingDat > &  sliset,
int  iovId,
std::string  tag 
)

Definition at line 194 of file EcalTPGDBApp.cc.

References gather_cfg::cout, FEConfigSlidingInfo::getId(), EcalCondDBInterface::insertConfigSet(), EcalCondDBInterface::insertDataArraySet(), query::result, IODConfig::setConfigTag(), and FEConfigSlidingInfo::setIOVId().

Referenced by EcalTPGParamBuilder::analyze().

{
  cout << "*****************************************" << endl;
  cout << "************Inserting SLIDING************" << endl;
  cout << "*****************************************" << endl;
  int result=0; 

  FEConfigSlidingInfo fe_info ;
  fe_info.setIOVId(iovId); 
  fe_info.setConfigTag(tag);
  insertConfigSet(&fe_info);
  
  //  Tm tdb = fe_lut_info.getDBTime();
  //tdb.dumpTm();
  
  // Insert the dataset
  insertDataArraySet(&sliset, &fe_info);

  result=fe_info.getId();

  cout << "*****************************************" << endl;
  cout << "************SLI done*********************" << endl;
  cout << "*****************************************" << endl;
  return result;

}
int EcalTPGDBApp::writeToConfDB_TPGWeight ( const std::map< EcalLogicID, FEConfigWeightGroupDat > &  lutgroup,
const std::map< EcalLogicID, FEConfigWeightDat > &  lutdat,
int  iovId,
std::string  tag 
)

Definition at line 255 of file EcalTPGDBApp.cc.

References gather_cfg::cout, FEConfigWeightInfo::getId(), EcalCondDBInterface::insertConfigSet(), EcalCondDBInterface::insertDataArraySet(), query::result, IODConfig::setConfigTag(), and FEConfigWeightInfo::setNumberOfGroups().

Referenced by EcalTPGParamBuilder::analyze().

{  
  cout << "*****************************************" << endl;
  cout << "************Inserting weights************" << endl;
  cout << "*****************************************" << endl;
  
  int result=0; 

  FEConfigWeightInfo fe_wei_info ;
  fe_wei_info.setNumberOfGroups(5); // this eventually refers to some other table 
  fe_wei_info.setConfigTag(tag);
  insertConfigSet(&fe_wei_info);
  
  //  Tm tdb = fe_lut_info.getDBTime();
  //tdb.dumpTm();
  
  // Insert the dataset
  insertDataArraySet(&lutgroupset, &fe_wei_info);
  // Insert the dataset
  insertDataArraySet(&lutset, &fe_wei_info);
  
  result=fe_wei_info.getId();

  cout << "*****************************************" << endl;
  cout << "************WEIGHT done******************" << endl;
  cout << "*****************************************" << endl;
  return result;

  
}

Member Data Documentation

uint64_t EcalTPGDBApp::endmicros [private]

Definition at line 54 of file EcalTPGDBApp.h.

Definition at line 56 of file EcalTPGDBApp.h.

uint64_t EcalTPGDBApp::startmicros [private]

Definition at line 53 of file EcalTPGDBApp.h.

Definition at line 55 of file EcalTPGDBApp.h.