Changeset 10768 for trunk


Ignore:
Timestamp:
05/23/11 08:55:14 (14 years ago)
Author:
tbretz
Message:
Keep FTM LED green even in data-taking mode; don't output FTM errors to the console; 'fixed' rate graph
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/gui/FactGui.h

    r10750 r10768  
    914914    // ===================== FTM ============================================
    915915
     916    double fTimeStamp1;
     917
    916918    void handleFtmTriggerCounter(const DimData &d)
    917919    {
     
    927929        const FTM::DimTriggerCounter &sdata = *reinterpret_cast<const FTM::DimTriggerCounter*>(d.ptr());
    928930
    929         fFtmTime->setText(QString::number(sdata.fTimeStamp));
     931        fFtmTime->setText(QString::number(sdata.fTimeStamp/1000000., 'f', 6)+ " s");
    930932        fTriggerCounter->setText(QString::number(sdata.fTriggerCounter));
     933
     934        if (sdata.fTimeStamp>0)
     935            fTriggerCounterRate->setValue(1000000.*sdata.fTriggerCounter/sdata.fTimeStamp);
     936        else
     937            fTriggerCounterRate->setValue(0);
    931938
    932939
     
    937944        {
    938945            fTriggerCounter0 = sdata.fTriggerCounter;
     946            fTimeStamp1      = sdata.fTimeStamp;
    939947            return;
    940948        }
     
    944952        TH1 *h = (TH1*)c->FindObject("TimeFrame");
    945953
    946         const double rate = sdata.fTriggerCounter-fTriggerCounter0;
    947         fTriggerCounter0 = sdata.fTriggerCounter;
    948 
    949         if (rate<0)
     954        const double rate  = sdata.fTriggerCounter-fTriggerCounter0;
     955        const double tdiff = sdata.fTimeStamp     -fTimeStamp1;
     956
     957        fTriggerCounter0   = sdata.fTriggerCounter;
     958        fTimeStamp1        = sdata.fTimeStamp;
     959
     960        if (rate<0 && tdiff<=0)
    950961        {
    951962            fGraphFtmRate.Set(0);
     
    962973        }
    963974
    964         const double avgrate = sdata.fTimeStamp>0 ? double(sdata.fTriggerCounter)/sdata.fTimeStamp : 1;
     975        if (rate<0)
     976            return;
     977
     978        const double avgrate = sdata.fTimeStamp>0 ? double(sdata.fTriggerCounter)/sdata.fTimeStamp*1000000 : 1;
    965979
    966980        const double t1 = h->GetXaxis()->GetXmax();
    967981        const double t0 = h->GetXaxis()->GetXmin();
    968982
    969         h->SetBins(h->GetNbinsX()+1, t0, t0+sdata.fTimeStamp+1);
     983        h->SetBins(h->GetNbinsX()+1, t0, t0+sdata.fTimeStamp/1000000.+1);
    970984        fGraphFtmRate.SetPoint(fGraphFtmRate.GetN(),
    971                                t0+sdata.fTimeStamp, rate);
     985                               t0+sdata.fTimeStamp/1000000., 1000000*rate/tdiff);
    972986
    973987        if (t1-t0>60)
     
    10231037        const FTM::DimDynamicData &sdata = *reinterpret_cast<const FTM::DimDynamicData*>(d.ptr());
    10241038
    1025         fFtmTime->setText(QString::number(sdata.fTimeStamp));
    1026         fOnTime->setText(QString::number(sdata.fOnTimeCounter));
     1039        fOnTime->setText(QString::number(sdata.fOnTimeCounter/1000000., 'f', 6)+" s");
     1040
     1041        if (sdata.fTimeStamp>0)
     1042            fOnTimeRel->setValue(100.*sdata.fOnTimeCounter/sdata.fTimeStamp);
     1043        else
     1044            fOnTimeRel->setValue(0);
    10271045
    10281046        fFtmTemp0->setValue(sdata.fTempSensor[0]*0.1);
     
    13501368        SetFtuStatusLed(d.time);
    13511369
    1352         // Write to special window!
    1353         Out() << "Error:" << endl;
    1354         Out() << sdata.fError << endl;
     1370        // FIXME: Write to special window!
     1371        //Out() << "Error:" << endl;
     1372        //Out() << sdata.fError << endl;
    13551373    }
    13561374
     
    13751393                SetLedColor(fStatusFTMLed, kLedYellow, time);
    13761394            if (s.index==FTM::kConnected || s.index==FTM::kIdle || s.index==FTM::kTakingData) // Dim connection / FTM connected
    1377             {
    13781395                SetLedColor(fStatusFTMLed, kLedGreen, time);
     1396
     1397            if (s.index==FTM::kConnected || s.index==FTM::kIdle) // Dim connection / FTM connected
    13791398                enable = true;
    1380             }
    13811399
    13821400            fTriggerWidget->setEnabled(enable);
     
    19571975#ifdef HAVE_ROOT
    19581976
     1977        fGraphFtmRate.SetLineColor(kBlue);
     1978        fGraphFtmRate.SetMarkerColor(kBlue);
     1979        fGraphFtmRate.SetMarkerStyle(kFullDotMedium);
     1980
    19591981        for (int i=0; i<160; i++)
     1982        {
    19601983            fGraphPatchRate[i].SetName("PatchRate");
     1984            fGraphPatchRate[i].SetLineColor(kBlue);
     1985            fGraphPatchRate[i].SetMarkerColor(kBlue);
     1986            fGraphPatchRate[i].SetMarkerStyle(kFullDotMedium);
     1987        }
    19611988        for (int i=0; i<40; i++)
     1989        {
    19621990            fGraphBoardRate[i].SetName("BoardRate");
     1991            fGraphBoardRate[i].SetLineColor(kBlue);
     1992            fGraphBoardRate[i].SetMarkerColor(kBlue);
     1993            fGraphBoardRate[i].SetMarkerStyle(kFullDotMedium);
     1994        }
    19631995        /*
    19641996        TCanvas *c = fFtmTempCanv->GetCanvas();
Note: See TracChangeset for help on using the changeset viewer.