diff --git a/NPLib/Core/NPDetectorManager.cxx b/NPLib/Core/NPDetectorManager.cxx
index 8be0afde85d0a554cef29e474dd6a6ec1a195e2c..29c2fbc2a682ba7680033b47cd9f0cd82edab560 100644
--- a/NPLib/Core/NPDetectorManager.cxx
+++ b/NPLib/Core/NPDetectorManager.cxx
@@ -416,7 +416,9 @@ void NPL::DetectorManager::StartThread(NPL::VDetector* det,unsigned int id){
     if(m_Ready[id]){
       // Do the job
       (det->*m_ClearEventPhysicsPtr)();
+
       (det->*m_BuildPhysicalPtr)();
+
       if(m_FillSpectra){
         (det->*m_FillSpectra)();
        if(m_CheckSpectra)
@@ -426,6 +428,7 @@ void NPL::DetectorManager::StartThread(NPL::VDetector* det,unsigned int id){
      std::this_thread::yield();
    }
    else{
+//    std::this_thread::sleep_for(std::chrono::milliseconds(100));
     std::this_thread::yield();
    }
 
@@ -447,7 +450,9 @@ bool NPL::DetectorManager::IsDone(){
   static std::vector<bool>::iterator it;
   static std::vector<bool>::iterator begin = m_Ready.begin(); 
   static std::vector<bool>::iterator end = m_Ready.end();
+  unsigned int i = 0 ;
   for( it = begin ; it!=end ; it++){
+    //std::cout << i++ << " " << *it << std::endl;
     if((*it))
       return false;
   }
diff --git a/NPLib/Detectors/MUST2/TMust2Spectra.cxx b/NPLib/Detectors/MUST2/TMust2Spectra.cxx
index aa5a33bf65be58d01a2856b75566b79511ed61fd..c71108a1ff0a9261c94c212be9935effb604d691 100644
--- a/NPLib/Detectors/MUST2/TMust2Spectra.cxx
+++ b/NPLib/Detectors/MUST2/TMust2Spectra.cxx
@@ -81,11 +81,13 @@ void TMust2Spectra::InitRawSpectra(){
     
     // STRX_E_RAW
     name = "MM"+NPL::itoa(i+1)+"_STRX_E_RAW";
-    AddHisto2D(name, name, fStripX, 1, fStripX+1, 512, 8192, 16384,  "MUST2/RAW/STRXE");
-    
+    // AddHisto2D(name, name, fStripX, 1, fStripX+1, 512, 8192, 16384,  "MUST2/RAW/STRXE");
+    AddHisto2D(name, name, fStripX, 1, fStripX+1, 10000, 7000, 17000,  "MUST2/RAW/STRXE");
+
     // STRY_E_RAW
     name = "MM"+NPL::itoa(i+1)+"_STRY_E_RAW";
-    AddHisto2D(name, name, fStripY, 1, fStripY+1, 512, 0, 8192, "MUST2/RAW/STRYE");
+    // AddHisto2D(name, name, fStripY, 1, fStripY+1, 512, 0, 8192, "MUST2/RAW/STRYE");
+    AddHisto2D(name, name, fStripY, 1, fStripY+1,10000, 0, 10000, "MUST2/RAW/STRYE");
 
     // STRX_T_RAW
     name = "MM"+NPL::itoa(i+1)+"_STRX_T_RAW";
@@ -94,7 +96,7 @@ void TMust2Spectra::InitRawSpectra(){
     // STRY_T_RAW
     name = "MM"+NPL::itoa(i+1)+"_STRY_T_RAW";
     AddHisto2D(name, name, fStripY, 1, fStripY+1, 512, 0, 8192, "MUST2/RAW/STRYT");
-    
+
     // SILI_E_RAW
     name = "MM"+NPL::itoa(i+1)+"_SILI_E_RAW";
     AddHisto2D(name, name, fPadSili, 1, fPadSili+1, 512, 0, 8192, "MUST2/RAW/SILIE");
@@ -183,11 +185,11 @@ void TMust2Spectra::InitPreTreatedSpectra()
     // CSI_CAL_MULT
     name = "MM"+NPL::itoa(i+1)+"_CSI_CAL_MULT";
     AddHisto1D(name, name, fCrystalCsI, 1, fCrystalCsI+1, "MUST2/CAL/MULT");
-   
+
     // CSI_CAL_ID 
     for(unsigned int j = 0 ; j < fCrystalCsI ; j++){
-     name = "MM"+NPL::itoa(i+1)+"_CSI"+NPL::itoa(j+1)+"_CAL_ID";
-     AddHisto2D(name, name,1024,0,16384,500,0,50, "MUST2/CAL/ID");
+      name = "MM"+NPL::itoa(i+1)+"_CSI"+NPL::itoa(j+1)+"_CAL_ID";
+      AddHisto2D(name, name,1024,0,16384,500,0,50, "MUST2/CAL/ID");
     }
   }  // end loop on number of detectors
 
@@ -227,7 +229,7 @@ void TMust2Spectra::InitPhysicsSpectra(){
   // Etot-DE:
   name = "MM_Etot_E";
   AddHisto2D(name, name,500,0,500,500,0,50,"MUST2/PHY");
-  
+
 
   // ID plot detector by detector
   for (unsigned int i = 0; i < fNumberOfTelescope; i++) { // loop on number of detectors
@@ -264,8 +266,8 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     family = "MUST2/RAW/STRXE";
 
     FillSpectra(family,name
-      ,RawData->GetMMStripXEStripNbr(i), 
-          RawData->GetMMStripXEEnergy(i));
+        ,RawData->GetMMStripXEStripNbr(i), 
+        RawData->GetMMStripXEEnergy(i));
   }
 
   // STRY_E
@@ -274,8 +276,8 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     family = "MUST2/RAW/STRYE";
 
     FillSpectra(family,name
-      ,RawData->GetMMStripYEStripNbr(i),
-          RawData->GetMMStripYEEnergy(i));
+        ,RawData->GetMMStripYEStripNbr(i),
+        RawData->GetMMStripYEEnergy(i));
   }
 
   // STRX_T
@@ -284,8 +286,8 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     family = "MUST2/RAW/STRXT";
 
     FillSpectra(family,name
-      ,RawData->GetMMStripXTStripNbr(i),
-          RawData->GetMMStripXTTime(i));
+        ,RawData->GetMMStripXTStripNbr(i),
+        RawData->GetMMStripXTTime(i));
   }
   // STRY_T
   for (unsigned int i = 0; i < RawData->GetMMStripYTMult(); i++) {
@@ -293,8 +295,8 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     family = "MUST2/RAW/STRYT";
 
     FillSpectra(family,name
-      ,RawData->GetMMStripYTStripNbr(i),
-          RawData->GetMMStripYTTime(i));
+        ,RawData->GetMMStripYTStripNbr(i),
+        RawData->GetMMStripYTTime(i));
   }
 
   // SILI_E
@@ -303,8 +305,8 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     family = "MUST2/RAW/SILIE";
 
     FillSpectra(family,name
-      ,RawData->GetMMSiLiEPadNbr(i),
-          RawData->GetMMSiLiEEnergy(i));
+        ,RawData->GetMMSiLiEPadNbr(i),
+        RawData->GetMMSiLiEEnergy(i));
   }
 
   // SILI_T
@@ -313,8 +315,8 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     family = "MUST2/RAW/SILIT";
 
     FillSpectra(family,name
-      ,RawData->GetMMSiLiTPadNbr(i),
-          RawData->GetMMSiLiTTime(i));
+        ,RawData->GetMMSiLiTPadNbr(i),
+        RawData->GetMMSiLiTTime(i));
   }
 
   // CSI_E
@@ -323,8 +325,8 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     family = "MUST2/RAW/CSIE";
 
     FillSpectra(family,name
-      ,RawData->GetMMCsIECristalNbr(i), 
-          RawData->GetMMCsIEEnergy(i));
+        ,RawData->GetMMCsIECristalNbr(i), 
+        RawData->GetMMCsIEEnergy(i));
   }
 
   // CSI_T
@@ -333,8 +335,8 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     family = "MUST2/RAW/CSIT";
 
     FillSpectra(family,name
-      ,RawData->GetMMCsITCristalNbr(i), 
-          RawData->GetMMCsITTime(i));
+        ,RawData->GetMMCsITCristalNbr(i), 
+        RawData->GetMMCsITTime(i));
   }
 
   // STRX MULT
@@ -351,7 +353,7 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     name = "MM"+NPL::itoa(i+1)+"_STRX_RAW_MULT";
     family= "MUST2/RAW/MULT";
     FillSpectra(family,name
-      ,myMULT[i]);
+        ,myMULT[i]);
   }
 
   // STRY MULT
@@ -366,7 +368,7 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     name = "MM"+NPL::itoa(i+1)+"_STRY_RAW_MULT";
     family= "MUST2/RAW/MULT";
     FillSpectra(family,name
-      ,myMULT[i]);
+        ,myMULT[i]);
   }
 
   // SILI MULT
@@ -381,7 +383,7 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     name = "MM"+NPL::itoa(i+1)+"_SILI_RAW_MULT";
     family= "MUST2/RAW/MULT";
     FillSpectra(family,name
-      ,myMULT[i]);
+        ,myMULT[i]);
   }
 
   // CSI MULT
@@ -396,7 +398,7 @@ void TMust2Spectra::FillRawSpectra(TMust2Data* RawData){
     name = "MM"+NPL::itoa(i+1)+"_CSI_RAW_MULT";
     family= "MUST2/RAW/MULT";
     FillSpectra(family,name
-      ,myMULT[i]);
+        ,myMULT[i]);
   }
 
 }
@@ -412,8 +414,8 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     family = "MUST2/CAL/STRXE";
 
     FillSpectra(family,name
-      ,PreTreatedData->GetMMStripXEStripNbr(i), 
-          PreTreatedData->GetMMStripXEEnergy(i));
+        ,PreTreatedData->GetMMStripXEStripNbr(i), 
+        PreTreatedData->GetMMStripXEEnergy(i));
   }
   // STRY_E
   for (unsigned int i = 0; i < PreTreatedData->GetMMStripYEMult(); i++) {
@@ -421,8 +423,8 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     family = "MUST2/CAL/STRYE";
 
     FillSpectra(family,name
-      ,PreTreatedData->GetMMStripYEStripNbr(i), 
-          PreTreatedData->GetMMStripYEEnergy(i));
+        ,PreTreatedData->GetMMStripYEStripNbr(i), 
+        PreTreatedData->GetMMStripYEEnergy(i));
   }
   // STRX_T
   for (unsigned int i = 0; i < PreTreatedData->GetMMStripXTMult(); i++) {
@@ -430,8 +432,8 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     family = "MUST2/CAL/STRXT";
 
     FillSpectra(family,name
-      ,PreTreatedData->GetMMStripXTStripNbr(i), 
-          PreTreatedData->GetMMStripXTTime(i));
+        ,PreTreatedData->GetMMStripXTStripNbr(i), 
+        PreTreatedData->GetMMStripXTTime(i));
   }
   // STRY_T
   for (unsigned int i = 0; i < PreTreatedData->GetMMStripYTMult(); i++) {
@@ -439,8 +441,8 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     family = "MUST2/CAL/STRYT";
 
     FillSpectra(family,name
-      ,PreTreatedData->GetMMStripYTStripNbr(i), 
-          PreTreatedData->GetMMStripYTTime(i));
+        ,PreTreatedData->GetMMStripYTStripNbr(i), 
+        PreTreatedData->GetMMStripYTTime(i));
   }
   // SILI_E
   for (unsigned int i = 0; i < PreTreatedData->GetMMSiLiEMult(); i++) {
@@ -448,8 +450,8 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     family = "MUST2/CAL/SILIE";
 
     FillSpectra(family,name
-      ,PreTreatedData->GetMMSiLiEPadNbr(i), 
-          PreTreatedData->GetMMSiLiEEnergy(i));
+        ,PreTreatedData->GetMMSiLiEPadNbr(i), 
+        PreTreatedData->GetMMSiLiEEnergy(i));
   }
   // SILI_T
   for (unsigned int i = 0; i < PreTreatedData->GetMMSiLiTMult(); i++) {
@@ -457,8 +459,8 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     family = "MUST2/CAL/SILIT";
 
     FillSpectra(family,name
-      ,PreTreatedData->GetMMSiLiTPadNbr(i), 
-          PreTreatedData->GetMMSiLiTTime(i));
+        ,PreTreatedData->GetMMSiLiTPadNbr(i), 
+        PreTreatedData->GetMMSiLiTTime(i));
   }
   // CSI_E
   for (unsigned int i = 0; i < PreTreatedData->GetMMCsIEMult(); i++) {
@@ -466,18 +468,18 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     family = "MUST2/CAL/CSIE";
 
     FillSpectra(family,name
-      ,PreTreatedData->GetMMCsIECristalNbr(i),   
-          PreTreatedData->GetMMCsIEEnergy(i));
+        ,PreTreatedData->GetMMCsIECristalNbr(i),   
+        PreTreatedData->GetMMCsIEEnergy(i));
   }
-  
+
   // CSI_T
   for (unsigned int i = 0; i < PreTreatedData->GetMMCsITMult(); i++) {
     name = "MM"+NPL::itoa(PreTreatedData->GetMMCsITDetectorNbr(i))+"_CSI_T_CAL";
     family = "MUST2/CAL/CSIT";
 
     FillSpectra(family,name
-      ,PreTreatedData->GetMMCsITCristalNbr(i), 
-          PreTreatedData->GetMMCsITTime(i));
+        ,PreTreatedData->GetMMCsITCristalNbr(i), 
+        PreTreatedData->GetMMCsITTime(i));
   }
 
   // STRX MULT
@@ -494,7 +496,7 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     name = "MM"+NPL::itoa(i+1)+"_STRX_CAL_MULT";
     family= "MUST2/CAL/MULT";
     FillSpectra(family,name
-      ,myMULT[i]);
+        ,myMULT[i]);
   }
 
   // STRY MULT
@@ -509,7 +511,7 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     name = "MM"+NPL::itoa(i+1)+"_STRY_CAL_MULT";
     family= "MUST2/CAL/MULT";
     FillSpectra(family,name
-      ,myMULT[i]);
+        ,myMULT[i]);
   }
 
   // SILI MULT
@@ -524,7 +526,7 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     name = "MM"+NPL::itoa(i+1)+"_SILI_CAL_MULT";
     family= "MUST2/CAL/MULT";
     FillSpectra(family,name
-      ,myMULT[i]);
+        ,myMULT[i]);
   }
 
   // CSI MULT
