From 3a34ec4086f14af02d51c12c775f7eb9bbd644cb Mon Sep 17 00:00:00 2001
From: Eric Pooser <pooser@jlab.org>
Date: Mon, 18 Dec 2017 12:26:04 -0500
Subject: [PATCH] Trigger eff (#344)

* Add prescaled live time measurement calculation

* Update parameter files and create appropriate default calib files for HMS

* Fix template file
---
 DBASE/HMS/GEN/default_det_calib_files.param            |  8 +++++++-
 DBASE/HMS/STD/standard.kinematics                      |  4 ++++
 PARAM/HMS/CAL/hcal_calib.param                         | 10 ----------
 .../HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1130.param |  1 +
 .../HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1136.param |  1 +
 .../HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1178.param |  1 +
 .../HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1179.param |  1 +
 .../HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1180.param |  1 +
 .../HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1212.param |  1 +
 .../HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1213.param |  1 +
 .../HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1214.param |  1 +
 PARAM/HMS/CER/CALIB/hcer_calib.param                   |  5 +----
 TEMPLATES/HMS/SCALERS/hscalers.template                |  1 -
 13 files changed, 20 insertions(+), 16 deletions(-)
 delete mode 100644 PARAM/HMS/CAL/hcal_calib.param
 create mode 100644 PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1130.param
 create mode 100644 PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1136.param
 create mode 100644 PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1178.param
 create mode 100644 PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1179.param
 create mode 100644 PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1180.param
 create mode 100644 PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1212.param
 create mode 100644 PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1213.param
 create mode 100644 PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1214.param

diff --git a/DBASE/HMS/GEN/default_det_calib_files.param b/DBASE/HMS/GEN/default_det_calib_files.param
index c5478449..01f99f8e 100644
--- a/DBASE/HMS/GEN/default_det_calib_files.param
+++ b/DBASE/HMS/GEN/default_det_calib_files.param
@@ -1,3 +1,9 @@
 ; Dummy file
 ; Default calibration files in general.param
-; This keeps the replay script from complaining
\ No newline at end of file
+; This keeps the replay script from complaining
+#include "PARAM/HMS/DC/CALIB/hdc_calib.param"
+#include "PARAM/HMS/DC/CALIB/hdc_tzero_per_wire.param"
+#include "PARAM/HMS/HODO/CALIB/hhodo_calib.param"'
+#include "PARAM/HMS/HODO/CALIB/htofcalib.param"
+#include "PARAM/HMS/CER/CALIB/hcer_calib.param"
+#include "PARAM/HMS/CAL/CALIB/hcal_calib.param"
\ No newline at end of file
diff --git a/DBASE/HMS/STD/standard.kinematics b/DBASE/HMS/STD/standard.kinematics
index 89a79221..8d27277a 100644
--- a/DBASE/HMS/STD/standard.kinematics
+++ b/DBASE/HMS/STD/standard.kinematics
@@ -188,3 +188,7 @@ gtargmass_amu=12.0107
 htheta_lab = -21.94
 hpcentral = 1.6162
 
+1211-1213
+gtargmass_amu=1.00794
+htheta_lab = -21.94
+hpcentral = 0.9
\ No newline at end of file
diff --git a/PARAM/HMS/CAL/hcal_calib.param b/PARAM/HMS/CAL/hcal_calib.param
deleted file mode 100644
index 2f363dec..00000000
--- a/PARAM/HMS/CAL/hcal_calib.param
+++ /dev/null
@@ -1,10 +0,0 @@
-; Calibration constants for run 1136_100000, 39049 events processed
-
-hcal_pos_gain_cor=  0.00,  9.15, 10.44, 10.88, 10.86, 11.14, 12.93, 14.47, 10.02, 14.21, 12.72, 13.03,  0.00,
-                    9.44, 15.69, 10.67, 13.04, 11.65,  9.33, 10.58, 10.56,  9.76, 10.34, 10.30, 12.17,  0.00,
-                   23.63, 16.39, 17.25, 19.63, 17.38, 16.83, 19.07, 18.55, 18.51, 23.70, 18.56, 20.22,  0.00,
-                    0.00, 19.40, 21.71, 19.02, 19.86, 20.51, 24.60, 20.31, 19.73, 21.80, 18.53, 19.00,  0.00,
-hcal_neg_gain_cor=  0.00, 12.76, 13.46, 10.86, 12.85, 14.27, 11.70, 14.84, 13.87, 11.47, 12.57, 12.83,  0.00,
-                   29.74, 12.10, 13.64, 13.64, 13.63, 14.32, 16.45, 14.92, 17.14, 16.15, 17.72, 14.32,  0.00,
-                    0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,
-                    0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,
diff --git a/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1130.param b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1130.param
new file mode 100644
index 00000000..ab04e588
--- /dev/null
+++ b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1130.param
@@ -0,0 +1 @@
+hcer_adc_to_npe = 6.556*0.04,5.224*0.04
\ No newline at end of file
diff --git a/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1136.param b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1136.param
new file mode 100644
index 00000000..2aec810e
--- /dev/null
+++ b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1136.param
@@ -0,0 +1 @@
+hcer_adc_to_npe = 6.638*0.04,5.242*0.04
\ No newline at end of file
diff --git a/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1178.param b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1178.param
new file mode 100644
index 00000000..31667aef
--- /dev/null
+++ b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1178.param
@@ -0,0 +1 @@
+hcer_adc_to_npe = 6.748*0.04,5.310*0.04
diff --git a/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1179.param b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1179.param
new file mode 100644
index 00000000..0b4d53b0
--- /dev/null
+++ b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1179.param
@@ -0,0 +1 @@
+hcer_adc_to_npe = 6.752*0.04,5.850*0.04
\ No newline at end of file
diff --git a/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1180.param b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1180.param
new file mode 100644
index 00000000..4b518876
--- /dev/null
+++ b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1180.param
@@ -0,0 +1 @@
+hcer_adc_to_npe = 6.732*0.04,5.985*0.04
\ No newline at end of file
diff --git a/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1212.param b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1212.param
new file mode 100644
index 00000000..617906d3
--- /dev/null
+++ b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1212.param
@@ -0,0 +1 @@
+hcer_adc_to_npe = 5.735*0.04,5.741*0.04
\ No newline at end of file
diff --git a/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1213.param b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1213.param
new file mode 100644
index 00000000..7450b99b
--- /dev/null
+++ b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1213.param
@@ -0,0 +1 @@
+hcer_adc_to_npe = 6.616*0.04,6.564*0.04
\ No newline at end of file
diff --git a/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1214.param b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1214.param
new file mode 100644
index 00000000..d540d097
--- /dev/null
+++ b/PARAM/HMS/CER/CALIB/Fall_Comm_2017/hcer_calib_1214.param
@@ -0,0 +1 @@
+hcer_adc_to_npe = 6.399*0.04,5.729*0.04
\ No newline at end of file
diff --git a/PARAM/HMS/CER/CALIB/hcer_calib.param b/PARAM/HMS/CER/CALIB/hcer_calib.param
index 42f51941..617906d3 100644
--- a/PARAM/HMS/CER/CALIB/hcer_calib.param
+++ b/PARAM/HMS/CER/CALIB/hcer_calib.param
@@ -1,4 +1 @@
-
-;Garth H.  gain calibration from HMS run 303
-hcer_adc_to_npe = 1/323./0.0195,1/327./0.0195
-
+hcer_adc_to_npe = 5.735*0.04,5.741*0.04
\ No newline at end of file
diff --git a/TEMPLATES/HMS/SCALERS/hscalers.template b/TEMPLATES/HMS/SCALERS/hscalers.template
index 1af896e7..a73006b7 100644
--- a/TEMPLATES/HMS/SCALERS/hscalers.template
+++ b/TEMPLATES/HMS/SCALERS/hscalers.template
@@ -48,7 +48,6 @@ HMS Event Types            : {HMS_Pretrig.npassed}
 HMS Computer Live Time : {(TRIG1.npassed / H.hTRIG1.scaler)*100.0:%3.4f} % [ {(TRIG1.npassed / (H.hTRIG1.scaler/ghconfig_ti_ps_factors[0]))*100.0:%3.4f} %  ]
 HMS Computer Dead Time : {100.0 - (TRIG1.npassed / H.hTRIG1.scaler)*100.0:%3.4f} % [ {100.0 - (TRIG1.npassed / (H.hTRIG1.scaler/ghconfig_ti_ps_factors[0]))*100.0:%3.4f} %  ]
 
-
 *******
 * EDTM
 *******
-- 
GitLab