Index: Algorithms/CMakeLists.txt
===================================================================
--- Algorithms/CMakeLists.txt	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ Algorithms/CMakeLists.txt	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -29,4 +29,11 @@
 ELSEIF(NOT DataSvc_FOUND) 
   MESSAGE(FATAL_ERROR "Unable to find DataSvc. Did you set DataSvc_ROOT?")
+ENDIF()
+
+FIND_PACKAGE(TinyXML REQUIRED)
+IF(TinyXML_FOUND)
+  INCLUDE_DIRECTORIES(${TinyXML_INCLUDE_DIRS})
+ELSEIF(NOT TinyXML_FOUND) 
+  MESSAGE(FATAL_ERROR "Unable to find TinyXML. Did you set TinyXML_ROOT?")
 ENDIF()
 
@@ -63,4 +70,5 @@
 TARGET_LINK_LIBRARIES(Algorithms ${DroNECore_LIBRARIES})
 TARGET_LINK_LIBRARIES(Algorithms ${DataSvc_LIBRARIES})
+TARGET_LINK_LIBRARIES(Algorithms ${TinyXML_LIBRARIES})
 
 # Output Path and Install Area
Index: Algorithms/src/DumpAlg.cc
===================================================================
--- Algorithms/src/DumpAlg.cc	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ Algorithms/src/DumpAlg.cc	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -88,5 +88,5 @@
 	for(uint32_t i = 0; i < evtcol->size(); i++){
 		Evt* evt = evtcol->at(i);
-		std::cout << std::dec << " =====  "<<evt->getX() << ", " << evt->getY() << std::endl;
+		std::cout << std::dec << " TOF  "<<evt->getTOF() << " PID " << evt->getPixelID() << std::endl;
 		//if(1100000==evt->getPixelID()) std::cout << "ERROR: " << std::endl;
 	}
Index: Algorithms/src/GPPDSNDMapAlg.cc
===================================================================
--- Algorithms/src/GPPDSNDMapAlg.cc	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ Algorithms/src/GPPDSNDMapAlg.cc	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -19,6 +19,8 @@
 #include "SniperKernel/SniperLog.h"
 #include "SniperKernel/SniperPtr.h"
-
+#include "tinyxml.h"
 #include <math.h>
+#include "boost/lexical_cast.hpp"
+#include <map>
 
 DECLARE_ALGORITHM(GPPDSNDMapAlg);
@@ -27,4 +29,5 @@
     : AlgBase(name)
 {
+	declProp("ConfigFileName",m_configfile);
 }
 
@@ -43,4 +46,18 @@
     }
 
+    TiXmlDocument doc;
+    doc.LoadFile(m_configfile.c_str());
+    //doc.Print();
+    TiXmlElement* root = doc.FirstChildElement();
+    for(TiXmlElement* bank = root->FirstChildElement("type")     ; bank != NULL; bank = bank->NextSiblingElement("type"))
+    for(TiXmlElement* mdul = bank->FirstChildElement("component"); mdul != NULL; mdul = mdul->NextSiblingElement("component"))
+    m_m2p.insert(MODULE2PID::value_type(boost::lexical_cast<int>(mdul->Attribute("moduleNum")),
+                                        boost::lexical_cast<int>(mdul->Attribute("idstart"))));
+
+    //for(MODULE2PID::iterator it=m_m2p.begin(); it!=m_m2p.end(); it++) 
+    //    std::cout << "module: " << it->first << " pid: " << it->second << std::endl;
+
+
+
     m_svc = pSvc.data();
 
@@ -55,5 +72,4 @@
 
 	uint32_t x, y, module;
-	uint32_t bank, row, column;
 	uint64_t pixelID;
 	uint32_t size = m_evtcol->size();
@@ -65,6 +81,5 @@
 		y = evt->getY();
 		module = m_pulse->getModule();
-		getModInfo(module, bank, row, column);
-		pixelID = getPixelID(bank, row, column, x, y);
+		pixelID = getPixelID(module, x, y);
 		evt->setPixelID(pixelID);
 
@@ -85,20 +100,6 @@
 }
 
-void GPPDSNDMapAlg::getModInfo(uint32_t module, uint32_t& bank, uint32_t& row, uint32_t& column)
+uint64_t GPPDSNDMapAlg::getPixelID(uint32_t& module, uint32_t& x, uint32_t& y)
 {
-	bank   = 1;
-	row    = 1;
-	column = module;
+	return uint64_t(m_m2p.find(module)->second) + (uint64_t(y/4)*111+uint64_t(x/4));	
 }
-
-uint64_t GPPDSNDMapAlg::getPixelID(uint32_t& bank, uint32_t& row, uint32_t& column, uint32_t& x, uint32_t& y)
-{
-	uint64_t ret_val = 0;
-	ret_val =    bank*1000000;
-	ret_val +=    row* 100000;
-	ret_val += column*  10000;
-	ret_val += (uint64_t(y/4)*111+uint64_t(x/4));	
-
-	//std::cout << "bank: " << bank << " row: " << row << " column: " << column << " x: " << x << " y: " << y  << " return: " << ret_val << std::endl;
-	return ret_val;
-}
Index: Algorithms/src/GPPDSNDMapAlg.h
===================================================================
--- Algorithms/src/GPPDSNDMapAlg.h	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ Algorithms/src/GPPDSNDMapAlg.h	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -41,6 +41,10 @@
 	DataSvc* m_svc;
     private:
-	void getModInfo(uint32_t module, uint32_t& bank, uint32_t& row, uint32_t& column);
-	uint64_t getPixelID(uint32_t& bank, uint32_t& row, uint32_t& column, uint32_t& x, uint32_t& y);
+	uint64_t getPixelID(uint32_t& module, uint32_t& x, uint32_t& y);
+
+	std::string m_configfile;
+	typedef std::map<int, int> MODULE2PID;
+	MODULE2PID m_m2p;
+
 
 };
Index: Algorithms/src/RunningInfAlg.cc
===================================================================
--- Algorithms/src/RunningInfAlg.cc	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ Algorithms/src/RunningInfAlg.cc	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -32,4 +32,7 @@
     : AlgBase(name)
 {
+        declProp("TofStart", m_tofstart);
+        declProp("TofBins", m_tofbins);
+        declProp("TofStep", m_tofstep);
 }
 
@@ -46,4 +49,7 @@
 	if ( pSvc.invalid()) return false;
 	m_svc = pSvc.data();
+
+	PixelCountList* pcs = m_svc->getObj<PixelCountList>("/statistic/pixel_counts");
+        for(uint32_t i = 0; i < m_tofbins; i++) pcs->add_item();
 
 	return true;
@@ -62,8 +68,14 @@
         ri->addPulseCnt(1);
 
-	PixelCount* pc  = m_svc->getObj<PixelCount>("/statistic/pixel_count");
+	PixelCount*     pc  = m_svc->getObj<PixelCount>("/statistic/pixel_count");
+	PixelCountList* pcs = m_svc->getObj<PixelCountList>("/statistic/pixel_counts");
 	for(uint32_t i = 0; i < evtcol->size(); i++){
 		Evt* evt = evtcol->at(i);
 		pc->addCount(evt->getPixelID(), 1);
+		uint32_t time = evt->getTOF()-m_tofstart;
+                uint32_t chan = time/m_tofstep;
+                if(chan>m_tofbins)continue; 
+                //std::cout << "chan: " << chan << " pixle: " << evt->getPixelID() << std::endl;
+                pcs->at(chan)->addCount(evt->getPixelID(), 1);
 	}
 
Index: Algorithms/src/RunningInfAlg.h
===================================================================
--- Algorithms/src/RunningInfAlg.h	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ Algorithms/src/RunningInfAlg.h	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -37,4 +37,7 @@
 
 	DataSvc* m_svc;
+        uint32_t m_tofbins;
+        uint32_t m_tofstep;
+        uint32_t m_tofstart;
 };
 
Index: CMake/Modules/FindBase.cmake
===================================================================
--- CMake/Modules/FindBase.cmake	(revision a4bf60c5a9ec673bd34cd92dcca716a510dbb871)
+++ CMake/Modules/FindBase.cmake	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -14,5 +14,5 @@
 
 # Look for the library.
-FIND_LIBRARY(Base_LIBRARY NAMES Com)
+FIND_LIBRARY(Base_LIBRARY NAMES libCom.so)
 MARK_AS_ADVANCED(Base_LIBRARIES)
 
@@ -26,5 +26,5 @@
 IF(Base_INCLUDE_DIR AND Base_LIBRARY)#Base_FOUND)
   SET(Base_FOUND TRUE)
-  SET(Base_LIBRARIES    ${Base_LIBRARY})
+  SET(Base_LIBRARIES    ${Base_LIBRARY}/libCom.so)
   SET(Base_INCLUDE_DIRS ${Base_INCLUDE_DIR})
 ELSEIF(NOT Base_FOUND)
Index: CMake/Modules/FindDataSvc.cmake
===================================================================
--- CMake/Modules/FindDataSvc.cmake	(revision a4bf60c5a9ec673bd34cd92dcca716a510dbb871)
+++ CMake/Modules/FindDataSvc.cmake	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -14,5 +14,5 @@
 
 # Look for the library.
-FIND_LIBRARY(DataSvc_LIBRARY NAMES DataSvc)
+FIND_LIBRARY(DataSvc_LIBRARY NAMES libDataSvc.so)
 MARK_AS_ADVANCED(DataSvc_LIBRARIES)
 
@@ -24,5 +24,5 @@
 IF(DataSvc_INCLUDE_DIR AND DataSvc_LIBRARY)#DataSvc_FOUND)
   SET(DataSvc_FOUND TRUE)
