From eba3d56ec8f18c46143c38f2859e529814a40459 Mon Sep 17 00:00:00 2001
From: Carlos Yero <cyero002@fiu.edu>
Date: Mon, 23 Apr 2018 16:42:53 -0400
Subject: [PATCH] 1)added THcCoinTime module to
 replay_production_coin_pElec_hProt.C 2)added eHadron coin offset parameter
 3)added HMS/SHMS central pathlength parameter

---
 DEF-files/COIN/PRODUCTION/coin_production_pElec_hProt.def   | 2 ++
 PARAM/HMS/GEN/hcana.param                                   | 4 +++-
 PARAM/SHMS/GEN/pcana.param                                  | 4 ++++
 PARAM/TRIG/tcoin.param                                      | 6 ++++++
 .../COIN/PRODUCTION/replay_production_coin_pElec_hProt.C    | 6 ++++++
 5 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/DEF-files/COIN/PRODUCTION/coin_production_pElec_hProt.def b/DEF-files/COIN/PRODUCTION/coin_production_pElec_hProt.def
index 9db5c46f..5af2aadd 100644
--- a/DEF-files/COIN/PRODUCTION/coin_production_pElec_hProt.def
+++ b/DEF-files/COIN/PRODUCTION/coin_production_pElec_hProt.def
@@ -1,5 +1,6 @@
 block T.coin.hTRIG*
 block T.coin.pTRIG*
+block CTime*
 
 block H.cer.*
 block H.dc.*
@@ -23,6 +24,7 @@ block P.kin.*
 block P.rb.*
 block P.react.*
 
+
 begin epics
 IBC3H00CRCUR4
 hac_bcm_average
diff --git a/PARAM/HMS/GEN/hcana.param b/PARAM/HMS/GEN/hcana.param
index caf48164..47c63857 100644
--- a/PARAM/HMS/GEN/hcana.param
+++ b/PARAM/HMS/GEN/hcana.param
@@ -6,7 +6,9 @@
 href_npaddles = 0
 href_nsperchan = 0.1
 href_offset = 0.0
-;
+
+;HMS Central Path Lenth from target to focal plane
+HMS_CentralPathLen = 22.*100   ; 22 m (or 2200 cm)
 
 hcal_num_layers = 4
 
diff --git a/PARAM/SHMS/GEN/pcana.param b/PARAM/SHMS/GEN/pcana.param
index be41756d..17d272e3 100644
--- a/PARAM/SHMS/GEN/pcana.param
+++ b/PARAM/SHMS/GEN/pcana.param
@@ -1,3 +1,7 @@
+;SHMS Central Path Lenth from target to focal plane
+SHMS_CentralPathLen = 18.1*100   ; 18.1 m (or 1810 cm)
+
+
 ; Parameters we need to keep THcHallCSpectrometer Happy
 ;p_recon_coeff_filename = "DATFILES/SHMS_fr3_rec__order_5.dat"
 ;p_recon_coeff_filename = "DATFILES/shms-2011-26cm-monte_q2_p20_rec.dat"
diff --git a/PARAM/TRIG/tcoin.param b/PARAM/TRIG/tcoin.param
index b3044cf6..0dec13df 100644
--- a/PARAM/TRIG/tcoin.param
+++ b/PARAM/TRIG/tcoin.param
@@ -3,6 +3,12 @@ t_coin_numTdc = 110
 t_coin_tdcoffset = 300.
 t_coin_adc_tdc_offset = 200.
 t_coin_tdcchanperns = 0.1
+eHadCoinTime_Offset = 0.
+
+
+;NOTE: pTRIG1_ROC1, pTRIG4_ROC1, pTRIG1_ROC2, pTRIG4_ROC2 (tdcTimeRaw),  are hard-coded in THcTrigDet.cxx class
+;      These varibles and their indices are used for the coincidence time calculation, and should NOT change here.
+;      If you do change them, please make sure to modify the THcTrigDet.cxx class.
 
 ; bar num:           1     2     3     4      5     6     7   8        9           10    11     12     13        14            15         16         17       18       19
 t_coin_adcNames = "hASUM hBSUM hCSUM hDSUM hPSHWR hSHWR hAER hCER hFADC_TREF_ROC1 pAER pHGCER pNGCER pPSHWR pFADC_TREF_ROC2 pHGCER_MOD pNGCER_MOD pHEL_NEG pHEL_POS pHEL_MPS"
diff --git a/SCRIPTS/COIN/PRODUCTION/replay_production_coin_pElec_hProt.C b/SCRIPTS/COIN/PRODUCTION/replay_production_coin_pElec_hProt.C
index ad1a7942..1cdf1503 100644
--- a/SCRIPTS/COIN/PRODUCTION/replay_production_coin_pElec_hProt.C
+++ b/SCRIPTS/COIN/PRODUCTION/replay_production_coin_pElec_hProt.C
@@ -181,6 +181,12 @@ void replay_production_coin_pElec_hProt (Int_t RunNumber = 0, Int_t MaxEvent = 0
   gHaApps->Add(TRG);
   // Add trigger detector to trigger apparatus
   THcTrigDet* coin = new THcTrigDet("coin", "Coincidence Trigger Information");
+
+  //Add coin physics module
+  THcCoinTime* coinTime = new THcCoinTime("CTime", "Coincidende Time Determination", "H", "P", "T.coin");
+  gHaPhysics->Add(coinTime);
+
+
   // Suppress missing reference time warnings for these event types
   coin->SetEvtType(1);
   coin->AddEvtType(2);
-- 
GitLab