Index: trunk/FACT++/src/HeadersFTM.h
===================================================================
--- trunk/FACT++/src/HeadersFTM.h	(revision 11546)
+++ trunk/FACT++/src/HeadersFTM.h	(revision 11563)
@@ -175,4 +175,5 @@
             kMaxDelayTrigger    = 0x3ff,   ///< (4ns * x + 8ns)
             kMaxTriggerInterval = 0x3ff,   ///< 
+            kMaxIntensity       = 0x7f,
             kMaxSequence        = 0x1f,
             kMaxDAC             = 0xfff,
@@ -206,8 +207,8 @@
         uint16_t fTriggerInterval;         /// [ms] Interval between two artificial triggers (no matter which type) minimum 1ms, 10 bit
         uint16_t fTriggerSequence;         /// Ratio between trigger types send as artificial trigger (in this order) 3x5bit
-        uint8_t  fEnableLpExt;             /// Enable for LED group 1/2 (LightPulserEnable)
-        uint8_t  fIntensityLpExt;          /// Intensity of LEDs (0-127)
-        uint8_t  fEnableLpInt;             /// Enable for LED group 1/2 (LightPulserEnable)
-        uint8_t  fIntensityLpInt;          /// Intensity of LEDs (0-127)
+        uint8_t  fEnableLPext;             /// Enable for LED group 1/2 (LightPulserEnable)
+        uint8_t  fIntensityLPext;          /// Intensity of LEDs (0-127)
+        uint8_t  fEnableLPint;             /// Enable for LED group 1/2 (LightPulserEnable)
+        uint8_t  fIntensityLPint;          /// Intensity of LEDs (0-127)
         uint32_t fDummy0;
         uint16_t fMultiplicityPhysics;     /// Required trigger multiplicity for physcis triggers (0-40)
@@ -259,4 +260,20 @@
         void EnableAllFTU()    { for (int i=0; i<4; i++) fActiveFTU[i] = 0x3ff; }
         void DisableAllFTU()   { for (int i=0; i<4; i++) fActiveFTU[i] = 0;     }
+
+        void EnableLPint(LightPulserEnable group, bool enable)
+        {
+            if (enable)
+                fEnableLPint |= group;
+            else
+                fEnableLPint &= ~group;
+        }
+
+        void EnableLPext(LightPulserEnable group, bool enable)
+        {
+            if (enable)
+                fEnableLPext |= group;
+            else
+                fEnableLPext &= ~group;
+        }
 
         void ToggleFTU(int i)  { fActiveFTU[i/10] ^= (1<<(i%10)); }
Index: trunk/FACT++/src/ftmctrl.cc
===================================================================
--- trunk/FACT++/src/ftmctrl.cc	(revision 11546)
+++ trunk/FACT++/src/ftmctrl.cc	(revision 11563)
@@ -955,4 +955,43 @@
     }
 
+    bool EnableLP(FTM::StaticData::GeneralSettings lp, FTM::StaticData::LightPulserEnable group, bool enable)
+    {
+        if (lp!=FTM::StaticData::kLPint && lp!=FTM::StaticData::kLPext)
+            return false;
+
+        FTM::StaticData data(fStaticData);
+
+        if (lp==FTM::StaticData::kLPint)
+            data.EnableLPint(group, enable);
+
+        if (lp==FTM::StaticData::kLPext)
+            data.EnableLPext(group, enable);
+
+        CmdSendStatDat(data);
+
+        return true;
+    }
+
+    bool SetIntensity(FTM::StaticData::GeneralSettings lp, uint16_t intensity)
+    {
+        if (intensity>FTM::StaticData::kMaxIntensity)
+            return false;
+
+        if (lp!=FTM::StaticData::kLPint && lp!=FTM::StaticData::kLPext)
+            return false;
+
+        FTM::StaticData data(fStaticData);
+
+        if (lp==FTM::StaticData::kLPint)
+            data.fIntensityLPint = intensity;
+
+        if (lp==FTM::StaticData::kLPext)
+            data.fIntensityLPext = intensity;
+
+        CmdSendStatDat(data);
+
+        return true;
+    }
+
     bool EnablePixel(int16_t idx, bool enable)
     {
@@ -1523,4 +1562,26 @@
     }
 
+    int EnableLP(const EventImp &evt, FTM::StaticData::GeneralSettings lp, FTM::StaticData::LightPulserEnable group)
+    {
+        if (!CheckEventSize(evt.GetSize(), "EnableLP", 1))
+            return T::kSM_FatalError;
+
+        if (!fFTM.EnableLP(lp, group, evt.GetBool()))
+            T::Warn("EnableLP - Invalid light pulser id.");
+
+        return T::GetCurrentState();
+    }
+
+    int SetIntensity(const EventImp &evt, FTM::StaticData::GeneralSettings lp)
+    {
+        if (!CheckEventSize(evt.GetSize(), "SetIntensity", 2))
+            return T::kSM_FatalError;
+
+        if (!fFTM.SetIntensity(lp, evt.GetShort()))
+            T::Warn("SetIntensity - Value out of range.");
+
+        return T::GetCurrentState();
+    }
+
     int Enable(const EventImp &evt, FTM::StaticData::GeneralSettings type)
     {
@@ -1914,4 +1975,24 @@
             ("Enable clock conidtioner output in favor of time marker output"
              "|Enable[bool]:Enable clock conditioner (yes/no)");
+
+        T::AddEvent("ENABLE_GROUP1_LPINT", "B:1", FTM::kIdle)
+            (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPint, FTM::StaticData::kGroup1))
+            ("");
+        T::AddEvent("ENABLE_GROUP1_LPEXT", "B:1", FTM::kIdle)
+            (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPext, FTM::StaticData::kGroup1))
+            ("");
+        T::AddEvent("ENABLE_GROUP2_LPINT", "B:1", FTM::kIdle)
+            (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPint, FTM::StaticData::kGroup2))
+            ("");
+        T::AddEvent("ENABLE_GROUP2_LPEXT", "B:1", FTM::kIdle)
+            (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPext, FTM::StaticData::kGroup2))
+            ("");
+        T::AddEvent("SET_INTENSITY_LPINT", "S:1", FTM::kIdle)
+            (bind(&StateMachineFTM::SetIntensity, this, placeholders::_1, FTM::StaticData::kLPint))
+            ("");
+        T::AddEvent("SET_INTENSITY_LPEXT", "S:1", FTM::kIdle)
+            (bind(&StateMachineFTM::SetIntensity, this, placeholders::_1, FTM::StaticData::kLPext))
+            ("");
+
 
         T::AddEvent("SET_TRIGGER_SEQUENCE", "S:3", FTM::kIdle)
@@ -2124,45 +2205,58 @@
             // Trigger sequence ped:lp1:lp2
             // (data. is used here as an abbreviation for FTM::StaticData::