-  SET(DataSvc_LIBRARIES    ${DataSvc_LIBRARY})
+  SET(DataSvc_LIBRARIES    ${DataSvc_LIBRARY}/libDataSvc.so)
   SET(DataSvc_INCLUDE_DIRS ${DataSvc_INCLUDE_DIR})
 ELSE()
Index: CMake/Modules/FindDim.cmake
===================================================================
--- CMake/Modules/FindDim.cmake	(revision a4bf60c5a9ec673bd34cd92dcca716a510dbb871)
+++ CMake/Modules/FindDim.cmake	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -26,5 +26,5 @@
 IF(Dim_INCLUDE_DIR AND Dim_LIBRARY)#DIM_FOUND)
   SET(Dim_FOUND TRUE)	
-  SET(Dim_LIBRARIES    ${Dim_LIBRARY})
+  SET(Dim_LIBRARIES    ${Dim_LIBRARY}/libdim.so)
   SET(Dim_INCLUDE_DIRS ${Dim_INCLUDE_DIR})
 ELSE()#IF(NOT Dim_FOUND)
Index: CMake/Modules/FindDroNECore.cmake
===================================================================
--- CMake/Modules/FindDroNECore.cmake	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ CMake/Modules/FindDroNECore.cmake	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -14,5 +14,5 @@
 
 # Look for the library.
-FIND_LIBRARY(DroNECore_LIBRARY NAMES DroNECore)
+FIND_LIBRARY(DroNECore_LIBRARY NAMES DroNECore)#libDroNECore.so)
 MARK_AS_ADVANCED(DroNECore_LIBRARIES)
 
@@ -26,5 +26,5 @@
 IF(DroNECore_INCLUDE_DIR AND DroNECore_LIBRARY)#DataSvc_FOUND)
   SET(DroNECore_FOUND TRUE)
-  SET(DroNECore_LIBRARIES    ${DroNECore_LIBRARY})
+  SET(DroNECore_LIBRARIES    ${DroNECore_LIBRARY}/libDroNECore.so)
   SET(DroNECore_INCLUDE_DIRS ${DroNECore_INCLUDE_DIR})
 ELSE()
Index: CMake/Modules/FindSniperKernel.cmake
===================================================================
--- CMake/Modules/FindSniperKernel.cmake	(revision a4bf60c5a9ec673bd34cd92dcca716a510dbb871)
+++ CMake/Modules/FindSniperKernel.cmake	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -14,5 +14,5 @@
 
 # Look for the library.
-FIND_LIBRARY(SniperKernel_LIBRARY NAMES SniperKernel)
+FIND_LIBRARY(SniperKernel_LIBRARY NAMES SniperKernel/SniperKernel)
 MARK_AS_ADVANCED(SniperKernel_LIBRARIES)
 
@@ -26,5 +26,5 @@
 IF(SniperKernel_INCLUDE_DIR AND SniperKernel_LIBRARY)
   SET(SniperKernel_FOUND TRUE)
-  SET(SniperKernel_LIBRARIES    ${SniperKernel_LIBRARY})
+  SET(SniperKernel_LIBRARIES    ${SniperKernel_LIBRARY}/libSniperKernel.so)
   SET(SniperKernel_INCLUDE_DIRS ${SniperKernel_INCLUDE_DIR})
 ELSE()
Index: CMake/Modules/FindpvAccess.cmake
===================================================================
--- CMake/Modules/FindpvAccess.cmake	(revision a4bf60c5a9ec673bd34cd92dcca716a510dbb871)
+++ CMake/Modules/FindpvAccess.cmake	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -10,9 +10,9 @@
 SET(CMAKE_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib)
 
-FIND_PATH(pvAccess_INCLUDE_DIR NAMES pvAccess.h)
+FIND_PATH(pvAccess_INCLUDE_DIR NAMES pv/pvAccess.h)
 MARK_AS_ADVANCED(pvAccess_INCLUDE_DIRS)
 
 # Look for the library.
-FIND_LIBRARY(pvAccess_LIBRARY NAMES pvAccess)
+FIND_LIBRARY(pvAccess_LIBRARY NAMES libpvAccess.so)
 MARK_AS_ADVANCED(pvAccess_LIBRARIES)
 
@@ -26,5 +26,5 @@
 IF(pvAccess_INCLUDE_DIR AND pvAccess_LIBRARY)
   SET(pvAccess_FOUND TRUE)
-  SET(pvAccess_LIBRARIES    ${pvAccess_LIBRARY})
+  SET(pvAccess_LIBRARIES    ${pvAccess_LIBRARY}/libpvAccess.so)
   SET(pvAccess_INCLUDE_DIRS ${pvAccess_INCLUDE_DIR})
 ELSE()
Index: CMake/Modules/FindpvData.cmake
===================================================================
--- CMake/Modules/FindpvData.cmake	(revision a4bf60c5a9ec673bd34cd92dcca716a510dbb871)
+++ CMake/Modules/FindpvData.cmake	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -10,9 +10,9 @@
 SET(CMAKE_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib)
 
