CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EcalCondDBInterface Class Reference

#include <EcalCondDBInterface.h>

Inheritance diagram for EcalCondDBInterface:
EcalDBConnection EcalTPGDBApp

List of all members.

Public Member Functions

void dummy ()
 EcalCondDBInterface (std::string host, std::string sid, std::string user, std::string pass, int port=1521)
 EcalCondDBInterface (std::string sid, std::string user, std::string pass)
CaliIOV fetchCaliIOV (CaliTag *tag, Tm evenTm) throw (std::runtime_error)
template<class DATT , class ICONF >
void fetchConfigDataSet (std::vector< DATT > *fillMap, ICONF *iconf) throw (std::runtime_error)
template<class ICONF >
void fetchConfigSet (ICONF *iconf) throw (std::runtime_error)
template<class DATT , class IOVT >
void fetchDataSet (std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) throw (std::runtime_error)
template<class DATT , class IOVT >
void fetchDataSetWithMap (std::map< EcalLogicID, DATT > *fillMap, IOVT *iov, std::string mapping_name) throw (std::runtime_error)
template<class DATT >
void fetchDCSDataSet (std::list< std::pair< Tm, std::map< EcalLogicID, DATT > > > *fillMap, Tm t) throw (std::runtime_error)
DCSPTMTempList fetchDCSPTMTempList (EcalLogicID ecid) throw (std::runtime_error)
DCSPTMTempList fetchDCSPTMTempList (EcalLogicID ecid, Tm start, Tm end) throw (std::runtime_error)
DCUIOV fetchDCUIOV (DCUTag *tag, Tm evenTm) throw (std::runtime_error)
std::list< ODDelaysDatfetchFEDelaysForRun (RunIOV *iov) throw (std::runtime_error)
RunList fetchGlobalRunListByLocation (RunTag tag, int min_run, int max_run, const LocationDef locDef) throw (std::runtime_error)
template<class ICONF >
void fetchLastConfigSet (ICONF *iconf) throw (std::runtime_error)
RunIOV fetchLMFLastRun () const
LMFRunIOV fetchLMFRunIOV (RunTag *runtag, LMFRunTag *lmftag, run_t run, subrun_t lmfrun) throw (std::runtime_error)
bool fetchLMFRunIOV (const LMFSeqDat &, LMFRunIOV &, int lmr, int type, int color) const
MonRunIOV fetchMonRunIOV (RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun) throw (std::runtime_error)
MonRunList fetchMonRunList (RunTag tag, MonRunTag monruntag) throw (std::runtime_error)
MonRunList fetchMonRunList (RunTag tag, MonRunTag monruntag, int min_run, int max_run) throw (std::runtime_error)
MonRunList fetchMonRunListLastNRuns (RunTag tag, MonRunTag monruntag, int max_run, int n_runs) throw (std::runtime_error)
RunList fetchNonEmptyGlobalRunList (RunTag tag, int min_run, int max_run) throw (std::runtime_error)
RunList fetchNonEmptyRunList (RunTag tag, int min_run, int max_run) throw (std::runtime_error)
RunIOV fetchRunIOV (RunTag *tag, run_t run) throw (std::runtime_error)
RunIOV fetchRunIOV (std::string location, run_t run) throw (std::runtime_error)
RunIOV fetchRunIOV (std::string location, const Tm &t) throw (std::runtime_error)
RunList fetchRunList (RunTag tag) throw (std::runtime_error)
RunList fetchRunList (RunTag tag, int min_run, int max_run) throw (std::runtime_error)
RunList fetchRunListByLocation (RunTag tag, int min_run, int max_run, const LocationDef locDef) throw (std::runtime_error)
RunList fetchRunListLastNRuns (RunTag tag, int max_run, int n_runs) throw (std::runtime_error)
template<class DATT , class IOVT >
void fetchValidDataSet (std::map< EcalLogicID, DATT > *fillMap, IOVT *fillIOV, std::string location, run_t run=(unsigned int)-1) throw (std::runtime_error)
template<class DATT , class IOVT >
void fetchValidDataSet (std::map< EcalLogicID, DATT > *fillMap, IOVT *fillIOV, RunTag *tag, run_t run=(unsigned int)-1) throw (std::runtime_error)
DateHandlergetDateHandler ()
std::map< int, int > getDetId2LogicIdMap ()
int getDetIdFromLogicId (int logic_id)
EcalLogicID getEcalLogicID (std::string name, int id1=EcalLogicID::NULLID, int id2=EcalLogicID::NULLID, int id3=EcalLogicID::NULLID, std::string mapsTo="") throw (std::runtime_error)
EcalLogicID getEcalLogicID (int logicID) throw (std::runtime_error)
std::map< int, int > getEcalLogicID2LmrMap ()
std::vector< EcalLogicIDgetEcalLogicIDForLMPN (int lmr_logic_id)
std::vector< EcalLogicIDgetEcalLogicIDForLMPN (const EcalLogicID &lmr_logic_id)
std::vector< EcalLogicIDgetEcalLogicIDForLMR (const EcalLogicID &lmr_logic_id)
std::vector< EcalLogicIDgetEcalLogicIDForLMR (int lmr_logic_id)
std::vector< EcalLogicIDgetEcalLogicIDMappedTo (int logic_id, std::string maps_to)
std::vector< EcalLogicIDgetEcalLogicIDSet (std::string name, int fromId1=EcalLogicID::NULLID, int toId1=EcalLogicID::NULLID, int fromId2=EcalLogicID::NULLID, int toId2=EcalLogicID::NULLID, int fromId3=EcalLogicID::NULLID, int toId3=EcalLogicID::NULLID, std::string mapsTo="") throw (std::runtime_error)
std::vector< EcalLogicIDgetEcalLogicIDSetOrdered (std::string name, int fromId1, int toId1, int fromId2=EcalLogicID::NULLID, int toId2=EcalLogicID::NULLID, int fromId3=EcalLogicID::NULLID, int toId3=EcalLogicID::NULLID, std::string mapsTo="", int orderedBy=EcalLogicID::NULLID) throw (std::runtime_error)
std::map< int, int > getLogicId2DetIdMap ()
int getLogicIdFromDetId (int det_id)
template<class DATT , class ICONF >
void insertConfigDataArraySet (const std::vector< DATT > data, ICONF *iconf) throw (std::runtime_error)
template<class DATT , class ICONF >
void insertConfigDataSet (const std::vector< DATT > data, ICONF *iconf) throw (std::runtime_error)
template<class ICONF >
void insertConfigSet (ICONF *iconf) throw (std::runtime_error)
template<class DATT , class IOVT >
void insertDataArraySet (const std::map< EcalLogicID, DATT > *data, IOVT *iov) throw (std::runtime_error)
template<class DATT , class IOVT >
void insertDataSet (const std::map< EcalLogicID, DATT > *data, IOVT *iov) throw (std::runtime_error)
template<class DATT , class IOVT >
void insertDataSetVector (std::vector< EcalLogicID > ecid, std::vector< IOVT > run_iov, std::vector< DATT > data) throw (std::runtime_error)
void insertDCUIOV (DCUIOV *iov) throw (std::runtime_error)
void insertLmfDat (std::list< LMFDat * > dat) throw (std::runtime_error)
void insertLmfDat (LMFDat *dat) throw (std::runtime_error)
void insertLmfIOV (LMFIOV *iov) throw (std::runtime_error)
void insertLmfLmrSubIOV (LMFLmrSubIOV *iov) throw (std::runtime_error)
void insertLmfRunIOV (LMFRunIOV *iov) throw (std::runtime_error)
void insertLmfSeq (LMFSeqDat *iov) throw (std::runtime_error)
void insertMonRunIOV (MonRunIOV *iov) throw (std::runtime_error)
void insertRunIOV (RunIOV *iov) throw (std::runtime_error)
void updateRunConfig (ODRunConfigInfo *od) throw (std::runtime_error)
void updateRunIOV (RunIOV *iov) throw (std::runtime_error)
void updateRunIOVEndTime (RunIOV *iov) throw (std::runtime_error)
void updateRunIOVStartTime (RunIOV *iov) throw (std::runtime_error)
virtual ~EcalCondDBInterface () throw (std::runtime_error)

Private Member Functions

 EcalCondDBInterface ()
 EcalCondDBInterface (const EcalCondDBInterface &copy)
void fillLogicId2DetIdMaps ()

Private Attributes

std::map< int, int > _detId2LogicId
std::map< int, int > _logicId2DetId
DateHandlerdh

Detailed Description

Definition at line 39 of file EcalCondDBInterface.h.


Constructor & Destructor Documentation

EcalCondDBInterface::EcalCondDBInterface ( std::string  host,
std::string  sid,
std::string  user,
std::string  pass,
int  port = 1521 
) [inline]

Constructor, makes connection to DB without TNS_ADMIN === Parameters === host: DB host machine sid: DB SID (name) user: User to connect pass: Password for user port: port number to connect, default 1521

Definition at line 55 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, dh, and EcalDBConnection::env.

    : EcalDBConnection( host, sid, user, pass, port )
    {
      // call the parent constructor

      // create a DateHandler
      dh = new DateHandler(env, conn);
    }
EcalCondDBInterface::EcalCondDBInterface ( std::string  sid,
std::string  user,
std::string  pass 
) [inline]

Constructor, makes connection to DB with TNS_ADMIN === Parameters === sid: DB SID (name) user: User to connect pass: Password for user

Definition at line 77 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, dh, and EcalDBConnection::env.

    : EcalDBConnection( sid, user, pass )
    {
      // call the parent constructor

      // create a DateHandler
      dh = new DateHandler(env, conn);
    }
virtual EcalCondDBInterface::~EcalCondDBInterface ( ) throw (std::runtime_error) [inline, virtual]

Destructor

Definition at line 92 of file EcalCondDBInterface.h.

References dh.

    {
      // call the parent destructor
      
      // destroy the DateHandler
      delete(dh);
    }
EcalCondDBInterface::EcalCondDBInterface ( ) [private]
EcalCondDBInterface::EcalCondDBInterface ( const EcalCondDBInterface copy) [private]

Member Function Documentation

void EcalCondDBInterface::dummy ( )

Definition at line 920 of file EcalCondDBInterface.cc.

{
}
CaliIOV EcalCondDBInterface::fetchCaliIOV ( CaliTag tag,
Tm  evenTm 
) throw (std::runtime_error)

Return a Calibration IOV object

Definition at line 792 of file EcalCondDBInterface.cc.

References CaliIOV::setByTm(), IDBObject::setConnection(), and GlobalPosition_Frontier_DevDB_cff::tag.

{
  CaliIOV caliiov;
  caliiov.setConnection(env, conn);
  caliiov.setByTm(tag, eventTm);
  return caliiov;
}
template<class DATT , class ICONF >
void EcalCondDBInterface::fetchConfigDataSet ( std::vector< DATT > *  fillMap,
ICONF *  iconf 
) throw (std::runtime_error) [inline]

Definition at line 558 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, EcalDBConnection::env, and edm::pset::fillMap().

  {

    DATT datiface;
    datiface.setConnection(env, conn);
    datiface.createReadStatement();
    datiface.setPrefetchRowCount(1024);
    datiface.fetchData( fillMap, iconf );
    datiface.terminateReadStatement();

  }
template<class ICONF >
void EcalCondDBInterface::fetchConfigSet ( ICONF *  iconf) throw (std::runtime_error) [inline]

Definition at line 449 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, and EcalDBConnection::env.

Referenced by EcalTPGDBApp::readFromConfDB_TPGPedestals().

  {

    iconf->clear();
    iconf->setConnection(env, conn);
    iconf->createReadStatement();
    iconf->fetchData(iconf);
    iconf->terminateReadStatement();

  }
template<class DATT , class IOVT >
void EcalCondDBInterface::fetchDataSet ( std::map< EcalLogicID, DATT > *  fillMap,
IOVT *  iov 
) throw (std::runtime_error) [inline]

Definition at line 581 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, EcalDBConnection::env, edm::pset::fillMap(), and o2o::iov.

Referenced by EcalTPGParamBuilder::analyze(), EcalEndcapMonitorClient::endRunDb(), EcalBarrelMonitorClient::endRunDb(), EcalTPGDBApp::readFromCondDB_Pedestals(), and EcalTPGDBApp::readFromConfDB_TPGPedestals().

  {
    fillMap->clear();

    DATT datiface;
    datiface.setConnection(env, conn);
    datiface.createReadStatement();
    datiface.setPrefetchRowCount(1024);
    datiface.fetchData( fillMap, iov );
    datiface.terminateReadStatement();

  }
template<class DATT , class IOVT >
void EcalCondDBInterface::fetchDataSetWithMap ( std::map< EcalLogicID, DATT > *  fillMap,
IOVT *  iov,
std::string  mapping_name 
) throw (std::runtime_error) [inline]

Definition at line 625 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, EcalDBConnection::env, edm::pset::fillMap(), and o2o::iov.

  {
    fillMap->clear();

    DATT datiface;
    datiface.setConnection(env, conn);
    datiface.createReadStatement();
    datiface.setPrefetchRowCount(1024);
    datiface.fetchData( fillMap, iov , mapping_name);
    datiface.terminateReadStatement();

  }
template<class DATT >
void EcalCondDBInterface::fetchDCSDataSet ( std::list< std::pair< Tm, std::map< EcalLogicID, DATT > > > *  fillMap,
Tm  t 
) throw (std::runtime_error) [inline]

Definition at line 602 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, EcalDBConnection::env, edm::pset::fillMap(), and lumiQTWidget::t.

  {
    fillMap->clear();
    
    DATT datiface;
    datiface.setConnection(env, conn);
    datiface.createReadStatement();
    datiface.setPrefetchRowCount(1024);
    datiface.fetchHistoricalData( fillMap, t );
    datiface.terminateReadStatement();
    
  }
DCSPTMTempList EcalCondDBInterface::fetchDCSPTMTempList ( EcalLogicID  ecid) throw (std::runtime_error)

Return a PTM Temp List

Definition at line 801 of file EcalCondDBInterface.cc.

References DCSPTMTempList::fetchValuesForECID(), alignCSCRings::r, and IDBObject::setConnection().

DCSPTMTempList EcalCondDBInterface::fetchDCSPTMTempList ( EcalLogicID  ecid,
Tm  start,
Tm  end 
) throw (std::runtime_error)
DCUIOV EcalCondDBInterface::fetchDCUIOV ( DCUTag tag,
Tm  evenTm 
) throw (std::runtime_error)

Return a DCU IOV object

Definition at line 737 of file EcalCondDBInterface.cc.

References DCUIOV::setByTm(), IDBObject::setConnection(), and GlobalPosition_Frontier_DevDB_cff::tag.

{
  DCUIOV dcuiov;
  dcuiov.setConnection(env, conn);
  dcuiov.setByTm(tag, eventTm);
  return dcuiov;
}
std::list< ODDelaysDat > EcalCondDBInterface::fetchFEDelaysForRun ( RunIOV iov) throw (std::runtime_error)

Return run Fe Config Dat objects for a given run

Definition at line 107 of file EcalCondDBInterface.cc.

References alignCSCRings::e, RunFEConfigDat::fetchData(), ODDelaysDat::fetchData(), ODFEDAQConfig::fetchData(), edm::pset::fillMap(), ODFEDAQConfig::getDelayId(), i, o2o::iov, runTheMatrix::ret, IDBObject::setConnection(), ODFEDAQConfig::setId(), and groupFilesInBlocks::temp.

{
  std::list<ODDelaysDat> ret;
  RunFEConfigDat d;
  std::map<EcalLogicID, RunFEConfigDat > fillMap;
  try {
    d.setConnection(env, conn);
    d.fetchData(&fillMap, iov);
  } catch (std::runtime_error &e) {
    throw e;
  }
  std::map<EcalLogicID, RunFEConfigDat >::const_iterator i = fillMap.begin();
  std::map<EcalLogicID, RunFEConfigDat >::const_iterator e = fillMap.end();
  while (i != e) {
    ODFEDAQConfig feDaqConfig;
    ODFEDAQConfig temp;
    temp.setId(i->second.getConfigId());
    feDaqConfig.setConnection(env, conn);
    feDaqConfig.fetchData(&temp);
    std::vector<ODDelaysDat> delays;
    ODDelaysDat temp2;
    temp2.setConnection(env, conn);
    temp2.fetchData(&delays, temp.getDelayId());
    std::vector<ODDelaysDat>::const_iterator di = delays.begin();
    std::vector<ODDelaysDat>::const_iterator de = delays.end();
    while (di != de) {
      ret.push_back(*di++);
    }
    i++;
  }
  return ret;
}
RunList EcalCondDBInterface::fetchGlobalRunListByLocation ( RunTag  tag,
int  min_run,
int  max_run,
const LocationDef  locDef 
) throw (std::runtime_error)
template<class ICONF >
void EcalCondDBInterface::fetchLastConfigSet ( ICONF *  iconf) throw (std::runtime_error) [inline]

Definition at line 465 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, and EcalDBConnection::env.

  {

    iconf->clear();
    iconf->setConnection(env, conn);
    iconf->createReadStatement();
    iconf->fetchLastData(iconf);
    iconf->terminateReadStatement();

  }
RunIOV EcalCondDBInterface::fetchLMFLastRun ( ) const

Definition at line 746 of file EcalCondDBInterface.cc.

References LMFSeqDat::fetchLastRun().

                                                  {
  LMFSeqDat seq(env, conn);
  return seq.fetchLastRun();
}
bool EcalCondDBInterface::fetchLMFRunIOV ( const LMFSeqDat seq,
LMFRunIOV iov,
int  lmr,
int  type,
int  color 
) const

Definition at line 761 of file EcalCondDBInterface.cc.

References gather_cfg::cout, LMFRunIOV::fetchBySequence(), LMFRunIOV::fetchLastBeforeSequence(), LMFUnique::getID(), ntuplemaker::iovlist, runTheMatrix::ret, alignCSCRings::s, and IDBObject::setConnection().

                                                                              {
  bool ret = false;
  iov.setConnection(env, conn);
  std::list<LMFRunIOV> iovlist = iov.fetchBySequence(seq, lmr, type, color);
  int s = iovlist.size();
  if (s > 0) {
    iov = iovlist.front();
    ret = true;
    if (s > 1) {
      // should not happen
      std::cout << "################################" << std::endl;
      std::cout << "################################" << std::endl;
      std::cout << "WARNING: More than one LMFRUNIOV" << std::endl;
      std::cout << "         Found for seq " << seq.getID() << std::endl;
      std::cout << "         lmr " << lmr << " type " << type << std::endl;
      std::cout << "         and color " << color << std::endl;
      std::cout << "################################" << std::endl;
      std::cout << "################################" << std::endl;
    }
  } else {
    // find the most recent data
    iovlist = iov.fetchLastBeforeSequence(seq, lmr, type, color);
    s = iovlist.size();
    if (s == 1) {
      iov = iovlist.front();
    } 
  }
  return ret;
}
LMFRunIOV EcalCondDBInterface::fetchLMFRunIOV ( RunTag runtag,
LMFRunTag lmftag,
run_t  run,
subrun_t  lmfrun 
) throw (std::runtime_error)

Return a laser monitoring farm run object

Definition at line 751 of file EcalCondDBInterface.cc.

References DTTTrigCorrFirst::run, and IDBObject::setConnection().

{
  RunIOV runiov = fetchRunIOV(runtag, run);
  LMFRunIOV lmfiov;
  lmfiov.setConnection(env, conn);
  //  lmfiov.setByRun(lmftag, &runiov, subrun);
  return lmfiov;
}
MonRunIOV EcalCondDBInterface::fetchMonRunIOV ( RunTag runtag,
MonRunTag montag,
run_t  run,
subrun_t  monrun 
) throw (std::runtime_error)

Return a monitoring run object

Definition at line 725 of file EcalCondDBInterface.cc.

References DTTTrigCorrFirst::run, MonRunIOV::setByRun(), and IDBObject::setConnection().

Referenced by EcalEndcapMonitorClient::writeDb(), EcalBarrelMonitorClient::writeDb(), and EcalPedOffset::writeDb().

{
  RunIOV runiov = fetchRunIOV(runtag, run);
  MonRunIOV moniov;
  moniov.setConnection(env, conn);
  moniov.setByRun(montag, &runiov, subrun);
  return moniov;
}
MonRunList EcalCondDBInterface::fetchMonRunList ( RunTag  tag,
MonRunTag  monruntag 
) throw (std::runtime_error)
MonRunList EcalCondDBInterface::fetchMonRunList ( RunTag  tag,
MonRunTag  monruntag,
int  min_run,
int  max_run 
) throw (std::runtime_error)
MonRunList EcalCondDBInterface::fetchMonRunListLastNRuns ( RunTag  tag,
MonRunTag  monruntag,
int  max_run,
int  n_runs 
) throw (std::runtime_error)
RunList EcalCondDBInterface::fetchNonEmptyGlobalRunList ( RunTag  tag,
int  min_run,
int  max_run 
) throw (std::runtime_error)
RunList EcalCondDBInterface::fetchNonEmptyRunList ( RunTag  tag,
int  min_run,
int  max_run 
) throw (std::runtime_error)
RunIOV EcalCondDBInterface::fetchRunIOV ( std::string  location,
run_t  run 
) throw (std::runtime_error)

Return a run IOV object for a given location. It is not guarunteed that a run is unique for a location only, so an exception is thrown if more than one result exists.

Definition at line 678 of file EcalCondDBInterface.cc.

References o2o::iov, DTTTrigCorrFirst::run, RunIOV::setByRun(), and IDBObject::setConnection().

{  
  RunIOV iov;
  iov.setConnection(env, conn);
  iov.setByRun(location, run);
  return iov;
}
RunIOV EcalCondDBInterface::fetchRunIOV ( std::string  location,
const Tm t 
) throw (std::runtime_error)

Definition at line 687 of file EcalCondDBInterface.cc.

References o2o::iov, RunIOV::setByTime(), IDBObject::setConnection(), and lumiQTWidget::t.

{
  RunIOV iov;
  iov.setConnection(env, conn);
  iov.setByTime(location, t);
  return iov;
}
RunIOV EcalCondDBInterface::fetchRunIOV ( RunTag tag,
run_t  run 
) throw (std::runtime_error)
RunList EcalCondDBInterface::fetchRunList ( RunTag  tag) throw (std::runtime_error)
RunList EcalCondDBInterface::fetchRunList ( RunTag  tag,
int  min_run,
int  max_run 
) throw (std::runtime_error)
RunList EcalCondDBInterface::fetchRunListByLocation ( RunTag  tag,
int  min_run,
int  max_run,
const LocationDef  locDef 
) throw (std::runtime_error)
RunList EcalCondDBInterface::fetchRunListLastNRuns ( RunTag  tag,
int  max_run,
int  n_runs 
) throw (std::runtime_error)
template<class DATT , class IOVT >
void EcalCondDBInterface::fetchValidDataSet ( std::map< EcalLogicID, DATT > *  fillMap,
IOVT *  fillIOV,
RunTag tag,
run_t  run = (unsigned int)-1 
) throw (std::runtime_error) [inline]

Definition at line 647 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, EcalDBConnection::env, DTTTrigCorrFirst::run, and GlobalPosition_Frontier_DevDB_cff::tag.

  {
    fillMap->clear();
    DATT datiface;
    fillIOV->setConnection(env, conn);
    fillIOV->setByRecentData(datiface.getTable(), tag, run);
    datiface.setConnection(env, conn);
    datiface.createReadStatement();
    datiface.setPrefetchRowCount(1024);
    datiface.fetchData( fillMap, fillIOV );
    datiface.terminateReadStatement();
  }
template<class DATT , class IOVT >
void EcalCondDBInterface::fetchValidDataSet ( std::map< EcalLogicID, DATT > *  fillMap,
IOVT *  fillIOV,
std::string  location,
run_t  run = (unsigned int)-1 
) throw (std::runtime_error) [inline]

Definition at line 671 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, EcalDBConnection::env, and DTTTrigCorrFirst::run.

  {
    fillMap->clear();
    DATT datiface;
    fillIOV->setConnection(env, conn);
    fillIOV->setByRecentData(datiface.getTable(), location, run);
    datiface.setConnection(env, conn);
    datiface.createReadStatement();
    datiface.setPrefetchRowCount(1024);
    datiface.fetchData( fillMap, fillIOV );
    datiface.terminateReadStatement();
  }
void EcalCondDBInterface::fillLogicId2DetIdMaps ( ) [private]

Private method: fill a private map used to associate logicIds to DetIds

Definition at line 29 of file EcalCondDBInterface.cc.

References EcalLogicID::NULLID.

Referenced by getDetId2LogicIdMap(), getDetIdFromLogicId(), getLogicId2DetIdMap(), and getLogicIdFromDetId().

                                                {
  // retrieve the lists of logic_ids, to build the detids
  std::vector<EcalLogicID> crystals_EB  =
    getEcalLogicIDSetOrdered( "EB_crystal_angle",
                              -85,85,1,360,
                              EcalLogicID::NULLID,EcalLogicID::NULLID,
                              "EB_crystal_number", 4 );
  std::vector<EcalLogicID> crystals_EE  =
    getEcalLogicIDSetOrdered( "EE_crystal_number",
                              -1,1,1,100,
                              1,100,
                              "EE_crystal_number", 4 );
  // fill the barrel map
  std::vector<EcalLogicID>::const_iterator ieb = crystals_EB.begin();
  std::vector<EcalLogicID>::const_iterator eeb = crystals_EB.end();
  while (ieb != eeb) {
    int iEta = ieb->getID1();
    int iPhi = ieb->getID2();
    EBDetId ebdetid(iEta,iPhi);
    _logicId2DetId[ieb->getLogicID()] = ebdetid;
    _detId2LogicId[ebdetid] = ieb->getLogicID();
    ieb++;
  }

  // fill the endcap map
  std::vector<EcalLogicID>::const_iterator iee = crystals_EE.begin();
  std::vector<EcalLogicID>::const_iterator eee = crystals_EE.end();

  while (iee != eee) {
    int iSide = iee->getID1();
    int iX    = iee->getID2();
    int iY    = iee->getID3();
    EEDetId eedetidpos(iX,iY,iSide);
    _logicId2DetId[iee->getLogicID()] = eedetidpos;
    _detId2LogicId[eedetidpos] = iee->getLogicID();
    iee++;
  }
  
}
DateHandler* EcalCondDBInterface::getDateHandler ( ) [inline]

Return a date handler associated with this connection

Definition at line 105 of file EcalCondDBInterface.h.

References dh.

    {
      return dh;
    }
std::map<int, int> EcalCondDBInterface::getDetId2LogicIdMap ( ) [inline]

Definition at line 716 of file EcalCondDBInterface.h.

References _detId2LogicId, _logicId2DetId, and fillLogicId2DetIdMaps().

                                                {
    if (_logicId2DetId.size() == 0) {
      fillLogicId2DetIdMaps();
    }
    return _detId2LogicId;
  }
int EcalCondDBInterface::getDetIdFromLogicId ( int  logic_id) [inline]

Definition at line 687 of file EcalCondDBInterface.h.

References _logicId2DetId, cond::rpcobgas::detid, and fillLogicId2DetIdMaps().

                                               {
    int detid = -1;
    if (_logicId2DetId.size() == 0) {
      fillLogicId2DetIdMaps();
    }
    if (_logicId2DetId.find(logic_id) != _logicId2DetId.end()) {
      detid = _logicId2DetId[logic_id];
    }
    return detid;
  }
EcalLogicID EcalCondDBInterface::getEcalLogicID ( std::string  name,
int  id1 = EcalLogicID::NULLID,
int  id2 = EcalLogicID::NULLID,
int  id3 = EcalLogicID::NULLID,
std::string  mapsTo = "" 
) throw (std::runtime_error)

Look up the "human readable" ids and return an EcalLogicID object which contains the "database readable" logic_id === Parameters === name: name of the channel type you are specifying id1, id2, id3: ids of the channel type mapsTo: name of the channel type you are mapping to

Referenced by EcalTPGParamBuilder::analyze(), popcon::EcalLaserHandler::dumpBarrelPayload(), popcon::EcalLaserHandler::dumpEndcapPayload(), and EcalPedOffset::writeDb().

EcalLogicID EcalCondDBInterface::getEcalLogicID ( int  logicID) throw (std::runtime_error)

Look up the database logic_id and return the EcalLogicID object which contains the "human readable" ids === Parameters === logicID: DB logic_id

Definition at line 70 of file EcalCondDBInterface.cc.

References alignCSCRings::e, lumiQueryAPI::msg, mergeVDriftHistosByStation::name, and EcalLogicID::NULLID.

{

  string sql = "SELECT name, logic_id, id1, id2, id3, maps_to FROM channelView WHERE logic_id = :logicID AND name=maps_to";
  
  int id1, id2, id3;
  string name, mapsTo;
  
  try {
    stmt->setSQL(sql);
    stmt->setInt(1, logicID);
    ResultSet* rset = stmt->executeQuery();

    if (rset->next()) {
      name = rset->getString(1);
      logicID = rset->getInt(2);
      id1 = rset->getInt(3);
      if (rset->isNull(3)) { id1 = EcalLogicID::NULLID; }
      id2 = rset->getInt(4);
      if (rset->isNull(4)) { id2 = EcalLogicID::NULLID; }
      id3 = rset->getInt(5);
      if (rset->isNull(5)) { id3 = EcalLogicID::NULLID; }
      mapsTo = rset->getString(6);
    } else {
      stringstream msg;
      msg << "ERROR:  Cannot build EcalLogicID for logic_id " << logicID;
      throw(std::runtime_error(msg.str()));
    }

  } catch (SQLException &e) {    
    throw(std::runtime_error("ERROR:  Failed to retrive ids:  " + e.getMessage() ));
  }
  
  return EcalLogicID( name, logicID, id1, id2, id3, mapsTo );  
}
std::map< int, int > EcalCondDBInterface::getEcalLogicID2LmrMap ( )

Definition at line 295 of file EcalCondDBInterface.cc.

References i, EcalLogicID::NULLID, and runTheMatrix::ret.

                                                            {
  std::map<int, int> ret;
  std::vector<EcalLogicID> crystals_EB  =
    getEcalLogicIDSetOrdered( "EB_crystal_number",
                              1,36,1,1700,
                              EcalLogicID::NULLID,EcalLogicID::NULLID,
                              "EB_crystal_number", EcalLogicID::NULLID);
  std::vector<EcalLogicID> crystals_EE  =
    getEcalLogicIDSetOrdered( "EE_crystal_number",
                              -1,1,1,100,
                              1,100,
                              "EE_crystal_number", EcalLogicID::NULLID);
  std::vector<EcalLogicID> EB_lmr  =
    getEcalLogicIDSetOrdered( "EB_crystal_number",
                              1,36,1,1700,
                              EcalLogicID::NULLID,EcalLogicID::NULLID,
                              "ECAL_LMR", EcalLogicID::NULLID);
  std::vector<EcalLogicID> EE_lmr  =
    getEcalLogicIDSetOrdered( "EE_crystal_number",
                              -1,1,1,100,
                              1,100,
                              "ECAL_LMR", EcalLogicID::NULLID);
  unsigned int neb = crystals_EB.size();
  unsigned int nee = crystals_EE.size();
  if (neb != EB_lmr.size()) {
    throw(std::runtime_error("ERROR: EB Vectors size do not agree"));
  }
  if (nee != EE_lmr.size()) {
    throw(std::runtime_error("ERROR: EE Vectors size do not agree"));
  }
  for (unsigned int i = 0; i < neb; i++) {
    ret[crystals_EB[i].getLogicID()] = EB_lmr[i].getLogicID() % 100;
  }
  for (unsigned int i = 0; i < nee; i++) {
    ret[crystals_EE[i].getLogicID()] = EE_lmr[i].getLogicID() % 100;
  }
  return ret;
}
std::vector< EcalLogicID > EcalCondDBInterface::getEcalLogicIDForLMPN ( int  lmr_logic_id)

Definition at line 389 of file EcalCondDBInterface.cc.

                                                                         {
  if ((lmr / 1000000000) == 2) {
    return getEcalLogicIDMappedTo(lmr, "EE_LM_PN");
  } else {
    return getEcalLogicIDMappedTo(lmr, "EB_LM_PN");
  }
}
std::vector< EcalLogicID > EcalCondDBInterface::getEcalLogicIDForLMPN ( const EcalLogicID lmr_logic_id)

Definition at line 397 of file EcalCondDBInterface.cc.

References EcalLogicID::getLogicID().

                                                                                        {
  return getEcalLogicIDForLMR(lmr.getLogicID());
}
std::vector< EcalLogicID > EcalCondDBInterface::getEcalLogicIDForLMR ( int  lmr_logic_id)

Definition at line 381 of file EcalCondDBInterface.cc.

                                                                        {
  return getEcalLogicIDMappedTo(lmr, "ECAL_LMR");
}
std::vector< EcalLogicID > EcalCondDBInterface::getEcalLogicIDForLMR ( const EcalLogicID lmr_logic_id)

Definition at line 385 of file EcalCondDBInterface.cc.

References EcalLogicID::getLogicID().

                                                                                       {
  return getEcalLogicIDForLMR(lmr.getLogicID());
}
std::vector< EcalLogicID > EcalCondDBInterface::getEcalLogicIDMappedTo ( int  logic_id,
std::string  maps_to 
)

Build various reverse maps Map an LMR, or a Ex_LM_PN into the set of components

Definition at line 334 of file EcalCondDBInterface.cc.

References IDBObject::ECALDB_NROWS, mergeVDriftHistosByStation::name, EcalLogicID::NULLID, and runTheMatrix::ret.

                                                                                                      {
  std::string name = "EB_crystal_angle";
  std::string sql = "SELECT LOGIC_ID, ID1, ID2, ID3 "
    "FROM CHANNELVIEW WHERE NAME = 'EB_crystal_angle' AND LOGIC_ID IN "
    "(SELECT LOGIC_ID FROM CHANNELVIEW WHERE NAME = 'EB_crystal_number' AND "
    "ID1*10000+ID2 IN (SELECT DISTINCT ID1*10000+ID2 FROM CHANNELVIEW "
    "WHERE LOGIC_ID = :1 AND NAME = 'EB_crystal_number' AND MAPS_TO = :2) "
    "AND NAME = MAPS_TO)"; 
  if ((lmr_logic_id / 1000000000) == 2) {
    name = "EE_crystal_number";
    sql = "SELECT LOGIC_ID, ID1, ID2, ID3 "
      "FROM CHANNELVIEW WHERE NAME = 'EE_crystal_number' AND LOGIC_ID IN "
      "(SELECT LOGIC_ID FROM CHANNELVIEW WHERE NAME = 'EE_crystal_number' AND "
      "ID1*10000000+ID2*10000+ID3 IN (SELECT DISTINCT "
      "ID1*10000000+ID2*10000+ID3 FROM CHANNELVIEW "
      "WHERE LOGIC_ID = :1 AND NAME = 'EE_crystal_number' AND MAPS_TO = :2) "
      "AND NAME = MAPS_TO) AND NAME = MAPS_TO"; 
  }
  std::vector<EcalLogicID> ret;
  try {
    stmt->setSQL(sql.c_str());
    stmt->setInt(1, lmr_logic_id);
    stmt->setString(2, maps_to);
    stmt->setPrefetchRowCount(IDBObject::ECALDB_NROWS);    
    
    ResultSet* rset = stmt->executeQuery();
    
    while (rset->next()) {
      int logic_id = rset->getInt(1);
      int id1 = rset->getInt(2);
      if (rset->isNull(2)) { id1 = EcalLogicID::NULLID; }
      int id2 = rset->getInt(3);
      if (rset->isNull(3)) { id2 = EcalLogicID::NULLID; }
      int id3 = rset->getInt(4);
      if (rset->isNull(4)) { id3 = EcalLogicID::NULLID; }
      
      EcalLogicID ecid = EcalLogicID( name, logic_id, id1, id2, id3, maps_to );
      ret.push_back(ecid);
    }
    stmt->setPrefetchRowCount(0);
  }
  catch (SQLException &e) {
    throw(std::runtime_error("ERROR:  Failure while getting EcalLogicID set:  " + e.getMessage() ));
  }
  return ret;
}
std::vector< EcalLogicID > EcalCondDBInterface::getEcalLogicIDSet ( std::string  name,
int  fromId1 = EcalLogicID::NULLID,
int  toId1 = EcalLogicID::NULLID,
int  fromId2 = EcalLogicID::NULLID,
int  toId2 = EcalLogicID::NULLID,
int  fromId3 = EcalLogicID::NULLID,
int  toId3 = EcalLogicID::NULLID,
std::string  mapsTo = "" 
) throw (std::runtime_error)

Get a set of EcalLogicID in one transaction === Parameters === name: name of the channel type you are specifying fromId1, toId1: Range of id1 in the DB to retrieve fromId2, toId2: Range of id2 in the DB to retrieve fromId3, toId3: Range of id3 in the DB to retrieve string mapsTo: channel type name these ids map to

Definition at line 203 of file EcalCondDBInterface.cc.

References IDBObject::ECALDB_NROWS, Capri::details::from(), i, mergeVDriftHistosByStation::name, EcalLogicID::NULLID, and query::result.

{
  if (mapsTo == "") {
    mapsTo = name;
  }
  
  int idArray[] = { fromId1, toId1, fromId2, toId2, fromId3, toId3 };
  int from, to;
  
  stringstream ss;
  ss << "SELECT name, logic_id, id1, id2, id3, maps_to FROM channelView WHERE name = :name AND ";
  
  // loop through the three ids
  for (int i=1; i<=3; i++) {
    from = idArray[2*(i-1)];
    to   = idArray[2*(i-1) + 1];
    
    // check the id arguments in pairs
    if ((from == EcalLogicID::NULLID && to != EcalLogicID::NULLID) || // one is null
        (from != EcalLogicID::NULLID && to == EcalLogicID::NULLID) || //   but not the other
        (from > to)) { // negative interval
      throw(std::runtime_error("ERROR:  Bad arguments for getEcalLogicIDSet"));
    }
    
    // build the sql
    if (from == EcalLogicID::NULLID && to == EcalLogicID::NULLID) {
      ss << "id" << i << " IS NULL AND ";
    } else {
      ss << "id" << i << " >= :id" << i << "from AND " <<
        "id" << i << " <= :id" << i << "to AND ";
    }
  }
  ss << "maps_to = :maps_to ORDER BY id1, id2, id3";
  
  std::vector<EcalLogicID> result;
  
  try {
    stmt->setSQL(ss.str());

    // bind the parameters
    int j = 1;  // parameter number counter
    stmt->setString(j, name);
    j++;
    
    for (int i=0; i<3; i++) {
      from = idArray[2*i];
      to   = idArray[2*i + 1];
      if (from != EcalLogicID::NULLID) {
        stmt->setInt(j, from);
        j++;
        stmt->setInt(j, to);
        j++;
      }
    }

    stmt->setString(j, mapsTo);

  
    stmt->setPrefetchRowCount(IDBObject::ECALDB_NROWS);    

    ResultSet* rset = stmt->executeQuery();

    int id1, id2, id3, logicId;

    while (rset->next()) {
      name = rset->getString(1);
      logicId = rset->getInt(2);
      id1 = rset->getInt(3);
      if (rset->isNull(3)) { id1 = EcalLogicID::NULLID; }
      id2 = rset->getInt(4);
      if (rset->isNull(4)) { id2 = EcalLogicID::NULLID; }
      id3 = rset->getInt(5);
      if (rset->isNull(5)) { id3 = EcalLogicID::NULLID; }
      mapsTo = rset->getString(6);

      EcalLogicID ecid = EcalLogicID( name, logicId, id1, id2, id3, mapsTo );
      result.push_back(ecid);
    }
    stmt->setPrefetchRowCount(0);

  } catch (SQLException &e) {
    throw(std::runtime_error("ERROR:  Failure while getting EcalLogicID set:  " + e.getMessage() ));    
  }

  return result;
}
std::vector< EcalLogicID > EcalCondDBInterface::getEcalLogicIDSetOrdered ( std::string  name,
int  fromId1,
int  toId1,
int  fromId2 = EcalLogicID::NULLID,
int  toId2 = EcalLogicID::NULLID,
int  fromId3 = EcalLogicID::NULLID,
int  toId3 = EcalLogicID::NULLID,
std::string  mapsTo = "",
int  orderedBy = EcalLogicID::NULLID 
) throw (std::runtime_error)

Definition at line 401 of file EcalCondDBInterface.cc.

References IDBObject::ECALDB_NROWS, Capri::details::from(), i, mergeVDriftHistosByStation::name, EcalLogicID::NULLID, and query::result.

Referenced by EcalTPGParamBuilder::analyze().

{
  if (mapsTo == "") {
    mapsTo = name;
  }
  
  int idArray[] = { fromId1, toId1, fromId2, toId2, fromId3, toId3 };
  int from, to;
  
  stringstream ss;
  ss << "SELECT name, logic_id, id1, id2, id3, maps_to FROM channelView WHERE name = :name AND ";
  
  // loop through the three ids
  for (int i=1; i<=3; i++) {
    from = idArray[2*(i-1)];
    to   = idArray[2*(i-1) + 1];
    
    // check the id arguments in pairs
    if ((from == EcalLogicID::NULLID && to != EcalLogicID::NULLID) || // one is null
        (from != EcalLogicID::NULLID && to == EcalLogicID::NULLID) || //   but not the other
        (from > to)) { // negative interval
      throw(std::runtime_error("ERROR:  Bad arguments for getEcalLogicIDSet"));
    }
    
    // build the sql
    if (from == EcalLogicID::NULLID && to == EcalLogicID::NULLID) {
      ss << "id" << i << " IS NULL AND ";
    } else {
      ss << "id" << i << " >= :id" << i << "from AND " <<
        "id" << i << " <= :id" << i << "to AND ";
    }
  }
  ss << "maps_to = :maps_to ";

  if(orderedBy==EcalLogicID::NULLID){
    ss<<"  ORDER BY id1, id2, id3";
  } else if(orderedBy==1 || orderedBy==12 || orderedBy==123){
    ss<<"  ORDER BY id1, id2, id3 ";
  } else if (orderedBy==213 || orderedBy==21 ){ 
    ss<<"  ORDER BY id2, id1, id3 ";
  } else if (orderedBy==231|| orderedBy==23){ 
    ss<<"  ORDER BY id2, id3, id1 ";
  } else if (orderedBy==321|| orderedBy==32){
    ss<<"  ORDER BY id3, id2, id1 ";
  } else if (orderedBy==312|| orderedBy==31){
    ss<<"  ORDER BY id3, id1, id2 ";
  } else if (orderedBy==132|| orderedBy==13){ 
    ss<<"  ORDER BY id1, id3, id2 ";
  } else if (orderedBy==1234 ){ 
    ss<<"  ORDER BY id1, id2, id3, logic_id ";
  } else if (orderedBy==4) {
    ss<<"  ORDER BY logic_id ";
  } else {
    ss<<"  ORDER BY id1, id2, id3";
  }
  
  std::vector<EcalLogicID> result;
  
  try {
    stmt->setSQL(ss.str());

    // bind the parameters
    int j = 1;  // parameter number counter
    stmt->setString(j, name);
    j++;
    
    for (int i=0; i<3; i++) {
      from = idArray[2*i];
      to   = idArray[2*i + 1];
      if (from != EcalLogicID::NULLID) {
        stmt->setInt(j, from);
        j++;
        stmt->setInt(j, to);
        j++;
      }
    }

    stmt->setString(j, mapsTo);

  
    stmt->setPrefetchRowCount(IDBObject::ECALDB_NROWS);    

    ResultSet* rset = stmt->executeQuery();

    int id1, id2, id3, logicId;

    while (rset->next()) {
      name = rset->getString(1);
      logicId = rset->getInt(2);
      id1 = rset->getInt(3);
      if (rset->isNull(3)) { id1 = EcalLogicID::NULLID; }
      id2 = rset->getInt(4);
      if (rset->isNull(4)) { id2 = EcalLogicID::NULLID; }
      id3 = rset->getInt(5);
      if (rset->isNull(5)) { id3 = EcalLogicID::NULLID; }
      mapsTo = rset->getString(6);

      EcalLogicID ecid = EcalLogicID( name, logicId, id1, id2, id3, mapsTo );
      result.push_back(ecid);
    }
    stmt->setPrefetchRowCount(0);

  } catch (SQLException &e) {
    throw(std::runtime_error("ERROR:  Failure while getting EcalLogicID set:  " + e.getMessage() ));    
  }

  return result;
}
std::map<int, int> EcalCondDBInterface::getLogicId2DetIdMap ( ) [inline]

Definition at line 709 of file EcalCondDBInterface.h.

References _logicId2DetId, and fillLogicId2DetIdMaps().

                                                {
    if (_logicId2DetId.size() == 0) {
      fillLogicId2DetIdMaps();
    }
    return _logicId2DetId;
  }
int EcalCondDBInterface::getLogicIdFromDetId ( int  det_id) [inline]

Definition at line 698 of file EcalCondDBInterface.h.

References _detId2LogicId, _logicId2DetId, and fillLogicId2DetIdMaps().

                                             {
    int logic_id = -1;
    if (_logicId2DetId.size() == 0) {
      fillLogicId2DetIdMaps();
    }
    if (_detId2LogicId.find(det_id) != _detId2LogicId.end()) {
      logic_id = _detId2LogicId[det_id];
    }
    return logic_id;
  }
template<class DATT , class ICONF >
void EcalCondDBInterface::insertConfigDataArraySet ( const std::vector< DATT >  data,
ICONF *  iconf 
) throw (std::runtime_error) [inline]

Definition at line 522 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, gather_cfg::cout, AlCaHLTBitMon_QueryRunRegistry::data, alignCSCRings::e, and EcalDBConnection::env.

Referenced by EcalDccWeightBuilder::writeWeightToDB().

  {
    try {
      iconf->setConnection(env, conn);
      // if it has not yet been written then write 
      if(iconf->getId()==0){
        std::cout<<"EcalCondDBInterface>> config_id was not set we retrieve it from DB"<<std::endl;
        iconf->fetchID();
      } 
      if(iconf->getId()==0){
        std::cout<<"EcalCondDBInterface>> configuration info was not written we write it"<<std::endl;
        iconf->writeDB();
      } 
      
      DATT dataIface;
      dataIface.setConnection(env, conn);
      dataIface.prepareWrite();
      
      dataIface.writeArrayDB(data, iconf);
      conn->commit();
      
      dataIface.terminateWriteStatement();
   
    } catch (std::runtime_error &e) {
      conn->rollback();
      throw(e);
    } catch (...) {
      conn->rollback();
      throw(std::runtime_error("EcalCondDBInterface::insertConfigDataArraySet:  Unknown exception caught"));
    }
  }
template<class DATT , class ICONF >
void EcalCondDBInterface::insertConfigDataSet ( const std::vector< DATT >  data,
ICONF *  iconf 
) throw (std::runtime_error) [inline]

Definition at line 483 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, gather_cfg::cout, AlCaHLTBitMon_QueryRunRegistry::data, alignCSCRings::e, EcalDBConnection::env, and AlCaHLTBitMon_ParallelJobs::p.

  {
    try {
      iconf->setConnection(env, conn);
      // if it has not yet been written then write 
      if(iconf->getId()==0){
        std::cout<<"EcalCondDBInterface>> config_id was not set we retrieve it from DB"<<std::endl;
        iconf->fetchID();
      } 
      if(iconf->getId()==0){
        std::cout<<"EcalCondDBInterface>> configuration info was not written we write it"<<std::endl;
        iconf->writeDB();
      } 
      
      DATT dataIface;
      dataIface.setConnection(env, conn);
      dataIface.prepareWrite();
      
      const DATT* dataitem;

      for (int p = 0; p != data->size(); ++p) {
        dataitem = data[p];
        dataIface.writeDB( dataitem, iconf);
      }
      conn->commit();
      dataIface.terminateWriteStatement();
    } catch (std::runtime_error &e) {
      conn->rollback();
      throw(e);
    } catch (...) {
      conn->rollback();
      throw(std::runtime_error("EcalCondDBInterface::insertConfigDataSet:  Unknown exception caught"));
    }
  }
template<class ICONF >
void EcalCondDBInterface::insertConfigSet ( ICONF *  iconf) throw (std::runtime_error) [inline]

Definition at line 425 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, gather_cfg::cout, alignCSCRings::e, and EcalDBConnection::env.

Referenced by EcalTPGDBApp::writeToConfDB_Delay(), EcalTPGDBApp::writeToConfDB_Spike(), EcalTPGDBApp::writeToConfDB_TPGFgr(), EcalTPGDBApp::writeToConfDB_TPGLinearCoef(), EcalTPGDBApp::writeToConfDB_TPGLUT(), EcalTPGDBApp::writeToConfDB_TPGMain(), EcalTPGDBApp::writeToConfDB_TPGPedestals(), EcalTPGDBApp::writeToConfDB_TPGSliding(), EcalTPGDBApp::writeToConfDB_TPGWeight(), and EcalDccWeightBuilder::writeWeightToDB().

   {
     try {
       iconf->setConnection(env, conn);
       iconf->prepareWrite();
       // if it has not yet been written then write 
       iconf->writeDB();
       std::cout<< "iconf inserted with ID="<<iconf->getId()<<std::endl;
       conn->commit();
       iconf->terminateWriteStatement();
     } catch (std::runtime_error &e) {
       conn->rollback();
       throw(e);
     } catch (...) {
       conn->rollback();
       throw(std::runtime_error("EcalCondDBInterface::insertDataSet:  Unknown exception caught"));
     }
   }
template<class DATT , class IOVT >
void EcalCondDBInterface::insertDataArraySet ( const std::map< EcalLogicID, DATT > *  data,
IOVT *  iov 
) throw (std::runtime_error) [inline]

Definition at line 348 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, gather_cfg::cout, AlCaHLTBitMon_QueryRunRegistry::data, alignCSCRings::e, EcalDBConnection::env, and o2o::iov.

Referenced by EcalTPGDBApp::writeToConfDB_Delay(), EcalTPGDBApp::writeToConfDB_Spike(), EcalTPGDBApp::writeToConfDB_TPGFgr(), EcalTPGDBApp::writeToConfDB_TPGLinearCoef(), EcalTPGDBApp::writeToConfDB_TPGLUT(), EcalTPGDBApp::writeToConfDB_TPGPedestals(), EcalTPGDBApp::writeToConfDB_TPGSliding(), and EcalTPGDBApp::writeToConfDB_TPGWeight().

  {
    try {
      iov->setConnection(env, conn);
      if(iov->getID()==0){
        std::cout<<"IOV was not set we retrieve it from DB"<<std::endl;
        iov->fetchID();
      } 
      if(iov->getID()==0){
        std::cout<<"IOV was not written we write it"<<std::endl;
        iov->writeDB();
      } 

      std::cout<<"id="<<iov->getID()<<std::endl;

      DATT dataIface;
      dataIface.setConnection(env, conn);
      dataIface.prepareWrite();
      
      dataIface.writeArrayDB(data, iov);
      conn->commit();
      
      dataIface.terminateWriteStatement();
   
    } catch (std::runtime_error &e) {
      conn->rollback();
      throw(e);
    } catch (...) {
      conn->rollback();
      throw(std::runtime_error("EcalCondDBInterface::insertDataSet:  Unknown exception caught"));
    }
  }
