From 2eb9d82da26ff5c8f0ec93b96b7a4cc7becdb93a Mon Sep 17 00:00:00 2001
From: adrien matta <matta@lpccaen.in2p3.fr>
Date: Thu, 12 Jul 2018 09:51:21 +0200
Subject: [PATCH] * Add -T flag to NPOptionManger         - Readin file without
 RunToTreat file * Suppress using namespace std from Core header

---
 NPLib/Core/NPCalibrationManager.cxx | 138 +++++++++++------------
 NPLib/Core/NPCalibrationManager.h   |  35 +++---
 NPLib/Core/NPDetectorFactory.cxx    |   8 +-
 NPLib/Core/NPDetectorManager.cxx    | 138 +++++++++++------------
 NPLib/Core/NPDetectorManager.h      |  30 ++---
 NPLib/Core/NPInputParser.cxx        |  32 +++---
 NPLib/Core/NPOptionManager.cxx      | 164 ++++++++++++++++------------
 NPLib/Core/NPOptionManager.h        |  77 +++++++------
 NPLib/Core/NPVDetector.cxx          |   9 +-
 NPLib/Core/NPVSpectra.h             |  41 ++++---
 NPLib/Core/RootInput.cxx            | 105 +++++++++---------
 NPLib/Core/RootInput.h              |  11 +-
 NPLib/Core/RootOutput.cxx           |  48 ++++----
 NPLib/Core/RootOutput.h             |  11 +-
 NPLib/Core/TAsciiFile.h             |   3 +-
 NPLib/Utility/npanalysis.cxx        |  30 ++---
 16 files changed, 447 insertions(+), 433 deletions(-)

diff --git a/NPLib/Core/NPCalibrationManager.cxx b/NPLib/Core/NPCalibrationManager.cxx
index 4503a7268..395617e99 100644
--- a/NPLib/Core/NPCalibrationManager.cxx
+++ b/NPLib/Core/NPCalibrationManager.cxx
@@ -33,7 +33,7 @@
 //////////////////////////////////////////////////////////////////
 CalibrationManager* CalibrationManager::instance = 0;
 
