Index: /trunk/FACT++/src/StateMachineDim.cc
===================================================================
--- /trunk/FACT++/src/StateMachineDim.cc	(revision 10385)
+++ /trunk/FACT++/src/StateMachineDim.cc	(revision 10386)
@@ -20,4 +20,6 @@
 #include "StateMachineDim.h"
 
+#include <boost/lexical_cast.hpp>
+
 #include "tools.h"
 
@@ -26,4 +28,5 @@
 
 using namespace std;
+using boost::lexical_cast;
 
 const int StateMachineDim::fVersion = 42;
@@ -71,7 +74,5 @@
     // WARNING: This exit handler is GLOBAL!
     DimServer::addExitHandler(this);
-
-    for (StateNames::const_iterator i=fStateNames.begin(); i!=fStateNames.end(); i++)
-        DistStateName(i->first, i->second.first, i->second.second);
+    SetDefaultStateNames();
 }
 
@@ -89,18 +90,31 @@
 }
 
-void StateMachineDim::DistStateName(const int state, const std::string &name, const std::string &doc)
-{
-    ostringstream out;
-    out << reinterpret_cast<char*>(fDescriptionStates.itsData);
-    out << state << ':' << name << '=' << doc << '\n';
-
-    fDescriptionStates.setData(const_cast<char*>(out.str().c_str()));
+// --------------------------------------------------------------------------
+//
+//! Overwrite StateMachineImp::AddStateName. In addition to storing the
+//! state locally it is also propagated through Dim in the STATE_LIST
+//! service.
+//!
+//! @param state
+//!    Number of the state to which a name should be assigned
+//!
+//! @param name
+//!    A name which should be assigned to the state, e.g. "Tracking"
+//!
+//! @param doc
+//!    A explanatory text describing the state
+//!
+void StateMachineDim::AddStateName(const int state, const std::string &name, const std::string &doc)
+{
+    StateMachineImp::AddStateName(state, name, doc);
+
+    const string str0 = reinterpret_cast<char*>(fDescriptionStates.itsData);
+    const string str1 = lexical_cast<string>(state)+':'+name+'=';
+
+    if (str0.find(str1)!=string::npos)
+        return;
+
+    fDescriptionStates.setData(const_cast<char*>((str0+str1+doc+'\n').c_str()));
     fDescriptionStates.updateService();
-}
-
-void StateMachineDim::AddStateName(const int state, const std::string &name, const std::string &doc)
-{
-    StateMachineImp::AddStateName(state, name, doc);
-    DistStateName(state, name, doc);
 }
 
Index: /trunk/FACT++/src/StateMachineDim.h
===================================================================
--- /trunk/FACT++/src/StateMachineDim.h	(revision 10385)
+++ /trunk/FACT++/src/StateMachineDim.h	(revision 10386)
@@ -54,5 +54,4 @@
 
     void AddStateName(const int state, const std::string &name, const std::string &doc="");
-    void DistStateName(const int state, const std::string &name, const std::string &doc="");
 };
 
