From 8805d65218d6e7217b6b763c102e0110c3982457 Mon Sep 17 00:00:00 2001
From: Jacob Lamblin <lamblinj@ill.fr>
Date: Wed, 4 Jan 2017 15:26:09 +0000
Subject: [PATCH] Add threshold for sum03, sum47 and sum07.

---
 .../stereo_daq/DAQParamController.cpp         | 46 ++++++++++++++-----
 .../stereo_daq/DAQParamController.h           |  8 +++-
 .../daqparam/daqparam_controller.properties   |  4 +-
 .../daqparam_controllerProperties.xml         |  6 ++-
 .../gui/daqparam/daqparam_controllerView.xml  | 12 +++--
 5 files changed, 57 insertions(+), 19 deletions(-)

diff --git a/src/controllers/stereo_daq/DAQParamController.cpp b/src/controllers/stereo_daq/DAQParamController.cpp
index 4338798d..74fa5b09 100644
--- a/src/controllers/stereo_daq/DAQParamController.cpp
+++ b/src/controllers/stereo_daq/DAQParamController.cpp
@@ -60,7 +60,9 @@ acquisition::TimeAcquisitionController(name), Select(this),Set(this) {
 	trigsum07.init(this, NOSAVE, "trigsum07");
 	trigquantity.init(this, NOSAVE, "trigquantity");
 	slotindex.init(this, NOSAVE, "slotindex");
-	sumthres.init(this, NOSAVE, "sumthres");
+	sumthres03.init(this, NOSAVE, "sumthres03");
+	sumthres47.init(this, NOSAVE, "sumthres47");
+	sumthres07.init(this, NOSAVE, "sumthres07");
 	nsum.init(this, NOSAVE, "nsum");
 	t1accepted.init(this, NOSAVE, "t1accepted");
 	t1timereset.init(this, NOSAVE, "t1timereset");
@@ -132,7 +134,9 @@ acquisition::TimeAcquisitionController(name), Select(this),Set(this) {
 	registerRefresher(gain20, &DAQParamController::refreshGain20Property, this);
 	registerRefresher(trigthres, &DAQParamController::refreshTrigThresProperty, this);
 	registerRefresher(cfdthres, &DAQParamController::refreshCFDThresProperty, this);
-	registerRefresher(sumthres, &DAQParamController::refreshSumThresProperty, this);
+	registerRefresher(sumthres03,&DAQParamController::refreshSumThres03Property, this);
+	registerRefresher(sumthres47, &DAQParamController::refreshSumThres47Property, this);
+	registerRefresher(sumthres07,   &DAQParamController::refreshSumThres07Property, this);
 	registerRefresher(precfd, &DAQParamController::refreshPreCFDProperty, this);
 	registerRefresher(nsum, &DAQParamController::refreshNSumProperty, this);
 	registerRefresher(t1accepted, &DAQParamController::refreshT1AcceptedProperty, this);
@@ -188,7 +192,9 @@ DAQParamController::DAQParamController(const DAQParamController& controller) :
 	trigsum07.copy(this, controller.trigsum07);
 	trigquantity.copy(this, controller.trigquantity);
 	slotindex.copy(this, controller.slotindex);
-	sumthres.copy(this, controller.sumthres);
+	sumthres03.copy(this, controller.sumthres03);
+	sumthres47.copy(this, controller.sumthres47);
+	sumthres07.copy(this, controller.sumthres07);
 	nsum.copy(this, controller.nsum);
 	t1accepted.copy(this, controller.t1accepted);
 	t1timereset.copy(this,controller.t1timereset);
@@ -316,7 +322,9 @@ void DAQParamController::refreshNFEBoardMaxProperty(int32 value) throw (CannotSe
 	trigsum07.resize(value);
 	trigquantity.resize(value);
 	slotindex.resize(value);
-	sumthres.resize(value);
+	sumthres03.resize(value);
+	sumthres47.resize(value);
+	sumthres07.resize(value);
 	nsum.resize(value);
 	t1accepted.resize(value);
 	t1timereset.resize(value);
@@ -355,7 +363,9 @@ void DAQParamController::refreshNFEBoardProperty(int32 value) throw (CannotSetVa
 //	trigsum07.resize(value);
 //	trigquantity.resize(value);
 //	slotindex.resize(value);
-//	sumthres.resize(value);
+//	sumthres03.resize(value);
+//	SumThres47.resize(value);
+//	SumThres07.resize(value);
 //	nsum.resize(value);
 //	t1accepted.resize(value);
 //	t1timereset.resize(value);
@@ -431,7 +441,9 @@ void DAQParamController::refreshNFEBoardProperty(int32 value) throw (CannotSetVa
 		trigsum07.set(i, false);
 		//cout << "init trigquantity  " << endl ;
 		trigquantity.set(i, TrigAmp);
-		sumthres.set(i, 1000);
+		sumthres03.set(i, 1000);
+		sumthres47.set(i, 1000);
+		sumthres07.set(i, 1000);
 		nsum.set(i, 50);
 		t1accepted.set(i,true);
 		t1timereset.set(i,false);
@@ -492,7 +504,9 @@ void DAQParamController::refreshNFEBoardCloneProperty(int32 value) throw (Cannot
 //	trigsum07.resize(value);
 //	trigquantity.resize(value);
 //	slotindex.resize(value);
-//	sumthres.resize(value);
+//	sumthres03.resize(value);
+//	SumThres47.resize(value);
+//	SumThres07.resize(value);
 //	nsum.resize(value);
 //	t1accepted.resize(value);
 //	t1timereset.resize(value);
@@ -529,7 +543,9 @@ void DAQParamController::refreshNFEBoardCloneProperty(int32 value) throw (Cannot
 		trigsum47.set(i, false);
 		trigsum07.set(i, false);
 		trigquantity.set(i, TrigAmp);
-		sumthres.set(i, 1000);
+		sumthres03.set(i, 1000);
+		sumthres47.set(i, 1000);
+		sumthres07.set(i, 1000);
 		nsum.set(i, 50);
 		t1accepted.set(i,true);
 		t1timereset.set(i,false);
@@ -647,8 +663,14 @@ void DAQParamController::refreshPreCFDProperty(int32 index, int32 value) throw (
 	if(index<nfeboard()) m_ELECDriver->DAQParams.FEParams_v.at(index).preCFD = (short unsigned) value;
 }
 
-void DAQParamController::refreshSumThresProperty(int32 index, int32 value) throw (CannotSetValue) {
-	if(index<nfeboard() && trigthresall()==0) m_ELECDriver->DAQParams.FEParams_v.at(index).sumThreshold = value;
+void DAQParamController::refreshSumThres03Property(int32 index, int32 value) throw (CannotSetValue) {
+	if(index<nfeboard() && trigthresall()==0) m_ELECDriver->DAQParams.FEParams_v.at(index).sumThreshold03 = value;
+}
+void DAQParamController::refreshSumThres47Property(int32 index, int32 value) throw (CannotSetValue) {
+	if(index<nfeboard() && trigthresall()==0) m_ELECDriver->DAQParams.FEParams_v.at(index).sumThreshold47 = value;
+}
+void DAQParamController::refreshSumThres07Property(int32 index, int32 value) throw (CannotSetValue) {
+	if(index<nfeboard() && trigthresall()==0) m_ELECDriver->DAQParams.FEParams_v.at(index).sumThreshold07 = value;
 }
 void DAQParamController::refreshNSumProperty(int32 index, int32 value) throw (CannotSetValue) {
 	if(index<nfeboard())m_ELECDriver->DAQParams.FEParams_v.at(index).nSum = (short unsigned) value;
@@ -714,7 +736,9 @@ void DAQParamController::refreshTrigThresAllProperty(int32 value) throw (CannotS
 			for(int j=0;j< stereo_elec::NBFECHANNEL; j++){
 				m_ELECDriver->DAQParams.FEParams_v.at(i).threshold_v[j] = (short unsigned) value;
 			}
-			m_ELECDriver->DAQParams.FEParams_v.at(i).sumThreshold= (short unsigned) value;
+			m_ELECDriver->DAQParams.FEParams_v.at(i).sumThreshold03= (short unsigned) value;
+			m_ELECDriver->DAQParams.FEParams_v.at(i).sumThreshold47= (short unsigned) value;
+			m_ELECDriver->DAQParams.FEParams_v.at(i).sumThreshold07= (short unsigned) value;
 		}
 
 		log(Level::s_Info) << "Trigger threshold have been set to " << value << " for all channels" << endlog;
diff --git a/src/controllers/stereo_daq/DAQParamController.h b/src/controllers/stereo_daq/DAQParamController.h
index cbd3a6aa..095af2f8 100644
--- a/src/controllers/stereo_daq/DAQParamController.h
+++ b/src/controllers/stereo_daq/DAQParamController.h
@@ -126,7 +126,9 @@ public:
 	DynamicProperty<bool> trigsum07;
 	DynamicProperty<string> trigquantity;  // Charge or amplitude
 	DynamicProperty<int32> slotindex;
-	DynamicProperty<int32> sumthres;
+	DynamicProperty<int32> sumthres03;
+	DynamicProperty<int32> sumthres47;
+	DynamicProperty<int32> sumthres07;
 	DynamicProperty<int32> nsum;
 	DynamicProperty<bool> t1accepted;
 	DynamicProperty<bool> t1timereset;
@@ -270,7 +272,9 @@ private:
 	void refreshCFDDelayProperty(int32 index, int32 value) throw (CannotSetValue);
 	void refreshCFDFractionProperty(int32 index, int32 value) throw (CannotSetValue);
 	void refreshPreCFDProperty(int32 index, int32 value) throw (CannotSetValue);
-	void refreshSumThresProperty(int32 index, int32 value) throw (CannotSetValue);
+	void refreshSumThres03Property(int32 index, int32 value) throw (CannotSetValue);
+	void refreshSumThres47Property(int32 index, int32 value) throw (CannotSetValue);
+	void refreshSumThres07Property(int32 index, int32 value) throw (CannotSetValue);
 	void refreshNSumProperty(int32 index, int32 value) throw (CannotSetValue);
 	void refreshGain20Property(int32 index, bool value) throw (CannotSetValue);
 	void refreshTrigThresProperty(int32 index, int32 value) throw (CannotSetValue);
diff --git a/src/controllers/stereo_daq/gui/daqparam/daqparam_controller.properties b/src/controllers/stereo_daq/gui/daqparam/daqparam_controller.properties
index f37860b7..bcf08124 100644
--- a/src/controllers/stereo_daq/gui/daqparam/daqparam_controller.properties
+++ b/src/controllers/stereo_daq/gui/daqparam/daqparam_controller.properties
@@ -32,7 +32,9 @@ DAQParam.cfddelayPrefix=CFD Delay
 DAQParam.cfdfractionPrefix=CFD Fraction
 DAQParam.precfdPrefix=PreCFD
 DAQParam.nsumPrefix=Nsum
-DAQParam.sumThresPrefix=Sum threshold
+DAQParam.sumThres03Prefix=Sum thres 03
+DAQParam.sumThres47Prefix=Sum thres 47
+DAQParam.sumThres07Prefix=Sum thres 07
 
 
 DAQParam.ntotchannelPrefix=Number of channels
diff --git a/src/controllers/stereo_daq/gui/daqparam/daqparam_controllerProperties.xml b/src/controllers/stereo_daq/gui/daqparam/daqparam_controllerProperties.xml
index c5727fbb..0ec8e81a 100644
--- a/src/controllers/stereo_daq/gui/daqparam/daqparam_controllerProperties.xml
+++ b/src/controllers/stereo_daq/gui/daqparam/daqparam_controllerProperties.xml
@@ -43,7 +43,11 @@
 	</dynamic_property>
 	<dynamic_property name="precfd" size_property="nfeboard" type="int32" max_length="2">
 	</dynamic_property>
-	<dynamic_property name="sumthres" size_property="nfeboard" type="int32" max_length="5">
+	<dynamic_property name="sumthres03" size_property="nfeboard" type="int32" max_length="5">
+	</dynamic_property>
+	<dynamic_property name="sumthres47" size_property="nfeboard" type="int32" max_length="5">
+	</dynamic_property>
+	<dynamic_property name="sumthres07" size_property="nfeboard" type="int32" max_length="5">
 	</dynamic_property>
 	<dynamic_property name="nsum" size_property="nfeboard" type="int32" max_length="2">
 	</dynamic_property>
diff --git a/src/controllers/stereo_daq/gui/daqparam/daqparam_controllerView.xml b/src/controllers/stereo_daq/gui/daqparam/daqparam_controllerView.xml
index 62f4d26b..f3ba377c 100644
--- a/src/controllers/stereo_daq/gui/daqparam/daqparam_controllerView.xml
+++ b/src/controllers/stereo_daq/gui/daqparam/daqparam_controllerView.xml
@@ -47,7 +47,7 @@
 	<group title="DAQParam.FETitle" key="groupForFE">
 		<label role="DAQParamController1" property="nfeboard" prefix="DAQParam.nfeboardPrefix"/>
 		<newLine/>
-		<table_composite nbColumns="16">
+		<table_composite nbColumns="18">
 			<simple_label prefix="DAQParam.slotindexPrefix" font_style="BOLD" hAlignment="center"/>
 <!-- 			<simple_label prefix="DAQParam.enabledfePrefix" font_style="BOLD" hAlignment="center"/> -->
 			<simple_label prefix="DAQParam.trigquantityPrefix" font_style="BOLD" hAlignment="center"/>
@@ -61,11 +61,13 @@
 			<simple_label prefix="DAQParam.ntotPrefix" font_style="BOLD" hAlignment="center"/>
 			<simple_label prefix="DAQParam.ntailPrefix" font_style="BOLD" hAlignment="center"/>
 			<simple_label prefix="DAQParam.nsumPrefix" font_style="BOLD" hAlignment="center"/>
-			<simple_label prefix="DAQParam.sumThresPrefix" font_style="BOLD" hAlignment="center"/>
+			<simple_label prefix="DAQParam.sumThres03Prefix" font_style="BOLD" hAlignment="center"/>
+			<simple_label prefix="DAQParam.sumThres47Prefix" font_style="BOLD" hAlignment="center"/>
+			<simple_label prefix="DAQParam.sumThres07Prefix" font_style="BOLD" hAlignment="center"/>
 			<simple_label prefix="DAQParam.cfddelayPrefix" font_style="BOLD" hAlignment="center"/>
 			<simple_label prefix="DAQParam.cfdfractionPrefix" font_style="BOLD" hAlignment="center"/>
 			<simple_label prefix="DAQParam.precfdPrefix" font_style="BOLD" hAlignment="center"/>	
-			<dynamic_composite role="DAQParamController1" properties="slotindex,trigquantity,trigchannel,trigsum03,trigsum47,trigsum07,t1accepted,t1timereset,pretrig,ntot,ntail,nsum,sumthres,cfddelay,cfdfraction,precfd">
+			<dynamic_composite role="DAQParamController1" properties="slotindex,trigquantity,trigchannel,trigsum03,trigsum47,trigsum07,t1accepted,t1timereset,pretrig,ntot,ntail,nsum,sumthres03,sumthres47,sumthres07,cfddelay,cfdfraction,precfd">
 <!-- 			<dynamic_composite role="DAQParamController1" properties="slotindex,enabledfe,trigquantity,trigchannel,trigsum03,trigsum47,trigsum07,t1accepted,t1timereset,pretrig,ntot,ntail,nsum,sumthres,cfddelay,cfdfraction,precfd"> -->
 				<label role="DAQParamController1" property="slotindex" hAlignment="center"/>
 <!-- 				<check role="DAQParamController1" property="enabledfe" hAlignment="center" checkBoxValues="DAQParam.isselected"/> -->
@@ -80,7 +82,9 @@
 				<text role="DAQParamController1" property="ntot" hAlignment="center"/>
 				<text role="DAQParamController1" property="ntail" hAlignment="center"/>
 				<text role="DAQParamController1" property="nsum" hAlignment="center"/>
-				<text role="DAQParamController1" property="sumthres" hAlignment="center"/>
+				<text role="DAQParamController1" property="sumthres03" hAlignment="center"/>
+				<text role="DAQParamController1" property="sumthres47" hAlignment="center"/>
+				<text role="DAQParamController1" property="sumthres07" hAlignment="center"/>
 				<text role="DAQParamController1" property="cfddelay" hAlignment="center"/>
 				<text role="DAQParamController1" property="cfdfraction" hAlignment="center"/>
 				<text role="DAQParamController1" property="precfd" hAlignment="center"/>
-- 
GitLab