Index: trunk/FACT++/src/DataCalib.cc
===================================================================
--- trunk/FACT++/src/DataCalib.cc	(revision 17329)
+++ trunk/FACT++/src/DataCalib.cc	(revision 17330)
@@ -1,5 +1,5 @@
 #include "DataCalib.h"
 
-#include "FAD.h"
+#include "EventBuilder.h"
 #include "FitsFile.h"
 #include "DimDescriptionService.h"
@@ -180,8 +180,10 @@
 }
 
-bool DataCalib::WriteEvt(const EVENT &e)
+bool DataCalib::WriteEvt(const EVT_CTRL2 &evt)
 {
     // FIXME: SET StartPix to 0 if StartPix is -1
 
+    const EVENT &e = *evt.fEvent;
+
     if (fData.fStep==0)
     {
@@ -197,5 +199,5 @@
     }
 
-    return DataWriteFits2::WriteEvt(e);
+    return DataWriteFits2::WriteEvt(evt);
 }
 
@@ -274,5 +276,5 @@
 }
 */
-bool DataCalib::Close(const RUN_TAIL *tail)
+bool DataCalib::Close(const EVT_CTRL2 &evt)
 {
     if (fNumEntries==0)
@@ -357,4 +359,4 @@
     fProcessing = false;
 
-    return DataWriteFits2::Close(tail);
-}
+    return DataWriteFits2::Close(evt);
+}
Index: trunk/FACT++/src/DataCalib.h
===================================================================
--- trunk/FACT++/src/DataCalib.h	(revision 17329)
+++ trunk/FACT++/src/DataCalib.h	(revision 17330)
@@ -38,6 +38,6 @@
 
     bool Open(const RUN_HEAD &h, const FAD::RunDescription &d);
-    bool WriteEvt(const EVENT &e);
-    bool Close(const RUN_TAIL * = 0);
+    bool WriteEvt(const EVT_CTRL2 &);
+    bool Close(const EVT_CTRL2 &);
 
     //static void Apply(int16_t *val, const int16_t *start, uint32_t roi);
Index: trunk/FACT++/src/DataProcessorImp.cc
===================================================================
--- trunk/FACT++/src/DataProcessorImp.cc	(revision 17329)
+++ trunk/FACT++/src/DataProcessorImp.cc	(revision 17330)
@@ -2,5 +2,5 @@
 
 #include "HeadersFAD.h"
-#include "FAD.h"
+#include "EventBuilder.h"
 #include "tools.h"
 
@@ -67,5 +67,5 @@
 }
 
-bool DataDump::WriteEvt(const EVENT &e)
+bool DataDump::WriteEvt(const EVT_CTRL2 &e)
 {
     const Time now;
@@ -76,5 +76,5 @@
 
     ostringstream str;
-    str << this << " - EVENT #" << e.EventNum << " / " << e.TriggerNum;
+    str << this << " - EVENT #" << e.evNum << " / " << e.trgNum;
     Debug(str);
 
@@ -82,5 +82,5 @@
 }
 