@@ -539,20 +541,20 @@ void TMust2Spectra::FillPreTreatedSpectra(TMust2Data* PreTreatedData){
     name = "MM"+NPL::itoa(i+1)+"_CSI_CAL_MULT";
     family= "MUST2/CAL/MULT";
     FillSpectra(family,name
-      ,myMULT[i]);
+        ,myMULT[i]);
   }
 
   //E-CSI ID
   family = "MUST2/CAL/ID";
   for (unsigned int i = 0; i < PreTreatedData->GetMMStripXEMult(); i++) {
-   for (unsigned int j = 0; j < PreTreatedData->GetMMCsIEMult(); j++) {
-    
-    if(PreTreatedData->GetMMStripXEDetectorNbr(i) == PreTreatedData->GetMMCsIEDetectorNbr(j)){ 
-      name = "MM"+NPL::itoa(PreTreatedData->GetMMStripXEDetectorNbr(i))+"_CSI"+NPL::itoa(PreTreatedData->GetMMCsIECristalNbr(j))+"_CAL_ID";
-    
-      FillSpectra(family,name
-        ,PreTreatedData->GetMMCsIEEnergy(j), 
-          PreTreatedData->GetMMStripXEEnergy(i));
+    for (unsigned int j = 0; j < PreTreatedData->GetMMCsIEMult(); j++) {
+
+      if(PreTreatedData->GetMMStripXEDetectorNbr(i) == PreTreatedData->GetMMCsIEDetectorNbr(j)){ 
+        name = "MM"+NPL::itoa(PreTreatedData->GetMMStripXEDetectorNbr(i))+"_CSI"+NPL::itoa(PreTreatedData->GetMMCsIECristalNbr(j))+"_CAL_ID";
+
+        FillSpectra(family,name
+            ,PreTreatedData->GetMMCsIEEnergy(j), 
+            PreTreatedData->GetMMStripXEEnergy(i));
       }
     }
   }
diff --git a/NPLib/Detectors/Mugast/CMakeLists.txt b/NPLib/Detectors/Mugast/CMakeLists.txt
index 7db0a1ebfe7b1040f5f6242d148b9fa30e2b8614..b01a4c20b7380a3dc33b4e34aa32c97b7ccee3e8 100644
--- a/NPLib/Detectors/Mugast/CMakeLists.txt
+++ b/NPLib/Detectors/Mugast/CMakeLists.txt
@@ -1,7 +1,7 @@
 add_custom_command(OUTPUT TMugastPhysicsDict.cxx COMMAND ../../scripts/build_dict.sh TMugastPhysics.h TMugastPhysicsDict.cxx TMugastPhysics.rootmap libNPMugast.dylib DEPENDS TMugastPhysics.h)
 add_custom_command(OUTPUT TMugastDataDict.cxx COMMAND ../../scripts/build_dict.sh TMugastData.h TMugastDataDict.cxx TMugastData.rootmap libNPMugast.dylib DEPENDS TMugastData.h)
 #add_library(NPMUST2 SHARED TMugastData.cxx TMugastPhysics.cxx TMugastDataDict.cxx TMugastPhysicsDict.cxx TMugastSpectra.cxx)
-add_library(NPMugast SHARED TMugastData.cxx TMugastDataDict.cxx TMugastPhysics.cxx TMugastPhysicsDict.cxx)
+add_library(NPMugast SHARED TMugastData.cxx TMugastDataDict.cxx TMugastPhysics.cxx TMugastPhysicsDict.cxx TMugastSpectra.h TMugastSpectra.cxx)
 target_link_libraries(NPMugast ${ROOT_LIBRARIES} NPCore) 
 #install(FILES TMugastData.h TMugastPhysics.h TMugastSpectra.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
 install(FILES TMugastData.h TMugastPhysics.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
diff --git a/NPLib/Detectors/Mugast/TMugastPhysics.cxx b/NPLib/Detectors/Mugast/TMugastPhysics.cxx
index 129b7a32322bf39578e6758ac9e2344c8e3efff7..e8da42af665acda0cc4d97cc7d2e596b370d140e 100644
--- a/NPLib/Detectors/Mugast/TMugastPhysics.cxx
+++ b/NPLib/Detectors/Mugast/TMugastPhysics.cxx
@@ -42,28 +42,28 @@ using namespace NPUNITS;
 ///////////////////////////////////////////////////////////////////////////
 
 ClassImp(TMugastPhysics)
-    ///////////////////////////////////////////////////////////////////////////
-    TMugastPhysics::TMugastPhysics() {
-  EventMultiplicity                  = 0;
-  m_EventData                        = new TMugastData;
-  m_PreTreatedData                   = new TMugastData;
-  m_EventPhysics                     = this;
-  //m_Spectra                          = NULL;
-  m_NumberOfTelescope                = 0;
-  m_MaximumStripMultiplicityAllowed  = 10;
-  m_StripEnergyMatching = 0.050;
-  // Raw Threshold
-  m_DSSD_X_E_RAW_Threshold = 8200;
-  m_DSSD_Y_E_RAW_Threshold = 8200;
-  m_SecondLayer_E_RAW_Threshold = 8200;
-  // Calibrated Threshold
-  m_DSSD_X_E_Threshold = 0;
-  m_DSSD_Y_E_Threshold = 0;
-  m_SecondLayer_E_Threshold  = 0;
-
-  m_Take_E_Y = false;
-  m_Take_T_Y = true;
-}
+  ///////////////////////////////////////////////////////////////////////////
+  TMugastPhysics::TMugastPhysics() {
+    EventMultiplicity                  = 0;
+    m_EventData                        = new TMugastData;
+    m_PreTreatedData                   = new TMugastData;
+    m_EventPhysics                     = this;
+    m_Spectra                          = NULL;
+    m_NumberOfTelescope                = 0;
+    m_MaximumStripMultiplicityAllowed  = 10;
+    m_StripEnergyMatching = 0.050;
+    // Raw Threshold
+    m_DSSD_X_E_RAW_Threshold = 8200;
+    m_DSSD_Y_E_RAW_Threshold = 8200;
+    m_SecondLayer_E_RAW_Threshold = 8200;
+    // Calibrated Threshold
+    m_DSSD_X_E_Threshold = 0;
+    m_DSSD_Y_E_Threshold = 0;
+    m_SecondLayer_E_Threshold  = 0;
+
+    m_Take_E_Y = false;
+    m_Take_T_Y = true;
+  }
 
 ///////////////////////////////////////////////////////////////////////////
 TMugastPhysics::~TMugastPhysics() {}
@@ -81,26 +81,26 @@ void TMugastPhysics::PreTreat() {
   DSSDY_TMult = m_EventData->GetDSSDYTMult();
   SecondLayer_EMult = m_EventData->GetSecondLayerEMult();
   SecondLayer_TMult = m_EventData->GetSecondLayerTMult();
-  
+
   //   X
   //   E
   for (unsigned int i = 0; i < DSSDX_EMult; ++i) {
     if (m_EventData->GetDSSDXEEnergy(i) > m_DSSD_X_E_RAW_Threshold
         && IsValidChannel(0, m_EventData->GetDSSDXEDetectorNbr(i),
-                          m_EventData->GetDSSDXEStripNbr(i))) {
+          m_EventData->GetDSSDXEStripNbr(i))) {
       double EX = fDSSD_X_E(m_EventData, i);
       if (EX > m_DSSD_X_E_Threshold)
         m_PreTreatedData->SetDSSDXE(m_EventData->GetDSSDXEDetectorNbr(i),
-                                     m_EventData->GetDSSDXEStripNbr(i), EX);
+            m_EventData->GetDSSDXEStripNbr(i), EX);
     }
   }
   //   T
   for (unsigned int i = 0; i < DSSDX_TMult; ++i) {
     if (IsValidChannel(0, m_EventData->GetDSSDXTDetectorNbr(i),
-                       m_EventData->GetDSSDXTStripNbr(i)))
+          m_EventData->GetDSSDXTStripNbr(i)))
       m_PreTreatedData->SetDSSDXT(m_EventData->GetDSSDXTDetectorNbr(i),
-                                   m_EventData->GetDSSDXTStripNbr(i),
-                                   fDSSD_X_T(m_EventData, i));
+          m_EventData->GetDSSDXTStripNbr(i),
+          fDSSD_X_T(m_EventData, i));
   }
 
   //   Y
@@ -108,43 +108,43 @@ void TMugastPhysics::PreTreat() {
   for (unsigned int i = 0; i < DSSDY_EMult; ++i) {
     if (m_EventData->GetDSSDYEEnergy(i) < m_DSSD_Y_E_RAW_Threshold
         && IsValidChannel(1, m_EventData->GetDSSDYEDetectorNbr(i),
-                          m_EventData->GetDSSDYEStripNbr(i))) {
+          m_EventData->GetDSSDYEStripNbr(i))) {
       double EY = fDSSD_Y_E(m_EventData, i);
       if (EY > m_DSSD_Y_E_Threshold)
         m_PreTreatedData->SetDSSDYE(m_EventData->GetDSSDYEDetectorNbr(i),
-                                     m_EventData->GetDSSDYEStripNbr(i), EY);
+            m_EventData->GetDSSDYEStripNbr(i), EY);
     }
   }
 
   //   T
   for (unsigned int i = 0; i < DSSDY_TMult; ++i) {
     if (IsValidChannel(1, m_EventData->GetDSSDYTDetectorNbr(i),
-                       m_EventData->GetDSSDYTStripNbr(i)))
+          m_EventData->GetDSSDYTStripNbr(i)))
       m_PreTreatedData->SetDSSDYT(m_EventData->GetDSSDYTDetectorNbr(i),
-                                   m_EventData->GetDSSDYTStripNbr(i),
-                                   fDSSD_Y_T(m_EventData, i));
+          m_EventData->GetDSSDYTStripNbr(i),
+          fDSSD_Y_T(m_EventData, i));
   }
 
   //   SecondLayer
   //   E
   for (unsigned int i = 0; i < SecondLayer_EMult; ++i) {
     if (m_EventData->GetSecondLayerEEnergy(i) > m_SecondLayer_E_RAW_Threshold
-        && IsValidChannel(3, m_EventData->GetSecondLayerEDetectorNbr(i),
-                          m_EventData->GetSecondLayerEStripNbr(i))) {
+        && IsValidChannel(2, m_EventData->GetSecondLayerEDetectorNbr(i),
+          m_EventData->GetSecondLayerEStripNbr(i))) {
       double ESecondLayer = fSecondLayer_E(m_EventData, i);
       if (ESecondLayer > m_SecondLayer_E_Threshold)
         m_PreTreatedData->SetSecondLayerE(m_EventData->GetSecondLayerEDetectorNbr(i),
-                                  m_EventData->GetSecondLayerEStripNbr(i), ESecondLayer);
+            m_EventData->GetSecondLayerEStripNbr(i), ESecondLayer);
     }
   }
 
   //   T
   for (unsigned int i = 0; i < SecondLayer_TMult; ++i) {
-    if (IsValidChannel(3, m_EventData->GetSecondLayerTDetectorNbr(i),
-                       m_EventData->GetSecondLayerTStripNbr(i)))
+    if (IsValidChannel(2, m_EventData->GetSecondLayerTDetectorNbr(i),
+          m_EventData->GetSecondLayerTStripNbr(i)))
       m_PreTreatedData->SetSecondLayerT(m_EventData->GetSecondLayerTDetectorNbr(i),
-                                m_EventData->GetSecondLayerTStripNbr(i),
-                                fSecondLayer_T(m_EventData, i));
+          m_EventData->GetSecondLayerTStripNbr(i),
+          fSecondLayer_T(m_EventData, i));
   }
 
   return;