-CalibrationManager* CalibrationManager::getInstance(const string& configFileName){
+CalibrationManager* CalibrationManager::getInstance(const std::string& configFileName){
   // A new instance of CalibrationManager is created if it does not exist:
   if (instance == 0) {
     instance = new CalibrationManager(configFileName);
@@ -44,28 +44,28 @@ CalibrationManager* CalibrationManager::getInstance(const string& configFileName
 }
 
 //////////////////////////////////////////////////////////////////
-CalibrationManager::CalibrationManager(string configFileName){
+CalibrationManager::CalibrationManager(std::string configFileName){
   // Read configuration file Buffer
-  string lineBuffer, dataBuffer;
+  std::string lineBuffer, dataBuffer;
 
   // Open file
-  ifstream inputConfigFile;
+  std::ifstream inputConfigFile;
   inputConfigFile.open(configFileName.c_str());
 
   if(!NPOptionManager::getInstance()->IsDefault("Calibration")){
-    cout << endl;
-    cout << "/////////// Calibration Information ///////////" << endl;
-    cout << "Getting list of calibration files" << endl;
+    std::cout << std::endl;
+    std::cout << "/////////// Calibration Information ///////////" << std::endl;
+    std::cout << "Getting list of calibration files" << std::endl;
   }
  
   if (!inputConfigFile) {
       if(!NPOptionManager::getInstance()->IsDefault("Calibration"))
-        cout << "Calibration Path file: " << configFileName << " not found" << endl; 
+        std::cout << "Calibration Path file: " << configFileName << " not found" << std::endl; 
     return;
   }
 
   else { 
-    cout << "Reading list of files from: " << configFileName << endl; 
+    std::cout << "Reading list of files from: " << configFileName << std::endl; 
     while (!inputConfigFile.eof()) {
       getline(inputConfigFile, lineBuffer);
 
@@ -81,13 +81,13 @@ CalibrationManager::CalibrationManager(string configFileName){
 
           else if (!inputConfigFile.eof()) {
             AddFile(dataBuffer);
-            cout << "Adding file " << dataBuffer << " to Calibration" << endl;
+            std::cout << "Adding file " << dataBuffer << " to Calibration" << std::endl;
           }
         }
       }
     }
   }
-  cout << "/////////////////////////////////" << endl;
+  std::cout << "/////////////////////////////////" << std::endl;
 }
 
 //////////////////////////////////////////////////////////////////
@@ -95,8 +95,8 @@ CalibrationManager::~CalibrationManager()
 {}
 
 //////////////////////////////////////////////////////////////////
-bool CalibrationManager::AddParameter(string DetectorName , string ParameterName , string Token ){
-  string ParameterPath = DetectorName + "/" + ParameterName ;
+bool CalibrationManager::AddParameter(std::string DetectorName , std::string ParameterName , std::string Token ){
+  std::string ParameterPath = DetectorName + "/" + ParameterName ;
   fToken[Token] = ParameterPath ;
   return true;
 }
@@ -107,16 +107,16 @@ void CalibrationManager::ClearCalibration(){
 }
 
 /////////////////////////////////////////////////////////////////
-vector<double> CalibrationManager::GetCorrection(const string& ParameterPath) const {
-  vector<double> Coeff ;
-  map< string , vector<double> >::const_iterator it ;
+std::vector<double> CalibrationManager::GetCorrection(const std::string& ParameterPath) const {
+  std::vector<double> Coeff ;
+  std::map< std::string , std::vector<double> >::const_iterator it ;
   it = fCalibrationCoeff.find(ParameterPath)  ;
 
   if(it == fCalibrationCoeff.end() )
   {
-    /* cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << endl ;
-       cout << " ERROR: PARAMETER " << ParameterPath << " IS NOT FOUND IN THE CALIBRATION DATA BASE  " << endl ;
-       cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << endl ;*/
+    /* std::cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << std::endl ;
+       std::cout << " ERROR: PARAMETER " << ParameterPath << " IS NOT FOUND IN THE CALIBRATION DATA BASE  " << std::endl ;
+       std::cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << std::endl ;*/
 
     return Coeff ;
   }
@@ -129,9 +129,9 @@ vector<double> CalibrationManager::GetCorrection(const string& ParameterPath) co
 
 //////////////////////////////////////////////////////////////////
 void CalibrationManager::LoadParameterFromFile(){
-  ifstream CalibFile    ;
-  string    DataBuffer   ;
-  string   LineBuffer ;
+  std::ifstream  CalibFile;
+  std::string    DataBuffer;
+  std::string    LineBuffer;
 
   // Get pointer to the TAsciifile CalibrationFile in RootOuput
   TAsciiFile* AcsiiCalibration = RootOutput::getInstance()->GetAsciiFileCalibration();
@@ -140,17 +140,17 @@ void CalibrationManager::LoadParameterFromFile(){
   unsigned int sizeF = fFileList.size();
   for(unsigned int i = 0 ; i < sizeF ; i++){
     CalibFile.open( fFileList[i].c_str() );
-    map<string,string>::iterator it ;
+    std::map<std::string,std::string>::iterator it ;
 
     if(!CalibFile){
-      ostringstream message;
+      std::ostringstream message;
       message << "file " << fFileList[i] << " is missing " ;
       NPL::SendWarning ("NPL::CalibrationManager" , message.str());
     }
 
     else {
       // Append the Calibration File to the RootOuput for Back-up
-      string comment = "%%% From File " + fFileList[i] + "%%%";
+      std::string comment = "%%% From File " + fFileList[i] + "%%%";
       AcsiiCalibration->AppendLine(comment.c_str());
       AcsiiCalibration->Append(fFileList[i].c_str());
 
@@ -158,8 +158,8 @@ void CalibrationManager::LoadParameterFromFile(){
         // Read the file Line by line
         getline(CalibFile, LineBuffer);
 
-        // Create a istringstream to manipulate the line easely
-        istringstream theLine (LineBuffer,istringstream::in);
+        // Create a istd::stringstream to manipulate the line easely
+        std::istringstream theLine (LineBuffer,std::istringstream::in);
         theLine >> DataBuffer ;
 
         // Comment support, comment symbole is %
@@ -170,16 +170,16 @@ void CalibrationManager::LoadParameterFromFile(){
         it=fToken.find(DataBuffer);
         //   if the word is find, values are read
         if( it!=fToken.end() ){ 
-          vector<double> Coeff ;
+          std::vector<double> Coeff ;
           while( theLine >> DataBuffer ){
             Coeff.push_back( atof(DataBuffer.c_str()) ) ;
           }
 
           //   Check this parameter is not already define
           if( fCalibrationCoeff.find(it->second) != fCalibrationCoeff.end() ) 
-            cout << "WARNING: Parameter " << it->second << " Already found. It will be overwritten. " << endl;
+            std::cout << "WARNING: Parameter " << it->second << " Already found. It will be overwritten. " << std::endl;
 
-          //   Add the list of Coeff to the Coeff map using Parameter Path as index
+          //   Add the list of Coeff to the Coeff std::map using Parameter Path as index
           fCalibrationCoeff[ it->second ] = Coeff ;
         }
       }
@@ -189,9 +189,9 @@ void CalibrationManager::LoadParameterFromFile(){
 }
 
 //////////////////////////////////////////////////////////////////
-double CalibrationManager::ApplyCalibration(const string& ParameterPath , const double& RawValue) const {
-  map< string , vector<double> >::const_iterator it ;
-  static map< string , vector<double> >::const_iterator ite = fCalibrationCoeff.end();
+double CalibrationManager::ApplyCalibration(const std::string& ParameterPath , const double& RawValue) const {
+  std::map< std::string , std::vector<double> >::const_iterator it ;
+  static std::map< std::string , std::vector<double> >::const_iterator ite = fCalibrationCoeff.end();
 
   //   Find the good parameter in the Map
   // Using Find method of stl is the fastest way
@@ -199,11 +199,11 @@ double CalibrationManager::ApplyCalibration(const string& ParameterPath , const
   // If the find methods return the end iterator it's mean the parameter was not found
   if(it == ite ){
 //by Shuya 170222
-//cout << ParameterPath << "!" << endl;
+//std::cout << ParameterPath << "!" << std::endl;
     return RawValue ;
   }
 
-  // The vector size give the degree of calibration
+  // The std::vector size give the degree of calibration
   // We just apply the coeff it->second and returned the calibrated value
   double CalibratedValue = 0 ;
   unsigned int mysize = it->second.size(); 
@@ -215,9 +215,9 @@ double CalibrationManager::ApplyCalibration(const string& ParameterPath , const
 
 }
 //////////////////////////////////////////////////////////////////
-double CalibrationManager::ApplyCalibrationDebug(const string& ParameterPath , const double& RawValue) const{
-  map< string , vector<double> >::const_iterator it ;
-  static map< string , vector<double> >::const_iterator ite = fCalibrationCoeff.end();
+double CalibrationManager::ApplyCalibrationDebug(const std::string& ParameterPath , const double& RawValue) const{
+  std::map< std::string , std::vector<double> >::const_iterator it ;
+  static std::map< std::string , std::vector<double> >::const_iterator ite = fCalibrationCoeff.end();
 
   //   Find the good parameter in the Map
   // Using Find method of stl is the fastest way
@@ -225,30 +225,30 @@ double CalibrationManager::ApplyCalibrationDebug(const string& ParameterPath , c
 
   // If the find methods return the end iterator it's mean the parameter was not found
   if(it == ite ){
-           cout << " PARAMETER " << ParameterPath << " IS NOT FOUND IN THE CALIBRATION DATA BASE  " << endl ;
+           std::cout << " PARAMETER " << ParameterPath << " IS NOT FOUND IN THE CALIBRATION DATA BASE  " << std::endl ;
     return RawValue ;
   }
 
   // Else we take the second part of the element (first is index, ie: parameter path)
-  // Second is the vector of Coeff
-  cout << it->first << " :  raw = " << RawValue << " coeff = "  ;
-  vector<double> Coeff = it->second  ;
+  // Second is the std::vector of Coeff
+  std::cout << it->first << " :  raw = " << RawValue << " coeff = "  ;
+  std::vector<double> Coeff = it->second  ;
 
-  // The vector size give the degree of calibration
+  // The std::vector size give the degree of calibration
   // We just apply the coeff and returned the calibrated value
 
   double CalibratedValue = 0 ;
   for(unsigned int i = 0 ; i < Coeff.size() ; i++){
-    cout << Coeff[i] << " " ;
+    std::cout << Coeff[i] << " " ;
     CalibratedValue += Coeff[i]*pow(RawValue, (double)i);
   }
-  cout << "results = " << CalibratedValue << endl ;
+  std::cout << "results = " << CalibratedValue << std::endl ;
   return CalibratedValue ;
 }
 ////////////////////////////////////////////////////////////////////////////////
-double CalibrationManager::ApplyResistivePositionCalibration(const string& ParameterPath , const double& DeltaRawValue) const{
-  map< string , vector<double> >::const_iterator it ;
-  static map< string , vector<double> >::const_iterator ite = fCalibrationCoeff.end();
+double CalibrationManager::ApplyResistivePositionCalibration(const std::string& ParameterPath , const double& DeltaRawValue) const{
+  std::map< std::string , std::vector<double> >::const_iterator it ;
+  static std::map< std::string , std::vector<double> >::const_iterator ite = fCalibrationCoeff.end();
 
   //   Find the good parameter in the Map
   // Using Find method of stl is the fastest way
@@ -259,7 +259,7 @@ double CalibrationManager::ApplyResistivePositionCalibration(const string& Param
     return DeltaRawValue ;
   }
 
-  vector<double> Coeff = it->second  ;
+  std::vector<double> Coeff = it->second  ;
 
   // Check that the number of coeff is ok
   if(it->second.size()!=2) 
@@ -271,9 +271,9 @@ double CalibrationManager::ApplyResistivePositionCalibration(const string& Param
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-double CalibrationManager::ApplyResistivePositionCalibrationDebug(const string& ParameterPath , const double& DeltaRawValue) const {
-  map< string , vector<double> >::const_iterator it ;
-  static map< string , vector<double> >::const_iterator ite = fCalibrationCoeff.end();
+double CalibrationManager::ApplyResistivePositionCalibrationDebug(const std::string& ParameterPath , const double& DeltaRawValue) const {
+  std::map< std::string , std::vector<double> >::const_iterator it ;
+  static std::map< std::string , std::vector<double> >::const_iterator ite = fCalibrationCoeff.end();
 
   //   Find the good parameter in the Map
   // Using Find method of stl is the fastest way
@@ -281,30 +281,30 @@ double CalibrationManager::ApplyResistivePositionCalibrationDebug(const string&
 	
   // If the find methods return the end iterator it's mean the parameter was not found
   if(it == ite ){
-      cout << " PARAMETER " << ParameterPath << " IS NOT FOUND IN THE CALIBRATION DATA BASE  " << endl ;
+      std::cout << " PARAMETER " << ParameterPath << " IS NOT FOUND IN THE CALIBRATION DATA BASE  " << std::endl ;
     return DeltaRawValue ;
   }
 
-	vector<double> Coeff = it->second  ;
+	std::vector<double> Coeff = it->second  ;
 	
   // Check that the number of coeff is ok
   if(Coeff.size()!=2){
-      cout << " NUMBER OF COEFF " << Coeff.size() << " IS DIFFERENT THAN TWO " << endl ;
+      std::cout << " NUMBER OF COEFF " << Coeff.size() << " IS DIFFERENT THAN TWO " << std::endl ;
     return DeltaRawValue ; 
   }
 
   double CalibratedValue = (DeltaRawValue-Coeff[0])/(Coeff[1]);
-  cout << it->first << " :  raw = " << DeltaRawValue << " coeff = "  ;
-  cout << Coeff[0] << " " << Coeff[1] << endl ;
-  cout << "results = " << CalibratedValue << endl ;
+  std::cout << it->first << " :  raw = " << DeltaRawValue << " coeff = "  ;
+  std::cout << Coeff[0] << " " << Coeff[1] << std::endl ;
+  std::cout << "results = " << CalibratedValue << std::endl ;
 
   return CalibratedValue ;
 }
 
 //////////////////////////////////////////////////////////////////
-bool CalibrationManager::ApplyThreshold(const string& ParameterPath, const double& RawValue) const{
-  map< string , vector<double> >::const_iterator it ;
-  static map< string , vector<double> >::const_iterator ite = fCalibrationCoeff.end();
+bool CalibrationManager::ApplyThreshold(const std::string& ParameterPath, const double& RawValue) const{
+  std::map< std::string , std::vector<double> >::const_iterator it ;
+  static std::map< std::string , std::vector<double> >::const_iterator ite = fCalibrationCoeff.end();
   
   //   Find the good parameter in the Map
   // Using Find method of stl is the fastest way
@@ -316,10 +316,10 @@ bool CalibrationManager::ApplyThreshold(const string& ParameterPath, const doubl
   }
 
   // Else we take the second part of the element (first is index, ie: parameter path)
-  // Second is the vector of Coeff
-  vector<double> Coeff = it->second  ;
+  // Second is the std::vector of Coeff
+  std::vector<double> Coeff = it->second  ;
 
-  // The vector size give the degree of calibration
+  // The std::vector size give the degree of calibration
   // We just apply the coeff and returned the calibrated value
 
   double ThresholdValue = 0 ;
@@ -339,14 +339,14 @@ bool CalibrationManager::ApplyThreshold(const string& ParameterPath, const doubl
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////
-double CalibrationManager::GetPedestal(const string& ParameterPath) const{
+double CalibrationManager::GetPedestal(const std::string& ParameterPath) const{
   return GetValue(ParameterPath,0);
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////
-double CalibrationManager::GetValue(const string& ParameterPath,const unsigned int& order) const{
-  map< string , vector<double> >::const_iterator it ;
-  static map< string , vector<double> >::const_iterator ite = fCalibrationCoeff.end();
+double CalibrationManager::GetValue(const std::string& ParameterPath,const unsigned int& order) const{
+  std::map< std::string , std::vector<double> >::const_iterator it ;
+  static std::map< std::string , std::vector<double> >::const_iterator ite = fCalibrationCoeff.end();
 
   //   Find the good parameter in the Map
   // Using Find method of stl is the fastest way
@@ -357,7 +357,7 @@ double CalibrationManager::GetValue(const string& ParameterPath,const unsigned i
     return 0;
   }
 
-  // The vector size give the degree of calibration
+  // The std::vector size give the degree of calibration
   double Value = 0 ;
   if(it->second.size()>order){
      Value = it->second[order];
diff --git a/NPLib/Core/NPCalibrationManager.h b/NPLib/Core/NPCalibrationManager.h
index e99e008fa..2bf88eaad 100644
--- a/NPLib/Core/NPCalibrationManager.h
+++ b/NPLib/Core/NPCalibrationManager.h
@@ -28,44 +28,43 @@
 #include<vector>
 #include<map>
 
-using namespace std ;
 
 class CalibrationManager{
 
   protected:   //   Constructor and Destructor are protected because the class is a singleton
-    CalibrationManager(string configFileName);
+    CalibrationManager(std::string configFileName);
     ~CalibrationManager();
 
   public: // Accessor
     //   return a pointer to the calibration manager instance.
     //   if the instance does not exist it is created.
-    static CalibrationManager* getInstance(const string& configFileName="XXX");
+    static CalibrationManager* getInstance(const std::string& configFileName="XXX");
 
   private: // the instance
     //   Hold a pointer on itself
     static CalibrationManager* instance ;
 
   public:   //   File Management
-    inline void AddFile(string Path) { fFileList.push_back(Path) ;} ;
+    inline void AddFile(std::string Path) { fFileList.push_back(Path) ;} ;
 
 
   public:   // Calibration Parameter Related
 
     // call like : myCalibrationManager->AddParameter( "MUST2" ,"Telescope5_Si_X38_E", "T5_Si_X38_E" )
     // return false if the token is not found in the file list
-    bool AddParameter(string DetectorName , string ParameterName , string Token)    ;      
+    bool AddParameter(std::string DetectorName , std::string ParameterName , std::string Token)    ;      
 
     // call like : myCalibrationManager->ApplyCalibration( "MUST2/Telescope5_Si_X38_E" , RawEnergy )
     // return the Calibrated value
-    double ApplyCalibration (const string& ParameterPath , const double& RawValue) const ;
-    double ApplyResistivePositionCalibration (const string& ParameterPath , const double& RawValue) const ;
+    double ApplyCalibration (const std::string& ParameterPath , const double& RawValue) const ;
+    double ApplyResistivePositionCalibration (const std::string& ParameterPath , const double& RawValue) const ;
     // Same but with debug information outputs
-    double ApplyCalibrationDebug (const string& ParameterPath , const double& RawValue) const ;
-    double ApplyResistivePositionCalibrationDebug (const string& ParameterPath , const double& RawValue) const ;
+    double ApplyCalibrationDebug (const std::string& ParameterPath , const double& RawValue) const ;
+    double ApplyResistivePositionCalibrationDebug (const std::string& ParameterPath , const double& RawValue) const ;
 
-    bool ApplyThreshold (const string& ParameterPath, const double& RawValue) const ;
-    double GetPedestal  (const string& ParameterPath) const ;
-    double GetValue     (const string& ParameterPath,const unsigned int& order) const ;
+    bool ApplyThreshold (const std::string& ParameterPath, const double& RawValue) const ;
+    double GetPedestal  (const std::string& ParameterPath) const ;
+    double GetValue     (const std::string& ParameterPath,const unsigned int& order) const ;
 
   public:   //   To be called after initialisation
     //   Loop over the file list and catch the file used for calibration
@@ -74,18 +73,18 @@ class CalibrationManager{
   public: //Clear calibration if we have some calibration files to read 
     void ClearCalibration();
 
-  public: //Get correction coefficient vector
-    vector<double> GetCorrection (const string& ParameterPath) const ;
+  public: //Get correction coefficient std::vector
+    std::vector<double> GetCorrection (const std::string& ParameterPath) const ;
 
   private:
-    //   This map hold a vector of the calibration coefficient. Index is the Parameter path, like "MUST2/Telescope5_Si_X38_E"
+    //   This std::map hold a std::vector of the calibration coefficient. Index is the Parameter path, like "MUST2/Telescope5_Si_X38_E"
 
-    map< string , vector<double> >   fCalibrationCoeff ;  
+    std::map< std::string , std::vector<double> >   fCalibrationCoeff ;  
     //   Hold the path of all the registered file of coeff
-    vector<string>   fFileList   ;
+    std::vector<std::string>   fFileList   ;
 
     //   Hold The list of Token. Index is the Token, value the parameter path.
-    map< string , string >   fToken      ;
+    std::map< std::string , std::string >   fToken      ;
 
 };
 
diff --git a/NPLib/Core/NPDetectorFactory.cxx b/NPLib/Core/NPDetectorFactory.cxx
index 5abf466a0..5c42b5f78 100644
--- a/NPLib/Core/NPDetectorFactory.cxx
+++ b/NPLib/Core/NPDetectorFactory.cxx
@@ -57,19 +57,19 @@ void NPL::DetectorFactory::ReadClassList(std::string FileList){
     std::ifstream InFile(FileList.c_str());
 
     if(!InFile.is_open()){
-      string error = "Detector Class List file " +FileList +" Not found";
+      std::string error = "Detector Class List file " +FileList +" Not found";
       NPL::SendErrorAndExit("NPL::NPL::DetectorFactory",error);
       exit(1);
     }
 
-    string Token, LibName;
+    std::string Token, LibName;
     while(InFile >> Token >> LibName)
       m_TokenLib[Token] = LibName; 
 }
 ////////////////////////////////////////////////////////////////////////////////
 void NPL::DetectorFactory::CreateClassList(std::string FileList){
-  ofstream outFile(FileList.c_str());
-  std::map<string,string>::iterator it;
+  std::ofstream outFile(FileList.c_str());
+  std::map<std::string,std::string>::iterator it;
 
   for(it = m_TokenLib.begin();it!=m_TokenLib.end();it++){
     outFile << it->first << " " << it->second << std::endl;
diff --git a/NPLib/Core/NPDetectorManager.cxx b/NPLib/Core/NPDetectorManager.cxx
index e07f8b542..9ba19f299 100644
--- a/NPLib/Core/NPDetectorManager.cxx
+++ b/NPLib/Core/NPDetectorManager.cxx
@@ -75,34 +75,34 @@ NPL::DetectorManager::~DetectorManager(){
 
 ///////////////////////////////////////////////////////////////////////////////
 //   Read stream at ConfigFile and pick-up Token declaration of Detector
-void NPL::DetectorManager::ReadConfigurationFile(string Path)   {
-  cout << "\033[1;36m" ;
+void NPL::DetectorManager::ReadConfigurationFile(std::string Path)   {
+  std::cout << "\033[1;36m" ;
 
   // Instantiate the Calibration Manager
   // All The detector will then add to it their parameter (see AddDetector)
   CalibrationManager::getInstance(NPOptionManager::getInstance()->GetCalibrationFile());
 
   // Access the DetectorFactory and ask it to load the Class List
-  string classlist = getenv("NPTOOL");
+  std::string classlist = getenv("NPTOOL");
   classlist += "/NPLib/ClassList.txt";
   NPL::DetectorFactory* theFactory = NPL::DetectorFactory::getInstance();
   theFactory->ReadClassList(classlist);
 
-  set<string> check;
+  std::set<std::string> check;
   NPL::InputParser parser(Path);
 
   ////////////////////////////////////////////
   //////////// Search for Target /////////////
   ////////////////////////////////////////////
-  vector<NPL::InputBlock*>  starget = parser.GetAllBlocksWithToken("Target");
-  vector<NPL::InputBlock*>  ctarget = parser.GetAllBlocksWithToken("CryoTarget");
+  std::vector<NPL::InputBlock*>  starget = parser.GetAllBlocksWithToken("Target");
+  std::vector<NPL::InputBlock*>  ctarget = parser.GetAllBlocksWithToken("CryoTarget");
 
   if(starget.size()==1){
     if(NPOptionManager::getInstance()->GetVerboseLevel()){
-    cout << "////       TARGET      ////" << endl;
-    cout << "//// Solid Target found " << endl;
+    std::cout << "////       TARGET      ////" << std::endl;
+    std::cout << "//// Solid Target found " << std::endl;
     }
-    vector<string> token = {"Thickness","Radius","Material","Angle","X","Y","Z"};
+    std::vector<std::string> token = {"Thickness","Radius","Material","Angle","X","Y","Z"};
     if(starget[0]->HasTokenList(token)){
       m_TargetThickness= starget[0]->GetDouble("Thickness","micrometer");
       m_TargetAngle=starget[0]->GetDouble("Angle","deg");
@@ -112,15 +112,15 @@ void NPL::DetectorManager::ReadConfigurationFile(string Path)   {
       m_TargetZ=starget[0]->GetDouble("Z","mm");
     }
     else{
-      cout << "ERROR: Target token list incomplete, check your input file" << endl;
+      std::cout << "ERROR: Target token list incomplete, check your input file" << std::endl;
       exit(1);
     }
   }
   else if(ctarget.size()==1){
     if(NPOptionManager::getInstance()->GetVerboseLevel())
-      cout << "//// Cryogenic Target found " << endl;
+      std::cout << "//// Cryogenic Target found " << std::endl;
     
-    vector<string> token = {"Thickness","Radius","Material","Density","WindowsThickness","WindowsMaterial","Angle","X","Y","Z"};
+    std::vector<std::string> token = {"Thickness","Radius","Material","Density","WindowsThickness","WindowsMaterial","Angle","X","Y","Z"};
     if(ctarget[0]->HasTokenList(token)){
       m_TargetThickness= ctarget[0]->GetDouble("Thickness","micrometer");
       m_TargetAngle=ctarget[0]->GetDouble("Angle","deg");
@@ -132,12 +132,12 @@ void NPL::DetectorManager::ReadConfigurationFile(string Path)   {
       m_TargetZ =ctarget[0]->GetDouble("Z","mm");
     }
     else{
-      cout << "ERROR: Target token list incomplete, check your input file" << endl;
+      std::cout << "ERROR: Target token list incomplete, check your input file" << std::endl;
       exit(1);
     }
   }
   else{
-    cout << "ERROR: One and only one target shall be declared in your detector file" << endl;
+    std::cout << "ERROR: One and only one target shall be declared in your detector file" << std::endl;
   }
 
   ////////////////////////////////////////////
@@ -150,12 +150,12 @@ void NPL::DetectorManager::ReadConfigurationFile(string Path)   {
   VDetector* detector = theFactory->Construct(token[i]);
   if(detector!=NULL && check.find(token[i])==check.end()){
     if(NPOptionManager::getInstance()->GetVerboseLevel()){
-      cout << "/////////////////////////////////////////" << endl;
-      cout << "//// Adding Detector " << token[i] << endl; 
+      std::cout << "/////////////////////////////////////////" << std::endl;
+      std::cout << "//// Adding Detector " << token[i] << std::endl; 
     }
     detector->ReadConfiguration(parser);
     if(NPOptionManager::getInstance()->GetVerboseLevel())
-      cout << "/////////////////////////////////////////" << endl;
+      std::cout << "/////////////////////////////////////////" << std::endl;
     
     // Add array to the VDetector Vector
     AddDetector(token[i], detector);
@@ -165,7 +165,7 @@ void NPL::DetectorManager::ReadConfigurationFile(string Path)   {
     delete detector;
   }
   // Now That the detector lib are loaded, we can instantiate the root input
-  string runToReadfileName = NPOptionManager::getInstance()->GetRunToReadFile();
+  std::string runToReadfileName = NPOptionManager::getInstance()->GetRunToReadFile();
   RootInput::getInstance(runToReadfileName);
 
   // Now that the detector are all added, they can initialise their Branch to the Root I/O
@@ -191,29 +191,29 @@ void NPL::DetectorManager::ReadConfigurationFile(string Path)   {
 void NPL::DetectorManager::BuildPhysicalEvent(){
 #if __cplusplus > 199711L
   // add new job
-//cout << "TEST0a" << endl;
-  map<string,VDetector*>::iterator it;
+//std::cout << "TEST0a" << std::endl;
+  std::map<std::string,VDetector*>::iterator it;
   unsigned int i = 0;
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it) {
-//cout << "TEST0" << endl;
+//std::cout << "TEST0" << std::endl;
     m_Ready[i++]=true;
   }
-//cout << "TEST1" << endl;
+//std::cout << "TEST1" << std::endl;
   { // aquire the sub thread lock
     std::unique_lock<std::mutex> lk(m_ThreadMtx);
   }
   m_CV.notify_all();
 
-//cout << "TEST2" << endl;
+//std::cout << "TEST2" << std::endl;
   while(!IsDone()){
-//cout << "TEST2a" << endl;
-     //this_thread::yield();
+//std::cout << "TEST2a" << std::endl;
+     //std::this_thread::yield();
   }
-//cout << "TEST2b" << endl;
+//std::cout << "TEST2b" << std::endl;
 
 #else 
-//cout << "TEST3" << endl;
-  map<string,VDetector*>::iterator it;
+//std::cout << "TEST3" << std::endl;
+  std::map<std::string,VDetector*>::iterator it;
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it) {
     (it->second->*m_ClearEventPhysicsPtr)();
     (it->second->*m_BuildPhysicalPtr)();
@@ -229,7 +229,7 @@ void NPL::DetectorManager::BuildPhysicalEvent(){
 ///////////////////////////////////////////////////////////////////////////////
 void NPL::DetectorManager::BuildSimplePhysicalEvent(){
   ClearEventPhysics();
-  map<string,VDetector*>::iterator it;
+  std::map<std::string,VDetector*>::iterator it;
 
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it) {
     it->second->BuildSimplePhysicalEvent();
@@ -247,7 +247,7 @@ void NPL::DetectorManager::InitializeRootInput(){
   if( NPOptionManager::getInstance()->GetDisableAllBranchOption() )
     RootInput::getInstance()->GetChain()->SetBranchStatus ( "*" , false ) ;
 
-  map<string,VDetector*>::iterator it;
+  std::map<std::string,VDetector*>::iterator it;
 
   if(NPOptionManager::getInstance()->GetInputPhysicalTreeOption())
     for (it = m_Detector.begin(); it != m_Detector.end(); ++it) 
@@ -260,7 +260,7 @@ void NPL::DetectorManager::InitializeRootInput(){
 
 ///////////////////////////////////////////////////////////////////////////////
 void NPL::DetectorManager::InitializeRootOutput(){
-  map<string,VDetector*>::iterator it;
+  std::map<std::string,VDetector*>::iterator it;
 
   if(!NPOptionManager::getInstance()->GetInputPhysicalTreeOption())
     for (it = m_Detector.begin(); it != m_Detector.end(); ++it) 
@@ -268,26 +268,26 @@ void NPL::DetectorManager::InitializeRootOutput(){
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-void NPL::DetectorManager::AddDetector(string DetectorName , VDetector* newDetector){
+void NPL::DetectorManager::AddDetector(std::string DetectorName , VDetector* newDetector){
   m_Detector[DetectorName] = newDetector;
   newDetector->AddParameterToCalibrationManager();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-NPL::VDetector* NPL::DetectorManager::GetDetector(string name){
-  map<string,VDetector*>::iterator it;
+NPL::VDetector* NPL::DetectorManager::GetDetector(std::string name){
+  std::map<std::string,VDetector*>::iterator it;
   it = m_Detector.find(name);
   if ( it!=m_Detector.end() ) return it->second;
   else{
-    cout << endl;
-    cout << "**********************************       Error       **********************************" << endl;
-    cout << " No Detector " << name << " found in the Detector Manager" << endl;
-		cout << " Available Detectors: " << endl;
-		for(map<string,VDetector*>::iterator i = m_Detector.begin(); i != m_Detector.end(); ++i) {
-			cout << "\t" << i->first << endl;
+    std::cout << std::endl;
+    std::cout << "**********************************       Error       **********************************" << std::endl;
+    std::cout << " No Detector " << name << " found in the Detector Manager" << std::endl;
+		std::cout << " Available Detectors: " << std::endl;
+		for(std::map<std::string,VDetector*>::iterator i = m_Detector.begin(); i != m_Detector.end(); ++i) {
+			std::cout << "\t" << i->first << std::endl;
 		}
-    cout << "***************************************************************************************" << endl;
-    cout << endl;
+    std::cout << "***************************************************************************************" << std::endl;
+    std::cout << std::endl;
     exit(1);
   }
 
@@ -295,14 +295,14 @@ NPL::VDetector* NPL::DetectorManager::GetDetector(string name){
 
 ///////////////////////////////////////////////////////////////////////////////
 void NPL::DetectorManager::ClearEventPhysics(){
-  map<string,VDetector*>::iterator it;
+  std::map<std::string,VDetector*>::iterator it;
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it) 
     (it->second->*m_ClearEventPhysicsPtr)();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 void NPL::DetectorManager::ClearEventData(){
-  map<string,VDetector*>::iterator it;
+  std::map<std::string,VDetector*>::iterator it;
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it)
     (it->second->*m_ClearEventDataPtr)();
 }
@@ -314,7 +314,7 @@ void NPL::DetectorManager::InitSpectra(){
      batch = gROOT->IsBatch();
      gROOT->ProcessLine("gROOT->SetBatch()");
   }
-  map<string,VDetector*>::iterator it;
+  std::map<std::string,VDetector*>::iterator it;
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it) 
     it->second->InitSpectra();
 
@@ -324,17 +324,17 @@ void NPL::DetectorManager::InitSpectra(){
 
 ///////////////////////////////////////////////////////////////////////////////
 void NPL::DetectorManager::WriteSpectra(){
-  std::cout << endl << "\r \033[1;36m *** Writing Spectra: this may take a while ***\033[0m"<<flush;
-  map<string,VDetector*>::iterator it;
+  std::cout << std::endl << "\r \033[1;36m *** Writing Spectra: this may take a while ***\033[0m"<<std::flush;
+  std::map<std::string,VDetector*>::iterator it;
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it) 
     it->second->WriteSpectra();
-  std::cout << "\r                                                  " << flush; 
+  std::cout << "\r                                                  " << std::flush; 
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-vector< map< string, TH1* > > NPL::DetectorManager::GetSpectra(){
-  vector< map< string, TH1* > > myVector;
-  map<string,VDetector*>::iterator it;
+std::vector< std::map< std::string, TH1* > > NPL::DetectorManager::GetSpectra(){
+  std::vector< std::map< std::string, TH1* > > myVector;
+  std::map<std::string,VDetector*>::iterator it;
   // loop on detectors
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it) {
     myVector.push_back(it->second->GetSpectra());
@@ -344,9 +344,9 @@ vector< map< string, TH1* > > NPL::DetectorManager::GetSpectra(){
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-vector<string> NPL::DetectorManager::GetDetectorList(){
-  map<string,VDetector*>::iterator it;
-  vector<string> DetectorList;
+std::vector<std::string> NPL::DetectorManager::GetDetectorList(){
+  std::map<std::string,VDetector*>::iterator it;
+  std::vector<std::string> DetectorList;
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { 
     DetectorList.push_back(it->first);
   }
@@ -359,11 +359,11 @@ void NPL::DetectorManager::InitThreadPool(){
   StopThread();
   m_ThreadPool.clear();
   m_Ready.clear();
-  map<string,VDetector*>::iterator it;
+  std::map<std::string,VDetector*>::iterator it;
 
   unsigned int i = 0;
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { 
-    m_ThreadPool.push_back( thread( &NPL::DetectorManager::StartThread,this,it->second,i++) );
+    m_ThreadPool.push_back( std::thread( &NPL::DetectorManager::StartThread,this,it->second,i++) );
     m_Ready.push_back(false);
   }
 
@@ -372,16 +372,16 @@ void NPL::DetectorManager::InitThreadPool(){
     th.detach();
   }
 
-  cout << "\033[1;33m**** Detector Manager : Started " << i << " Threads ****\033[0m" << endl ;
+  std::cout << "\033[1;33m**** Detector Manager : Started " << i << " Threads ****\033[0m" << std::endl ;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void NPL::DetectorManager::StartThread(NPL::VDetector* det,unsigned int id){ 
-  this_thread::sleep_for(chrono::milliseconds(1));
-  vector<bool>::iterator it = m_Ready.begin()+id;
+  std::this_thread::sleep_for(std::chrono::milliseconds(1));
+  std::vector<bool>::iterator it = m_Ready.begin()+id;
   while(true){
     { // Aquire the lock
-////cout << "WWWW" << endl;
+////std::cout << "WWWW" << std::endl;
       std::unique_lock<std::mutex> lk(m_ThreadMtx);    
       // wait for work to be given
       while(!m_Ready[id]){
@@ -410,20 +410,20 @@ void NPL::DetectorManager::StartThread(NPL::VDetector* det,unsigned int id){
 ////////////////////////////////////////////////////////////////////////////////
 void NPL::DetectorManager::StopThread(){
   // make sure the last thread are schedule before stopping;
-  this_thread::yield();
+  std::this_thread::yield();
   m_stop=true;
   m_CV.notify_all();
 }
 ////////////////////////////////////////////////////////////////////////////////
 bool NPL::DetectorManager::IsDone(){
 int ijk=0;
-//cout << m_Ready.size() << " !" << endl;
-  for(vector<bool>::iterator it =  m_Ready.begin() ; it!=m_Ready.end() ; it++){
+//std::cout << m_Ready.size() << " !" << std::endl;
+  for(std::vector<bool>::iterator it =  m_Ready.begin() ; it!=m_Ready.end() ; it++){
     if((*it))
 {
 ijk++;
-//cout << *it << endl;
-//cout << ijk << endl;
+//std::cout << *it << std::endl;
+//std::cout << ijk << std::endl;
       return false;
 }
   }
@@ -434,9 +434,9 @@ ijk++;
 void NPL::DetectorManager::SetSpectraServer(){
   m_SpectraServer = NPL::SpectraServer::getInstance();
 
-  map<string,VDetector*>::iterator it;
+  std::map<std::string,VDetector*>::iterator it;
   for (it = m_Detector.begin(); it != m_Detector.end(); ++it){ 
-    vector<TCanvas*> canvas = it->second->GetCanvas();
+    std::vector<TCanvas*> canvas = it->second->GetCanvas();
     size_t mysize = canvas.size();
     for (size_t i = 0 ; i < mysize ; i++){} 
       //m_SpectraServer->AddCanvas(canvas[i]);
@@ -452,7 +452,7 @@ void NPL::DetectorManager::StopSpectraServer(){
   if(m_SpectraServer)
     m_SpectraServer->Destroy();
   else
-    cout <<"WARNING: requesting to stop spectra server, which is not started" << endl; 
+    std::cout <<"WARNING: requesting to stop spectra server, which is not started" << std::endl; 
   
 }
 
@@ -461,7 +461,7 @@ void NPL::DetectorManager::CheckSpectraServer(){
   if(m_SpectraServer)
     m_SpectraServer->CheckRequest();
   else
-    cout <<"WARNING: requesting to check spectra server, which is not started" << endl; 
+    std::cout <<"WARNING: requesting to check spectra server, which is not started" << std::endl; 
 
 }
 
diff --git a/NPLib/Core/NPDetectorManager.h b/NPLib/Core/NPDetectorManager.h
index ae7485e0c..49d35eec7 100644
--- a/NPLib/Core/NPDetectorManager.h
+++ b/NPLib/Core/NPDetectorManager.h
@@ -29,6 +29,7 @@
 //   STL
 #include <string>
 #include <map>
+#include <vector>
  
 #if __cplusplus > 199711L 
 #include <thread>
@@ -36,10 +37,9 @@
 #include <condition_variable>
 #endif
 
-using namespace std ;
 
 typedef void(NPL::VDetector::*VDetector_FuncPtr)(void);
-// This class manage a map of virtual detector
+// This class manage a std::map of virtual detector
 namespace NPL{
   class DetectorManager{
     public:
@@ -47,19 +47,19 @@ namespace NPL{
       ~DetectorManager();
 
     public:
-      void        ReadConfigurationFile(string Path);
+      void        ReadConfigurationFile(std::string Path);
       void        BuildPhysicalEvent();
       void        BuildSimplePhysicalEvent();
       void        InitializeRootInput();
       void        InitializeRootOutput();
-      void        AddDetector(string,VDetector*);
-      VDetector*  GetDetector(string);
+      void        AddDetector(std::string,VDetector*);
+      VDetector*  GetDetector(std::string);
       void        ClearEventPhysics();
       void        ClearEventData();
       void        InitSpectra();
       void        WriteSpectra();
-      vector< map< string, TH1* > > GetSpectra();  
-      vector<string> GetDetectorList();
+      std::vector< std::map< std::string, TH1* > > GetSpectra();  
+      std::vector<std::string> GetDetectorList();
 
     public: // for online spectra server
       void SetSpectraServer();
@@ -69,9 +69,9 @@ namespace NPL{
       NPL::SpectraServer* m_SpectraServer;
 
     private:   
-      // The map containning all detectors
+      // The std::map containning all detectors
       // Using a Map one can access to any detector using its name
-      map<string,VDetector*> m_Detector;
+      std::map<std::string,VDetector*> m_Detector;
 
     private: // Function pointer to accelerate the code execution
       VDetector_FuncPtr m_BuildPhysicalPtr;
@@ -82,8 +82,8 @@ namespace NPL{
       
     #if __cplusplus > 199711L 
     private: // Thread Pool defined if C++11 is available
-      vector<std::thread> m_ThreadPool;
-      vector<bool> m_Ready;
+      std::vector<std::thread> m_ThreadPool;
+      std::vector<bool> m_Ready;
       bool m_stop;
       std::mutex m_ThreadMtx;
       std::condition_variable m_CV;
@@ -100,14 +100,14 @@ namespace NPL{
       double m_TargetThickness;
       double m_TargetAngle;
       double m_TargetRadius;
-      string m_TargetMaterial;
+      std::string m_TargetMaterial;
       double m_TargetX;
       double m_TargetY;
       double m_TargetZ;
   
       // Additional info for cryogenic target
       double m_WindowsThickness;
-      string m_WindowsMaterial;
+      std::string m_WindowsMaterial;
   
 
       // Special treatment for the target for the moment
@@ -116,9 +116,9 @@ namespace NPL{
 
     public:
       double GetTargetThickness()       {return m_TargetThickness;}
-      string GetTargetMaterial()        {return m_TargetMaterial;}
+      std::string GetTargetMaterial()        {return m_TargetMaterial;}
       double GetWindowsThickness(){return m_WindowsThickness;}
-      string GetWindowsMaterial() {return m_WindowsMaterial;}
+      std::string GetWindowsMaterial() {return m_WindowsMaterial;}
       double GetTargetRadius()          {return m_TargetRadius;}
       double GetTargetAngle()           {return m_TargetAngle;}
       double GetTargetX()               {return m_TargetX;}
diff --git a/NPLib/Core/NPInputParser.cxx b/NPLib/Core/NPInputParser.cxx
index 577983975..79c72d331 100644
--- a/NPLib/Core/NPInputParser.cxx
+++ b/NPLib/Core/NPInputParser.cxx
@@ -143,7 +143,7 @@ double NPL::InputBlock::GetDouble(std::string Token,std::string default_unit){
   }
 
   if(verbose)
-    cout << " " << Token << " (" <<default_unit << "): " << val/ApplyUnit(1,default_unit) << endl; 
+    std::cout << " " << Token << " (" <<default_unit << "): " << val/ApplyUnit(1,default_unit) <<std::endl; 
 
   return val;        
 }
@@ -155,7 +155,7 @@ int NPL::InputBlock::GetInt(std::string Token){
   iss >> val ;
 
   if(verbose)
-    cout << " " << Token << ": " << val << endl;
+    std::cout << " " << Token << ": " << val <<std::endl;
 
 
   return val;        
@@ -164,7 +164,7 @@ int NPL::InputBlock::GetInt(std::string Token){
 std::string NPL::InputBlock::GetString(std::string Token){
   int verbose = NPOptionManager::getInstance()->GetVerboseLevel();
   if(verbose)
-    cout << " " << Token << ": " << GetValue(Token) << endl; 
+    std::cout << " " << Token << ": " << GetValue(Token) << std::endl; 
 
   return GetValue(Token);
 }
@@ -190,10 +190,10 @@ TVector3 NPL::InputBlock::GetTVector3(std::string Token,std::string  default_uni
   }
 
   if(verbose)
-    cout << " " << Token << " (" <<default_unit << "): (" 
+    std::cout << " " << Token << " (" <<default_unit << "): (" 
       << x/ApplyUnit(1,default_unit) << " ; " 
       << y/ApplyUnit(1,default_unit) << " ; " 
-      << z/ApplyUnit(1,default_unit) << ")" << endl; 
+      << z/ApplyUnit(1,default_unit) << ")" << std::endl; 
 
 
   return TVector3(x,y,z);        
@@ -211,10 +211,10 @@ std::vector<std::string> NPL::InputBlock::GetVectorString(std::string Token){
 
 
   if(verbose){
-    cout << " " << Token << ": ";
+    std::cout << " " << Token << ": ";
     for(unsigned int i = 0 ; i < val.size() ; i++)
-      cout << val[i] << " " ;
-    cout << endl; 
+      std::cout << val[i] << " " ;
+    std::cout << std::endl; 
   }
   return val;        
 }
@@ -247,10 +247,10 @@ std::vector<double> NPL::InputBlock::GetVectorDouble(std::string Token,std::stri
   }
 
   if(verbose){
-    cout << " " << Token << " (" << default_unit << "): ";
+    std::cout << " " << Token << " (" << default_unit << "): ";
     for(unsigned int i = 0 ; i < val.size() ; i++)
-      cout << val[i]/ApplyUnit(1,default_unit) << " " ;
-    cout << endl; 
+      std::cout << val[i]/ApplyUnit(1,default_unit) << " " ;
+    std::cout << std::endl; 
   }
 
   return val;        
@@ -267,10 +267,10 @@ std::vector<int> NPL::InputBlock::GetVectorInt(std::string Token){
     val.push_back(buffer);
 
   if(verbose){
-    cout << " " << Token << ": ";
+    std::cout << " " << Token << ": ";
     for(unsigned int i = 0 ; i < val.size() ; i++)
-      cout << val[i] << " " ;
-    cout << endl; 
+      std::cout << val[i] << " " ;
+    std::cout << std::endl; 
   }
 
 
@@ -351,7 +351,7 @@ void NPL::InputParser::TreatAliases(){
     int verbose = NPOptionManager::getInstance()->GetVerboseLevel();
 
     if(verbose)
-      std::cout << "Using Alias : @" << alias[i]->GetMainValue() << endl;
+      std::cout << "Using Alias : @" << alias[i]->GetMainValue() << std::endl;
     
     std::string name="@";
     name += alias[i]->GetMainValue(); 
@@ -398,7 +398,7 @@ void NPL::InputParser::TreatAliases(){
               m_Block[b] = newBlock;
             }
             else{
-              vector<NPL::InputBlock*>::iterator it = m_Block.begin();
+              std::vector<NPL::InputBlock*>::iterator it = m_Block.begin();
               m_Block.insert(it+b+a,newBlock);
             }
           }
diff --git a/NPLib/Core/NPOptionManager.cxx b/NPLib/Core/NPOptionManager.cxx
index eb522e198..7f299c009 100644
--- a/NPLib/Core/NPOptionManager.cxx
+++ b/NPLib/Core/NPOptionManager.cxx
@@ -37,7 +37,7 @@ NPOptionManager* NPOptionManager::getInstance(int argc, char** argv){
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-NPOptionManager* NPOptionManager::getInstance(string arg){
+NPOptionManager* NPOptionManager::getInstance(std::string arg){
 
   if (instance == 0) instance = new NPOptionManager(arg);
 
@@ -45,6 +45,10 @@ NPOptionManager* NPOptionManager::getInstance(string arg){
 
 }
 void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
+  if(argc==1)
+    DisplayHelp();
+
+
   // Default Setting
   fDefaultReactionFileName    = "defaultReaction.reaction";
   fDefaultDetectorFileName    = "defaultDetector.detector";
@@ -90,7 +94,7 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
 
 
   for (int i = 0; i < argc; i++) {
-    string argument = argv[i];
+    std::string argument = argv[i];
     if (argument == "-H" || argument == "-h" || argument == "--help") DisplayHelp();
 
     else if (argument == "--event-generator" && argc >= i + 1)    fReactionFileName    = argv[++i] ;
@@ -111,6 +115,8 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
 
     else if (argument == "-R" && argc >= i + 1)                   fRunToReadFileName   = argv[++i] ;
 
+    else if (argument == "-T" && argc >= i + 2)                   CreateRunToTreatFile(argv[++i],argv[++i]);
+
     else if (argument == "--cal" && argc >= i + 1)                fCalibrationFileName = argv[++i] ;
 
     else if (argument == "-C" && argc >= i + 1)                   fCalibrationFileName = argv[++i] ;
@@ -160,18 +166,34 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
   if(argc!=0)
     DisplayVersion();
 }
+////////////////////////////////////////////////////////////////////////////////
+void NPOptionManager::CreateRunToTreatFile(std::string file, std::string tree){
+  
+  std::ofstream run(".RunToTreat.txt");
+  if(!run.is_open())
+    exit(1);
+
+  run << "TTreeName" << std::endl;
+  run << " " << tree << std::endl;
+  run << "RootFileName" << std::endl;
+  run << " " << file << std::endl << std::endl;
+  run.close();
+  fRunToReadFileName=".RunToTreat.txt";
+  }
+
+
 ////////////////////////////////////////////////////////////////////////////////
 void NPOptionManager::DisplayVersion(){
   if(fVerboseLevel>0){
-    string line;
+    std::string line;
     line.resize(80,'*');
-    cout << line << endl;
-    cout << "***********************************  NPTool  ***********************************"<< endl;
-    cout << line << endl;
-    cout << " NPLib version: nplib-"<< NPL::version_major <<"-" << NPL::version_minor << "-" << NPL::version_deta <<endl;
-    cout << " Copyright: NPTool Collaboration "<<endl;
-    cout << " GitHub: http://github.com/adrien-matta/nptool"<<endl; ;
-    cout << line << endl;
+    std::cout << line << std::endl;
+    std::cout << "***********************************  NPTool  ***********************************"<< std::endl;
+    std::cout << line << std::endl;
+    std::cout << " NPLib version: nplib-"<< NPL::version_major <<"-" << NPL::version_minor << "-" << NPL::version_deta <<std::endl;
+    std::cout << " Copyright: NPTool Collaboration "<<std::endl;
+    std::cout << " GitHub: http://github.com/adrien-matta/nptool"<<std::endl; ;
+    std::cout << line << std::endl;
 
   }
 }
@@ -180,11 +202,11 @@ NPOptionManager::NPOptionManager(int argc, char** argv){
   ReadTheInputArgument(argc,argv);
 }
 ////////////////////////////////////////////////////////////////////////////////
-NPOptionManager::NPOptionManager(string arg){  
-  vector<char *> args;
-  istringstream iss(arg);
+NPOptionManager::NPOptionManager(std::string arg){  
+  std::vector<char *> args;
+  std::stringstream iss(arg);
 
-  string token;
+  std::string token;
   while(iss >> token) {
     char *arg = new char[token.size() + 1];
     copy(token.begin(), token.end(), arg);
@@ -211,11 +233,11 @@ void NPOptionManager::CheckEventGenerator(){
   bool checkFile = true;
 
   // NPTool path
-  string GlobalPath = getenv("NPTOOL");
-  string StandardPath = GlobalPath + "/Inputs/EventGenerator/" + fReactionFileName;
+  std::string GlobalPath = getenv("NPTOOL");
+  std::string StandardPath = GlobalPath + "/Inputs/EventGenerator/" + fReactionFileName;
 
   // ifstream to configfile
-  ifstream ConfigFile;
+  std::ifstream ConfigFile;
 
   // test if config file is in local path
   ConfigFile.open(fReactionFileName.c_str());
@@ -241,11 +263,11 @@ void NPOptionManager::CheckDetectorConfiguration(){
   bool checkFile = true;
 
   // NPTool path
-  string GlobalPath = getenv("NPTOOL");
-  string StandardPath = GlobalPath + "/Inputs/DetectorConfiguration/" + fDetectorFileName;
+  std::string GlobalPath = getenv("NPTOOL");
+  std::string StandardPath = GlobalPath + "/Inputs/DetectorConfiguration/" + fDetectorFileName;
 
   // ifstream to configfile
-  ifstream ConfigFile;
+  std::ifstream ConfigFile;
 
   // test if config file is in local path
   ConfigFile.open(fDetectorFileName.c_str());
@@ -273,7 +295,7 @@ void NPOptionManager::CheckG4Macro(){
     return ;
 
   // ifstream to configfile
-  ifstream MacroFile( fG4MacroPath );
+  std::ifstream MacroFile( fG4MacroPath );
 
   if (!MacroFile.is_open()) {
     SendErrorAndExit("G4MacroPath");
@@ -288,7 +310,7 @@ void NPOptionManager::CheckG4Macro(){
 bool NPOptionManager::IsDefault(const char* type) const{
   bool result = false;
 
-  string stype = type;
+  std::string stype = type;
   if (stype == "EventGenerator") {
     if (fReactionFileName == fDefaultReactionFileName) result = true;
   }
@@ -312,7 +334,7 @@ bool NPOptionManager::IsDefault(const char* type) const{
   }
  
   else {
-    cout << "NPOptionManager::IsDefault() unkwown keyword" << endl;
+    std::cout << "NPOptionManager::IsDefault() unkwown keyword" << std::endl;
   }
 
   return result;
@@ -322,21 +344,21 @@ bool NPOptionManager::IsDefault(const char* type) const{
 ////////////////////////////////////////////////////////////////////////////////
 // This method tests if the input files are the default ones
 void NPOptionManager::SendErrorAndExit(const char* type) const{
-  string stype = type;
+  std::string stype = type;
   if (stype == "EventGenerator") {
-    cout << endl;
-    cout << "**********************************       Error       **********************************" << endl;
-    cout << "* No event generator file found in $NPTool/Inputs/EventGenerator or local directories *" << endl;
-    cout << "***************************************************************************************" << endl;
-    cout << endl;
+    std::cout << std::endl;
+    std::cout << "**********************************       Error       **********************************" << std::endl;
+    std::cout << "* No event generator file found in $NPTool/Inputs/EventGenerator or local directories *" << std::endl;
+    std::cout << "***************************************************************************************" << std::endl;
+    std::cout << std::endl;
     exit(1);
   }
   else if (stype == "DetectorConfiguration") {
-    cout << endl;
-    cout << "***********************************       Error       ***********************************" << endl;
-    cout << "* No detector geometry file found in $NPTool/Inputs/DetectorConfiguration or local directories *" << endl;
-    cout << "*****************************************************************************************" << endl;
-    cout << endl;
+    std::cout << std::endl;
+    std::cout << "***********************************       Error       ***********************************" << std::endl;
+    std::cout << "* No detector geometry file found in $NPTool/Inputs/DetectorConfiguration or local directories *" << std::endl;
+    std::cout << "*****************************************************************************************" << std::endl;
+    std::cout << std::endl;
     exit(1);
   }
   else if (stype == "Calibration") {
@@ -344,16 +366,16 @@ void NPOptionManager::SendErrorAndExit(const char* type) const{
   else if (stype == "RunToTreat") {
   }
   else if (stype == "G4MacroPath") {
-    cout << endl;
-    cout << "***********************************       Error       ***********************************" << endl;
-    cout << "*                  No Geant4 macro file found in the provided path                      *" << endl;
-    cout << "*****************************************************************************************" << endl;
-    cout << endl;
+    std::cout << std::endl;
+    std::cout << "***********************************       Error       ***********************************" << std::endl;
+    std::cout << "*                  No Geant4 macro file found in the provided path                      *" << std::endl;
+    std::cout << "*****************************************************************************************" << std::endl;
+    std::cout << std::endl;
     exit(1);
   }
 
   else {
-    cout << "NPOptionManager::SendErrorAndExit() unkwown keyword" << endl;
+    std::cout << "NPOptionManager::SendErrorAndExit() unkwown keyword" << std::endl;
   }
 }
 
@@ -361,34 +383,36 @@ void NPOptionManager::SendErrorAndExit(const char* type) const{
 ////////////////////////////////////////////////////////////////////////////////
 void NPOptionManager::DisplayHelp(){
   DisplayVersion();
-  cout << endl << "----NPOptionManager Help----" << endl << endl ;
-  cout << "List of Option " << endl ;
-  cout << "\t--help -H -h\t\t\tDisplay this help message" << endl ;
-  cout << "\t--detector -D <arg>\t\tSet arg as the detector configuration file" << endl ;
-  cout << "\t--event-generator -E <arg>\tSet arg as the event generator file" << endl ;
-  cout << "\t--output -O <arg>\t\tSet arg as the Output File Name (output tree)" << endl ;
-  cout << "\t--tree-name <arg>\t\tSet arg as the Output Tree Name " << endl ;
-  cout << "\t--verbose -V <arg>\t\tSet the verbose level, 0 for nothing, 1 for normal printout."<<endl;
-	cout  << "\t\t\t\t\tError and warning are not affected" << endl ;
-  cout << endl << "NPAnalysis only:"<<endl;
-  cout << "\t--run -R <arg>\t\t\tSet arg as the run to read file list" << endl  ;
-  cout << "\t--cal -C <arg>\t\t\tSet arg as the calibration file list" << endl ;
-  cout << "\t--disable-branch\t\tDisable of branch of Input tree except the one of the detector (faster)" << endl  ;
-  cout << "\t--generate-histo -GH\t\tInstantiate the T*Spectra class of each detector" << endl ;
-  cout << "\t--check-histo -CH\t\tCheck if the Histogram looks ok and change there color if not" << endl ;
-  cout << "\t--input-physical -IP\t\tConsider the Input file is containing Physics Class." << endl  ;
-  cout << "\t-L <arg>\t\t\tLimit the number of events to be analysed to arg" << endl ;
-  cout << "\t-F <arg>\t\t\tSet the first event to analyse to arg (analysis goes from F -> L+F)" << endl ;
-  cout << "\t--last-sim\t\t\tIgnore the list of Run to treat if any and analysed the last simulated file" << endl ;
-  cout << "\t--last-phy\t\t\tIgnore the list of Run to treat if any and analysed the last Physics file" << endl ;
-  cout << "\t--last-res\t\t\tIgnore the list of Run to treat if any and analysed the last Result file" << endl ;
-  cout << "\t--last-any\t\t\tIgnore the list of Run to treat if any and analysed the last generated root file" << endl ;
-  cout << "\t--online  \t\t\tStart the spectra server" << endl ;
-  cout << endl << "NPSimulation only:"<<endl;
-  cout << "\t-M <arg>\t\t\tExecute Geant4 macro <arg> at startup" << endl ;
-  cout << "\t-B <arg>\t\t\tExecute in batch mode (no ui) with Geant4 macro <arg> at startup" << endl ;
-
-  cout << endl << endl ;
+  std::cout << std::endl << "----NPOptionManager Help----" << std::endl << std::endl ;
+  std::cout << "List of Option " << std::endl ;
+  std::cout << "\t--help -H -h\t\t\tDisplay this help message" << std::endl ;
+  std::cout << "\t--detector -D <arg>\t\tSet arg as the detector configuration file" << std::endl ;
+  std::cout << "\t--event-generator -E <arg>\tSet arg as the event generator file" << std::endl ;
+  std::cout << "\t--output -O <arg>\t\tSet arg as the Output File Name (output tree)" << std::endl ;
+  std::cout << "\t--tree-name <arg>\t\tSet arg as the Output Tree Name " << std::endl ;
+  std::cout << "\t--verbose -V <arg>\t\tSet the verbose level, 0 for nothing, 1 for normal printout."<<std::endl;
+	std::cout  << "\t\t\t\t\tError and warning are not affected" << std::endl ;
+  std::cout << std::endl << "NPAnalysis only:"<<std::endl;
+  std::cout << "\t--run -R <arg>\t\t\tSet arg as the run to read file list" << std::endl  ;
+  std::cout << "\t-T <name> <file>\t\tTree <name> from root file <file>" << std::endl  ;
+
+  std::cout << "\t--cal -C <arg>\t\t\tSet arg as the calibration file list" << std::endl ;
+  std::cout << "\t--disable-branch\t\tDisable of branch of Input tree except the one of the detector (faster)" << std::endl  ;
+  std::cout << "\t--generate-histo -GH\t\tInstantiate the T*Spectra class of each detector" << std::endl ;
+  std::cout << "\t--check-histo -CH\t\tCheck if the Histogram looks ok and change there color if not" << std::endl ;
+  std::cout << "\t--input-physical -IP\t\tConsider the Input file is containing Physics Class." << std::endl  ;
+  std::cout << "\t-L <arg>\t\t\tLimit the number of events to be analysed to arg" << std::endl ;
+  std::cout << "\t-F <arg>\t\t\tSet the first event to analyse to arg (analysis goes from F -> L+F)" << std::endl ;
+  std::cout << "\t--last-sim\t\t\tIgnore the list of Run to treat if any and analysed the last simulated file" << std::endl ;
+  std::cout << "\t--last-phy\t\t\tIgnore the list of Run to treat if any and analysed the last Physics file" << std::endl ;
+  std::cout << "\t--last-res\t\t\tIgnore the list of Run to treat if any and analysed the last Result file" << std::endl ;
+  std::cout << "\t--last-any\t\t\tIgnore the list of Run to treat if any and analysed the last generated root file" << std::endl ;
+  std::cout << "\t--online  \t\t\tStart the spectra server" << std::endl ;
+  std::cout << std::endl << "NPSimulation only:"<<std::endl;
+  std::cout << "\t-M <arg>\t\t\tExecute Geant4 macro <arg> at startup" << std::endl ;
+  std::cout << "\t-B <arg>\t\t\tExecute in batch mode (no ui) with Geant4 macro <arg> at startup" << std::endl ;
+
+  std::cout << std::endl << std::endl ;
 
   // exit current program
   exit(0);
@@ -403,8 +427,8 @@ void NPOptionManager::Destroy(){
   }
 }
 ////////////////////////////////////////////////////////////////////////////////
-string NPOptionManager::GetLastFile(){
-  string path = getenv("NPTOOL");
+std::string NPOptionManager::GetLastFile(){
+  std::string path = getenv("NPTOOL");
   if(fLastSimFile)
     return (path+"/.last_sim_file");
 
diff --git a/NPLib/Core/NPOptionManager.h b/NPLib/Core/NPOptionManager.h
index eaece873a..88fe77f63 100644
--- a/NPLib/Core/NPOptionManager.h
+++ b/NPLib/Core/NPOptionManager.h
@@ -26,7 +26,6 @@
 // C++ headers
 #include <iostream>
 #include <string>
-using namespace std;
 
 class NPOptionManager{
    public:
@@ -38,7 +37,7 @@ class NPOptionManager{
       static NPOptionManager* getInstance(int argc = 0, char** argv = NULL);
   
       // Added for compatibility with pROOF 
-      static NPOptionManager* getInstance(string arg);
+      static NPOptionManager* getInstance(std::string arg);
 
       // The analysis class instance can be deleted by calling the Destroy
       // method (NOTE: The class destructor is protected, and can thus not be
@@ -48,7 +47,7 @@ class NPOptionManager{
    protected:
       // Constructor (protected)
       NPOptionManager(int argc, char** argv);
-      NPOptionManager(string arg);
+      NPOptionManager(std::string arg);
 
       // Destructor (protected)
       ~NPOptionManager() {};
@@ -60,7 +59,7 @@ class NPOptionManager{
   private:
     // Read the input argument
     void ReadTheInputArgument(int argc = 0, char** argv = NULL);
-  
+      
    private:
       // The static instance of the NPOptionManager class:
       static NPOptionManager* instance;
@@ -72,7 +71,7 @@ class NPOptionManager{
       void CheckEventGenerator();
       void CheckDetectorConfiguration();
       void CheckG4Macro();
-
+      void CreateRunToTreatFile(std::string file, std::string tree );
    public:
       bool IsDefault(const char* type) const;
       void SendErrorAndExit(const char* type) const;
@@ -80,21 +79,21 @@ class NPOptionManager{
    public:
       // Getters
       // default values
-      string GetDefaultReactionFile()     {return fDefaultReactionFileName;}
-      string GetDefaultDetectorFile()     {return fDefaultDetectorFileName;}
-      string GetDefaultRunToReadFile()    {return fDefaultRunToReadFileName;}
-      string GetDefaultCalibrationFile()  {return fDefaultCalibrationFileName;}
-      string GetDefaultOutputFile()       {return fDefaultOutputFileName;}
-      string GetDefaultG4MacroPath()      {return fDefaultG4MacroPath;}
+      std::string GetDefaultReactionFile()     {return fDefaultReactionFileName;}
+      std::string GetDefaultDetectorFile()     {return fDefaultDetectorFileName;}
+      std::string GetDefaultRunToReadFile()    {return fDefaultRunToReadFileName;}
+      std::string GetDefaultCalibrationFile()  {return fDefaultCalibrationFileName;}
+      std::string GetDefaultOutputFile()       {return fDefaultOutputFileName;}
+      std::string GetDefaultG4MacroPath()      {return fDefaultG4MacroPath;}
 
       // assigned values
-      string GetReactionFile()             {return fReactionFileName;}
-      string GetDetectorFile()             {return fDetectorFileName;}
-      string GetRunToReadFile()            {return fRunToReadFileName;}
-      string GetCalibrationFile()          {return fCalibrationFileName;}
-      string GetOutputFile()               {return fOutputFileName;}
-      string GetOutputTreeName()           {return fOutputTreeName;}
-      string GetG4MacroPath()              {return fG4MacroPath;}     
+      std::string GetReactionFile()             {return fReactionFileName;}
+      std::string GetDetectorFile()             {return fDetectorFileName;}
+      std::string GetRunToReadFile()            {return fRunToReadFileName;}
+      std::string GetCalibrationFile()          {return fCalibrationFileName;}
+      std::string GetOutputFile()               {return fOutputFileName;}
+      std::string GetOutputTreeName()           {return fOutputTreeName;}
+      std::string GetG4MacroPath()              {return fG4MacroPath;}     
 
       bool   GetDisableAllBranchOption()   {return fDisableAllBranchOption;}
       bool   GetInputPhysicalTreeOption()  {return fInputPhysicalTreeOption;}
@@ -106,32 +105,32 @@ class NPOptionManager{
       int    GetVerboseLevel()             {return fVerboseLevel;}
       int    GetNumberOfEntryToAnalyse()   {return fNumberOfEntryToAnalyse;} 
       int    GetFirstEntryToAnalyse()      {return fFirstEntryToAnalyse;} 
-      string GetSharedLibExtension()       {return fSharedLibExtension;}     
-      string GetLastFile();                 
+      std::string GetSharedLibExtension()       {return fSharedLibExtension;}     
+      std::string GetLastFile();                 
       
       // Setters
-      void SetReactionFile(string name)       {fReactionFileName = name;CheckEventGenerator();}
-      void SetDetectorFile(string name)       {fDetectorFileName = name;CheckDetectorConfiguration();}
-      void SetRunToReadFile(string name)      {fRunToReadFileName = name;}
-      void SetVerboseLevel(int VerboseLevel)  {fVerboseLevel = VerboseLevel;}
+      void SetReactionFile(const std::string& name)  {fReactionFileName = name;CheckEventGenerator();}
+      void SetDetectorFile(const std::string& name)  {fDetectorFileName = name;CheckDetectorConfiguration();}
+      void SetRunToReadFile(const std::string& name) {fRunToReadFileName = name;}
+      void SetVerboseLevel(int VerboseLevel)         {fVerboseLevel = VerboseLevel;}
   
    private:
       // default values
-      string fDefaultReactionFileName;
-      string fDefaultDetectorFileName;
-      string fDefaultRunToReadFileName;
-      string fDefaultCalibrationFileName;
-      string fDefaultOutputFileName;
-      string fDefaultOutputTreeName;
-      string fDefaultG4MacroPath;
+      std::string fDefaultReactionFileName;
+      std::string fDefaultDetectorFileName;
+      std::string fDefaultRunToReadFileName;
+      std::string fDefaultCalibrationFileName;
+      std::string fDefaultOutputFileName;
+      std::string fDefaultOutputTreeName;
+      std::string fDefaultG4MacroPath;
 
       // assigned values
-      string fReactionFileName;
-      string fDetectorFileName;
-      string fRunToReadFileName;
-      string fCalibrationFileName;
-      string fOutputFileName;
-      string fOutputTreeName;
+      std::string fReactionFileName;
+      std::string fDetectorFileName;
+      std::string fRunToReadFileName;
+      std::string fCalibrationFileName;
+      std::string fOutputFileName;
+      std::string fOutputTreeName;
       bool   fDisableAllBranchOption;
       bool   fInputPhysicalTreeOption;
       bool   fGenerateHistoOption;
@@ -145,8 +144,8 @@ class NPOptionManager{
       int    fVerboseLevel; // 0 for not talk, 1 for talking
       int    fNumberOfEntryToAnalyse; // use to limit the number of analysed in NPA
       int    fFirstEntryToAnalyse; // use to set the first event analysed in NPA (total: fFirstEntryToAnalyse -> fFirstEntryToAnalyse + fNumberOfEntryToAnalyse)
-      string fSharedLibExtension; // lib extension is platform dependent
-      string fG4MacroPath; // Path to a geant4 macro to execute at start of nps
+      std::string fSharedLibExtension; // lib extension is platform dependent
+      std::string fG4MacroPath; // Path to a geant4 macro to execute at start of nps
       bool fG4BatchMode; // Execute geant4 in batch mode, running the given macro
 };
 
diff --git a/NPLib/Core/NPVDetector.cxx b/NPLib/Core/NPVDetector.cxx
index ea559d625..5d8da1cb7 100644
--- a/NPLib/Core/NPVDetector.cxx
+++ b/NPLib/Core/NPVDetector.cxx
@@ -24,22 +24,21 @@
  *****************************************************************************/
 #include "NPVDetector.h"
 #include "NPOptionManager.h"
-using namespace NPL ;
 
-ClassImp(VDetector);
+ClassImp(NPL::VDetector);
 
 // Constructor
-VDetector::VDetector(){
+NPL::VDetector::VDetector(){
 }
 
 
 // Destructor
-VDetector::~VDetector(){
+NPL::VDetector::~VDetector(){
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 namespace NPL{
-  static string itoa_array[10000];
+  static std::string itoa_array[10000];
 
   class itoa_proxy{
     public:
diff --git a/NPLib/Core/NPVSpectra.h b/NPLib/Core/NPVSpectra.h
index 36b3339cf..c9e26adb5 100644
--- a/NPLib/Core/NPVSpectra.h
+++ b/NPLib/Core/NPVSpectra.h
@@ -30,7 +30,6 @@
 #include <map>
 #include <vector>
 #include <string>
-using namespace std;
 
 class VSpectra {
   public:
@@ -39,10 +38,10 @@ class VSpectra {
     virtual ~VSpectra(){};
 
   public:
-    // Instantiate and register histo to maps
-    TH1* AddHisto1D(string name, string title, Int_t nbinsx, Double_t xlow, Double_t xup, string family);
-    TH1* AddHisto2D(string name, string title, Int_t nbinsx, Double_t xlow, Double_t xup, 
-        Int_t nbinsy, Double_t ylow, Double_t yup, string family);
+    // Instantiate and register histo to std::maps
+    TH1* AddHisto1D(std::string name, std::string title, Int_t nbinsx, Double_t xlow, Double_t xup, std::string family);
+    TH1* AddHisto2D(std::string name, std::string title, Int_t nbinsx, Double_t xlow, Double_t xup, 
+        Int_t nbinsy, Double_t ylow, Double_t yup, std::string family);
 
   public:
     // Initialization methods
@@ -58,32 +57,32 @@ class VSpectra {
     virtual void CheckSpectra(){};
 
   public:
-    // get map histo which will be used for GSpectra in GUser
-    map< string, TH1* > GetMapHisto() const {return fMapHisto;}
-    TH1* GetSpectra(const string& family, const string& name);    
-    TH1* GetSpectra(const string& FamilyAndName);    
+    // get std::map histo which will be used for GSpectra in GUser
+    std::map< std::string, TH1* > GetMapHisto() const {return fMapHisto;}
+    TH1* GetSpectra(const std::string& family, const std::string& name);    
+    TH1* GetSpectra(const std::string& FamilyAndName);    
     // TEMP FIX
-//    TH1* GetHisto(const string& family, const string& name){return GetSpectra(family,name);};    
-//    TH1* GetHisto(const string& FamilyAndName){return GetSpectra(FamilyAndName);};    
+//    TH1* GetHisto(const std::string& family, const std::string& name){return GetSpectra(family,name);};    
+//    TH1* GetHisto(const std::string& FamilyAndName){return GetSpectra(FamilyAndName);};    
 
-    void FillSpectra(const string& family, const string& name, double val);
-    void FillSpectra(const string& family, const string& name, double x, double y);
-    void FillSpectra(const string& familyAndname, double val);
-    void FillSpectra(const string& familyAndname, double x, double y);
+    void FillSpectra(const std::string& family, const std::string& name, double val);
+    void FillSpectra(const std::string& family, const std::string& name, double x, double y);
+    void FillSpectra(const std::string& familyAndname, double val);
+    void FillSpectra(const std::string& familyAndname, double x, double y);
 
 
-    void WriteSpectra(string filename = "VOID");      
+    void WriteSpectra(std::string filename = "VOID");      
      
   protected:
-    // map holding histo pointers and their family names
-    map< string, TH1* > fMapHisto;
+    // std::map holding histo pointers and their family names
+    std::map< std::string, TH1* > fMapHisto;
     
   private: // Name of the Detector
-   string m_name;
+   std::string m_name;
 
   public:
-   inline void SetName(string name) {m_name=name;}
-   inline string GetName() {return m_name;}
+   inline void SetName(std::string name) {m_name=name;}
+   inline std::string GetName() {return m_name;}
 };
 
 #endif
diff --git a/NPLib/Core/RootInput.cxx b/NPLib/Core/RootInput.cxx
index e6393c049..bfbb79295 100644
--- a/NPLib/Core/RootInput.cxx
+++ b/NPLib/Core/RootInput.cxx
@@ -30,10 +30,11 @@
 #include "RootInput.h"
 #include "TAsciiFile.h"
 #include "NPOptionManager.h"
+#include "NPInputParser.h"
 
 RootInput* RootInput::instance = 0;
 ////////////////////////////////////////////////////////////////////////////////
-RootInput* RootInput::getInstance(string configFileName){
+RootInput* RootInput::getInstance(std::string configFileName){
   // A new instance of RootInput is created if it does not exist:
   if (instance == 0) {
     instance = new RootInput(configFileName);
@@ -52,8 +53,8 @@ void RootInput::Destroy(){
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-RootInput::RootInput(string configFileName){
-  string lastfile= NPOptionManager::getInstance()->GetLastFile();
+RootInput::RootInput(std::string configFileName){
+  std::string lastfile= NPOptionManager::getInstance()->GetLastFile();
   if(lastfile!="VOID"){
     configFileName = lastfile;
   }
@@ -63,40 +64,36 @@ RootInput::RootInput(string configFileName){
   bool CheckRootFileName = false;
 
   // Read configuration file Buffer
-  string lineBuffer, dataBuffer;
+  std::string lineBuffer, dataBuffer;
 
   // Open file
-  cout << endl;
-  cout << "/////////// ROOT Input files ///////////" << endl;
-  cout << "Initializing input TChain" << endl;
+  std::cout << std::endl;
+  std::cout << "/////////// ROOT Input files ///////////" << std::endl;
+  std::cout << "Initializing input TChain using: " << configFileName << std::endl;
 
-  ifstream inputConfigFile;
+  std::ifstream inputConfigFile;
   inputConfigFile.open(configFileName.c_str());
-
   pRootFile  = NULL;
-  pRootChain = new TChain();
-
   if (!inputConfigFile.is_open()) {
-    cout << "\033[1;31mWarning : Run to Read file: " << configFileName << " not found\033[0m" << endl; 
+    std::cout << "\033[1;31mWarning : Run to Read file: " << configFileName << " not found\033[0m" << std::endl; 
     //exit(1);
   }
 
   else {
     while (!inputConfigFile.eof()) {
       getline(inputConfigFile, lineBuffer);
-
       // search for token giving the TTree name
       if (lineBuffer.compare(0, 9, "TTreeName") == 0) {
         inputConfigFile >> dataBuffer;
         // initialize pRootChain
-        pRootChain->SetName(dataBuffer.c_str());
+        pRootChain = new TChain(dataBuffer.c_str());
         CheckTreeName = true ;
         // If the tree come from a simulation, the InteractionCoordinates
         // and InitialConditions lib are loaded
         if(dataBuffer=="SimulatedTree"){
-          string path = getenv("NPTOOL");
+          std::string path = getenv("NPTOOL");
           path+="/NPLib/lib/";
-          string libName="libNPInteractionCoordinates"+NPOptionManager::getInstance()->GetSharedLibExtension();
+          std::string libName="libNPInteractionCoordinates"+NPOptionManager::getInstance()->GetSharedLibExtension();
           libName=path+libName;
           dlopen(libName.c_str(),RTLD_NOW);
           libName="libNPInitialConditions"+NPOptionManager::getInstance()->GetSharedLibExtension();
@@ -119,16 +116,16 @@ RootInput::RootInput(string configFileName){
 
           else if (!inputConfigFile.eof()) {
             pRootChain->Add(dataBuffer.c_str());
-            cout << "Adding file " << dataBuffer << " to TChain" << endl;
+            std::cout << "Adding file " << dataBuffer << " to TChain" << std::endl;
 
             // Test if the file is a regex or a single file
             double counts;
-            string command = "ls " + dataBuffer + " > .ls_return";
+            std::string command = "ls " + dataBuffer + " > .ls_return";
             counts= system(command.c_str());
-            ifstream return_ls(".ls_return");
+            std::ifstream return_ls(".ls_return");
             
-            string files;
-            string firstfile;
+            std::string files;
+            std::string firstfile;
             while(return_ls >> files){
               if(counts == 0)
                 firstfile = files;
@@ -142,43 +139,43 @@ RootInput::RootInput(string configFileName){
       }
     }
     if( pRootChain->GetEntries() ==0){
-      cout << "\033[1;31m**** ERROR: No entries to analyse ****\033[0m" << endl; 
+      std::cout << "\033[1;31m**** ERROR: No entries to analyse ****\033[0m" << std::endl; 
       exit(1);
     }
     else{
-      cout << "\033[1;32mROOTInput:  " << pRootChain->GetEntries() << " entries loaded in the input chain\033[0m" << endl ;
+      std::cout << "\033[1;32mROOTInput:  " << pRootChain->GetEntries() << " entries loaded in the input chain\033[0m" << std::endl ;
     }
 
   }
 
   if (!CheckRootFileName || !CheckTreeName) 
-    cout << "\033[1;33mWARNING: Token not found for InputTree Declaration : Input Tree may not be instantiate properly\033[0m" << endl;
+    std::cout << "\033[1;33mWARNING: Token not found for InputTree Declaration : Input Tree may not be instantiate properly\033[0m" << std::endl;
 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void RootInput::AddFriendChain(string RunToAdd){
+void RootInput::AddFriendChain(std::string RunToAdd){
   NumberOfFriend++;
-  ostringstream suffix_buffer;
+  std::ostringstream suffix_buffer;
   suffix_buffer << "_" << NumberOfFriend ; 
-  string suffix = suffix_buffer.str();
+  std::string suffix = suffix_buffer.str();
   bool CheckTreeName     = false;
   bool CheckRootFileName = false;
 
   // Read configuration file Buffer
-  string lineBuffer, dataBuffer;
+  std::string lineBuffer, dataBuffer;
 
   // Open file
-  ifstream inputConfigFile;
+  std::ifstream inputConfigFile;
   inputConfigFile.open(RunToAdd.c_str());
 
   TChain* localChain = new TChain();
-
-  cout << "/////////////////////////////////" << endl;
-  cout << "Adding friend to current TChain" << endl;
+  
+  std::cout << "/////////////////////////////////" << std::endl;
+  std::cout << "Adding friend to current TChain" << std::endl;
 
   if (!inputConfigFile) {
-    cout << "Run to Add file :" << RunToAdd << " not found " << endl; 
+    std::cout << "Run to Add file :" << RunToAdd << " not found " << std::endl; 
     return;
   }
 
@@ -210,7 +207,7 @@ void RootInput::AddFriendChain(string RunToAdd){
 
           else if (!inputConfigFile.eof()) {
             localChain->Add(dataBuffer.c_str());
-            cout << "Adding file " << dataBuffer << " to TChain" << endl;
+            std::cout << "Adding file " << dataBuffer << " to TChain" << std::endl;
           }
         }
       }
@@ -218,38 +215,38 @@ void RootInput::AddFriendChain(string RunToAdd){
   }
 
   if (!CheckRootFileName || !CheckTreeName) 
-    cout << "WARNING: Token not found for InputTree Declaration : Input Tree has not be Added to the current Chain" << endl;
+    std::cout << "WARNING: Token not found for InputTree Declaration : Input Tree has not be Added to the current Chain" << std::endl;
 
   else
     pRootChain->AddFriend( localChain->GetName() );
 
-  cout << "/////////////////////////////////" << endl;
+  std::cout << "/////////////////////////////////" << std::endl;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-string RootInput::DumpAsciiFile(const char* type, const char* folder){
-  string name="fail";
+std::string RootInput::DumpAsciiFile(const char* type, const char* folder){
+  std::string name="fail";
 
-  string sfolder = folder;
+  std::string sfolder = folder;
   // create folder if not existing
   // first test if folder exist
   struct stat dirInfo;
   int res = stat(folder, &dirInfo);
   if (res != 0) {   // if folder does not exist, create it
-    string cmd = "mkdir " + sfolder;
-    if (system(cmd.c_str()) != 0) cout << "RootInput::DumpAsciiFile() problem creating directory" << endl;
+    std::string cmd = "mkdir " + sfolder;
+    if (system(cmd.c_str()) != 0) std::cout << "RootInput::DumpAsciiFile() problem creating directory" << std::endl;
   }
 
-  string stype = type;
+  std::string stype = type;
   if (stype == "EventGenerator") {
     TAsciiFile *aFile = (TAsciiFile*)pRootFile->Get(stype.c_str());
 
     if(aFile)
     {
       // build file name
-      string title = aFile->GetTitle();
+      std::string title = aFile->GetTitle();
       size_t pos = title.rfind("/");
-      if (pos != string::npos) name = sfolder + title.substr(pos);
+      if (pos != std::string::npos) name = sfolder + title.substr(pos);
       else name = sfolder + "/" + title;
       aFile->WriteToFile(name.c_str());
     }
@@ -260,9 +257,9 @@ string RootInput::DumpAsciiFile(const char* type, const char* folder){
     if(aFile)
     {
       // build file name
-      string title = aFile->GetTitle();
+      std::string title = aFile->GetTitle();
       size_t pos = title.rfind("/");
-      if (pos != string::npos) name = sfolder + title.substr(pos);
+      if (pos != std::string::npos) name = sfolder + title.substr(pos);
       else name = sfolder + "/" + title;
       aFile->WriteToFile(name.c_str());
     }
@@ -273,9 +270,9 @@ string RootInput::DumpAsciiFile(const char* type, const char* folder){
     if(aFile)
     {
       // build file name
-      string title = aFile->GetTitle();
+      std::string title = aFile->GetTitle();
       size_t pos = title.rfind("/");
-      if (pos != string::npos) name = sfolder + title.substr(pos);
+      if (pos != std::string::npos) name = sfolder + title.substr(pos);
       else name = sfolder + "/" + title;
       aFile->WriteToFile(name.c_str());
     }
@@ -284,7 +281,7 @@ string RootInput::DumpAsciiFile(const char* type, const char* folder){
   else if (stype == "RunToTreat") {
   }
   else {
-    cout << "RootInput::DumpAsciiFile() unkwown keyword" << endl;
+    std::cout << "RootInput::DumpAsciiFile() unkwown keyword" << std::endl;
   }
 
   return name;
@@ -296,17 +293,17 @@ RootInput::~RootInput(){
   struct stat dirInfo;
   int res = stat("./.tmp", &dirInfo);
   if (res == 0) {   // if does exist, delete it
-    if (system("rm -rf ./.tmp") != 0) cout << "RootInput::~RootInput() problem deleting ./.tmp directory" << endl; 
+    if (system("rm -rf ./.tmp") != 0) std::cout << "RootInput::~RootInput() problem deleting ./.tmp directory" << std::endl; 
   }
-  cout << endl << "Root Input summary" << endl;
-  cout << "  - Number of bites read: " << pRootFile->GetBytesRead() << endl;
-  cout << "  - Number of transactions: " << pRootFile->GetReadCalls() << endl;
+  std::cout << std::endl << "Root Input summary" << std::endl;
+  std::cout << "  - Number of bites read: " << pRootFile->GetBytesRead() << std::endl;
+  std::cout << "  - Number of transactions: " << pRootFile->GetReadCalls() << std::endl;
   // Close the Root file
   pRootFile->Close();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-TChain* MakeFriendTrees(string RunToRead1,string RunToRead2){
+TChain* MakeFriendTrees(std::string RunToRead1,std::string RunToRead2){
   RootInput:: getInstance(RunToRead1)	;
   RootInput:: getInstance()->AddFriendChain(RunToRead2);
   return RootInput:: getInstance()->GetChain();
diff --git a/NPLib/Core/RootInput.h b/NPLib/Core/RootInput.h
index 7408ba402..b9cb0c6d9 100644
--- a/NPLib/Core/RootInput.h
+++ b/NPLib/Core/RootInput.h
@@ -30,7 +30,6 @@
 #include "TFile.h"
 #include "TChain.h"
 
-using namespace std;
 
 
 class RootInput
@@ -41,7 +40,7 @@ public:
    // the user to get a pointer to the existing instance or to create it if
    // it does not yet exist:
    // (see the constructor for an explanation of the arguments)
-   static RootInput* getInstance(string configFileName = "configFile");
+   static RootInput* getInstance(std::string configFileName = "configFile");
 
    // The analysis class instance can be deleted by calling the Destroy
    // method (NOTE: The class destructor is protected, and can thus not be
@@ -50,7 +49,7 @@ public:
 
 protected:
    // Constructor (protected)
-   RootInput(string configFileName);
+   RootInput(std::string configFileName);
 
    // Destructor (protected)
    virtual ~RootInput();
@@ -64,7 +63,7 @@ private:
    static RootInput* instance;
 
 public:
-   string DumpAsciiFile(const char* type, const char* folder = "./.tmp");
+   std::string DumpAsciiFile(const char* type, const char* folder = "./.tmp");
 
 public:
    // Return the private chain and file
@@ -73,7 +72,7 @@ public:
    void     SetChain(TChain* c)  {pRootChain = c;} 
 
    // Add a Friend chain to the input chain
-   void     AddFriendChain(string RunToAdd);
+   void     AddFriendChain(std::string RunToAdd);
 
 private:
    TChain   *pRootChain;
@@ -83,6 +82,6 @@ private:
 };
 
 // A convenient function related to Root Input, coded Here so it can be called within ROOT CINT
-TChain* MakeFriendTrees(string,string);
+TChain* MakeFriendTrees(std::string,std::string);
 
 #endif // ROOTINPUT_HH
diff --git a/NPLib/Core/RootOutput.cxx b/NPLib/Core/RootOutput.cxx
index 6a4ea5198..433665ebc 100644
--- a/NPLib/Core/RootOutput.cxx
+++ b/NPLib/Core/RootOutput.cxx
@@ -31,10 +31,10 @@ using namespace std;
 
 RootOutput* RootOutput::instance = 0;
 ////////////////////////////////////////////////////////////////////////////////
-RootOutput* RootOutput::getInstance(TString fileNameBase, TString treeNameBase){
+RootOutput* RootOutput::getInstance(std::string fileNameBase, std::string treeNameBase){
   // A new instance of RootOutput is created if it does not exist:
   if (instance == 0) {
-    instance = new RootOutput(fileNameBase, treeNameBase);
+    instance = new RootOutput(fileNameBase.c_str(), treeNameBase.c_str());
   }
 
   // The instance of RootOutput is returned:
@@ -50,19 +50,19 @@ void RootOutput::Destroy(){
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-RootOutput::RootOutput(TString fileNameBase, TString treeNameBase){
+RootOutput::RootOutput(std::string fileNameBase, std::string treeNameBase){
   TDirectory* currentPath= gDirectory;
 
   // The file extension is added to the file name:
-  TString GlobalPath = getenv("NPTOOL");
+  std::string GlobalPath = getenv("NPTOOL");
 
   // The ROOT file is created
   if(!NPOptionManager::getInstance()->GetPROOF()){
-    TString fileName = GlobalPath + "/Outputs/";
-    if (fileNameBase.Contains("root")) fileName += fileNameBase;
+    std::string fileName = GlobalPath + "/Outputs/";
+    if (fileNameBase.find("root")!=std::string::npos) fileName += fileNameBase;
     else fileName += fileNameBase + ".root";
 
-    pRootFile = new TFile(fileName, "RECREATE");
+    pRootFile = new TFile(fileName.c_str(), "RECREATE");
 
     if(treeNameBase=="SimulatedTree"){
       string path = getenv("NPTOOL");
@@ -118,7 +118,7 @@ RootOutput::RootOutput(TString fileNameBase, TString treeNameBase){
     pRootFile = 0 ;
   }
 
-  pRootTree = new TTree(treeNameBase, "Data created / analysed with the NPTool package");
+  pRootTree = new TTree(treeNameBase.c_str(), "Data created / analysed with the NPTool package");
   pRootList = new TList();
 
   // Init TAsciiFile objects
@@ -134,35 +134,35 @@ void RootOutput::InitAsciiFiles(){
 
   // Event generator
   // Get file name from NPOptionManager
-  TString fileNameEG = OptionManager->GetReactionFile();
+  std::string fileNameEG = OptionManager->GetReactionFile();
   pEventGenerator = new TAsciiFile();
-  pEventGenerator->SetNameTitle("EventGenerator", fileNameEG.Data());
-  pEventGenerator->Append(fileNameEG.Data());
+  pEventGenerator->SetNameTitle("EventGenerator", fileNameEG.c_str());
+  pEventGenerator->Append(fileNameEG.c_str());
   pEventGenerator->Write(0,TAsciiFile::kOverwrite);
   
   // Detector configuration 
   // Get file name from NPOptionManager
-  TString fileNameDC = OptionManager->GetDetectorFile();
+  std::string fileNameDC = OptionManager->GetDetectorFile();
   pDetectorConfiguration = new TAsciiFile();
-  pDetectorConfiguration->SetNameTitle("DetectorConfiguration", fileNameDC.Data());
-  pDetectorConfiguration->Append(fileNameDC.Data());
+  pDetectorConfiguration->SetNameTitle("DetectorConfiguration", fileNameDC.c_str());
+  pDetectorConfiguration->Append(fileNameDC.c_str());
   pDetectorConfiguration->Write(0,TAsciiFile::kOverwrite);
 
   // Run to treat file
   // Get file name from NPOptionManager
   pRunToTreatFile = new TAsciiFile();
   if (!OptionManager->IsDefault("RunToTreat")) {
-    TString fileNameRT = OptionManager->GetRunToReadFile();
-    pRunToTreatFile->SetNameTitle("RunToTreat", fileNameRT.Data());
-    pRunToTreatFile->Append(fileNameRT.Data());
+    std::string fileNameRT = OptionManager->GetRunToReadFile();
+    pRunToTreatFile->SetNameTitle("RunToTreat", fileNameRT.c_str());
+    pRunToTreatFile->Append(fileNameRT.c_str());
     pRunToTreatFile->Write(0,TAsciiFile::kOverwrite);
   }
 
   // Calibration files
   pCalibrationFile = new TAsciiFile();
   if (!OptionManager->IsDefault("Calibration")) {
-    TString fileNameCal = OptionManager->GetCalibrationFile();
-    pCalibrationFile->SetNameTitle("Calibration", fileNameCal.Data());
+    std::string fileNameCal = OptionManager->GetCalibrationFile();
+    pCalibrationFile->SetNameTitle("Calibration", fileNameCal.c_str());
     pCalibrationFile->Write(0,TAsciiFile::kOverwrite);
   }
 
@@ -227,14 +227,14 @@ RootOutput::~RootOutput(){
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-TFile* RootOutput::InitFile(TString fileNameBase){
+TFile* RootOutput::InitFile(std::string fileNameBase){
 
   if(NPOptionManager::getInstance()->GetPROOF()){
-    TString GlobalPath = getenv("NPTOOL");
-    TString fileName = GlobalPath + "/Outputs/Analysis/";
-    if (fileNameBase.Contains("root")) fileName += fileNameBase;
+    std::string GlobalPath = getenv("NPTOOL");
+    std::string fileName = GlobalPath + "/Outputs/Analysis/";
+    if (fileNameBase.find("root")!=std::string::npos) fileName += fileNameBase;
     else fileName += fileNameBase + ".root";
-    pRootFile = new TFile(fileName, "RECREATE");
+    pRootFile = new TFile(fileName.c_str(), "RECREATE");
     pRootFile->Flush();
     return pRootFile;
   }
diff --git a/NPLib/Core/RootOutput.h b/NPLib/Core/RootOutput.h
index 25fca9412..2ac1db601 100644
--- a/NPLib/Core/RootOutput.h
+++ b/NPLib/Core/RootOutput.h
@@ -28,11 +28,10 @@
 #include "TAsciiFile.h"
 
 // ROOT headers
-#include "TString.h"
 #include "TFile.h"
 #include "TTree.h"
 #include "TList.h"
-
+#include <string>
 
 class RootOutput{
 public:
@@ -41,8 +40,8 @@ public:
   // the user to get a pointer to the existing instance or to create it if
   // it does not yet exist:
   // (see the constructor for an explanation of the arguments)
-  static RootOutput* getInstance(TString fileNameBase = "Simulation",
-                                 TString treeNameBase = "SimulatedTree");
+  static RootOutput* getInstance(std::string fileNameBase = "Simulation",
+                                 std::string treeNameBase = "SimulatedTree");
   
   // The analysis class instance can be deleted by calling the Destroy
   // method (NOTE: The class destructor is protected, and can thus not be
@@ -51,7 +50,7 @@ public:
   
 protected:
   // Constructor (protected)
-  RootOutput(TString fileNameBase, TString treeNameBase);
+  RootOutput(std::string fileNameBase, std::string treeNameBase);
   
   // Destructor (protected)
   virtual ~RootOutput();
@@ -76,7 +75,7 @@ public:
   TAsciiFile* GetAsciiFileCalibration()           {return pCalibrationFile;}
   TAsciiFile* GetAsciiFileRunToTreat()            {return pRunToTreatFile;}
   TAsciiFile* GetAsciiFileAnalysisConfig()        {return pAnalysisConfigFile;}
-  TFile*      InitFile(TString fileNameBase); // use only for proof environment
+  TFile*      InitFile(std::string fileNameBase); // use only for proof environment
   
 private:
   TFile      *pRootFile;
diff --git a/NPLib/Core/TAsciiFile.h b/NPLib/Core/TAsciiFile.h
index 249ab7b66..e1ac5e248 100644
--- a/NPLib/Core/TAsciiFile.h
+++ b/NPLib/Core/TAsciiFile.h
@@ -28,12 +28,11 @@
 // C++ headers
 #include <vector>
 #include <string>
-using namespace std;
 
 
 class TAsciiFile : public TNamed {
  private :
-   vector<string>   fLines;
+   std::vector<std::string>   fLines;
 
  protected :
    void ReadFile(const char* inputAsciiFile);
diff --git a/NPLib/Utility/npanalysis.cxx b/NPLib/Utility/npanalysis.cxx
index 3863a46d5..972ee77ad 100644
--- a/NPLib/Utility/npanalysis.cxx
+++ b/NPLib/Utility/npanalysis.cxx
@@ -22,30 +22,30 @@ void ProgressDisplay(clock_t&,clock_t&,unsigned long&, unsigned long&, unsigned
 int main(int argc , char** argv){
   // command line parsing
   NPOptionManager* myOptionManager = NPOptionManager::getInstance(argc,argv);
-  string inputfilename = myOptionManager->GetRunToReadFile();
+  std::string inputfilename = myOptionManager->GetRunToReadFile();
   // if input files are not given, use those from TAsciiFile
   if (myOptionManager->IsDefault("DetectorConfiguration")) {
-    string name = RootInput::getInstance(inputfilename)->DumpAsciiFile("DetectorConfiguration");
+    std::string name = RootInput::getInstance(inputfilename)->DumpAsciiFile("DetectorConfiguration");
     if(name!="fail"){
       myOptionManager->SetDetectorFile(name);
-     cout << "\033[1;33mInfo: No Detector file given, using Input tree one \033[0m"<<endl;;
+     std::cout << "\033[1;33mInfo: No Detector file given, using Input tree one \033[0m" << std::endl;;
     }  
   }
 
   if (myOptionManager->IsDefault("EventGenerator")) {
-    string name = RootInput::getInstance(inputfilename)->DumpAsciiFile("EventGenerator");
+    std::string name = RootInput::getInstance(inputfilename)->DumpAsciiFile("EventGenerator");
     if(name!="fail"){
     myOptionManager->SetReactionFile(name);
-    cout << "\033[1;33mInfo: No Event file given, using Input tree one \033[0m"<<endl;;
+    std::cout << "\033[1;33mInfo: No Event file given, using Input tree one \033[0m" << std::endl;;
     }
   }
 
   // get input files from NPOptionManager
-  string detectorfileName    = myOptionManager->GetDetectorFile();
-  string OutputfileName      = myOptionManager->GetOutputFile();
+  std::string detectorfileName    = myOptionManager->GetDetectorFile();
+  std::string OutputfileName      = myOptionManager->GetOutputFile();
 
   // Instantiate RootOutput
-  string TreeName="NPTool_Tree";
+  std::string TreeName="NPTool_Tree";
 
   // User decided of the name
   if(!myOptionManager->IsDefault("TreeName")){
@@ -76,7 +76,7 @@ int main(int argc , char** argv){
   myDetector->InitializeRootOutput();
   // Attempt to load an analysis
   NPL::VAnalysis* UserAnalysis = NULL;
-  string libName = "./libNPAnalysis" + myOptionManager->GetSharedLibExtension();
+  std::string libName = "./libNPAnalysis" + myOptionManager->GetSharedLibExtension();
   dlopen(libName.c_str(),RTLD_NOW | RTLD_GLOBAL);
   char* error = dlerror();
   if(error==NULL){
@@ -161,7 +161,7 @@ int main(int argc , char** argv){
     }
 
     else{
-      cout << "\033[1;31m ERROR: You are requesting to rebuild a Physics Tree without any User Analysis, nothing to be done\033[0m" <<endl;
+      std::cout << "\033[1;31m ERROR: You are requesting to rebuild a Physics Tree without any User Analysis, nothing to be done\033[0m" << std::endl;
       // Quit without error
       exit(0);
     }
@@ -171,19 +171,19 @@ int main(int argc , char** argv){
     if(!IsPhysics){ 
       for (unsigned long i = first_entry ; i < nentries + first_entry; i++) { 
         // Get the raw Data
-	//cout << "!" << endl;
+	//std::cout << "!" << std::endl;
         Chain -> GetEntry(i);
-	//cout << "!!" << endl;
+	//std::cout << "!!" << std::endl;
         // Build the current event
         myDetector->BuildPhysicalEvent();
-	//cout << "!!!" << endl;
+	//std::cout << "!!!" << std::endl;
         // User Analysis
         UserAnalysis->TreatEvent();
-	//cout << "!!!!" << endl;
+	//std::cout << "!!!!" << std::endl;
         // Fill the tree      
         tree->Fill();
       
-	//cout << "!!!!!" << endl;
+	//std::cout << "!!!!!" << std::endl;
         current_tree = Chain->GetTreeNumber()+1;
         ProgressDisplay(begin,end,treated,inter,nentries,mean_rate,displayed,current_tree,total_tree);
         
-- 
GitLab