-bool DataDump::Close(const RUN_TAIL *)
+bool DataDump::Close(const EVT_CTRL2 &)
 {
     ostringstream str;
@@ -94,10 +94,10 @@
 // =======================================================================
 
-bool DataDebug::WriteEvt(const EVENT &e)
+bool DataDebug::WriteEvt(const EVT_CTRL2 &e)
 {
-    cout << "WRITE_EVENT #" << GetRunId() << " (" << e.EventNum << ")" << endl;
-    cout << " Typ=" << e.TriggerType << endl;
-    cout << " roi=" << e.Roi << endl;
-    cout << " tim=" << e.PCTime << endl;
+    cout << "WRITE_EVENT #" << GetRunId() << " (" << e.evNum << ")" << endl;
+    cout << " Typ=" << e.trgTyp << endl;
+    cout << " roi=" << e.nRoi << endl;
+    cout << " tim=" << e.time.tv_sec << endl;
 
     return true;
Index: trunk/FACT++/src/DataProcessorImp.h
===================================================================
--- trunk/FACT++/src/DataProcessorImp.h	(revision 17329)
+++ trunk/FACT++/src/DataProcessorImp.h	(revision 17330)
@@ -5,6 +5,6 @@
 
 struct RUN_HEAD;
-struct _EVENT;
-struct _RUN_TAIL;
+struct EVT_CTRL2;
+struct RUN_CTRL2;
 
 namespace FAD
@@ -12,7 +12,4 @@
     struct RunDescription;
 };
-
-typedef struct _EVENT    EVENT;
-typedef struct _RUN_TAIL RUN_TAIL;
 
 class DataProcessorImp : public MessageImp
@@ -36,6 +33,6 @@
 
     virtual bool Open(const RUN_HEAD &h, const FAD::RunDescription &desc) = 0;
-    virtual bool WriteEvt(const EVENT &) = 0;
-    virtual bool Close(const RUN_TAIL * = 0) = 0;
+    virtual bool WriteEvt(const EVT_CTRL2 &) = 0;
+    virtual bool Close(const EVT_CTRL2 &) = 0;
 
     const std::string &GetFileName() const { return fFileName; }
@@ -62,6 +59,6 @@
 
     bool Open(const RUN_HEAD &h, const FAD::RunDescription &d);
-    bool WriteEvt(const EVENT &e);
-    bool Close(const RUN_TAIL * = 0);
+    bool WriteEvt(const EVT_CTRL2 &);
+    bool Close(const EVT_CTRL2 &);
 };
 
@@ -71,5 +68,5 @@
     DataDebug(const std::string &path, uint64_t night, uint32_t id, MessageImp &imp) : DataDump(path, night, id, imp) { }
 
-    bool WriteEvt(const EVENT &e);
+    bool WriteEvt(const EVT_CTRL2 &);
 };
 
Index: trunk/FACT++/src/DataWriteRaw.cc
===================================================================
--- trunk/FACT++/src/DataWriteRaw.cc	(revision 17329)
+++ trunk/FACT++/src/DataWriteRaw.cc	(revision 17330)
@@ -2,5 +2,5 @@
 
 #include "HeadersFAD.h"
-#include "FAD.h"
+#include "EventBuilder.h"
 
 using namespace std;
@@ -79,6 +79,8 @@
 }
 
-bool DataWriteRaw::WriteEvt(const EVENT &e)
+bool DataWriteRaw::WriteEvt(const EVT_CTRL2 &evt)
 {
+    const EVENT &e = *evt.fEvent;
+
     const int sh = sizeof(EVENT)-2 + NPIX*e.Roi*2;
 
@@ -88,8 +90,9 @@
 }
 
-bool DataWriteRaw::Close(const RUN_TAIL *tail)
+bool DataWriteRaw::Close()
 {
     WriteBlockHeader(kEndOfFile, 0, 0, 0);
 
+    /*
     if (tail)
     {
@@ -97,6 +100,6 @@
 
         WriteValue(uint32_t(1));
-        fOut.write(reinterpret_cast<const char*>(tail), 0/*sizeof(RUN_TAIL)*/);
-    }
+        fOut.write(reinterpret_cast<const char*>(tail), sizeof(RUN_TAIL));
+    }*/
 
     if (!fOut)
Index: trunk/FACT++/src/DataWriteRaw.h
===================================================================
--- trunk/FACT++/src/DataWriteRaw.h	(revision 17329)
+++ trunk/FACT++/src/DataWriteRaw.h	(revision 17330)
@@ -82,6 +82,7 @@
 
     bool Open(const RUN_HEAD &h, const FAD::RunDescription &d);
-    bool WriteEvt(const EVENT &evt);
-    bool Close(const RUN_TAIL *tail= 0);
+    bool WriteEvt(const EVT_CTRL2 &);
+    bool Close(const EVT_CTRL2 &) { return Close(); }
+    bool Close();
 };
 