-FIND_PATH(pvData_INCLUDE_DIR NAMES pvData.h)
+FIND_PATH(pvData_INCLUDE_DIR NAMES pv/pvData.h)
 MARK_AS_ADVANCED(pvData_INCLUDE_DIRS)
 
 # Look for the library.
-FIND_LIBRARY(pvData_LIBRARY NAMES pvData)
+FIND_LIBRARY(pvData_LIBRARY NAMES libpvData.so)
 MARK_AS_ADVANCED(pvData_LIBRARIES)
 
@@ -26,5 +26,5 @@
 IF(pvData_INCLUDE_DIR AND pvData_LIBRARY)
   SET(pvData_FOUND TRUE)
-  SET(pvData_LIBRARIES    ${pvData_LIBRARY})
+  SET(pvData_LIBRARIES    ${pvData_LIBRARY}/libpvData.so)
   SET(pvData_INCLUDE_DIRS ${pvData_INCLUDE_DIR})
 ELSE()
Index: CtrlSvc/CMakeLists.txt
===================================================================
--- CtrlSvc/CMakeLists.txt	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ CtrlSvc/CMakeLists.txt	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -85,2 +85,3 @@
 INSTALL(DIRECTORY CtrlSvc DESTINATION include)
 INSTALL(DIRECTORY python/CtrlSvc DESTINATION pylib)
+INSTALL(DIRECTORY python/NEON DESTINATION pylib)
Index: CtrlSvc/python/CtrlSvc/NeonRPCTask.py
===================================================================
--- CtrlSvc/python/CtrlSvc/NeonRPCTask.py	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ CtrlSvc/python/CtrlSvc/NeonRPCTask.py	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -8,4 +8,6 @@
 import NEON
 import DroNECore.PyIncident as PI
+import json
+import CtrlSvc.HeartBeatIncident  as HBI
 
 class RPCMethods(NEON.Neon.NeonService.NeonRPC.MethodCall):
@@ -21,9 +23,10 @@
 class NeonRPCTask(Task) :
 
-    def __init__(self, name, rpcserver) :
+    def __init__(self, name, rpcserver, remotedata = None) :
         Task.__init__(self, name)
         Task.regist(self, "NeonRPC")
         self.rpcserver = rpcserver
         self.rpcmethod = RPCMethods()
+        self.remotedata = remotedata
 
     def handle(self, incident) :
@@ -32,4 +35,12 @@
             neonid, method, parameters = rpcitem
             print "uuid: ", neonid, " method: ", method, " parameters: ", parameters
+            # NOW it is only for Stop
+            index = json.loads(self.remotedata.getData())['uuid']
+            heartbeatdata = HBI.HeartBeatCronIncident.encodeHeartBeat(status='stopping', \
+                                            hit = 0, event = 0, \
+                                            pulse = 0, idx = index)
+            print heartbeatdata, "============="
+            self.remotedata.setData(heartbeatdata)
+            self.remotedata.dump()
+            self.rpcserver.sndRSLT(neonid, result = "Stop OK", error = "None ERROR")
             returnValue, errorCode = self.rpcmethod.execute(method, parameters)
-            self.rpcserver.sndRSLT(neonid, returnValue = "return OK", error = "None ERROR")
Index: CtrlSvc/src/CtrlSvc.cc
===================================================================
--- CtrlSvc/src/CtrlSvc.cc	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ CtrlSvc/src/CtrlSvc.cc	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -18,4 +18,5 @@
 #include "CtrlSvc/HelloDroNEHdl.h"
 #include "CtrlSvc/PushHistHdl.h"
+#include "CtrlSvc/PushMatrixHdl.h"
 #include "CtrlSvc/BeginEvtHdl.h"
 #include "CtrlSvc/EndEvtHdl.h"
@@ -56,4 +57,9 @@
 	pi->listening();
 
+	IIncidentHandler* mi = new PushMatrixHdl(par);
+	if ( par->isTop() ) mi->regist("PushMatrix");
+	else mi->regist(par->scope() + par->objName() + ":PushMatrix");
+	mi->listening();
+
 	IIncidentHandler* bi = new BeginEvtHdl(par);
 	bi->regist("BeginEvent");
Index: DataSvc/CMakeLists.txt
===================================================================
--- DataSvc/CMakeLists.txt	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ DataSvc/CMakeLists.txt	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -47,5 +47,5 @@
     IF(pvAccess_FOUND AND pvData_FOUND)
         IF(Base_FOUND)
