From e04450de208f08e1743a676099a1aebaece7286d Mon Sep 17 00:00:00 2001
From: matta <matta@npt>
Date: Wed, 16 Feb 2011 23:40:55 +0000
Subject: [PATCH] * Adding CATS in NPL DetectorManager * Changing old naming
 convention ThinSi to SSSD

---
 .../DetectorConfiguration/Riken_65mm.detector | 10 +++---
 Inputs/DetectorConfiguration/SSSD.detector    | 19 +++++++++++
 Inputs/DetectorConfiguration/ThinSi.detector  | 19 -----------
 NPLib/SSSD/TSSSDPhysics.cxx                   | 30 ++++++++---------
 NPLib/VDetector/DetectorManager.cxx           | 33 +++++++++++++++----
 5 files changed, 66 insertions(+), 45 deletions(-)
 create mode 100644 Inputs/DetectorConfiguration/SSSD.detector
 delete mode 100644 Inputs/DetectorConfiguration/ThinSi.detector

diff --git a/Inputs/DetectorConfiguration/Riken_65mm.detector b/Inputs/DetectorConfiguration/Riken_65mm.detector
index 6e6994315..e835d16d5 100644
--- a/Inputs/DetectorConfiguration/Riken_65mm.detector
+++ b/Inputs/DetectorConfiguration/Riken_65mm.detector
@@ -128,30 +128,30 @@ VIS=    all
 
 
 %%%%%%%%%%%%%%%%%%%%%			
-AddThinSi			
+SSSDArray			
 %%%%%%%%%% Det 1 %%%%%%%%			
-ThinSi			
+SSSD			
 A=	17.61	9.85	104.11
 B=	64.48	9.85	85.31
 C=	58.66	56.29	70.79
 D=	11.79	56.29	89.69
 %			
 %%%%%%%%%% Det 2 %%%%%%%%			
-ThinSi			
+SSSD			
 A=	-11.79	56.29	89.59
 B=	-58.66	56.29	70.79
 C=	-64.48	9.85	85.31
 D=	-17.61	9.85	104.11
 %			
 %%%%%%%%%% Det 3 %%%%%%%%			
-ThinSi			
+SSSD			
 A=	-17.61	-9.85	104.11
 B=	-64.48	-9.85	85.31
 C=	-58.66	-56.29	70.79
 D=	-11.79	-56.29	89.59
 %			
 %%%%%%%%%% Det 4 %%%%%%%%			
-ThinSi			
+SSSD			
 A=	11.79	-56.29	89.59
 B=	58.66	-56.29	70.79
 C=	64.48	-9.85	85.31
diff --git a/Inputs/DetectorConfiguration/SSSD.detector b/Inputs/DetectorConfiguration/SSSD.detector
new file mode 100644
index 000000000..e3cbb377b
--- /dev/null
+++ b/Inputs/DetectorConfiguration/SSSD.detector
@@ -0,0 +1,19 @@
+%%%%%%%%%%%%%%%%%%%%         
+SSSDArray 
+%%%%%%%%% Det 1 %%%%%%%%         
+SSSD
+   A=   17.61   9.85   104.11
+   B=   64.48   9.85   85.31
+   C=   58.66   56.29   70.79
+   D=   11.79   56.29   89.69
+         
+%%%%%%%%% Det 2 %%%%%%%%         
+SSSD
+   THETA= 33
+   PHI= -130
+   R= 110
+   BETA= 0 0 -0
+   SIDE= right
+         
+
+
diff --git a/Inputs/DetectorConfiguration/ThinSi.detector b/Inputs/DetectorConfiguration/ThinSi.detector
deleted file mode 100644
index 352ff0601..000000000
--- a/Inputs/DetectorConfiguration/ThinSi.detector
+++ /dev/null
@@ -1,19 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%			
-AddThinSi			
-%%%%%%%%% Det 1 %%%%%%%%			
-ThinSi			
-A=	17.61	9.85	104.11
-B=	64.48	9.85	85.31
-C=	58.66	56.29	70.79
-D=	11.79	56.29	89.69
-			
-%%%%%%%%% Det 2 %%%%%%%%			
-ThinSi
-	THETA= 33
-	PHI= -130
-	R= 110
-	BETA= 0 0 -0
-	SIDE= right
-			
-
-
diff --git a/NPLib/SSSD/TSSSDPhysics.cxx b/NPLib/SSSD/TSSSDPhysics.cxx
index 5ba76ce55..a79aff3d0 100644
--- a/NPLib/SSSD/TSSSDPhysics.cxx
+++ b/NPLib/SSSD/TSSSDPhysics.cxx
@@ -94,10 +94,10 @@ void TSSSDPhysics::ReadConfiguration(string Path)
       
     getline(ConfigFile, LineBuffer);
 
-    //  If line is a Start Up ThinSi bloc, Reading toggle to true      
-        if (LineBuffer.compare(0, 6, "ThinSi") == 0) 
+    //  If line is a Start Up SSSD bloc, Reading toggle to true      
+        if (LineBuffer.compare(0, 4, "SSSD") == 0) 
           {
-            cout << "Detector found: " << endl   ;        
+            cout << "SSSD found: " << endl   ;        
             ReadingStatus = true ;
           }
 
@@ -114,22 +114,22 @@ void TSSSDPhysics::ReadConfiguration(string Path)
         if (DataBuffer.compare(0, 1, "%") == 0) {  ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );}
 
           //  Finding another telescope (safety), toggle out
-        else if (DataBuffer.compare(0, 6, "ThinSi") == 0) {
+        else if (DataBuffer.compare(0, 4, "SSSD") == 0) {
           cout << "WARNING: Another Telescope is find before standard sequence of Token, Error may occured in Telecope definition" << endl ;
           ReadingStatus = false ;
         }
 
-           //Position method
-             else if (DataBuffer=="A=") {
-                check_A = true;
-                ConfigFile >> DataBuffer ;
-                TLX = atof(DataBuffer.c_str()) ;
-                ConfigFile >> DataBuffer ;
-                TLY = atof(DataBuffer.c_str()) ;
-                ConfigFile >> DataBuffer ;
-                TLZ = atof(DataBuffer.c_str()) ;
-                cout << " A corner Position : (" << TLX << ";"<< TLY << ";"<< TLZ << ")"<<endl;
-             }
+        //Position method
+       else if (DataBuffer=="A=") {
+          check_A = true;
+          ConfigFile >> DataBuffer ;
+          TLX = atof(DataBuffer.c_str()) ;
+          ConfigFile >> DataBuffer ;
+          TLY = atof(DataBuffer.c_str()) ;
+          ConfigFile >> DataBuffer ;
+          TLZ = atof(DataBuffer.c_str()) ;
+          cout << " A corner Position : (" << TLX << ";"<< TLY << ";"<< TLZ << ")"<<endl;
+       }
         
         else if (DataBuffer=="B=") {
           check_B = true;
diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx
index 5c8250e8b..f9cfad7ee 100644
--- a/NPLib/VDetector/DetectorManager.cxx
+++ b/NPLib/VDetector/DetectorManager.cxx
@@ -7,6 +7,7 @@
 
 //   Detector   
 #include "TMust2Physics.h"
+#include "TCATSPhysics.h"
 #include "TSSSDPhysics.h"
 #include "TPlasticPhysics.h"
 #include "GaspardTracker.h"
@@ -47,7 +48,8 @@ void DetectorManager::ReadConfigurationFile(string Path)
 
    /////////Boolean////////////////////
    bool MUST2               = false;
-   bool AddThinSi           = false;
+   bool CATS                = false;
+   bool SSSD                = false;
    bool ScintillatorPlastic = false;
    bool GeneralTarget       = false;
    bool GPDTracker          = false;
@@ -159,7 +161,7 @@ void DetectorManager::ReadConfigurationFile(string Path)
       }
 
       ////////////////////////////////////////////
-      //////// Search for MUST2 Array  ////////
+      ////////  Search for MUST2 Array    ////////
       ////////////////////////////////////////////
       else if (LineBuffer.compare(0, 10, "MUST2Array") == 0 && MUST2 == false) {
          MUST2 = true;
@@ -177,6 +179,25 @@ void DetectorManager::ReadConfigurationFile(string Path)
          AddDetector("MUST2", myDetector);
       }
 
+      ////////////////////////////////////////////
+      ////////   Search for CATS Array    ////////
+      ////////////////////////////////////////////
+      else if (LineBuffer.compare(0, 9, "CATSArray") == 0 && CATS == false) {
+         MUST2 = true;
+         cout << "//////// CATS Array ////////" << endl << endl;
+
+         // Instantiate the new array as a VDetector Object
+         VDetector* myDetector = new TCATSPhysics();
+
+         // Read Position of Telescope
+         ConfigFile.close();
+         myDetector->ReadConfiguration(Path);
+         ConfigFile.open(Path.c_str());
+
+         // Add array to the VDetector Vector
+         AddDetector("CATS", myDetector);
+      }
+      
       ////////////////////////////////////////////
       ////////// Search for W1 (Micron)  /////////
       ////////////////////////////////////////////
@@ -197,11 +218,11 @@ void DetectorManager::ReadConfigurationFile(string Path)
       }
 
       ////////////////////////////////////////////
-      ////////// Search for ThinSi (SSSD)/////////
+      //////////      Search for SSSD    /////////
       ////////////////////////////////////////////
-      else if (LineBuffer.compare(0, 9, "AddThinSi") == 0 && AddThinSi == false) {
-         AddThinSi = true ;
-         cout << "//////// Thin Si ////////" << endl << endl;
+      else if (LineBuffer.compare(0, 9, "SSSDArray") == 0 && SSSD == false) {
+         SSSD = true ;
+         cout << "//////// SSSD ////////" << endl << endl;
 
          // Instantiate the new array as a VDetector Object
          VDetector* myDetector = new TSSSDPhysics();
-- 
GitLab