Changeset 11825


Ignore:
Timestamp:
08/06/11 19:09:38 (13 years ago)
Author:
tbretz
Message:
Configure possible run lengths etc. from program options.
Location:
trunk/FACT++/gui
Files:
2 edited

Legend:

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

    r11824 r11825  
    1616#include "src/Dim.h"
    1717#include "src/Converter.h"
     18#include "src/Configuration.h"
    1819#include "src/HeadersFTM.h"
    1920#include "src/HeadersFAD.h"
     
    31393140#endif
    31403141
     3142    pair<string,string> Split(const string &str) const
     3143    {
     3144        const size_t p = str.find_first_of('|');
     3145        if (p==string::npos)
     3146            return make_pair(str, "");
     3147
     3148        return make_pair(str.substr(0, p), str.substr(p+1));
     3149    }
     3150
    31413151public:
    3142     FactGui() :
     3152    FactGui(Configuration &conf) :
    31433153        fFtuStatus(40),
    31443154        fPixelMapHW(1440), fPatchMapHW(160), fPatchHW(1440),
     
    31913201        fClockCondFreq->addItem("5 GHz",   QVariant(5000));
    31923202
     3203        cout << "-- run counter ---" << endl;
    31933204        fMcpNumEvents->addItem("unlimited", QVariant(0));
    3194         fMcpNumEvents->addItem("100",   QVariant(100));
    3195         fMcpNumEvents->addItem("300",   QVariant(300));
    3196         fMcpNumEvents->addItem("1000",  QVariant(1000));
    3197         fMcpNumEvents->addItem("3000",  QVariant(3000));
    3198         fMcpNumEvents->addItem("10000", QVariant(10000));
    3199         fMcpNumEvents->addItem("30000", QVariant(30000));
    3200 
     3205        const vector<uint32_t> runcount = conf.Vec<uint32_t>("run-count");
     3206        for (vector<uint32_t>::const_iterator it=runcount.begin(); it!=runcount.end(); it++)
     3207        {
     3208            cout << *it << endl;
     3209            ostringstream str;
     3210            str << *it;
     3211            fMcpNumEvents->addItem(str.str().c_str(), QVariant(*it));
     3212        }
     3213
     3214        cout << "-- run times ---" << endl;
    32013215        fMcpTime->addItem("unlimited", QVariant(0));
    3202         fMcpTime->addItem("00:30", QVariant(30));
    3203         fMcpTime->addItem("01:00", QVariant(60));
    3204         fMcpTime->addItem("02:30", QVariant(150));
    3205         fMcpTime->addItem("05:00", QVariant(300));
    3206         fMcpTime->addItem("10:00", QVariant(600));
    3207         fMcpTime->addItem("15:00", QVariant(900));
    3208         fMcpTime->addItem("20:00", QVariant(1200));
    3209         fMcpTime->addItem("30:00", QVariant(1800));
    3210         fMcpTime->addItem("60:00", QVariant(3600));
    3211 
    3212         fMcpRunType->addItem("Data",      QVariant("data"));
    3213         fMcpRunType->addItem("Pedestal",  QVariant("pedestal"));
    3214         fMcpRunType->addItem("DRS Calib", QVariant("drs-calib"));
    3215         fMcpRunType->addItem("Light pulser", QVariant("light-pulser"));
     3216        const vector<string> runtime = conf.Vec<string>("run-time");
     3217        for (vector<string>::const_iterator it=runtime.begin(); it!=runtime.end(); it++)
     3218        {
     3219            const pair<string,string> p = Split(*it);
     3220            cout << *it << "|" << p.second << "|" << p.first << "|" << endl;
     3221            fMcpTime->addItem(p.second.c_str(), QVariant(stoi(p.first)));
     3222        }
     3223
     3224        cout << "-- run types ---" << endl;
     3225        const vector<string> runtype = conf.Vec<string>("run-type");
     3226        for (vector<string>::const_iterator it=runtype.begin(); it!=runtype.end(); it++)
     3227        {
     3228            const pair<string,string> p = Split(*it);
     3229            cout << *it << "|" << p.second << "|" << p.first << "|" << endl;
     3230            fMcpRunType->addItem(p.second.c_str(), QVariant(p.first.c_str()));
     3231        }
    32163232
    32173233        fTriggerWidget->setEnabled(false);
  • trunk/FACT++/gui/fact.cc

    r11611 r11825  
    3939        ;
    4040
     41    po::options_description runtype("Run type configuration");
     42    runtype.add_options()
     43        ("run-type",  vars<string>(),   "Names of available run-types")
     44        ("run-time",  vars<string>(),   "Possible run-times for runs")
     45        ("run-count", vars<uint32_t>(), "Number of events for a run")
     46        ;
     47
    4148    conf.AddEnv("dns",  "DIM_DNS_NODE");
    4249    conf.AddEnv("host", "DIM_HOST_NODE");
    4350
    4451    conf.AddOptions(config);
     52    conf.AddOptions(runtype);
    4553}
    4654
     
    5866    QApplication app(argc, const_cast<char**>(argv));
    5967
    60     FactGui gui;
     68    FactGui gui(conf);
    6169    gui.show();
    6270
Note: See TracChangeset for help on using the changeset viewer.