CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Friends

ODCCSConfig Class Reference

#include <ODCCSConfig.h>

Inheritance diagram for ODCCSConfig:
IODConfig IDBObject

List of all members.

Public Member Functions

int fetchNextId () throw (std::runtime_error)
int getBC0Counter () const
int getBC0Delay () const
std::string getBGOSource () const
int getClock () const
int getDaccal () const
int getDAQBCIDPreset () const
int getDelay () const
std::string getGain () const
int getId () const
std::string getMemGain () const
int getOffsetHigh () const
int getOffsetLow () const
int getOffsetMid () const
std::string getTable ()
int getTEDelay () const
int getTrgBCIDPreset () const
std::string getTrgFilter () const
std::string getTrgMode () const
int getTTSMask () const
 ODCCSConfig ()
void setBC0Counter (int x)
void setBC0Delay (int x)
void setBGOSource (std::string x)
void setClock (int x)
void setDaccal (int x)
void setDAQBCIDPreset (int x)
void setDelay (int x)
void setGain (std::string x)
void setId (int id)
void setMemGain (std::string x)
void setOffsetHigh (int x)
void setOffsetLow (int x)
void setOffsetMid (int x)
void setParameters (std::map< std::string, std::string > my_keys_map)
void setTEDelay (int x)
void setTrgBCIDPreset (int x)
void setTrgFilter (std::string x)
void setTrgMode (std::string x)
void setTTSMask (int x)
 ~ODCCSConfig ()

Private Member Functions

void clear ()
void fetchData (ODCCSConfig *result) throw (std::runtime_error)
int fetchID () throw (std::runtime_error)
void prepareWrite () throw (std::runtime_error)
void writeDB () throw (std::runtime_error)

Private Attributes

int m_bc0
int m_bc0_delay
std::string m_bgo
int m_clock
int m_daccal
int m_daq
int m_delay
std::string m_gain
int m_ID
std::string m_memgain
int m_offset_high
int m_offset_low
int m_offset_mid
std::string m_pedestal_offset_release
std::string m_system
int m_te_delay
int m_trg
std::string m_trg_filter
std::string m_trg_mode
int m_tts_mask

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 9 of file ODCCSConfig.h.


Constructor & Destructor Documentation

ODCCSConfig::ODCCSConfig ( )

Definition at line 19 of file ODCCSConfig.cc.

References NULL.

ODCCSConfig::~ODCCSConfig ( )

Definition at line 52 of file ODCCSConfig.cc.

{
}

Member Function Documentation

void ODCCSConfig::clear ( void  ) [private]
void ODCCSConfig::fetchData ( ODCCSConfig result) throw (std::runtime_error) [private]

Definition at line 195 of file ODCCSConfig.cc.

References ExpressReco_HICollisions_FallBack::e, and query::result.

{
  this->checkConnection();
  result->clear();
  if(result->getId()==0 && (result->getConfigTag()=="") ){
    throw(std::runtime_error("ODCCSConfig::fetchData(): no Id defined for this ODCCSConfig "));
  }

  try {

    m_readStmt->setSQL("SELECT * "
                       "FROM ECAL_CCS_CONFIGURATION  "
                       " where ( CCS_configuration_id = :1 or CCS_tag=:2 )" );
    m_readStmt->setInt(1, result->getId());
    m_readStmt->setString(2, result->getConfigTag());
    ResultSet* rset = m_readStmt->executeQuery();

    rset->next();

    // 1 is the id and 2 is the config tag

    result->setId(rset->getInt(1));
    result->setConfigTag(rset->getString(2));

    result->setDaccal(       rset->getInt(3) );
    result->setDelay(        rset->getInt(4) );
    result->setGain(         rset->getString(5) );
    result->setMemGain(      rset->getString(6) );
    result->setOffsetHigh(   rset->getInt(7) );
    result->setOffsetLow(    rset->getInt(8) );
    result->setOffsetMid(    rset->getInt(9) );
    result->setTrgMode(      rset->getString(10) );
    result->setTrgFilter(    rset->getString(11) );
    result->setClock(        rset->getInt(12) );
    result->setBGOSource(      rset->getString(13) );
    result->setTTSMask(        rset->getInt(14) );
    result->setDAQBCIDPreset(        rset->getInt(15) );
    result->setTrgBCIDPreset(        rset->getInt(16) );
    result->setBC0Counter(        rset->getInt(17) );


  } catch (SQLException &e) {
    throw(std::runtime_error("ODCCSConfig::fetchData():  "+e.getMessage()));
  }
}
int ODCCSConfig::fetchID ( ) throw (std::runtime_error) [private]

Definition at line 242 of file ODCCSConfig.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  // Return from memory if available
  if (m_ID!=0) {
    return m_ID;
  }

  this->checkConnection();

  try {
    Statement* stmt = m_conn->createStatement();
    stmt->setSQL("SELECT ccs_configuration_id FROM ecal_ccs_configuration "
                 "WHERE  ccs_tag=:ccs_tag "
                 );

    stmt->setString(1, getConfigTag() );

    ResultSet* rset = stmt->executeQuery();

    if (rset->next()) {
      m_ID = rset->getInt(1);
    } else {
      m_ID = 0;
    }
    m_conn->terminateStatement(stmt);
  } catch (SQLException &e) {
    throw(std::runtime_error("ODCCSConfig::fetchID:  "+e.getMessage()));
  }

  return m_ID;
}
int ODCCSConfig::fetchNextId ( ) throw (std::runtime_error)

Definition at line 58 of file ODCCSConfig.cc.

References ExpressReco_HICollisions_FallBack::e, and query::result.

                                                      {

  int result=0;
  try {
    this->checkConnection();

    m_readStmt = m_conn->createStatement(); 
    m_readStmt->setSQL("select ecal_CCS_config_sq.NextVal from dual");
    ResultSet* rset = m_readStmt->executeQuery();
    while (rset->next ()){
      result= rset->getInt(1);
    }
    m_conn->terminateStatement(m_readStmt);
    return result; 

  } catch (SQLException &e) {
    throw(std::runtime_error("ODCCSConfig::fetchNextId():  "+e.getMessage()));
  }

}
int ODCCSConfig::getBC0Counter ( ) const [inline]

Definition at line 59 of file ODCCSConfig.h.

References m_bc0.

{ return m_bc0; }
int ODCCSConfig::getBC0Delay ( ) const [inline]

Definition at line 60 of file ODCCSConfig.h.

References m_bc0_delay.

{ return m_bc0_delay; }
std::string ODCCSConfig::getBGOSource ( ) const [inline]

Definition at line 51 of file ODCCSConfig.h.

References m_bgo.

{ return m_bgo; }
int ODCCSConfig::getClock ( ) const [inline]

Definition at line 49 of file ODCCSConfig.h.

References m_clock.

{ return m_clock; }
int ODCCSConfig::getDaccal ( ) const [inline]

Definition at line 22 of file ODCCSConfig.h.

References m_daccal.

{ return m_daccal; }
int ODCCSConfig::getDAQBCIDPreset ( ) const [inline]

Definition at line 55 of file ODCCSConfig.h.

References m_daq.

{ return m_daq; }
int ODCCSConfig::getDelay ( ) const [inline]

Definition at line 25 of file ODCCSConfig.h.

References m_delay.

{ return m_delay; }
std::string ODCCSConfig::getGain ( ) const [inline]

Definition at line 28 of file ODCCSConfig.h.

References m_gain.

{ return m_gain; }
int ODCCSConfig::getId ( ) const [inline]

Definition at line 19 of file ODCCSConfig.h.

References m_ID.

{ return m_ID; }
std::string ODCCSConfig::getMemGain ( ) const [inline]

Definition at line 31 of file ODCCSConfig.h.

References m_memgain.

{ return m_memgain; }
int ODCCSConfig::getOffsetHigh ( ) const [inline]

Definition at line 34 of file ODCCSConfig.h.

References m_offset_high.

{ return m_offset_high; }
int ODCCSConfig::getOffsetLow ( ) const [inline]

Definition at line 37 of file ODCCSConfig.h.

References m_offset_low.

{ return m_offset_low; }
int ODCCSConfig::getOffsetMid ( ) const [inline]

Definition at line 40 of file ODCCSConfig.h.

References m_offset_mid.

{ return m_offset_mid; }
std::string ODCCSConfig::getTable ( ) [inline, virtual]

