Changeset 15344 for trunk/FACT++/src


Ignore:
Timestamp:
04/15/13 13:15:48 (12 years ago)
Author:
tbretz
Message:
More unification of code to close run.
File:
1 edited

Legend:

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

    r15343 r15344  
    23272327}
    23282328
    2329 void checkAndCloseRun(int j, int irun, int cond, char *where)
     2329void checkAndCloseRun(int j, int irun, int cond, int where)
    23302330{
    23312331    if (!cond &&
     
    23602360    if (rc<0)
    23612361    {
    2362         factPrintf(kError, 503, "writeEvt-%s: Error closing run %d (runClose[1],rc=%d)",
     2362        factPrintf(kError, 503, "writeEvt-%d: Error closing run %d (runClose,rc=%d)",
    23632363                   where, runCtrl[j].runId, rc);
    2364         runCtrl[j].fileId = 92;
     2364        runCtrl[j].fileId = 92+where*2;
    23652365    }
    23662366    else
    23672367    {
    2368         factPrintf(kInfo, 503, "writeEvt-%s: Closed run %d (ii=%d)",
     2368        factPrintf(kInfo, 503, "writeEvt-%d: Closed run %d (reason=%d)",
    23692369                   where, irun, ii);
    2370         runCtrl[j].fileId = 93;
     2370        runCtrl[j].fileId = 93+where*2;
    23712371    }
    23722372}
     
    25002500                  }
    25012501
    2502                   checkAndCloseRun(j, irun, rc<0, "1");
     2502                  checkAndCloseRun(j, irun, rc<0, 1);
    25032503               }
    25042504            }
     
    25532553              //ETIENNE added the condition at this line. dunno what to do with run 0: skipping it
    25542554              const int cond = runCtrl[j].lastTime < lastStartedTime && runCtrl[j].runId != 0;
    2555               checkAndCloseRun(j, runCtrl[j].runId, cond, "2");
     2555              checkAndCloseRun(j, runCtrl[j].runId, cond, 2);
    25562556          }
    25572557      }
     
    25812581   factPrintf(kInfo, -1, "Close all open files ...");
    25822582   for (j = 0; j < MAX_RUN; j++)
    2583       if (runCtrl[j].fileId == 0) {
    2584          if (runCtrl[j].runId == gi_myRun)
    2585             gi_myRun = g_actTime;
    2586 
    2587          if (runCtrl[j].procId == 0) {
    2588             runFinish1 (runCtrl[j].runId);
    2589             runCtrl[j].procId = 92;
    2590          }
    2591 
    2592          runCtrl[j].closeTime = g_actTime - 1;
    2593          int i = runClose (runCtrl[j].fileHd, &runTail[j], sizeof (runTail[j]));
    2594          int ii = 0;
    2595          if (runCtrl[j].closeTime < g_actTime)
    2596             ii |= 2; // = 2
    2597          /*else*/ if (runCtrl[j].lastTime < g_actTime - 300)
    2598             ii |= 4; // = 3
    2599          /*else*/ if (runCtrl[j].maxEvt <= runCtrl[j].actEvt)
    2600             ii |= 8; // = 4
    2601          if (i < 0) {
    2602              factPrintf(kError, 506, "writeEvt: Error closing run %d (runClose[3],i=%d)", runCtrl[j].runId, i);
    2603             runCtrl[j].fileId = 96;
    2604          } else {
    2605              factPrintf(kInfo, 507, "writeEvt: Closed run %d (ii[3]=%d)", runCtrl[j].runId, ii);
    2606             runCtrl[j].fileId = 97;
    2607          }
    2608       }
     2583   {
     2584       if (runCtrl[j].fileId == 0)
     2585           checkAndCloseRun(j, runCtrl[j].runId, 1, 3);
     2586   }
    26092587
    26102588   gw_runStat = -99;
Note: See TracChangeset for help on using the changeset viewer.