Changeset 11607 for trunk/FACT++/src
- Timestamp:
- 07/26/11 12:42:13 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilderWrapper.h
r11605 r11607 801 801 DimDescribedService fDimPrescaler; 802 802 DimDescribedService fDimRefClock; 803 DimDescribedService fDimRoi; 803 804 DimDescribedService fDimStatistics1; 804 805 DimDescribedService fDimStatistics2; … … 841 842 fFileFormat(kNone), fMaxRun(0), fLastOpened(0), fLastClosed(0), 842 843 fDimWriteStats ("FAD_CONTROL", imp), 843 fDimRuns ("FAD_CONTROL/RUNS", "I:5;C", ""), 844 fDimEvents ("FAD_CONTROL/EVENTS", "I:4", ""), 845 fDimEventData ("FAD_CONTROL/EVENT_DATA", "S:1;I:1;S:1;I:1;I:2;I:40;S:1440;S:160;S", ""), 846 fDimFwVersion ("FAD_CONTROL/FIRMWARE_VERSION", "F:42", ""), 847 fDimRunNumber ("FAD_CONTROL/RUN_NUMBER", "I:42", ""), 848 fDimStatus ("FAD_CONTROL/STATUS", "S:42", ""), 849 fDimDNA ("FAD_CONTROL/DNA", "X:40", ""), 850 fDimTemperature ("FAD_CONTROL/TEMPERATURE", "F:82", ""), 851 fDimPrescaler ("FAD_CONTROL/PRESCALER", "S:42", ""), 852 fDimRefClock ("FAD_CONTROL/REFERENCE_CLOCK", "I:42", ""), 853 fDimStatistics1 ("FAD_CONTROL/STATISTICS1", "I:3;I:5;X:4;I:3;I:3;I:40;I:1;I:2;C:40;I:40;I:40;X:40", ""), 854 fDimStatistics2 ("FAD_CONTROL/STATISTICS2", "I:1;I:280;X:40;I:40;I:4;I:4;I:2;I:2;I:3;C:40", ""), 844 fDimRuns ("FAD_CONTROL/RUNS", "I:5;C", ""), 845 fDimEvents ("FAD_CONTROL/EVENTS", "I:4", ""), 846 fDimEventData ("FAD_CONTROL/EVENT_DATA", "S:1;I:1;S:1;I:1;I:2;I:40;S:1440;S:160;S", ""), 847 fDimFwVersion ("FAD_CONTROL/FIRMWARE_VERSION", "F:42", ""), 848 fDimRunNumber ("FAD_CONTROL/RUN_NUMBER", "I:42", ""), 849 fDimStatus ("FAD_CONTROL/STATUS", "S:42", ""), 850 fDimDNA ("FAD_CONTROL/DNA", "X:40", ""), 851 fDimTemperature ("FAD_CONTROL/TEMPERATURE", "F:82", ""), 852 fDimPrescaler ("FAD_CONTROL/PRESCALER", "S:42", ""), 853 fDimRefClock ("FAD_CONTROL/REFERENCE_CLOCK", "I:42", ""), 854 fDimRoi ("FAD_CONTROL/REGION_OF_INTEREST", "S:2", ""), 855 fDimStatistics1 ("FAD_CONTROL/STATISTICS1", "I:3;I:5;X:4;I:3;I:3;I:40;I:1;I:2;C:40;I:40;I:40;X:40", ""), 856 fDimStatistics2 ("FAD_CONTROL/STATISTICS2", "I:1;I:280;X:40;I:40;I:4;I:4;I:2;I:2;I:3;C:40", ""), 855 857 fDebugStream(false), fDebugRead(false), fDebugLog(false) 856 858 { … … 1355 1357 } 1356 1358 1359 array<uint16_t,2> fVecRoi; 1360 1357 1361 int eventCheck(PEVNT_HEADER *fadhd, EVENT *event) 1358 1362 { … … 1368 1372 geloescht (nicht an die write-routine weitergeleitet [mind. im Prinzip] 1369 1373 */ 1374 1375 const array<uint16_t,2> roi = {{ event->Roi, event->RoiTM }}; 1376 1377 if (roi!=fVecRoi) 1378 Update(fDimRoi, roi); 1370 1379 1371 1380 const FAD::EventHeader *beg = reinterpret_cast<FAD::EventHeader*>(fadhd); … … 1385 1394 // * fTriggerGeneratorPrescaler 1386 1395 // * fDac 1387 // inconsistent 1396 // inconsistent 1397 1398 // FIXME: Produce some output, only once per run or 1399 // minute 1400 1401 /* 1388 1402 if (*ptr != *beg) 1389 1403 return -1; … … 1394 1408 return -1; 1395 1409 if (ptr->fVersion != beg->fVersion) 1396 return -1; 1410 return -1; 1411 */ 1397 1412 } 1398 1413 … … 1564 1579 array<FAD::EventHeader, 40> fVecHeader; 1565 1580 1566 template<typename T >1567 array<T, 42> Compare(const FAD::EventHeader *h, const T *t)1568 { 1569 const int offset = reinterpret_cast<const char *>(t) - reinterpret_cast<const char *>( h);1581 template<typename T, class S> 1582 array<T, 42> Compare(const S *vec, const T *t) 1583 { 1584 const int offset = reinterpret_cast<const char *>(t) - reinterpret_cast<const char *>(vec); 1570 1585 1571 1586 const T *min = NULL; … … 1573 1588 const T *max = NULL; 1574 1589 1575 array<T, 42> vec;1590 array<T, 42> arr; 1576 1591 1577 1592 bool rc = true; 1578 1593 for (int i=0; i<40; i++) 1579 1594 { 1580 const char *base = reinterpret_cast<const char*>( &fVecHeader[i]);1595 const char *base = reinterpret_cast<const char*>(vec+i); 1581 1596 const T *ref = reinterpret_cast<const T*>(base+offset); 1582 1597 1583 vec[i] = *ref;1598 arr[i] = *ref; 1584 1599 1585 1600 if (gi_NumConnect[i]!=7) 1586 1601 { 1587 vec[i] = 0;1602 arr[i] = 0; 1588 1603 continue; 1589 1604 } … … 1606 1621 } 1607 1622 1608 vec[40] = val ? *min : 1;1609 vec[41] = val ? *max : 0;1610 1611 return vec;1623 arr[40] = val ? *min : 1; 1624 arr[41] = val ? *max : 0; 1625 1626 return arr; 1612 1627 } 1613 1628 … … 1692 1707 if (old.fVersion != h.fVersion || changed) 1693 1708 { 1694 const array<uint16_t,42> ver = Compare(& h, &h.fVersion);1709 const array<uint16_t,42> ver = Compare(&fVecHeader[0], &fVecHeader[0].fVersion); 1695 1710 1696 1711 array<float,42> data; … … 1706 1721 if (old.fRunNumber != h.fRunNumber || changed) 1707 1722 { 1708 const array<uint32_t,42> run = Compare(& h, &h.fRunNumber);1723 const array<uint32_t,42> run = Compare(&fVecHeader[0], &fVecHeader[0].fRunNumber); 1709 1724 fDimRunNumber.Update(run); 1710 1725 } … … 1712 1727 if (old.fTriggerGeneratorPrescaler != h.fTriggerGeneratorPrescaler || changed) 1713 1728 { 1714 const array<uint16_t,42> pre = Compare(& h, &h.fTriggerGeneratorPrescaler);1729 const array<uint16_t,42> pre = Compare(&fVecHeader[0], &fVecHeader[0].fTriggerGeneratorPrescaler); 1715 1730 fDimPrescaler.Update(pre); 1716 1731 } … … 1718 1733 if (old.fDNA != h.fDNA || changed) 1719 1734 { 1720 const array<uint64_t,42> dna = Compare(& h, &h.fDNA);1735 const array<uint64_t,42> dna = Compare(&fVecHeader[0], &fVecHeader[0].fDNA); 1721 1736 Update(fDimDNA, dna, 40); 1722 1737 } … … 1724 1739 if (old.fStatus != h.fStatus || changed) 1725 1740 { 1726 const array<uint16_t,42> sts = CompareBits(& h, &h.fStatus);1741 const array<uint16_t,42> sts = CompareBits(&fVecHeader[0], &fVecHeader[0].fStatus); 1727 1742 Update(fDimStatus, sts); 1728 1743 } … … 1739 1754 // --- RefClock 1740 1755 1741 const array<uint32_t,42> clk = Compare(& h, &h.fFreqRefClock);1756 const array<uint32_t,42> clk = Compare(&fVecHeader[0], &fVecHeader[0].fFreqRefClock); 1742 1757 Update(fDimRefClock, clk); 1743 1758 … … 1746 1761 const array<int16_t,42> tmp[4] = 1747 1762 { 1748 Compare(& h, &h.fTempDrs[0]), // 0-39:val, 40:min, 41:max1749 Compare(& h, &h.fTempDrs[1]), // 0-39:val, 40:min, 41:max1750 Compare(& h, &h.fTempDrs[2]), // 0-39:val, 40:min, 41:max1751 Compare(& h, &h.fTempDrs[3]) // 0-39:val, 40:min, 41:max1763 Compare(&fVecHeader[0], &fVecHeader[0].fTempDrs[0]), // 0-39:val, 40:min, 41:max 1764 Compare(&fVecHeader[0], &fVecHeader[0].fTempDrs[1]), // 0-39:val, 40:min, 41:max 1765 Compare(&fVecHeader[0], &fVecHeader[0].fTempDrs[2]), // 0-39:val, 40:min, 41:max 1766 Compare(&fVecHeader[0], &fVecHeader[0].fTempDrs[3]) // 0-39:val, 40:min, 41:max 1752 1767 }; 1753 1768
Note:
See TracChangeset
for help on using the changeset viewer.