From d59ed51a05f92919ef16fe66dfc5ecf664b5b40c Mon Sep 17 00:00:00 2001
From: adrien-matta <a.matta@surrey.ac.uk>
Date: Thu, 24 Dec 2015 15:24:15 +0100
Subject: [PATCH] * further progress to  nptool-wizard* further progress to *
 nptool-wizard

---
 NPLib/CMakeLists.txt                          |  5 ++-
 .../NPLib/TDETECTORNAMEData.h                 |  5 ++-
 NPLib/Utility/nptool-cleaner.cxx              | 37 ++++++++++---------
 NPLib/Utility/nptool-wizard.cxx               |  4 +-
 4 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/NPLib/CMakeLists.txt b/NPLib/CMakeLists.txt
index fb4c51efc..3a91dfab4 100644
--- a/NPLib/CMakeLists.txt
+++ b/NPLib/CMakeLists.txt
@@ -71,11 +71,14 @@ MACRO(subdirlist result curdir)
     IF(IS_DIRECTORY ${curdir}/${child})
       string(COMPARE EQUAL "${child}" "CMakeFiles" r0)
       string(COMPARE EQUAL "${child}" ".DS_Store" r1) 
+      set(det "")
+      string(REPLACE "Detectors/" "" det ${child})
+
       IF(NOT r0 AND NOT r1)
         string(COMPARE EQUAL "${DETLIST}" "" r2)
         IF(r2)
           LIST(APPEND dirlist ${child})
-        ELSEIF(${DETLIST} MATCHES ".*${child}.*" )
+        ELSEIF(${DETLIST} MATCHES ".*${det}.*" )
           LIST(APPEND dirlist ${child}) 
         ENDIF()
       ENDIF()
diff --git a/NPLib/Utility/DetectorSkeleton/NPLib/TDETECTORNAMEData.h b/NPLib/Utility/DetectorSkeleton/NPLib/TDETECTORNAMEData.h
index 0ca4d20de..5b8ae916a 100644
--- a/NPLib/Utility/DetectorSkeleton/NPLib/TDETECTORNAMEData.h
+++ b/NPLib/Utility/DetectorSkeleton/NPLib/TDETECTORNAMEData.h
@@ -54,13 +54,15 @@ class TDETECTORNAMEData : public TObject {
   public: // Getters and Setters
           // Prefere inline declaration to avoid unnecessary called of 
           // frequently used methods
-          // add //! to avoid root to create dictionnary to the method
+          // add //! to avoid root to create dictionnary for the method
     /////////////////////           SETTERS           ////////////////////////
     inline void SetE_DetectorNbr(const UShort_t& DetNbr)
       {fDETECTORNAME_E_DetectorNbr.push_back(DetNbr);} //!
     inline void Set_Energy(const Double_t& Energy)
       {fDETECTORNAME_Energy.push_back(Energy);}//!
 
+
+    // Prefer global stter that guaranty the vector are al the same size
     inline void SetEnergy(const UShort_t& DetNbr,const Double_t& Energy)	{
       SetE_DetectorNbr(DetNbr);
       Set_Energy(Energy);
@@ -72,6 +74,7 @@ class TDETECTORNAMEData : public TObject {
       {fDETECTORNAME_Time.push_back(Time);}//!
 
 
+    // Prefer global stter that guaranty the vector are al the same size
     inline void SetTime(const UShort_t& DetNbr,const Double_t& Time)	{
       SetT_DetectorNbr(DetNbr);
       Set_Time(Time);
diff --git a/NPLib/Utility/nptool-cleaner.cxx b/NPLib/Utility/nptool-cleaner.cxx
index 7e74fb5f1..37abd716a 100644
--- a/NPLib/Utility/nptool-cleaner.cxx
+++ b/NPLib/Utility/nptool-cleaner.cxx
@@ -52,48 +52,49 @@ int main(int argc , char** argv){
   
   std::string command,command2;
   // Dict     
-  command = "ls ./*/*Dict* > /dev/null 2>/dev/null";
+  command = "ls ./*/*/*Dict* > /dev/null 2>/dev/null";
   return_value=system(command.c_str());             
   if(!return_value){
-    command2 = "rm -f ./*/*Dict* > /dev/null 2>/dev/null";
+    command2 = "rm -f ./*/*/*Dict* > /dev/null 2>/dev/null";
     return_value=system(command2.c_str());   
   }  
    // DetectorClassList
-  command = "ls ./DetectorClassList.txt > /dev/null 2>/dev/null";
+  command = "ls ./ClassList.txt > /dev/null 2>/dev/null";
   return_value=system(command.c_str());             
   if(!return_value){
-    command2 = "rm -f ./DetectorClassList.txt > /dev/null 2>/dev/null";
+    command2 = "rm -f ./ClassList.txt > /dev/null 2>/dev/null";
     return_value=system(command2.c_str());   
   }
   
   // pcm 
-  command = "ls ./*/*.pcm > /dev/null 2>/dev/null";
+  command = "ls ./*/*/*.pcm > /dev/null 2>/dev/null";
   return_value=system(command.c_str());             
   if(!return_value){
-    command2 = "rm -f ./*/*.pcm > /dev/null 2>/dev/null";
+    command2 = "rm -f ./*/*/*.pcm > /dev/null 2>/dev/null";
     return_value=system(command2.c_str());   
   }
  
   // rootmap 
-  command = "ls ./*/*.rootmap > /dev/null 2>/dev/null";
+  command = "ls ./*/*/*.rootmap > /dev/null 2>/dev/null";
   return_value=system(command.c_str());             
   if(!return_value){
-    command2 = "rm -f ./*/*.rootmap > /dev/null 2>/dev/null";
+    command2 = "rm -f ./*/*/*.rootmap > /dev/null 2>/dev/null";
     return_value=system(command2.c_str());   
   }
   
    // Makefile 
-  command = "ls ./*/Makefile > /dev/null 2>/dev/null";
+  command = "ls ./*/*/Makefile > /dev/null 2>/dev/null";
   return_value=system(command.c_str());             
   if(!return_value){
-    command2 = "rm -f ./*/Makefile > /dev/null 2>/dev/null";
+    command2 = "rm -f ./*/*/Makefile > /dev/null 2>/dev/null";
     return_value=system(command2.c_str());   
   }
    // ninja
-  command = "ls ./*.ninja > /dev/null 2>/dev/null";
+  command = "ls ./*/*/.ninja > /dev/null 2>/dev/null";
   return_value=system(command.c_str());             
   if(!return_value){
-    command2 = "rm -f ./*.ninja > /dev/null 2>/dev/null";
+// Prefer global stter that guaranty the vector are al the same size
+    command2 = "rm -f ./*/*/.ninja > /dev/null 2>/dev/null";
     return_value=system(command2.c_str());   
   }
    // lib 
@@ -111,10 +112,10 @@ int main(int argc , char** argv){
     return_value=system(command2.c_str());   
   }
    // CMakeFiles
-  command = "ls ./*/CMakeFiles > /dev/null 2>/dev/null";
+  command = "ls ./*/*/CMakeFiles > /dev/null 2>/dev/null";
   return_value=system(command.c_str());             
   if(!return_value){
-    command2 = "rm -f .Rf ./*/CMakeFiles > /dev/null 2>/dev/null";
+    command2 = "rm -f .Rf ./*/*/CMakeFiles > /dev/null 2>/dev/null";
     return_value=system(command2.c_str());   
     command2 = "rm -f .Rf ./CMakeFiles > /dev/null 2>/dev/null";
     return_value=system(command2.c_str());   
@@ -152,17 +153,17 @@ int main(int argc , char** argv){
     return_value=system(command2.c_str());   
   }
    // so 
-  command = "ls ./*/*.so > /dev/null 2>/dev/null";
+  command = "ls ./*/*/*.so > /dev/null 2>/dev/null";
   return_value=system(command.c_str());             
   if(!return_value){
-    command2 = "rm -f ./*/*.so > /dev/null 2>/dev/null";
+    command2 = "rm -f ./*/*/*.so > /dev/null 2>/dev/null";
     return_value=system(command2.c_str());   
   }
    // dylib
-  command = "ls ./*/*.dylib > /dev/null 2>/dev/null";
+  command = "ls ./*/*/*.dylib > /dev/null 2>/dev/null";
   return_value=system(command.c_str());             
   if(!return_value){
-    command2 = "rm -f ./*/*.dylib > /dev/null 2>/dev/null";
+    command2 = "rm -f ./*/*/*.dylib > /dev/null 2>/dev/null";
     return_value=system(command2.c_str());   
   }
     //bin 
diff --git a/NPLib/Utility/nptool-wizard.cxx b/NPLib/Utility/nptool-wizard.cxx
index a6cf05c10..b40e10a35 100644
--- a/NPLib/Utility/nptool-wizard.cxx
+++ b/NPLib/Utility/nptool-wizard.cxx
@@ -95,10 +95,10 @@ int main(int argc , char** argv){
   return_value = system(command.c_str());
 
   // Edit npl file
-  command = "sed -i '' -e \"s/DETECTORNAME/"+ answer +"/g\" "
+   command = "sed -i '' -e \"s/DETECTORNAME/"+ answer +"/g\" "
     + pathNPL + answer +"/* > /dev/null 2> /dev/null";
   return_value = system(command.c_str());
-
+ 
   command = "sed -i '' -e \"s/XAUTHORX/"+ author+"/g\" "
     + pathNPL + answer +"/* > /dev/null 2> /dev/null";
   return_value = system(command.c_str());
-- 
GitLab