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

Definition at line 1734 of file smartfact.cc.

References EventImp::GetQoS(), i, kLPext, kPedestal, and EventImp::Ptr().

Referenced by StateMachineSmartFACT().

1735  {
1736  if (!CheckDataSize(d, "FadControl:EventData", 23040+8))
1737  return GetCurrentState();
1738 
1739  const float *dat = d.Ptr<float>(1440*sizeof(float)*2)+2;
1740 
1741  /*
1742  vector<float> max(320, 0);
1743  for (int i=0; i<1440; i++)
1744  {
1745  if (i%9==8)
1746  continue;
1747 
1748  const int idx = (fPixelMap.hw(i).hw()/9)*2+fPixelMap.hw(i).group();
1749  const double v = dat[i]/1000;
1750  //if (v>max[idx])
1751  // max[idx]=v;
1752 
1753  max[idx] += v/4;
1754  } */
1755 
1756  vector<float> val(1440);
1757  for (int i=0; i<1440; i++)
1758  val[i] = dat[i%9==8 ? i-2 : i]/1000;
1759 
1760  vector<float> sorted(val);
1761  nth_element(sorted.begin(), sorted.begin()+3, sorted.end(),
1762  std::greater<float>());
1763 
1764  const uint32_t trig = d.GetQoS() & FAD::EventHeader::kLPext;
1765 
1766  const float min = fFadControlDrsRuns[0]==0 ? -1 : 0;
1767 
1768  float scale = 2;
1769  if (trig&FAD::EventHeader::kLPext)
1770  scale = 1;
1771  if (trig&FAD::EventHeader::kPedestal)
1772  scale = 0.25;
1773  if (trig==0)
1774  scale = max(0.25f, sorted[3]);
1775 
1776  // assume it is drs-gain
1777  //if ((trig&FAD::EventHeader::kPedestal) && fFadControlDrsRuns[0]>0 && fFadControlDrsRuns[1]==0)
1778  // min = 0.75;
1779 
1780  WriteCam(d, "cam-fadcontrol-eventdata", val, scale, min);
1781 
1782  return GetCurrentState();
1783  }
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
virtual int GetQoS() const
Definition: EventImp.h:58
Pedestal trigger (artifical)
Definition: HeadersFTM.h:207
vector< uint32_t > fFadControlDrsRuns
Definition: smartfact.cc:572
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
Enable trigger decision after light pulse (CalibrationTrigger, LP1)
Definition: HeadersFTM.h:209

+ Here is the call graph for this function:

+ Here is the caller graph for this function: