Index: trunk/FACT++/src/smartfact.cc
===================================================================
--- trunk/FACT++/src/smartfact.cc	(revision 13872)
+++ trunk/FACT++/src/smartfact.cc	(revision 13878)
@@ -365,4 +365,5 @@
 
     float fFtmPatchThresholdMed;
+    float fFtmBoardThresholdMed;
 
     bool fFtmControlFtuOk;
@@ -1120,23 +1121,74 @@
     int HandleFtmStaticData(const EventImp &d)
     {
-        if (!CheckDataSize(d, "FtmControl:StaticData", 740))
+        if (!CheckDataSize(d, "FtmControl:StaticData", sizeof(FTM::DimStaticData)))
             return GetCurrentState();
 
-        const uint16_t *ptr = d.Ptr<uint16_t>(260);
-        vector<uint16_t> vec(ptr, ptr+160);
-
-        WriteBinary(d, "ftmcontrol-thresholds", vec, 1000);
-
-        const Statistics stat(vec);
-
-        fFtmPatchThresholdMed = stat.med;
+        const FTM::DimStaticData &dat = d.Ref<FTM::DimStaticData>();
+
+        vector<uint16_t> vecp(dat.fThreshold, dat.fThreshold+160);
+        vector<uint16_t> vecb(dat.fMultiplicity, dat.fMultiplicity+40);
+
+        WriteBinary(d, "ftmcontrol-thresholds-patch", vecp, 1000);
+        WriteBinary(d, "ftmcontrol-thresholds-board", vecb, 1000);
+
+        const Statistics statp(vecp);
+        const Statistics statb(vecb);
+
+        fFtmPatchThresholdMed = statp.med;
+        fFtmBoardThresholdMed = statb.med;
 
         ostringstream out;
         out << d.GetJavaDate() << '\n';
-        out << kHtmlWhite << '\t' << stat.min << '\n';
-        out << kHtmlWhite << '\t' << stat.med << '\n';
-        out << kHtmlWhite << '\t' << stat.avg << '\n';
-        out << kHtmlWhite << '\t' << stat.max << '\n';
+        out << kHtmlWhite << '\t' << statb.min << '\n';
+        out << kHtmlWhite << '\t' << statb.med << '\n';
+        //out << kHtmlWhite << '\t' << statb.avg << '\n';
+        out << kHtmlWhite << '\t' << statb.max << '\n';
+        out << kHtmlWhite << '\t' << statp.min << '\n';
+        out << kHtmlWhite << '\t' << statp.med << '\n';
+        //out << kHtmlWhite << '\t' << statp.avg << '\n';
+        out << kHtmlWhite << '\t' << statp.max << '\n';
         ofstream(fPath+"/thresholds.txt") << out.str();
+
+        out.str("");
+        out << d.GetJavaDate() << '\n';
+        out << kHtmlWhite << '\t' << dat.fTriggerInterval << '\n';
+        out << kHtmlWhite << '\t';
+        if (dat.HasPedestal())
+            out << dat.fTriggerSeqPed;
+        else
+            out << "&ndash;";
+        out << ':';
+        if (dat.HasLPext())
+            out << dat.fTriggerSeqLPext;
+        else
+            out << "&ndash;";
+        out << ':';
+        if (dat.HasLPint())
+            out << dat.fTriggerSeqLPint;
+        else
+            out << "&ndash;";
+        out << '\n';
+
+        out << kHtmlWhite << '\t' << (dat.HasTrigger()?"on":"off") << " / " << (dat.HasExt1()?"on":"off") << " / " << (dat.HasExt2()?"on":"off") << '\n';
+        out << kHtmlWhite << '\t' << (dat.HasVeto()?"on":"off") << " / " << (dat.HasClockConditioner()?"time cal":"marker") << '\n';
+        out << kHtmlWhite << '\t' << dat.fMultiplicityPhysics << " / " << dat.fMultiplicityCalib << '\n';
+        out << kHtmlWhite << '\t' << dat.fWindowPhysics << '\t' << dat.fWindowCalib << '\n';
+        out << kHtmlWhite << '\t' << dat.fDelayTrigger << '\t' << dat.fDelayTimeMarker << '\n';
+        out << kHtmlWhite << '\t' << dat.fDeadTime << '\n';
+
+        int64_t vp = dat.fPrescaling[0];
+        for (int i=1; i<40; i++)
+            if (vp!=dat.fPrescaling[i])
+                vp = -1;
+
+        if (vp<0)
+            out << kHtmlYellow << "\tdifferent\n";
+        else
+            out << kHtmlWhite  << "\t" << 0.5*vp << "\n";
+
+        ofstream(fPath+"/ftm.txt") << out.str();
+
+        // Active FTUs: IsActive(i)
+        // Enabled Pix: IsEnabled(i)
 
         return GetCurrentState();
@@ -1329,4 +1381,5 @@
         out << setprecision(3);
         out << d.GetJavaDate() << '\n';
+        out << "#ffffff\t" << fFtmBoardThresholdMed << '\n';
         out << "#ffffff\t" << fFtmPatchThresholdMed << '\n';
         out << "#ffffff\t" << pow(10, fRateScanDataHist[0].back()) << '\n';
