Changeset 13937 for trunk/FACT++/src


Ignore:
Timestamp:
05/27/12 11:59:19 (12 years ago)
Author:
tbretz
Message:
Some improvements to the event selection for the fDimEventData service; fixed a bug which might have caused invalid memory access when seraching for a valid header; replaced the QoS in the event data with the trigger type rather than the calbration step
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/EventBuilderWrapper.h

    r13924 r13937  
    916916    }
    917917
    918     void SendRawData(PEVNT_HEADER */*fadhd*/, EVENT *event)
     918    void SendRawData(PEVNT_HEADER *fadhd, EVENT *event)
    919919    {
    920920        // Currently we send any event no matter what its trigger id is...
     
    923923        Time newt;
    924924
     925        static int skip = 0;
     926
    925927        // 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;
    929930        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, Pos
    943         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;
    953931
    954932        // Workaround to find a valid header.....
     
    957935
    958936        // FIMXE: Compare with target configuration
    959 
    960937        const FAD::EventHeader *ptr=beg;
    961938        for (; ptr!=end; ptr++)
     
    963940            if (ptr->fStartDelimiter==0)
    964941                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;
    965990
    966991            if (!ptr->HasTriggerLPext() && !ptr->HasTriggerLPint())
     
    968993        }
    969994
    970         if (ptr->fStartDelimiter==0)
     995        if (ptr==end || ptr->fStartDelimiter==0)
    971996            return;
    972997
Note: See TracChangeset for help on using the changeset viewer.