@@ -187,9 +187,9 @@ void TMugastPhysics::BuildPhysicalEvent() {
       double DSSD_X_T = -1000;
       for (unsigned int t = 0; t < DSSDXTMult; ++t) {
         if (m_PreTreatedData->GetDSSDXTStripNbr(couple[i].X())
-                == m_PreTreatedData->GetDSSDXTStripNbr(t)
+            == m_PreTreatedData->GetDSSDXTStripNbr(t)
             && m_PreTreatedData->GetDSSDXTDetectorNbr(couple[i].X())
-                   == m_PreTreatedData->GetDSSDXTDetectorNbr(t)) {
+            == m_PreTreatedData->GetDSSDXTDetectorNbr(t)) {
           DSSD_X_T = m_PreTreatedData->GetDSSDXTTime(t);
           break;
         }
@@ -198,9 +198,9 @@ void TMugastPhysics::BuildPhysicalEvent() {
       double DSSD_Y_T = -1000;
       for (unsigned int t = 0; t < DSSDYTMult; ++t) {
         if (m_PreTreatedData->GetDSSDYTStripNbr(couple[i].Y())
-                == m_PreTreatedData->GetDSSDYTStripNbr(t)
+            == m_PreTreatedData->GetDSSDYTStripNbr(t)
             && m_PreTreatedData->GetDSSDYTDetectorNbr(couple[i].Y())
-                   == m_PreTreatedData->GetDSSDYTDetectorNbr(t)) {
+            == m_PreTreatedData->GetDSSDYTDetectorNbr(t)) {
           DSSD_Y_T = m_PreTreatedData->GetDSSDYTTime(t);
           break;
         }
@@ -230,9 +230,9 @@ void TMugastPhysics::BuildPhysicalEvent() {
             for (unsigned int k = 0; k < SecondLayerTMult; ++k) {
               // Same DSSD, Same Detector
               if (m_PreTreatedData->GetSecondLayerEStripNbr(j)
-                      == m_PreTreatedData->GetSecondLayerTStripNbr(k)
+                  == m_PreTreatedData->GetSecondLayerTStripNbr(k)
                   && m_PreTreatedData->GetSecondLayerEDetectorNbr(j)
-                         == m_PreTreatedData->GetSecondLayerTDetectorNbr(k)) {
+                  == m_PreTreatedData->GetSecondLayerTDetectorNbr(k)) {
                 SecondLayer_T[SecondLayer_T.size() - 1] = m_PreTreatedData->GetSecondLayerTTime(j);
                 break;
               }
@@ -307,14 +307,14 @@ vector<TVector2> TMugastPhysics::Match_X_Y() {
         //   Look if energy match
         if (abs((DSSDXEnergy - DSSDYEnergy) / 2.)
             < m_StripEnergyMatching) {
-            // Gives a unique ID for every telescope and strip combination
-            int IDX = m_NumberOfTelescope * DSSDXNbr + DSSDXDetNbr;
-            int IDY = m_NumberOfTelescope * DSSDYNbr + DSSDYDetNbr;
+          // Gives a unique ID for every telescope and strip combination
+          int IDX = m_NumberOfTelescope * DSSDXNbr + DSSDXDetNbr;
+          int IDY = m_NumberOfTelescope * DSSDYNbr + DSSDYDetNbr;
 
-            m_HitDSSDX[IDX]++;
-            m_HitDSSDY[IDY]++;
+          m_HitDSSDX[IDX]++;
+          m_HitDSSDY[IDY]++;
 
-            ArrayOfGoodCouple.push_back(TVector2(i, j));
+          ArrayOfGoodCouple.push_back(TVector2(i, j));
         }
       }
     }
@@ -343,7 +343,7 @@ vector<TVector2> TMugastPhysics::Match_X_Y() {
 
 ////////////////////////////////////////////////////////////////////////////
 bool TMugastPhysics::IsValidChannel(const int& DetectorType,
-                                   const int& telescope, const int& channel) {
+    const int& telescope, const int& channel) {
   if (DetectorType == 0)
     return *(m_XChannelStatus[m_DetectorNumberIndex[telescope] - 1].begin() + channel - 1);
 
@@ -359,27 +359,27 @@ bool TMugastPhysics::IsValidChannel(const int& DetectorType,
 
 ///////////////////////////////////////////////////////////////////////////
 void TMugastPhysics::ReadAnalysisConfig() {
-  
+
   NPL::InputParser parser("./configs/ConfigMugast.dat");
   vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("ConfigMugast");
-  
+
   for (unsigned int i = 0; i < blocks.size(); i++) {
-   if(blocks[i]->HasToken("MAX_STRIP_MULTIPLICITY"))
-    m_MaximumStripMultiplicityAllowed = blocks[i]->GetInt("MAX_STRIP_MULTIPLICITY");
-   else if(blocks[i]->HasToken("STRIP_ENERGY_MATCHING"))
-    m_StripEnergyMatching = blocks[i]->GetDouble("STRIP_ENERGY_MATCHING","MeV");
-   else if(blocks[i]->HasToken("DISABLE_CHANNEL")){
-    vector<int> v = blocks[i]->GetVectorInt("DISABLE_CHANNEL");
-    *(m_XChannelStatus[v[0] - 1].begin() + v[1] - 1) = false;
+    if(blocks[i]->HasToken("MAX_STRIP_MULTIPLICITY"))
+      m_MaximumStripMultiplicityAllowed = blocks[i]->GetInt("MAX_STRIP_MULTIPLICITY");
+    else if(blocks[i]->HasToken("STRIP_ENERGY_MATCHING"))
+      m_StripEnergyMatching = blocks[i]->GetDouble("STRIP_ENERGY_MATCHING","MeV");
+    else if(blocks[i]->HasToken("DISABLE_CHANNEL")){
+      vector<int> v = blocks[i]->GetVectorInt("DISABLE_CHANNEL");
+      *(m_XChannelStatus[v[0] - 1].begin() + v[1] - 1) = false;
     }
-   else if(blocks[i]->HasToken("DISABLE_ALL")){
-    int telescope = blocks[i]->GetInt("DISABLE_ALL");
-    vector<bool> ChannelStatus;
-    ChannelStatus.resize(128, false);
-    m_XChannelStatus[telescope - 1] = ChannelStatus;
-    m_YChannelStatus[telescope - 1] = ChannelStatus;
-    ChannelStatus.resize(16, false);
-    m_SecondLayerChannelStatus[telescope - 1]  = ChannelStatus;
+    else if(blocks[i]->HasToken("DISABLE_ALL")){
+      int telescope = blocks[i]->GetInt("DISABLE_ALL");
+      vector<bool> ChannelStatus;
+      ChannelStatus.resize(128, false);
+      m_XChannelStatus[telescope - 1] = ChannelStatus;
+      m_YChannelStatus[telescope - 1] = ChannelStatus;
+      ChannelStatus.resize(16, false);
+      m_SecondLayerChannelStatus[telescope - 1]  = ChannelStatus;
     }
     else if (blocks[i]->HasToken("TAKE_E_Y"))
       m_Take_E_Y = blocks[i]->GetInt("TAKE_E_Y");
@@ -392,22 +392,22 @@ void TMugastPhysics::ReadAnalysisConfig() {
 
     else if (blocks[i]->HasToken("TAKE_T_X"))
       m_Take_T_Y = !(blocks[i]->GetInt("TAKE_T_X"));
-    
+
     else if (blocks[i]->HasToken("DSSD_X_E_RAW_THRESHOLD"))
       m_DSSD_X_E_RAW_Threshold = blocks[i]->GetInt("DSSD_X_E_RAW_THRESHOLD");
 
     else if (blocks[i]->HasToken("DSSD_Y_E_RAW_THRESHOLD"))
       m_DSSD_Y_E_RAW_Threshold = blocks[i]->GetInt("DSSD_Y_E_RAW_THRESHOLD");
-    
+
     else if (blocks[i]->HasToken("SECONDLAYER_E_RAW_THRESHOLD"))
       m_SecondLayer_E_RAW_Threshold = blocks[i]->GetInt("SECONDLAYER_E_RAW_THRESHOLD");
-    
+
     else if (blocks[i]->HasToken("DSSD_X_E_THRESHOLD"))
       m_DSSD_X_E_Threshold = blocks[i]->GetDouble("DSSD_X_E_THRESHOLD","MeV");
 
     else if (blocks[i]->HasToken("DSSD_Y_E_THRESHOLD"))
       m_DSSD_Y_E_Threshold = blocks[i]->GetDouble("DSSD_Y_E_THRESHOLD","MeV");
-    
+
     else if (blocks[i]->HasToken("SECONDLAYER_E_THRESHOLD"))
       m_SecondLayer_E_Threshold = blocks[i]->GetDouble("SECONDLAYER_E_THRESHOLD","MeV");
   }
@@ -415,14 +415,14 @@ void TMugastPhysics::ReadAnalysisConfig() {
 
 ///////////////////////////////////////////////////////////////////////////
 bool TMugastPhysics::Match_SecondLayer(int X, int Y, int StripNbr) {
-/*
-  if (abs(m_CsI_MatchingX[CristalNbr - 1] - X) < (double)m_CsI_Size / 2.
-      && abs(m_CsI_MatchingY[CristalNbr - 1] - Y) < (double)m_CsI_Size / 2.)
-    return true;
+  /*
+     if (abs(m_CsI_MatchingX[CristalNbr - 1] - X) < (double)m_CsI_Size / 2.
+     && abs(m_CsI_MatchingY[CristalNbr - 1] - Y) < (double)m_CsI_Size / 2.)
+     return true;
 
-  else
-    return false;*/
-    return true;
+     else
+     return false;*/
+  return true;
 }
 
 ///////////////////////////////////////////////////////////////////////////
@@ -456,14 +456,14 @@ void TMugastPhysics::ReadConfiguration(NPL::InputParser parser) {
   unsigned int det=0;
   // Cartesian Case
   vector<string> cart
-      = {"DetectorNumber","X1_Y1", "X1_Y128", "X128_Y1", "X128_Y128"};
+    = {"DetectorNumber","X1_Y1", "X1_Y128", "X128_Y1", "X128_Y128"};
   // Spherical Case
   vector<string> sphe = {"DetectorNumber","R", "THETA", "PHI", "BETA"};
 
   for (unsigned int i = 0; i < blocks.size(); i++) {
     if (blocks[i]->HasTokenList(cart)) {
       if (NPOptionManager::getInstance()->GetVerboseLevel())
-      cout << endl << "////  Mugast Telescope " << i + 1 << endl;
+        cout << endl << "////  Mugast Telescope " << i + 1 << endl;
       int detectorNbr = blocks[i]->GetInt("DetectorNumber");
       det = i+1;
       m_DetectorNumberIndex[detectorNbr]=det;
@@ -476,7 +476,7 @@ void TMugastPhysics::ReadConfiguration(NPL::InputParser parser) {
 
     else if (blocks[i]->HasTokenList(sphe)) {
       if (NPOptionManager::getInstance()->GetVerboseLevel())
-      cout << endl << "////  Mugast Telescope " << i + 1 << endl;
+        cout << endl << "////  Mugast Telescope " << i + 1 << endl;
       int detectorNbr = blocks[i]->GetInt("DetectorNumber");
       det = i+1;
       m_DetectorNumberIndex[detectorNbr]=det;
@@ -489,8 +489,8 @@ void TMugastPhysics::ReadConfiguration(NPL::InputParser parser) {
 
     else {
       cout << "ERROR: Missing token for Mugast, check your input "
-              "file"
-           << endl;
+        "file"
+        << endl;
       exit(1);
     }
   }
@@ -500,14 +500,14 @@ void TMugastPhysics::ReadConfiguration(NPL::InputParser parser) {
 }
 //////////////////////////////////////////////////////////////////////////
 void TMugastPhysics::InitSpectra() {
-  //m_Spectra = new TMugastSpectra(m_NumberOfTelescope);
+  m_Spectra = new TMugastSpectra(m_DetectorNumberIndex);
 }
 
 ///////////////////////////////////////////////////////////////////////////
 void TMugastPhysics::FillSpectra() {
- // m_Spectra->FillRawSpectra(m_EventData);
- // m_Spectra->FillPreTreatedSpectra(m_PreTreatedData);
- // m_Spectra->FillPhysicsSpectra(m_EventPhysics);
+  m_Spectra->FillRawSpectra(m_EventData);
+  m_Spectra->FillPreTreatedSpectra(m_PreTreatedData);
+  m_Spectra->FillPhysicsSpectra(m_EventPhysics);
 }
 ///////////////////////////////////////////////////////////////////////////
 void TMugastPhysics::CheckSpectra() { /*m_Spectra->CheckSpectra();*/ }
@@ -518,20 +518,18 @@ void TMugastPhysics::ClearSpectra() {
 
 ///////////////////////////////////////////////////////////////////////////
 void TMugastPhysics::WriteSpectra() {
-  //if (m_Spectra)
-  //  m_Spectra->WriteSpectra();
+  if (m_Spectra)
+    m_Spectra->WriteSpectra();
 }
 
 ///////////////////////////////////////////////////////////////////////////
 map<string, TH1*> TMugastPhysics::GetSpectra() {
-/*  if (m_Spectra)
-    return m_Spectra->GetMapHisto();
+ if(m_Spectra)
+  return m_Spectra->GetMapHisto();
   else {
     map<string, TH1*> empty;
     return empty;
-  }*/
-  map<string, TH1*> empty;
-  return empty;
+  }
 }
 
 ///////////////////////////////////////////////////////////////////////////
@@ -623,7 +621,7 @@ void TMugastPhysics::InitializeRootOutput() {
 /////   Specific to MugastArray   ////
 
 void TMugastPhysics::AddTelescope(TVector3 C_X1_Y1, TVector3 C_X128_Y1,
-                                 TVector3 C_X1_Y128, TVector3 C_X128_Y128) {
+    TVector3 C_X1_Y128, TVector3 C_X128_Y128) {
   // To avoid warning
   C_X128_Y128 *= 1;
 
@@ -704,7 +702,7 @@ void TMugastPhysics::InitializeStandardParameter() {
 }
 
 void TMugastPhysics::AddTelescope(double theta, double phi, double distance,
-                                 double beta_u, double beta_v, double beta_w) {
+    double beta_u, double beta_v, double beta_w) {
 
   m_NumberOfTelescope++;
 
@@ -725,10 +723,10 @@ void TMugastPhysics::AddTelescope(double theta, double phi, double distance,
   TVector3 C;
 
   C = TVector3(distance * sin(theta) * cos(phi),
-               distance * sin(theta) * sin(phi), distance * cos(theta));
+      distance * sin(theta) * sin(phi), distance * cos(theta));
 
   TVector3 P
-      = TVector3(cos(theta) * cos(phi), cos(theta) * sin(phi), -sin(theta));
+    = TVector3(cos(theta) * cos(phi), cos(theta) * sin(phi), -sin(theta));
 
   W = C.Unit();
   U = W.Cross(P);
@@ -792,29 +790,29 @@ void TMugastPhysics::AddTelescope(double theta, double phi, double distance,
 
 TVector3 TMugastPhysics::GetPositionOfInteraction(const int i) {
   TVector3 Position
-      = TVector3(GetStripPositionX(TelescopeNumber[i], DSSD_X[i], DSSD_Y[i]),
-                 GetStripPositionY(TelescopeNumber[i], DSSD_X[i], DSSD_Y[i]),
-                 GetStripPositionZ(TelescopeNumber[i], DSSD_X[i], DSSD_Y[i]));
+    = TVector3(GetStripPositionX(TelescopeNumber[i], DSSD_X[i], DSSD_Y[i]),
+        GetStripPositionY(TelescopeNumber[i], DSSD_X[i], DSSD_Y[i]),
+        GetStripPositionZ(TelescopeNumber[i], DSSD_X[i], DSSD_Y[i]));
 
   return (Position);
 }
 
 TVector3 TMugastPhysics::GetTelescopeNormal(const int i) {
   TVector3 U = TVector3(GetStripPositionX(TelescopeNumber[i], 128, 1),
-                        GetStripPositionY(TelescopeNumber[i], 128, 1),
-                        GetStripPositionZ(TelescopeNumber[i], 128, 1))
+      GetStripPositionY(TelescopeNumber[i], 128, 1),
+      GetStripPositionZ(TelescopeNumber[i], 128, 1))
 
-               - TVector3(GetStripPositionX(TelescopeNumber[i], 1, 1),
-                          GetStripPositionY(TelescopeNumber[i], 1, 1),
-                          GetStripPositionZ(TelescopeNumber[i], 1, 1));
+    - TVector3(GetStripPositionX(TelescopeNumber[i], 1, 1),
+        GetStripPositionY(TelescopeNumber[i], 1, 1),
+        GetStripPositionZ(TelescopeNumber[i], 1, 1));
 
   TVector3 V = TVector3(GetStripPositionX(TelescopeNumber[i], 128, 128),
-                        GetStripPositionY(TelescopeNumber[i], 128, 128),
-                        GetStripPositionZ(TelescopeNumber[i], 128, 128))
+      GetStripPositionY(TelescopeNumber[i], 128, 128),
+      GetStripPositionZ(TelescopeNumber[i], 128, 128))
 
-               - TVector3(GetStripPositionX(TelescopeNumber[i], 128, 1),
-                          GetStripPositionY(TelescopeNumber[i], 128, 1),
-                          GetStripPositionZ(TelescopeNumber[i], 128, 1));
+    - TVector3(GetStripPositionX(TelescopeNumber[i], 128, 1),
+        GetStripPositionY(TelescopeNumber[i], 128, 1),
+        GetStripPositionZ(TelescopeNumber[i], 128, 1));
 
   TVector3 Normal = U.Cross(V);
 
@@ -823,75 +821,75 @@ TVector3 TMugastPhysics::GetTelescopeNormal(const int i) {
 
 ///////////////////////////////////////////////////////////////////////////
 namespace MUST2_LOCAL {
-//   DSSD
-//   X
-double fDSSD_X_E(const TMugastData* m_EventData, const int& i) {
-  static string name;
-  name = "MUST2/T";
-  name += NPL::itoa(m_EventData->GetDSSDXEDetectorNbr(i));
-  name += "_DSSD_X";
-  name += NPL::itoa(m_EventData->GetDSSDXEStripNbr(i));
-  name += "_E";
-  return CalibrationManager::getInstance()->ApplyCalibration(
-      name, m_EventData->GetDSSDXEEnergy(i));
-}
+  //   DSSD
+  //   X
+  double fDSSD_X_E(const TMugastData* m_EventData, const int& i) {
+    static string name;
+    name = "MUST2/T";
+    name += NPL::itoa(m_EventData->GetDSSDXEDetectorNbr(i));
+    name += "_DSSD_X";
+    name += NPL::itoa(m_EventData->GetDSSDXEStripNbr(i));
+    name += "_E";
+    return CalibrationManager::getInstance()->ApplyCalibration(
+        name, m_EventData->GetDSSDXEEnergy(i));
+  }
 
-double fDSSD_X_T(const TMugastData* m_EventData, const int& i) {
-  static string name;
-  name = "MUST2/T";
-  name += NPL::itoa(m_EventData->GetDSSDXTDetectorNbr(i));
-  name += "_DSSD_X";
-  name += NPL::itoa(m_EventData->GetDSSDXTStripNbr(i));
-  name += "_T";
-  return CalibrationManager::getInstance()->ApplyCalibration(
-      name, m_EventData->GetDSSDXTTime(i));
-}
+  double fDSSD_X_T(const TMugastData* m_EventData, const int& i) {
+    static string name;
+    name = "MUST2/T";
+    name += NPL::itoa(m_EventData->GetDSSDXTDetectorNbr(i));
+    name += "_DSSD_X";
+    name += NPL::itoa(m_EventData->GetDSSDXTStripNbr(i));
+    name += "_T";
+    return CalibrationManager::getInstance()->ApplyCalibration(
+        name, m_EventData->GetDSSDXTTime(i));
+  }
 
-//   Y
-double fDSSD_Y_E(const TMugastData* m_EventData, const int& i) {
-  static string name;
-  name = "MUST2/T";
-  name += NPL::itoa(m_EventData->GetDSSDYEDetectorNbr(i));
-  name += "_DSSD_Y";
-  name += NPL::itoa(m_EventData->GetDSSDYEStripNbr(i));
-  name += "_E";
-  return CalibrationManager::getInstance()->ApplyCalibration(
-      name, m_EventData->GetDSSDYEEnergy(i));
-}
+  //   Y
+  double fDSSD_Y_E(const TMugastData* m_EventData, const int& i) {
+    static string name;
+    name = "MUST2/T";
+    name += NPL::itoa(m_EventData->GetDSSDYEDetectorNbr(i));
+    name += "_DSSD_Y";
+    name += NPL::itoa(m_EventData->GetDSSDYEStripNbr(i));
+    name += "_E";
+    return CalibrationManager::getInstance()->ApplyCalibration(
+        name, m_EventData->GetDSSDYEEnergy(i));
+  }
 
-double fDSSD_Y_T(const TMugastData* m_EventData, const int& i) {
-  static string name;
-  name = "MUST2/T";
-  name += NPL::itoa(m_EventData->GetDSSDYTDetectorNbr(i));
-  name += "_DSSD_Y";
-  name += NPL::itoa(m_EventData->GetDSSDYTStripNbr(i));
-  name += "_T";
-  return CalibrationManager::getInstance()->ApplyCalibration(
-      name, m_EventData->GetDSSDYTTime(i));
-}
+  double fDSSD_Y_T(const TMugastData* m_EventData, const int& i) {
+    static string name;
+    name = "MUST2/T";
+    name += NPL::itoa(m_EventData->GetDSSDYTDetectorNbr(i));
+    name += "_DSSD_Y";
+    name += NPL::itoa(m_EventData->GetDSSDYTStripNbr(i));
+    name += "_T";
+    return CalibrationManager::getInstance()->ApplyCalibration(
+        name, m_EventData->GetDSSDYTTime(i));
+  }
 
-//   SecondLayer
-double fSecondLayer_E(const TMugastData* m_EventData, const int& i) {
-  static string name;
-  name = "MUST2/T";
-  name += NPL::itoa(m_EventData->GetSecondLayerEDetectorNbr(i));
-  name += "_SecondLayer";
-  name += NPL::itoa(m_EventData->GetSecondLayerEStripNbr(i));
-  name += "_E";
-  return CalibrationManager::getInstance()->ApplyCalibration(
-      name, m_EventData->GetSecondLayerEEnergy(i));
-}
+  //   SecondLayer
+  double fSecondLayer_E(const TMugastData* m_EventData, const int& i) {
+    static string name;
+    name = "MUST2/T";
+    name += NPL::itoa(m_EventData->GetSecondLayerEDetectorNbr(i));
+    name += "_SecondLayer";
+    name += NPL::itoa(m_EventData->GetSecondLayerEStripNbr(i));
+    name += "_E";
+    return CalibrationManager::getInstance()->ApplyCalibration(
+        name, m_EventData->GetSecondLayerEEnergy(i));
+  }
 
-double fSecondLayer_T(const TMugastData* m_EventData, const int& i) {
-  static string name;
-  name = "MUST2/T";
-  name += NPL::itoa(m_EventData->GetSecondLayerTDetectorNbr(i));
-  name += "_SecondLayer";
-  name += NPL::itoa(m_EventData->GetSecondLayerTStripNbr(i));
-  name += "_T";
-  return CalibrationManager::getInstance()->ApplyCalibration(
-      name, m_EventData->GetSecondLayerTTime(i));
-}
+  double fSecondLayer_T(const TMugastData* m_EventData, const int& i) {
+    static string name;
+    name = "MUST2/T";
+    name += NPL::itoa(m_EventData->GetSecondLayerTDetectorNbr(i));
+    name += "_SecondLayer";
+    name += NPL::itoa(m_EventData->GetSecondLayerTStripNbr(i));
+    name += "_T";
+    return CalibrationManager::getInstance()->ApplyCalibration(
+        name, m_EventData->GetSecondLayerTTime(i));
+  }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -905,14 +903,14 @@ NPL::VDetector* TMugastPhysics::Construct() {
 //            Registering the construct method to the factory                 //
 ////////////////////////////////////////////////////////////////////////////////
 extern "C" {
-class proxy_Mugast {
-  public:
-  proxy_Mugast() {
-    NPL::DetectorFactory::getInstance()->AddToken("Mugast", "Mugast");
-    NPL::DetectorFactory::getInstance()->AddDetector("Mugast",
-                                                     TMugastPhysics::Construct);
-  }
-};
+  class proxy_Mugast {
+    public:
+      proxy_Mugast() {
+        NPL::DetectorFactory::getInstance()->AddToken("Mugast", "Mugast");
+        NPL::DetectorFactory::getInstance()->AddDetector("Mugast",
+            TMugastPhysics::Construct);
+      }
+  };
 
-proxy_Mugast p_Mugast;
+  proxy_Mugast p_Mugast;
 }
diff --git a/NPLib/Detectors/Mugast/TMugastPhysics.h b/NPLib/Detectors/Mugast/TMugastPhysics.h
index 5749b844bd21f903f2397650f44668e373ddb3f9..7204d0aed07d19792723b9286024cff0d7e9eae6 100644
--- a/NPLib/Detectors/Mugast/TMugastPhysics.h
+++ b/NPLib/Detectors/Mugast/TMugastPhysics.h
@@ -30,7 +30,7 @@
 #include "NPInputParser.h"
 #include "NPVDetector.h"
 #include "TMugastData.h"
-//#include "TMugastSpectra.h"
+#include "TMugastSpectra.h"
 // ROOT
 #include "TH1.h"
 #include "TObject.h"
@@ -40,7 +40,7 @@
 using namespace std;
 
 // Forward Declaration
-//class TMugastSpectra;
+class TMugastSpectra;
 
 class TMugastPhysics : public TObject, public NPL::VDetector {
   public:
@@ -177,27 +177,30 @@ class TMugastPhysics : public TObject, public NPL::VDetector {
   TMugastData* GetPreTreatedData() const { return m_PreTreatedData; }
 
   // Use to access the strip position
-  double GetStripPositionX(const int N, const int X, const int Y) const {
-    return m_StripPositionX[N - 1][X - 1][Y - 1];
+  double GetStripPositionX(const int N, const int X, const int Y) {
+    return m_StripPositionX[ m_DetectorNumberIndex[N] - 1][X - 1][Y - 1];
   };
-  double GetStripPositionY(const int N, const int X, const int Y) const {
-    return m_StripPositionY[N - 1][X - 1][Y - 1];
+  double GetStripPositionY(const int N, const int X, const int Y) {
+    return m_StripPositionY[ m_DetectorNumberIndex[N] - 1][X - 1][Y - 1];
   };
-  double GetStripPositionZ(const int N, const int X, const int Y) const {
-    return m_StripPositionZ[N - 1][X - 1][Y - 1];
+  double GetStripPositionZ(const int N, const int X, const int Y) {
+    return m_StripPositionZ[ m_DetectorNumberIndex[N] - 1][X - 1][Y - 1];
   };
 
   double GetNumberOfTelescope() const { return m_NumberOfTelescope; };
 
-  // To be called after a build Physical Event
+  // To be called after a build Physical Even
   int GetEventMultiplicity() const { return EventMultiplicity; };
 
   double GetEnergyDeposit(const int i) const { return TotalEnergy[i]; };
 
-  TVector3 GetPositionOfInteraction(const int i) const;
-  TVector3 GetTelescopeNormal(const int i) const;
+  TVector3 GetPositionOfInteraction(const int i) ;
+  TVector3 GetTelescopeNormal(const int i) ;
 
   private: //   Parameter used in the analysis
+  // Shape of the detector Trapezoid or Square
+  map<int, int> m_DetectorNumberIndex; 
+
   // By default take EX and TY.
   bool m_Take_E_Y; //!
   bool m_Take_T_Y; //!
@@ -213,7 +216,7 @@ class TMugastPhysics : public TObject, public NPL::VDetector {
   int m_DSSD_Y_E_RAW_Threshold; //!
   int m_SecondLayer_E_RAW_Threshold; //!
 
-  // Calibrated Threshold
+    // Calibrated Threshold
   double m_DSSD_X_E_Threshold; //!
   double m_DSSD_Y_E_Threshold; //!
   double m_SecondLayer_E_Threshold; //!
@@ -240,8 +243,8 @@ class TMugastPhysics : public TObject, public NPL::VDetector {
   map<int, int>    m_HitDSSDY; //!
 
   private: // Spectra Class
-  //TMugastSpectra* m_Spectra; //!
-
+  TMugastSpectra* m_Spectra; //!
+  
   public:
   void WriteSpectra(); //!
 
diff --git a/NPLib/Detectors/Mugast/TMugastSpectra.cxx b/NPLib/Detectors/Mugast/TMugastSpectra.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..76d0bdf79dd5da2ef8d18c654da219955c580208
--- /dev/null
+++ b/NPLib/Detectors/Mugast/TMugastSpectra.cxx
@@ -0,0 +1,388 @@
+/*****************************************************************************
+ * Copyright (C) 2009-2016   this file is part of the NPTool Project         *
+ *                                                                           *
+ * For the licensing terms see $NPTOOL/Licence/NPTool_Licence                *
+ * For the list of contributors see $NPTOOL/Licence/Contributors             *
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Original Author: A. Matta         contact address: matta@lpccaen.in2p3.fr *
+ * Creation Date  : February 2019                                            *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class holds all the online spectra needed for Mugast                *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *    + first version                                                        *
+ *                                                                           *
+ *                                                                           *
+ *****************************************************************************/
+
+// NPL
+#include "TMugastSpectra.h"
+#include "NPOptionManager.h"
+#include "NPGlobalSystemOfUnits.h"
+#include "NPPhysicalConstants.h"
+#ifdef NP_SYSTEM_OF_UNITS_H
+using namespace NPUNITS;
+#endif
+
+// STL
+#include <stdexcept>
+#include <iostream>  
+#include <cstdlib>
+#include <string>
+using namespace std;
+
+
+////////////////////////////////////////////////////////////////////////////////
+TMugastSpectra::TMugastSpectra(){
+  SetName("Mugast");
+  fStripX=128;
+  fStripY=128;
+  fStripSecondLayer=16;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+TMugastSpectra::TMugastSpectra(map<int,int> TelescopeIndex){
+  if(NPOptionManager::getInstance()->GetVerboseLevel()>0)
+    cout << "************************************************" << endl
+      << "TMugastSpectra : Initalising control spectra for " 
+      << TelescopeIndex.size() << " Telescopes" << endl
+      << "************************************************" << endl ;
+
+  SetName("Mugast");
+  for(map<int,int>::iterator it=TelescopeIndex.begin() ; it!=TelescopeIndex.end() ; it++){
+    fTelescopeIndex[it->second-1]=it->first; 
+    }
+  fNumberOfTelescope=fTelescopeIndex.size();
+  fStripX=128;
+  fStripY=128;
+  fStripSecondLayer=16;
+
+  InitRawSpectra();
+  InitPreTreatedSpectra();
+  InitPhysicsSpectra();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+TMugastSpectra::~TMugastSpectra(){
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TMugastSpectra::InitRawSpectra(){
+
+  static string name;
+  for (unsigned int i = 0; i < fTelescopeIndex.size(); i++) { // loop on number of detectors
+    TString nbr = NPL::itoa(fTelescopeIndex[i]);
+    
+    // STRX_E_RAW
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_STRX_E_RAW";
+    // AddHisto2D(name, name, fStripX, 1, fStripX+1, 512, 8192, 16384,  "Mugast/RAW/STRXE");
+    AddHisto2D(name, name, fStripX, 1, fStripX+1, 10000, 7000, 17000,  "Mugast/RAW/STRXE");
+
+    // STRY_E_RAW
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_STRY_E_RAW";
+    // AddHisto2D(name, name, fStripY, 1, fStripY+1, 512, 0, 8192, "Mugast/RAW/STRYE");
+    AddHisto2D(name, name, fStripY, 1, fStripY+1,10000, 0, 10000, "Mugast/RAW/STRYE");
+
+    // STRX_T_RAW
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_STRX_T_RAW";
+    AddHisto2D(name, name, fStripX, 1, fStripX+1, 512, 0, 8192, "Mugast/RAW/STRXT");
+
+    // STRY_T_RAW
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_STRY_T_RAW";
+    AddHisto2D(name, name, fStripY, 1, fStripY+1, 512, 0, 8192, "Mugast/RAW/STRYT");
+
+    // SDLR_E_RAW
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_SDLR_E_RAW";
+    AddHisto2D(name, name, fStripSecondLayer, 1, fStripSecondLayer+1, 512, 0, 8192, "Mugast/RAW/SDLRE");
+
+    // SDLR_T_RAW
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_SDLR_T_RAW";
+  }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TMugastSpectra::InitPreTreatedSpectra()
+{
+
+  string name;
+  for (unsigned int i = 0; i < fNumberOfTelescope; i++) { // loop on number of detectors
+    // STRX_E_CAL
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_STRX_E_CAL";
+    AddHisto2D(name, name, fStripX, 1, fStripX+1, 500, 0, 50, "Mugast/CAL/STRXE");
+
+    // STRY_E_CAL
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_STRY_E_CAL";
+    AddHisto2D(name, name, fStripY, 1, fStripY+1, 500, 0, 50, "Mugast/CAL/STRYE");
+
+    // STRX_T_CAL
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_STRX_T_CAL";
+    AddHisto2D(name, name, fStripX, 1, fStripX+1, 1000, 0, 1000, "Mugast/CAL/STRXT");
+
+    // STRY_T_CAL
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_STRY_T_CAL";
+    AddHisto2D(name, name, fStripY, 1, fStripY+1, 1000, 0, 1000, "Mugast/CAL/STRYT");
+
+    // SDLR_E_CAL
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_SDLR_E_CAL";
+    AddHisto2D(name, name, fStripSecondLayer, 1, fStripSecondLayer+1, 500, 0, 50, "Mugast/CAL/SDLRE");
+
+    // SDLR_T_CAL
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_SDLR_T_CAL";
+    AddHisto2D(name, name, fStripSecondLayer, 1, fStripSecondLayer+1, 500, 0, 50, "Mugast/CAL/SDLRT");
+
+  }  // end loop on number of detectors
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TMugastSpectra::InitPhysicsSpectra(){
+
+  static string name;
+  // X-Y Impact Matrix
+  name = "MG_IMPACT_MATRIX";
+  AddHisto2D(name, name,500,-150,150,500,-150,150, "Mugast/PHY");
+
+  // X-Y Impact Matrix
+  name = "MG_THETA_E";
+  AddHisto2D(name, name,360,0,180,500,0,50,"Mugast/PHY");
+
+  // X-Y Energy Correlation
+  for (unsigned int i = 0 ; i < fNumberOfTelescope ; i++) { // loop on number of detectors
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_XY_COR";
+    AddHisto2D(name, name,500,0,50,500,0,50, "Mugast/PHY"); 
+  }
+
+  // ID Plot
+  // E-TOF:
+  name = "MG_E_TOF";
+  AddHisto2D(name, name,500,0,50,500,200,1200,"Mugast/PHY");
+
+  // SDLRE-DE:
+  name = "MG_SDLRE_E";
+  AddHisto2D(name, name,500,0,200,500,0,50,"Mugast/PHY");
+
+  // Etot-DE:
+  name = "MG_Etot_E";
+  AddHisto2D(name, name,500,0,500,500,0,50,"Mugast/PHY");
+
+
+  // ID plot detector by detector
+  for (unsigned int i = 0; i < fNumberOfTelescope; i++) { // loop on number of detectors
+    // E-TOF:
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_E_TOF";
+    AddHisto2D(name, name,500,0,50,500,200,1200,"Mugast/PHY");
+
+    // SDLRE-DE:
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_SDLRE_E";
+    AddHisto2D(name, name,500,0,200,500,0,50,"Mugast/PHY");
+
+    // Etot-DE:
+    name = "MG"+NPL::itoa(fTelescopeIndex[i])+"_Etot_E";
+    AddHisto2D(name, name,500,0,500,500,0,50,"Mugast/PHY");
+  }
+
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+void TMugastSpectra::FillRawSpectra(TMugastData* RawData){
+
+  static string name;
+  static string family;
+
+  // STRX_E 
+  for (unsigned int i = 0; i < RawData->GetDSSDXEMult(); i++) {
+    name = "MG"+NPL::itoa( fTelescopeIndex[RawData->GetDSSDXEDetectorNbr(i)])+"_STRX_E_RAW";
+    family = "Mugast/RAW/STRXE";
+
+    FillSpectra(family,name
+        ,RawData->GetDSSDXEStripNbr(i), 
+        RawData->GetDSSDXEEnergy(i));
+  }
+
+  // STRY_E
+  for (unsigned int i = 0; i < RawData->GetDSSDYEMult(); i++) {
+    name = "MG"+NPL::itoa( fTelescopeIndex[RawData->GetDSSDYEDetectorNbr(i)] )+"_STRY_E_RAW";
+    family = "Mugast/RAW/STRYE";
+
+    FillSpectra(family,name
+        ,RawData->GetDSSDYEStripNbr(i),
+        RawData->GetDSSDYEEnergy(i));
+  }
+
+  // STRX_T
+  for (unsigned int i = 0; i < RawData->GetDSSDXTMult(); i++) {
+    name = "MG"+NPL::itoa(fTelescopeIndex[RawData->GetDSSDXTDetectorNbr(i)])+"_STRX_T_RAW";
+    family = "Mugast/RAW/STRXT";
+
+    FillSpectra(family,name
+        ,RawData->GetDSSDXTStripNbr(i),
+        RawData->GetDSSDXTTime(i));
+  }
+  // STRY_T
+  for (unsigned int i = 0; i < RawData->GetDSSDYTMult(); i++) {
+    name = "MG"+NPL::itoa( fTelescopeIndex[RawData->GetDSSDYTDetectorNbr(i)])+"_STRY_T_RAW";
+    family = "Mugast/RAW/STRYT";
+
+    FillSpectra(family,name
+        ,RawData->GetDSSDYTStripNbr(i),
+        RawData->GetDSSDYTTime(i));
+  }
+
+  // SDLR_E
+  for (unsigned int i = 0; i < RawData->GetSecondLayerEMult(); i++) {
+    name = "MG"+NPL::itoa( fTelescopeIndex[RawData->GetSecondLayerEDetectorNbr(i)])+"_SDLR_E_RAW";
+    family = "Mugast/RAW/SDLRE";
+
+    FillSpectra(family,name
+        ,RawData->GetSecondLayerEStripNbr(i),
+        RawData->GetSecondLayerEEnergy(i));
+  }
+
+  // SDLR_T
+  for (unsigned int i = 0; i < RawData->GetSecondLayerTMult(); i++) {
+    name = "MG"+NPL::itoa(RawData->GetSecondLayerTDetectorNbr(i))+"_SDLR_T_RAW";
+    family = "Mugast/RAW/SDLRT";
+
+    FillSpectra(family,name
+        ,RawData->GetSecondLayerTStripNbr(i),
+        RawData->GetSecondLayerTTime(i));
+  }
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TMugastSpectra::FillPreTreatedSpectra(TMugastData* PreTreatedData){
+
+  static string name ;
+  static string family;
+  // STRX_E
+  for (unsigned int i = 0; i < PreTreatedData->GetDSSDXEMult(); i++) {
+    name = "MG"+NPL::itoa( fTelescopeIndex[PreTreatedData->GetDSSDXEDetectorNbr(i)])+"_STRX_E_CAL";
+    family = "Mugast/CAL/STRXE";
+
+    FillSpectra(family,name
+        ,PreTreatedData->GetDSSDXEStripNbr(i), 
+        PreTreatedData->GetDSSDXEEnergy(i));
+  }
+  // STRY_E
+  for (unsigned int i = 0; i < PreTreatedData->GetDSSDYEMult(); i++) {
+    name = "MG"+NPL::itoa( fTelescopeIndex[PreTreatedData->GetDSSDYEDetectorNbr(i)])+"_STRY_E_CAL";
+    family = "Mugast/CAL/STRYE";
+
+    FillSpectra(family,name
+        ,PreTreatedData->GetDSSDYEStripNbr(i), 
+        PreTreatedData->GetDSSDYEEnergy(i));
+  }
+  // STRX_T
+  for (unsigned int i = 0; i < PreTreatedData->GetDSSDXTMult(); i++) {
+    name = "MG"+NPL::itoa( fTelescopeIndex[PreTreatedData->GetDSSDXTDetectorNbr(i)])+"_STRX_T_CAL";
+    family = "Mugast/CAL/STRXT";
+
+    FillSpectra(family,name
+        ,PreTreatedData->GetDSSDXTStripNbr(i), 
+        PreTreatedData->GetDSSDXTTime(i));
+  }
+  // STRY_T
+  for (unsigned int i = 0; i < PreTreatedData->GetDSSDYTMult(); i++) {
+    name = "MG"+NPL::itoa( fTelescopeIndex[PreTreatedData->GetDSSDYTDetectorNbr(i)])+"_STRY_T_CAL";
+    family = "Mugast/CAL/STRYT";
+
+    FillSpectra(family,name
+        ,PreTreatedData->GetDSSDYTStripNbr(i), 
+        PreTreatedData->GetDSSDYTTime(i));
+  }
+  // SDLR_E
+  for (unsigned int i = 0; i < PreTreatedData->GetSecondLayerEMult(); i++) {
+    name = "MG"+NPL::itoa( fTelescopeIndex[PreTreatedData->GetSecondLayerEDetectorNbr(i)])+"_SDLR_E_CAL";
+    family = "Mugast/CAL/SDLRE";
+
+    FillSpectra(family,name
+        ,PreTreatedData->GetSecondLayerEStripNbr(i), 
+        PreTreatedData->GetSecondLayerEEnergy(i));
+  }
+  // SDLR_T
+  for (unsigned int i = 0; i < PreTreatedData->GetSecondLayerTMult(); i++) {
+    name = "MG"+NPL::itoa( fTelescopeIndex[PreTreatedData->GetSecondLayerTDetectorNbr(i)])+"_SDLR_T_CAL";
+    family = "Mugast/CAL/SDLRT";
+
+    FillSpectra(family,name
+        ,PreTreatedData->GetSecondLayerTStripNbr(i), 
+        PreTreatedData->GetSecondLayerTTime(i));
+  }
+ 
+  //E-SDLR ID
+  family = "Mugast/CAL/ID";
+  for (unsigned int i = 0; i < PreTreatedData->GetDSSDXEMult(); i++) {
+    for (unsigned int j = 0; j < PreTreatedData->GetSecondLayerEMult(); j++) {
+
+      if(PreTreatedData->GetDSSDXEDetectorNbr(i) == PreTreatedData->GetSecondLayerEDetectorNbr(j)){ 
+        name = "MG"+NPL::itoa( fTelescopeIndex[PreTreatedData->GetDSSDXEDetectorNbr(i)])+"_SDLR"+NPL::itoa(PreTreatedData->GetSecondLayerEStripNbr(j))+"_CAL_ID";
+
+        FillSpectra(family,name
+            ,PreTreatedData->GetSecondLayerEEnergy(j), 
+            PreTreatedData->GetDSSDXEEnergy(i));
+      }
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TMugastSpectra::FillPhysicsSpectra(TMugastPhysics* Physics){
+
+  static string name;
+  static string family= "Mugast/PHY";
+  // X-Y Impact Matrix
+
+  for(unsigned int i = 0 ; i < Physics->DSSD_E.size(); i++){
+    name = "MG_IMPACT_MATRIX";
+    double x = Physics->GetPositionOfInteraction(i).x();
+    double y = Physics->GetPositionOfInteraction(i).y();
+    FillSpectra(family,name,x,y);
+
+    name = "MG_THETA_E";
+    double Theta = Physics->GetPositionOfInteraction(i).Angle(TVector3(0,0,1));
+    Theta = Theta/deg;
+    FillSpectra(family,name,Theta,Physics->DSSD_E[i]);
+
+//    // STRX_E_CAL
+//    name = "MG"+NPL::itoa( Physics->TelescopeNumber[i])+"_XY_COR";
+//    FillSpectra(family,name,Physics->DSSD_EX[i],Physics->DSSD_EY[i]);
+
+
+    // Fill only for particle stopped in the first stage
+    if(Physics->SecondLayer_E[i]<0 && Physics->SecondLayer_E[i]<0){
+      // E-TOF:
+      name = "MG_E_TOF";
+      FillSpectra(family,name,Physics->DSSD_E[i],Physics->DSSD_T[i]);
+
+      name = "MG"+NPL::itoa(Physics->TelescopeNumber[i])+"_E_TOF";
+      FillSpectra(family,name,Physics->DSSD_E[i],Physics->DSSD_T[i]);
+    }
+
+    double Etot=0;
+    if(Physics->SecondLayer_E[i]>0){
+      name = "MG_SDLRE_E";
+      Etot = Physics->SecondLayer_E[i];
+      FillSpectra(family,name,Physics->SecondLayer_E[i],Physics->DSSD_E[i]);
+
+      name = "MG"+NPL::itoa(Physics->TelescopeNumber[i])+"_SDLRE_E";
+      FillSpectra(family,name,Physics->SecondLayer_E[i],Physics->DSSD_E[i]);
+    }
+
+    if(Etot>0){
+      name = "MG_Etot_E";
+      FillSpectra(family,name,Etot,Physics->DSSD_E[i]);
+      name = "MG"+NPL::itoa(Physics->TelescopeNumber[i])+"_Etot_E";
+      FillSpectra(family,name,Etot,Physics->DSSD_E[i]);
+    }
+  }
+
+}
+
diff --git a/NPLib/Detectors/Mugast/TMugastSpectra.h b/NPLib/Detectors/Mugast/TMugastSpectra.h
new file mode 100644
index 0000000000000000000000000000000000000000..a178dc67232eb9849ce663d94a6e71a91f2ebbbe
--- /dev/null
+++ b/NPLib/Detectors/Mugast/TMugastSpectra.h
@@ -0,0 +1,60 @@
+#ifndef TMugastSPECTRA_H
+#define TMugastSPECTRA_H
+/*****************************************************************************
+ * Copyright (C) 2009-2016    this file is part of the NPTool Project        *
+ *                                                                           *
+ * For the licensing terms see $NPTOOL/Licence/NPTool_Licence                *
+ * For the list of contributors see $NPTOOL/Licence/Contributors             *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Original Author: N. de Sereville  contact address: matta@lpccaen.in2p3.fr *
+ *                                                                           *
+ * Creation Date  : February 2019                                            *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class holds all the online spectra needed for Mugast                *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *
+ *                                                                           *
+ *****************************************************************************/
+
+// NPLib headers
+#include "NPVSpectra.h"
+#include "TMugastData.h"
+#include "TMugastPhysics.h"
+
+// ForwardDeclaration
+class TMugastPhysics ;
+
+class TMugastSpectra:public VSpectra{
+  public:
+    // constructor and destructor
+    TMugastSpectra();
+    TMugastSpectra(map<int,int> TelescopeIndex);
+    ~TMugastSpectra();
+
+  private:
+    // Initialization methods
+    void InitRawSpectra();
+    void InitPreTreatedSpectra();
+    void InitPhysicsSpectra();
+
+  public:
+    // Filling methods
+    void FillRawSpectra(TMugastData*);
+    void FillPreTreatedSpectra(TMugastData*);
+    void FillPhysicsSpectra(TMugastPhysics*);
+
+  private: // Information on Mugast
+    map<int,int> fTelescopeIndex;
+    unsigned int fNumberOfTelescope;
+    unsigned int fStripX;
+    unsigned int fStripY;
+    unsigned int fStripSecondLayer;
+};
+
+#endif