コード例 #1
0
ファイル: ConditionsInterna.cpp プロジェクト: vvolkl/DD4hep
/// Retrieve a condition given a Detector Element and the conditions name
Condition
ConditionsManagerObject::get(Condition::key_type key, const Condition::iov_type& iov)
{
  RC conditions;
  __check_values__<Discrete>(this, key, &iov);
  bool rc = select(key, iov, conditions);
  if ( !rc )  {
    dd4hep_lock_t locked_load(m_updateLock);
    m_loader->load(key, iov, conditions);
  }
  if ( conditions.size() == 1 )   {
    conditions[0]->flags |= Condition::ACTIVE;
    return conditions[0];
  }
  else if ( conditions.empty() )   {
    except("ConditionsManager","+++ Condition %08X for the requested IOV %s do not exist.",
           key, iov.str().c_str());
  }
  else if ( conditions.size() > 1 )  {
    RC::const_iterator start = conditions.begin();
    Condition first = *start;
    printout(ERROR,"ConditionsManager","+++ Condition %s [%08X] is ambiguous for IOV %s:",
             first.name().c_str(), key, iov.str().c_str());
    for(RC::const_iterator i=start; i!=conditions.end(); ++i)  {
      Condition c = *i;
      printout(ERROR,"ConditionsManager","+++ %s [%s] = %s",
               c.name().c_str(), c->iov->str().c_str(), c->value.c_str());
    }
    except("ConditionsManager","+++ Condition %s [%08X] is ambiguous for IOV %s:",
           first.name().c_str(), key, iov.str().c_str());
  }
  return Condition();
}