Index: /trunk/FACT++/gui/FactGui.h
===================================================================
--- /trunk/FACT++/gui/FactGui.h	(revision 11126)
+++ /trunk/FACT++/gui/FactGui.h	(revision 11127)
@@ -387,4 +387,5 @@
     DimStampedInfo fDimFadEvents;
     DimStampedInfo fDimFadCurrentEvent;
+    DimStampedInfo fDimFadEventData;
     DimStampedInfo fDimFadConnections;
 
@@ -960,7 +961,86 @@
     }
 
+    struct DimEventData
+    {
+	uint16_t Roi ;            // #slices per pixel (same for all pixels and tmarks)
+	uint32_t EventNum ;       // EventNumber as from FTM
+	uint16_t TriggerType ;    // Trigger Type from FTM
+
+	uint32_t PCTime ;         // when did event start to arrive at PC
+	uint32_t BoardTime;       //
+
+	int16_t StartPix;         // First Channel per Pixel (Pixels sorted according Software ID)  ; -1 if not filled
+	int16_t StartTM;          // First Channel for TimeMark (sorted Hardware ID) ; -1 if not filled
+
+	uint16_t Adc_Data[];     // final length defined by malloc ....
+
+    } __attribute__((__packed__));;
+
+    void handleFadEventData(const DimData &d)
+    {
+	if (d.size()==0)
+            return;
+
+#ifdef HAVE_ROOT
+	const DimEventData &dat = d.ref<DimEventData>();
+
+        if (d.size()<sizeof(DimEventData))
+        {
+            cout << "Size mismatch in " << d.name << ": Found=" << d.size() << " Expected=" << sizeof(DimEventData) << endl;
+            return;
+        }
+
+        if (d.size()!=dat.Roi*2+sizeof(DimEventData))
+        {
+            cout << "Size mismatch in " << d.name << ": Found=" << d.size() << " Expected=" << dat.Roi*2+sizeof(DimEventData) << endl;
+            return;
+        }
+
+	TCanvas *c = fAdcDataCanv->GetCanvas();
+
+	TH1 *h = dynamic_cast<TH1*>(c->FindObject("EventData"));
+	if (h && h->GetNbinsX()!=dat.Roi)
+	{
+	    delete h;
+	    h = 0;
+	}
+
+	if (!h)
+	{
+	    c->cd();
+
+	    TH1D hist("EventData", "", dat.Roi, -0.5, dat.Roi-0.5);
+	    hist.SetStats(kFALSE);
+	    //hist->SetBit(TH1::kNoTitle);
+	    hist.SetMarkerStyle(kFullDotMedium);
+	    hist.SetYTitle("Voltage [mV]");
+	    hist.GetXaxis()->CenterTitle();
+	    hist.GetYaxis()->CenterTitle();
+	    hist.SetMinimum(-1025);
+	    hist.SetMaximum(1025);
+	    h = hist.DrawCopy("P");
+	    h->SetDirectory(0);
+
+	}
+
+	ostringstream str;
+	str << "ADC Pipeline (start=" << dat.StartTM << ")";
+	h->SetXTitle(str.str().c_str());
+
+	//str.str("");
+	//str << "Crate=" << crate << " Board=" << board << " Channel=" << channel << " [" << d.time() << "]" << endl;
+	//hist->SetTitle(str.str().c_str());
+
+	for (int i=0; i<dat.Roi; i++)
+	    h->SetBinContent(i+1, dat.Adc_Data[i]-1024);
+
+	c->Modified();
+	c->Update();
+#endif
+    }
+
     void handleFadConnections(const DimData &d)
     {
-        if (!CheckSize(d, 40))
+        if (!CheckSize(d, 41))
             return;
 
@@ -976,46 +1056,7 @@
             }
         }
-    }
-
-    /*
-     TCanvas *c = fAdcDataCanv->GetCanvas();
-
-     TH1D *hist = c->FindObject("Hist");
-     if (hist && hist->GetNbinsX()!=...)
-     {
-         delete hist;
-         hist = 0;
-
-     }
-     if (!hist)
-     {
-         hist = new TH1D("Hist", "", n, -0.5, n-0.5);
-         hist->SetStats(kFALSE);
-         hist->SetDirectory(0);
-         //hist->SetBit(TH1::kNoTitle);
-         hist->SetBit(kCanDelete);
-         hist->SetMarkerStyle(kFullDotMedium);
-         hist->SetYTitle("Voltage [mV]");
-         hist->GetXaxis()->CenterTitle();
-         hist->GetYaxis()->CenterTitle();
-         hist->SetMinimum(-1025);
-         hist->SetMaximum(1025);
-         hist->Draw("P");
-     }
-
-     ostringstream str;
-     str << "ADC Pipeline (start=" << startbin << ")";
-     hist->SetXTitle(str.str().c_str());
-
-     str.str("");
-     str << "Crate=" << crate << " Board=" << board << " Channel=" << channel << " [" << d.time() << "]" << endl;
-     hist->SetTitle(str.str().c_str());
-
-     for (int i=0; i<n; i++)
-        hist->SetBinContent(i+1, value[i]-1024);
-
-     c->Modified();
-     c->Update();
-     */
+
+        SetLedColor(fFadLEDEventBuilder, ptr[40]==0?kLedRed:kLedGreen, d.time);
+    }
 
     // ===================== FTM ============================================
@@ -1077,5 +1118,5 @@
             return;
 
-        const double avgrate = sdata.fTimeStamp>0 ? double(sdata.fTriggerCounter)/sdata.fTimeStamp*1000000 : 1;
+//        const double avgrate = sdata.fTimeStamp>0 ? double(sdata.fTriggerCounter)/sdata.fTimeStamp*1000000 : 1;
 
         const double t1 = h->GetXaxis()->GetXmax();
@@ -1800,4 +1841,7 @@
             return PostInfoHandler(&FactGui::handleFadCurrentEvent);
 
