FACT++  1.0
bool EventBuilderWrapper::procHeader ( const tuple< Time, bool, FAD::EventHeader > &  dat)
inline

Definition at line 1365 of file EventBuilderWrapper.h.

References data, fDac, fDNA, fStatus, fTriggerGeneratorPrescaler, fVersion, i, kNumDac, run, DimDescribedService::setData(), str, t, and DimDescribedService::Update().

1366  {
1367  const Time &t = get<0>(dat);
1368  const bool changed = get<1>(dat);
1369  const FAD::EventHeader &h = get<2>(dat);
1370 
1371  const FAD::EventHeader old = fVecHeader[h.Id()];
1372  fVecHeader[h.Id()] = h;
1373 
1374  if (old.fVersion != h.fVersion || changed)
1375  {
1376  const array<uint16_t,42> ver = Compare(&fVecHeader[0], &fVecHeader[0].fVersion);
1377 
1378  array<float,42> data;
1379  for (int i=0; i<42; i++)
1380  {
1381  ostringstream str;
1382  str << (ver[i]>>8) << '.' << (ver[i]&0xff);
1383  data[i] = stof(str.str());
1384  }
1385  Update(fDimFwVersion, data, t);
1386  }
1387 
1388  if (old.fRunNumber != h.fRunNumber || changed)
1389  {
1390  const array<uint32_t,42> run = Compare(&fVecHeader[0], &fVecHeader[0].fRunNumber);
1391  fDimRunNumber.setData(&run[0], 42*sizeof(uint32_t));
1392  fDimRunNumber.Update(t);
1393  }
1394 
1395  if (old.fTriggerGeneratorPrescaler != h.fTriggerGeneratorPrescaler || changed)
1396  {
1397  const array<uint16_t,42> pre = Compare(&fVecHeader[0], &fVecHeader[0].fTriggerGeneratorPrescaler);
1398  fDimPrescaler.setData(&pre[0], 42*sizeof(uint16_t));
1399  fDimPrescaler.Update(t);
1400  }
1401 
1402  if (old.fDNA != h.fDNA || changed)
1403  {
1404  const array<uint64_t,42> dna = Compare(&fVecHeader[0], &fVecHeader[0].fDNA);
1405  Update(fDimDNA, dna, t, 40);
1406  }
1407 
1408  if (old.fStatus != h.fStatus || changed)
1409  {
1410  const array<uint16_t,42> sts = CompareBits(&fVecHeader[0], &fVecHeader[0].fStatus);
1411  Update(fDimStatus, sts, t);
1412  }
1413 
1414  if (memcmp(old.fDac, h.fDac, sizeof(h.fDac)) || changed)
1415  {
1416  array<uint16_t, FAD::kNumDac*42> dacs;
1417 
1418  for (int i=0; i<FAD::kNumDac; i++)
1419  {
1420  const array<uint16_t, 42> dac = Compare(&fVecHeader[0], &fVecHeader[0].fDac[i]);
1421  memcpy(&dacs[i*42], &dac[0], sizeof(uint16_t)*42);
1422  }
1423 
1424  Update(fDimDac, dacs, t);
1425  }
1426 
1427  return true;
1428  }
DimDescribedService fDimDNA
array< FAD::EventHeader, 40 > fVecHeader
void Update(DimDescribedService &svc, const array< T, N > &data, const Time &t=Time(), int n=N)
DimDescribedService fDimStatus
uint16_t fStatus
Definition: HeadersFAD.h:173
array< T, 42 > Compare(const S *vec, const T *t)
int i
Definition: db_dim_client.c:21
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
char str[80]
Definition: test_client.c:7
DimDescribedService fDimDac
DimDescribedService fDimPrescaler
array< T, 42 > CompareBits(const FAD::EventHeader *h, const T *t)
DimDescribedService fDimRunNumber
void setData(const void *ptr, size_t sz)
uint64_t fDNA
Number of boards answered per crate.
Definition: HeadersFAD.h:187
uint16_t fTriggerGeneratorPrescaler
Definition: HeadersFAD.h:185
static int run
Definition: dim_fork.cxx:9
float data[4 *1440]
uint16_t fVersion
Definition: HeadersFAD.h:172
TT t
Definition: test_client.c:26
DimDescribedService fDimFwVersion
uint16_t fDac[kNumDac]
Definition: HeadersFAD.h:194

+ Here is the call graph for this function: