Index: mantid/Framework/DataHandling/inc/MantidDataHandling/LoadCSNSNexus.h
===================================================================
--- mantid/Framework/DataHandling/inc/MantidDataHandling/LoadCSNSNexus.h	(revision 0f1a14f5ea1107338cb4b89391a5b82358486af5)
+++ mantid/Framework/DataHandling/inc/MantidDataHandling/LoadCSNSNexus.h	(revision 7ab2b1d7eafc3804b21fc2248631db255a191234)
@@ -117,4 +117,5 @@
     /// Load Log to workspace
     void loadLog(::NeXus::File *file, boost::shared_ptr<API::MatrixWorkspace> workspace) const;
+   // void loadLog(::NeXus::File *file, EventWorkspace_sptr workspace) const;
 
     /// Create a time series property
@@ -141,4 +142,6 @@
     /// get end_time
     Kernel::DateAndTime getEndTime(::NeXus::File *file);
+    /// get instrument name
+    std::string getInstrumentName(::NeXus::File *file);
 
     ///bank name
Index: mantid/Framework/DataHandling/src/LoadCSNSNexus.cpp
===================================================================
--- mantid/Framework/DataHandling/src/LoadCSNSNexus.cpp	(revision 0f1a14f5ea1107338cb4b89391a5b82358486af5)
+++ mantid/Framework/DataHandling/src/LoadCSNSNexus.cpp	(revision 7ab2b1d7eafc3804b21fc2248631db255a191234)
@@ -304,5 +304,5 @@
 //-------------------------------------------------------------------------------------------------
 /**
-* Return the pixel number
+* Return the bin number
 * @param[in] filen :: nxs file
 * @return numBins :: bins of TOF
@@ -624,13 +624,8 @@
     //----- Start time is an ISO8601 string date and time. ------
     std::string start;
-    try
-    {
-        file->getAttr("start", start);
-    }
-    catch (::NeXus::Exception &)
-    {
-        start="2017-12-31T00:00:00+08:00";
-    }
-
+    try{
+        file->getAttr("start", start);}
+    catch (::NeXus::Exception &){
+        start="2017-12-31T00:00:00+08:00";}
     // Convert to date and time
     Kernel::DateAndTime start_time = Kernel::DateAndTime(start);
@@ -677,5 +672,4 @@
         value_units = "";
     }
-
     // Now the actual data
     ::NeXus::Info info = file->getInfo();
@@ -885,22 +879,14 @@
  * @param workspace :: A pointer to the workspace to store the logs
  */
-void LoadCSNSNexus::loadLog(
-    ::NeXus::File *file,
-    boost::shared_ptr<API::MatrixWorkspace> workspace) const
-{
-
+void LoadCSNSNexus::loadLog( ::NeXus::File *file, boost::shared_ptr<API::MatrixWorkspace> workspace) const
+//void LoadCSNSNexus::loadLog( ::NeXus::File *file, EventWorkspace_sptr workspace) const
+{
     file->openGroup(m_entryName, "NXentry");
-
-    try
-    {
-        file->openGroup("logs", "NXcollection");
-    }
-    catch (::NeXus::Exception &e)
-    {
+    try{file->openGroup("logs", "NXcollection");}
+    catch (::NeXus::Exception &e){
         g_log.warning() <<"Read logs: " << e.what()<<"\n";
         file->closeGroup();
         return;
     }
-
     // Validate the NX log class.
     std::map<std::string, std::string> entries = file->getEntries();
@@ -912,15 +898,10 @@
         {
             file->openGroup(it->first, "NXlog");
-
             std::map<std::string, std::string> subEntries = file->getEntries();
             if ((subEntries.find("value") == subEntries.end()) || (subEntries.find("time") == subEntries.end()))
-            {
-                g_log.warning() << "Invalid NXlog entry " << logName
-                                << " found. Did not contain 'value' and 'time'.\n";
-            }
-            else
-            {
-                try
-                {
+            {   g_log.warning() << "Invalid NXlog entry " << logName
+                                << " found. Did not contain 'value' and 'time'.\n";}
+            else{
+                try{
                     if (!(workspace->run().hasProperty(logName)))
                     {
@@ -935,5 +916,4 @@
                                     << " gave an error when loading:'" << e.what() << "'.\n";
                 }
-
             }
             file->closeGroup();
@@ -973,9 +953,7 @@
                                             << " gave an error when loading:'" << e.what() << "'.\n";
                         }
-
                     }
                     file->closeGroup();
                 }
-
             }
             file->closeGroup();
@@ -1095,9 +1073,6 @@
 {
     std::string startTime;
-
     file->openGroup(m_entryName, "NXentry");
-
     std::map<std::string, std::string> entries = file->getEntries();
-
     if (entries.find("start_time") != entries.end())
     {
@@ -1111,5 +1086,4 @@
     return Kernel::DateAndTime(startTime);;
 }
-
 //-------------------------------------------------------------------------------------------------
 /**
@@ -1121,9 +1095,6 @@
 {
     std::string endTime;
-
     file->openGroup(m_entryName, "NXentry");
-
     std::map<std::string, std::string> entries = file->getEntries();
-
     if (entries.find("end_time") != entries.end())
     {
@@ -1137,4 +1108,29 @@
     return Kernel::DateAndTime(endTime);
 }
+
+//-------------------------------------------------------------------------------------------------
+/**
+* Return the name of instrument
+* @param[in] filename :: nxs file name
+* @return instrumentName :: the name of instrument
+*/
+std::string LoadCSNSNexus::getInstrumentName(::NeXus::File *file)
+{
+    std::string instrumentName;    // Open the default data group 'entry'
+    file->openGroup(m_entryName, "NXentry");
+    std::map<std::string, std::string> entries = file->getEntries();
+    if (entries.find("instrument_name") != entries.end())
+    {
+        file->readData("instrument_name", instrumentName);
+        return instrumentName;
+    }
+    else
+    {
+        throw std::runtime_error("No Instrument Name in the NXS file!");
+    }
+    file->closeGroup();
+    return instrumentName;
+}
+
 //-------------------------------------------------------------------------------------------------
 /**
@@ -1223,8 +1219,6 @@
     auto prog = new Progress(this, 0.0, 1.0, 10);
     prog->doReport("Start to load Nexus");
-
     // Open nxs file
     auto file = new ::NeXus::File(filename);
-
     // Find the entry name we want.
     std::string newEntryName = getEntryName(file);
@@ -1233,18 +1227,10 @@
         throw std::runtime_error(m_entryName+" not found in the NXS file!");
     }
-
     std::vector<std::string> bankNames= getBankNames(file);
     g_log.debug() <<bankNames.size() << " banks found." << std::endl;
     prog->setNumSteps(bankNames.size() + 5);
-
     // Get CSNS Nexus Version
     std::string m_version = getVersion(file);
     g_log.debug()<<"CSNS Nexus version is: " <<m_version<<"\n";
-
-    // Get start time and end time
-    //Kernel::DateAndTime start_time = getStartTime(file);
-    //Kernel::DateAndTime end_time = getEndTime(file);
-    //cout<<"end_time is: " <<end_time<<"\n";
-
     // has Event data
     if (hasEventData(file))
@@ -1252,5 +1238,4 @@
         cout<<"has Event data\n";
     }
-
     // has Histogram data
     if (hasHistogramData(file))
@@ -1258,12 +1243,10 @@
         cout<<"has Histogram data\n";
     }
-
     prog->doReport("Counting pixels");
     m_bNumPixels = getNumPixels(file, true);
     m_mNumPixels = getNumPixels(file, false);
-    cout<<"pixel number in banks is: "<<m_bNumPixels<<endl;
-    cout<<"pixel number in monitors is: "<<m_mNumPixels<<endl;
+    //cout<<"pixel number in banks is: "<<m_bNumPixels<<endl;
+    //cout<<"pixel number in monitors is: "<<m_mNumPixels<<endl;
     g_log.debug() <<m_bNumPixels <<" pixels found."<< std::endl;
-
 
     prog->doReport("Counting TOF bins");
@@ -1271,21 +1254,30 @@
     m_mNumBins = getNumBins(file, false);
     g_log.debug() <<m_numBins <<" TOF bins found."<< std::endl;
-    std::cout<<"num of bin in banks are: "<<m_bNumBins<<std::endl;
-    std::cout<<"num of bin in monitors are: "<<m_mNumBins<<std::endl;
+    //std::cout<<"num of bin in banks are: "<<m_bNumBins<<std::endl;
+    //std::cout<<"num of bin in monitors are: "<<m_mNumBins<<std::endl;
 
     std::vector<uint32_t> pixelId = getPixelId(file, true);
     cout<<"the pixelId size banks are: "<<pixelId.size()<<endl;
 
-//    Kernel::DateAndTime timetest(0);
-//    std::cout<<"timetest is: "<<timetest<<std::endl;   
-
     // create event workspace
     EventWorkspace_sptr WS(new EventWorkspace);
-    
     setProperty("OutputWorkspace", WS);
     WS->initialize(m_bNumPixels,1,1);
-    // load sampleinfo 
-//    CSNSsample m_sampleInfo = getSampleInfo(file);
-    //cout<<"name of sample is: "<<m_sampleInfo.name<<endl;
+
+    // Get start time and end time
+    Kernel::DateAndTime start_time = getStartTime(file);
+    Kernel::DateAndTime end_time = getEndTime(file);
+    //cout<<"start_time is: " <<start_time<<"\n";
+    //cout<<"end_time is: " <<end_time<<"\n";    
+    WS->mutableRun().setStartAndEndTime(start_time, end_time);
+    // load info into workspace 
+    CSNSsample m_sampleInfo = getSampleInfo(file);
+    WS->setTitle(m_sampleInfo.name);
+    //std::string instrumentName = getInstrumentName(file);
+    //WS->setInstrument(instrumentName); //only eventWorkspaceCollection can do this!
+    
+    // set units in X and Y axis 
+    WS->getAxis(0)->unit() = Kernel::UnitFactory::Instance().create("TOF");    
+    WS->setYUnit("Counts");    
 
     //load event data
@@ -1317,9 +1309,13 @@
     MatrixWorkspace_sptr WS2 = boost::dynamic_pointer_cast<MatrixWorkspace>( WorkspaceFactory::Instance().create("Workspace2D", m_mNumPixels, m_mNumBins + 1, m_mNumBins));
 
+*/
+
     // Load log of source, chopper and SE
     prog->doReport("Loading time log");
-    loadLog(file, WS1);
+    loadLog(file, WS);
     //std::cout<<"current path: "<<file->getPath()<<std::endl;
 
+
+/*
     // Set to the output
     //setProperty("OutputWorkspace", boost::dynamic_pointer_cast<MatrixWorkspace>(WS));