template<class DATT , class IOVT >
void EcalCondDBInterface::insertDataSet ( const std::map< EcalLogicID, DATT > *  data,
IOVT *  iov 
) throw (std::runtime_error) [inline]

Definition at line 308 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, gather_cfg::cout, alignCSCRings::e, EcalDBConnection::env, o2o::iov, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by EcalEndcapMonitorClient::endRunDb(), EcalBarrelMonitorClient::endRunDb(), EcalEndcapMonitorClient::writeDb(), EcalBarrelMonitorClient::writeDb(), and EcalPedOffset::writeDb().

  {
    try {
      iov->setConnection(env, conn);
      // if it has not yet been written then write 
      if(iov->getID()==0){
        std::cout<<"IOV was not set we retrieve it from DB"<<std::endl;
        iov->fetchID();
      } 
      if(iov->getID()==0){
        std::cout<<"IOV was not written we write it"<<std::endl;
        iov->writeDB();
      } 
      
      DATT dataIface;
      dataIface.setConnection(env, conn);
      dataIface.prepareWrite();
      
      const EcalLogicID* channel;
      const DATT* dataitem;
      typedef typename std::map< EcalLogicID, DATT >::const_iterator CI;
      for (CI p = data->begin(); p != data->end(); ++p) {
        channel = &(p->first);
        dataitem = &(p->second);
        dataIface.writeDB( channel, dataitem, iov);
      }
      conn->commit();
      dataIface.terminateWriteStatement();
    } catch (std::runtime_error &e) {
      conn->rollback();
      throw(e);
    } catch (...) {
      conn->rollback();
      throw(std::runtime_error("EcalCondDBInterface::insertDataSet:  Unknown exception caught"));
    }
  }
template<class DATT , class IOVT >
void EcalCondDBInterface::insertDataSetVector ( std::vector< EcalLogicID ecid,
std::vector< IOVT >  run_iov,
std::vector< DATT >  data 
) throw (std::runtime_error) [inline]

Definition at line 383 of file EcalCondDBInterface.h.

References EcalDBConnection::conn, AlCaHLTBitMon_QueryRunRegistry::data, alignCSCRings::e, EcalDBConnection::env, and i.

  {
   
    int nruns= run_iov.size();
   
    if(run_iov.size()!=ecid.size() &&ecid.size()!=data.size()){
      throw(std::runtime_error("EcalCondDBInterface::insertDataSetVector:  vector sizes are different.."));
    } 


    try {
      
      DATT dataIface;
      dataIface.setConnection(env, conn);
      dataIface.prepareWrite();

      for (int i=0; i<nruns; i++){

        run_iov[i].setConnection(env, conn);
        run_iov[i].writeDB();
      
        dataIface.writeDB( &ecid[i], &data[i], &run_iov[i]);
        
        conn->commit();
      }
    } catch (std::runtime_error &e) {
      conn->rollback();
      throw(e);
    } catch (...) {
      conn->rollback();
      throw(std::runtime_error("EcalCondDBInterface::insertDataSet:  Unknown exception caught"));
    }
  }
void EcalCondDBInterface::insertDCUIOV ( DCUIOV iov) throw (std::runtime_error)

Insert a DCU IOV object. Nothing is committed in the event of an exception

Definition at line 709 of file EcalCondDBInterface.cc.

References o2o::iov.

{
  try {
    iov->setConnection(env, conn);
    iov->writeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::insertLmfDat ( LMFDat dat) throw (std::runtime_error)

Definition at line 571 of file EcalCondDBInterface.cc.

{
  try {
    dat->setConnection(env, conn);
    dat->writeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::insertLmfDat ( std::list< LMFDat * >  dat) throw (std::runtime_error)

Definition at line 584 of file EcalCondDBInterface.cc.

References i.

{
  try {
    std::list<LMFDat *>::iterator i = dat.begin();
    std::list<LMFDat *>::iterator e = dat.end();
    while (i != e) {
      (*i)->setConnection(env, conn);
      (*i)->writeDB();
      i++;
    }
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::insertLmfIOV ( LMFIOV iov) throw (std::runtime_error)

Definition at line 558 of file EcalCondDBInterface.cc.

References o2o::iov.

{
  try {
    iov->setConnection(env, conn);
    iov->writeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::insertLmfLmrSubIOV ( LMFLmrSubIOV iov) throw (std::runtime_error)

Definition at line 545 of file EcalCondDBInterface.cc.

References o2o::iov.

{
  try {
    iov->setConnection(env, conn);
    iov->writeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::insertLmfRunIOV ( LMFRunIOV iov) throw (std::runtime_error)

Definition at line 602 of file EcalCondDBInterface.cc.

References o2o::iov.

{
  try {
    iov->setConnection(env, conn);
    iov->writeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::insertLmfSeq ( LMFSeqDat iov) throw (std::runtime_error)

Definition at line 532 of file EcalCondDBInterface.cc.

References o2o::iov.

{
  try {
    iov->setConnection(env, conn);
    iov->writeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::insertMonRunIOV ( MonRunIOV iov) throw (std::runtime_error)

Insert a monitoring run object. Nothing is committed in the event of an exception

Definition at line 696 of file EcalCondDBInterface.cc.

References o2o::iov.

Referenced by EcalEndcapMonitorClient::writeDb(), and EcalBarrelMonitorClient::writeDb().

{
  try {
    iov->setConnection(env, conn);
    iov->writeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::insertRunIOV ( RunIOV iov) throw (std::runtime_error)

Insert a run IOV object. Nothing is committed in the event of an exception

Definition at line 519 of file EcalCondDBInterface.cc.

References o2o::iov.

Referenced by EcalEndcapMonitorClient::beginRunDb(), and EcalBarrelMonitorClient::beginRunDb().

{
  try {
    iov->setConnection(env, conn);
    iov->writeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::updateRunConfig ( ODRunConfigInfo od) throw (std::runtime_error)

Definition at line 654 of file EcalCondDBInterface.cc.

{
  try {
    od->setConnection(env, conn);
    od->updateDefaultCycle();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::updateRunIOV ( RunIOV iov) throw (std::runtime_error)

Definition at line 615 of file EcalCondDBInterface.cc.

References o2o::iov.

{
  try {
    iov->setConnection(env, conn);
    iov->updateEndTimeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::updateRunIOVEndTime ( RunIOV iov) throw (std::runtime_error)

Definition at line 628 of file EcalCondDBInterface.cc.

References o2o::iov.

{
  try {
    iov->setConnection(env, conn);
    iov->updateEndTimeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}
void EcalCondDBInterface::updateRunIOVStartTime ( RunIOV iov) throw (std::runtime_error)

Definition at line 641 of file EcalCondDBInterface.cc.

References o2o::iov.

{
  try {
    iov->setConnection(env, conn);
    iov->updateStartTimeDB();
  } catch(std::runtime_error &e) {
    conn->rollback();
    throw(e);
  }
  conn->commit();
}

Member Data Documentation

std::map<int, int> EcalCondDBInterface::_detId2LogicId [private]

Definition at line 743 of file EcalCondDBInterface.h.

Referenced by getDetId2LogicIdMap(), and getLogicIdFromDetId().

std::map<int, int> EcalCondDBInterface::_logicId2DetId [private]