Index: trunk/FACT++/src/DataWriteFits.cc
===================================================================
--- trunk/FACT++/src/DataWriteFits.cc	(revision 12483)
+++ trunk/FACT++/src/DataWriteFits.cc	(revision 12484)
@@ -38,4 +38,6 @@
         return false;
     }
+
+    const int16_t realRoiTM = (h->NroiTM >= 2*h->Nroi && h->Nroi<=512) ? h->Nroi : 0;
 
     fFile.AddColumn('I', "EventNum");
@@ -50,13 +52,10 @@
     fFile.AddColumn('S', "StartCellTimeMarker", NTMARK);
     fFile.AddColumn('S', "Data",                h->NPix*h->Nroi);	
-	
-	int16_t realRoiTM = (h->NroiTM > h->Nroi) ? h->Nroi : 0; 
-    fFile.AddColumn('S', "TimeMarker",          h->NTm*realRoiTM);//ETIENNE TM);
+    fFile.AddColumn('S', "TimeMarker",          h->NTm*realRoiTM);
 
     // Write length of physical pipeline (1024)
-
     fConv = new Converter(Converter::ToFormat(fFile.GetColumnTypes()));
 
-    const size_t sz = (h->NPix*h->Nroi + h->NTm*realRoiTM)*2;//ETIENNE TM)*2;
+    const size_t sz = (h->NPix*h->Nroi + h->NTm*realRoiTM)*2;
     if (fConv->GetSize()-sz+4!=sizeof(EVENT))
     {
@@ -88,22 +87,22 @@
         fFile.WriteKey("BLDVER",   h->Version,  "Builder version");
         fFile.WriteKey("RUNID",    GetRunId(),  "Run number");
-        fFile.WriteKey("RUNTYPE",  h->RunType,  "Type of run");
+//        fFile.WriteKey("RUNTYPE",  h->RunType,  "Type of run");
         fFile.WriteKey("NBOARD",   h->NBoard,   "Number of acquisition boards");
         fFile.WriteKey("NPIX",     h->NPix,     "Number of pixels");
-        fFile.WriteKey("NTMARK",   h->NTm,      "Number of Time marks");
+        fFile.WriteKey("NTMARK",   h->NTm,      "Number of time marker channels");
         fFile.WriteKey("NCELLS",   1024,        "Maximum number of slices per pixels");
         fFile.WriteKey("NROI",     h->Nroi,     "Number of slices per pixels");
-        fFile.WriteKey("NROITM",   realRoiTM,   "Number of slices per time-marker"); //ETIENNE from NroiTMm to Nroi
+        fFile.WriteKey("NROITM",   realRoiTM,   "Number of slices per time-marker");
 
         const uint16_t realOffset = (h->NroiTM > h->Nroi) ?  h->NroiTM - 2*h->Nroi : 0;
-        fFile.WriteKey("OFFSET", realOffset, "Offset between pixels ROI and TM ROi"); //ETIENNE added
+        fFile.WriteKey("TMSHIFT",  realOffset,  "Shift of the start of the time marker readout wrt to data");
 
         //FIXME should we also put the start and stop time of the received data ?
         //now the events header related variables
         fFile.WriteKey("CAMERA",   "MGeomCamFACT", "");
-        fFile.WriteKey("DAQ",      "DRS4", "");
+        fFile.WriteKey("DAQ",      "DRS4",         "");
         fFile.WriteKey("ADCRANGE", 2000,        "Dynamic range in mV");
         fFile.WriteKey("ADC",      12,          "Resolution in bits");
-        fFile.WriteKey("TYPE",     d.name,      "File type according to FAD configuration (Config database)");
+        fFile.WriteKey("RUNTYPE",  d.name,      "File type according to FAD configuration");
 
         // Write a single key for:
@@ -138,5 +137,5 @@
 
             fFile.WriteKey("BOARD", i, "Board number for RUN, PRESC, PHASE and DAC");
-            fFile.WriteKey("RUN",   hh.runnumber, "Run number");
+            // fFile.WriteKey("RUN",   hh.runnumber, "Run number");
             fFile.WriteKey("PRESC", hh.trigger_generator_prescaler, "Trigger generator prescaler");
             fFile.WriteKey("PHASE", (int16_t)hh.adc_clock_phase_shift, "ADC clock phase shift");
