diff --git a/NPLib/Detectors/PISTA/CMakeLists.txt b/NPLib/Detectors/PISTA/CMakeLists.txt
index fe7686eee6bfe0d91d709d23238b4c5153050672..375bdb28ed4de7609778dfa8f7111424ffb8f1b3 100644
--- a/NPLib/Detectors/PISTA/CMakeLists.txt
+++ b/NPLib/Detectors/PISTA/CMakeLists.txt
@@ -1,5 +1,7 @@
 add_custom_command(OUTPUT TPISTAPhysicsDict.cxx COMMAND ../../scripts/build_dict.sh TPISTAPhysics.h TPISTAPhysicsDict.cxx TPISTAPhysics.rootmap libNPPISTA.dylib DEPENDS TPISTAPhysics.h)
+
 add_custom_command(OUTPUT TPISTADataDict.cxx COMMAND ../../scripts/build_dict.sh TPISTAData.h TPISTADataDict.cxx TPISTAData.rootmap libNPPISTA.dylib DEPENDS TPISTAData.h)
+
 add_library(NPPISTA SHARED TPISTASpectra.cxx TPISTAData.cxx TPISTAPhysics.cxx TPISTADataDict.cxx TPISTAPhysicsDict.cxx )
 target_link_libraries(NPPISTA ${ROOT_LIBRARIES} NPCore) 
 install(FILES TPISTAData.h TPISTAPhysics.h TPISTASpectra.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
diff --git a/NPLib/Detectors/Sofia/CMakeLists.txt b/NPLib/Detectors/Sofia/CMakeLists.txt
index 5669724d43fb231d151c6d86c7fa75fe33187cc8..10ce558b9212cb0f6a69dc28c96d7d485c039d58 100644
--- a/NPLib/Detectors/Sofia/CMakeLists.txt
+++ b/NPLib/Detectors/Sofia/CMakeLists.txt
@@ -1,6 +1,20 @@
-add_custom_command(OUTPUT TSofiaPhysicsDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh TSofiaPhysics.h TSofiaPhysicsDict.cxx TSofiaPhysics.rootmap libNPSofia.dylib DEPENDS TSofiaPhysics.h)
-add_custom_command(OUTPUT TSofiaDataDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh TSofiaData.h TSofiaDataDict.cxx TSofiaData.rootmap libNPSofia.dylib DEPENDS TSofiaData.h)
-add_library(NPSofia SHARED TSofiaSpectra.cxx TSofiaData.cxx TSofiaPhysics.cxx TSofiaDataDict.cxx TSofiaPhysicsDict.cxx )
-target_link_libraries(NPSofia ${ROOT_LIBRARIES} NPCore) 
-install(FILES TSofiaData.h TSofiaPhysics.h TSofiaSpectra.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
+add_custom_command(OUTPUT TSofSciDataDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh TSofSciData.h TSofSciDataDict.cxx TSofSciData.rootmap libNPSofia.dylib DEPENDS TSofSciData.h)
+
+add_custom_command(OUTPUT TSofTofWDataDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh TSofTofWData.h TSofTofWDataDict.cxx TSofTofWData.rootmap libNPSofia.dylib DEPENDS TSofTofWData.h)
+add_custom_command(OUTPUT TSofTofWPhysicsDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh TSofTofWPhysics.h TSofTofWPhysicsDict.cxx TSofTofWPhysics.rootmap libNPSofia.dylib DEPENDS TSofTofWPhysics.h)
+
+add_custom_command(OUTPUT TSofMwpcDataDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh TSofMwpcData.h TSofMwpcDataDict.cxx TSofMwpcData.rootmap libNPSofia.dylib DEPENDS TSofMwpcData.h)
+
+add_custom_command(OUTPUT TSofAtDataDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh TSofAtData.h TSofAtDataDict.cxx TSofAtData.rootmap libNPSofia.dylib DEPENDS TSofAtData.h)
+
+add_custom_command(OUTPUT TSofTrimDataDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh TSofTrimData.h TSofTrimDataDict.cxx TSofTrimData.rootmap libNPSofia.dylib DEPENDS TSofTrimData.h)
+add_custom_command(OUTPUT TSofTrimPhysicsDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh TSofTrimPhysics.h TSofTrimPhysicsDict.cxx TSofTrimPhysics.rootmap libNPSofia.dylib DEPENDS TSofTrimPhysics.h)
+
+add_custom_command(OUTPUT TSofTwimDataDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh TSofTwimData.h TSofTwimDataDict.cxx TSofTwimData.rootmap libNPSofia.dylib DEPENDS TSofTwimData.h)
+
+add_library(NPSofia SHARED TSofSciData.cxx TSofSciDataDict.cxx TSofMwpcData.cxx TSofMwpcDataDict.cxx TSofAtData.cxx TSofAtDataDict.cxx TSofTrimData.cxx TSofTrimDataDict.cxx TSofTrimPhysics.cxx TSofTrimPhysicsDict.cxx TSofTwimData.cxx TSofTwimDataDict.cxx TSofTofWData.cxx TSofTofWDataDict.cxx TSofTofWPhysics.cxx TSofTofWPhysicsDict.cxx)
+
+target_link_libraries(NPSofia ${ROOT_LIBRARIES} NPCore NPPhysics)
+
+install(FILES TSofSciData.h TSofMwpcData.h TSofAtData.h TSofTrimData.h TSofTrimPhysics.h TSofTwimData.h TSofTofWData.h TSofTofWPhysics.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
 
diff --git a/NPLib/Detectors/Sofia/TSofiaSpectra.h b/NPLib/Detectors/Sofia/TSofAtData.cxx
similarity index 53%
rename from NPLib/Detectors/Sofia/TSofiaSpectra.h
rename to NPLib/Detectors/Sofia/TSofAtData.cxx
index ce0fef524a259cec57699f30c84c00dbcae12ee6..545411bc821182b968616ef85723b44e21e4c2ff 100644
--- a/NPLib/Detectors/Sofia/TSofiaSpectra.h
+++ b/NPLib/Detectors/Sofia/TSofAtData.cxx
@@ -1,5 +1,3 @@
-#ifndef TSofiaSPECTRA_H
-#define TSofiaSPECTRA_H
 /*****************************************************************************
  * Copyright (C) 2009-2020   this file is part of the NPTool Project       *
  *                                                                           *
@@ -9,54 +7,58 @@
 
 /*****************************************************************************
  * Original Author: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
- *                                                                           *
- * Creation Date  : November 2020                                           *
+ * Creation Date  : May 2021                                           *
  * Last update    :                                                          *
  *---------------------------------------------------------------------------*
  * Decription:                                                               *
- *  This class hold Sofia Spectra                                     *
+ *  This class hold SofAt Raw data                                    *
  *                                                                           *
  *---------------------------------------------------------------------------*
  * Comment:                                                                  *
  *                                                                           *   
  *                                                                           *
  *****************************************************************************/
+#include "TSofAtData.h"
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+using namespace std; 
+
+ClassImp(TSofAtData)
+
+
+//////////////////////////////////////////////////////////////////////
+TSofAtData::TSofAtData() {
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+TSofAtData::~TSofAtData() {
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+void TSofAtData::Clear() {
+  fAT_AnodeNbr.clear();
+  fAT_Energy.clear();
+  fAT_Time.clear();
+  fAT_PileUp.clear();
+  fAT_Overflow.clear();
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+void TSofAtData::Dump() const {
+  // This method is very useful for debuging and worth the dev.
+  cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TSofAtData::Dump()] XXXXXXXXXXXXXXXXX" << endl;
 
-// NPLib headers
-#include "NPVSpectra.h"
-#include "TSofiaData.h"
-#include "TSofiaPhysics.h"
-
-// Forward Declaration
-class TSofiaPhysics;
-
-
-class TSofiaSpectra : public VSpectra {
-  //////////////////////////////////////////////////////////////
-  // constructor and destructor
-  public:
-    TSofiaSpectra();
-    TSofiaSpectra(unsigned int NumberOfDetectors);
-    ~TSofiaSpectra();
-
-  //////////////////////////////////////////////////////////////
-  // Initialization methods
-  private:
-    void InitRawSpectra();
-    void InitPreTreatedSpectra();
-    void InitPhysicsSpectra();
-
-  //////////////////////////////////////////////////////////////
-  // Filling methods
-  public:
-    void FillRawSpectra(TSofiaData*);
-    void FillPreTreatedSpectra(TSofiaData*);
-    void FillPhysicsSpectra(TSofiaPhysics*);
-
-  //////////////////////////////////////////////////////////////
-  // Detector parameters 
-  private:
-    unsigned int fNumberOfDetectors;
-};
-
-#endif
+  // Energy
+  size_t mysize = fAT_AnodeNbr.size();
+  cout << "AT_Mult: " << GetMultiplicity() << endl;
+ 
+}
diff --git a/NPLib/Detectors/Sofia/TSofAtData.h b/NPLib/Detectors/Sofia/TSofAtData.h
new file mode 100644
index 0000000000000000000000000000000000000000..cb9fae883ba051c1628606c0c2ffa1aa56da81c2
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofAtData.h
@@ -0,0 +1,84 @@
+#ifndef __SofAtDATA__
+#define __SofAtDATA__
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ *                                                                           *
+ * Creation Date  : May 2021                                                 *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofAt Raw data                                    *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+
+// STL
+#include <vector>
+using namespace std;
+
+// ROOT
+#include "TObject.h"
+
+class TSofAtData : public TObject {
+  //////////////////////////////////////////////////////////////
+  // data members are hold into vectors in order 
+  // to allow multiplicity treatment
+  private: 
+    vector<int>      fAT_AnodeNbr;
+    vector<double>   fAT_Energy;
+    vector<double>   fAT_Time;
+    vector<bool>     fAT_PileUp;
+    vector<bool>     fAT_Overflow;
+
+  //////////////////////////////////////////////////////////////
+  // Constructor and destructor
+  public: 
+    TSofAtData();
+    ~TSofAtData();
+    
+
+  //////////////////////////////////////////////////////////////
+  // Inherited from TObject and overriden to avoid warnings
+  public:
+    void Clear();
+    void Clear(const Option_t*) {};
+    void Dump() const;
+
+
+  //////////////////////////////////////////////////////////////
+  // Getters and Setters
+  // Prefer inline declaration to avoid unnecessary called of 
+  // frequently used methods
+  // add //! to avoid ROOT creating dictionnary for the methods
+  public:
+    //////////////////////    SETTERS    ////////////////////////
+    inline void SetAnodeNbr(int det){fAT_AnodeNbr.push_back(det);};//!
+    inline void SetEnergy(double Energy){fAT_Energy.push_back(Energy);};//!
+    inline void SetTime(double Time){fAT_Time.push_back(Time);};//!
+    inline void SetPileUp(bool ispileup){fAT_PileUp.push_back(ispileup);};//!
+    inline void SetOverflow(bool isoverflow){fAT_Overflow.push_back(isoverflow);};//!
+
+    //////////////////////    GETTERS    ////////////////////////
+    inline int GetMultiplicity() const {return fAT_AnodeNbr.size();}//!
+    inline int GetAnodeNbr(const unsigned int &i) const {return fAT_AnodeNbr[i];}//! 
+    inline double GetEnergy(const unsigned int &i) const {return fAT_Energy[i];}//!     
+    inline double GetTime(const unsigned int &i) const {return fAT_Time[i];}//!     
+    inline bool GetPileUp(const unsigned int &i) const {return fAT_PileUp[i];}//!     
+    inline bool GetOverflow(const unsigned int &i) const {return fAT_Overflow[i];}//!     
+
+  //////////////////////////////////////////////////////////////
+  // Required for ROOT dictionnary
+  ClassDef(TSofAtData,1)  // SofAtData structure
+};
+
+#endif
diff --git a/NPLib/Detectors/Sofia/TSofMwpcData.cxx b/NPLib/Detectors/Sofia/TSofMwpcData.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..b293dab00ecf4d07177b0ae7a687993204dca697
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofMwpcData.cxx
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ * Creation Date  : May 2021                                           *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofMwpc Raw data                                    *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+#include "TSofMwpcData.h"
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+using namespace std; 
+
+ClassImp(TSofMwpcData)
+
+
+//////////////////////////////////////////////////////////////////////
+TSofMwpcData::TSofMwpcData() {
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+TSofMwpcData::~TSofMwpcData() {
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+void TSofMwpcData::Clear() {
+  fMwpc_DetNbr.clear();
+  fMwpc_Plane.clear();
+  fMwpc_Pad.clear();
+  fMwpc_Charge.clear();
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+void TSofMwpcData::Dump() const {
+  // This method is very useful for debuging and worth the dev.
+  cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TSofMwpcData::Dump()] XXXXXXXXXXXXXXXXX" << endl;
+
+  // Energy
+  size_t mysize = fMwpc_Charge.size();
+  cout << "MWPC_Mult: " << GetMultiplicity() << endl;
+ 
+}
diff --git a/NPLib/Detectors/Sofia/TSofMwpcData.h b/NPLib/Detectors/Sofia/TSofMwpcData.h
new file mode 100644
index 0000000000000000000000000000000000000000..d5de7eeadc858fc95b491eb77257f371940ff4f5
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofMwpcData.h
@@ -0,0 +1,81 @@
+#ifndef __SofMwpcDATA__
+#define __SofMwpcDATA__
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ *                                                                           *
+ * Creation Date  : May 2021                                                 *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofMwpc Raw data                                    *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+
+// STL
+#include <vector>
+using namespace std;
+
+// ROOT
+#include "TObject.h"
+
+class TSofMwpcData : public TObject {
+  //////////////////////////////////////////////////////////////
+  // data members are hold into vectors in order 
+  // to allow multiplicity treatment
+  private: 
+    vector<int> fMwpc_DetNbr;
+    vector<int> fMwpc_Plane;
+    vector<int> fMwpc_Pad;
+    vector<int> fMwpc_Charge;
+
+    //////////////////////////////////////////////////////////////
+    // Constructor and destructor
+  public: 
+    TSofMwpcData();
+    ~TSofMwpcData();
+
+
+    //////////////////////////////////////////////////////////////
+    // Inherited from TObject and overriden to avoid warnings
+  public:
+    void Clear();
+    void Clear(const Option_t*) {};
+    void Dump() const;
+
+
+    //////////////////////////////////////////////////////////////
+    // Getters and Setters
+    // Prefer inline declaration to avoid unnecessary called of 
+    // frequently used methods
+    // add //! to avoid ROOT creating dictionnary for the methods
+  public:
+    //////////////////////    SETTERS    ////////////////////////
+    inline void SetDetectorNbr(int det){fMwpc_DetNbr.push_back(det);};//!
+    inline void SetPlane(int p){fMwpc_Plane.push_back(p);};//!
+    inline void SetPad(int p){fMwpc_Pad.push_back(p);};//!
+    inline void SetCharge(int q){fMwpc_Charge.push_back(q);};//!
+
+    //////////////////////    GETTERS    ////////////////////////
+    inline int GetMultiplicity() const {return fMwpc_DetNbr.size();}//!
+    inline int GetDetectorNbr(const unsigned int &i) const {return fMwpc_DetNbr[i];}//! 
+    inline int GetPlane(const unsigned int &i) const {return fMwpc_Plane[i];}//! 
+    inline int GetPad(const unsigned int &i) const {return fMwpc_Pad[i];}//! 
+    inline int GetCharge(const unsigned int &i) const {return fMwpc_Charge[i];}//! 
+
+    //////////////////////////////////////////////////////////////
+    // Required for ROOT dictionnary
+    ClassDef(TSofMwpcData,1)  // SofMwpcData structure
+};
+
+#endif
diff --git a/NPLib/Detectors/Sofia/TSofSciData.cxx b/NPLib/Detectors/Sofia/TSofSciData.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..428412e249224d7943487214a7844768402a5f75
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofSciData.cxx
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ * Creation Date  : May 2021                                           *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofSci Raw data                                    *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+#include "TSofSciData.h"
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+using namespace std; 
+
+ClassImp(TSofSciData)
+
+
+//////////////////////////////////////////////////////////////////////
+TSofSciData::TSofSciData() {
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+TSofSciData::~TSofSciData() {
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+void TSofSciData::Clear() {
+  fSofSci_DetNbr.clear();
+  fSofSci_Pmt.clear();
+  fSofSci_CT.clear();
+  fSofSci_FT.clear();
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+void TSofSciData::Dump() const {
+  // This method is very useful for debuging and worth the dev.
+  cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TSofSciData::Dump()] XXXXXXXXXXXXXXXXX" << endl;
+
+  // Energy
+  size_t mysize = fSofSci_DetNbr.size();
+  cout << "SofSci_Mult: " << GetMultiplicity() << endl;
+ 
+}
diff --git a/NPLib/Detectors/Sofia/TSofSciData.h b/NPLib/Detectors/Sofia/TSofSciData.h
new file mode 100644
index 0000000000000000000000000000000000000000..460e11ab92b86f1aff073ae747a1bdec83db23fa
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofSciData.h
@@ -0,0 +1,81 @@
+#ifndef __SofSciDATA__
+#define __SofSciDATA__
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ *                                                                           *
+ * Creation Date  : May 2021                                                 *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofSci Raw data                                    *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+
+// STL
+#include <vector>
+using namespace std;
+
+// ROOT
+#include "TObject.h"
+
+class TSofSciData : public TObject {
+  //////////////////////////////////////////////////////////////
+  // data members are hold into vectors in order 
+  // to allow multiplicity treatment
+  private: 
+    vector<int>     fSofSci_DetNbr;
+    vector<int>     fSofSci_Pmt;
+    vector<double>  fSofSci_CT;
+    vector<double>  fSofSci_FT;
+
+  //////////////////////////////////////////////////////////////
+  // Constructor and destructor
+  public: 
+    TSofSciData();
+    ~TSofSciData();
+    
+
+  //////////////////////////////////////////////////////////////
+  // Inherited from TObject and overriden to avoid warnings
+  public:
+    void Clear();
+    void Clear(const Option_t*) {};
+    void Dump() const;
+
+
+  //////////////////////////////////////////////////////////////
+  // Getters and Setters
+  // Prefer inline declaration to avoid unnecessary called of 
+  // frequently used methods
+  // add //! to avoid ROOT creating dictionnary for the methods
+  public:
+    //////////////////////    SETTERS    ////////////////////////
+    inline void SetDetectorNbr(int det){fSofSci_DetNbr.push_back(det);};//!
+    inline void SetPmt(int pmt){fSofSci_Pmt.push_back(pmt);};//!
+    inline void SetCoarseTime(double Time){fSofSci_CT.push_back(Time);};//!
+    inline void SetFineTime(double Time){fSofSci_FT.push_back(Time);};//!
+
+    //////////////////////    GETTERS    ////////////////////////
+    inline int GetMultiplicity() const {return fSofSci_DetNbr.size();}//!
+    inline int GetDetectorNbr(const unsigned int &i) const {return fSofSci_DetNbr[i];}//! 
+    inline int GetPmt(const unsigned int &i) const {return fSofSci_Pmt[i];}//! 
+    inline double GetCoarseTime(const unsigned int &i) const {return fSofSci_CT[i];}//!     
+    inline double GetFineTime(const unsigned int &i) const {return fSofSci_FT[i];}//!     
+
+  //////////////////////////////////////////////////////////////
+  // Required for ROOT dictionnary
+  ClassDef(TSofSciData,1)  // SofSciData structure
+};
+
+#endif
diff --git a/NPLib/Detectors/Sofia/TSofiaData.cxx b/NPLib/Detectors/Sofia/TSofTofWData.cxx
similarity index 77%
rename from NPLib/Detectors/Sofia/TSofiaData.cxx
rename to NPLib/Detectors/Sofia/TSofTofWData.cxx
index 57df7605374b4a97be6e83e1c3299125a72e60d6..0d261b8032f74988f5418f94ceea770db8a9a725 100644
--- a/NPLib/Detectors/Sofia/TSofiaData.cxx
+++ b/NPLib/Detectors/Sofia/TSofTofWData.cxx
@@ -19,7 +19,7 @@
  *                                                                           *   
  *                                                                           *
  *****************************************************************************/
-#include "TSofiaData.h"
+#include "TSofTofWData.h"
 
 #include <iostream>
 #include <fstream>
@@ -27,51 +27,40 @@
 #include <string>
 using namespace std; 
 
-ClassImp(TSofiaData)
+ClassImp(TSofTofWData)
 
 
 //////////////////////////////////////////////////////////////////////
-TSofiaData::TSofiaData() {
+TSofTofWData::TSofTofWData() {
 }
 
 
 
 //////////////////////////////////////////////////////////////////////
-TSofiaData::~TSofiaData() {
+TSofTofWData::~TSofTofWData() {
 }
 
 
 
 //////////////////////////////////////////////////////////////////////
-void TSofiaData::Clear() {
-  // TOF
-  fTOF_DetectorNbr.clear();
+void TSofTofWData::Clear() {
   fTOF_PlasticNbr.clear();
+  fTOF_Pmt.clear();
   fTOF_Energy.clear();
-  fTOF_Time.clear();
-  
-  // TWIN
-  fTWIN_SectorNbr.clear();
-  fTWIN_AnodeNbr.clear();
-  fTWIN_AnodeEnergy.clear();
-  fTWIN_AnodeTime.clear();
-  
-  fTWIN_Esum1 = -10;
-  fTWIN_Esum2 = -10;
-  fTWIN_Esum3 = -10;
-  fTWIN_Esum4 = -10;
+  fTOF_CT.clear();
+  fTOF_FT.clear();
+  fTOF_WhichFlag.clear();
 }
 
 
 
 //////////////////////////////////////////////////////////////////////
-void TSofiaData::Dump() const {
+void TSofTofWData::Dump() const {
   // This method is very useful for debuging and worth the dev.
-  cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TSofiaData::Dump()] XXXXXXXXXXXXXXXXX" << endl;
+  cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TSofTofWData::Dump()] XXXXXXXXXXXXXXXXX" << endl;
 
   // Energy
-  size_t mysize = fTOF_DetectorNbr.size();
-  cout << "TWIN_Mult: " << GetTwinMult() << endl;
+  size_t mysize = fTOF_PlasticNbr.size();
   cout << "TOF_Mult: " << mysize << endl;
  
 }
diff --git a/NPLib/Detectors/Sofia/TSofTofWData.h b/NPLib/Detectors/Sofia/TSofTofWData.h
new file mode 100644
index 0000000000000000000000000000000000000000..c663ef319d3d8a22db1bf465797fb929833ff6a8
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofTofWData.h
@@ -0,0 +1,88 @@
+#ifndef __SofTofWDATA__
+#define __SofTofWDATA__
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ *                                                                           *
+ * Creation Date  : November 2020                                           *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofTofW Raw data                                    *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+
+// STL
+#include <vector>
+using namespace std;
+
+// ROOT
+#include "TObject.h"
+
+class TSofTofWData : public TObject {
+  //////////////////////////////////////////////////////////////
+  // data members are hold into vectors in order 
+  // to allow multiplicity treatment
+  private: 
+    vector<int>      fTOF_PlasticNbr;
+    vector<int>      fTOF_Pmt;
+    vector<double>   fTOF_Energy;
+    vector<double>   fTOF_CT;
+    vector<double>   fTOF_FT;
+    vector<bool>     fTOF_WhichFlag;
+
+
+    //////////////////////////////////////////////////////////////
+    // Constructor and destructor
+  public: 
+    TSofTofWData();
+    ~TSofTofWData();
+
+
+    //////////////////////////////////////////////////////////////
+    // Inherited from TObject and overriden to avoid warnings
+  public:
+    void Clear();
+    void Clear(const Option_t*) {};
+    void Dump() const;
+
+
+    //////////////////////////////////////////////////////////////
+    // Getters and Setters
+    // Prefer inline declaration to avoid unnecessary called of 
+    // frequently used methods
+    // add //! to avoid ROOT creating dictionnary for the methods
+  public:
+    //////////////////////    SETTERS    ////////////////////////
+    inline void SetPlasticNbr(int plastic){fTOF_PlasticNbr.push_back(plastic);};//!
+    inline void SetPmt(int pmt){fTOF_Pmt.push_back(pmt);};//!
+    inline void SetEnergy(double Energy){fTOF_Energy.push_back(Energy);};//!
+    inline void SetCoarseTime(double Time){fTOF_CT.push_back(Time);};//!
+    inline void SetFineTime(double Time){fTOF_FT.push_back(Time);};//!
+    inline void SetWhichFlag(bool flag){fTOF_WhichFlag.push_back(flag);};//!
+
+    //////////////////////    GETTERS    ////////////////////////
+    inline int GetMultiplicity() const {return fTOF_PlasticNbr.size();}//!
+    inline int GetPlasticNbr(const unsigned int &i) const {return fTOF_PlasticNbr[i];}//!     
+    inline int GetPmt(const unsigned int &i) const {return fTOF_Pmt[i];}//!     
+    inline double GetEnergy(const unsigned int &i) const {return fTOF_Energy[i];}//!     
+    inline double GetCoarseTime(const unsigned int &i) const {return fTOF_CT[i];}//!     
+    inline double GetFineTime(const unsigned int &i) const {return fTOF_FT[i];}//!     
+    inline bool GetWhichFlag(const unsigned int &i) const {return fTOF_WhichFlag[i];}//!     
+
+    //////////////////////////////////////////////////////////////
+    // Required for ROOT dictionnary
+    ClassDef(TSofTofWData,1)  // SofTofWData structure
+};
+
+#endif
diff --git a/NPLib/Detectors/Sofia/TSofiaPhysics.cxx b/NPLib/Detectors/Sofia/TSofTofWPhysics.cxx
similarity index 66%
rename from NPLib/Detectors/Sofia/TSofiaPhysics.cxx
rename to NPLib/Detectors/Sofia/TSofTofWPhysics.cxx
index ce6f5fc40da0551fc4dac3fbd078d0f01c74eeff..f4d85066fe9e855bb7369548797805e1edf72765 100644
--- a/NPLib/Detectors/Sofia/TSofiaPhysics.cxx
+++ b/NPLib/Detectors/Sofia/TSofTofWPhysics.cxx
@@ -12,7 +12,7 @@
  * Last update    :                                                          *
  *---------------------------------------------------------------------------*
  * Decription:                                                               *
- *  This class hold Sofia Treated  data                               *
+ *  This class hold SofTofW Treated  data                               *
  *                                                                           *
  *---------------------------------------------------------------------------*
  * Comment:                                                                  *
@@ -20,7 +20,7 @@
  *                                                                           *
  *****************************************************************************/
 
-#include "TSofiaPhysics.h"
+#include "TSofTofWPhysics.h"
 
 //   STL
 #include <sstream>
@@ -39,15 +39,14 @@ using namespace std;
 //   ROOT
 #include "TChain.h"
 
-ClassImp(TSofiaPhysics)
+ClassImp(TSofTofWPhysics)
 
 
 ///////////////////////////////////////////////////////////////////////////
-TSofiaPhysics::TSofiaPhysics()
-   : m_EventData(new TSofiaData),
-     m_PreTreatedData(new TSofiaData),
+TSofTofWPhysics::TSofTofWPhysics()
+   : m_EventData(new TSofTofWData),
+     m_PreTreatedData(new TSofTofWData),
      m_EventPhysics(this),
-     m_Spectra(0),
      m_E_RAW_Threshold(0), // adc channels
      m_E_Threshold(0),     // MeV
      m_NumberOfDetectors(0) {
@@ -55,7 +54,7 @@ TSofiaPhysics::TSofiaPhysics()
 
 ///////////////////////////////////////////////////////////////////////////
 /// A usefull method to bundle all operation to add a detector
-void TSofiaPhysics::AddDetector(TVector3 , string ){
+void TSofTofWPhysics::AddDetector(TVector3 ){
   // In That simple case nothing is done
   // Typically for more complex detector one would calculate the relevant 
   // positions (stripped silicon) or angles (gamma array)
@@ -63,37 +62,35 @@ void TSofiaPhysics::AddDetector(TVector3 , string ){
 } 
 
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::AddDetector(double R, double Theta, double Phi, string shape){
+void TSofTofWPhysics::AddDetector(double R, double Theta, double Phi){
   // Compute the TVector3 corresponding
   TVector3 Pos(R*sin(Theta)*cos(Phi),R*sin(Theta)*sin(Phi),R*cos(Theta));
   // Call the cartesian method
-  AddDetector(Pos,shape);
+  AddDetector(Pos);
 } 
   
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::BuildSimplePhysicalEvent() {
+void TSofTofWPhysics::BuildSimplePhysicalEvent() {
   BuildPhysicalEvent();
 }
 
 
 
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::BuildPhysicalEvent() {
+void TSofTofWPhysics::BuildPhysicalEvent() {
   // apply thresholds and calibration
   PreTreat();
 
   // match energy and time together
   unsigned int mysizeE = m_PreTreatedData->GetMultiplicity();
   for (UShort_t e = 0; e < mysizeE ; e++) {
-    DetectorNumber.push_back(m_PreTreatedData->GetDetectorNbr(e));
     PlasticNumber.push_back(m_PreTreatedData->GetPlasticNbr(e));
     Energy.push_back(m_PreTreatedData->GetEnergy(e));
-    Time.push_back(m_PreTreatedData->GetTime(e));
   }
 }
 
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::PreTreat() {
+void TSofTofWPhysics::PreTreat() {
   // This method typically applies thresholds and calibrations
   // Might test for disabled channels for more complex detector
 
@@ -107,11 +104,9 @@ void TSofiaPhysics::PreTreat() {
   unsigned int mysize = m_EventData->GetMultiplicity();
   for (UShort_t i = 0; i < mysize ; ++i) {
     if (m_EventData->GetEnergy(i) > m_E_RAW_Threshold) {
-      Double_t Energy = Cal->ApplyCalibration("Sofia/ENERGY"+NPL::itoa(m_EventData->GetPlasticNbr(i)),m_EventData->GetEnergy(i));
+      Double_t Energy = Cal->ApplyCalibration("SofTofW/ENERGY"+NPL::itoa(m_EventData->GetPlasticNbr(i)),m_EventData->GetEnergy(i));
       if (Energy > m_E_Threshold) {
-        m_PreTreatedData->SetDetectorNbr(m_EventData->GetDetectorNbr(i));
         m_PreTreatedData->SetPlasticNbr(m_EventData->GetPlasticNbr(i));
-        m_PreTreatedData->SetTime(m_EventData->GetTime(i));
         m_PreTreatedData->SetEnergy(Energy);
       }
     }
@@ -121,25 +116,25 @@ void TSofiaPhysics::PreTreat() {
 
 
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::ReadAnalysisConfig() {
+void TSofTofWPhysics::ReadAnalysisConfig() {
   bool ReadingStatus = false;
 
   // path to file
-  string FileName = "./configs/ConfigSofia.dat";
+  string FileName = "./configs/ConfigSofTofW.dat";
 
   // open analysis config file
   ifstream AnalysisConfigFile;
   AnalysisConfigFile.open(FileName.c_str());
 
   if (!AnalysisConfigFile.is_open()) {
-    cout << " No ConfigSofia.dat found: Default parameter loaded for Analayis " << FileName << endl;
+    cout << " No ConfigSofTofW.dat found: Default parameter loaded for Analayis " << FileName << endl;
     return;
   }
-  cout << " Loading user parameter for Analysis from ConfigSofia.dat " << endl;
+  cout << " Loading user parameter for Analysis from ConfigSofTofW.dat " << endl;
 
   // Save it in a TAsciiFile
   TAsciiFile* asciiConfig = RootOutput::getInstance()->GetAsciiFileAnalysisConfig();
-  asciiConfig->AppendLine("%%% ConfigSofia.dat %%%");
+  asciiConfig->AppendLine("%%% ConfigSofTofW.dat %%%");
   asciiConfig->Append(FileName.c_str());
   asciiConfig->AppendLine("");
   // read analysis config file
@@ -149,7 +144,7 @@ void TSofiaPhysics::ReadAnalysisConfig() {
     getline(AnalysisConfigFile, LineBuffer);
 
     // search for "header"
-    string name = "ConfigSofia";
+    string name = "ConfigSofTofW";
     if (LineBuffer.compare(0, name.length(), name) == 0) 
       ReadingStatus = true;
 
@@ -185,41 +180,39 @@ void TSofiaPhysics::ReadAnalysisConfig() {
 
 
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::Clear() {
-  DetectorNumber.clear();
+void TSofTofWPhysics::Clear() {
   PlasticNumber.clear();
   Energy.clear();
   Time.clear();
+  PosY.clear();
 }
 
 
 
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::ReadConfiguration(NPL::InputParser parser) {
-  vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Sofia");
+void TSofTofWPhysics::ReadConfiguration(NPL::InputParser parser) {
+  vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("SofTofW");
   if(NPOptionManager::getInstance()->GetVerboseLevel())
     cout << "//// " << blocks.size() << " detectors found " << endl; 
 
-  vector<string> cart = {"POS","Shape"};
-  vector<string> sphe = {"R","Theta","Phi","Shape"};
+  vector<string> cart = {"POS"};
+  vector<string> sphe = {"R","Theta","Phi"};
 
   for(unsigned int i = 0 ; i < blocks.size() ; i++){
     if(blocks[i]->HasTokenList(cart)){
       if(NPOptionManager::getInstance()->GetVerboseLevel())
-        cout << endl << "////  Sofia " << i+1 <<  endl;
+        cout << endl << "////  SofTofW " << i+1 <<  endl;
     
       TVector3 Pos = blocks[i]->GetTVector3("POS","mm");
-      string Shape = blocks[i]->GetString("Shape");
-      AddDetector(Pos,Shape);
+      AddDetector(Pos);
     }
     else if(blocks[i]->HasTokenList(sphe)){
       if(NPOptionManager::getInstance()->GetVerboseLevel())
-        cout << endl << "////  Sofia " << i+1 <<  endl;
+        cout << endl << "////  SofTofW " << i+1 <<  endl;
       double R = blocks[i]->GetDouble("R","mm");
       double Theta = blocks[i]->GetDouble("Theta","deg");
       double Phi = blocks[i]->GetDouble("Phi","deg");
-      string Shape = blocks[i]->GetString("Shape");
-      AddDetector(R,Theta,Phi,Shape);
+      AddDetector(R,Theta,Phi);
     }
     else{
       cout << "ERROR: check your input file formatting " << endl;
@@ -228,85 +221,39 @@ void TSofiaPhysics::ReadConfiguration(NPL::InputParser parser) {
   }
 }
 
-///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::InitSpectra() {
-  m_Spectra = new TSofiaSpectra(m_NumberOfDetectors);
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::FillSpectra() {
-  m_Spectra -> FillRawSpectra(m_EventData);
-  m_Spectra -> FillPreTreatedSpectra(m_PreTreatedData);
-  m_Spectra -> FillPhysicsSpectra(m_EventPhysics);
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::CheckSpectra() {
-  m_Spectra->CheckSpectra();
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::ClearSpectra() {
-  // To be done
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////
-map< string , TH1*> TSofiaPhysics::GetSpectra() {
-  if(m_Spectra)
-    return m_Spectra->GetMapHisto();
-  else{
-    map< string , TH1*> empty;
-    return empty;
-  }
-}
-
-///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::WriteSpectra() {
-  m_Spectra->WriteSpectra();
-}
-
-
 
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::AddParameterToCalibrationManager() {
+void TSofTofWPhysics::AddParameterToCalibrationManager() {
   CalibrationManager* Cal = CalibrationManager::getInstance();
   for (int i = 0; i < m_NumberOfDetectors; ++i) {
-    Cal->AddParameter("Sofia", "D"+ NPL::itoa(i+1)+"_ENERGY","Sofia_D"+ NPL::itoa(i+1)+"_ENERGY");
-    Cal->AddParameter("Sofia", "D"+ NPL::itoa(i+1)+"_TIME","Sofia_D"+ NPL::itoa(i+1)+"_TIME");
+    Cal->AddParameter("SofTofW", "D"+ NPL::itoa(i+1)+"_ENERGY","SofTofW_D"+ NPL::itoa(i+1)+"_ENERGY");
+    Cal->AddParameter("SofTofW", "D"+ NPL::itoa(i+1)+"_TIME","SofTofW_D"+ NPL::itoa(i+1)+"_TIME");
   }
 }
 
 
 
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::InitializeRootInputRaw() {
+void TSofTofWPhysics::InitializeRootInputRaw() {
   TChain* inputChain = RootInput::getInstance()->GetChain();
-  inputChain->SetBranchStatus("Sofia",  true );
-  inputChain->SetBranchAddress("Sofia", &m_EventData );
+  inputChain->SetBranchStatus("SofTofW",  true );
+  inputChain->SetBranchAddress("SofTofW", &m_EventData );
 }
 
 
 
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::InitializeRootInputPhysics() {
+void TSofTofWPhysics::InitializeRootInputPhysics() {
   TChain* inputChain = RootInput::getInstance()->GetChain();
-  inputChain->SetBranchAddress("Sofia", &m_EventPhysics);
+  inputChain->SetBranchAddress("SofTofW", &m_EventPhysics);
 }
 
 
 
 ///////////////////////////////////////////////////////////////////////////
-void TSofiaPhysics::InitializeRootOutput() {
+void TSofTofWPhysics::InitializeRootOutput() {
   TTree* outputTree = RootOutput::getInstance()->GetTree();
-  outputTree->Branch("Sofia", "TSofiaPhysics", &m_EventPhysics);
+  outputTree->Branch("SofTofW", "TSofTofWPhysics", &m_EventPhysics);
 }
 
 
@@ -314,8 +261,8 @@ void TSofiaPhysics::InitializeRootOutput() {
 ////////////////////////////////////////////////////////////////////////////////
 //            Construct Method to be pass to the DetectorFactory              //
 ////////////////////////////////////////////////////////////////////////////////
-NPL::VDetector* TSofiaPhysics::Construct() {
-  return (NPL::VDetector*) new TSofiaPhysics();
+NPL::VDetector* TSofTofWPhysics::Construct() {
+  return (NPL::VDetector*) new TSofTofWPhysics();
 }
 
 
@@ -324,14 +271,14 @@ NPL::VDetector* TSofiaPhysics::Construct() {
 //            Registering the construct method to the factory                 //
 ////////////////////////////////////////////////////////////////////////////////
 extern "C"{
-class proxy_Sofia{
+class proxy_SofTofW{
   public:
-    proxy_Sofia(){
-      NPL::DetectorFactory::getInstance()->AddToken("Sofia","Sofia");
-      NPL::DetectorFactory::getInstance()->AddDetector("Sofia",TSofiaPhysics::Construct);
+    proxy_SofTofW(){
+      NPL::DetectorFactory::getInstance()->AddToken("SofTofW","SofTofW");
+      NPL::DetectorFactory::getInstance()->AddDetector("SofTofW",TSofTofWPhysics::Construct);
     }
 };
 
-proxy_Sofia p_Sofia;
+proxy_SofTofW p_SofTofW;
 }
 
diff --git a/NPLib/Detectors/Sofia/TSofiaPhysics.h b/NPLib/Detectors/Sofia/TSofTofWPhysics.h
similarity index 74%
rename from NPLib/Detectors/Sofia/TSofiaPhysics.h
rename to NPLib/Detectors/Sofia/TSofTofWPhysics.h
index 984de993ee33784ace9fc9629592713dfe768b1c..3b8ac0370ffe652698fc4e410614a1e4df6ed58d 100644
--- a/NPLib/Detectors/Sofia/TSofiaPhysics.h
+++ b/NPLib/Detectors/Sofia/TSofTofWPhysics.h
@@ -1,5 +1,5 @@
-#ifndef TSofiaPHYSICS_H
-#define TSofiaPHYSICS_H
+#ifndef TSofTofWPHYSICS_H
+#define TSofTofWPHYSICS_H
 /*****************************************************************************
  * Copyright (C) 2009-2020   this file is part of the NPTool Project       *
  *                                                                           *
@@ -14,7 +14,7 @@
  * Last update    :                                                          *
  *---------------------------------------------------------------------------*
  * Decription:                                                               *
- *  This class hold Sofia Treated data                                *
+ *  This class hold TofTofW Treated data                                *
  *                                                                           *
  *---------------------------------------------------------------------------*
  * Comment:                                                                  *
@@ -33,22 +33,19 @@ using namespace std;
 #include "TH1.h"
 #include "TVector3.h"
 // NPTool headers
-#include "TSofiaData.h"
-#include "TSofiaSpectra.h"
+#include "TSofTofWData.h"
 #include "NPCalibrationManager.h"
 #include "NPVDetector.h"
 #include "NPInputParser.h"
-// forward declaration
-class TSofiaSpectra;
 
 
 
-class TSofiaPhysics : public TObject, public NPL::VDetector {
+class TSofTofWPhysics : public TObject, public NPL::VDetector {
   //////////////////////////////////////////////////////////////
   // constructor and destructor
   public:
-    TSofiaPhysics();
-    ~TSofiaPhysics() {};
+    TSofTofWPhysics();
+    ~TSofTofWPhysics() {};
 
 
   //////////////////////////////////////////////////////////////
@@ -62,14 +59,14 @@ class TSofiaPhysics : public TObject, public NPL::VDetector {
   // data obtained after BuildPhysicalEvent() and stored in
   // output ROOT file
   public:
-    vector<int>      DetectorNumber;
     vector<int>      PlasticNumber;
     vector<double>   Energy;
     vector<double>   Time;
+    vector<double>   PosY;
 
   /// A usefull method to bundle all operation to add a detector
-  void AddDetector(TVector3 POS, string shape); 
-  void AddDetector(double R, double Theta, double Phi, string shape); 
+  void AddDetector(TVector3 POS); 
+  void AddDetector(double R, double Theta, double Phi); 
   
   //////////////////////////////////////////////////////////////
   // methods inherited from the VDetector ABC class
@@ -108,27 +105,9 @@ class TSofiaPhysics : public TObject, public NPL::VDetector {
     void ClearEventPhysics() {Clear();}      
     void ClearEventData()    {m_EventData->Clear();}   
 
-    // methods related to the TSofiaSpectra class
-    // instantiate the TSofiaSpectra class and 
-    // declare list of histograms
-    void InitSpectra();
-
-    // fill the spectra
-    void FillSpectra();
-
-    // used for Online mainly, sanity check for histograms and 
-    // change their color if issues are found, for example
-    void CheckSpectra();
-
-    // used for Online only, clear all the spectra
-    void ClearSpectra();
-
-    // write spectra to ROOT output file
-    void WriteSpectra();
-
 
   //////////////////////////////////////////////////////////////
-  // specific methods to Sofia array
+  // specific methods to SofTofW array
   public:
     // remove bad channels, calibrate the data and apply thresholds
     void PreTreat();
@@ -139,20 +118,20 @@ class TSofiaPhysics : public TObject, public NPL::VDetector {
     // read the user configuration file. If no file is found, load standard one
     void ReadAnalysisConfig();
 
-    // give and external TSofiaData object to TSofiaPhysics. 
+    // give and external TSofTofWData object to TSofTofWPhysics. 
     // needed for online analysis for example
-    void SetRawDataPointer(TSofiaData* rawDataPointer) {m_EventData = rawDataPointer;}
+    void SetRawDataPointer(TSofTofWData* rawDataPointer) {m_EventData = rawDataPointer;}
     
   // objects are not written in the TTree
   private:
-    TSofiaData*         m_EventData;        //!
-    TSofiaData*         m_PreTreatedData;   //!
-    TSofiaPhysics*      m_EventPhysics;     //!
+    TSofTofWData*         m_EventData;        //!
+    TSofTofWData*         m_PreTreatedData;   //!
+    TSofTofWPhysics*      m_EventPhysics;     //!
 
   // getters for raw and pre-treated data object
   public:
-    TSofiaData* GetRawData()        const {return m_EventData;}
-    TSofiaData* GetPreTreatedData() const {return m_PreTreatedData;}
+    TSofTofWData* GetRawData()        const {return m_EventData;}
+    TSofTofWData* GetPreTreatedData() const {return m_PreTreatedData;}
 
   // parameters used in the analysis
   private:
@@ -164,18 +143,10 @@ class TSofiaPhysics : public TObject, public NPL::VDetector {
   private:
     int m_NumberOfDetectors;  //!
 
-  // spectra class
-  private:
-    TSofiaSpectra* m_Spectra; // !
-
-  // spectra getter
-  public:
-    map<string, TH1*>   GetSpectra(); 
-
   // Static constructor to be passed to the Detector Factory
   public:
     static NPL::VDetector* Construct();
 
-    ClassDef(TSofiaPhysics,1)  // SofiaPhysics structure
+    ClassDef(TSofTofWPhysics,1)  // SofTofWPhysics structure
 };
 #endif
diff --git a/NPLib/Detectors/Sofia/TSofTrimData.cxx b/NPLib/Detectors/Sofia/TSofTrimData.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..b89b933f25a090118e204915358bbf38b637d381
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofTrimData.cxx
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ * Creation Date  : May 2021                                           *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofTrim Raw data                                    *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+#include "TSofTrimData.h"
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+using namespace std; 
+
+ClassImp(TSofTrimData)
+
+
+//////////////////////////////////////////////////////////////////////
+TSofTrimData::TSofTrimData() {
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+TSofTrimData::~TSofTrimData() {
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+void TSofTrimData::Clear() {
+  fTrim_SectionNbr.clear();
+  fTrim_AnodeNbr.clear();
+  fTrim_Energy.clear();
+  fTrim_DriftTime.clear();
+  fTrim_PileUp.clear();
+  fTrim_Overflow.clear();
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+void TSofTrimData::Dump() const {
+  // This method is very useful for debuging and worth the dev.
+  cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TSofTrimData::Dump()] XXXXXXXXXXXXXXXXX" << endl;
+
+  // Energy
+  size_t mysize = fTrim_AnodeNbr.size();
+  cout << "Trim_Mult: " << GetMultiplicity() << endl;
+ 
+}
diff --git a/NPLib/Detectors/Sofia/TSofTrimData.h b/NPLib/Detectors/Sofia/TSofTrimData.h
new file mode 100644
index 0000000000000000000000000000000000000000..761595e1a848392a9f732dd3404e7a7b2fa92a6b
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofTrimData.h
@@ -0,0 +1,87 @@
+#ifndef __SofTrimDATA__
+#define __SofTrimDATA__
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ *                                                                           *
+ * Creation Date  : May 2021                                                 *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofTrim Raw data                                    *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+
+// STL
+#include <vector>
+using namespace std;
+
+// ROOT
+#include "TObject.h"
+
+class TSofTrimData : public TObject {
+  //////////////////////////////////////////////////////////////
+  // data members are hold into vectors in order 
+  // to allow multiplicity treatment
+  private: 
+    vector<int>      fTrim_SectionNbr;
+    vector<int>      fTrim_AnodeNbr;
+    vector<double>   fTrim_Energy;
+    vector<double>   fTrim_DriftTime;
+    vector<bool>     fTrim_PileUp;
+    vector<bool>     fTrim_Overflow;
+
+  //////////////////////////////////////////////////////////////
+  // Constructor and destructor
+  public: 
+    TSofTrimData();
+    ~TSofTrimData();
+    
+
+  //////////////////////////////////////////////////////////////
+  // Inherited from TObject and overriden to avoid warnings
+  public:
+    void Clear();
+    void Clear(const Option_t*) {};
+    void Dump() const;
+
+
+  //////////////////////////////////////////////////////////////
+  // Getters and Setters
+  // Prefer inline declaration to avoid unnecessary called of 
+  // frequently used methods
+  // add //! to avoid ROOT creating dictionnary for the methods
+  public:
+    //////////////////////    SETTERS    ////////////////////////
+    inline void SetSectionNbr(int sec){fTrim_SectionNbr.push_back(sec);};//!
+    inline void SetAnodeNbr(int det){fTrim_AnodeNbr.push_back(det);};//!
+    inline void SetEnergy(double Energy){fTrim_Energy.push_back(Energy);};//!
+    inline void SetDriftTime(double Time){fTrim_DriftTime.push_back(Time);};//!
+    inline void SetPileUp(bool ispileup){fTrim_PileUp.push_back(ispileup);};//!
+    inline void SetOverflow(bool isoverflow){fTrim_Overflow.push_back(isoverflow);};//!
+
+    //////////////////////    GETTERS    ////////////////////////
+    inline int GetMultiplicity() const {return fTrim_AnodeNbr.size();}//!
+    inline int GetSectionNbr(const unsigned int &i) const {return fTrim_SectionNbr[i];}//! 
+    inline int GetAnodeNbr(const unsigned int &i) const {return fTrim_AnodeNbr[i];}//! 
+    inline double GetEnergy(const unsigned int &i) const {return fTrim_Energy[i];}//!     
+    inline double GetDriftTime(const unsigned int &i) const {return fTrim_DriftTime[i];}//!     
+    inline bool GetPileUp(const unsigned int &i) const {return fTrim_PileUp[i];}//!     
+    inline bool GetOverflow(const unsigned int &i) const {return fTrim_Overflow[i];}//!     
+
+  //////////////////////////////////////////////////////////////
+  // Required for ROOT dictionnary
+  ClassDef(TSofTrimData,1)  // SofTrimData structure
+};
+
+#endif
diff --git a/NPLib/Detectors/Sofia/TSofTrimPhysics.cxx b/NPLib/Detectors/Sofia/TSofTrimPhysics.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..5d55976570e598be69d8c18f5c699af326b02439
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofTrimPhysics.cxx
@@ -0,0 +1,291 @@
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ *                                                                           *
+ * Creation Date  : November 2020                                           *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofTrim Treated  data                               *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+
+#include "TSofTrimPhysics.h"
+
+//   STL
+#include <sstream>
+#include <iostream>
+#include <cmath>
+#include <stdlib.h>
+#include <limits>
+using namespace std;
+
+//   NPL
+#include "RootInput.h"
+#include "RootOutput.h"
+#include "NPDetectorFactory.h"
+#include "NPOptionManager.h"
+
+//   ROOT
+#include "TChain.h"
+
+ClassImp(TSofTrimPhysics)
+
+
+  ///////////////////////////////////////////////////////////////////////////
+TSofTrimPhysics::TSofTrimPhysics()
+  : m_EventData(new TSofTrimData),
+  m_PreTreatedData(new TSofTrimData),
+  m_EventPhysics(this),
+  m_NumberOfDetectors(0), 
+  m_NumberOfSections(3), 
+  m_NumberOfAnodesPerSection(6) {
+  }
+
+///////////////////////////////////////////////////////////////////////////
+/// A usefull method to bundle all operation to add a detector
+void TSofTrimPhysics::AddDetector(TVector3 ){
+  // In That simple case nothing is done
+  // Typically for more complex detector one would calculate the relevant 
+  // positions (stripped silicon) or angles (gamma array)
+  m_NumberOfDetectors++;
+} 
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::AddDetector(double R, double Theta, double Phi){
+  // Compute the TVector3 corresponding
+  TVector3 Pos(R*sin(Theta)*cos(Phi),R*sin(Theta)*sin(Phi),R*cos(Theta));
+  // Call the cartesian method
+  AddDetector(Pos);
+} 
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::BuildSimplePhysicalEvent() {
+  BuildPhysicalEvent();
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::BuildPhysicalEvent() {
+  // apply thresholds and calibration
+  PreTreat();
+
+  // match energy and time together
+  unsigned int mysizeE = m_PreTreatedData->GetMultiplicity();
+  for (UShort_t e = 0; e < mysizeE ; e++) {
+    //to do 
+  }
+}
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::PreTreat() {
+  // This method typically applies thresholds and calibrations
+  // Might test for disabled channels for more complex detector
+
+  // clear pre-treated object
+  ClearPreTreatedData();
+
+  // instantiate CalibrationManager
+  static CalibrationManager* Cal = CalibrationManager::getInstance();
+
+  unsigned int mysize = m_EventData->GetMultiplicity();
+  for (unsigned int i = 0; i < mysize ; ++i) {
+    Double_t Energy = Cal->ApplyCalibration("SofTrim/ENERGY_SEC"+NPL::itoa(m_EventData->GetSectionNbr(i))+"_ANODE"+NPL::itoa(m_EventData->GetAnodeNbr(i))+"_ENERGY",m_EventData->GetEnergy(i));
+    Double_t Time = Cal->ApplyCalibration("SofTrim/TIME_SEC"+NPL::itoa(m_EventData->GetSectionNbr(i))+"_ANODE"+NPL::itoa(m_EventData->GetAnodeNbr(i))+"_TIME",m_EventData->GetDriftTime(i));
+
+    m_PreTreatedData->SetSectionNbr(m_EventData->GetSectionNbr(i));
+    m_PreTreatedData->SetAnodeNbr(m_EventData->GetAnodeNbr(i));
+    m_PreTreatedData->SetEnergy(Energy);
+    m_PreTreatedData->SetDriftTime(Time);
+    m_PreTreatedData->SetPileUp(m_EventData->GetPileUp(i));
+    m_PreTreatedData->SetOverflow(m_EventData->GetOverflow(i));
+  }
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::ReadAnalysisConfig() {
+  bool ReadingStatus = false;
+
+  // path to file
+  string FileName = "./configs/ConfigSofTrim.dat";
+
+  // open analysis config file
+  ifstream AnalysisConfigFile;
+  AnalysisConfigFile.open(FileName.c_str());
+
+  if (!AnalysisConfigFile.is_open()) {
+    cout << " No ConfigSofTrim.dat found: Default parameter loaded for Analayis " << FileName << endl;
+    return;
+  }
+  cout << " Loading user parameter for Analysis from ConfigSofTrim.dat " << endl;
+
+  // Save it in a TAsciiFile
+  TAsciiFile* asciiConfig = RootOutput::getInstance()->GetAsciiFileAnalysisConfig();
+  asciiConfig->AppendLine("%%% ConfigSofTrim.dat %%%");
+  asciiConfig->Append(FileName.c_str());
+  asciiConfig->AppendLine("");
+  // read analysis config file
+  string LineBuffer,DataBuffer,whatToDo;
+  while (!AnalysisConfigFile.eof()) {
+    // Pick-up next line
+    getline(AnalysisConfigFile, LineBuffer);
+
+    // search for "header"
+    string name = "ConfigSofTrim";
+    if (LineBuffer.compare(0, name.length(), name) == 0) 
+      ReadingStatus = true;
+
+    // loop on tokens and data
+    while (ReadingStatus ) {
+      whatToDo="";
+      AnalysisConfigFile >> whatToDo;
+
+      // Search for comment symbol (%)
+      if (whatToDo.compare(0, 1, "%") == 0) {
+        AnalysisConfigFile.ignore(numeric_limits<streamsize>::max(), '\n' );
+      }
+
+      /*else if (whatToDo=="E_RAW_THRESHOLD") {
+        AnalysisConfigFile >> DataBuffer;
+        m_E_RAW_Threshold = atof(DataBuffer.c_str());
+        cout << whatToDo << " " << m_E_RAW_Threshold << endl;
+        }
+
+        else if (whatToDo=="E_THRESHOLD") {
+        AnalysisConfigFile >> DataBuffer;
+        m_E_Threshold = atof(DataBuffer.c_str());
+        cout << whatToDo << " " << m_E_Threshold << endl;
+        }*/
+
+      else {
+        ReadingStatus = false;
+      }
+    }
+  }
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::Clear() {
+  SectionNbr.clear();
+  EnergyPair1.clear();
+  EnergyPair2.clear();
+  EnergyPair2.clear();
+  DriftTimePair1.clear();
+  DriftTimePair2.clear();
+  DriftTimePair3.clear();
+  EnergySum.clear();
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::ReadConfiguration(NPL::InputParser parser) {
+  vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("SofTrim");
+  if(NPOptionManager::getInstance()->GetVerboseLevel())
+    cout << "//// " << blocks.size() << " detectors found " << endl; 
+
+  vector<string> cart = {"POS"};
+  vector<string> sphe = {"R","Theta","Phi"};
+
+  for(unsigned int i = 0 ; i < blocks.size() ; i++){
+    if(blocks[i]->HasTokenList(cart)){
+      if(NPOptionManager::getInstance()->GetVerboseLevel())
+        cout << endl << "////  SofTrim " << i+1 <<  endl;
+
+      TVector3 Pos = blocks[i]->GetTVector3("POS","mm");
+      AddDetector(Pos);
+    }
+    else if(blocks[i]->HasTokenList(sphe)){
+      if(NPOptionManager::getInstance()->GetVerboseLevel())
+        cout << endl << "////  SofTrim " << i+1 <<  endl;
+      double R = blocks[i]->GetDouble("R","mm");
+      double Theta = blocks[i]->GetDouble("Theta","deg");
+      double Phi = blocks[i]->GetDouble("Phi","deg");
+      AddDetector(R,Theta,Phi);
+    }
+    else{
+      cout << "ERROR: check your input file formatting " << endl;
+      exit(1);
+    }
+  }
+}
+
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::AddParameterToCalibrationManager() {
+  CalibrationManager* Cal = CalibrationManager::getInstance();
+  for(int sec = 0; sec < m_NumberOfSections; sec++){
+    for(int anode = 0; anode < m_NumberOfAnodesPerSection; anode++){
+      Cal->AddParameter("SofTrim","SEC"+NPL::itoa(sec+1)+"_ANODE"+NPL::itoa(anode+1)+"_ENERGY","SofTrim_SEC"+NPL::itoa(sec+1)+"_ANODE"+NPL::itoa(anode+1)+"_ENERGY");
+      Cal->AddParameter("SofTrim","SEC"+NPL::itoa(sec+1)+"_ANODE"+NPL::itoa(anode+1)+"_TIME","SofTrim_SEC"+NPL::itoa(sec+1)+"_ANODE"+NPL::itoa(anode+1)+"_TIME");
+
+    }
+  }
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::InitializeRootInputRaw() {
+  TChain* inputChain = RootInput::getInstance()->GetChain();
+  inputChain->SetBranchStatus("SofTrim",  true );
+  inputChain->SetBranchAddress("SofTrim", &m_EventData );
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::InitializeRootInputPhysics() {
+  TChain* inputChain = RootInput::getInstance()->GetChain();
+  inputChain->SetBranchAddress("SofTrim", &m_EventPhysics);
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////
+void TSofTrimPhysics::InitializeRootOutput() {
+  TTree* outputTree = RootOutput::getInstance()->GetTree();
+  outputTree->Branch("SofTrim", "TSofTrimPhysics", &m_EventPhysics);
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+//            Construct Method to be pass to the DetectorFactory              //
+////////////////////////////////////////////////////////////////////////////////
+NPL::VDetector* TSofTrimPhysics::Construct() {
+  return (NPL::VDetector*) new TSofTrimPhysics();
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+//            Registering the construct method to the factory                 //
+////////////////////////////////////////////////////////////////////////////////
+extern "C"{
+  class proxy_SofTrim{
+    public:
+      proxy_SofTrim(){
+        NPL::DetectorFactory::getInstance()->AddToken("SofTrim","SofTrim");
+        NPL::DetectorFactory::getInstance()->AddDetector("SofTrim",TSofTrimPhysics::Construct);
+      }
+  };
+
+  proxy_SofTrim p_SofTrim;
+}
+
diff --git a/NPLib/Detectors/Sofia/TSofTrimPhysics.h b/NPLib/Detectors/Sofia/TSofTrimPhysics.h
new file mode 100644
index 0000000000000000000000000000000000000000..759fff86d56b500de3f6766655701e592e2da0ce
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofTrimPhysics.h
@@ -0,0 +1,157 @@
+#ifndef TSofTrimPHYSICS_H
+#define TSofTrimPHYSICS_H
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ *                                                                           *
+ * Creation Date  : November 2020                                           *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold TofTofW Treated data                                *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+
+// C++ headers 
+#include <vector>
+#include <map>
+#include <string>
+using namespace std;
+
+// ROOT headers
+#include "TObject.h"
+#include "TH1.h"
+#include "TVector3.h"
+// NPTool headers
+#include "TSofTrimData.h"
+#include "NPCalibrationManager.h"
+#include "NPVDetector.h"
+#include "NPInputParser.h"
+
+
+
+class TSofTrimPhysics : public TObject, public NPL::VDetector {
+  //////////////////////////////////////////////////////////////
+  // constructor and destructor
+  public:
+    TSofTrimPhysics();
+    ~TSofTrimPhysics() {};
+
+
+  //////////////////////////////////////////////////////////////
+  // Inherited from TObject and overriden to avoid warnings
+  public: 
+    void Clear();   
+    void Clear(const Option_t*) {};
+
+
+  //////////////////////////////////////////////////////////////
+  // data obtained after BuildPhysicalEvent() and stored in
+  // output ROOT file
+  public:
+    vector<int>      SectionNbr;
+    vector<double>   EnergyPair1;
+    vector<double>   EnergyPair2;
+    vector<double>   EnergyPair3;
+    vector<double>   DriftTimePair1;
+    vector<double>   DriftTimePair2;
+    vector<double>   DriftTimePair3;
+    vector<double>   EnergySum;
+
+  /// A usefull method to bundle all operation to add a detector
+  void AddDetector(TVector3 POS); 
+  void AddDetector(double R, double Theta, double Phi); 
+  
+  //////////////////////////////////////////////////////////////
+  // methods inherited from the VDetector ABC class
+  public:
+    // read stream from ConfigFile to pick-up detector parameters
+    void ReadConfiguration(NPL::InputParser);
+
+    // add parameters to the CalibrationManger
+    void AddParameterToCalibrationManager();
+
+    // method called event by event, aiming at extracting the 
+    // physical information from detector
+    void BuildPhysicalEvent();
+
+    // same as BuildPhysicalEvent() method but with a simpler
+    // treatment
+    void BuildSimplePhysicalEvent();
+
+    // same as above but for online analysis
+    void BuildOnlinePhysicalEvent()  {BuildPhysicalEvent();};
+
+    // activate raw data object and branches from input TChain
+    // in this method mother branches (Detector) AND daughter leaves 
+    // (fDetector_parameter) have to be activated
+    void InitializeRootInputRaw();
+
+    // activate physics data object and branches from input TChain
+    // in this method mother branches (Detector) AND daughter leaves 
+    // (fDetector_parameter) have to be activated
+    void InitializeRootInputPhysics();
+
+    // create branches of output ROOT file
+    void InitializeRootOutput();
+
+    // clear the raw and physical data objects event by event
+    void ClearEventPhysics() {Clear();}      
+    void ClearEventData()    {m_EventData->Clear();}   
+
+
+  //////////////////////////////////////////////////////////////
+  // specific methods to SofTrim array
+  public:
+    // remove bad channels, calibrate the data and apply thresholds
+    void PreTreat();
+
+    // clear the pre-treated object
+    void ClearPreTreatedData()   {m_PreTreatedData->Clear();}
+
+    // read the user configuration file. If no file is found, load standard one
+    void ReadAnalysisConfig();
+
+    // give and external TSofTrimData object to TSofTrimPhysics. 
+    // needed for online analysis for example
+    void SetRawDataPointer(TSofTrimData* rawDataPointer) {m_EventData = rawDataPointer;}
+    
+  // objects are not written in the TTree
+  private:
+    TSofTrimData*         m_EventData;        //!
+    TSofTrimData*         m_PreTreatedData;   //!
+    TSofTrimPhysics*      m_EventPhysics;     //!
+
+  // getters for raw and pre-treated data object
+  public:
+    TSofTrimData* GetRawData()        const {return m_EventData;}
+    TSofTrimData* GetPreTreatedData() const {return m_PreTreatedData;}
+
+  // parameters used in the analysis
+  private:
+    // thresholds
+    double m_E_Threshold;     //!
+
+  // number of detectors
+  private:
+    int m_NumberOfDetectors;  //!
+    int m_NumberOfSections;  //!
+    int m_NumberOfAnodesPerSection;  //!
+
+  // Static constructor to be passed to the Detector Factory
+  public:
+    static NPL::VDetector* Construct();
+
+    ClassDef(TSofTrimPhysics,1)  // SofTrimPhysics structure
+};
+#endif
diff --git a/NPLib/Detectors/Sofia/TSofTwimData.cxx b/NPLib/Detectors/Sofia/TSofTwimData.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..5b2f302751d3d314f1f4d44f382188bc8fc02277
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofTwimData.cxx
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ * Creation Date  : May 2021                                           *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofTwim Raw data                                    *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+#include "TSofTwimData.h"
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+using namespace std; 
+
+ClassImp(TSofTwimData)
+
+
+//////////////////////////////////////////////////////////////////////
+TSofTwimData::TSofTwimData() {
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+TSofTwimData::~TSofTwimData() {
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+void TSofTwimData::Clear() {
+  fTwim_SectionNbr.clear();
+  fTwim_AnodeNbr.clear();
+  fTwim_Energy.clear();
+  fTwim_DriftTime.clear();
+  fTwim_PileUp.clear();
+  fTwim_Overflow.clear();
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+void TSofTwimData::Dump() const {
+  // This method is very useful for debuging and worth the dev.
+  cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TSofTwimData::Dump()] XXXXXXXXXXXXXXXXX" << endl;
+
+  // Energy
+  size_t mysize = fTwim_AnodeNbr.size();
+  cout << "Twim_Mult: " << GetMultiplicity() << endl;
+ 
+}
diff --git a/NPLib/Detectors/Sofia/TSofTwimData.h b/NPLib/Detectors/Sofia/TSofTwimData.h
new file mode 100644
index 0000000000000000000000000000000000000000..2819d658701f5e47b0f434eee7a86c946177b838
--- /dev/null
+++ b/NPLib/Detectors/Sofia/TSofTwimData.h
@@ -0,0 +1,87 @@
+#ifndef __SofTwimDATA__
+#define __SofTwimDATA__
+/*****************************************************************************
+ * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
+ *                                                                           *
+ * Creation Date  : May 2021                                                 *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class hold SofTwim Raw data                                    *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *   
+ *                                                                           *
+ *****************************************************************************/
+
+// STL
+#include <vector>
+using namespace std;
+
+// ROOT
+#include "TObject.h"
+
+class TSofTwimData : public TObject {
+  //////////////////////////////////////////////////////////////
+  // data members are hold into vectors in order 
+  // to allow multiplicity treatment
+  private: 
+    vector<int>      fTwim_SectionNbr;
+    vector<int>      fTwim_AnodeNbr;
+    vector<double>   fTwim_Energy;
+    vector<double>   fTwim_DriftTime;
+    vector<bool>     fTwim_PileUp;
+    vector<bool>     fTwim_Overflow;
+
+  //////////////////////////////////////////////////////////////
+  // Constructor and destructor
+  public: 
+    TSofTwimData();
+    ~TSofTwimData();
+    
+
+  //////////////////////////////////////////////////////////////
+  // Inherited from TObject and overriden to avoid warnings
+  public:
+    void Clear();
+    void Clear(const Option_t*) {};
+    void Dump() const;
+
+
+  //////////////////////////////////////////////////////////////
+  // Getters and Setters
+  // Prefer inline declaration to avoid unnecessary called of 
+  // frequently used methods
+  // add //! to avoid ROOT creating dictionnary for the methods
+  public:
+    //////////////////////    SETTERS    ////////////////////////
+    inline void SetSectionNbr(int sec){fTwim_SectionNbr.push_back(sec);};//!
+    inline void SetAnodeNbr(int det){fTwim_AnodeNbr.push_back(det);};//!
+    inline void SetEnergy(double Energy){fTwim_Energy.push_back(Energy);};//!
+    inline void SetDriftTime(double Time){fTwim_DriftTime.push_back(Time);};//!
+    inline void SetPileUp(bool ispileup){fTwim_PileUp.push_back(ispileup);};//!
+    inline void SetOverflow(bool isoverflow){fTwim_Overflow.push_back(isoverflow);};//!
+
+    //////////////////////    GETTERS    ////////////////////////
+    inline int GetMultiplicity() const {return fTwim_AnodeNbr.size();}//!
+    inline int GetSectionNbr(const unsigned int &i) const {return fTwim_SectionNbr[i];}//! 
+    inline int GetAnodeNbr(const unsigned int &i) const {return fTwim_AnodeNbr[i];}//! 
+    inline double GetEnergy(const unsigned int &i) const {return fTwim_Energy[i];}//!     
+    inline double GetDriftTime(const unsigned int &i) const {return fTwim_DriftTime[i];}//!     
+    inline bool GetPileUp(const unsigned int &i) const {return fTwim_PileUp[i];}//!     
+    inline bool GetOverflow(const unsigned int &i) const {return fTwim_Overflow[i];}//!     
+
+  //////////////////////////////////////////////////////////////
+  // Required for ROOT dictionnary
+  ClassDef(TSofTwimData,1)  // SofTwimData structure
+};
+
+#endif
diff --git a/NPLib/Detectors/Sofia/TSofiaData.h b/NPLib/Detectors/Sofia/TSofiaData.h
deleted file mode 100644
index 548fa1e0f4b43311acd61098519194d907cd93b6..0000000000000000000000000000000000000000
--- a/NPLib/Detectors/Sofia/TSofiaData.h
+++ /dev/null
@@ -1,115 +0,0 @@
-#ifndef __SofiaDATA__
-#define __SofiaDATA__
-/*****************************************************************************
- * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
- *                                                                           *
- * Creation Date  : November 2020                                           *
- * Last update    :                                                          *
- *---------------------------------------------------------------------------*
- * Decription:                                                               *
- *  This class hold Sofia Raw data                                    *
- *                                                                           *
- *---------------------------------------------------------------------------*
- * Comment:                                                                  *
- *                                                                           *   
- *                                                                           *
- *****************************************************************************/
-
-// STL
-#include <vector>
-using namespace std;
-
-// ROOT
-#include "TObject.h"
-
-class TSofiaData : public TObject {
-  //////////////////////////////////////////////////////////////
-  // data members are hold into vectors in order 
-  // to allow multiplicity treatment
-  private: 
-    // TOF //
-    vector<int>      fTOF_DetectorNbr;
-    vector<int>      fTOF_PlasticNbr;
-    vector<double>   fTOF_Energy;
-    vector<double>   fTOF_Time;
-  
-    // TWIN MUSIC //
-    vector<int>      fTWIN_SectorNbr;
-    vector<int>      fTWIN_AnodeNbr;
-    vector<double>   fTWIN_AnodeEnergy;
-    vector<double>   fTWIN_AnodeTime;
-    double           fTWIN_Esum1;
-    double           fTWIN_Esum2;
-    double           fTWIN_Esum3;
-    double           fTWIN_Esum4;
-
-  //////////////////////////////////////////////////////////////
-  // Constructor and destructor
-  public: 
-    TSofiaData();
-    ~TSofiaData();
-    
-
-  //////////////////////////////////////////////////////////////
-  // Inherited from TObject and overriden to avoid warnings
-  public:
-    void Clear();
-    void Clear(const Option_t*) {};
-    void Dump() const;
-
-
-  //////////////////////////////////////////////////////////////
-  // Getters and Setters
-  // Prefer inline declaration to avoid unnecessary called of 
-  // frequently used methods
-  // add //! to avoid ROOT creating dictionnary for the methods
-  public:
-    //////////////////////    SETTERS    ////////////////////////
-    // TOF
-    inline void SetDetectorNbr(int det){fTOF_DetectorNbr.push_back(det);};//!
-    inline void SetPlasticNbr(int plastic){fTOF_PlasticNbr.push_back(plastic);};//!
-    inline void SetEnergy(double Energy){fTOF_Energy.push_back(Energy);};//!
-    inline void SetTime(double Time){fTOF_Time.push_back(Time);};//!
-
-    // TWIN
-    inline void SetTwinSectorNbr(int Sector){fTWIN_SectorNbr.push_back(Sector);};//!
-    inline void SetTwinAnodeNbr(int Anode){fTWIN_AnodeNbr.push_back(Anode);};//!
-    inline void SetTwinAnodeEnergy(double Energy){fTWIN_AnodeEnergy.push_back(Energy);};//!
-    inline void SetTwinAnodeTime(double Time){fTWIN_AnodeTime.push_back(Time);};//!
-    inline void SetTwinEsum1(double E){fTWIN_Esum1=E;};//!
-    inline void SetTwinEsum2(double E){fTWIN_Esum2=E;};//!
-    inline void SetTwinEsum3(double E){fTWIN_Esum3=E;};//!
-    inline void SetTwinEsum4(double E){fTWIN_Esum4=E;};//!
-
-    //////////////////////    GETTERS    ////////////////////////
-    // TOF
-    inline int GetMultiplicity() const {return fTOF_PlasticNbr.size();}//!
-    inline int GetDetectorNbr(const unsigned int &i) const {return fTOF_DetectorNbr[i];}//! 
-    inline int GetPlasticNbr(const unsigned int &i) const {return fTOF_PlasticNbr[i];}//!     
-    inline double GetEnergy(const unsigned int &i) const {return fTOF_Energy[i];}//!     
-    inline double GetTime(const unsigned int &i) const {return fTOF_Time[i];}//!     
-
-    // TWIN
-    inline int GetTwinMult() const {return fTWIN_AnodeNbr.size();}//!
-    inline int GetTwinSectorNbr(const unsigned int &i) const {return fTWIN_SectorNbr[i];}//!
-    inline int GetTwinAnodeNbr(const unsigned int &i) const {return fTWIN_AnodeNbr[i];}//!
-    inline double GetTwinAnodeEnergy(const unsigned int &i) const {return fTWIN_AnodeEnergy[i];}//!
-    inline double GetTwinAnodeTime(const unsigned int &i) const {return fTWIN_AnodeTime[i];}//!
-    inline double GetTwinEsum1() const {return fTWIN_Esum1;}//!
-    inline double GetTwinEsum2() const {return fTWIN_Esum2;}//!
-    inline double GetTwinEsum3() const {return fTWIN_Esum3;}//!
-    inline double GetTwinEsum4() const {return fTWIN_Esum4;}//!
-
-  //////////////////////////////////////////////////////////////
-  // Required for ROOT dictionnary
-  ClassDef(TSofiaData,1)  // SofiaData structure
-};
-
-#endif
diff --git a/NPLib/Detectors/Sofia/TSofiaSpectra.cxx b/NPLib/Detectors/Sofia/TSofiaSpectra.cxx
deleted file mode 100644
index 2cd43574b09af67e0a3ec8d84e78ed050c157df8..0000000000000000000000000000000000000000
--- a/NPLib/Detectors/Sofia/TSofiaSpectra.cxx
+++ /dev/null
@@ -1,156 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2009-2020   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: Pierre Morfouace  contact address: pierre.morfouace2@cea.fr                        *
- *                                                                           *
- * Creation Date  : November 2020                                           *
- * Last update    :                                                          *
- *---------------------------------------------------------------------------*
- * Decription:                                                               *
- *  This class hold Sofia Spectra                                     *
- *                                                                           *
- *---------------------------------------------------------------------------*
- * Comment:                                                                  *
- *                                                                           *   
- *                                                                           *
- *****************************************************************************/
-
-// class header 
-#include "TSofiaSpectra.h"
-
-// STL
-#include <iostream>  
-#include <string>
-using namespace std;
-
-// NPTool header
-#include "NPOptionManager.h"
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-TSofiaSpectra::TSofiaSpectra() 
-   : fNumberOfDetectors(0) {
-  SetName("Sofia");
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-TSofiaSpectra::TSofiaSpectra(unsigned int NumberOfDetectors) {
-  if(NPOptionManager::getInstance()->GetVerboseLevel()>0)
-    cout << "************************************************" << endl
-      << "TSofiaSpectra : Initalizing control spectra for " 
-      << NumberOfDetectors << " Detectors" << endl
-      << "************************************************" << endl ;
-  SetName("Sofia");
-  fNumberOfDetectors = NumberOfDetectors;
-
-  InitRawSpectra();
-  InitPreTreatedSpectra();
-  InitPhysicsSpectra();
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-TSofiaSpectra::~TSofiaSpectra() {
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-void TSofiaSpectra::InitRawSpectra() {
-  static string name;
-  for (unsigned int i = 0; i < fNumberOfDetectors; i++) { // loop on number of detectors
-    // Energy 
-    name = "Sofia"+NPL::itoa(i+1)+"_ENERGY_RAW";
-    AddHisto1D(name, name, 4096, 0, 16384, "Sofia/RAW");
-    // Time 
-    name = "Sofia"+NPL::itoa(i+1)+"_TIME_RAW";
-    AddHisto1D(name, name, 4096, 0, 16384, "Sofia/RAW");
-  } // end loop on number of detectors
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-void TSofiaSpectra::InitPreTreatedSpectra() {
-  static string name;
-  for (unsigned int i = 0; i < fNumberOfDetectors; i++) { // loop on number of detectors
-    // Energy 
-    name = "Sofia"+NPL::itoa(i+1)+"_ENERGY_CAL";
-    AddHisto1D(name, name, 500, 0, 25, "Sofia/CAL");
-    // Time
-    name = "Sofia"+NPL::itoa(i+1)+"_TIME_CAL";
-    AddHisto1D(name, name, 500, 0, 25, "Sofia/CAL");
-
-  
-  }  // end loop on number of detectors
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-void TSofiaSpectra::InitPhysicsSpectra() {
-  static string name;
-  // Kinematic Plot 
-  name = "Sofia_ENERGY_TIME";
-  AddHisto2D(name, name, 500, 0, 500, 500, 0, 50, "Sofia/PHY");
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-void TSofiaSpectra::FillRawSpectra(TSofiaData* RawData) {
-  static string name;
-  static string family;
-
-  // Energy 
-  unsigned int sizeE = RawData->GetMultiplicity();
-  for (unsigned int i = 0; i < sizeE; i++) {
-    name = "Sofia"+NPL::itoa(RawData->GetPlasticNbr(i))+"_ENERGY_RAW";
-    family = "Sofia/RAW";
-
-    FillSpectra(family,name,RawData->GetEnergy(i));
-  }
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-void TSofiaSpectra::FillPreTreatedSpectra(TSofiaData* PreTreatedData) {
-  static string name;
-  static string family;
-  
-  // Energy 
-  unsigned int sizeE = PreTreatedData->GetMultiplicity();
-  for (unsigned int i = 0; i < sizeE; i++) {
-    name = "Sofia"+NPL::itoa(PreTreatedData->GetPlasticNbr(i))+"_ENERGY_CAL";
-    family = "Sofia/CAL";
-
-    FillSpectra(family,name,PreTreatedData->GetEnergy(i));
-  }
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-void TSofiaSpectra::FillPhysicsSpectra(TSofiaPhysics* Physics) {
-  static string name;
-  static string family;
-  family= "Sofia/PHY";
-
-  // Energy vs time
-  unsigned int sizeE = Physics->Energy.size();
-  for(unsigned int i = 0 ; i < sizeE ; i++){
-    name = "Sofia_ENERGY_TIME";
-    FillSpectra(family,name,Physics->Energy[i],Physics->Time[i]);
-  }
-}
-
diff --git a/NPSimulation/Detectors/PISTA/PISTA.cc b/NPSimulation/Detectors/PISTA/PISTA.cc
index 3265e26c9e3e69bb9228d82553789383791bd1c1..de345ef37719861f83e714d422281d2f3c4cfc1a 100644
--- a/NPSimulation/Detectors/PISTA/PISTA.cc
+++ b/NPSimulation/Detectors/PISTA/PISTA.cc
@@ -64,12 +64,12 @@ namespace PISTA_NS{
   const double DE_ResoEnergy = 0.015*MeV ;
 
   // Trapezoid dimension
-  //const double TrapezoidBaseLarge = 95*mm;
-  const double TrapezoidBaseLarge = 78.1*mm;
-  //const double TrapezoidBaseSmall = 45*mm;
-  const double TrapezoidBaseSmall = 43.3*mm;
-  //const double TrapezoidHeight = 118*mm;
-  const double TrapezoidHeight = 61.8*mm;
+  const double TrapezoidBaseLarge = 74.1*mm;
+  //const double TrapezoidBaseLarge = 78.1*mm;
+  const double TrapezoidBaseSmall = 39.3*mm;
+  //const double TrapezoidBaseSmall = 43.3*mm;
+  const double TrapezoidHeight = 57.8*mm;
+  //const double TrapezoidHeight = 61.8*mm;
   const double TrapezoidLength = 1*cm;
   const double FirstStageThickness = 100*um;
   const double SecondStageThickness = 1*mm;
diff --git a/NPSimulation/Detectors/Sofia/Sofia.cc b/NPSimulation/Detectors/Sofia/Sofia.cc
index df09efa7d1a347b3240597862b6ba63def00b8e8..93db89c1add5cca29357a410cd5a7d67b5c5aab4 100644
--- a/NPSimulation/Detectors/Sofia/Sofia.cc
+++ b/NPSimulation/Detectors/Sofia/Sofia.cc
@@ -88,7 +88,7 @@ namespace Sofia_NS{
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 // Sofia Specific Method
 Sofia::Sofia(){
-  m_Event = new TSofiaData() ;
+  m_Event = new TSofTofWData() ;
   m_TofScorer = 0;
   m_TwinScorer = 0;
   m_PlasticTof = 0;
@@ -378,9 +378,9 @@ void Sofia::InitializeRootOutput(){
   RootOutput *pAnalysis = RootOutput::getInstance();
   TTree *pTree = pAnalysis->GetTree();
   if(!pTree->FindBranch("Sofia")){
-    pTree->Branch("Sofia", "TSofiaData", &m_Event) ;
+    pTree->Branch("SofTofW", "TSofTofWData", &m_Event) ;
   }
-  pTree->SetBranchAddress("Sofia", &m_Event) ;
+  pTree->SetBranchAddress("SofTofW", &m_Event) ;
 }
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -401,47 +401,15 @@ void Sofia::ReadSensitive(const G4Event* ){
       double Time = RandGauss::shoot(Scorer->GetTime(i),Sofia_NS::ResoTime);
       int DetectorNbr = level[0];
       int PlasticNbr = level[1]-1;
-      m_Event->SetDetectorNbr(DetectorNbr);
+      //m_Event->SetDetectorNbr(DetectorNbr);
       m_Event->SetPlasticNbr(PlasticNbr);
       m_Event->SetEnergy(Energy);
-      m_Event->SetTime(Time); 
+      m_Event->SetCoarseTime(Time); 
     }
   }
   Scorer->clear();
 
-  ///////////
-  // Twin scorer
-  CalorimeterScorers::PS_Calorimeter* TwinScorer= (CalorimeterScorers::PS_Calorimeter*) m_TwinScorer->GetPrimitive(0);
-  double Esum1=0;
-  double Esum2=0;
-  double Esum3=0;
-  double Esum4=0;
-  unsigned int twin_size = TwinScorer->GetMult(); 
-  for(unsigned int i = 0 ; i < twin_size ; i++){
-    vector<unsigned int> level = TwinScorer->GetLevel(i); 
-    double Energy = RandGauss::shoot(TwinScorer->GetEnergy(i),Sofia_NS::TwinResoEnergy);
-    if(Energy>Sofia_NS::EnergyThreshold){
-      double Time = RandGauss::shoot(TwinScorer->GetTime(i),Sofia_NS::ResoTime);
-      int SectorNbr = level[0];
-      int PlasticNbr = level[1];
-      if(SectorNbr==1) Esum1 += Energy;
-      if(SectorNbr==2) Esum2 += Energy;
-      if(SectorNbr==3) Esum3 += Energy;
-      if(SectorNbr==4) Esum4 += Energy;
-      m_Event->SetTwinSectorNbr(SectorNbr);
-      m_Event->SetTwinAnodeNbr(PlasticNbr);
-      m_Event->SetTwinAnodeEnergy(Energy);
-      m_Event->SetTwinAnodeTime(Time); 
-    }
   }
-  m_Event->SetTwinEsum1(Esum1);
-  m_Event->SetTwinEsum2(Esum1);
-  m_Event->SetTwinEsum3(Esum1);
-  m_Event->SetTwinEsum4(Esum1);
-
-  TwinScorer->clear();
-
-}
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 ////////////////////////////////////////////////////////////////   
@@ -449,7 +417,6 @@ void Sofia::InitializeScorers() {
   // This check is necessary in case the geometry is reloaded
   bool already_exist = false; 
   m_TofScorer = CheckScorer("TofScorer",already_exist) ;
-  m_TwinScorer = CheckScorer("TwinScorer",already_exist) ;
 
   if(already_exist) 
     return ;
diff --git a/NPSimulation/Detectors/Sofia/Sofia.hh b/NPSimulation/Detectors/Sofia/Sofia.hh
index 4a5b392b0731868649454546f60aec7507ea3675..4182106251d652c17f42db79f7d3c52e08a85daf 100644
--- a/NPSimulation/Detectors/Sofia/Sofia.hh
+++ b/NPSimulation/Detectors/Sofia/Sofia.hh
@@ -35,7 +35,7 @@ using namespace std;
 
 // NPTool header
 #include "NPSVDetector.hh"
-#include "TSofiaData.h"
+#include "TSofTofWData.h"
 #include "NPInputParser.h"
 
 class Sofia : public NPS::VDetector{
@@ -98,7 +98,7 @@ class Sofia : public NPS::VDetector{
     ///////////Event class to store Data////////////////
     ////////////////////////////////////////////////////
   private:
-    TSofiaData* m_Event ;
+    TSofTofWData* m_Event ;
 
     ////////////////////////////////////////////////////
     ///////////////Private intern Data//////////////////
diff --git a/Projects/PISTA/PISTA.detector b/Projects/PISTA/PISTA.detector
index 234c8fb79b213fbbaad8f7a0cb2a51a22e1bb88a..92f221685322ba32b069f80bcc7e783799f44426 100644
--- a/Projects/PISTA/PISTA.detector
+++ b/Projects/PISTA/PISTA.detector
@@ -9,42 +9,42 @@ Target
  Z= 0 mm
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 PISTA
- R= 85 mm
+ R= 80 mm
  THETA= 60 deg
  PHI= 315 deg
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 PISTA
- R= 85 mm
+ R= 80 mm
  THETA= 60 deg
  PHI= 270 deg
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 PISTA
- R= 85 mm
+ R= 80 mm
  THETA= 60 deg
  PHI= 225 deg
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 PISTA
- R= 85 mm
+ R= 80 mm
  THETA= 60 deg
  PHI= 180 deg
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 PISTA
- R= 85 mm
+ R= 80 mm
  THETA= 60 deg
  PHI= 135 deg
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 PISTA
- R= 85 mm
+ R= 80 mm
  THETA= 60 deg
  PHI= 90 deg
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 PISTA
- R= 85 mm
+ R= 80 mm
  THETA= 60 deg
  PHI= 45 deg
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 PISTA
- R= 85 mm
+ R= 80 mm
  THETA= 60 deg
  PHI= 0 deg
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/Projects/e793s/macro/BeamSpot/EventReader.C b/Projects/e793s/macro/BeamSpot/EventReader.C
index ff1ec0d0fb2d2dab29e399d17321346a555f8b81..e88744fa2f50f862a79e5a54e26c2ac42f84cd6c 100755
--- a/Projects/e793s/macro/BeamSpot/EventReader.C
+++ b/Projects/e793s/macro/BeamSpot/EventReader.C
@@ -20,8 +20,7 @@ using namespace std;
 void EventReader(){
 
   // Read ROOT file and pull the tree	
-  //auto DataFile = new TFile("../../../../Outputs/Analysis/47K_RawEnergyBranch_Run63_May11.root", "READ");
-  auto DataFile = new TFile("../../../../Outputs/Analysis/47K_RawEnergyBranch_Full_May11.root", "READ");
+  auto DataFile = new TFile("../../../../Outputs/Analysis/47K_Full_02June.root", "READ");
   auto PhysTree = (TTree*) DataFile->FindObjectAny("PhysicsTree");
 
   // Initilise the Mugast branch
@@ -56,7 +55,7 @@ void EventReader(){
 
   // Open output file
   ofstream outfile;
-  outfile.open("./XYZE_gammaGated_Full.txt");
+  outfile.open("./XYZE_Full_02June.txt");
 
   // Loop on entries
   for(unsigned int i=0; i<numEntries; i++){
diff --git a/Projects/e793s/macro/BeamSpot/MinimizeBeamSpot.cxx b/Projects/e793s/macro/BeamSpot/MinimizeBeamSpot.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..a89711353f530ab9e7352f448d580bba1890d714
--- /dev/null
+++ b/Projects/e793s/macro/BeamSpot/MinimizeBeamSpot.cxx
@@ -0,0 +1,132 @@
+#include "MinimizeBeamSpot.h"
+
+double devE(const double* parameter){
+  //Beam energy: 7.7 [MeV/A] * 47 [A] = 361.9 [MeV]
+  static NPL::Reaction reaction("47K(d,p)48K@362");
+
+  //Beam spot offset
+  TVector3 offset(parameter[0],parameter[1],parameter[2]);
+  unsigned int size = pos.size();
+
+  double dE,Theta;
+  TVector3 dir;
+
+  //Initilize histogram
+  h->Reset();
+  h1->Reset();
+  h2->Reset();
+  h3->Reset();
+  h4->Reset();
+  h5->Reset();
+  h7->Reset();
+
+  //Loop over events
+  for(unsigned int i = 0 ; i < size ; i++){
+    //Particle path vector
+    dir=*(pos[i])-offset;
+
+    //Detected energy, and angle of particle leaving target
+    double Theta= dir.Angle(TVector3(0,0,1));
+    double Energy = energy[i];
+
+    //NOTE!!! Not calucualting energy loss in Al???
+    //Energy loss in target
+    Energy=CD2.EvaluateInitialEnergy(
+		    Energy,                      //energy after leaving target
+		    0.5*parameter[4]*micrometer, //pass through half target
+		    Theta);                      //angle leaving target
+
+    //Final value of Ex
+    double Ex = reaction.ReconstructRelativistic(Energy,Theta);
+    
+    //Fill histogram with ERROR in Ex!
+    //h->Fill(Ex-refE); 
+    h->Fill(Ex); 
+
+    switch(detnum[i]){
+      case 1:
+        h1->Fill(Ex); 
+        break;
+      case 2:
+        h2->Fill(Ex); 
+        break;
+      case 3:
+        h3->Fill(Ex); 
+        break;
+      case 4:
+        h4->Fill(Ex); 
+        break;
+      case 5:
+        h5->Fill(Ex); 
+        break;
+      case 7:
+        h7->Fill(Ex); 
+        break;
+      default:
+        cout << "ERROR! Invalid detnum: " << detnum[i] << " @" << i << endl;
+        return 1; // Exit code
+    }
+
+  }
+  //End loop over events
+
+  //Write vals to screen
+  cout << "Mean: " << h->GetMean() 
+       << "\t StdDev: " << h->GetStdDev() 
+       << "\t Thickness??: " << parameter[4] 
+       << endl;
+
+  //Draw histogram(s)
+  h->Draw();
+  if(flagDraw){ InitiliseCanvas(); }
+
+  //Adapt the metric as needed
+  return sqrt( pow(h->GetMean()-refE,2) + pow(0.1*h->GetStdDev(),2) );
+}
+////////////////////////////////////////////////////////////////////////////////
+void MinimizeBeamSpot(){
+
+  // Read data in
+  LoadFile();
+
+  // Start with beam (0,0,0) and 4.7um 0.5mg/c2 target
+  double parameter[4] = {0.0, 0.0, 0.0, 4.7};   
+  devE(parameter);
+
+  // Function with 4 parameter XYZ and Target thickness
+  auto func = ROOT::Math::Functor(&devE,4);
+ 
+  // Minimizer
+  auto minim = ROOT::Math::Factory::CreateMinimizer("Minuit2","Migrad"); 
+
+  minim->SetPrintLevel(0);
+  minim->SetPrecision(1e-10); 
+
+  // Set minimizer function
+  minim->SetFunction(func);
+
+  // Assign variable limits
+  minim->SetLimitedVariable(0,"X",parameter[0],0.01,-10,10);
+  minim->SetLimitedVariable(1,"Y",parameter[1],0.01,-10,10);
+  minim->SetLimitedVariable(2,"Z",parameter[2],0.01,-5,5);
+  minim->SetLimitedVariable(3,"T",parameter[3],0.01, 4.7-3.0, 4.7+3.0);
+
+  // Don't draw iterations of minimizer
+  flagDraw = 0;
+
+  // Shrink it, babeyyy
+  minim->Minimize(); 
+  
+  // Draw minimal value
+  flagDraw = 1;
+
+  // Pull values from minimizer
+  const double* x = minim->X();
+  cout << "========================================" << endl;
+  cout << "\t\tX =" << x[0] << endl;
+  cout << "\t\tY =" << x[1] << endl;
+  cout << "\t\tZ =" << x[2] << endl;
+  cout << "\t\tT =" << x[3] << endl;
+  cout << "Minimum: " << devE(x) << endl;
+  cout << "========================================" << endl;
+}
diff --git a/Projects/e793s/macro/BeamSpot/MinimizeBeamSpot.h b/Projects/e793s/macro/BeamSpot/MinimizeBeamSpot.h
new file mode 100644
index 0000000000000000000000000000000000000000..932bc8eadf5916f3b0ec0e4c1f97ec1c867e5c62
--- /dev/null
+++ b/Projects/e793s/macro/BeamSpot/MinimizeBeamSpot.h
@@ -0,0 +1,135 @@
+#include "Math/Minimizer.h"
+#include "Math/Factory.h"
+#include "Math/Functor.h"
+#include "TRandom2.h"
+#include "TError.h"
+#include <iostream>
+
+double refE = 0.143; // the energy of the selected states
+vector<TVector3*> pos;
+vector<double> energy;
+vector<int> detnum;
+NPL::EnergyLoss CD2("proton_CD2.G4table","G4Table",100);
+NPL::EnergyLoss Al("proton_Al.G4table","G4Table",100);
+using namespace std;
+
+bool flagDraw = 0;
+static auto h = new TH1D("h","h", 80,-1.,1.);
+static auto h1 = new TH1D("h1","h1", 40,-1.,1.);
+static auto h2 = new TH1D("h2","h2", 40,-1.,1.);
+static auto h3 = new TH1D("h3","h3", 40,-1.,1.);
+static auto h4 = new TH1D("h4","h4", 40,-1.,1.);
+static auto h5 = new TH1D("h5","h5", 40,-1.,1.);
+static auto h7 = new TH1D("h7","h7", 40,-1.,1.);
+
+////////////////////////////////////////////////////////////////////////////////
+void LoadFile(){
+  // Open XYZE gamma-gated file
+  ifstream file("XYZE_Full_02June.txt");
+  if(!file.is_open()){
+    cout << "fail to load file" << endl;
+    exit(1);
+  }
+  else {
+    cout <<  "Success opening file" << endl;
+  }
+
+  // Read in
+  int mg;
+  double x,y,z,e;
+  while(file >> mg >> x >> y >> z >> e ){
+    auto p = new TVector3(x,y,z);
+    detnum.push_back(mg);
+    pos.push_back(p);
+    energy.push_back(e);
+  }
+  file.close();
+}
+////////////////////////////////////////////////////////////////////////////////
+void InitiliseCanvas(){
+  TCanvas *canv = new TCanvas("canv","Ex Histograms",20,20,1600,800);
+  gStyle->SetOptStat(0);
+  canv->Divide(2,1,0.005,0.005,0);
+  canv->cd(1)->SetLeftMargin(0.15);
+  canv->cd(1)->SetBottomMargin(0.15);
+  gPad->SetTickx();
+  gPad->SetTicky();
+  canv->cd(2)->SetLeftMargin(0.15);
+  canv->cd(2)->SetBottomMargin(0.15);
+  gPad->SetTickx();
+  gPad->SetTicky();
+      
+  canv->cd(1);
+  h1->SetMaximum(75.);
+  h1->GetXaxis()->SetTitle("Ex [MeV]");
+  h1->GetYaxis()->SetTitle("Counts");
+      
+  // ----- MG1 -----
+  h1->SetStats(0);
+  h1->SetLineColor(kRed);
+  h1->SetFillStyle(3244);
+  h1->SetFillColor(kRed);
+  h1->Draw();
+  h1->Fit("gaus","WQ"); //add N to stop it drawing
+  
+  // ----- MG2 -----
+  h2->SetStats(0);
+  h2->SetLineColor(kOrange);
+  h2->SetFillStyle(3244);
+  h2->SetFillColor(kOrange);
+  h2->Draw("same");
+  h2->Fit("gaus","WQ"); //add N to stop it drawing
+          
+  // ----- MG3 -----
+  h3->SetStats(0);
+  h3->SetLineColor(kGreen);
+  h3->SetFillStyle(3344);
+  h3->SetFillColor(kGreen);
+  h3->Draw("same");
+  h3->Fit("gaus","WQ"); //add N to stop it drawing
+          
+  // ----- MG4 -----
+  h4->SetStats(0);
+  h4->SetLineColor(kTeal);
+  h4->SetFillStyle(3444);
+  h4->SetFillColor(kTeal);
+  h4->Draw("same");
+  h4->Fit("gaus","WQ"); //add N to stop it drawing
+          
+  // ----- MG5 -----
+  h5->SetStats(0);
+  h5->SetLineColor(kBlue);
+  h5->SetFillStyle(3544);
+  h5->SetFillColor(kBlue);
+  h5->Draw("same");
+  h5->Fit("gaus","WQ"); //add N to stop it drawing
+	  
+  // ----- MG7 -----
+  h7->SetStats(0);
+  h7->SetLineColor(kViolet);
+  h7->SetFillStyle(3644);
+  h7->SetFillColor(kViolet);
+  h7->Draw("same");
+  h7->Fit("gaus","WQ"); //add N to stop it drawing
+          
+  // Format legend
+  auto legend = new TLegend(0.15,0.7,0.35,0.9);
+  legend->AddEntry(h1,"MUGAST 1","f");
+  legend->AddEntry(h2,"MUGAST 2","f");
+  legend->AddEntry(h3,"MUGAST 3","f");
+  legend->AddEntry(h4,"MUGAST 4","f");
+  legend->AddEntry(h5,"MUGAST 5","f");
+  legend->AddEntry(h7,"MUGAST 7","f");
+  legend->Draw();
+  
+  // ----- ALL -----
+  canv->cd(2);
+  h->SetStats(0);
+  h->GetXaxis()->SetTitle("Ex [MeV]");
+  h->GetYaxis()->SetTitle("Counts");
+  h->Draw();
+  h->Fit("gaus", "WQ");
+  gPad->Update();
+}
+////////////////////////////////////////////////////////////////////////////////
+