FACT++  1.0
int StateMachineSmartFACT::HandleRateScanData ( const EventImp d)
inlineprivate

Definition at line 2075 of file smartfact.cc.

References clear(), EventImp::Get(), EventImp::GetJavaDate(), i, id, HTML::kWhite, and EventImp::Ptr().

Referenced by StateMachineSmartFACT().

2076  {
2077  if (!CheckDataSize(d, "RateScan:Data", 824))
2078  return GetCurrentState();
2079 
2080  const uint64_t id = d.Get<uint64_t>();
2081  const float *rate = d.Ptr<float>(20);
2082 
2083  if (fRateScanDataId!=id)
2084  {
2085  for (int i=0; i<41; i++)
2087  fRateScanDataId = id;
2088  }
2089  fRateScanDataHist[0].push_back(log10(rate[0]));
2090 
2091  double max = 0;
2092  for (int i=1; i<41; i++)
2093  {
2094  fRateScanDataHist[i].push_back(log10(rate[i]));
2095  if (rate[i]>max)
2096  max = rate[i];
2097  }
2098 
2099  // Cycle by time!
2100  fRateScanBoard ++;
2101  fRateScanBoard %= 40;
2102 
2103  WriteHist(d, "hist-ratescan", fRateScanDataHist[0], 10, -2);
2104  WriteCam(d, "cam-ratescan-board", fRateScanDataHist[fRateScanBoard+1], 10, -4);
2105 
2106  ostringstream out;
2107  out << setprecision(3);
2108  out << d.GetJavaDate() << '\n';
2109  out << HTML::kWhite << '\t' << fFtmBoardThresholdMed << '\n';
2110  out << HTML::kWhite << '\t' << fFtmPatchThresholdMed << '\n';
2111  out << HTML::kWhite << '\t' << floor(pow(10, fRateScanDataHist[0].back())+.5) << '\n';
2112  out << HTML::kWhite << '\t' << floor(max+.5) << '\n';
2113 
2114  ofstream(fPath+"/ratescan.data") << out.str();
2115 
2116  out.str("");
2117  out << d.GetJavaDate() << '\n';
2118  out << HTML::kWhite << '\t' << int(fRateScanBoard) << '\n';
2119  out << HTML::kWhite << '\t' << pow(10, fRateScanDataHist[fRateScanBoard+1].back()) << '\n';
2120 
2121  ofstream(fPath+"/ratescan_board.data") << out.str();
2122 
2123  return GetCurrentState();
2124  }
int GetCurrentState() const
return the current state of the machine
bool CheckDataSize(const EventImp &d, const char *name, size_t size, bool min=false)
Definition: smartfact.cc:669
int i
Definition: db_dim_client.c:21
void WriteHist(const EventImp &d, const string &fname, const T &t, double scale, double offset=0)
Definition: smartfact.cc:752
char id[4]
Definition: FITS.h:71
uint64_t fRateScanDataId
Definition: smartfact.cc:585
static const string kWhite
Definition: smartfact.cc:74
uint64_t GetJavaDate() const
Definition: EventImp.cc:303
deque< float > fRateScanDataHist[41]
Definition: smartfact.cc:587
void clear()
Definition: HeadersFTM.h:216
T Get(size_t offset=0) const
Definition: EventImp.h:66
void WriteCam(const EventImp &d, const string &fname, const T &t, double scale, double offset=0)
Definition: smartfact.cc:758
const T * Ptr(size_t offset=0) const
Definition: EventImp.h:74

+ Here is the call graph for this function:

+ Here is the caller graph for this function: