Index: trunk/FACT++/src/EventBuilder.c
===================================================================
--- trunk/FACT++/src/EventBuilder.c	(revision 12505)
+++ trunk/FACT++/src/EventBuilder.c	(revision 12506)
@@ -191,5 +191,5 @@
     if (EtiMemoryChunks[numAllocatedChunks].pointers[0] == NULL)
     {
-        snprintf (str, MXSTR, "could not allocate %lu bytes. %d chunks are currently allocated (max allowed %lu bytes)", MAX_CHUNK_SIZE, numAllocatedChunks, g_maxMem);
+        snprintf (str, MXSTR, "Allocation of %lu bytes failed. %d chunks are currently allocated (max allowed %lu bytes)", MAX_CHUNK_SIZE, numAllocatedChunks, g_maxMem);
         factOut (kError, 000, str);
         return NULL;
@@ -218,5 +218,5 @@
     if (currentChunk->events[mBufferMapping[evtIndex].slot] != evtId)
     {
-        snprintf (str, MXSTR, "Mismatch in chunk mapping table. expected evtId %d. Got %d. No memory was freed.", evtId, currentChunk->events[mBufferMapping[evtIndex].slot]);
+        snprintf (str, MXSTR, "Mismatch in chunk mapping table. Expected evtId %d. Got %d. No memory was freed.", evtId, currentChunk->events[mBufferMapping[evtIndex].slot]);
         factOut (kError, 000, str);
         return;
@@ -233,5 +233,5 @@
         if (EtiMemoryChunks[chunkIndex].pointers[0] == NULL)
         {
-            snprintf(str, MXSTR, "Chunk %d not allocated as it ought to be. Skipping release", chunkIndex);
+            snprintf(str, MXSTR, "Chunk %d not allocated as it ought to be. Skipping memory release.", chunkIndex);
             factOut(kError, 000, str);
             return;
@@ -367,5 +367,5 @@
       j = close (rd->socket);
       if (j > 0) {
-         snprintf (str, MXSTR, "Error closing socket %d | %m", sid);
+          snprintf (str, MXSTR, "Closing socket %d failed: %m (close,rc=%d)", sid, errno);
          factOut (kFatal, 771, str);
       } else {
@@ -398,5 +398,5 @@
       rd->rBuf = malloc (sizeof (CNV_FACT));
       if (rd->rBuf == NULL) {
-         snprintf (str, MXSTR, "Could not create local buffer %d", sid);
+         snprintf (str, MXSTR, "Could not create local buffer %d (malloc failed)", sid);
          factOut (kFatal, 774, str);
          rd->sockStat = 77;
@@ -407,5 +407,5 @@
 
    if ((rd->socket = socket (PF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0)) <= 0) {
-      snprintf (str, MXSTR, "Could not generate socket %d | %m", sid);
+       snprintf (str, MXSTR, "Generating socket %d failed: %m (socket,rc=%d)", sid, errno);
       factOut (kFatal, 773, str);
       rd->sockStat = 88;
@@ -414,25 +414,25 @@
    optval = 1;
    if (setsockopt (rd->socket, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen) < 0) {
-      snprintf (str, MXSTR, "Could not set keepalive %d | %m", sid);
+       snprintf (str, MXSTR, "Setting SO_KEEPALIVE for socket %d failed: %m (setsockopt,rc=%d)", sid, errno);
       factOut (kInfo, 173, str);        //but continue anyhow
    }
    optval = 10;                 //start after 10 seconds
    if (setsockopt (rd->socket, SOL_TCP, TCP_KEEPIDLE, &optval, optlen) < 0) {
-      snprintf (str, MXSTR, "Could not set keepidle %d | %m", sid);
+      snprintf (str, MXSTR, "Setting TCP_KEEPIDLE for socket %d failed: %m (setsockopt,rc=%d)", sid, errno);
       factOut (kInfo, 173, str);        //but continue anyhow
    }
    optval = 10;                 //do every 10 seconds
    if (setsockopt (rd->socket, SOL_TCP, TCP_KEEPINTVL, &optval, optlen) < 0) {
-      snprintf (str, MXSTR, "Could not set keepintvl %d | %m", sid);
+      snprintf (str, MXSTR, "Setting TCP_KEEPINTVL for socket %d failed: %m (setsockopt,rc=%d)", sid, errno);
       factOut (kInfo, 173, str);        //but continue anyhow
    }
    optval = 2;                  //close after 2 unsuccessful tries
    if (setsockopt (rd->socket, SOL_TCP, TCP_KEEPCNT, &optval, optlen) < 0) {
-      snprintf (str, MXSTR, "Could not set keepalive probes %d | %m", sid);
+      snprintf (str, MXSTR, "Setting TCP_KEEPCNT for socket %d failed: %m (setsockopt,rc=%d)", sid, errno);
       factOut (kInfo, 173, str);        //but continue anyhow
    }
 
 
-   snprintf (str, MXSTR, "Successfully generated socket %d ", sid);
+   snprintf (str, MXSTR, "Successfully generated socket %d", sid);
    factOut (kInfo, 773, str);
    rd->sockStat = -1;           //try to (re)open socket
@@ -502,5 +502,5 @@
 
    int i, b, evFree;
-   int headmem = 0;
+//   int headmem = 0;
    size_t needmem = 0;
 
@@ -509,5 +509,5 @@
 
    if (nRoi[0] < 0 || nRoi[0] > 1024) {
-      snprintf (str, MXSTR, "illegal nRoi[0]: %d", nRoi[0]);
+       snprintf (str, MXSTR, "Illegal roi in channel 0: %d (allowed: 0<=roi<=1024)", nRoi[0]);
       factOut (kError, 999, str);
       gj.badRoiR++;
@@ -518,6 +518,5 @@
    for (int jr = 1; jr < 8; jr++) {
       if (nRoi[jr] != nRoi[0]) {
-         snprintf (str, MXSTR, "wrong nRoi[%d]: %d %d", jr, nRoi[jr],
-                   nRoi[0]);
+         snprintf (str, MXSTR, "Mismatch of roi (%d) in channel %d with roi (%d) in channel 0.", nRoi[jr], jr, nRoi[0]);
          factOut (kError, 711, str);
          gj.badRoiB++;
@@ -527,5 +526,5 @@
    }
    if (nRoi[8] < nRoi[0]) {
-      snprintf (str, MXSTR, "wrong nRoi_TM: %d %d", nRoi[8], nRoi[0]);
+      snprintf (str, MXSTR, "Mismatch of roi (%d) in channel 8. Should be larger or equal than the roi (%d) in channel 0.", nRoi[8], nRoi[0]);
       factOut (kError, 712, str);
       gj.badRoiB++;
@@ -543,6 +542,6 @@
          if (mBuffer[i].nRoi != nRoi[0]
              || mBuffer[i].nRoiTM != nRoi[8]) {
-            snprintf (str, MXSTR, "illegal evt_roi %d %d ; %d %d",
-                      nRoi[0], nRoi[8], mBuffer[i].nRoi, mBuffer[i].nRoiTM);
+            snprintf (str, MXSTR, "Mismatch of roi within event. Expected roi=%d and roi_tm=%d, got %d and %d.",
+                      mBuffer[i].nRoi, mBuffer[i].nRoiTM, nRoi[0], nRoi[8]);
             factOut (kError, 821, str);
             gj.badRoiE++;
@@ -570,5 +569,5 @@
    //event does not yet exist; create it
    if (evFree < 0) {            //no space available in ctrl
-      snprintf (str, MXSTR, "no control slot to keep event %d", evID);
+      snprintf (str, MXSTR, "No control slot to keep event %d", evID);
       factOut (kError, 881, str);
       return -1;
@@ -594,6 +593,6 @@
          if (runCtrl[k].roi0 != nRoi[0]
              || runCtrl[k].roi8 != nRoi[8]) {
-            snprintf (str, MXSTR, "illegal run_roi %d %d ; %d %d",
-                      nRoi[0], nRoi[8], runCtrl[k].roi0, runCtrl[k].roi8);
+            snprintf (str, MXSTR, "Mismatch of roi within run. Expected roi=%d and roi_tm=%d, got %d and %d.",
+                      runCtrl[k].roi0, runCtrl[k].roi8, nRoi[0], nRoi[8]);
             factOut (kError, 931, str);
             gj.badRoiR++;
@@ -613,5 +612,5 @@
 
    if (evFree < 0 && jold < 0) {
-      snprintf (str, MXSTR, "not able to register the new run %d", runID);
+      snprintf (str, MXSTR, "Not able to register the new run %d", runID);
       factOut (kFatal, 883, str);
       return -1001;
@@ -619,5 +618,5 @@
       if (evFree < 0)
          evFree = jold;
-      snprintf (str, MXSTR, "register new run %d(%d) roi: %d %d", runID,
+      snprintf (str, MXSTR, "New run %d (evFree=%d) registered with roi=%d and roi_tm=%d", runID,
                 evFree, nRoi[0], nRoi[8]);
       factOut (kInfo, 503, str);
@@ -678,9 +677,9 @@
        if (gi_memStat > 0) {
            gi_memStat = -99;
-           snprintf (str, MXSTR, "no memory left to keep event %6d sock %3d",
+           snprintf (str, MXSTR, "No memory left to keep event %6d sock %3d",
                      evID, sk);
            factOut (kError, 882, str);
         } else {
-           snprintf (str, MXSTR, "no memory left to keep event %6d sock %3d",
+           snprintf (str, MXSTR, "No memory left to keep event %6d sock %3d",
                      evID, sk);
            factOut (kDebug, 882, str);
@@ -901,9 +900,9 @@
 
 
-   snprintf (str, MXSTR, "start initializing");
+   snprintf (str, MXSTR, "Start initializing (readFAD)");
    factOut (kInfo, -1, str);
 
    int cpu = 7;                 //read thread
-   cpu_set_t mask;
+//   cpu_set_t mask;
 
 /* CPU_ZERO initializes all the bits in the mask to zero. */
@@ -980,5 +979,5 @@
          gj.evtSkip = gj.evtWrite = gj.evtErr = 0;
 
-      int b,p;
+      int b;
       for (b = 0; b < NBOARDS; b++)
          gj.badRoi[b] = 0;
@@ -986,5 +985,5 @@
       mBufInit ();              //initialize buffers
 
-      snprintf (str, MXSTR, "end   initializing");
+      snprintf (str, MXSTR, "End   initializing (readFAD)");
       factOut (kInfo, -1, str);
    }
@@ -1087,5 +1086,5 @@
                gi.numConn[b]++;
                gj.numConn[b]++;
-               snprintf (str, MXSTR, "+++connect %d %d", b, gi.numConn[b]);
+               snprintf (str, MXSTR, "New connection %d (number of connections: %d)", b, gi.numConn[b]);
                factOut (kInfo, -1, str);
             }
@@ -1127,5 +1126,5 @@
                } else if (jrd < 0) {    //did not read anything
                   if (errno != EAGAIN && errno != EWOULDBLOCK) {
-                     snprintf (str, MXSTR, "Error Reading from %d | %m", i);
+                      snprintf (str, MXSTR, "Reading from socket %d failed: %m (recv,rc=%d)", i, errno);
                      factOut (kError, 442, str);
                      gi.gotErr[b]++;
@@ -1170,9 +1169,7 @@
                      gi.evtErr++;
                      snprintf (str, MXSTR,
-                               "wrong end of buffer found sock %3d ev %4d len %5d %3d %3d - %3d %3d ",
-                               i, rd[i].fadLen, rd[i].evtID, rd[i].rBuf->B[0],
-                               rd[i].rBuf->B[1],
-                               rd[i].rBuf->B[rd[i].bufPos - 2],
-                               rd[i].rBuf->B[rd[i].bufPos - 1]);
+                               "End-of-event flag wrong on socket %3d for event %4d (len=%5d), expected %3d %3d, got %3d %3d",
+                               i, rd[i].evtID, rd[i].fadLen, stop.B[0], stop.B[1],
+                               rd[i].rBuf->B[rd[i].bufPos - 1], rd[i].rBuf->B[rd[i].bufPos - 2]);
                      factOut (kError, 301, str);
                      goto EndBuf;
@@ -1251,5 +1248,5 @@
                       if (checkRoi != roi[0])
                       {
-                          snprintf (str, MXSTR, "Inconsistent Roi accross board patches a %d %d %d", kr, checkRoi, roi[0]);
+                          snprintf (str, MXSTR, "Inconsistent Roi accross boards B=%d, expected %d, got %d", kr, checkRoi, roi[0]);
                           factOut (kError, 1, str);
                           goto EndBuf;
@@ -1267,5 +1264,5 @@
                          if (checkRoi != roi[jr])
                          {
-                             snprintf (str, MXSTR, "Inconsistent Roi accross board patches B=%d P=%d %d %d", kr, jr, roi[jr], checkRoi);
+                             snprintf (str, MXSTR, "Inconsistent Roi accross patches B=%d P=%d, expected %d, got %d", kr, jr, roi[jr], checkRoi);
                              factOut (kFatal, 1, str);
                              goto EndBuf;
@@ -1325,11 +1322,11 @@
                   int fadCrate = fadBoard / 256;
                   if (boardId != (fadCrate * 10 + fadBoard % 256)) {
-                     snprintf (str, MXSTR, "wrong Board ID %d %d %d",
-                               fadCrate, fadBoard % 256, boardId);
+                     snprintf (str, MXSTR, "Board ID mismatch. Expected %d, got %d (C=%d, B=%d)",
+                               boardId, fadBoard, fadCrate, fadBoard % 256);
                      factOut (kWarn, 301, str);
                   }
                   if (mBuffer[evID].board[boardId] != -1) {
                      snprintf (str, MXSTR,
-                               "double board: ev %5d, b %3d, %3d;  len %5d %3d %3d - %3d %3d ",
+                               "Got event %5d from board %3d (i=%3d, len=%5d) twice: Starts with %3d %3d - ends with %3d %3d",
                                evID, boardId, i, rd[i].fadLen,
                                rd[i].rBuf->B[0], rd[i].rBuf->B[1],
@@ -1403,5 +1400,5 @@
                               if (++runCtrl[ir].lastEvt == 0) {
                                  gotNewRun (actrun, mBuffer[evID].FADhead);
-                                 snprintf (str, MXSTR, "gotNewRun %d (ev %d)",
+                                 snprintf (str, MXSTR, "gotNewRun called for run %d, event %d",
                                            mBuffer[evID].runNum,
                                            mBuffer[evID].evNum);
@@ -1458,5 +1455,5 @@
                   if (rd[i].bufPos >= minLen) {
                      if (rd[i].skip > 0) {
-                        snprintf (str, MXSTR, "skipped %d bytes on port%d",
+                        snprintf (str, MXSTR, "Skipped %d bytes on port %d",
                                   rd[i].skip, i);
                         factOut (kInfo, 666, str);
@@ -1574,5 +1571,5 @@
                   for (ib=0; ib<NBOARDS; ib++) {
                      if (ib%10==0) {
-                        snprintf (&str[ik], MXSTR, "'");
+                        snprintf (&str[ik], MXSTR, "|");
                         ik++;
                      }
@@ -1589,5 +1586,5 @@
                      ik++;
                   }
-                  snprintf (&str[ik], MXSTR, "'");
+                  snprintf (&str[ik], MXSTR, "|");
                   factOut (kWarn, 601, str);
 
@@ -1654,5 +1651,5 @@
 
 
-   snprintf (str, MXSTR, "stop reading ... RESET=%d", g_reset);
+   snprintf (str, MXSTR, "Stop reading ... RESET=%d", g_reset);
    factOut (kInfo, -1, str);
 
@@ -1681,5 +1678,5 @@
    if (gi_resetS > 0) {
       //must close all open sockets ...
-      snprintf (str, MXSTR, "close all sockets ...");
+      snprintf (str, MXSTR, "Close all sockets...");
       factOut (kInfo, -1, str);
       for (i = 0; i < MAX_SOCK; i++) {
@@ -1723,8 +1720,8 @@
       if (gi_resetR == 1) {
          minclear = 900;
-         snprintf (str, MXSTR, "drain all buffers ...");
+         snprintf (str, MXSTR, "Drain all buffers ...");
       } else {
          minclear = 0;
-         snprintf (str, MXSTR, "flush all buffers ...");
+         snprintf (str, MXSTR, "Flush all buffers ...");
       }
       factOut (kInfo, -1, str);
@@ -1792,12 +1789,13 @@
 subProc (void *thrid)
 {
-   int threadID, status, numWait, numProc, kd, k1, k0, k, jret;
+    int64_t threadID;
+    int numWait, numProc, k, jret;
    struct timespec xwait;
 
-   int32_t cntr ;
-
-   threadID = (int) thrid;
-
-   snprintf (str, MXSTR, "Starting sub-process-thread %d", threadID);
+//   int32_t cntr ;
+
+   threadID = (int64_t)thrid;
+
+   snprintf (str, MXSTR, "Starting sub-process-thread %ld", threadID);
    factOut (kInfo, -1, str);
 
@@ -1826,5 +1824,5 @@
                if (jret <= threadID) {
                   snprintf (str, MXSTR,
-                            "process %d wants to send to process %d",
+                            "Process %ld wants to send event to process %d... not allowed.",
                             threadID, jret);
                   factOut (kError, -1, str);
@@ -1844,5 +1842,5 @@
 
       if (gj.readStat < -10 && numWait == 0) {  //nothing left to do
-         snprintf (str, MXSTR, "Exit subProcessing Process %d", threadID);
+         snprintf (str, MXSTR, "Exit subProcessing in process %ld", threadID);
          factOut (kInfo, -1, str);
          return 0;
@@ -1856,7 +1854,7 @@
    }
 
-   snprintf (str, MXSTR, "Ending sub-process-thread %d", threadID);
+   snprintf (str, MXSTR, "Ending sub-process-thread %ld", threadID);
    factOut (kInfo, -1, str);
-   return;
+   return 0;
 } /*-----------------------------------------------------------------*/
 
@@ -1867,5 +1865,5 @@
 /* *** main loop processing file, including SW-trigger */
    int numProc, numWait;
-   int k, status, j;
+   int status, j;
    struct timespec xwait;
    char str[MXSTR];
@@ -1875,8 +1873,8 @@
    int lastRun = 0;             //usually run from last event still valid
 
-   cpu_set_t mask;
-   int cpu = 1;                 //process thread  (will be several in final version)
-
-   snprintf (str, MXSTR, "Starting process-thread with %d subprocess",
+//   cpu_set_t mask;
+//   int cpu = 1;                 //process thread  (will be several in final version)
+
+   snprintf (str, MXSTR, "Starting process-thread with %d subprocesses",
              gi_maxProc);
    factOut (kInfo, -1, str);
@@ -1903,5 +1901,5 @@
    int th_ret[100];
 
-   for (k = 0; k < gi_maxProc; k++) {
+   for (long long k = 0; k < gi_maxProc; k++) {
       th_ret[k] = pthread_create (&thread[k], NULL, subProc, (void *) k);
    }
@@ -1915,5 +1913,5 @@
 
       int k1 = evtCtrl.frstPtr;
-      for (k = k1; k < (k1 + kd); k++) {
+      for (int k = k1; k < (k1 + kd); k++) {
          int k0 = k % (MAX_EVT * MAX_RUN);
 //would be better to use bitmaps for evtStat (allow '&' instead of multi-if)
@@ -1939,5 +1937,5 @@
                   if (j >= MAX_RUN) {
                      snprintf (str, MXSTR,
-                               "P error: can not find run %d for event %d in %d",
+                               "procEvt: Can not find run %d for event %d in %d",
                                irun, ievt, id);
                      factOut (kFatal, 901, str);
@@ -1955,5 +1953,5 @@
 //----                  problem: processing still going on ==> must wait for closing ....
                         snprintf (str, MXSTR,
-                                  "P finish run since new one opened %d",
+                                  "procEvt: Finished run since new one opened %d",
                                   runCtrl[j1].runId);
                         runFinish1 (runCtrl[j1].runId);
@@ -1983,10 +1981,10 @@
                   if (runCtrl[j].fileHd == NULL) {
                      snprintf (str, MXSTR,
-                               "P could not open a file for run %d", irun);
+                               "procEvt: Could not open a file for run %d (runOpen failed)", irun);
                      factOut (kError, 502, str);
                      runCtrl[j].fileId = 91;
                      runCtrl[j].procId = 91;
                   } else {                                                 
-                     snprintf (str, MXSTR, "P opened new run_file %d evt %d",
+                      snprintf (str, MXSTR, "procEvt: Opened new file for run %d (evt=%d)",
                                irun, ievt);
                      factOut (kInfo, -1, str);
@@ -2002,5 +2000,5 @@
                       || runCtrl[j].maxEvt <= runCtrl[j].procEvt) {
                      snprintf (str, MXSTR,
-                               "P reached end of run condition for run %d",
+                               "procEvt: Reached end of run condition for run %d",
                                irun);
                      factOut (kInfo, 502, str);
@@ -2011,5 +2009,5 @@
                if (runCtrl[j].procId != 0) {
                   snprintf (str, MXSTR,
-                            "P skip event %d because no active run %d", ievt,
+                            "procEvt: Skip event %d because no active run %d", ievt,
                             irun);
                   factOut (kDebug, 502, str);
@@ -2113,10 +2111,10 @@
       kd += (MAX_EVT * MAX_RUN);
 
-   for (k = 0; k < gi_maxProc; k++) {
+   for (int k = 0; k < gi_maxProc; k++) {
       pthread_join (thread[k], (void **) &status);
    }
 
    int k1 = evtCtrl.frstPtr;
-   for (k = k1; k < (k1 + kd); k++) {
+   for (int k = k1; k < (k1 + kd); k++) {
       int k0 = k % (MAX_EVT * MAX_RUN);
       if (evtCtrl.evtStat[k0] >= 0 && evtCtrl.evtStat[k0] < 1000) {
@@ -2180,6 +2178,6 @@
    char str[MXSTR];
 
-   cpu_set_t mask;
-   int cpu = 1;                 //write thread
+//   cpu_set_t mask;
+//   int cpu = 1;                 //write thread
 
    snprintf (str, MXSTR, "Starting write-thread");
@@ -2230,5 +2228,5 @@
                   if (j >= MAX_RUN) {
                      snprintf (str, MXSTR,
-                               "W error: can not find run %d for event %d in %d",
+                               "writeEvt: Can not find run %d for event %d in %d",
                                irun, ievt, id);
                      factOut (kFatal, 901, str);
@@ -2260,9 +2258,9 @@
                   if (runCtrl[j].fileHd == NULL) {
                      snprintf (str, MXSTR,
-                               "W could not open a file for run %d", irun);
+                               "writeEvt: Could not open a file for run %d (runOpen failed)", irun);
                      factOut (kError, 502, str);
                      runCtrl[j].fileId = 91;
                   } else {
-                     snprintf (str, MXSTR, "W opened new run_file %d evt %d",
+                      snprintf (str, MXSTR, "writeEvt: Opened new file for run %d (evt %d)",
                                irun, ievt);
                      factOut (kInfo, -1, str);
@@ -2275,13 +2273,13 @@
                   if (runCtrl[j].fileId < 0) {
                      snprintf (str, MXSTR,
-                               "W never opened file for this run %d", irun);
+                               "writeEvt: Never opened file for run %d", irun);
                      factOut (kError, 123, str);
                   } else if (runCtrl[j].fileId < 100) {
-                     snprintf (str, MXSTR, "W.file for this run is closed %d",
+                      snprintf (str, MXSTR, "writeEvt: File for run %d is closed",
                                irun);
                      factOut (kWarn, 123, str);
                      runCtrl[j].fileId += 100;
                   } else {
-                     snprintf (str, MXSTR, "W:file for this run is closed %d",
+                      snprintf (str, MXSTR, "writeEvt: File for run %d is closed",
                                irun);
                      factOut (kDebug, 123, str);
@@ -2304,5 +2302,5 @@
 //               gj.writEvt++ ;
                   } else {
-                     snprintf (str, MXSTR, "W error writing event for run %d",
+                      snprintf (str, MXSTR, "writeEvt: Writing event for run %d failed (runWrite)",
                                irun);
                      factOut (kError, 503, str);
@@ -2340,10 +2338,10 @@
                                    sizeof (runTail[j]));
                      if (i < 0) {
-                        snprintf (str, MXSTR, "error closing run %d %d AAA",
+                         snprintf (str, MXSTR, "writeEvt: Error closing run %d (runClose[1],i=%d)",
                                   runCtrl[j].runId, i);
                         factOut (kError, 503, str);
                         runCtrl[j].fileId = 92;
                      } else {
-                        snprintf (str, MXSTR, "W closed run %d AAA %d", irun,
+                         snprintf (str, MXSTR, "writeEvt: Closed run %d (ii[1]=%d)", irun,
                                   ii);
                         factOut (kInfo, 503, str);
@@ -2380,5 +2378,5 @@
 			  (runCtrl[j].runId != 0))
           {
-              snprintf (str, MXSTR, "No file will be opened for run #%ud. latest run: %ud (started)", runCtrl[j].runId, maxStartedRun);
+              snprintf (str, MXSTR, "writeEvt: No file will be opened for run %ud. Last run: %ud (started)", runCtrl[j].runId, maxStartedRun);
               factOut (kInfo, 000, str);
            ;//TODO notify that this run will never be opened
@@ -2411,10 +2409,10 @@
                           sizeof (runTail[j]));
             if (i < 0) {
-               snprintf (str, MXSTR, "error closing run %d %d BBB",
+                snprintf (str, MXSTR, "writeEvt: Error closing run %d (runClose[2],i=%d)",
                          runCtrl[j].runId, i);
                factOut (kError, 506, str);
                runCtrl[j].fileId = 94;
             } else {
-               snprintf (str, MXSTR, "W closed run %d BBB %d",
+                snprintf (str, MXSTR, "writeEvt: Closed run %d (ii[2]=%d)",
                          runCtrl[j].runId, ii);
                factOut (kInfo, 507, str);
@@ -2470,10 +2468,10 @@
             ii = 4;
          if (i < 0) {
-            snprintf (str, MXSTR, "error closing run %d %d CCC",
+             snprintf (str, MXSTR, "writeEvt: Error closing run %d (runClose[3],i=%d)",
                       runCtrl[j].runId, i);
             factOut (kError, 506, str);
             runCtrl[j].fileId = 96;
          } else {
-            snprintf (str, MXSTR, "W closed run %d CCC %d", runCtrl[j].runId,
+             snprintf (str, MXSTR, "writeEvt: Closed run %d (ii[3]=%d)", runCtrl[j].runId,
                       ii);
             factOut (kInfo, 507, str);
@@ -2523,5 +2521,5 @@
    gi_maxProc = g_maxProc;
    if (gi_maxProc <= 0 || gi_maxProc > 90) {
-      snprintf (str, MXSTR, "illegal number of processes %d", gi_maxProc);
+      snprintf (str, MXSTR, "Illegal number of processes %d", gi_maxProc);
       factOut (kFatal, 301, str);
       gi_maxProc = 1;