Implements IODConfig.

Definition at line 16 of file ODCCSConfig.h.

{ return "ECAL_CCS_CONFIGURATION"; }
int ODCCSConfig::getTEDelay ( ) const [inline]

Definition at line 62 of file ODCCSConfig.h.

References m_te_delay.

{ return m_te_delay; }
int ODCCSConfig::getTrgBCIDPreset ( ) const [inline]

Definition at line 57 of file ODCCSConfig.h.

References m_trg.

{ return m_trg; }
std::string ODCCSConfig::getTrgFilter ( ) const [inline]

Definition at line 46 of file ODCCSConfig.h.

References m_trg_filter.

{ return m_trg_filter; }
std::string ODCCSConfig::getTrgMode ( ) const [inline]

Definition at line 43 of file ODCCSConfig.h.

References m_trg_mode.

{ return m_trg_mode; }
int ODCCSConfig::getTTSMask ( ) const [inline]

Definition at line 53 of file ODCCSConfig.h.

References m_tts_mask.

{ return m_tts_mask; }
void ODCCSConfig::prepareWrite ( ) throw (std::runtime_error) [private, virtual]

Implements IODConfig.

Definition at line 79 of file ODCCSConfig.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  this->checkConnection();
  int next_id=fetchNextId();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO ECAL_CCS_CONFIGURATION ( ccs_configuration_id, ccs_tag ,"
                        " daccal, delay, gain, memgain, offset_high,offset_low,offset_mid, trg_mode, trg_filter, "
                        " clock, BGO_SOURCE, TTS_MASK, DAQ_BCID_PRESET , TRIG_BCID_PRESET, BC0_COUNTER, BC0_DELAY, TE_DELAY ) "
                        "VALUES (  "
                        " :ccs_configuration_id, :ccs_tag,  :daccal, :delay, :gain, :memgain, :offset_high,:offset_low,"
                        " :offset_mid, :trg_mode, :trg_filter, :clock, :BGO_SOURCE, :TTS_MASK, "
                        " :DAQ_BCID_PRESET , :TRIG_BCID_PRESET, :BC0_COUNTER, :BC0_DELAY, :TE_DELAY) ");

    m_writeStmt->setInt(1, next_id);
    m_ID=next_id;

  } catch (SQLException &e) {
    throw(std::runtime_error("ODCCSConfig::prepareWrite():  "+e.getMessage()));
  }

}
void ODCCSConfig::setBC0Counter ( int  x) [inline]

Definition at line 58 of file ODCCSConfig.h.

References m_bc0, and ExpressReco_HICollisions_FallBack::x.

{ m_bc0 = x; }
void ODCCSConfig::setBC0Delay ( int  x) [inline]

Definition at line 61 of file ODCCSConfig.h.

References m_bc0_delay, and ExpressReco_HICollisions_FallBack::x.

{ m_bc0_delay = x; }
void ODCCSConfig::setBGOSource ( std::string  x) [inline]

Definition at line 50 of file ODCCSConfig.h.

References m_bgo, and ExpressReco_HICollisions_FallBack::x.

{ m_bgo = x; }
void ODCCSConfig::setClock ( int  x) [inline]

Definition at line 48 of file ODCCSConfig.h.

References m_clock, and ExpressReco_HICollisions_FallBack::x.

{ m_clock = x; }
void ODCCSConfig::setDaccal ( int  x) [inline]

Definition at line 21 of file ODCCSConfig.h.

References m_daccal, and ExpressReco_HICollisions_FallBack::x.

{ m_daccal = x; }
void ODCCSConfig::setDAQBCIDPreset ( int  x) [inline]

Definition at line 54 of file ODCCSConfig.h.

References m_daq, and ExpressReco_HICollisions_FallBack::x.

{ m_daq = x; }
void ODCCSConfig::setDelay ( int  x) [inline]

Definition at line 24 of file ODCCSConfig.h.

References m_delay, and ExpressReco_HICollisions_FallBack::x.

{ m_delay = x; }
void ODCCSConfig::setGain ( std::string  x) [inline]

Definition at line 27 of file ODCCSConfig.h.

References m_gain, and ExpressReco_HICollisions_FallBack::x.

{ m_gain = x; }
void ODCCSConfig::setId ( int  id) [inline]

Definition at line 18 of file ODCCSConfig.h.

References ExpressReco_HICollisions_FallBack::id, and m_ID.

{ m_ID = id; }
void ODCCSConfig::setMemGain ( std::string  x) [inline]

Definition at line 30 of file ODCCSConfig.h.

References m_memgain, and ExpressReco_HICollisions_FallBack::x.

{ m_memgain = x; }
void ODCCSConfig::setOffsetHigh ( int  x) [inline]

Definition at line 33 of file ODCCSConfig.h.

References m_offset_high, and ExpressReco_HICollisions_FallBack::x.

void ODCCSConfig::setOffsetLow ( int  x) [inline]

Definition at line 36 of file ODCCSConfig.h.

References m_offset_low, and ExpressReco_HICollisions_FallBack::x.

{ m_offset_low = x; }
void ODCCSConfig::setOffsetMid ( int  x) [inline]

Definition at line 39 of file ODCCSConfig.h.

References m_offset_mid, and ExpressReco_HICollisions_FallBack::x.

{ m_offset_mid = x; }
void ODCCSConfig::setParameters ( std::map< std::string, std::string >  my_keys_map)
void ODCCSConfig::setTEDelay ( int  x) [inline]

Definition at line 63 of file ODCCSConfig.h.

References m_te_delay, and ExpressReco_HICollisions_FallBack::x.

{ m_te_delay = x; }
void ODCCSConfig::setTrgBCIDPreset ( int  x) [inline]

Definition at line 56 of file ODCCSConfig.h.

References m_trg, and ExpressReco_HICollisions_FallBack::x.

{ m_trg = x; }
void ODCCSConfig::setTrgFilter ( std::string  x) [inline]

Definition at line 45 of file ODCCSConfig.h.

References m_trg_filter, and ExpressReco_HICollisions_FallBack::x.

{ m_trg_filter = x; }
void ODCCSConfig::setTrgMode ( std::string  x) [inline]

Definition at line 42 of file ODCCSConfig.h.

References m_trg_mode, and ExpressReco_HICollisions_FallBack::x.

{ m_trg_mode = x; }
void ODCCSConfig::setTTSMask ( int  x) [inline]

Definition at line 52 of file ODCCSConfig.h.

References m_tts_mask, and ExpressReco_HICollisions_FallBack::x.

{ m_tts_mask = x; }
void ODCCSConfig::writeDB ( ) throw (std::runtime_error) [private]

Definition at line 135 of file ODCCSConfig.cc.

References ExpressReco_HICollisions_FallBack::e, SET_INT, and SET_STRING.

{
  this->checkConnection();
  this->checkPrepare();

  try {

    // number 1 is the id 
    // m_writeStmt->setString(2, this->getConfigTag());
    // m_writeStmt->setInt(3, this->getDaccal());
    // m_writeStmt->setInt(4, this->getDelay());
    // m_writeStmt->setString(5, this->getGain());
    // m_writeStmt->setString(6, this->getMemGain());
    // m_writeStmt->setInt(7, this->getOffsetHigh());
    // m_writeStmt->setInt(8, this->getOffsetLow());
    // m_writeStmt->setInt(9, this->getOffsetMid());
    // m_writeStmt->setString(10, this->getTrgMode() );
    // m_writeStmt->setString(11, this->getTrgFilter() );
    // m_writeStmt->setInt(  12, this->getClock() );
    // m_writeStmt->setString(13, this->getBGOSource() );
    // m_writeStmt->setInt(14, this->getTTSMask() );
    // m_writeStmt->setInt(15, this->getDAQBCIDPreset() );
    // m_writeStmt->setInt(16, this->getTrgBCIDPreset() );
    // m_writeStmt->setInt(17, this->getBC0Counter() );
    
    SET_STRING(m_writeStmt, 2,  this->getConfigTag());
    SET_INT   (m_writeStmt, 3,  this->getDaccal());
    SET_INT   (m_writeStmt, 4,  this->getDelay());
    SET_STRING(m_writeStmt, 5,  this->getGain());
    SET_STRING(m_writeStmt, 6,  this->getMemGain());
    SET_INT   (m_writeStmt, 7,  this->getOffsetHigh());
    SET_INT   (m_writeStmt, 8,  this->getOffsetLow());
    SET_INT   (m_writeStmt, 9,  this->getOffsetMid());
    SET_STRING(m_writeStmt, 10, this->getTrgMode());
    SET_STRING(m_writeStmt, 11, this->getTrgFilter());
    SET_INT   (m_writeStmt, 12, this->getClock());
    SET_STRING(m_writeStmt, 13, this->getBGOSource());
    SET_INT   (m_writeStmt, 14, this->getTTSMask());
    SET_INT   (m_writeStmt, 15, this->getDAQBCIDPreset());
    SET_INT   (m_writeStmt, 16, this->getTrgBCIDPreset());
    SET_INT   (m_writeStmt, 17, this->getBC0Counter());
    SET_INT   (m_writeStmt, 18, this->getBC0Delay());
    SET_INT   (m_writeStmt, 19, this->getTEDelay());
    
    m_writeStmt->executeUpdate();


  } catch (SQLException &e) {
    throw(std::runtime_error("ODCCSConfig::writeDB():  "+e.getMessage()));
  }
  // Now get the ID
  if (!this->fetchID()) {
    throw(std::runtime_error("ODCCSConfig::writeDB:  Failed to write"));
  }


}

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 11 of file ODCCSConfig.h.


Member Data Documentation

int ODCCSConfig::m_bc0 [private]

Definition at line 99 of file ODCCSConfig.h.

Referenced by getBC0Counter(), and setBC0Counter().

int ODCCSConfig::m_bc0_delay [private]

Definition at line 100 of file ODCCSConfig.h.

Referenced by getBC0Delay(), and setBC0Delay().

std::string ODCCSConfig::m_bgo [private]

Definition at line 95 of file ODCCSConfig.h.

Referenced by getBGOSource(), and setBGOSource().

int ODCCSConfig::m_clock [private]

Definition at line 94 of file ODCCSConfig.h.

Referenced by getClock(), and setClock().

int ODCCSConfig::m_daccal [private]

Definition at line 83 of file ODCCSConfig.h.

Referenced by getDaccal(), and setDaccal().

int ODCCSConfig::m_daq [private]

Definition at line 97 of file ODCCSConfig.h.

Referenced by getDAQBCIDPreset(), and setDAQBCIDPreset().

int ODCCSConfig::m_delay [private]

Definition at line 84 of file ODCCSConfig.h.

Referenced by getDelay(), and setDelay().

std::string ODCCSConfig::m_gain [private]

Definition at line 85 of file ODCCSConfig.h.

Referenced by getGain(), and setGain().

int ODCCSConfig::m_ID [private]

Definition at line 82 of file ODCCSConfig.h.

Referenced by getId(), and setId().

std::string ODCCSConfig::m_memgain [private]

Definition at line 86 of file ODCCSConfig.h.

Referenced by getMemGain(), and setMemGain().

Definition at line 87 of file ODCCSConfig.h.

Referenced by getOffsetHigh(), and setOffsetHigh().

Definition at line 88 of file ODCCSConfig.h.

Referenced by getOffsetLow(), and setOffsetLow().

Definition at line 89 of file ODCCSConfig.h.

Referenced by getOffsetMid(), and setOffsetMid().

Definition at line 90 of file ODCCSConfig.h.

std::string ODCCSConfig::m_system [private]

Definition at line 91 of file ODCCSConfig.h.

int ODCCSConfig::m_te_delay [private]

Definition at line 101 of file ODCCSConfig.h.

Referenced by getTEDelay(), and setTEDelay().

int ODCCSConfig::m_trg [private]

Definition at line 98 of file ODCCSConfig.h.

Referenced by getTrgBCIDPreset(), and setTrgBCIDPreset().

std::string ODCCSConfig::m_trg_filter [private]

Definition at line 93 of file ODCCSConfig.h.

Referenced by getTrgFilter(), and setTrgFilter().

std::string ODCCSConfig::m_trg_mode [private]

Definition at line 92 of file ODCCSConfig.h.

Referenced by getTrgMode(), and setTrgMode().

int ODCCSConfig::m_tts_mask [private]

Definition at line 96 of file ODCCSConfig.h.

Referenced by getTTSMask(), and setTTSMask().