Index: trunk/FACT++/src/EventBuilder.c
===================================================================
--- trunk/FACT++/src/EventBuilder.c	(revision 12451)
+++ trunk/FACT++/src/EventBuilder.c	(revision 12452)
@@ -1194,6 +1194,19 @@
 
 /*                  //we have a complete buffer, copy to WORK area
-                  int jr;
+                  int jr, kr;
+                  int  checkRoi;
                   roi[0] = ntohs (rd[i].rBuf->S[head_len / 2 + 2]);
+                  for (kr = 1; kr < 4; kr++)
+                  {
+                      checkRoi = ntohs(rd[i].rBuf->S[head_len/ 2 +
+                                                     + kr*(roi[jr-1]+4)]);
+                      if (checkRoi != roi[0])
+                      {
+                          snprintf (str, MXSTR, "Inconsistent Roi accross board patches");
+                          factOut (kFatal, 1, str);
+                          goto EndBuf;
+                      }
+
+                  }
                   for (jr = 1; jr < 9; jr++) {
                      roi[jr] =
@@ -1222,14 +1235,14 @@
                      roi[jr] =
                         ntohs (rd[i].
-                               rBuf->S[head_len / 2 + 2 + 4 * jr * (roi[jr-1] + 4)]);
+                               rBuf->S[head_len / 2 + 2 + 9 * jr * (roi[jr-1] + 4)]);
                      for (kr = 1; kr < 4; kr++)
                      {
                          checkRoi = ntohs(rd[i].rBuf->S[  head_len/2 + 2 //header up to first roi
-                                                        + kr*(roi[jr]+4) //shift up to the next board
-                                                        + 4*jr*(roi[jr-1]+4)]); //shift up to the correct pixel
+                                                        + kr*(roi[jr-1]+4) //shift up to the next board
+                                                        + 9*jr*(roi[jr-1]+4)]); //shift up to the correct pixel
                          if (checkRoi != roi[jr])
                          {
-                             snprintf (str, MXSTR, "Inconsistent Roi accross board patches b %d %d %d %d", kr, jr, roi[jr], checkRoi);
-                             factOut (kError, 1, str);
+                             snprintf (str, MXSTR, "Inconsistent Roi accross board patches");
+                             factOut (kFatal, 1, str);
                              goto EndBuf;
                          }
@@ -1340,4 +1353,10 @@
                            } else {
                               mBuffer[evID].fEvent->StartTM[tmS] = -1;
+                              //ETIENNE because the TM channels are always processed during drs calib,
+                              //set them to zero if they are not present
+                              //I suspect that it may be more efficient to set all the allocated mem to
+                              //zero when allocating it
+                              dest = tmS*roi[0] + NPIX*roi[0];
+                              memset(&mBuffer[evID].fEvent->Adc_Data[dest],0,roi[0]*2);
                            }
                         }
@@ -1965,4 +1984,5 @@
                      }
                   }
+
                   for (it = 0; it < NTMARK; it++) {
                      if (mBuffer[id].fEvent->StartTM[it] == -1) {
