Changeset 11498


Ignore:
Timestamp:
07/20/11 20:20:31 (13 years ago)
Author:
tbretz
Message:
Propagate the maximum number of events and the maximum run-type together with the run-type when configuring/starting a run.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

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

    r11483 r11498  
    10661066    int StartConfigure(const EventImp &evt)
    10671067    {
    1068         const string name = evt.GetText();
     1068        const string name = evt.Ptr<char>(16);
    10691069
    10701070        fTargetConfig = fConfigs.find(name);
     
    10751075        }
    10761076
    1077         const uint32_t runno = StartNewRun();
     1077        const uint32_t runno = StartNewRun(evt.Get<uint64_t>(), evt.Get<uint64_t>(8));
    10781078
    10791079        ostringstream str;
     
    16161616            "|val[short]:Value to be set");
    16171617
    1618         T::AddEvent("CONFIGURE", "C", FAD::kConnected, FAD::kConfigured)
     1618        T::AddEvent("CONFIGURE", "X:2;C", FAD::kConnected, FAD::kConfigured)
    16191619            (bind(&StateMachineFAD::StartConfigure, this, placeholders::_1))
    16201620            ("");
  • trunk/FACT++/src/mcp.cc

    r11494 r11498  
    211211    }
    212212
    213     string fRunType;
     213    uint64_t fMaxTime;
     214    uint64_t fNumEvents;
     215    string   fRunType;
    214216
    215217    int StartRun(const EventImp &evt)
    216218    {
    217         Message("Starting configuration '"+evt.GetString()+"' for new run.");
    218         fRunType = evt.GetString();
     219        fMaxTime   = evt.Get<int64_t>();
     220        fNumEvents = evt.Get<int64_t>(8);
     221        fRunType   = evt.Ptr<char>(16);
     222
     223        ostringstream str;
     224        str << "Starting configuration '" << fRunType << "' for new run";
     225        if (fNumEvents>0 || fMaxTime>0)
     226            str << " [";
     227            str << fNumEvents << " events"
     228        if (fNumEvents>0 && fMaxTime>0)
     229            str << " / ";
     230        if (fMaxTime>0)
     231            str << fMaxTime << "s";
     232        if (fNumEvents>0 || fMaxTime>0)
     233            str << "]";
     234        Message(str);
     235
    219236        return kStateConfiguring1;
     237    }
     238
     239    void ConfigureFAD()
     240    {
     241        struct Value
     242        {
     243            uint64_t time;
     244            uint64_t nevts;
     245            char type[];
     246        };
     247
     248        const size_t len = sizeof(Value)+fRunType.length()+1;
     249
     250        char *buf = new char[len];
     251
     252        Value *val = reinterpret_cast<Value*>(buf);
     253
     254        val->time  = fMaxTime;
     255        val->nevts = fNumEvents;
     256
     257        strcpy(val->type, fRunType.c_str());
     258
     259        Dim::SendCommand("FAD_CONTROL/CONFIGURE", buf, len);
     260
     261        delete buf;
    220262    }
    221263
     
    251293                    return GetCurrentState();
    252294
    253                 Dim::SendCommand("FAD_CONTROL/CONFIGURE", fRunType);
     295                Message("Starting FAD");
     296                ConfigureFAD();
    254297                return kStateConfiguring3;
    255298            }
     
    261304                    return GetCurrentState();
    262305
    263                 Message("START DATA TAKING");
    264                 Fatal("Distribute run-number to start datalogger!");
    265                 //Fatal("Must configure if FTM should be started or not?");
     306                Message("Starting Trigger (FTM)");
    266307                Dim::SendCommand("FTM_CONTROL/START_RUN");
    267308                return kStateConfigured;
     
    343384
    344385
    345         AddEvent("START", "C", kStateIdle)
     386        AddEvent("START", "X:2;C")//, kStateIdle)
    346387            (bind(&StateMachineMCP::StartRun, this, placeholders::_1))
    347388            ("");
Note: See TracChangeset for help on using the changeset viewer.