From 2631abd30ee7c54ab772ecbeb752a15d77fc3f51 Mon Sep 17 00:00:00 2001
From: moukaddam <mhd.moukaddam@gmail.com>
Date: Fri, 12 May 2017 12:06:06 +0100
Subject: [PATCH] The low gain config variable is now set independantly for
 crystal or segment

---
 NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx | 22 ++++++++++++++--------
 NPLib/Detectors/GeTAMU/TGeTAMUPhysics.h   |  9 +++------
 Projects/T40/configs/ConfigGeTamu.dat     |  3 ++-
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx b/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx
index 0262a66ad..8082d60c5 100644
--- a/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx
+++ b/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx
@@ -67,7 +67,8 @@ ClassImp(TGeTAMUPhysics)
 void TGeTAMUPhysics::InitializeStandardParameter(){
 
 //Set high gain as default
-  m_LowGainIsSet = false;
+  m_LowGainCryIsSet = false;
+  m_LowGainSegIsSet = false;
   m_CryChannelStatus.clear() ;
   m_SegChannelStatus.clear() ;
 
@@ -126,9 +127,14 @@ void TGeTAMUPhysics::ReadAnalysisConfig(){
         AnalysisConfigFile.ignore(numeric_limits<streamsize>::max(), '\n' );
       }
 
-      else if (whatToDo== "LOW_GAIN_ENERGY") {
-        m_LowGainIsSet  = true ; 
-        cout << whatToDo << " " << m_LowGainIsSet << endl; // e.g. DataBuffer = CLOVER03
+      else if (whatToDo== "LOW_GAIN_ENERGY_CRY") {
+        m_LowGainCryIsSet  = true ; 
+        cout << whatToDo << " " << m_LowGainCryIsSet << endl; // e.g. DataBuffer = CLOVER03
+      }
+
+      else if (whatToDo== "LOW_GAIN_ENERGY_SEG") {
+        m_LowGainSegIsSet  = true ; 
+        cout << whatToDo << " " << m_LowGainSegIsSet << endl; // e.g. DataBuffer = CLOVER03
       }
 
       else if (whatToDo== "DISABLE_ALL") {
@@ -347,13 +353,13 @@ double Eraw,Energy;
 double Traw,Time;
 int clover, crystal, segment;
 
-if(m_LowGainIsSet)
+if(m_LowGainCryIsSet)
   mysizeE = m_EventData->GetMultiplicityCoreELowGain();
 else
   mysizeE = m_EventData->GetMultiplicityCoreE();
 
 for(unsigned int i = 0 ; i < mysizeE ; i++){
-  if(m_LowGainIsSet){
+  if(m_LowGainCryIsSet){
     clover = m_EventData->GetCoreCloverNbrELowGain(i);
     crystal = m_EventData->GetCoreCrystalNbrELowGain(i);
     Eraw = m_EventData->GetCoreEnergyLowGain(i);
@@ -389,13 +395,13 @@ for(unsigned int i = 0 ; i < mysizeT ; i++){
   }
 }
 
-if(m_LowGainIsSet)
+if(m_LowGainSegIsSet)
   mysizeE = m_EventData->GetMultiplicitySegmentELowGain();
 else
   mysizeE = m_EventData->GetMultiplicitySegmentE();
 for(unsigned int i = 0 ; i < mysizeE ; i++){
   
-  if(m_LowGainIsSet){
+  if(m_LowGainSegIsSet){
     clover = m_EventData->GetSegmentCloverNbrELowGain(i);
     segment = m_EventData->GetSegmentSegmentNbrELowGain(i);
     Eraw = m_EventData->GetSegmentEnergyLowGain(i);
diff --git a/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.h b/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.h
index 483bb64ee..adcbfdd5a 100644
--- a/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.h
+++ b/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.h
@@ -67,10 +67,6 @@ class TGeTAMUPhysics :  public TObject, public NPL::VDetector{
     //   First argument is either 0 for Cry,1 Seg
     bool IsValidChannel(const int& DetectorType, const int& detector , const int& channel) ;
 
-    //   Return true if the energy is read from low gain channel
-    //   First argument is either 0 for Cry,1 Seg
-    bool IsLowGainChannel(const int& DetectorType, const int& detector , const int& channel) ;
-
     //   Initialize the standard parameter for analysis
     //   ie: all channel enable, maximum multiplicity for strip = number of telescope
     void InitializeStandardParameter();
@@ -144,8 +140,9 @@ class TGeTAMUPhysics :  public TObject, public NPL::VDetector{
     double m_Seg_E_Threshold;
     int m_Cry_E_Raw_Threshold;
     int m_Seg_E_Raw_Threshold;
-    int m_AddBackMode;
-    bool m_LowGainIsSet; 
+    int m_AddBackMode; 
+    bool m_LowGainCryIsSet; 
+    bool m_LowGainSegIsSet; 
  
   private: // use for anlysis
     TLorentzVector m_GammaLV; //!
diff --git a/Projects/T40/configs/ConfigGeTamu.dat b/Projects/T40/configs/ConfigGeTamu.dat
index 92086c035..2f3d54427 100644
--- a/Projects/T40/configs/ConfigGeTamu.dat
+++ b/Projects/T40/configs/ConfigGeTamu.dat
@@ -1,6 +1,7 @@
 ConfigGeTamu
   %%%%%%%% Default is high energy 
-  %LOW_GAIN_ENERGY
+  LOW_GAIN_ENERGY_CRY
+  LOW_GAIN_ENERGY_SEG
 	%%%%%%%% Defective channels 
 	%DISABLE_ALL     CLOVER04
 	%DISABLE_CHANNEL CLOVER01_SEG01
-- 
GitLab