diff --git a/NPAnalysis/Template/src/Analysis.cc b/NPAnalysis/Template/src/Analysis.cc
index a8e22c0c74c9655092b6c04db4ebebc2552435fe..2dbcabf3d51083ae24271fc21c06f941d228a522 100644
--- a/NPAnalysis/Template/src/Analysis.cc
+++ b/NPAnalysis/Template/src/Analysis.cc
@@ -12,10 +12,6 @@ int main(int argc, char** argv)
    RootInput:: getInstance(runToReadfileName);
 
    // if input files are not given, use those from TAsciiFile
-   if (myOptionManager->IsDefault("EventGenerator")) {
-      string name = RootInput::getInstance()->DumpAsciiFile("EventGenerator");
-      myOptionManager->SetReactionFile(name);
-   }
    if (myOptionManager->IsDefault("DetectorConfiguration")) {
       string name = RootInput::getInstance()->DumpAsciiFile("DetectorConfiguration");
       myOptionManager->SetDetectorFile(name);
@@ -25,15 +21,10 @@ int main(int argc, char** argv)
    RootOutput::getInstance("Analysis/Template_AnalyzedData", "AnalysedTree");
 
    // get input files from NPOptionManager
-   string reactionfileName    = myOptionManager->GetReactionFile();
    string detectorfileName    = myOptionManager->GetDetectorFile();
    string calibrationfileName = myOptionManager->GetCalibrationFile();
    string OutputfileName      = myOptionManager->GetOutputFile();
 
-   // Instantiate a Reaction
-   NPL::Reaction* myReaction = new Reaction();
-   myReaction->ReadConfigurationFile(reactionfileName);
-
    // Instantiate the detector using a file
    NPA::DetectorManager* myDetector = new DetectorManager();
    myDetector->ReadConfigurationFile(detectorfileName);
diff --git a/NPAnalysis/must2/src/Analysis.cc b/NPAnalysis/must2/src/Analysis.cc
index 83abf769f676fa9db7f8dc58a83dc7ef8a38d0a7..7b0e4d8ae64b54e3b4ae9e098f3a672de24b0e05 100644
--- a/NPAnalysis/must2/src/Analysis.cc
+++ b/NPAnalysis/must2/src/Analysis.cc
@@ -87,7 +87,7 @@ int main(int argc,char** argv)
    Chain->SetBranchStatus("InitialConditions", 1);
       
    // Get TMust2Physics pointer
-   TMust2Physics *M2 	 = (TMust2Physics*)  myDetector -> m_Detector["MUST2"] 	;
+   TMust2Physics *M2 	 = (TMust2Physics*)  myDetector -> GetDetector("MUST2")	;
             
    // define user spectra
    TH2F* DE_E_protons     = new TH2F("DE_E_protons",       "DE_E et cut protons", 1000,    0, 25000, 1000,   0, 25000);
diff --git a/NPLib/IORoot/RootInput.cxx b/NPLib/IORoot/RootInput.cxx
index 1e18c5f46392a79a0472eaa74156ebd4640336bb..7838d255f1aa3388f624e2b79f75becb0a3025cc 100644
--- a/NPLib/IORoot/RootInput.cxx
+++ b/NPLib/IORoot/RootInput.cxx
@@ -209,32 +209,42 @@ string RootInput::DumpAsciiFile(const char* type, const char* folder)
    string stype = type;
    if (stype == "EventGenerator") {
       TAsciiFile *aFile = (TAsciiFile*)pRootFile->Get(stype.c_str());
-      // build file name
-      string title = aFile->GetTitle();
-      unsigned int pos = title.rfind("/");
-      if (pos != string::npos) name = sfolder + title.substr(pos);
-      else name = sfolder + "/" + title;
-      aFile->WriteToFile(name.c_str());
+      
+      if(aFile)
+         {
+            // build file name
+            string title = aFile->GetTitle();
+            unsigned int pos = title.rfind("/");
+            if (pos != string::npos) name = sfolder + title.substr(pos);
+            else name = sfolder + "/" + title;
+            aFile->WriteToFile(name.c_str());
+         }
    }
    
    else if (stype == "DetectorConfiguration") {
       TAsciiFile *aFile = (TAsciiFile*)pRootFile->Get(stype.c_str());
-      // build file name
-      string title = aFile->GetTitle();
-      unsigned int pos = title.rfind("/");
-      if (pos != string::npos) name = sfolder + title.substr(pos);
-      else name = sfolder + "/" + title;
-      aFile->WriteToFile(name.c_str());
+      if(aFile)
+         {
+            // build file name
+            string title = aFile->GetTitle();
+            unsigned int pos = title.rfind("/");
+            if (pos != string::npos) name = sfolder + title.substr(pos);
+            else name = sfolder + "/" + title;
+            aFile->WriteToFile(name.c_str());
+         }
    }
    
    else if (stype == "Calibration") {
       TAsciiFile *aFile = (TAsciiFile*)pRootFile->Get(stype.c_str());
-      // build file name
-      string title = aFile->GetTitle();
-      unsigned int pos = title.rfind("/");
-      if (pos != string::npos) name = sfolder + title.substr(pos);
-      else name = sfolder + "/" + title;
-      aFile->WriteToFile(name.c_str());
+      if(aFile)
+         {
+            // build file name
+            string title = aFile->GetTitle();
+            unsigned int pos = title.rfind("/");
+            if (pos != string::npos) name = sfolder + title.substr(pos);
+            else name = sfolder + "/" + title;
+            aFile->WriteToFile(name.c_str());
+         }
    }
    
    else if (stype == "RunToTreat") {
diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx
index 5749c8e56f5363fd36d304ed6ae91e62c52175a9..356ee830c118eaaf80b73ac126476eae3916a6bf 100644
--- a/NPLib/VDetector/DetectorManager.cxx
+++ b/NPLib/VDetector/DetectorManager.cxx
@@ -398,7 +398,22 @@ void DetectorManager::AddDetector(string DetectorName , VDetector* newDetector)
    newDetector->AddParameterToCalibrationManager();
 }
 
-
+/////////////////////////////////////////////////////////////////////////////////////////////////
+VDetector* DetectorManager::GetDetector(string name)
+{
+   map<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 << "***************************************************************************************" << endl;
+      cout << endl;
+      exit(1);
+   }
+   
+}
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 void DetectorManager::ClearEventPhysics()
diff --git a/NPLib/VDetector/DetectorManager.h b/NPLib/VDetector/DetectorManager.h
index 3b272c9915788426e7fa5d5e3df89c9a1142a8e4..edeaddc420596898ca12e00e7e7573fc4493a114 100644
--- a/NPLib/VDetector/DetectorManager.h
+++ b/NPLib/VDetector/DetectorManager.h
@@ -22,16 +22,17 @@ namespace NPA
 
             public:
                // Read stream at Path and pick-up Token declaration of Detector
-               void   ReadConfigurationFile(string Path);
-               void   BuildPhysicalEvent();
-               void   BuildSimplePhysicalEvent();
-               void   InitializeRootInput();
-               void   InitializeRootOutput();
-               void   AddDetector(string,VDetector*);
-               void   ClearEventPhysics();
-               void   ClearEventData();
-
-            public:   
+               void        ReadConfigurationFile(string Path);
+               void        BuildPhysicalEvent();
+               void        BuildSimplePhysicalEvent();
+               void        InitializeRootInput();
+               void        InitializeRootOutput();
+               void        AddDetector(string,VDetector*);
+               VDetector*  GetDetector(string);
+               void        ClearEventPhysics();
+               void        ClearEventData();
+
+            private:   
                // The map containning all detectors
                // Using a Map one can access to any detector using its name
                map<string,VDetector*> m_Detector;