From 3dcb0ca134a15f90c464eb819d83bac7c26df2cc Mon Sep 17 00:00:00 2001
From: e657 <a.matta@surrey.ac.uk>
Date: Sun, 16 Mar 2014 20:56:09 +0100
Subject: [PATCH] Adapted ReadConfiguration for LaBr3 and SiLi

---
 NPLib/LaBr3/TLaBr3Physics.cxx | 50 +++-------------------------
 NPLib/LaBr3/TLaBr3Spectra.cxx |  3 +-
 NPLib/SiLi/TSiLiPhysics.cxx   | 61 ++---------------------------------
 3 files changed, 8 insertions(+), 106 deletions(-)

diff --git a/NPLib/LaBr3/TLaBr3Physics.cxx b/NPLib/LaBr3/TLaBr3Physics.cxx
index ff34a98f8..371eb1283 100644
--- a/NPLib/LaBr3/TLaBr3Physics.cxx
+++ b/NPLib/LaBr3/TLaBr3Physics.cxx
@@ -81,13 +81,8 @@ void TLaBr3Physics::ReadConfiguration(string Path)
       bool check_Theta = false          ;
       bool check_Phi  = false           ;
       bool check_R     = false          ;
-      bool check_Thickness = false      ;
       bool check_Radius = false         ;
-      bool check_LeadThickness = false  ;
-      bool check_Scintillator = false   ;
       bool check_Height = false         ;
-      bool check_Width = false          ;
-      bool check_Shape = false          ;
       bool check_X = false              ;
       bool check_Y = false              ;
       bool check_Z = false              ;      
@@ -102,7 +97,7 @@ void TLaBr3Physics::ReadConfiguration(string Path)
          if (LineBuffer.compare(0, 5, "LaBr3") == 0) 
             {
                cout << "///" << endl ;
-               cout << "Platic found: " << endl ;        
+               cout << "LaBr3 found: " << endl ;        
                ReadingStatus = true ;
             }
             
@@ -163,26 +158,14 @@ void TLaBr3Physics::ReadConfiguration(string Path)
                }
                
                
-               //General
-               else if (DataBuffer=="Shape=") {
-                  check_Shape = true;
-                  ConfigFile >> DataBuffer ;
-                  cout << "Shape:  " << DataBuffer << endl;
-               }
-               
+                 
                // Cylindrical shape
                else if (DataBuffer== "Radius=") {
                   check_Radius = true;
                   ConfigFile >> DataBuffer ;
                   cout << "LaBr3 Radius:  " << atof( DataBuffer.c_str() ) << "mm" << endl;
                }
-               
-               // Squared shape
-               else if (DataBuffer=="Width=") {
-                  check_Width = true;
-                  ConfigFile >> DataBuffer ;
-                  cout << "LaBr3 Width:  " <<atof( DataBuffer.c_str() ) << "mm" << endl;
-               }
+ 
                
                else if (DataBuffer== "Height=") {
                   check_Height = true;
@@ -190,25 +173,7 @@ void TLaBr3Physics::ReadConfiguration(string Path)
                   cout << "LaBr3 Height:  " << atof( DataBuffer.c_str() ) << "mm" << endl;
                }
                
-               // Common
-               else if (DataBuffer=="Thickness=") {
-                  check_Thickness = true;
-                  ConfigFile >> DataBuffer ;
-                  cout << "LaBr3 Thickness:  " << atof( DataBuffer.c_str() ) << "mm" << endl;
-               }
-               
-               else if (DataBuffer== "Scintillator=") {
-                  check_Scintillator = true ;
-                  ConfigFile >> DataBuffer ;
-                  cout << "LaBr3 Scintillator type:  " << DataBuffer << endl;
-               }
-               
-               else if (DataBuffer=="LeadThickness=") {
-                  check_LeadThickness = true;
-                  ConfigFile >> DataBuffer ;
-                  cout << "Lead Thickness :  " << atof( DataBuffer.c_str() ) << "mm" << endl;
-               }
-                                                
+                                                 
                ///////////////////////////////////////////////////
                //   If no Detector Token and no comment, toggle out
                else 
@@ -217,7 +182,7 @@ void TLaBr3Physics::ReadConfiguration(string Path)
                   /////////////////////////////////////////////////
                   //   If All necessary information there, toggle out
                
