Пример #1
0
/**
 * Return the value of a parameter as a string
 * @param comp :: Component to which parameter is related
 * @param name :: Parameter name
 * @param recursive :: Whether to travel up the instrument tree if not found at
 * this level
 * @return string representation of the parameter
 */
std::string ParameterMap::getString(const IComponent *comp,
                                    const std::string &name,
                                    bool recursive) const {
  Parameter_sptr param = get(comp, name);
  if (recursive) {
    param = getRecursive(comp, name);
  } else {
    param = get(comp, name);
  }
  if (!param)
    return "";
  return param->asString();
}
/**
 * Returns the value associated to a parameter name in the IDF
 * @param parameterName :: parameter name in the IDF
 * @return the value associated to the parameter name
 */
std::string DetectorEfficiencyCorUser::getValFromInstrumentDef(
    const std::string &parameterName) {

  const ParameterMap &pmap = m_inputWS->constInstrumentParameters();
  Instrument_const_sptr instrument = m_inputWS->getInstrument();
  Parameter_sptr par =
      pmap.getRecursive(instrument->getChild(0).get(), parameterName);
  if (par) {
    std::string ret = par->asString();
    g_log.debug() << "Parsed parameter " << parameterName << ": " << ret
                  << "\n";
    return ret;
  } else {
    throw Kernel::Exception::InstrumentDefinitionError(
        "There is no <" + parameterName + "> in the instrument definition!");
  }
}
Пример #3
0
 /**  
  * Return the value of a parameter as a string
  * @param comp :: Component to which parameter is related
  * @param name :: Parameter name
  * @return string representation of the parameter
  */
 std::string ParameterMap::getString(const IComponent* comp, const std::string& name)
 {
   Parameter_sptr param = get(comp,name);
   if (!param) return "";
   return param->asString();
 }