FACT++  1.0
int StateMachineRateControl::EvalOptions ( Configuration conf)
inline

Definition at line 860 of file ratecontrol.cc.

References Error(), StateMachineRateControl::config::fAverageTime, StateMachineRateControl::config::fCalibrationType, StateMachineRateControl::config::fMinThreshold, StateMachineRateControl::config::fRequiredEvents, StateMachineRateControl::config::fTargetRate, Configuration::Get(), PixelMap::Read(), and Configuration::Vec().

861  {
862  fVerbose = !conf.Get<bool>("quiet");
863 
864  if (!fMap.Read(conf.Get<string>("pixel-map-file")))
865  {
866  Error("Reading mapping table from "+conf.Get<string>("pixel-map-file")+" failed.");
867  return 1;
868  }
869 
870  fThresholdReference = 300;
871  fThresholdMin = 300;
872  fTargetRate = 75;
873 
874  fAverageTime = 10;
875  fRequiredEvents = 8;
876 
877  // ---------- Setup run types ---------
878  const vector<string> types = conf.Vec<string>("run-type");
879  if (types.empty())
880  Warn("No run-types defined.");
881  else
882  Message("Defining run-types");
883 
884  for (auto it=types.begin(); it!=types.end(); it++)
885  {
886  Message(" -> "+ *it);
887 
888  if (fRunTypes.count(*it)>0)
889  {
890  Error("Run-type "+*it+" defined twice.");
891  return 1;
892  }
893 
894  config &c = fRunTypes[*it];
895  if (!GetConfig(conf, "calibration-type.", *it, c.fCalibrationType) ||
896  !GetConfig(conf, "target-rate.", *it, c.fTargetRate) ||
897  !GetConfig(conf, "min-threshold.", *it, c.fMinThreshold) ||
898  !GetConfig(conf, "average-time.", *it, c.fAverageTime) ||
899  !GetConfig(conf, "required-events.", *it, c.fRequiredEvents))
900  return 2;
901  }
902 
903  return -1;
904  }
T Get(const std::string &var)
std::vector< T > Vec(const std::string &var)
map< string, config > fRunTypes
Definition: ratecontrol.cc:47
int Error(const std::string &str)
Definition: MessageImp.h:49
int Warn(const std::string &str)
Definition: MessageImp.h:48
int Message(const std::string &str)
Definition: MessageImp.h:46
bool GetConfig(Configuration &conf, const string &name, const string &sub, uint16_t &rc)
Definition: ratecontrol.cc:848
bool Read(const std::string &fname)
Definition: PixelMap.h:56

+ Here is the call graph for this function: