diff --git a/NPLib/Core/NPOptionManager.cxx b/NPLib/Core/NPOptionManager.cxx
index 50e1a1f3122edf34f7cc7a5b40d4dcc3acd547bf..5ce4d18f388da6f30a42b6ab93f6aebbae3bb434 100644
--- a/NPLib/Core/NPOptionManager.cxx
+++ b/NPLib/Core/NPOptionManager.cxx
@@ -32,13 +32,13 @@ NPOptionManager* NPOptionManager::instance = 0 ;
 ////////////////////////////////////////////////////////////////////////////////
 NPOptionManager* NPOptionManager::getInstance(int argc, char** argv){
   if (instance == 0) instance = new NPOptionManager(argc, argv);
-  
+
   return instance ;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 NPOptionManager* NPOptionManager::getInstance(string arg){
-  
+
   if (instance == 0) instance = new NPOptionManager(arg);
 
   return instance ;
@@ -49,12 +49,14 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
   fDefaultReactionFileName    = "defaultReaction.reaction";
   fDefaultDetectorFileName    = "defaultDetector.detector";
   fDefaultOutputFileName      = "myResult.root";
+  fDefaultOutputTreeName      = "NPTool_Tree";
   fDefaultRunToReadFileName   = "defaultRunToTreat.txt";
   fDefaultCalibrationFileName = "defaultCalibration.txt";
   // Assigned values
   fReactionFileName           = fDefaultReactionFileName;
   fDetectorFileName           = fDefaultDetectorFileName;
   fOutputFileName             = fDefaultOutputFileName;
+  fOutputTreeName             = fDefaultOutputTreeName;
   fRunToReadFileName          = fDefaultRunToReadFileName;
   fCalibrationFileName        = fDefaultCalibrationFileName;
   fVerboseLevel               = 1;
@@ -63,43 +65,45 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
   fInputPhysicalTreeOption = false;
   fGenerateHistoOption = false ;
   fPROOFMode = false;
-  
+
   for (int i = 0; i < argc; i++) {
     string argument = argv[i];
     if (argument == "-H" || argument == "-h" || argument == "--help") DisplayHelp();
-    
+
     else if (argument == "--event-generator" && argc >= i + 1)    fReactionFileName    = argv[++i] ;
-    
+
     else if (argument == "-E" && argc >= i + 1)                   fReactionFileName    = argv[++i] ;
-    
+
     else if (argument == "--detector" && argc >= i + 1)           fDetectorFileName    = argv[++i] ;
-    
+
     else if (argument == "-D" && argc >= i + 1)                   fDetectorFileName    = argv[++i] ;
-    
+
     else if (argument == "--output" && argc >= i + 1)             fOutputFileName      = argv[++i] ;
-    
+
     else if (argument == "-O" && argc >= i + 1)                   fOutputFileName      = argv[++i] ;
-    
+
+    else if (argument == "--tree-name" && argc >= i + 1)          fOutputTreeName      = argv[++i] ;
+
     else if (argument == "--run" && argc >= i + 1)                fRunToReadFileName   = argv[++i] ;
-    
+
     else if (argument == "-R" && argc >= i + 1)                   fRunToReadFileName   = argv[++i] ;
-    
+
     else if (argument == "--cal" && argc >= i + 1)                fCalibrationFileName = argv[++i] ;
-    
+
     else if (argument == "-C" && argc >= i + 1)                   fCalibrationFileName = argv[++i] ;
-    
+
     else if (argument == "-V"  && argc >= i + 1)                  fVerboseLevel = atoi(argv[++i]) ;
-    
+
     else if (argument == "--verbose" && argc >= i + 1)            fVerboseLevel = atoi(argv[++i]) ;
-    
+
     else if (argument == "--disable-branch")                      fDisableAllBranchOption = true ;
-    
+
     else if (argument == "--input-physical")                      fInputPhysicalTreeOption = true ;
-    
+
     else if (argument == "-IP")                                   fInputPhysicalTreeOption = true ;
-   
+
     else if (argument == "-GH")                                   fGenerateHistoOption = true ;
- 
+
     else if (argument == "-CH")                                   fCheckHistoOption = true ;
 
     else if (argument == "-check-histo")                          fCheckHistoOption = true ;
@@ -107,8 +111,17 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
     else if (argument == "--generate-histo")                      fGenerateHistoOption = true ;
 
     else if (argument == "--proof")                               fPROOFMode = true ;
-    
-    else if (argument == "-L")                                    fNumberOfEntryToAnalyse= atoi(argv[++i]) ;
+
+    else if (argument == "-L")                                    fNumberOfEntryToAnalyse = atoi(argv[++i]) ;
+
+    else if (argument == "--last-sim")                            fLastSimFile = true ;
+
+    else if (argument == "--last-phy")                            fLastPhyFile = true ;
+
+    else if (argument == "--last-res")                            fLastResFile = true ;
+
+    else if (argument == "--last-any")                            fLastAnyFile = true ;
+
     //else ;
   }
   CheckArguments();
@@ -132,12 +145,12 @@ NPOptionManager::NPOptionManager(string arg)
     args.push_back(arg);
   }
   args.push_back(0);
-  
+
   ReadTheInputArgument(args.size()-1, &args[0]);
 
   for(size_t i = 0; i < args.size(); i++)
     delete[] args[i];
-  
+
 }
 ////////////////////////////////////////////////////////////////////////////////
 void NPOptionManager::CheckArguments(){
@@ -148,14 +161,14 @@ void NPOptionManager::CheckArguments(){
 ////////////////////////////////////////////////////////////////////////////////
 void NPOptionManager::CheckEventGenerator(){
   bool checkFile = true;
-  
+
   // NPTool path
   string GlobalPath = getenv("NPTOOL");
   string StandardPath = GlobalPath + "/Inputs/EventGenerator/" + fReactionFileName;
-  
+
   // ifstream to configfile
   ifstream ConfigFile;
-  
+
   // test if config file is in local path
   ConfigFile.open(fReactionFileName.c_str());
   if (!ConfigFile.is_open()) {
@@ -170,7 +183,7 @@ void NPOptionManager::CheckEventGenerator(){
   if (!checkFile && fReactionFileName != fDefaultReactionFileName) {   // if file does not exist
     SendErrorAndExit("EventGenerator");
   }
-  
+
   // close ConfigFile
   ConfigFile.close();
 }
@@ -178,14 +191,14 @@ void NPOptionManager::CheckEventGenerator(){
 ////////////////////////////////////////////////////////////////////////////////
 void NPOptionManager::CheckDetectorConfiguration(){
   bool checkFile = true;
-  
+
   // NPTool path
   string GlobalPath = getenv("NPTOOL");
   string StandardPath = GlobalPath + "/Inputs/DetectorConfiguration/" + fDetectorFileName;
-  
+
   // ifstream to configfile
   ifstream ConfigFile;
-  
+
   // test if config file is in local path
   ConfigFile.open(fDetectorFileName.c_str());
   if (!ConfigFile.is_open()) {
@@ -200,7 +213,7 @@ void NPOptionManager::CheckDetectorConfiguration(){
   if (!checkFile && fDetectorFileName != fDefaultDetectorFileName) {   // if file does not exist
     SendErrorAndExit("DetectorConfiguration");
   }
-  
+
   // close ConfigFile
   ConfigFile.close();
 }
@@ -210,7 +223,7 @@ void NPOptionManager::CheckDetectorConfiguration(){
 // This method tests if the input files are the default ones
 bool NPOptionManager::IsDefault(const char* type) const{
   bool result = false;
-  
+
   string stype = type;
   if (stype == "EventGenerator") {
     if (fReactionFileName == fDefaultReactionFileName) result = true;
@@ -224,10 +237,16 @@ bool NPOptionManager::IsDefault(const char* type) const{
   else if (stype == "RunToTreat") {
     if (fRunToReadFileName == fDefaultRunToReadFileName) result = true;
   }
+  else if (stype == "OutputFileName") {
+    if (fOutputFileName == fDefaultOutputFileName) result = true;
+  }
+  else if (stype == "TreeName") {
+    if (fOutputTreeName == fDefaultOutputTreeName) result = true;
+  }
   else {
     cout << "NPOptionManager::IsDefault() unkwown keyword" << endl;
   }
-  
+
   return result;
 }
 
@@ -266,21 +285,26 @@ void NPOptionManager::SendErrorAndExit(const char* type) const{
 void NPOptionManager::DisplayHelp(){
   cout << endl << "----NPOptionManager Help----" << endl << endl ;
   cout << "List of Option " << endl ;
-  cout << "\t --help -H -h\t \t \t \t \t \t \t Display this help message" << endl ;
-  cout << "\t --detector -D <arg>\t \t \t \t \t \t Set arg as the detector configuration file" << endl ;
-  cout << "\t --event-generator -E <arg>\t \t \t \t \t Set arg as the event generator file" << endl ;
-  cout << "\t --output -O <arg>\t \t \t \t \t \t Set arg as the Output File Name (output tree)" << endl ;
-  cout << "\t --verbose -V <arg>\t \t \t \t \t \t Set the verbose level of some of the object, 0 for nothing, 1 for normal printout. Error and warning are not affected" << endl ;
+  cout << "\t --help -H -h\t \t \t \tDisplay this help message" << endl ;
+  cout << "\t --detector -D <arg>\t \t \tSet arg as the detector configuration file" << endl ;
+  cout << "\t --event-generator -E <arg>\t \tSet arg as the event generator file" << endl ;
+  cout << "\t --output -O <arg>\t \t \tSet arg as the Output File Name (output tree)" << endl ;
+  cout << "\t --tree-name <arg>\t \t \tSet arg as the Output Tree Name " << endl ;
+  cout << "\t --verbose -V <arg>\t \t \tSet the verbose level of some of the object, 0 for nothing, 1 for normal printout. Error and warning are not affected" << endl ;
   cout << endl << "NPAnalysis only:"<<endl;
-  cout << "\t --run -R <arg>\t \t \t \t \t \t \t Set arg as the run to read file list" << endl  ;
-  cout << "\t --cal -C <arg>\t \t \t \t \t \t \t Set arg as the calibration file list" << endl ;
-  cout << "\t --disable-branch\t \t \t \t \t \t Disable of branch of Input tree except the one of the detector (faster)" << endl  ;
-  cout << "\t --generate-histo -GH\t \t \t \t \t \t  Instantiate the T*Spectra class of each detector" << endl ;
-  cout << "\t --check-histo -CH\t \t \t \t \t \t  Check if the Histogram looks ok and change there color if not" << endl ;
-  cout << "\t --input-physical -IP\t \t \t \t \t \t Consider the Input file is containing Physics Class instead of Data Class. Output branches associate to the detector are not activated" << endl  ;
-  cout << "\t -L <arg>\t \t \t \t \t \t Limite the number of envent to be analysed to arg" << endl ;
+  cout << "\t --run -R <arg>\t \t \t \tSet arg as the run to read file list" << endl  ;
+  cout << "\t --cal -C <arg>\t \t \t \tSet arg as the calibration file list" << endl ;
+  cout << "\t --disable-branch\t \t \tDisable of branch of Input tree except the one of the detector (faster)" << endl  ;
+  cout << "\t --generate-histo -GH\t \t \tInstantiate the T*Spectra class of each detector" << endl ;
+  cout << "\t --check-histo -CH\t \t \tCheck if the Histogram looks ok and change there color if not" << endl ;
+  cout << "\t --input-physical -IP\t \t \tConsider the Input file is containing Physics Class instead of Data Class. Output branches associate to the detector are not activated" << endl  ;
+  cout << "\t -L <arg>\t \t \t \tLimite the number of envent to be analysed to arg" << endl ;
+  cout << "\t --last-sim\t \t \t \tIgnore the list of Run to treat if any and analysed the last simulated file" << endl ;
+  cout << "\t --last-phy\t \t \t \tIgnore the list of Run to treat if any and analysed the last Physics file" << endl ;
+  cout << "\t --last-res\t \t \t \tIgnore the list of Run to treat if any and analysed the last Result file" << endl ;
+  cout << "\t --last-any\t \t \t \tIgnore the list of Run to treat if any and analysed the last root file with a non standard Tree name" << endl ;
   cout << endl << endl ;
-  
+
   // exit current program
   exit(1);
 }
@@ -293,4 +317,22 @@ void NPOptionManager::Destroy(){
     instance = 0;
   }
 }
+////////////////////////////////////////////////////////////////////////////////
+string NPOptionManager::GetLastFile(){
+  string path = getenv("NPTOOL");
+  if(fLastSimFile)
+    return (path+"/.last_sim_file");
+
+  else if(fLastPhyFile)
+    return (path+"/.last_phy_file");
+
+  else if(fLastResFile)
+    return (path+"/.last_res_file");
 
+  else if(fLastAnyFile)
+    return (path+"/.last_any_file");
+
+  else
+    return "VOID";
+
+}
diff --git a/NPLib/Core/NPOptionManager.h b/NPLib/Core/NPOptionManager.h
index 62239fd8508fa45597d0aa9ef8d737f3fd6fe475..fa3b6a20536fa4f6d354654c0ebb2396db108481 100644
--- a/NPLib/Core/NPOptionManager.h
+++ b/NPLib/Core/NPOptionManager.h
@@ -28,8 +28,7 @@
 #include <string>
 using namespace std;
 
-class NPOptionManager
-{
+class NPOptionManager{
    public:
       // The analysis class is designed to be a singleton (i.e. only one instance
       // can exist). A member function called Instance is defined, which allows
@@ -90,6 +89,7 @@ class NPOptionManager
       string GetRunToReadFile()            {return fRunToReadFileName;}
       string GetCalibrationFile()          {return fCalibrationFileName;}
       string GetOutputFile()               {return fOutputFileName;}
+      string GetOutputTreeName()           {return fOutputTreeName;}
       bool   GetDisableAllBranchOption()   {return fDisableAllBranchOption;}
       bool   GetInputPhysicalTreeOption()  {return fInputPhysicalTreeOption;}
       bool   GetGenerateHistoOption()      {return fGenerateHistoOption;}
@@ -97,7 +97,8 @@ class NPOptionManager
       bool   GetPROOF()                    {return fPROOFMode;}
       int    GetVerboseLevel()             {return fVerboseLevel;}
       int    GetNumberOfEntryToAnalyse()   {return fNumberOfEntryToAnalyse;} 
-
+      string GetLastFile();                 
+     
       // Setters
       void SetReactionFile(string name)       {fReactionFileName = name;CheckEventGenerator();}
       void SetDetectorFile(string name)       {fDetectorFileName = name;CheckDetectorConfiguration();}
@@ -111,17 +112,23 @@ class NPOptionManager
       string fDefaultRunToReadFileName;
       string fDefaultCalibrationFileName;
       string fDefaultOutputFileName;
+      string fDefaultOutputTreeName;
       // assigned values
       string fReactionFileName;
       string fDetectorFileName;
       string fRunToReadFileName;
       string fCalibrationFileName;
       string fOutputFileName;
+      string fOutputTreeName;
       bool   fDisableAllBranchOption;
       bool   fInputPhysicalTreeOption;
       bool   fGenerateHistoOption;
       bool   fCheckHistoOption;
       bool   fPROOFMode; // if true, the system run in a pROOF environment
+      bool   fLastSimFile;
+      bool   fLastPhyFile;
+      bool   fLastResFile;
+      bool   fLastAnyFile;
       int    fVerboseLevel; // 0 for not talk, 1 for talking
       int    fNumberOfEntryToAnalyse; // use to limit the number of analysed in NPA
 };
diff --git a/NPLib/Core/RootInput.cxx b/NPLib/Core/RootInput.cxx
index 6045c4792bfad1260861986b6099f46b12512e52..dc6f7c38cfdc6a8306eff2e43711ef51475adc89 100644
--- a/NPLib/Core/RootInput.cxx
+++ b/NPLib/Core/RootInput.cxx
@@ -29,7 +29,7 @@
 
 #include "RootInput.h"
 #include "TAsciiFile.h"
-
+#include "NPOptionManager.h"
 #include "TEnv.h"
 RootInput* RootInput::instance = 0;
 ////////////////////////////////////////////////////////////////////////////////
@@ -53,11 +53,16 @@ void RootInput::Destroy(){
 
 ////////////////////////////////////////////////////////////////////////////////
 RootInput::RootInput(string configFileName){
+  string lastfile= NPOptionManager::getInstance()->GetLastFile();
+  if(lastfile!="VOID"){
+    configFileName = lastfile;
+  }
+
   // Setting Root Parameter
   gEnv->SetValue("TFile.AsyncPrefetching", 1);
   gEnv->SetValue("TTreeCache.Size",300000000);
   gEnv->SetValue("TTreeCache.Prefill",1);
-  
+
   NumberOfFriend = 0;
   bool CheckTreeName     = false;
   bool CheckRootFileName = false;
@@ -66,20 +71,21 @@ RootInput::RootInput(string configFileName){
   string lineBuffer, dataBuffer;
 
   // Open file
+  cout << endl;
+  cout << "/////////// ROOT Input files ///////////" << endl;
+  cout << "Initializing input TChain" << endl;
+
   ifstream inputConfigFile;
   inputConfigFile.open(configFileName.c_str());
 
   pRootFile  = NULL;
   pRootChain = new TChain();
 
-  cout << endl;
-  cout << "/////////// ROOT Input files ///////////" << endl;
-  cout << "Initializing input TChain" << endl;
-
-  if (!inputConfigFile) {
+  if (!inputConfigFile.is_open()) {
     cout << "\033[1;31mError : Run to Read file :" << configFileName << " not found\033[0m" << endl; 
     exit(1);
   }
+
   else {
     while (!inputConfigFile.eof()) {
       getline(inputConfigFile, lineBuffer);
@@ -92,23 +98,24 @@ RootInput::RootInput(string configFileName){
         CheckTreeName = true ;
         // If the tree come from a simulation, the InteractionCoordinates
         // and InitialConditions lib are loaded
-
+        if(dataBuffer=="SimulatedTree"){
 #ifdef __linux__
-        std::string SHARED_LIB_EXTENSION = ".so";
+          std::string SHARED_LIB_EXTENSION = ".so";
 #endif
 
 #ifdef __FreeBSD__
-        std::string SHARED_LIB_EXTENSION = ".so";
+          std::string SHARED_LIB_EXTENSION = ".so";
 #endif
 
 #ifdef __APPLE__
-        std::string SHARED_LIB_EXTENSION = ".dylib";
+          std::string SHARED_LIB_EXTENSION = ".dylib";
 #endif
 
-        string libName="libNPInteractionCoordinates"+SHARED_LIB_EXTENSION;
-        dlopen(libName.c_str(),RTLD_NOW);
-        libName="libNPInitialConditions"+SHARED_LIB_EXTENSION;
-        dlopen(libName.c_str(),RTLD_NOW);
+          string libName="libNPInteractionCoordinates"+SHARED_LIB_EXTENSION;
+          dlopen(libName.c_str(),RTLD_NOW);
+          libName="libNPInitialConditions"+SHARED_LIB_EXTENSION;
+          dlopen(libName.c_str(),RTLD_NOW);
+        }
       }
 
       // search for token giving the list of Root files to treat
@@ -117,7 +124,7 @@ RootInput::RootInput(string configFileName){
 
         while (!inputConfigFile.eof()) {
           inputConfigFile >> dataBuffer;
-
+          
           // ignore comment Line 
           if (dataBuffer.compare(0, 1, "%") == 0) {
             inputConfigFile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
@@ -143,7 +150,7 @@ RootInput::RootInput(string configFileName){
 
   if (!CheckRootFileName || !CheckTreeName) 
     cout << "\033[1;33mWARNING: Token not found for InputTree Declaration : Input Tree may not be instantiate properly\033[0m" << endl;
-  
+
 }
 
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/NPLib/Core/RootOutput.cxx b/NPLib/Core/RootOutput.cxx
index 7804d207bcb43a679079148238bf9eca6b6970f7..eb75feaea6f63dc103a0930e999c6834e42f77cf 100644
--- a/NPLib/Core/RootOutput.cxx
+++ b/NPLib/Core/RootOutput.cxx
@@ -21,6 +21,7 @@
  *****************************************************************************/
 
 #include <iostream>
+#include <fstream>
 #include <cstdlib>
 
 #include "RootOutput.h"
@@ -31,48 +32,95 @@ using namespace std;
 RootOutput* RootOutput::instance = 0;
 ////////////////////////////////////////////////////////////////////////////////
 RootOutput* RootOutput::getInstance(TString fileNameBase, TString treeNameBase){
-   // A new instance of RootOutput is created if it does not exist:
-   if (instance == 0) {
-      instance = new RootOutput(fileNameBase, treeNameBase);
-   }
+  // A new instance of RootOutput is created if it does not exist:
+  if (instance == 0) {
+    instance = new RootOutput(fileNameBase, treeNameBase);
+  }
 
-   // The instance of RootOutput is returned:
-   return instance;
+  // The instance of RootOutput is returned:
+  return instance;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void RootOutput::Destroy(){ 
-   if (instance != 0) {
-      delete instance;
-      instance = 0;
-   }
+  if (instance != 0) {
+    delete instance;
+    instance = 0;
+  }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 RootOutput::RootOutput(TString fileNameBase, TString treeNameBase){
-   TDirectory* currentPath= gDirectory;
+  TDirectory* currentPath= gDirectory;
 
-   // The file extension is added to the file name:
-   TString GlobalPath = getenv("NPTOOL");
-   
+  // The file extension is added to the file name:
+  TString GlobalPath = getenv("NPTOOL");
 
-   // The ROOT file is created
+  // The ROOT file is created
   if(!NPOptionManager::getInstance()->GetPROOF()){
     TString fileName = GlobalPath + "/Outputs/";
     if (fileNameBase.Contains("root")) fileName += fileNameBase;
     else fileName += fileNameBase + ".root";
-   
-      pRootFile = new TFile(fileName, "RECREATE");
-  }
+
+    pRootFile = new TFile(fileName, "RECREATE");
+
+    if(treeNameBase=="SimulatedTree"){
+      string path = getenv("NPTOOL");
+        path+="/.last_sim_file";
+      ofstream last_sim_file(path.c_str());
+      last_sim_file << "TTreeName" << endl 
+       << "  " << treeNameBase <<endl
+       << "RootFileName" <<endl
+       << "  " << fileName<<endl;
+      last_sim_file.close();
+    }
+
+    else if(treeNameBase=="PhysicsTree"){
+      string path = getenv("NPTOOL");
+        path+="/.last_phy_file";
+      ofstream last_phy_file(path.c_str());
+      last_phy_file << "TTreeName" << endl 
+       << "  " << treeNameBase <<endl
+       << "RootFileName" <<endl
+       << "  " << fileName<<endl;
+      last_phy_file.close();
+    }
+
+
+    else if(treeNameBase=="ResultTree"){
+      string path = getenv("NPTOOL");
+      path+="/.last_res_file";
+      ofstream last_res_file(path.c_str());
+      last_res_file << "TTreeName" << endl 
+       << "  " << treeNameBase <<endl
+       << "RootFileName" <<endl
+       << "  " << fileName<<endl;
+      last_res_file.close();
+    }
   
+    else{
+      string path = getenv("NPTOOL");
+        path+="/.last_any_file";
+      ofstream last_any_file(path.c_str());
+      last_any_file << "TTreeName" << endl 
+       << "  " << treeNameBase <<endl
+       << "RootFileName" <<endl
+       << "  " << fileName << endl;
+      last_any_file.close();
+    }
+
+
+
+  }
+
   else{ // the file path must be the current directory
     // Does not create the Output file at instantiation
     pRootFile = 0 ;
   }
-  
+
   pRootTree = new TTree(treeNameBase, "Data created / analysed with the NPTool package");
   pRootList = new TList();
-  
+
   // Init TAsciiFile objects
   InitAsciiFiles();
   gDirectory->cd(currentPath->GetPath()); 
@@ -85,96 +133,96 @@ RootOutput::RootOutput(TString fileNameBase, TString treeNameBase){
 
 ////////////////////////////////////////////////////////////////////////////////
 void RootOutput::InitAsciiFiles(){
-   // get NPOptionManager pointer
-   NPOptionManager* OptionManager  = NPOptionManager::getInstance();
-
-   // Event generator
-   // Get file name from NPOptionManager
-   TString fileNameEG = OptionManager->GetReactionFile();
-   pEventGenerator = new TAsciiFile();
-   pEventGenerator->SetNameTitle("EventGenerator", fileNameEG.Data());
-   pEventGenerator->Append(fileNameEG.Data());
-
-   // Detector configuration 
-   // Get file name from NPOptionManager
-   TString fileNameDC = OptionManager->GetDetectorFile();
-   pDetectorConfiguration = new TAsciiFile();
-   pDetectorConfiguration->SetNameTitle("DetectorConfiguration", fileNameDC.Data());
-   pDetectorConfiguration->Append(fileNameDC.Data());
-
-   // 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());
-   }
-
-   // Calibration files
-   pCalibrationFile = new TAsciiFile();
-   if (!OptionManager->IsDefault("Calibration")) {
-      TString fileNameCal = OptionManager->GetCalibrationFile();
-      pCalibrationFile->SetNameTitle("Calibration", fileNameCal.Data());
-   }
-
-   // Analysis configuration files
-   pAnalysisConfigFile = new TAsciiFile();
-   pAnalysisConfigFile->SetNameTitle("AnalysisConfig", "AnalysisConfig");
+  // get NPOptionManager pointer
+  NPOptionManager* OptionManager  = NPOptionManager::getInstance();
+
+  // Event generator
+  // Get file name from NPOptionManager
+  TString fileNameEG = OptionManager->GetReactionFile();
+  pEventGenerator = new TAsciiFile();
+  pEventGenerator->SetNameTitle("EventGenerator", fileNameEG.Data());
+  pEventGenerator->Append(fileNameEG.Data());
+
+  // Detector configuration 
+  // Get file name from NPOptionManager
+  TString fileNameDC = OptionManager->GetDetectorFile();
+  pDetectorConfiguration = new TAsciiFile();
+  pDetectorConfiguration->SetNameTitle("DetectorConfiguration", fileNameDC.Data());
+  pDetectorConfiguration->Append(fileNameDC.Data());
+
+  // 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());
+  }
+
+  // Calibration files
+  pCalibrationFile = new TAsciiFile();
+  if (!OptionManager->IsDefault("Calibration")) {
+    TString fileNameCal = OptionManager->GetCalibrationFile();
+    pCalibrationFile->SetNameTitle("Calibration", fileNameCal.Data());
+  }
+
+  // Analysis configuration files
+  pAnalysisConfigFile = new TAsciiFile();
+  pAnalysisConfigFile->SetNameTitle("AnalysisConfig", "AnalysisConfig");
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 RootOutput::~RootOutput(){ 
-    // The data is written to the file and the tree is closed:
-    if (pRootFile && !NPOptionManager::getInstance()->GetPROOF()) {
-      TDirectory* currentPath= gDirectory;
-      gDirectory->cd(pRootFile->GetPath());
-      cout << endl;
-      cout << endl << "Root Output summary" << endl;
-      cout << "  - Number of entries in the Tree: " << pRootTree->GetEntries() << endl;
-      cout << "  - Number of bites written to file: " << pRootTree->Write("", TObject::kOverwrite) << endl;
-
-      // write TAsciiFile if used
-      // EventGenerator
-      if (!pEventGenerator->IsEmpty()) pEventGenerator->Write();
-      // DetectorConfiguration
-      if (!pDetectorConfiguration->IsEmpty()) pDetectorConfiguration->Write();
-      // CalibrationFile
-      if (!pCalibrationFile->IsEmpty()) pCalibrationFile->Write();
-      // RunToTreatFile
-      if (!pRunToTreatFile->IsEmpty()) pRunToTreatFile->Write();
-      // Analysis ConfigFile
-      if (!pAnalysisConfigFile->IsEmpty()) pAnalysisConfigFile->Write();
-      pRootFile->Flush();
-       gDirectory->cd(currentPath->GetPath());
-      pRootFile->Close();
-    }
-  
-    else if (pRootFile && NPOptionManager::getInstance()->GetPROOF()){
-      if (!pEventGenerator->IsEmpty()) pEventGenerator->Write();
-      // DetectorConfiguration
-      if (!pDetectorConfiguration->IsEmpty()) pDetectorConfiguration->Write();
-      // CalibrationFile
-      if (!pCalibrationFile->IsEmpty()) pCalibrationFile->Write();
-      // RunToTreatFile
-      if (!pRunToTreatFile->IsEmpty()) pRunToTreatFile->Write();
-      // Analysis ConfigFile
-      if (!pAnalysisConfigFile->IsEmpty()) pAnalysisConfigFile->Write();
-    }
-  
-    else if(!pRootFile && NPOptionManager::getInstance()->GetPROOF()){
-      
-    }
-  
-    else {
-      cout << "\033[1;31mNo histograms and Tree !\033[0m" << endl;
-    }
+  // The data is written to the file and the tree is closed:
+  if (pRootFile && !NPOptionManager::getInstance()->GetPROOF()) {
+    TDirectory* currentPath= gDirectory;
+    gDirectory->cd(pRootFile->GetPath());
+    cout << endl;
+    cout << endl << "Root Output summary" << endl;
+    cout << "  - Number of entries in the Tree: " << pRootTree->GetEntries() << endl;
+    cout << "  - Number of bites written to file: " << pRootTree->Write("", TObject::kOverwrite) << endl;
+
+    // write TAsciiFile if used
+    // EventGenerator
+    if (!pEventGenerator->IsEmpty()) pEventGenerator->Write();
+    // DetectorConfiguration
+    if (!pDetectorConfiguration->IsEmpty()) pDetectorConfiguration->Write();
+    // CalibrationFile
+    if (!pCalibrationFile->IsEmpty()) pCalibrationFile->Write();
+    // RunToTreatFile
+    if (!pRunToTreatFile->IsEmpty()) pRunToTreatFile->Write();
+    // Analysis ConfigFile
+    if (!pAnalysisConfigFile->IsEmpty()) pAnalysisConfigFile->Write();
+    pRootFile->Flush();
+    gDirectory->cd(currentPath->GetPath());
+    pRootFile->Close();
+  }
+
+  else if (pRootFile && NPOptionManager::getInstance()->GetPROOF()){
+    if (!pEventGenerator->IsEmpty()) pEventGenerator->Write();
+    // DetectorConfiguration
+    if (!pDetectorConfiguration->IsEmpty()) pDetectorConfiguration->Write();
+    // CalibrationFile
+    if (!pCalibrationFile->IsEmpty()) pCalibrationFile->Write();
+    // RunToTreatFile
+    if (!pRunToTreatFile->IsEmpty()) pRunToTreatFile->Write();
+    // Analysis ConfigFile
+    if (!pAnalysisConfigFile->IsEmpty()) pAnalysisConfigFile->Write();
+  }
+
+  else if(!pRootFile && NPOptionManager::getInstance()->GetPROOF()){
+
+  }
+
+  else {
+    cout << "\033[1;31mNo histograms and Tree !\033[0m" << endl;
+  }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 TFile* RootOutput::InitFile(TString fileNameBase){
-  
+
   if(NPOptionManager::getInstance()->GetPROOF()){
     TString GlobalPath = getenv("NPTOOL");
     TString fileName = GlobalPath + "/Outputs/Analysis/";
@@ -184,7 +232,7 @@ TFile* RootOutput::InitFile(TString fileNameBase){
     pRootFile->Flush();
     return pRootFile;
   }
-  
+
   else{
     cout << "ERROR: Do not use RootOutput::InitFile without a proof environment (use --proof option to NPTool)" << endl ;
     exit(1);
diff --git a/NPLib/Utility/npanalysis.cxx b/NPLib/Utility/npanalysis.cxx
index de7e7e08e25ab49d7f7656211b328a044ef97bc8..96ff8bf532615bfd124da3103c85c670fc56234c 100644
--- a/NPLib/Utility/npanalysis.cxx
+++ b/NPLib/Utility/npanalysis.cxx
@@ -38,7 +38,6 @@ int main(int argc , char** argv){
     string name = RootInput::getInstance(inputfilename)->DumpAsciiFile("DetectorConfiguration");
     myOptionManager->SetDetectorFile(name);
     cout << "\033[1;33mWarning: No Detector file given, using Input tree one\033[0m"<<endl;;
-
   }
 
   if (myOptionManager->IsDefault("EventGenerator")) {
@@ -52,7 +51,28 @@ int main(int argc , char** argv){
   string OutputfileName      = myOptionManager->GetOutputFile();
 
   // Instantiate RootOutput
-  RootOutput::getInstance("Analysis/"+OutputfileName, "ResultTree");
+  string TreeName="NPTool_Tree";
+
+  // User decided of the name
+  if(!myOptionManager->IsDefault("TreeName")){
+    TreeName=myOptionManager->GetOutputTreeName();
+  }
+
+  // Case of a Physics tree produced
+  else if(!myOptionManager->GetInputPhysicalTreeOption()){ //
+    TreeName="PhysicsTree";
+    if(myOptionManager->IsDefault("OutputFileName"))
+      OutputfileName="PhysicsTree";
+  }
+  
+  // Case of Result tree produced
+  else{
+    TreeName="ResultTree";
+    if(myOptionManager->IsDefault("OutputFileName"))
+      OutputfileName="ResultTree";
+  }
+
+  RootOutput::getInstance("Analysis/"+OutputfileName,TreeName);
   TTree* tree= RootOutput::getInstance()->GetTree();
 
   // Instantiate the detector using a file