-               if ( check_Theta && check_Phi && check_R && check_Thickness && check_Radius &&   check_LeadThickness && check_Scintillator &&   check_Height &&   check_Width && check_Shape && check_X && check_Y && check_Z ) 
+               if ( check_Theta && check_Phi && check_R &&  check_Radius &&      check_Height &&    check_X && check_Y && check_Z ) 
                   { 
                      NumberOfDetector++;
                      
@@ -225,13 +190,8 @@ void TLaBr3Physics::ReadConfiguration(string Path)
                      check_Theta = false          ;
                      check_Phi  = false           ;
                      check_R     = false          ;
-                     check_Thickness = false      ;
                      check_Radius = false         ;
-                     check_LeadThickness = false  ;
-                     check_Scintillator = false   ;
                      check_Height = false         ;
-                     check_Width = false          ;
-                     check_Shape = false          ;
                      check_X = false              ;
                      check_Y = false              ;
                      check_Z = false              ;
diff --git a/NPLib/LaBr3/TLaBr3Spectra.cxx b/NPLib/LaBr3/TLaBr3Spectra.cxx
index acb3d25e1..c52e1ec91 100644
--- a/NPLib/LaBr3/TLaBr3Spectra.cxx
+++ b/NPLib/LaBr3/TLaBr3Spectra.cxx
@@ -82,10 +82,9 @@ void TLaBr3Spectra::InitRawSpectra()
    int NbrBin = 512;
    int MinBin = 0;
    int MaxBin = 16384;
-
    for (unsigned int i = 0; i < fNumberDetector; i++) { // loop on number of detectors
       // LABR3_E_RAW
-      name = Form("LABR3_%d_E_RAW", i+1);
+      name = Form("LABR3_%d_E_RAW", i+1);cout<<Form("LABR3_%d_E_RAW", i+1)<<endl;
       AddHisto1D(name, name, NbrBin, MinBin, MaxBin, "LABR3/RAW/ENERGY");
 
       // LABR3_T_RAW
diff --git a/NPLib/SiLi/TSiLiPhysics.cxx b/NPLib/SiLi/TSiLiPhysics.cxx
index 99d967b96..13972ea2f 100644
--- a/NPLib/SiLi/TSiLiPhysics.cxx
+++ b/NPLib/SiLi/TSiLiPhysics.cxx
@@ -78,16 +78,9 @@ void TSiLiPhysics::ReadConfiguration(string Path)
       string LineBuffer             ;
       string DataBuffer             ;
 
-      bool check_Theta = false          ;
-      bool check_Phi  = false           ;
-      bool check_R     = false          ;
       bool check_Thickness = false      ;
-      bool check_Radius = false         ;
-      bool check_LeadThickness = false  ;
-      bool check_Scintillator = false   ;
       bool check_Height = false         ;
       bool check_Width = false          ;
-      bool check_Shape = false          ;
       bool check_X = false              ;
       bool check_Y = false              ;
       bool check_Z = false              ;      
@@ -102,7 +95,7 @@ void TSiLiPhysics::ReadConfiguration(string Path)
          if (LineBuffer.compare(0, 4, "SiLi") == 0) 
             {
                cout << "///" << endl ;
-               cout << "Platic found: " << endl ;        
+               cout << "SiLi found: " << endl ;        
                ReadingStatus = true ;
             }
             
@@ -123,25 +116,7 @@ void TSiLiPhysics::ReadConfiguration(string Path)
                   cout << "WARNING: Another Detector is find before standard sequence of Token, Error may occured in Telecope definition" << endl ;
                   ReadingStatus = false ;
                }
-                              
-                                    //Angle method
-               else if (DataBuffer=="THETA=") {
-                  check_Theta = true;
-                  ConfigFile >> DataBuffer ;
-                  cout << "Theta:  " << atof(DataBuffer.c_str()) << "deg" << endl;
-               }
-
-               else if (DataBuffer=="PHI=") {
-                  check_Phi = true;
-                  ConfigFile >> DataBuffer ;
-                  cout << "Phi:  " << atof( DataBuffer.c_str() ) << "deg" << endl;
-               }
 
-               else if (DataBuffer=="R=") {
-                  check_R = true;
-                  ConfigFile >> DataBuffer ;
-                  cout << "R:  " << atof( DataBuffer.c_str() ) << "mm" << endl;
-               }
                
                //Position method
                else if (DataBuffer=="X=") {
@@ -163,20 +138,6 @@ void TSiLiPhysics::ReadConfiguration(string Path)
                }
                
                
-               //General
-               else if (DataBuffer=="Shape=") {
-                  check_Shape = true;
-                  ConfigFile >> DataBuffer ;
-                  cout << "Shape:  " << DataBuffer << endl;
-               }
-               
-               // Cylindrical shape
-               else if (DataBuffer== "Radius=") {
-                  check_Radius = true;
-                  ConfigFile >> DataBuffer ;
-                  cout << "SiLi Radius:  " << atof( DataBuffer.c_str() ) << "mm" << endl;
-               }
-               
                // Squared shape
                else if (DataBuffer=="Width=") {
                   check_Width = true;
@@ -197,17 +158,6 @@ void TSiLiPhysics::ReadConfiguration(string Path)
                   cout << "SiLi Thickness:  " << atof( DataBuffer.c_str() ) << "mm" << endl;
                }
                
-               else if (DataBuffer== "Scintillator=") {
-                  check_Scintillator = true ;
-                  ConfigFile >> DataBuffer ;
-                  cout << "SiLi Scintillator type:  " << DataBuffer << endl;
-               }
-               
-               else if (DataBuffer=="LeadThickness=") {
-                  check_LeadThickness = true;
-                  ConfigFile >> DataBuffer ;
-                  cout << "Lead Thickness :  " << atof( DataBuffer.c_str() ) << "mm" << endl;
-               }
                                                 
                ///////////////////////////////////////////////////
                //   If no Detector Token and no comment, toggle out
@@ -217,21 +167,14 @@ void TSiLiPhysics::ReadConfiguration(string Path)
                   /////////////////////////////////////////////////
                   //   If All necessary information there, toggle out
                
-               if ( check_Theta && check_Phi && check_R && check_Thickness && check_Radius &&   check_LeadThickness && check_Scintillator &&   check_Height &&   check_Width && check_Shape && check_X && check_Y && check_Z ) 
+               if ( check_Thickness &&    check_Height &&   check_Width &&  check_X && check_Y && check_Z ) 
                   { 
                      NumberOfDetector++;
                      
                      //   Reinitialisation of Check Boolean  
-                     check_Theta = false          ;
-                     check_Phi  = false           ;
-                     check_R     = false          ;
                      check_Thickness = false      ;
-                     check_Radius = false         ;
-                     check_LeadThickness = false  ;
-                     check_Scintillator = false   ;
                      check_Height = false         ;
                      check_Width = false          ;
-                     check_Shape = false          ;
                      check_X = false              ;
                      check_Y = false              ;
                      check_Z = false              ;
-- 
GitLab