- Timestamp:
- 09/05/11 16:28:50 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilderWrapper.h
r11893 r11968 97 97 DimDescribedService fDimRawData; 98 98 DimDescribedService fDimEventData; 99 DimDescribedService fDimFeedbackData; 99 100 DimDescribedService fDimFwVersion; 100 101 DimDescribedService fDimRunNumber; … … 177 178 fDimRawData ("FAD_CONTROL/RAW_DATA", "S:1;I:1;S:1;I:1;I:2;I:40;S:1440;S:160;F", ""), 178 179 fDimEventData ("FAD_CONTROL/EVENT_DATA", "F:1440;F:1440;F:1440;F:1440", ""), 180 fDimFeedbackData("FAD_CONTROL/FEEDBACK_DATA", "F:1440", ""), 179 181 fDimFwVersion ("FAD_CONTROL/FIRMWARE_VERSION", "F:42", ""), 180 182 fDimRunNumber ("FAD_CONTROL/RUN_NUMBER", "I:42", ""), … … 821 823 // need gotNewRun/closedRun to know it is finished 822 824 825 return 0; 826 } 827 828 void SendRawData(PEVNT_HEADER *fadhd, EVENT *event) 829 { 830 // Currently we send any event no matter what its trigger id is... 831 // To be changed. 832 static Time oldt(boost::date_time::neg_infin); 833 Time newt; 834 835 // FIXME: Only send events if the have newer run-numbers 836 if (newt<oldt+boost::posix_time::seconds(1)) 837 return; 838 839 oldt = newt; 840 841 const size_t sz = sizeof(EVENT)+event->Roi*2*1440; 842 843 vector<char> data(sz+event->Roi*2*1440); 844 memcpy(data.data(), event, sizeof(EVENT)); 845 846 float *vec = reinterpret_cast<float*>(data.data()+sizeof(EVENT)); 847 848 DataCalib::Apply(vec, event->Adc_Data, event->StartPix, event->Roi); 849 fDimRawData.Update(data); 850 851 vector<float> data2(1440*4); // Mean, RMS, Max, Pos 852 CalibData::GetPixelStats(data2.data(), vec, event->Roi); 853 854 fDimEventData.Update(data2); 855 } 856 857 void SendFeedbackData(PEVNT_HEADER *fadhd, EVENT *event) 858 { 859 if (!DataCalib::IsValid()) 860 return; 861 862 // Workaround to find a valid header..... 863 const FAD::EventHeader *beg = reinterpret_cast<FAD::EventHeader*>(fadhd); 864 const FAD::EventHeader *end = reinterpret_cast<FAD::EventHeader*>(fadhd)+40; 865 866 // FIMXE: Compare with target configuration 867 868 for (const FAD::EventHeader *ptr=beg; ptr!=end; ptr++, beg++) 869 if (ptr->fStartDelimiter!=0) 870 break; 871 872 // FIXME: Time limit?! 873 /* 823 874 static Time oldt(boost::date_time::neg_infin); 824 875 Time newt; … … 829 880 830 881 oldt = newt; 882 */ 883 884 // FIXME: Check event type here 885 return; 831 886 832 887 const size_t sz = sizeof(EVENT)+event->Roi*2*1440; … … 838 893 839 894 DataCalib::Apply(vec, event->Adc_Data, event->StartPix, event->Roi); 840 fDimRawData.Update(data); 841 842 vector<float> data2(1440*4); // Mean, RMS, Max, Pos 843 CalibData::GetPixelStats(data2.data(), vec, event->Roi); 844 845 fDimEventData.Update(data2); 846 847 848 849 850 return 0; 851 } 895 896 vector<float> data2(1440); // Mean, RMS, Max, Pos 897 CalibData::GetPixelMax(data2.data(), vec, event->Roi, 0, event->Roi); 898 899 fDimFeedbackData.Update(data2); 900 } 901 902 int subProcEvt(int threadID, PEVNT_HEADER *fadhd, EVENT *event, int8_t */*buffer*/) 903 { 904 switch (threadID) 905 { 906 case 0: 907 SendRawData(fadhd, event); 908 return 1; 909 case 1: 910 SendFeedbackData(fadhd, event); 911 return 2; 912 } 913 return 100; 914 } 915 852 916 853 917 bool IsRunStarted() const … … 1264 1328 int subProcEvt(int threadID, PEVNT_HEADER *fadhd, EVENT *event, int8_t *buffer) 1265 1329 { 1266 return 100;1330 return EventBuilderWrapper::This->subProcEvt(threadID, fadhd, event, buffer); 1267 1331 } 1268 1332
Note:
See TracChangeset
for help on using the changeset viewer.