Changeset 13937
- Timestamp:
- 05/27/12 11:59:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilderWrapper.h
r13924 r13937 916 916 } 917 917 918 void SendRawData(PEVNT_HEADER * /*fadhd*/, EVENT *event)918 void SendRawData(PEVNT_HEADER *fadhd, EVENT *event) 919 919 { 920 920 // Currently we send any event no matter what its trigger id is... … … 923 923 Time newt; 924 924 925 static int skip = 0; 926 925 927 // FIXME: Only send events if the have newer run-numbers 926 if (newt<oldt+boost::posix_time::seconds(1)) 927 return; 928 928 if (newt<oldt+boost::posix_time::milliseconds(skip>0 ? 200 : 1000)) 929 return; 929 930 oldt = newt; 930 931 vector<char> data(sizeof(EVENT)+event->Roi*sizeof(float)*(1440+160));932 memcpy(data.data(), event, sizeof(EVENT));933 934 float *vec = reinterpret_cast<float*>(data.data()+sizeof(EVENT));935 936 DataCalib::Apply(vec, event->Adc_Data, event->StartPix, event->Roi);937 fDimRawData.setQuality(DataCalib::GetStep());938 fDimRawData.Update(data);939 940 DrsCalibrate::RemoveSpikes(vec, event->Roi);941 942 vector<float> data2(1440*4); // Mean, RMS, Max, Pos943 DrsCalibrate::GetPixelStats(data2.data(), vec, event->Roi);944 945 fDimEventData.setQuality(DataCalib::GetStep());946 fDimEventData.Update(data2);947 }948 949 void SendFeedbackData(PEVNT_HEADER *fadhd, EVENT *event)950 {951 if (!DataCalib::IsValid())952 return;953 931 954 932 // Workaround to find a valid header..... … … 957 935 958 936 // FIMXE: Compare with target configuration 959 960 937 const FAD::EventHeader *ptr=beg; 961 938 for (; ptr!=end; ptr++) … … 963 940 if (ptr->fStartDelimiter==0) 964 941 continue; 942 } 943 if (ptr==end || ptr->fStartDelimiter==0) 944 return; 945 946 947 vector<char> data(sizeof(EVENT)+event->Roi*sizeof(float)*(1440+160)); 948 memcpy(data.data(), event, sizeof(EVENT)); 949 950 float *vec = reinterpret_cast<float*>(data.data()+sizeof(EVENT)); 951 952 DataCalib::Apply(vec, event->Adc_Data, event->StartPix, event->Roi); 953 DrsCalibrate::RemoveSpikes(vec, event->Roi); 954 955 vector<float> data2(1440*4); // Mean, RMS, Max, Pos 956 const double max = DrsCalibrate::GetPixelStats(data2.data(), vec, event->Roi); 957 958 // Maximum above roughly 5pe 959 if (ptr->IsTriggerPhys() && max<50 && skip<5) 960 { 961 skip++; 962 return; 963 } 964 965 skip = 0; 966 967 fDimRawData.setQuality(ptr->fTriggerType); 968 fDimRawData.Update(data); 969 970 fDimEventData.setQuality(ptr->fTriggerType); 971 fDimEventData.Update(data2); 972 } 973 974 void SendFeedbackData(PEVNT_HEADER *fadhd, EVENT *event) 975 { 976 if (!DataCalib::IsValid()) 977 return; 978 979 // Workaround to find a valid header..... 980 const FAD::EventHeader *beg = reinterpret_cast<FAD::EventHeader*>(fadhd); 981 const FAD::EventHeader *end = reinterpret_cast<FAD::EventHeader*>(fadhd)+40; 982 983 // FIMXE: Compare with target configuration 984 985 const FAD::EventHeader *ptr=beg; 986 for (; ptr<end; ptr++) 987 { 988 if (ptr->fStartDelimiter==0) 989 continue; 965 990 966 991 if (!ptr->HasTriggerLPext() && !ptr->HasTriggerLPint()) … … 968 993 } 969 994 970 if (ptr ->fStartDelimiter==0)995 if (ptr==end || ptr->fStartDelimiter==0) 971 996 return; 972 997
Note:
See TracChangeset
for help on using the changeset viewer.