FACT++  1.0
template<class T , class S >
int StateMachineBias< T, S >::EvalOptions ( Configuration conf)
inline

Definition at line 2173 of file biasctrl.cc.

References Error(), Configuration::Get(), Configuration::Has(), BiasMap::Read(), time, BiasMap::Vgapd(), BiasMap::Voffset(), and BiasMap::Vslope().

2174  {
2175  // FIXME: Read calib_offset
2176  // FIXME: Check calib offset being smaller than +/-0.25V
2177 
2178  fBias.SetVerbose(!conf.Get<bool>("quiet"));
2179  fBias.SetDummyMode(conf.Get<bool>("dummy-mode"));
2180 
2181  if (conf.Has("dev"))
2182  {
2183  fBias.SetEndpoint(conf.Get<string>("dev"));
2184  T::Message("Setting device to "+fBias.URL());
2185  }
2186 
2187  const uint16_t step = conf.Get<uint16_t>("ramp-step");
2188  const uint16_t time = conf.Get<uint16_t>("ramp-delay");
2189 
2190  if (step>230) // 5V
2191  {
2192  T::Error("ramp-step exceeds allowed range.");
2193  return 1;
2194  }
2195 
2196  fBias.SetRampStep(step);
2197  fBias.SetRampTime(time);
2198  fBias.SetUpdateInterval(conf.Get<uint32_t>("update-interval"));
2199  fBias.SetEmergencyLimit(conf.Get<uint16_t>("emergency-limit"));
2200  fBias.SetSyncDelay(conf.Get<uint16_t>("sync-delay"));
2201 
2202  ostringstream str1, str2;
2203  str1 << "Ramping in effective steps of " << fBias.GetRampStepVolt() << "V";
2204  str2 << "Ramping with a delay per step of " << time << "ms";
2205  T::Message(str1);
2206  T::Message(str2);
2207 
2208  // --------------------------------------------------------------------------
2209 
2210  const float maxabsv = conf.Get<float>("volt-max-abs");
2211  const float maxrelv = conf.Get<float>("volt-max-rel");
2212  if (maxabsv>90)
2213  {
2214  T::Error("volt-max exceeds 90V.");
2215  return 2;
2216  }
2217  if (maxabsv>75)
2218  T::Warn("volt-max exceeds 75V.");
2219  if (maxabsv<70)
2220  T::Warn("volt-max below 70V.");
2221  if (maxabsv<0)
2222  {
2223  T::Error("volt-max negative.");
2224  return 3;
2225  }
2226 
2227  fBias.SetVoltMaxAbs(maxabsv);
2228  fBias.SetVoltMaxRel(maxrelv);
2229 
2230  ostringstream str3, str4;
2231  str3 << "Effective maximum allowed absolute voltage: " << fBias.GetVoltMaxAbs() << "V";
2232  str4 << "Effective maximum difference w.r.t to G-APD reference: " << fBias.GetVoltMaxRel() << "V";
2233  T::Message(str3);
2234  T::Message(str4);
2235 
2236  // --------------------------------------------------------------------------
2237 
2238  BiasMap map;
2239 
2240  if (!conf.Has("bias-map-file") && !conf.Has("bias-database"))
2241  {
2242  T::Error("Neither bias-map-file not bias-database specified.");
2243  return 5;
2244  }
2245 
2246  try
2247  {
2248  if (conf.Has("bias-map-file"))
2249  map.Read(conf.Get<string>("bias-map-file"));
2250 
2251  //if (conf.Has("bias-database"))
2252  // map.Retrieve(conf.Get<string>("bias-database"));
2253  }
2254  catch (const runtime_error &e)
2255  {
2256  T::Error("Getting reference voltages failed: "+string(e.what()));
2257  return 7;
2258  }
2259 
2260  if (!fBias.SetReferences(map.Vgapd(), map.Voffset(), map.Vslope()))
2261  {
2262  T::Error("Setting reference voltages failed.");
2263  return 8;
2264  }
2265 
2266  // --------------------------------------------------------------------------
2267 
2268  if (conf.Has("dev"))
2269  fBias.Connect();
2270 
2271  return -1;
2272  }
std::vector< float > Vslope() const
Definition: PixelMap.h:354
T Get(const std::string &var)
bool Has(const std::string &var)
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
Definition: smartfact.txt:92
std::vector< float > Voffset() const
Definition: PixelMap.h:341
std::vector< float > Vgapd() const
Definition: PixelMap.h:329
bool Read(const std::string &fname)
Definition: PixelMap.h:226
Error()
Definition: HeadersFTM.h:197

+ Here is the call graph for this function: