CMS 3D CMS Logo

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

LMFRunIOV Class Reference

#include <LMFRunIOV.h>

Inheritance diagram for LMFRunIOV:
LMFUnique IUniqueDBObject IDBObject

List of all members.

Public Member Functions

virtual void dump () const
std::list< LMFRunIOVfetchBySequence (const LMFSeqDat &s)
std::list< LMFRunIOVfetchBySequence (const LMFSeqDat &s, int lmr)
std::list< LMFRunIOVfetchBySequence (const LMFSeqDat &s, int lmr, int type, int color)
std::string fetchIdSql (Statement *stmt)
std::list< LMFRunIOVfetchLastBeforeSequence (const LMFSeqDat &s, int lmr, int type, int color)
LMFColor getColor () const
std::string getColorLongName () const
std::string getColorShortName () const
Tm getDBInsertionTime () const
LMFColor getLMFColor () const
LMFRunTag getLMFRunTag () const
int getLmr () const
void getParameters (ResultSet *rset)
LMFSeqDat getSequence () const
Tm getSubRunEnd () const
Tm getSubRunStart () const
std::string getSubRunType () const
LMFTrigType getTriggerType () const
bool isValid ()
 LMFRunIOV (const LMFRunIOV &r)
 LMFRunIOV ()
 LMFRunIOV (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 LMFRunIOV (EcalDBConnection *c)
bool operator!= (const LMFRunIOV &m) const
virtual LMFRunIOVoperator= (const LMFRunIOV &r)
bool operator== (const LMFRunIOV &m) const
std::string setByIDSql (Statement *stmt, int id)
LMFRunIOVsetColor (int color_id)
LMFRunIOVsetColor (const LMFColor &c)
LMFRunIOVsetColor (std::string name)
LMFRunIOVsetColorIndex (int color_index)
LMFRunIOVsetLMFRunTag (const LMFRunTag &tag)
LMFRunIOVsetLMFRunTag (int tag_id)
LMFRunIOVsetLmr (int n)
LMFRunIOVsetSequence (LMFSeqDat *seq)
LMFRunIOVsetSequence (LMFSeqDat &seq)
LMFRunIOVsetSubRunEnd (Tm end)
LMFRunIOVsetSubRunStart (Tm start)
LMFRunIOVsetSubRunType (const std::string &x)
LMFRunIOVsetTriggerType (LMFTrigType &tt)
LMFRunIOVsetTriggerType (int trigType_id)
LMFRunIOVsetTriggerType (std::string trigShortName)
std::string writeDBSql (Statement *stmt)
 ~LMFRunIOV ()

Private Member Functions

void checkFabric ()
std::list< LMFRunIOVfetchBySequence (std::vector< int > par, const std::string &sql, const std::string &method) throw (std::runtime_error)
void initialize ()

Private Attributes

LMFDefFabric_fabric

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 19 of file LMFRunIOV.h.


Constructor & Destructor Documentation

LMFRunIOV::LMFRunIOV ( )

Definition at line 26 of file LMFRunIOV.cc.

References initialize().

                     : LMFUnique()
{
  initialize();
}
LMFRunIOV::LMFRunIOV ( oracle::occi::Environment *  env,
oracle::occi::Connection *  conn 
)

Definition at line 31 of file LMFRunIOV.cc.

References initialize().

                                                 : LMFUnique(env, conn)
{
  initialize();
}
LMFRunIOV::LMFRunIOV ( EcalDBConnection c)

Definition at line 37 of file LMFRunIOV.cc.

References initialize().

                                        : LMFUnique(c)
{
  initialize();
}
LMFRunIOV::LMFRunIOV ( const LMFRunIOV r)

Definition at line 42 of file LMFRunIOV.cc.

References initialize(), and alignCSCRings::r.

                                       {
  initialize();
  *this = r;
}
LMFRunIOV::~LMFRunIOV ( )

Definition at line 47 of file LMFRunIOV.cc.

References _fabric, and NULL.

{
  if (_fabric != NULL) {
    delete _fabric;
  }
}

Member Function Documentation

void LMFRunIOV::checkFabric ( ) [private]

Definition at line 85 of file LMFRunIOV.cc.

References _fabric, IDBObject::m_conn, IDBObject::m_env, and NULL.

Referenced by operator=(), setColor(), setColorIndex(), and setTriggerType().

                            {
  if (_fabric == NULL) {
    _fabric = new LMFDefFabric(m_env, m_conn);
  }
}
void LMFRunIOV::dump ( void  ) const [virtual]

Reimplemented from LMFUnique.

Definition at line 209 of file LMFRunIOV.cc.

References _fabric, gather_cfg::cout, LMFDefFabric::dump(), and LMFUnique::m_debug.

                           {
  LMFUnique::dump();
  std::cout << "# Fabric Address: " << _fabric << std::endl;
  if (m_debug) {
    _fabric->dump();
  }
}
std::list< LMFRunIOV > LMFRunIOV::fetchBySequence ( const LMFSeqDat s,
int  lmr,
int  type,
int  color 
)

Definition at line 367 of file LMFRunIOV.cc.

References fetchBySequence(), LMFUnique::getID(), and Parameters::parameters.

                                                                     {
  int seq_id = s.getID();
  vector<int> parameters;
  parameters.push_back(seq_id);
  parameters.push_back(lmr);
  parameters.push_back(color);
  parameters.push_back(type);
  return fetchBySequence(parameters, "SELECT LMF_IOV_ID FROM "
                         "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
                         "WHERE SEQ_ID = :1 AND LMR = :2 AND COLOR_ID = :3 "
                         "AND TRIG_TYPE = :4",
                         "fetchBySequence");
}
std::list< LMFRunIOV > LMFRunIOV::fetchBySequence ( const LMFSeqDat s,
int  lmr 
)

Definition at line 356 of file LMFRunIOV.cc.

References fetchBySequence(), LMFUnique::getID(), and Parameters::parameters.

                                                                         {
  int seq_id = s.getID();
  vector<int> parameters;
  parameters.push_back(seq_id);
  parameters.push_back(lmr);
  return fetchBySequence(parameters, "SELECT LMF_IOV_ID FROM "
                         "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
                         "WHERE SEQ_ID = :1 AND LMR = :2", 
                         "fetchBySequence");
}
std::list<LMFRunIOV> LMFRunIOV::fetchBySequence ( std::vector< int >  par,
const std::string &  sql,
const std::string &  method 
) throw (std::runtime_error) [private]
std::list< LMFRunIOV > LMFRunIOV::fetchBySequence ( const LMFSeqDat s)

Definition at line 347 of file LMFRunIOV.cc.

References LMFUnique::getID(), and Parameters::parameters.

Referenced by fetchBySequence(), fetchLastBeforeSequence(), and EcalCondDBInterface::fetchLMFRunIOV().

                                                                {
  int seq_id = s.getID();
  vector<int> parameters;
  parameters.push_back(seq_id);
  return fetchBySequence(parameters, "SELECT LMF_IOV_ID FROM "
                         "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
                         "WHERE SEQ_ID = :1", "fetchBySequence");
}
std::string LMFRunIOV::fetchIdSql ( Statement stmt) [virtual]

Reimplemented from LMFUnique.

Definition at line 217 of file LMFRunIOV.cc.

References LMFUnique::m_intFields.

{
  std::string sql = "";
  
  sql = "SELECT LMF_IOV_ID FROM CMS_ECAL_LASER_COND.LMF_RUN_IOV WHERE "
    "SEQ_ID = :1 "
    "AND LMR = :2 ";
  if (m_intFields["tag_id"] > 0) {
    sql += "AND TAG_ID = :3";
  }
  stmt->setSQL(sql);
  stmt->setInt(1, m_intFields["seq_id"]);
  stmt->setInt(2, m_intFields["lmr"]);
  if (m_intFields["tag_id"] > 0) {
    stmt->setInt(3, m_intFields["tag_id"]);
  }
  return sql;
}
std::list< LMFRunIOV > LMFRunIOV::fetchLastBeforeSequence ( const LMFSeqDat s,
int  lmr,
int  type,
int  color 
)

Definition at line 382 of file LMFRunIOV.cc.

References fetchBySequence(), LMFUnique::getID(), and Parameters::parameters.

Referenced by EcalCondDBInterface::fetchLMFRunIOV().

                                                                   {
  int seq_id = s.getID();
  vector<int> parameters;
  parameters.push_back(seq_id);
  parameters.push_back(lmr);
  parameters.push_back(color);
  parameters.push_back(type);
  return fetchBySequence(parameters, "SELECT LMF_IOV_ID FROM (SELECT "
                         "SEQ_ID, LMF_IOV_ID FROM "
                         "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
                         "WHERE SEQ_ID < :1 AND LMR = :2 AND COLOR_ID = :3 "
                         "AND TRIG_TYPE = :4 ORDER BY SEQ_ID DESC) WHERE "
                         "ROWNUM <= 1",
                         "fetchBySequence");
}
LMFColor LMFRunIOV::getColor ( ) const [inline]

Definition at line 56 of file LMFRunIOV.h.

References getLMFColor().

{ return getLMFColor(); }
std::string LMFRunIOV::getColorLongName ( ) const

Definition at line 117 of file LMFRunIOV.cc.

References getLMFColor(), and LMFColor::getLongName().

                                            {
  LMFColor rcol = getLMFColor();
  return rcol.getLongName();
}
std::string LMFRunIOV::getColorShortName ( ) const

Definition at line 112 of file LMFRunIOV.cc.

References getLMFColor(), and LMFColor::getShortName().

                                             {
  LMFColor rcol = getLMFColor();
  return rcol.getShortName();
}
Tm LMFRunIOV::getDBInsertionTime ( ) const

Definition at line 178 of file LMFRunIOV.cc.

References LMFUnique::getString(), Tm::setToString(), and lumiQTWidget::t.

                                       {
  Tm t;
  t.setToString(getString("db_timestamp"));
  return t;
}
LMFColor LMFRunIOV::getLMFColor ( ) const

Definition at line 105 of file LMFRunIOV.cc.

References LMFUnique::getInt(), IDBObject::m_conn, IDBObject::m_env, and LMFUnique::setByID().

Referenced by getColor(), getColorLongName(), getColorShortName(), isValid(), and operator==().

{
  LMFColor rcol = LMFColor(m_env, m_conn);
  rcol.setByID(getInt("color_id"));
  return rcol;
}
LMFRunTag LMFRunIOV::getLMFRunTag ( ) const

Definition at line 66 of file LMFRunIOV.cc.

References LMFUnique::getInt(), IDBObject::m_conn, IDBObject::m_env, and LMFUnique::setByID().

Referenced by isValid(), and operator==().

{
  LMFRunTag rtag = LMFRunTag(m_env, m_conn);
  rtag.setByID(getInt("tag_id"));
  return rtag;
}
int LMFRunIOV::getLmr ( ) const

Definition at line 152 of file LMFRunIOV.cc.

References LMFUnique::getInt().

Referenced by isValid(), and operator==().

                            {
  return getInt("lmr");
}
void LMFRunIOV::getParameters ( ResultSet rset) [virtual]

Reimplemented from LMFUnique.

Definition at line 248 of file LMFRunIOV.cc.

References DateHandler::dateToTm(), IDBObject::m_conn, IDBObject::m_env, LMFUnique::m_foreignKeys, setColor(), IDBObject::setConnection(), LMFUnique::setInt(), setLMFRunTag(), LMFUnique::setString(), setTriggerType(), dqm_diff::start, and Tm::str().

                                             {
  DateHandler dh(m_env, m_conn);
  setLMFRunTag(rset->getInt(1));
  LMFSeqDat *seq;
  if (m_foreignKeys.find("sequence") != m_foreignKeys.end()) {
    seq = (LMFSeqDat*)m_foreignKeys["sequence"];
    setInt("seq_id", seq->getID());
  } else {
    seq = new LMFSeqDat;
    seq->setConnection(m_env, m_conn);
    seq->setByID(rset->getInt(2));
    setInt("seq_id", seq->getID());
    delete seq;
  }
  setInt("lmr", rset->getInt(3));
  setColor(rset->getInt(4));
  setTriggerType(rset->getInt(5));
  Date start = rset->getDate(6);
  setString("subrun_start", dh.dateToTm(start).str());
  Date stop = rset->getDate(7);
  setString("subrun_end", dh.dateToTm(stop).str());
  setString("subrun_type", rset->getString(8));
  setString("db_timestamp", rset->getTimestamp(9).toText("YYYY-MM-DD HH24:MI:SS", 0));
}
LMFSeqDat LMFRunIOV::getSequence ( ) const

Definition at line 202 of file LMFRunIOV.cc.

References LMFUnique::getInt(), IDBObject::m_conn, IDBObject::m_env, and LMFUnique::setByID().

Referenced by isValid(), and operator==().

{
  LMFSeqDat rs = LMFSeqDat(m_env, m_conn);
  rs.setByID(getInt("seq_id"));
  return rs;
}
Tm LMFRunIOV::getSubRunEnd ( ) const

Definition at line 172 of file LMFRunIOV.cc.

References LMFUnique::getString(), Tm::setToString(), and lumiQTWidget::t.

Referenced by operator==(), and writeDBSql().

                                 {
  Tm t;
  t.setToString(getString("subrun_end"));
  return t;
}
Tm LMFRunIOV::getSubRunStart ( ) const

Definition at line 161 of file LMFRunIOV.cc.

References LMFUnique::getString(), Tm::setToString(), and lumiQTWidget::t.

Referenced by LMFDat::getSubrunStart(), operator==(), and writeDBSql().

                                   {
  Tm t;
  t.setToString(getString("subrun_start"));
  return t;
}
std::string LMFRunIOV::getSubRunType ( ) const

Definition at line 189 of file LMFRunIOV.cc.

References LMFUnique::getString().

Referenced by operator==(), and writeDBSql().

                                         {
  return getString("subrun_type");
}
LMFTrigType LMFRunIOV::getTriggerType ( void  ) const

Definition at line 140 of file LMFRunIOV.cc.

References LMFUnique::getInt(), IDBObject::m_conn, IDBObject::m_env, and LMFUnique::setByID().

Referenced by isValid(), and operator==().

{
  LMFTrigType rt = LMFTrigType(m_env, m_conn);
  rt.setByID(getInt("trigType_id"));
  return rt;
}
void LMFRunIOV::initialize ( ) [private]

Definition at line 8 of file LMFRunIOV.cc.

References NULL, Tm::setToCurrentGMTime(), and Tm::str().

Referenced by LMFRunIOV().

                           {
  Tm tm;
  tm.setToCurrentGMTime();

  m_intFields["lmr"] = 0;
  m_intFields["tag_id"] = 0;
  m_intFields["seq_id"] = 0;
  m_intFields["color_id"] = 0;
  m_intFields["trigType_id"] = 0;
  m_stringFields["subrun_start"] = tm.str();
  m_stringFields["subrun_end"] = tm.str();
  m_stringFields["db_timestamp"] = tm.str();
  m_stringFields["subrun_type"] = "none";
  m_className = "LMFRunIOV";
  
  _fabric = NULL;
}
bool LMFRunIOV::isValid ( void  ) [virtual]

Reimplemented from LMFUnique.

Definition at line 273 of file LMFRunIOV.cc.

References getLMFColor(), getLMFRunTag(), getLmr(), getSequence(), getTriggerType(), and runTheMatrix::ret.

                        {
  bool ret = true;
  if (!getLMFRunTag().isValid()) {
    ret = false;
  }
  if (!getSequence().isValid()) {
    ret = false;
  }
  if (!getTriggerType().isValid()) {
    ret = false;
  }
  if ((getLmr() < 0) || (getLmr() > 92)) {
    ret = false;
  }
  if (!getLMFColor().isValid()) {
    ret = false;
  }
  // subrun start and end are by definition valid
  return ret;
}
bool LMFRunIOV::operator!= ( const LMFRunIOV m) const [inline]

Definition at line 84 of file LMFRunIOV.h.

References m.

{ return !(*this == m); }
LMFRunIOV & LMFRunIOV::operator= ( const LMFRunIOV r) [virtual]

Definition at line 400 of file LMFRunIOV.cc.

References _fabric, checkFabric(), gather_cfg::cout, LMFDefFabric::debug(), LMFUnique::m_debug, and NULL.

                                                  {
  if (this != &r) {
    LMFUnique::operator=(r);
    if (r._fabric != NULL) {
      checkFabric();//      _fabric = new LMFDefFabric;
      if (m_debug) {
        _fabric->debug();
        std::cout << "COPYING INTO " << _fabric << std::endl;
      }
      *_fabric = *(r._fabric);
    }
  }
  return *this;
}
bool LMFRunIOV::operator== ( const LMFRunIOV m) const [inline]
std::string LMFRunIOV::setByIDSql ( Statement stmt,
int  id 
) [virtual]

Reimplemented from LMFUnique.

Definition at line 236 of file LMFRunIOV.cc.

References IDBObject::m_conn, and IDBObject::m_env.

{
   DateHandler dh(m_env, m_conn);
   std::string sql = "SELECT TAG_ID, SEQ_ID, LMR, COLOR_ID, TRIG_TYPE, "
     "SUBRUN_START, SUBRUN_END, SUBRUN_TYPE, DB_TIMESTAMP FROM "
     "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
     "WHERE LMF_IOV_ID = :1";
   stmt->setSQL(sql);
   stmt->setInt(1, id);
   return sql;  
}
LMFRunIOV & LMFRunIOV::setColor ( const LMFColor c)

Definition at line 73 of file LMFRunIOV.cc.

References LMFUnique::getID(), and LMFUnique::setInt().

Referenced by getParameters().

{
  setInt("color_id", color.getID());
  return *this;
}
LMFRunIOV & LMFRunIOV::setColor ( int  color_id)

Definition at line 79 of file LMFRunIOV.cc.

References LMFUnique::setInt().

{
  setInt("color_id", color_id);
  return *this;
}
LMFRunIOV & LMFRunIOV::setColor ( std::string  name)

Definition at line 98 of file LMFRunIOV.cc.

References _fabric, checkFabric(), LMFDefFabric::getColorID(), and LMFUnique::setInt().

{
  checkFabric();
  setInt("color_id", _fabric->getColorID(name));
  return *this;
}
LMFRunIOV & LMFRunIOV::setColorIndex ( int  color_index)

Definition at line 91 of file LMFRunIOV.cc.

References _fabric, checkFabric(), LMFDefFabric::getColorID(), and LMFUnique::setInt().

{
  checkFabric();
  setInt("color_id", _fabric->getColorID(color_index));
  return *this;
}
LMFRunIOV & LMFRunIOV::setLMFRunTag ( int  tag_id)

Definition at line 60 of file LMFRunIOV.cc.

References LMFUnique::setInt().

{
  setInt("tag_id", tag_id);
  return *this;
}
LMFRunIOV & LMFRunIOV::setLMFRunTag ( const LMFRunTag tag)

Definition at line 54 of file LMFRunIOV.cc.

References LMFUnique::getID(), and LMFUnique::setInt().

Referenced by getParameters().

{
  setInt("tag_id", tag.getID());
  return *this;
}
LMFRunIOV & LMFRunIOV::setLmr ( int  n)

Definition at line 147 of file LMFRunIOV.cc.

References LMFUnique::setInt().

                                  {
  setInt("lmr", n);
  return *this;
}
LMFRunIOV & LMFRunIOV::setSequence ( LMFSeqDat seq)

Definition at line 193 of file LMFRunIOV.cc.

References LMFUnique::attach(), LMFUnique::getID(), and LMFUnique::setInt().

{
  LMFSeqDat *seqdat = new LMFSeqDat();
  *seqdat = seq;
  attach("sequence", seqdat);
  setInt("seq_id", seqdat->getID());
  return *this;
}
LMFRunIOV& LMFRunIOV::setSequence ( LMFSeqDat seq)
LMFRunIOV & LMFRunIOV::setSubRunEnd ( Tm  end)

Definition at line 167 of file LMFRunIOV.cc.

References LMFUnique::setString(), and Tm::str().

                                          {
  setString("subrun_end", stop.str());
  return *this;
}
LMFRunIOV & LMFRunIOV::setSubRunStart ( Tm  start)

Definition at line 156 of file LMFRunIOV.cc.

References LMFUnique::setString(), and Tm::str().

                                             {
  setString("subrun_start", start.str());
  return *this;
}
LMFRunIOV & LMFRunIOV::setSubRunType ( const std::string &  x)

Definition at line 184 of file LMFRunIOV.cc.

References LMFUnique::setString().

                                                      {
  setString("subrun_type", s);
  return *this;
}
LMFRunIOV & LMFRunIOV::setTriggerType ( std::string  trigShortName)

Definition at line 128 of file LMFRunIOV.cc.

References _fabric, checkFabric(), LMFDefFabric::getTrigTypeID(), and LMFUnique::setInt().

{
  checkFabric();
  setInt("trigType_id", _fabric->getTrigTypeID(sname));
  return *this;
}
LMFRunIOV & LMFRunIOV::setTriggerType ( LMFTrigType tt)

Definition at line 122 of file LMFRunIOV.cc.

References LMFUnique::getID(), and LMFUnique::setInt().

Referenced by getParameters().

{
  setInt("trigType_id", trigType.getID());
  return *this;
}
LMFRunIOV & LMFRunIOV::setTriggerType ( int  trigType_id)

Definition at line 135 of file LMFRunIOV.cc.

References LMFUnique::setInt().

                                           {
  setInt("trigType_id", id);
  return *this;
}
std::string LMFRunIOV::writeDBSql ( Statement stmt) [virtual]

Reimplemented from LMFUnique.

Definition at line 294 of file LMFRunIOV.cc.

References LMFUnique::getInt(), getSubRunEnd(), getSubRunStart(), getSubRunType(), IDBObject::m_conn, IDBObject::m_env, LMFUnique::sequencePostfix(), DateHandler::tmToDate(), and groupFilesInBlocks::tt.

{
  // check that everything has been setup
  int tag_id = getInt("tag_id");
  int seq_id = getInt("seq_id");
  int color_id = getInt("color_id");
  int tt = getInt("trigType_id");
  std::string sp = sequencePostfix(getSubRunStart());
  std::string sql = "INSERT INTO LMF_RUN_IOV (LMF_IOV_ID, TAG_ID, SEQ_ID, "
    "LMR, COLOR_ID, TRIG_TYPE, SUBRUN_START, SUBRUN_END, SUBRUN_TYPE) VALUES "
    "(lmf_run_iov_" + sp + "_sq.NextVal, :1, :2, :3, :4, :5, :6, :7, :8)";
  stmt->setSQL(sql);
  DateHandler dm(m_env, m_conn);
  stmt->setInt(1, tag_id);
  stmt->setInt(2, seq_id);
  stmt->setInt(3, getInt("lmr"));
  stmt->setInt(4, color_id);
  stmt->setInt(5, tt);
  stmt->setDate(6, dm.tmToDate(getSubRunStart()));
  stmt->setDate(7, dm.tmToDate(getSubRunEnd()));
  stmt->setString(8, getSubRunType());
  return sql;
}

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from LMFUnique.

Definition at line 21 of file LMFRunIOV.h.


Member Data Documentation