-            INCLUDE_DIRECTORIES(${Base_INCLUDE_DIRS} ${Base_INCLUDE_DIRS}/compiler/gcc ${Base_INCLUDE_DIRS}/os/Linux ${pvAccess_INCLUDE_DIRS}/../ ${pvData_INCLUDE_DIRS}/../)
+            INCLUDE_DIRECTORIES(${Base_INCLUDE_DIRS} ${Base_INCLUDE_DIRS}/compiler/gcc ${Base_INCLUDE_DIRS}/os/Linux ${pvAccess_INCLUDE_DIRS} ${pvData_INCLUDE_DIRS})#/../)
         ELSEIF(NOT Base_FOUND)
             MESSAGE(FATAL_ERROR "Unable to find base. Did you set BasePATH?")
Index: DataSvc/Data/GPPDStatistic.h
===================================================================
--- DataSvc/Data/GPPDStatistic.h	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ DataSvc/Data/GPPDStatistic.h	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -87,4 +87,5 @@
 
 
+typedef DataList<PixelCount> PixelCountList;
 
 #endif
Index: DataSvc/DataSvc/DataSvc.h
===================================================================
--- DataSvc/DataSvc/DataSvc.h	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ DataSvc/DataSvc/DataSvc.h	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -34,6 +34,6 @@
       bool finalize();
 
-    //private :
-    //  std::list<IIncidentHandler*> m_icdts;
+    private :
+      //uint32_t         m_tofbins;
 
 };
Index: DataSvc/DataSvc/EpicsInputSvc.h
===================================================================
--- DataSvc/DataSvc/EpicsInputSvc.h	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ DataSvc/DataSvc/EpicsInputSvc.h	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -62,4 +62,5 @@
       MonitorItem* m_curDataItem;
       boost::thread *m_client;
+      std::string m_epicsChannel;
 
 };
Index: DataSvc/Install
===================================================================
--- DataSvc/Install	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ DataSvc/Install	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -1,1 +1,5 @@
-ccmake -DCMAKE_INSTALL_PREFIX=/opt/shared/library/DroNE -DBoost_NO_BOOST_CMAKE=TRUE -DBOOST_ROOT=/opt/shared/library/boost-1.62.0/ -DSniperKernel_INCLUDE_DIR=/opt/shared/library/sniper-1.0/include -DSniperKernel_LIBRARY=/opt/shared/library/sniper-1.0/lib -DDim=ON -DEpics=OFF ..
+mkdir build
+cd build
+
+cmake -DDim=ON -DEpics=OFF ..
+
Index: DataSvc/src/DataSvc.cc
===================================================================
--- DataSvc/src/DataSvc.cc	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ DataSvc/src/DataSvc.cc	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -49,8 +49,10 @@
   this->branch("statistic");
 
+  this->find("/statistic")->branch("running_inf");
   this->find("/statistic")->branch("pixel_count");
-  this->find("/statistic")->branch("running_inf");
-  this->regObj("/statistic/pixel_count", new PixelCount);
+  this->find("/statistic")->branch("pixel_counts");
   this->regObj("/statistic/running_inf", new RunningInf);
+  this->regObj("/statistic/pixel_count",  new PixelCount);
+  this->regObj("/statistic/pixel_counts", new PixelCountList);
 
   //Task* par = getScope();
Index: DataSvc/src/EpicsInputSvc.cc
===================================================================
--- DataSvc/src/EpicsInputSvc.cc	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ DataSvc/src/EpicsInputSvc.cc	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -16,6 +16,5 @@
 #include "DataSvc/EpicsInputSvc.h"
 #include "DataSvc/EpicsV4Hh/neutronClientStartMonitor.hh"
-#include "DataSvc/GPPDDataSvc.h"
-#include "DroNECore/BeginEvtHdl.h"
+#include "DataSvc/DataSvc.h"
 
 #include "SniperKernel/Incident.h"
@@ -45,6 +44,5 @@
 EpicsInputSvc::EpicsInputSvc(const std::string& name)
 : DataInputSvc(name) {
-	//declProp("BuffSize",  m_buffsize);
-	//m_decoder = new DecodeRawData();
+	declProp("Channel", m_epicsChannel);
 
 	m_EpicsMonitor= NULL;
@@ -80,14 +78,11 @@
 bool EpicsInputSvc::next() {
 	NeutronPulse* npulse = m_dataSvc->getObj<NeutronPulse>("/pulse");
-	HitList* hitcol      = m_dataSvc->getObj<HitList>("/pulse/hits");
 	EvtList* evtcol      = m_dataSvc->getObj<EvtList>("/pulse/evts");
-	hitcol->clear();
 	evtcol->clear();
-	Hit* hit;
+	Evt* evt;
 
 	popDataItem();
 
 	MonitorData* pData = m_curDataItem->getData();
-	//size_t       pSize = m_curDataItem->getSize();
 	npulse->setInstrument(pData->pPulse->mSpecID);
 	npulse->setDetector(pData->pPulse->mDetTypeID);
@@ -98,7 +93,9 @@
 
 	for(uint32_t idx = 0; idx < pData->pPulse->mHitCounts; idx++){
-		hit = hitcol->add_item();
-		hit->setChannel(pData->pPIDList[idx]);
-		hit->setTOF(pData->pTOFList[idx]);
+		evt = evtcol->add_item();
+		evt->setPixelID(pData->pPIDList[idx]);
+		evt->setTOF(pData->pTOFList[idx]);
+                evt->setX(0);
+                evt->setY(0);
 	}
 
@@ -134,5 +131,5 @@
 }
 void EpicsInputSvc::epicsClient(){
-	m_EpicsMonitor = new neutronClientStartMonitor();
+	m_EpicsMonitor = new neutronClientStartMonitor(m_epicsChannel);
 	m_EpicsMonitor->startMonitor(functionWrapper);
 
Index: DataSvc/src/neutronClientStartMonitor.cc
===================================================================
--- DataSvc/src/neutronClientStartMonitor.cc	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ DataSvc/src/neutronClientStartMonitor.cc	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -27,7 +27,7 @@
 
 
-neutronClientStartMonitor::neutronClientStartMonitor()
+neutronClientStartMonitor::neutronClientStartMonitor(std::string channel_name)
 {
-  channel = "neutrons";
+  channel = channel_name;
   request = "record[queueSize=100]field()";
   timeout = 2.0;
Index: DroNECore/CMakeLists.txt
===================================================================
--- DroNECore/CMakeLists.txt	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ DroNECore/CMakeLists.txt	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -10,16 +10,4 @@
 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../CMake/Modules)
 
-#OPTION(Dim "Dim" OFF)
-#IF(Dim)
-#    FIND_PACKAGE(Dim REQUIRED)
-#    IF(Dim_FOUND)
-#        INCLUDE_DIRECTORIES(${Dim_INCLUDE_DIRS})
-#    ELSEIF(NOT Dim_FOUND) 
-#        MESSAGE(FATAL_ERROR "Unable to find Dim. Did you set Dim_ROOT?")
-#    ENDIF()
-#ELSEIF(NOT Dim)
-#    MESSAGE(STATUS "Did not call Dim.")
-#ENDIF()
-
 FIND_PACKAGE(SniperKernel REQUIRED)
 #FIND_PACKAGE(Data REQUIRED)
@@ -30,24 +18,4 @@
   MESSAGE(FATAL_ERROR "Unable to find SniperKernel. Did you set SniperKernel_ROOT?")
 ENDIF()
-
-#OPTION(Epics "Epics" OFF)
-#IF(Epics)
-#    FIND_PACKAGE(pvAccess REQUIRED)
-#    FIND_PACKAGE(pvData REQUIRED)
-#    FIND_PACKAGE(Base REQUIRED)
-#    IF(pvAccess_FOUND AND pvData_FOUND)
-#        IF(Base_FOUND)
-#            INCLUDE_DIRECTORIES(${Base_INCLUDE_DIRS} ${Base_INCLUDE_DIRS}/compiler/gcc ${Base_INCLUDE_DIRS}/os/Linux ${pvAccess_INCLUDE_DIRS}/../ ${pvData_INCLUDE_DIRS}/../)
-#        ELSEIF(NOT Base_FOUND)
-#            MESSAGE(FATAL_ERROR "Unable to find base. Did you set BasePATH?")
-#        ENDIF()
-#    ELSEIF(NOT pvAccess_FOUND)
-#        MESSAGE(FATAL_ERROR "Unable to find pvAccess. Did you set pvAccess_ROOT?")
-#    ELSEIF(NOT pvData_FOUND)
-#        MESSAGE(FATAL_ERROR "Unable to find pvData. Did you set pvData_ROOT?")
-#    ENDIF()
-#ELSEIF(NOT Epics)
-#    MESSAGE(STATUS "Did not call Epics!")
-#ENDIF()
 
 # Find Package
@@ -80,21 +48,4 @@
     
 FILE(GLOB_RECURSE CPPLIB_SRC_LIST "src/*.cc")# "src/EpicsV4Src/*.cc")
-#IF(NOT Dim AND NOT Epics)
-#    list(REMOVE_ITEM CPPLIB_SRC_LIST
-#${CMAKE_CURRENT_SOURCE_DIR}/src/DimRecvSvc.cc
-#${CMAKE_CURRENT_SOURCE_DIR}/src/EpicsInputSvc.cc
-#${CMAKE_CURRENT_SOURCE_DIR}/src/neutronClientStartMonitor.cc
-#${CMAKE_CURRENT_SOURCE_DIR}/src/EpicsV4Src/neutronClientRequestAndMonitor.cc)
-#    MESSAGE(STATUS ${CPPLIB_SRC_LIST})
-#ELSEIF(NOT Dim AND Epics)
-#    list(REMOVE_ITEM CPPLIB_SRC_LIST
-#${CMAKE_CURRENT_SOURCE_DIR}/src/DimRecvSvc.cc)
-#    MESSAGE(STATUS ${CPPLIB_SRC_LIST})
-#ELSEIF(NOT Epics AND Dim)
-#    list(REMOVE_ITEM CPPLIB_SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/src/EpicsInputSvc.cc
-#${CMAKE_CURRENT_SOURCE_DIR}/src/neutronClientStartMonitor.cc
-#${CMAKE_CURRENT_SOURCE_DIR}/src/EpicsV4Src/neutronClientRequestAndMonitor.cc)
-#    MESSAGE(STATUS ${CPPLIB_SRC_LIST})
-#ENDIF()
 
 # Compile Library for CPP
@@ -102,8 +53,4 @@
 TARGET_LINK_LIBRARIES(DroNECore ${Boost_LIBRARIES}) 
 TARGET_LINK_LIBRARIES(DroNECore ${SniperKernel_LIBRARIES})
-#TARGET_LINK_LIBRARIES(DroNECore ${Dim_LIBRARIES})
-#TARGET_LINK_LIBRARIES(DroNECore ${pvAccess_LIBRARIES})
-#TARGET_LINK_LIBRARIES(DroNECore ${pvData_LIBRARIES})
-#TARGET_LINK_LIBRARIES(DroNECore ${Base_LIBRARIES})
 
 # add libDataSvcPython
Index: DroNECore/python/DroNECore/CtrlTask.py
===================================================================
--- DroNECore/python/DroNECore/CtrlTask.py	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ DroNECore/python/DroNECore/CtrlTask.py	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -25,6 +25,6 @@
 	for eachitem in self.__incidentList:
 		ret = eachitem.execute()
-                if(ret):
-                    print ret
+                #if(ret):
+                    #print ret
         #print self.__heartbeat.fire({"string":" pyIncident hello ", "times":2})
 
Index: PyDroNE/ctrl.py
===================================================================
--- PyDroNE/ctrl.py	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ PyDroNE/ctrl.py	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -9,4 +9,5 @@
 import CtrlSvc.HeartBeatIncident  as HBI
 import CtrlSvc.PushHistIncident   as PHI
+import CtrlSvc.PushMatrixIncident as PMI
 import CtrlSvc.HelloDroNEIncident as HDI
 import CtrlSvc.NeonRPCIncident    as NRI
@@ -15,5 +16,5 @@
 
 
-
+import uuid    
 def app(Server, RPC):
     Task = DroNECore.DroNE("task")
@@ -23,9 +24,8 @@
     
 ###############################################################################
-    import uuid    
-    heartbeatdata = HBI.HeartBeatCronIncident.encodeHeartBeat(status='configuring', \
-                                           hit = 0, event = 0, pulse = 0, idx = str(uuid.uuid1()))
     m_taskheartbeat = NEON.Data.SingleValue(Server, '/GPPD/hearbeat/detector/192.168.0.1:drone01', \
-                                           description='192.168.0.1:01', data=heartbeatdata)
+                                           description='192.168.0.1:01')
+    m_taskheartbeat.setData(HBI.HeartBeatCronIncident.encodeHeartBeat(status='configuring', \
+                                    hit = 0, event = 0, pulse = 0, idx = str(uuid.uuid1())))
     m_taskheartbeat.dump()
 ###############################################################################
@@ -39,17 +39,20 @@
 
 ###############################################################################
-    nr = NRT.NeonRPCTask("NeonRPC", RPC)
+    nr = NRT.NeonRPCTask("NeonRPC", RPC, remotedata = m_taskheartbeat)
 
 ###############################################################################
 
     ct = DroNECore.CtrlTask("ctrl")
-    #di = HDI.HelloIncident('HelloDroNE')
+    di = HDI.HelloIncident('HelloDroNE')
     ni = NRI.NeonRPCCronIncident("NeonRPC", cron = 2, repeatable = True)
     hi = HBI.HeartBeatCronIncident("HeartBeat", cron = 2, repeatable = True, remotedata = m_taskheartbeat)
-    pi = PHI.PushHistCronIncident("PushHist", cron = 2, repeatable = True, remotedata = m_taskhist)
+    #pi = PHI.PushHistCronIncident("PushHist", cron = 2, repeatable = True, remotedata = m_taskhist)
+    #pi = PMI.PushMatrixCronIncident("PushMatrix", cron = 5, repeatable = True, remotedata = m_taskhist)
+    ct.add(di)
     ct.add(ni)
-    #ct.add(hi)
+    ct.add(hi)
     #ct.add(pi)
-    #ct.add(hc)
+    
+
     import DataSvc
     import CtrlSvc
@@ -63,5 +66,5 @@
 
     filelist = []
-    for i in xrange(1):
+    for i in xrange(100):
         filelist.append("16adjust.dat")
     iPvd.property("InputFile").set(filelist) #"N_3Cdmaskslit.dat", 
@@ -80,5 +83,5 @@
     Task.setEvtMax(1000000)
     Task.run()
-    Task.run()
+    #Task.run()
 
     print "stop run"
@@ -116,4 +119,9 @@
 
 def rpcserver(Server, RPC):
+    heartbeatdata = HBI.HeartBeatCronIncident.encodeHeartBeat(status='stopping', \
+                                           hit = 0, event = 0, pulse = 0, idx = str(uuid.uuid1()))
+    m_taskheartbeat = NEON.Data.SingleValue(Server, '/GPPD/hearbeat/detector/192.168.0.1:drone01', \
+                                           description='192.168.0.1:01', data=heartbeatdata)
+    m_taskheartbeat.dump()
    
     rpcmethod = RPCMethods(Server=Server, RPC=RPC)
@@ -131,4 +139,5 @@
     servpob = NEON.Neon.NeonService.POBox(m_neonRedis, '/GPPD/process/detector', '192.168.0.1:drone01')
     servrpc = NEON.Neon.NeonService.NeonRPC(sendPOBox = servpob, recvPOBox = servpob, isServer=True)
+    #app(Server=m_neonRedis, RPC=servrpc)
     
     rpcserver(Server = m_neonRedis, RPC=servrpc)
Index: PyDroNE/dim.py
===================================================================
--- PyDroNE/dim.py	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ PyDroNE/dim.py	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -21,5 +21,6 @@
 
     iPvd.property("DataSize").set(1000000)
-    iPvd.property("DimServerName").set("dimserver/TEST_SWAP")
+    dimsrvname = "dimserver/TEST_SWAP_2"
+    iPvd.property("DimServerName").set(dimsrvname)
     iSvc.property("BuffSize").set(1000000)
 
@@ -30,8 +31,8 @@
     task.property("algs").append("GPPDSNDRecAlg")
     task.property("algs").append("GPPDSNDMapAlg")
-    task.property("algs").append("DumpAlg")
+    #task.property("algs").append("DumpAlg")
     #task.property("algs").append("SaveNeXusAlg")
-    dumpalg = task.find("DumpAlg")
-    dumpalg.property("OutputFileName").set("tempdim.txt")
+    #dumpalg = task.find("DumpAlg")
+    #dumpalg.property("OutputFileName").set("tempdim.txt")
     #dumpalg.property("initXNum").set(111)
     #dumpalg.property("initYNum").set(48)
Index: DroNE/epics.py
===================================================================
--- PyDroNE/epics.py	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ 	(revision )
@@ -1,26 +1,0 @@
-#!/usr/bin/env python
-# -*- coding:utf-8 -*-
-# author: H.L. TIAN 2017
-
-
-import Sniper
-
-if __name__ == "__main__":
-
-    task = Sniper.Task("task")
-    task.asTop()
-    task.setLogLevel(0)
-    
-    import DataSvc
-    task.property("svcs").append("DataSvc")
-    task.property("svcs").append("EpicsInputSvc/DataInputSvc")
-    iSvc = task.find("DataInputSvc")
-
-    import Algorithms
-    task.property("algs").append("DumpAlg")
-
-    iSvc.show()
-
-    task.setEvtMax(-1)
-    task.initialize()
-    task.run()
Index: PyDroNE/run.py
===================================================================
--- PyDroNE/run.py	(revision 974bd7d70e10207222aaeeb1192691871c355dd4)
+++ PyDroNE/run.py	(revision b01c4f850eefba824e531cc77b15604778ceb07b)
@@ -3,9 +3,11 @@
 # author: H.L. TIAN 2017
 
-import Sniper
+#import Sniper
+import DroNECore
 
 if __name__ == "__main__":
 
-    task = Sniper.Task("task")
+    task = DroNECore.DroNE("task")
+    #task = Sniper.Task("task")
     task.asTop()
     task.setLogLevel(0)
@@ -17,8 +19,12 @@
     task.property("svcs").append("RawDataInputSvc/DataInputSvc")
     task.property("svcs").append("FileInputSvc/DataProvideSvc")
+    iDat = task.find("DataSvc")
     iSvc = task.find("DataInputSvc")
     iPvd = task.find("DataProvideSvc")
 
     filelist = ["16adjust.dat"]
+    #filelist = []
+    #for i in xrange(100):
+    #    filelist.append("16adjust.dat")
     iPvd.property("InputFile").set(filelist) #"N_3Cdmaskslit.dat", 
     iSvc.property("BuffSize").set(5000)
@@ -30,9 +36,8 @@
     task.property("algs").append("GPPDSNDRecAlg")
     task.property("algs").append("GPPDSNDMapAlg")
-    task.property("algs").append("FileReadoutAlg")
-    alg = task.find("FileReadoutAlg")
-    alg.property("OutputFileName").set("16adjust.txt")
-    alg.property("initXNum").set(111)
-    alg.property("initYNum").set(48)
+    task.property("algs").append("RunningInfAlg")
+    iRun = task.find("RunningInfAlg")
+    iRun.property("TofBins").set(10000)
+    iRun.property("TofStep").set(1000)
 
     #    