+	if (getInfo()==&fDimFadEventData)
+            return PostInfoHandler(&FactGui::handleFadEventData);
+
 /*
         if (getInfo()==&fDimFadSetup)
@@ -2223,11 +2267,11 @@
         fDimFadEvents        ("FAD_CONTROL/EVENTS",          (void*)NULL, 0, this),
         fDimFadCurrentEvent  ("FAD_CONTROL/CURRENT_EVENT",   (void*)NULL, 0, this),
+        fDimFadEventData     ("FAD_CONTROL/EVENT_DATA",      (void*)NULL, 0, this),
         fDimFadConnections   ("FAD_CONTROL/CONNECTIONS",     (void*)NULL, 0, this)
     {
-        fClockCondFreq->addItem("-/-", QVariant(-1));
-        fClockCondFreq->addItem("700 MHz", QVariant(700));
+        fClockCondFreq->addItem("--- Hz",  QVariant(-1));
+        fClockCondFreq->addItem("800 MHz", QVariant(800));
         fClockCondFreq->addItem("1 GHz",   QVariant(1000));
         fClockCondFreq->addItem("2 GHz",   QVariant(2000));
-        fClockCondFreq->addItem("2 GHz (*)",   QVariant(2001));
         fClockCondFreq->addItem("3 GHz",   QVariant(3000));
         fClockCondFreq->addItem("4 GHz",   QVariant(4000));
Index: /trunk/FACT++/src/EventBuilderWrapper.h
===================================================================
--- /trunk/FACT++/src/EventBuilderWrapper.h	(revision 11126)
+++ /trunk/FACT++/src/EventBuilderWrapper.h	(revision 11127)
@@ -719,4 +719,5 @@
     DimDescribedService fDimEvents;
     DimDescribedService fDimCurrentEvent;
+    DimDescribedService fDimEventData;
 
     bool fDebugStream;
@@ -735,6 +736,7 @@
         fDimEvents("FAD_CONTROL/EVENTS",        "I:2", ""),
         fDimCurrentEvent("FAD_CONTROL/CURRENT_EVENT", "I:1", ""),
+	fDimEventData("FAD_CONTROL/EVENT_DATA", "S:1;I:1;S:1;I:2;S:1;S", ""),
         fDebugStream(false), fDebugRead(false)
-    {
+   {
         if (This)
             throw logic_error("EventBuilderWrapper cannot be instantiated twice.");
@@ -1083,4 +1085,151 @@
     }
 
+    	struct DimEventData
+	{
+	    uint16_t Roi ;            // #slices per pixel (same for all pixels and tmarks)
+	    uint32_t EventNum ;       // EventNumber as from FTM
+	    uint16_t TriggerType ;    // Trigger Type from FTM
+
+	    uint32_t PCTime ;         // when did event start to arrive at PC
+	    uint32_t BoardTime;       //
+
+	    int16_t StartPix;         // First Channel per Pixel (Pixels sorted according Software ID)  ; -1 if not filled
+	    int16_t StartTM;          // First Channel for TimeMark (sorted Hardware ID) ; -1 if not filled
+
+	    uint16_t Adc_Data[];     // final length defined by malloc ....
+
+	} __attribute__((__packed__));;
+
+        template<typename T>
+        vector<T> Check(const PEVNT_HEADER *fadhd, const T &val, bool &rc)
+        {
+            const size_t offset = reinterpret_cast<const char*>(&val)-reinterpret_cast<const char*>(fadhd);
+
+            vector<T> vec(40);
+
+            vec[0] = val;
+
+            rc = true;
+            for (int i=1; i<40; i++)
+            {
+
+                const T &t = *reinterpret_cast<const T*>(reinterpret_cast<const char*>(fadhd+i)+offset);
+                if (t!=val)
+                    rc = false;
+
+                vec[i] = t;
+            }
+
+            return vec;
+        }
+
+        template<typename T>
+        vector<uint8_t> CheckBits(const PEVNT_HEADER *fadhd, const T &val, T &rc)
+        {
+            const size_t offset = reinterpret_cast<const char*>(&val)-reinterpret_cast<const char*>(fadhd);
+
+            vector<uint8_t> vec(40);
+
+            rc = 0;
+            for (int i=0; i<40; i++)
+            {
+                const T &t = *reinterpret_cast<const T*>(reinterpret_cast<const char*>(fadhd+i)+offset);
+
+                rc |= val^t;
+
+                vec[i] = t;
+            }
+
+            // Return 1 for all bits which are identical
+            //        0 for all other bits
+            rc = ~rc;
+            return vec;
+        }
+
+
+    int eventCheck(PEVNT_HEADER *fadhd, EVENT *event)
+    {
+        /*
+         fadhd[i] ist ein array mit den 40 fad-headers
+         (falls ein board nicht gelesen wurde, ist start_package_flag =0 )
+
+         event  ist die Struktur, die auch die write routine erhaelt;
+         darin sind im header die 'soll-werte' fuer z.B. eventID
+         als auch die ADC-Werte (falls Du die brauchst)
+
+         Wenn die routine einen negativen Wert liefert, wird das event
+         geloescht (nicht an die write-routine weitergeleitet [mind. im Prinzip]
+         */
+
+        bool     ok_verno;
+        bool     ok_runno;
+        uint16_t ok_bitmask;
+
+        const vector<uint16_t> verno   = Check(fadhd, fadhd->version_no, ok_verno);
+        const vector<uint32_t> runno   = Check(fadhd, fadhd->runnumber,  ok_runno);
+        const vector<uint8_t>  bitmask = CheckBits(fadhd, fadhd->PLLLCK, ok_bitmask);
+
+        /*
+         uint16_t start_package_flag;
+         uint16_t package_length;
+         uint16_t version_no;
+         uint16_t PLLLCK;
+
+         uint16_t trigger_crc;
+         uint16_t trigger_type;
+         uint32_t trigger_id;
+
+         uint32_t fad_evt_counter;
+         uint32_t REFCLK_frequency;
+
+         uint16_t board_id;
+         uint8_t  zeroes;
+         int8_t   adc_clock_phase_shift;
+         uint16_t number_of_triggers_to_generate;
+         uint16_t trigger_generator_prescaler;
+
+         uint64_t DNA;
+
+         uint32_t time;
+         uint32_t runnumber;
+
+         int16_t  drs_temperature[NTemp];
+
+         uint16_t dac[NDAC];
+         */
+
+	static DimEventData *data = 0;
+
+	const size_t sz = sizeof(DimEventData)+event->Roi*2;
+
+	if (data && data->Roi != event->Roi)
+	{
+	    delete data;
+	    data = 0;
+	}
+
+        if (!data)
+	    data = reinterpret_cast<DimEventData*>(new char[sz]);
+
+//        cout << sizeof(DimEventData) << " " << event->Roi << " " << sz << " " << sizeof(*data) << endl;
+
+	data->Roi         = event->Roi;
+	data->EventNum    = event->EventNum;
+	data->TriggerType = event->TriggerType;
+	data->PCTime      = event->PCTime;
+	data->BoardTime   = event->BoardTime[0];
+	data->StartPix    = event->StartPix[0];
+	data->StartTM     = event->StartTM[0];
+
+        memcpy(data->Adc_Data, event->Adc_Data, event->Roi*2);
+
+        fDimEventData.setData(data, sz);
+	fDimEventData.updateService();
+
+        //delete data;
+
+	return 0;
+    }
+
 };
 
@@ -1151,17 +1300,5 @@
     int eventCheck(PEVNT_HEADER *fadhd, EVENT *event)
     {
-        /*
-         fadhd[i] ist ein array mit den 40 fad-headers
-         (falls ein board nicht gelesen wurde, ist start_package_flag =0 )
-
-         event  ist die Struktur, die auch die write routine erhaelt;
-         darin sind im header die 'soll-werte' fuer z.B. eventID
-         als auch die ADC-Werte (falls Du die brauchst)
-
-         Wenn die routine einen negativen Wert liefert, wird das event
-         geloescht (nicht an die write-routine weitergeleitet [mind. im Prinzip]
-         */
-
-        return 0;
+        return EventBuilderWrapper::This->eventCheck(fadhd, event);
     }
 }
Index: /trunk/FACT++/src/fadctrl.cc
===================================================================
--- /trunk/FACT++/src/fadctrl.cc	(revision 11126)
+++ /trunk/FACT++/src/fadctrl.cc	(revision 11127)
@@ -1173,7 +1173,7 @@
     }
 
-    bool            fStatusT;
     vector<uint8_t> fStatus1;
     vector<uint8_t> fStatus2;
+    bool            fStatusT;
 
     int Execute()
@@ -1197,5 +1197,5 @@
         vector<uint8_t> stat2(40);
 
-        int cnt = 0; // counter for enbled board
+        int cnt = 0; // counter for enabled board
 
         for (int idx=0; idx<40; idx++)
Index: /trunk/FACT++/src/ftmctrl.cc
===================================================================
--- /trunk/FACT++/src/ftmctrl.cc	(revision 11126)
+++ /trunk/FACT++/src/ftmctrl.cc	(revision 11127)
@@ -1429,18 +1429,17 @@
         //map<uint32_t,uint32_t>::const_iterator = fClockConditionerMap.find(freq);
 
-        static const uint64_t R1  = 0x00010101;
-        static const uint64_t R8  = 0x10000908;
-        static const uint64_t R9  = 0xa0032a09;
-        static const uint64_t R11 = 0x0082000b;
-        static const uint64_t R13 = 0x020a000d;
-
-        static const uint64_t freq0700[8] = { 0x0003e000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400f50f };
-        static const uint64_t freq1000[8] = { 0x0003a000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f };
-        static const uint64_t freq2000[8] = { 0x00035000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f };
-        static const uint64_t freq2001[8] = { 0x00038000, R1, R8, R9, R11, R13, 0x0830280e, 0x1400fa0f };
-        static const uint64_t freq3000[8] = { 0x00037200, R1, R8, R9, R11, R13, 0x0830400e, 0x1420a30f };
-//      static const uint64_t freq4000[8] = { 0x00032800, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f };
-        static const uint64_t freq4000[8] = { 0x00034000, R1, R8, R9, R11, R13, 0x0830280e, 0x1400fa0f };
-        static const uint64_t freq5000[8] = { 0x00032000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f };
+        static const uint64_t R0hi  = 0x00030000;
+        static const uint64_t R8    = 0x10000908;
+        static const uint64_t R9    = 0xa0032a09;
+        static const uint64_t R11   = 0x0082000b;
+        static const uint64_t R13   = 0x020a000d;
+        static const uint64_t R14hi = 0x08300000;
+
+        static const uint64_t freq0800[8] = { R0hi|0xfe00, 0x00010101, R8, R9, R11, R13, R14hi|0x800e, 0x14027b0f };
+        static const uint64_t freq1000[8] = { R0hi|0xd000, 0x00010101, R8, R9, R11, R13, R14hi|0x400e, 0x1401450f };
+        static const uint64_t freq2000[8] = { R0hi|0x8000, 0x00010101, R8, R9, R11, R13, R14hi|0x280e, 0x1400fa0f };
+        static const uint64_t freq3000[8] = { R0hi|0x9000, 0x00030101, R8, R9, R11, R13, R14hi|0x400e, 0x1402a30f };
+        static const uint64_t freq4000[8] = { R0hi|0x4000, 0x00010100, R8, R9, R11, R13, R14hi|0x280e, 0x1400fa0f };
+        static const uint64_t freq5000[8] = { R0hi|0x8000, 0x00030200, R8, R9, R11, R13, R14hi|0x280e, 0x1402710f };
 
         const uint64_t *reg = 0;
@@ -1448,8 +1447,7 @@
         switch (freq)
         {
-        case  700: reg = freq0700; break;
+        case  800: reg = freq0800; break;
         case 1000: reg = freq1000; break;
         case 2000: reg = freq2000; break;
-        case 2001: reg = freq2001; break;
         case 3000: reg = freq3000; break;
         case 4000: reg = freq4000; break;