-            if (!CheckConfigVal<bool>    (conf, true,                     "enable-trigger.",             *it) ||
-                !CheckConfigVal<bool>    (conf, true,                     "enable-external-1.",          *it) ||
-                !CheckConfigVal<bool>    (conf, true,                     "enable-external-2.",          *it) ||
-                !CheckConfigVal<bool>    (conf, true,                     "enable-veto.",                *it) ||
-                !CheckConfigVal<bool>    (conf, true,                     "enable-clock-conditioner.",   *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxSequence,        "trigger-sequence-ped.",       *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxSequence,        "trigger-sequence-lp-ext.",    *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxSequence,        "trigger-sequence-lp-int.",    *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxTriggerInterval, "trigger-interval.",           *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxMultiplicity,    "multiplicity-physics.",       *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxMultiplicity,    "multiplicity-calib.",         *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxWindow,          "coincidence-window-physics.", *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxWindow,          "coincidence-window-calib.",   *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxDeadTime,        "dead-time.",                  *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxDelayTrigger,    "trigger-delay.",              *it) ||
-                !CheckConfigVal<uint16_t>(conf, data.kMaxDelayTimeMarker, "time-marker-delay.",          *it) ||
-                !CheckConfigVal<uint16_t>(conf, 0xffff,                   "ftu-report-interval.",        *it) ||
+            if (!CheckConfigVal<bool>    (conf, true,                     "trigger.enable-trigger.",              *it) ||
+                !CheckConfigVal<bool>    (conf, true,                     "trigger.enable-external-1.",           *it) ||
+                !CheckConfigVal<bool>    (conf, true,                     "trigger.enable-external-2.",           *it) ||
+                !CheckConfigVal<bool>    (conf, true,                     "trigger.enable-veto.",                 *it) ||
+                !CheckConfigVal<bool>    (conf, true,                     "trigger.enable-clock-conditioner.",    *it) ||
+                !CheckConfigVal<bool>    (conf, true,                     "light-pulser.external.enable-group1.", *it) ||
+                !CheckConfigVal<bool>    (conf, true,                     "light-pulser.external.enable-group2.", *it) ||
+                !CheckConfigVal<bool>    (conf, true,                     "light-pulser.internal.enable-group1.", *it) ||
+                !CheckConfigVal<bool>    (conf, true,                     "light-pulser.internal.enable-group2.", *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxSequence,        "trigger.sequence.pedestal.",           *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxSequence,        "trigger.sequence.lp-ext.",             *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxSequence,        "trigger.sequence.lp-int.",             *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxTriggerInterval, "trigger.sequence.interval.",           *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxMultiplicity,    "trigger.multiplicity-physics.",        *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxMultiplicity,    "trigger.multiplicity-calib.",          *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxWindow,          "trigger.coincidence-window-physics.",  *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxWindow,          "trigger.coincidence-window-calib.",    *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxDeadTime,        "trigger.dead-time.",                   *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxDelayTrigger,    "trigger.delay.",                       *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxDelayTimeMarker, "trigger.time-marker-delay.",           *it) ||
+                !CheckConfigVal<uint16_t>(conf, 0xffff,                   "ftu-report-interval.",                 *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxIntensity,       "light-pulser.external.intensity.",     *it) ||
+                !CheckConfigVal<uint16_t>(conf, data.kMaxIntensity,       "light-pulser.internal.intensity.",     *it) ||
                 0)
                 return 2;
 
-            data.Enable(data.kTrigger,          conf.GetDef<bool>("enable-trigger.",           *it));
-            data.Enable(data.kExt1,             conf.GetDef<bool>("enable-external-1.",        *it));
-            data.Enable(data.kExt2,             conf.GetDef<bool>("enable-external-2.",        *it));
-            data.Enable(data.kVeto,             conf.GetDef<bool>("enable-veto.",              *it));
-            data.Enable(data.kClockConditioner, conf.GetDef<bool>("enable-clock-conditioner.", *it));
+            data.Enable(data.kTrigger,          conf.GetDef<bool>("trigger.enable-trigger.",           *it));
+            data.Enable(data.kExt1,             conf.GetDef<bool>("trigger.enable-external-1.",        *it));
+            data.Enable(data.kExt2,             conf.GetDef<bool>("trigger.enable-external-2.",        *it));
+            data.Enable(data.kVeto,             conf.GetDef<bool>("trigger.enable-veto.",              *it));
+            data.Enable(data.kClockConditioner, conf.GetDef<bool>("trigger.enable-clock-conditioner.", *it));
+
+            data.EnableLPint(data.kGroup1, conf.GetDef<bool>("light-pulser.internal.enable-group1.", *it));
+            data.EnableLPint(data.kGroup2, conf.GetDef<bool>("light-pulser.internal.enable-group2.", *it));
+            data.EnableLPext(data.kGroup1, conf.GetDef<bool>("light-pulser.external.enable-group1.", *it));
+            data.EnableLPext(data.kGroup2, conf.GetDef<bool>("light-pulser.external.enable-group2.", *it));
 
             // [ms] Interval between two artificial triggers (no matter which type) minimum 1ms, 10 bit
-            data.fTriggerInterval     = conf.GetDef<uint16_t>("trigger-interval.",           *it);
-            data.fMultiplicityPhysics = conf.GetDef<uint16_t>("multiplicity-physics.",       *it);
-            data.fMultiplicityCalib   = conf.GetDef<uint16_t>("multiplicity-calib.",         *it);
-            data.fWindowPhysics       = conf.GetDef<uint16_t>("coincidence-window-physics.", *it); /// (4ns * x + 8ns)
-            data.fWindowCalib         = conf.GetDef<uint16_t>("coincidence-window-calib.",   *it); /// (4ns * x + 8ns)
-            data.fDelayTrigger        = conf.GetDef<uint16_t>("trigger-delay.",              *it); /// (4ns * x + 8ns)
-            data.fDelayTimeMarker     = conf.GetDef<uint16_t>("time-marker-delay.",          *it); /// (4ns * x + 8ns)
-            data.fDeadTime            = conf.GetDef<uint16_t>("dead-time.",                  *it); /// (4ns * x + 8ns)
+            data.fIntensityLPint      = conf.GetDef<uint16_t>("light-pulser.internal.intensity.", *it);
+            data.fIntensityLPext      = conf.GetDef<uint16_t>("light-pulser.external.intensity.", *it);
+            data.fTriggerInterval     = conf.GetDef<uint16_t>("trigger.sequence.interval.",          *it);
+            data.fMultiplicityPhysics = conf.GetDef<uint16_t>("trigger.multiplicity-physics.",       *it);
+            data.fMultiplicityCalib   = conf.GetDef<uint16_t>("trigger.multiplicity-calib.",         *it);
+            data.fWindowPhysics       = conf.GetDef<uint16_t>("trigger.coincidence-window-physics.", *it); /// (4ns * x + 8ns)
+            data.fWindowCalib         = conf.GetDef<uint16_t>("trigger.coincidence-window-calib.",   *it); /// (4ns * x + 8ns)
+            data.fDelayTrigger        = conf.GetDef<uint16_t>("trigger.delay.",              *it); /// (4ns * x + 8ns)
+            data.fDelayTimeMarker     = conf.GetDef<uint16_t>("trigger.time-marker-delay.",  *it); /// (4ns * x + 8ns)
+            data.fDeadTime            = conf.GetDef<uint16_t>("trigger.dead-time.",          *it); /// (4ns * x + 8ns)
 
             data.SetPrescaling(conf.GetDef<uint16_t>("ftu-report-interval.", *it));
 
-            const uint16_t seqped = conf.GetDef<uint16_t>("trigger-sequence-ped.",       *it);
-            const uint16_t seqint = conf.GetDef<uint16_t>("trigger-sequence-lp-int.",    *it);
-            const uint16_t seqext = conf.GetDef<uint16_t>("trigger-sequence-lp-ext.",    *it);
+            const uint16_t seqped = conf.GetDef<uint16_t>("trigger.sequence.pedestal.",  *it);
+            const uint16_t seqint = conf.GetDef<uint16_t>("trigger.sequence.lp-int.",    *it);
+            const uint16_t seqext = conf.GetDef<uint16_t>("trigger.sequence.lp-ext.",    *it);
 
             data.SetSequence(seqped, seqint, seqext);
@@ -2171,9 +2265,9 @@
             data.EnableAllPixel();
 
-            const vector<uint16_t> pat1 = conf.Vec<uint16_t>("disable-patch.default");
-            const vector<uint16_t> pat2 = conf.Vec<uint16_t>("disable-patch."+*it);
-
-            const vector<uint16_t> pix1 = conf.Vec<uint16_t>("disable-pixel.default");
-            const vector<uint16_t> pix2 = conf.Vec<uint16_t>("disable-pixel."+*it);
+            const vector<uint16_t> pat1 = conf.Vec<uint16_t>("trigger.disable-patch.default");
+            const vector<uint16_t> pat2 = conf.Vec<uint16_t>("trigger.disable-patch."+*it);
+
+            const vector<uint16_t> pix1 = conf.Vec<uint16_t>("trigger.disable-pixel.default");
+            const vector<uint16_t> pix2 = conf.Vec<uint16_t>("trigger.disable-pixel."+*it);
 
             vector<uint16_t> pat, pix;
@@ -2188,5 +2282,5 @@
                 {
                     ostringstream str;
-                    str << "disable-patch.*=" << *ip << " exceeds allowed maximum of " << FTM::StaticData::kMaxPatchIdx << "!";
+                    str << "trigger.disable-patch.*=" << *ip << " exceeds allowed maximum of " << FTM::StaticData::kMaxPatchIdx << "!";
                     T::Error(str);
                     return 2;
@@ -2199,5 +2293,5 @@
                 {
                     ostringstream str;
-                    str << "disable-pixel.*=" << *ip << " exceeds allowed maximum of " << FTM::StaticData::kMaxPixelIdx << "!";
+                    str << "trigger.disable-pixel.*=" << *ip << " exceeds allowed maximum of " << FTM::StaticData::kMaxPixelIdx << "!";
                     T::Error(str);
                     return 2;
@@ -2360,23 +2454,29 @@
         ("run-type",                     vars<string>(),        "")
         ("sampling-frequency.*",         var<uint16_t>(),       "")
-        ("enable-trigger.*",             var<bool>(),           "")
-        ("enable-external-1.*",          var<bool>(),           "")
-        ("enable-external-2.*",          var<bool>(),           "")
-        ("enable-veto.*",                var<bool>(),           "")
-        ("enable-clock-conditioner.*",   var<bool>(),           "")
-        ("trigger-interval.*",           var<uint16_t>(),       "")
-        ("trigger-sequence-ped.*",       var<uint16_t>(),       "")
-        ("trigger-sequence-lp-int.*",    var<uint16_t>(),       "")
-        ("trigger-sequence-lp-ext.*",    var<uint16_t>(),       "")
-        ("multiplicity-physics.*",       var<uint16_t>(),       "")
-        ("multiplicity-calib.*",         var<uint16_t>(),       "")
-        ("coincidence-window-physics.*", var<uint16_t>(),       "")
-        ("coincidence-window-calib.*",   var<uint16_t>(),       "")
-        ("dead-time.*",                  var<uint16_t>(),       "")
-        ("trigger-delay.*",              var<uint16_t>(),       "")
-        ("time-marker-delay.*",          var<uint16_t>(),       "")
-        ("diable-pixel.*",               vars<uint16_t>(),      "")
-        ("diable-patch.*",               vars<uint16_t>(),      "")
-        ("ftu-report-interval.*",        var<uint16_t>(),       "")
+        ("trigger.enable-trigger.*",             var<bool>(),           "")
+        ("trigger.enable-external-1.*",          var<bool>(),           "")
+        ("trigger.enable-external-2.*",          var<bool>(),           "")
+        ("trigger.enable-veto.*",                var<bool>(),           "")
+        ("trigger.enable-clock-conditioner.*",   var<bool>(),           "")
+        ("trigger.sequence.interval.*",          var<uint16_t>(),       "")
+        ("trigger.sequence.pedestal.*",          var<uint16_t>(),       "")
+        ("trigger.sequence.lp-int.*",            var<uint16_t>(),       "")
+        ("trigger.sequence.lp-ext.*",            var<uint16_t>(),       "")
+        ("trigger.multiplicity-physics.*",       var<uint16_t>(),       "")
+        ("trigger.multiplicity-calib.*",         var<uint16_t>(),       "")
+        ("trigger.coincidence-window-physics.*", var<uint16_t>(),       "")
+        ("trigger.coincidence-window-calib.*",   var<uint16_t>(),       "")
+        ("trigger.dead-time.*",                  var<uint16_t>(),       "")
+        ("trigger.delay.*",                      var<uint16_t>(),       "")
+        ("trigger.time-marker-delay.*",          var<uint16_t>(),       "")
+        ("trigger.disable-pixel.*",              vars<uint16_t>(),      "")
+        ("trigger.disable-patch.*",              vars<uint16_t>(),      "")
+        ("ftu-report-interval.*",                var<uint16_t>(),       "")
+        ("light-pulser.external.enable-group1.*", var<bool>(),       "")
+        ("light-pulser.external.enable-group2.*", var<bool>(),       "")
+        ("light-pulser.internal.enable-group1.*", var<bool>(),       "")
+        ("light-pulser.internal.enable-group2.*", var<bool>(),       "")
+        ("light-pulser.external.intensity.*",     var<uint16_t>(),   "")
+        ("light-pulser.internal.intensity.*",     var<uint16_t>(),   "")
         ;
 
