Changeset 13704 for trunk/FACT++/src


Ignore:
Timestamp:
05/13/12 22:40:45 (12 years ago)
Author:
tbretz
Message:
A fix for the color of the bias information; added colors to the current page; implemented fad connection stuff
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/smartfact.cc

    r13699 r13704  
    8282    float  fDriveControlTrackingDev;
    8383    string fDriveControlSourceName;
     84
     85    int64_t fFadControlNumEvents;
    8486
    8587    float  fFtmControlTriggerRateCam;
     
    192194    DimStampedInfo fDimBiasControlCurrent;
    193195
     196    DimStampedInfo fDimFadConnections;
     197    DimStampedInfo fDimFadEvents;
     198
    194199    DimStampedInfo fDimFtmControlTriggerRates;
    195200    DimStampedInfo fDimFtmControlStaticData;
     
    454459    void HandleFeedbackDeviation(const DimData &d)
    455460    {
    456         if (!CheckDataSize(d, "Feedback:Deviation", 2*4*416+2))
     461        if (!CheckDataSize(d, "Feedback:Deviation", 2*4*416+8))
    457462            return;
    458463
     
    467472
    468473        // Write the 160 patch values to a file
    469         WriteBinary("feedback-deviation", dev, 2000, -1000);
     474        WriteBinary("feedback-deviation", dev, 1);
    470475
    471476        const Statistics stat(dev, 3);
     
    480485        out << kHtmlWhite << '\t' << stat.avg << '\n';
    481486        out << kHtmlWhite << '\t' << stat.max << '\n';
    482         ofstream("www/feedback.txt") << out.str();
     487        ofstream(fPath+"/feedback.txt") << out.str();
    483488    }
    484489
     
    603608    }
    604609
     610    void HandleFadEvents(const DimData &d)
     611    {
     612        if (!CheckDataSize(d, "FadControl:Events", 4*4))
     613        {
     614            fFadControlNumEvents = -1;
     615            return;
     616        }
     617
     618        fFadControlNumEvents = d.get<uint32_t>();
     619    }
     620
     621    void HandleFadConnections(const DimData &d)
     622    {
     623        if (!CheckDataSize(d, "FadControl:Connections", 41))
     624        {
     625            //fStatusEventBuilderLabel->setText("Offline");
     626            return;
     627        }
     628
     629        string rc(40, '-'); // orange/red [45]
     630
     631        const uint8_t *ptr = d.ptr<uint8_t>();
     632
     633        int c[4] = { '.', '.', '.', '.' };
     634
     635        for (int i=0; i<40; i++)
     636        {
     637            const uint8_t stat1 = ptr[i]&3;
     638            const uint8_t stat2 = ptr[i]>>3;
     639
     640            if (stat1==0 && stat2==0)
     641                rc[i] = '.'; // gray [46]
     642            else
     643                if (stat1>=2 && stat2==8)
     644                    rc[i] = stat1==2?'+':'*';  // green [43] : check [42]
     645
     646            if (rc[i]<c[i/10])
     647                c[i/10] = rc[i];
     648        }
     649
     650        string col[4];
     651        for (int i=0; i<4; i++)
     652            switch (c[i])
     653            {
     654            case '.': col[i]=kHtmlWhite;  break;
     655            case '-': col[i]=kHtmlRed;    break;
     656            case '+': col[i]=kHtmlYellow; break;
     657            case '*': col[i]=kHtmlGreen;  break;
     658            }
     659
     660        ostringstream out;
     661        out << setprecision(3);
     662        out << d.time.JavaDate() << '\n';
     663        out << col[0] << '\t' << rc.substr( 0, 10) << '\n';
     664        out << col[1] << '\t' << rc.substr(10, 10) << '\n';
     665        out << col[2] << '\t' << rc.substr(20, 10) << '\n';
     666        out << col[3] << '\t' << rc.substr(30, 10) << '\n';
     667        ofstream(fPath+"/fad.txt") << out.str();
     668    }
     669
    605670    void HandleFtmControlTriggerRates(const DimData &d)
    606671    {
     
    829894            return;
    830895        if (HandleService(curr, fDimBiasControlCurrent,     &StateMachineSmartFACT::HandleBiasControlCurrent))
     896            return;
     897        if (HandleService(curr, fDimFadConnections,         &StateMachineSmartFACT::HandleFadConnections))
     898            return;
     899        if (HandleService(curr, fDimFadEvents,              &StateMachineSmartFACT::HandleFadEvents))
    831900            return;
    832901        if (HandleService(curr, fDimFtmControlTriggerRates, &StateMachineSmartFACT::HandleFtmControlTriggerRates))
     
    9531022                out << " [";
    9541023            if (fMcpConfigurationMaxEvents>0)
    955                 out << fMcpConfigurationMaxEvents;
     1024            {
     1025                if (fFadControlNumEvents>0 && fMcpConfigurationState==12)
     1026                    out << fMcpConfigurationMaxEvents-fFadControlNumEvents;
     1027                else
     1028                    out << fMcpConfigurationMaxEvents;
     1029            }
    9561030            if (fMcpConfigurationMaxEvents>0 && (fMcpConfigurationMaxTime>0 || fMcpConfigurationState==12))
    9571031                out << '/';
     
    9681042                }
    9691043                else
    970                     out << "[" << fMcpConfigurationMaxTime << "s]";
     1044                    out << fMcpConfigurationMaxTime << 's';
    9711045            }
    9721046            else
     
    10811155            // and Bias not in "data-taking state' => Red
    10821156            if (fDimMcp.state()>5 &&
    1083                 (fDimBiasControl.state()==BIAS::kVoltageOn ||
    1084                  fDimBiasControl.state()==BIAS::kVoltageOff))
     1157                fDimBiasControl.state()!=BIAS::kVoltageOn &&
     1158                fDimBiasControl.state()!=BIAS::kVoltageOff)
    10851159                col = kHtmlRed;
    10861160
     
    11831257        fDimBiasControlCurrent    ("BIAS_CONTROL/CURRENT",            (void*)NULL, 0, this),
    11841258        //---
     1259        fDimFadConnections        ("FAD_CONTROL/CONNECTIONS",         (void*)NULL, 0, this),
     1260        fDimFadEvents             ("FAD_CONTROL/EVENTS",              (void*)NULL, 0, this),
     1261        //---
    11851262        fDimFtmControlTriggerRates("FTM_CONTROL/TRIGGER_RATES",       (void*)NULL, 0, this),
    11861263        fDimFtmControlStaticData  ("FTM_CONTROL/STATIC_DATA",         (void*)NULL, 0, this),
     
    12431320    po::options_description control("Smart FACT");
    12441321    control.add_options()
    1245         ("pixel-map-file", var<string>("FACTmapV5a.txt"), "Pixel mapping file. Used here to get the default reference voltage")
    1246         ("path",           var<string>("www/smartfact"), "Output path for the data-files")
     1322        ("pixel-map-file", var<string>("FACTmapV5a.txt"),     "Pixel mapping file. Used here to get the default reference voltage")
     1323        ("path",           var<string>("www/smartfact/data"), "Output path for the data-files")
    12471324        ;
    12481325
Note: See TracChangeset for help on using the changeset viewer.