Index: trunk/FACT++/src/EventBuilderWrapper.h
===================================================================
--- trunk/FACT++/src/EventBuilderWrapper.h	(revision 11702)
+++ trunk/FACT++/src/EventBuilderWrapper.h	(revision 11703)
@@ -615,6 +615,4 @@
         }
 
-        h->NroiTM = 0;
-
         vector<string> colNames;
         vector<string> dataTypes;
@@ -623,26 +621,26 @@
         AddColumnEntry(colNames, dataTypes, 1,                'I', "TriggerType");
         AddColumnEntry(colNames, dataTypes, 1,                'J', "NumBoards");
-        AddColumnEntry(colNames, dataTypes, 1,                'J', "Errors");
         AddColumnEntry(colNames, dataTypes, 1,                'J', "reserved");
         AddColumnEntry(colNames, dataTypes, 1,                'J', "SoftTrig");
         AddColumnEntry(colNames, dataTypes, 2,                'J', "PCTime");
-        AddColumnEntry(colNames, dataTypes, h->NBoard,        'J', "BoardTime");
-        AddColumnEntry(colNames, dataTypes, h->NPix,          'I', "StartCellData");
-        AddColumnEntry(colNames, dataTypes, h->NTm,           'I', "StartCellTimeMarker");
-        AddColumnEntry(colNames, dataTypes, h->NPix*h->Nroi,  'I', "Data");
-        AddColumnEntry(colNames, dataTypes, h->NTm*h->NroiTM, 'I', "TimeMarker");
+        AddColumnEntry(colNames, dataTypes, NBOARDS/*h->NBoard*/, 'J', "BoardTime");
+        AddColumnEntry(colNames, dataTypes, NPIX   /*h->NPix*/,   'I', "StartCellData");
+        AddColumnEntry(colNames, dataTypes, NTMARK /*h->NTm*/,    'I', "StartCellTimeMarker");
+        AddColumnEntry(colNames, dataTypes, h->NPix*h->Nroi,      'I', "Data");
+        AddColumnEntry(colNames, dataTypes, h->NTm*h->NroiTM,     'I', "TimeMarker");
 
         // Write length of physical pipeline (1024)
 
-        /*
-        ostringstream fmt;
-        fmt << "I:1";   // uint32_t EventNum
-        fmt << ";S:1";  // uint16_t TriggerType
-        fmt << ";I:5";  // uint32_t NumBoards, reserved, SoftTrig, PCTime, PCUsec
-        fmt << ";I:" << h->NBoard;       // uint32_t BoardTime[NBOARDS]
-        fmt << ";S:" << h->NPix+h->NTm;  // int16_t StartPix[NPIX], StartTM[NTMARK]
-        fmt << ";S:" << h->NPix*h->Nroi + h->NTm*h->NroiTM; // int16_t Adc_Data[]
-        */
         fConv = new Converter(Converter::ToFormat(dataTypes));
+
+        const size_t sz = (h->NPix*h->Nroi + h->NTm*h->NroiTM)*2;
+        if (fConv->GetSize()-sz+4!=sizeof(EVENT))
+        {
+            ostringstream str;
+            str << "The EVENT structure size (" << sizeof(EVENT) << ") doesn't match the described FITS row (";
+            str << fConv->GetSize()-sz+4 << ")";
+            Error(str);
+            return false;
+        }
 
         //actually create the table
