Changeset 11207 for trunk/FACT++/src/EventBuilderWrapper.h
- Timestamp:
- 06/29/11 15:13:47 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilderWrapper.h
r11203 r11207 702 702 enum 703 703 { 704 kCurrent = 0, 705 kTotal = 1 704 kCurrent = 0, 705 kTotal = 1, 706 kEventId = 2, 707 kTriggerId = 3, 706 708 }; 707 709 … … 718 720 719 721 uint32_t fMaxRun; 720 uint32_t fNumEvts[2]; 722 uint32_t fLastOpened; 723 uint32_t fLastClosed; 724 uint32_t fNumEvts[4]; 721 725 722 726 DimDescribedService fDimRuns; … … 727 731 DimDescribedService fDimStatus; 728 732 DimDescribedService fDimDNA; 733 DimDescribedService fDimTemperature; 729 734 DimDescribedService fDimStatistics; 730 735 … … 739 744 public: 740 745 EventBuilderWrapper(MessageImp &imp) : fMsg(imp), 741 fFileFormat(kRaw), fMaxRun(0), 742 fDimRuns ("FAD_CONTROL/RUNS", "I: 3", ""),743 fDimEvents ("FAD_CONTROL/EVENTS", "I: 2", ""),746 fFileFormat(kRaw), fMaxRun(0), fLastOpened(0), fLastClosed(0), 747 fDimRuns ("FAD_CONTROL/RUNS", "I:5", ""), 748 fDimEvents ("FAD_CONTROL/EVENTS", "I:4", ""), 744 749 fDimEventData ("FAD_CONTROL/EVENT_DATA", "S:1;I:1;S:1;I:2;S:1;S", ""), 745 750 fDimFwVersion ("FAD_CONTROL/FIRMWARE_VERSION", "F:42", ""), … … 747 752 fDimStatus ("FAD_CONTROL/STATUS", "S:42", ""), 748 753 fDimDNA ("FAD_CONTROL/DNA", "X:40", ""), 754 fDimTemperature ("FAD_CONTROL/TEMPERATURE", "F:82", ""), 749 755 fDimStatistics ("FAD_CONTROL/STATISTICS", "X:8", ""), 750 756 fDebugStream(false), fDebugRead(false) … … 942 948 void UpdateRuns() 943 949 { 944 uint32_t values[ 3] =950 uint32_t values[5] = 945 951 { 946 952 static_cast<uint32_t>(fFiles.size()), 947 953 0xffffffff, 948 0 954 0, 955 fLastOpened, 956 fLastClosed 949 957 }; 950 958 … … 960 968 values[2] = file->GetRunId(); 961 969 } 970 971 fMaxRun = values[2]; 962 972 963 973 fDimRuns.Update(values); … … 990 1000 fFiles.push_back(file); 991 1001 1002 fLastOpened = runid; 992 1003 UpdateRuns(); 1004 1005 fNumEvts[kEventId] = 0; 1006 fNumEvts[kTriggerId] = 0; 993 1007 994 1008 fNumEvts[kCurrent] = 0; … … 1008 1022 if (file->GetRunId()==fMaxRun) 1009 1023 { 1010 //fDimCurrentEvent.Update(e->EventNum);1011 1024 fNumEvts[kCurrent]++; 1025 fNumEvts[kEventId] = e->EventNum; 1026 fNumEvts[kTriggerId] = e->TriggerType; 1012 1027 } 1013 1028 1014 1029 fNumEvts[kTotal]++; 1015 1030 1016 static Time oldt ;1031 static Time oldt(boost::date_time::neg_infin); 1017 1032 Time newt; 1018 1033 if (newt>oldt+boost::posix_time::seconds(1)) … … 1021 1036 oldt = newt; 1022 1037 } 1038 1023 1039 1024 1040 // ===> SignalEvtWritten(runid); … … 1051 1067 fFiles.erase(it); 1052 1068 1069 fLastClosed = file->GetRunId(); 1053 1070 UpdateRuns(); 1071 1072 fDimEvents.Update(fNumEvts); 1054 1073 1055 1074 const bool rc = file->Close(tail); … … 1253 1272 str << "): " << message; 1254 1273 1274 static string last; 1275 if (str.str()==last) 1276 return; 1277 1278 last = str.str(); 1255 1279 fMsg.Update(str, severity); 1256 1280 } … … 1451 1475 Update(fDimStatus, sts); 1452 1476 } 1477 1478 static Time oldt(boost::date_time::neg_infin); 1479 Time newt; 1480 1481 if (newt>oldt+boost::posix_time::seconds(1)) 1482 { 1483 const boost::array<int16_t,42> tmp[4] = 1484 { 1485 Compare(&h, &h.fTempDrs[0]), 1486 Compare(&h, &h.fTempDrs[1]), 1487 Compare(&h, &h.fTempDrs[2]), 1488 Compare(&h, &h.fTempDrs[3]) 1489 }; 1490 1491 vector<int16_t> data; 1492 data.reserve(82); 1493 data.push_back(tmp[0][0]); 1494 data.insert(data.end(), tmp[0].data()+2, tmp[0].data()+42); 1495 data.push_back(tmp[0][1]); 1496 data.insert(data.end(), tmp[0].data()+2, tmp[0].data()+42); 1497 1498 for (int j=0; j<=3; j++) 1499 { 1500 const boost::array<int16_t,42> &ref = tmp[j]; 1501 1502 // Gloabl min 1503 if (ref[40]<data[0]) 1504 data[0] = ref[40]; 1505 1506 // Global max 1507 if (ref[41]>data[40]) 1508 data[40] = ref[41]; 1509 1510 for (int i=0; i<40; i++) 1511 { 1512 // min per board 1513 if (ref[i]<data[i+1]) 1514 data[i+1] = ref[i]; 1515 1516 // max per board 1517 if (ref[i]>data[i+41]) 1518 data[i+41] = ref[i]; 1519 } 1520 } 1521 1522 vector<float> deg(82); 1523 for (int i=0; i<82; i++) 1524 deg[i] = data[i]/16.; 1525 fDimTemperature.Update(deg); 1526 } 1527 1528 1453 1529 1454 1530 /*
Note:
See TracChangeset
for help on using the changeset viewer.