示例#1
0
void EdgeItem::UpdatePath( void ){
//    if( points )
//        delete []points;
    points.clear();
    QPainterPath m_path;
    m_path.moveTo(0, 0);

    QPointF control = MidPoint();
    double dist = DistancePoint(QPointF(0, 0) , control) + DistancePoint(control, m_endPoint);

    int maxPointsCount = 8;
    pointsCount = (int)(dist / m_selectDistance) + 1;
    if(pointsCount > maxPointsCount ){
        pointsCount = maxPointsCount;
    }
//    points = new QPointF[pointsCount];
    QPointF point;
    for (int i = 0; i < pointsCount; i++){
        point = BezierValue( (double) i / ( pointsCount - 1), control );
        m_path.lineTo( point );
//        m_path.addEllipse(point, 3,3);
        points << point + pos();
    }

    setPath( m_path );
    UpdateArrow();
}
示例#2
0
int32_t PigsGUI::RunAcquisition() {
    // Runs acquisition as a loop
    if(fVerbose) std::cout<<__PRETTY_FUNCTION__ << std::endl;
    int32_t ret=0;
    int32_t ch;
    Float_t currentAcqTime  = -2.0;     // used to check if we need to reconfigure channels
    Float_t previousAcqTime = -1.0;
    fStartDAQ->SetState(kButtonDown);
    fStopDAQ->SetState(kButtonUp);
    fUseIntegration->SetState(kButtonDisabled);
    keepAcquiring = kTRUE;
    while(keepAcquiring) {                      // Acquisition loop
        currentAcqTime  = daq->GetAcquisitionLoopTime();
        if(currentAcqTime != previousAcqTime) { // Acquisition time changed, reconfigure channels
            for (ch=0; ch<4;ch++) ret += daq->ConfigureChannel(ch);
            previousAcqTime = currentAcqTime;
        }
        ret += daq->AcquisitionSingleLoop();    // Run data acquisition
        if(!ret) {
            daq->RefreshCurrHist();             // transfer data to TH1F
            for (ch=0; ch<4;ch++) {
                cCurrHCanvas->GetPad(ch+1)->cd();
                daq->getCurrHist(ch)->Draw();         // plot latest TH1F
                cCurrHCanvas->GetPad(ch+1)->Update();
                ev->spectrum[ch]        = daq->getCurrHist(ch); // save current measurement
                ev->realTime[ch]        = daq->getRealTime(ch);
                ev->deadTime[ch]        = daq->getDeadTime(ch);
                ev->goodCounts[ch]      = daq->getGoodCounts(ch);
                ev->totCounts[ch]       = daq->getTotCounts(ch);
                ev->scaleFactor[ch]     = fScaleFactor[ch];
                ev->countsPerSecond[ch] = daq->getCountsPerSecond(ch);
                if (useIntegration)                             // detector response
                    ev->detectorResponse[ch]= this->CalcResponseV2(ch);
                else
                    ev->detectorResponse[ch]= this->CalcResponseV1(ch);
            }
            ev->acqTime = daq->GetAcquisitionLoopTime();
            NormalizeFuzzyInputs();
            ev->arrowAngle = UpdateArrow();      // Updates the arrow tab, calculates the arrow angle
            gSystem->ProcessEvents();
            cCurrHCanvas->Modified(); 
            storage->getTree()->Fill();
            UpdateHistory();                     // Updates the history & average tabs

        }
        fHCurrHProgressBar->SetPosition(1);
    }
    storage->getTree()->Write();                 // This may be excessive, but we have SSD for storage :)
    fStartDAQ->SetState(kButtonUp);
    fStopDAQ->SetState(kButtonDisabled);
    fUseIntegration->SetState(kButtonUp);
    return ret;
}