Changeset 14734


Ignore:
Timestamp:
12/05/12 15:17:50 (12 years ago)
Author:
lyard
Message:
allows for run number decrement
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/EventBuilder.c

    r14225 r14734  
    15631563                   && evtCtrl.pcTime[k0] < g_actTime - 30) {
    15641564                  int id = evtCtrl.evtBuf[k0];
    1565                   snprintf (str, MXSTR, "%5d skip incomplete evt %8d %8d %2d",
    1566                             mBuffer[id].evNum, evtCtrl.evtBuf[k0], k0,
     1565                  snprintf (str, MXSTR, "%5d skip incomplete evt %8d %8d %2d", mBuffer[id].evNum, evtCtrl.evtBuf[k0], k0,
    15671566                            evtCtrl.evtStat[k0]);
    15681567                  factOut (kWarn, 601, str);
     
    23602359      //i.e. max run Id and lastEvt >= 0
    23612360      //this condition is sufficient because all pending events were written already in the loop just above
    2362       unsigned int maxStartedRun = 0;
    2363       for (j=0;j<MAX_RUN;j++)
     2361      //actrun
     2362      uint32_t lastStartedTime = 0;
     2363      uint32_t runIdFound = 0;
     2364      if (actrun != 0)
     2365      {//If we have an active run, look for its start time
     2366          for (j=0;j<MAX_RUN;j++)
     2367          {
     2368              if (runCtrl[j].runId == actrun)
     2369              {
     2370                  lastStartedTime = runCtrl[j].lastTime;
     2371                  runIdFound = 1;
     2372              }
     2373          }
     2374      }
     2375      else
     2376          runIdFound = 1;
     2377
     2378      if (runIdFound == 0)
    23642379      {
    2365           if ((runCtrl[j].runId > maxStartedRun) &&
    2366               (runCtrl[j].lastEvt > -1) &&
    2367                           (runCtrl[j].runId != 0))
    2368               maxStartedRun = runCtrl[j].runId;
     2380          snprintf(str, MXSTR, "An Active run (number %ud) has been registered, but it could not be found in the runs list", actrun);
     2381          factOut(kInfo, 000, str);
    23692382      }
    23702383//        snprintf(str, MXSTR, "Maximum runId: %d", maxStartedRun);
     
    23762389      {
    23772390          if ((runCtrl[j].fileId < 0) &&
    2378               (runCtrl[j].runId < maxStartedRun) &&
     2391              (runCtrl[j].lastTime < lastStartedTime) &&
    23792392                          (runCtrl[j].runId != 0))
    23802393          {
    2381               snprintf (str, MXSTR, "writeEvt: No file will be opened for run %ud. Last run: %ud (started)", runCtrl[j].runId, maxStartedRun);
     2394              snprintf (str, MXSTR, "writeEvt: No file will be opened for run %ud. Last run: %ud (started)", runCtrl[j].runId, actrun);
    23822395              factOut (kInfo, 000, str);
    23832396           ;//TODO notify that this run will never be opened
     
    23892402                 || runCtrl[j].lastTime < g_actTime - 300
    23902403                 || runCtrl[j].maxEvt <= runCtrl[j].actEvt
    2391                  || (runCtrl[j].runId < maxStartedRun && runCtrl[j].runId != 0))) //ETIENNE added the condition at this line. dunno what to do with run 0: skipping it
     2404                 || (runCtrl[j].lastTime < lastStartedTime && runCtrl[j].runId != 0))) //ETIENNE added the condition at this line. dunno what to do with run 0: skipping it
    23922405{
    23932406            if (runCtrl[j].runId == gi_myRun)
Note: See TracChangeset for help on using the changeset viewer.