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

Definition at line 1542 of file smartfact.cc.

References StateMachineSmartFACT::Statistics::avg, FTM::DimTriggerRates::fBoardRate, FTM::DimTriggerRates::fElapsedTime, FTM::DimTriggerRates::fPatchRate, FTM::DimTriggerRates::fTriggerRate, EventImp::GetJavaDate(), EventImp::GetQoS(), FTM::kFtmRunning, FTM::kFtmStates, HTML::kWhite, StateMachineSmartFACT::Statistics::max, StateMachineSmartFACT::Statistics::med, StateMachineSmartFACT::Statistics::min, and EventImp::Ref().

Referenced by StateMachineSmartFACT().

1543  {
1544  if (!CheckDataSize(d, "FtmControl:TriggerRates", 24+160+640+8))
1545  {
1547  return GetCurrentState();
1548  }
1549 
1550  const FTM::DimTriggerRates &dim = d.Ref<FTM::DimTriggerRates>();
1551 
1552  // If the trigger rate is too low...
1553  // ... and the run was not just started (can lead to very small elapsed times)
1554  // ... and the trigger is switched on
1555  // ... and there was no state change (then the trigger was started or stopped)
1557  dim.fTriggerRate<1 && dim.fElapsedTime>0.45 &&
1560 
1561  fFtmControlState = d.GetQoS();
1562 
1563  const float *brates = dim.fBoardRate; // Board rate
1564  const float *prates = dim.fPatchRate; // Patch rate
1565 
1566  // Store a history of the last 60 entries
1568  if (fFtmControlTriggerRateHist.size()>300)
1569  fFtmControlTriggerRateHist.pop_front();
1570 
1571  // FIXME: Add statistics for all kind of rates
1572 
1573  WriteHist(d, "hist-ftmcontrol-triggerrate",
1575  WriteCam(d, "cam-ftmcontrol-boardrates",
1576  vector<float>(brates, brates+40), 10);
1577  WriteCam(d, "cam-ftmcontrol-patchrates",
1578  vector<float>(prates, prates+160), 10);
1579 
1580  ostringstream out;
1581  out << setprecision(3);
1582  out << d.GetJavaDate() << '\n';
1583  out << HTML::kWhite << '\t' << dim.fTriggerRate << '\n';
1584 
1585  ofstream(fPath+"/trigger.data") << out.str();
1586 
1587  const Statistics bstat(vector<float>(brates, brates+ 40));
1588  const Statistics pstat(vector<float>(prates, prates+160));
1589 
1590  out.str("");
1591  out << d.GetJavaDate() << '\n';
1592  out << HTML::kWhite << '\t' << bstat.min << '\n';
1593  out << HTML::kWhite << '\t' << bstat.med << '\n';
1594  out << HTML::kWhite << '\t' << bstat.avg << '\n';
1595  out << HTML::kWhite << '\t' << bstat.max << '\n';
1596  ofstream(fPath+"/boardrates.data") << out.str();
1597 
1598  out.str("");
1599  out << d.GetJavaDate() << '\n';
1600  out << HTML::kWhite << '\t' << pstat.min << '\n';
1601  out << HTML::kWhite << '\t' << pstat.med << '\n';
1602  out << HTML::kWhite << '\t' << pstat.avg << '\n';
1603  out << HTML::kWhite << '\t' << pstat.max << '\n';
1604  ofstream(fPath+"/patchrates.data") << out.str();
1605 
1606  return GetCurrentState();
1607  }
int32_t fFtmControlTriggerRateTooLow
Definition: smartfact.cc:575
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
void WriteHist(const EventImp &d, const string &fname, const T &t, double scale, double offset=0)
Definition: smartfact.cc:752
float fBoardRate[40]
Definition: HeadersFTM.h:589
deque< float > fFtmControlTriggerRateHist
Definition: smartfact.cc:574
static const string kWhite
Definition: smartfact.cc:74
virtual int GetQoS() const
Definition: EventImp.h:58
uint64_t GetJavaDate() const
Definition: EventImp.cc:303
const T & Ref(size_t offset=0) const
Definition: EventImp.h:82
void WriteCam(const EventImp &d, const string &fname, const T &t, double scale, double offset=0)
Definition: smartfact.cc:758
Trigger output enabled, configuration ignored.
Definition: HeadersFTM.h:23
float fPatchRate[160]
Definition: HeadersFTM.h:590

+ Here is the call graph for this function:

+ Here is the caller graph for this function: