Changeset 12474 for trunk/FACT++


Ignore:
Timestamp:
11/09/11 19:55:35 (13 years ago)
Author:
lyard
Message:
close runs when new ones arrive in event builder
File:
1 edited

Legend:

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

    r12465 r12474  
    23162316
    23172317      //check if we should close a run (mainly when no event pending)
     2318      //ETIENNE but first figure out which one is the latest run with a complete event.
     2319      //i.e. max run Id and lastEvt >= 0
     2320      //this condition is sufficient because all pending events were written already in the loop just above
     2321      unsigned int maxStartedRun = 0;
     2322      for (j=0;j<MAX_RUN;j++)
     2323      {
     2324          if ((runCtrl[j].runId > maxStartedRun) &&
     2325              (runCtrl[j].lastEvt > -1) &&
     2326                          (runCtrl[j].runId != 0))
     2327              maxStartedRun = runCtrl[j].runId;
     2328      }
     2329//        snprintf(str, MXSTR, "Maximum runId: %d", maxStartedRun);
     2330//        factOut(kInfo, 000, str);
     2331      //Also check if some files will never be opened
     2332      //EDIT: this is completely useless, because as run Numbers are taken from FADs board,
     2333      //I will never get run numbers for which no file is to be opened
     2334          for (j=0;j<MAX_RUN;j++)
     2335      {
     2336          if ((runCtrl[j].fileId < 0) &&
     2337              (runCtrl[j].runId < maxStartedRun) &&
     2338                          (runCtrl[j].runId != 0))
     2339          {
     2340              snprintf (str, MXSTR, "No file will be opened for run #%ud. latest run: %ud (started)", runCtrl[j].runId, maxStartedRun);
     2341              factOut (kInfo, 000, str);
     2342           ;//TODO notify that this run will never be opened
     2343          }
     2344      }
    23182345      for (j = 0; j < MAX_RUN; j++) {
    23192346         if (runCtrl[j].fileId == 0
    23202347             && (runCtrl[j].closeTime < g_actTime
    23212348                 || runCtrl[j].lastTime < g_actTime - 300
    2322                  || runCtrl[j].maxEvt <= runCtrl[j].actEvt)) {
     2349                 || runCtrl[j].maxEvt <= runCtrl[j].actEvt
     2350                 || (runCtrl[j].runId < maxStartedRun && runCtrl[j].runId != 0))) //ETIENNE added the condition at this line. dunno what to do with run 0: skipping it
     2351{
    23232352            if (runCtrl[j].runId == gi_myRun)
    23242353               gi_myRun = g_actTime;
Note: See TracChangeset for help on using the changeset viewer.