Changeset 12241 for trunk


Ignore:
Timestamp:
10/23/11 15:00:51 (13 years ago)
Author:
tbretz
Message:
Added possibility to scan in the N-out-of-4 logic.
File:
1 edited

Legend:

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

    r12240 r12241  
    9191    uint16_t    fReferenceIdx;
    9292
     93    string fCommand;
     94
    9395    pair<Time, int> GetNewState(DimStampedInfo &info) const
    9496    {
     
    219221
    220222            const int32_t data[2] = { -1, fThresholdMin+fCounter*fThresholdStep };
    221             DimClient::sendCommandNB("FTM_CONTROL/SET_THRESHOLD", (void*)data, 8);
     223            DimClient::sendCommandNB(fCommand.c_str(), (void*)data, 8);
    222224        }
    223225    }
     
    247249    }
    248250
    249     int StartRateScan(const EventImp &evt)
     251    int StartRateScan(const EventImp &evt, const string &command)
    250252    {
    251253        if (!CheckEventSize(evt.GetSize(), "StartRateScan", 12))
    252254            return kSM_FatalError;
    253255
    254         fThresholdMin   = evt.Get<uint32_t>();
    255         fThresholdMax   = evt.Get<uint32_t>(4);
     256        fCommand = "FTM_CONTROL/"+command;
     257
     258        fThresholdMin  = evt.Get<uint32_t>();
     259        fThresholdMax  = evt.Get<uint32_t>(4);
    256260        fThresholdStep = evt.Get<uint32_t>(8);
    257261
     262
    258263        ofstream fout("ratescan.txt", ios::app);
    259         fout << "# ----- " << Time() << " -----" << endl;
     264        fout << "# ----- " << Time() << " -----\n";
     265        fout << "# Command: " << fCommand << '\n';
    260266        fout << "# Reference: ";
    261267        switch (fReference)
     
    274280        //Message("Starting Trigger (FTM)");
    275281        //Dim::SendCommand("FTM_CONTROL/SET_PRESCALING", int32_t(20));
    276         Dim::SendCommand("FTM_CONTROL/SET_THRESHOLD", data);
     282        Dim::SendCommand(fCommand, data);
    277283        //Dim::SendCommand("FTM_CONTROL/STOP_RUN");
    278284
     
    372378        fFTM("FTM_CONTROL/STATE",       (void*)NULL, 0, this),
    373379        fRates("FTM_CONTROL/TRIGGER_RATES", (void*)NULL, 0, this),
    374         fCounter(-1)
     380        fCounter(-1), fReference(kCamera), fReferenceIdx(0)
    375381    {
    376382        // ba::io_service::work is a kind of keep_alive for the loop.
     
    394400                     "Rate scan in progress.");
    395401
    396         AddEvent("START", "I:3", kStateConnected)
    397             (bind(&StateMachineRateScan::StartRateScan, this, placeholders::_1))
    398             ("Start rate scan for the defined range"
     402        AddEvent("START_THRESHOLD_SCAN", "I:3", kStateConnected)
     403            (bind(&StateMachineRateScan::StartRateScan, this, placeholders::_1, "SET_THRESHOLD"))
     404            ("Start rate scan for the threshold in the defined range"
     405             "|min[int]:Start value in DAC counts"
     406             "|max[int]:Limiting value in DAC counts"
     407             "|step[int]:Single step in DAC counts");
     408
     409        AddEvent("START_N_OUT_OF_4_SCAN", "I:3", kStateConnected)
     410            (bind(&StateMachineRateScan::StartRateScan, this, placeholders::_1, "SET_N_OUT_OF_4"))
     411            ("Start rate scan for N-out-of-4 in the defined range"
    399412             "|min[int]:Start value in DAC counts"
    400413             "|max[int]:Limiting value in DAC counts"
Note: See TracChangeset for help on using the changeset viewer.