Changeset 13742 for trunk


Ignore:
Timestamp:
05/16/12 08:59:17 (12 years ago)
Author:
tbretz
Message:
Renamed fSeconds* to fCounter* which is more appropriate; added a first draft of a dynamic sized ratescan.
File:
1 edited

Legend:

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

    r13256 r13742  
    6868    DimDescribedService fDimProc;
    6969
    70     int fSeconds;
    71     int fSecondsMax;
     70    int fCounter;
     71    int fCounterMax;
    7272
    7373    int fThreshold;
     
    7575    int fThresholdMax;
    7676    int fThresholdStep;
     77    int fThresholdStepDyn;
    7778
    7879    double fRate;
     
    159160            const FTM::DimTriggerRates &sdata = *static_cast<FTM::DimTriggerRates*>(curr->getData());
    160161
    161             if (++fSeconds<0)
    162                 return;
    163 
    164             if (fSeconds==0)
     162            if (++fCounter<0)
     163                return;
     164
     165            if (fCounter==0)
    165166            {
    166167                fRate = 0;
     
    197198            reference *= sdata.fElapsedTime;
    198199
    199             if ((reference==0 || sqrt(reference)>fResolution*reference) && fSeconds<fSecondsMax)
     200            if ((reference==0 || sqrt(reference)>fResolution*reference) && fCounter<fCounterMax)
    200201            {
    201202                ostringstream out;
     
    208209            }
    209210
    210             const double   time = sdata.fElapsedTime*fSeconds;
     211            const double   time = sdata.fElapsedTime*fCounter;
    211212            const uint32_t th   = fThreshold;
    212213
     
    216217            data[3] = time;         // total elapsed time
    217218            data[4] = fOnTime/time; // relative on time
    218             data[5] = fRate/fSeconds;
     219            data[5] = fRate/fCounter;
    219220            for (int i=0; i<40; i++)
    220                 data[i+6] = fRateBoard[i]/fSeconds;
     221                data[i+6] = fRateBoard[i]/fCounter;
    221222            for (int i=0; i<160; i++)
    222                 data[i+46] = fRatePatch[i]/fSeconds;
     223                data[i+46] = fRatePatch[i]/fCounter;
    223224
    224225            ostringstream sout1, sout2, sout3;
     
    240241            fThreshold += fThresholdStep;
    241242
    242             if (fSeconds>=fSecondsMax)
     243            if (fCounter>=fCounterMax)
    243244            {
    244245                Message("Rate scan stopped due to timeout.");
     
    254255            }
    255256
    256             //fSeconds = -2;  // FIXME: In principle one missed report is enough
    257             fSeconds = -1;
     257            // Does this need to be shifted upwards?
     258            if (fCounter>1 && fThresholdStepDyn>0)
     259            {
     260                //const double scale = fCounter/reference/fResolution/fResolution;
     261                //const double step  = floor(scale*fThresholdStepDyn);
     262
     263                fThresholdStep = fCounter*fThresholStepDyn;
     264            }
     265
     266            //fCounter = -2;  // FIXME: In principle one missed report is enough
     267            fCounter = -1;
    258268
    259269            const int32_t cmd[2] = { -1, fThreshold };
     
    293303        fCommand = "FTM_CONTROL/"+command;
    294304
     305        const int32_t step = evt.Get<int32_t>(8);
     306
    295307        fThresholdMin  = evt.Get<uint32_t>();
    296308        fThresholdMax  = evt.Get<uint32_t>(4);
    297         fThresholdStep = evt.Get<uint32_t>(8);
     309        fThresholdStep = abs(step);
     310
     311        fThresholdStepDyn = step<0 ? -step : 0;
    298312
    299313        UpdateProc();
     
    325339
    326340        fThreshold = fThresholdMin;
    327         fSeconds = -2;
     341        fCounter = -2;
    328342
    329343        ostringstream msg;
     
    527541    int EvalOptions(Configuration &conf)
    528542    {
    529         fSecondsMax = conf.Get<uint16_t>("max-wait");
     543        fCounterMax = conf.Get<uint16_t>("max-wait");
    530544        fResolution = conf.Get<double>("resolution");
    531545
Note: See TracChangeset for help on using the changeset viewer.