From 7a9e11daca888c09208e887ab5782df7f6f46e3e Mon Sep 17 00:00:00 2001
From: Ryan-Ambrose <george.ryan.ambrose@gmail.com>
Date: Thu, 14 Dec 2017 05:49:53 -0500
Subject: [PATCH] Updated SHMS HGCER calibration and efficiency scripts to
 comply with updated calibration for beta and particle ID. Also corrected the
 timing information to use goodAdcTdcDiffTime branch. Updated new calibration
 constants. (#342)

---
 CALIBRATION/shms_hgcer_calib/calibration.C  | 41 ++++++++++++---------
 CALIBRATION/shms_hgcer_calib/calibration.h  |  8 +++-
 CALIBRATION/shms_hgcer_calib/efficiencies.C | 40 +++++++++++---------
 CALIBRATION/shms_hgcer_calib/efficiencies.h |  6 +++
 PARAM/SHMS/HGCER/CALIB/phgcer_calib.param   |  4 +-
 5 files changed, 61 insertions(+), 38 deletions(-)

diff --git a/CALIBRATION/shms_hgcer_calib/calibration.C b/CALIBRATION/shms_hgcer_calib/calibration.C
index 053fdd47..4409e417 100644
--- a/CALIBRATION/shms_hgcer_calib/calibration.C
+++ b/CALIBRATION/shms_hgcer_calib/calibration.C
@@ -135,18 +135,18 @@ void calibration::SlaveBegin(TTree * /*tree*/)
   fBeta_Full = new TH1F("Beta_Full", "Full beta for events;Beta;Counts", 1000, -5, 5);
   GetOutputList()->Add(fBeta_Full);
 
-  fTiming_Cut = new TH1F("Timing_Cut", "Timing cut used for 'good' hits;Time (ns);Counts", 10000, 1, 200);
+  fTiming_Cut = new TH1F("Timing_Cut", "Timing cut used for 'good' hits;Time (ns);Counts", 10000, -40, 0);
   GetOutputList()->Add(fTiming_Cut);
 
-  fTiming_Full = new TH1F("Timing_Full", "Full timing information for events;Time (ns);Counts", 10000, 1, 200);
+  fTiming_Full = new TH1F("Timing_Full", "Full timing information for events;Time (ns);Counts", 10000, -40, 0);
   GetOutputList()->Add(fTiming_Full);
 
   //Particle ID cut visualization
-  fCut_everything = new TH2F("Cut_everything", "Visualization of no cuts; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 200, 0, 1.0, 200, 0, 1.0);
+  fCut_everything = new TH2F("Cut_everything", "Visualization of no cuts; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 250, 0, 1.0, 250, 0, 1.0);
   GetOutputList()->Add(fCut_everything);
-  fCut_electron = new TH2F("Cut_electron", "Visualization of electron cut; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 200, 0, 1.0, 200, 0, 1.0);
+  fCut_electron = new TH2F("Cut_electron", "Visualization of electron cut; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 250, 0, 1.0, 250, 0, 1.0);
   GetOutputList()->Add(fCut_electron);
-  fCut_pion = new TH2F("Cut_pion", "Visualization of pion cut; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 200, 0, 1.0, 200, 0, 1.0);
+  fCut_pion = new TH2F("Cut_pion", "Visualization of pion cut; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 250, 0, 1.0, 250, 0, 1.0);
   GetOutputList()->Add(fCut_pion);
   
   printf("\n\n");
@@ -193,18 +193,18 @@ Bool_t calibration::Process(Long64_t entry)
       if (!fFullRead) b_P_tr_beta->GetEntry(entry);
       //Require loose cut on particle velocity
       fBeta_Full->Fill(P_tr_beta[itrack]);
-      if (TMath::Abs(P_tr_beta[itrack] -0.7) > 0.3) return kTRUE;
+      if (TMath::Abs(P_tr_beta[itrack] -1.0) > 0.2) return kTRUE;
       fBeta_Cut->Fill(P_tr_beta[itrack]);
 
       //Filling the histograms
       for (Int_t ipmt = 0; ipmt < fpmts; ipmt++) 
 	{	  
 	  //Perform a loose timing cut
-	  if (!fFullRead) fNGC ? b_P_ngcer_goodAdcPulseTime->GetEntry(entry) : b_P_hgcer_goodAdcPulseTime->GetEntry(entry);
-	  fTiming_Full->Fill(fNGC ? P_ngcer_goodAdcPulseTime[ipmt] : P_hgcer_goodAdcPulseTime[ipmt]);
+	  if (!fFullRead) fNGC ? b_P_ngcer_goodAdcPulseTime->GetEntry(entry) : b_P_hgcer_goodAdcTdcDiffTime->GetEntry(entry);
+	  fTiming_Full->Fill(fNGC ? P_ngcer_goodAdcPulseTime[ipmt] : P_hgcer_goodAdcTdcDiffTime[ipmt]);
 	  if (fNGC ? P_ngcer_goodAdcPulseTime[ipmt] < 50 || P_ngcer_goodAdcPulseTime[ipmt] > 125 :
-	             P_hgcer_goodAdcPulseTime[ipmt] < 50 || P_hgcer_goodAdcPulseTime[ipmt] > 70) continue;
-	  fTiming_Cut->Fill(fNGC ? P_ngcer_goodAdcPulseTime[ipmt] : P_hgcer_goodAdcPulseTime[ipmt]);
+	             P_hgcer_goodAdcTdcDiffTime[ipmt] > -17.0 || P_hgcer_goodAdcTdcDiffTime[ipmt] < -30.0) continue;
+	  fTiming_Cut->Fill(fNGC ? P_ngcer_goodAdcPulseTime[ipmt] : P_hgcer_goodAdcTdcDiffTime[ipmt]);
 
 	  //Cuts to remove entries corresponding to a PMT not registering a hit	  
 	  if (!fFullRead) fNGC ? b_P_ngcer_goodAdcPulseInt->GetEntry(entry) : b_P_hgcer_goodAdcPulseInt->GetEntry(entry);
@@ -217,18 +217,23 @@ Bool_t calibration::Process(Long64_t entry)
 	      if (!fFullRead) b_P_cal_fly_earray->GetEntry(entry);
 	      if (!fFullRead) b_P_cal_pr_eplane->GetEntry(entry);
 	      if (!fFullRead) b_P_gtr_dp->GetEntry(entry);
-	      Float_t central_p = 3.0;
+	      Float_t central_p = 2.2;
 	      Float_t p = ((P_gtr_dp/100.0)*central_p) + central_p;
 
 	      //Fill histogram visualizaing the electron selection
 	      fCut_everything->Fill(P_cal_fly_earray/p, P_cal_pr_eplane/p);
 
 	      //Cut on Shower vs preshower is a tilted ellipse, this requires an angle of rotation (in radians), x/y center, semimajor and semiminor axis
-	      Float_t eangle = 3.0*3.14159/4.0;
+	      /*Float_t eangle = 3.0*3.14159/4.0;
 	      Float_t ex_center = 0.66;
 	      Float_t ey_center = 0.35;
 	      Float_t esemimajor_axis = 0.28;
-	      Float_t esemiminor_axis = 0.04;
+	      Float_t esemiminor_axis = 0.04;*/
+	      Float_t eangle = 3.0*3.14159/4.0;
+	      Float_t ex_center = 0.375;
+	      Float_t ey_center = 0.360;
+	      Float_t esemimajor_axis = 0.38;
+	      Float_t esemiminor_axis = 0.05;
 	      if (pow((P_cal_fly_earray/p - ex_center)*cos(eangle) + (P_cal_pr_eplane/p - ey_center)*sin(eangle),2)/pow(esemimajor_axis,2) + 
 		  pow((P_cal_fly_earray/p - ex_center)*sin(eangle) - (P_cal_pr_eplane/p - ey_center)*cos(eangle),2)/pow(esemiminor_axis,2) < 1)
 		{
@@ -372,7 +377,7 @@ Bool_t calibration::Process(Long64_t entry)
 	      if (!fFullRead) b_P_cal_fly_earray->GetEntry(entry);
 	      if (!fFullRead) b_P_cal_pr_eplane->GetEntry(entry);
 	      if (!fFullRead) b_P_gtr_dp->GetEntry(entry);
-	      Float_t central_p = 3.0;
+	      Float_t central_p = 2.2;
 	      Float_t p = ((P_gtr_dp/100.0)*central_p) + central_p;
 
 	      //Fill histogram visualizaing the electron selection
@@ -380,10 +385,10 @@ Bool_t calibration::Process(Long64_t entry)
 
 	      //Cut on Shower vs preshower is a tilted ellipse, this requires an angle of rotation (in radians), x/y center, semimajor and semiminor axis
 	      Float_t eangle = 3.0*3.14159/4;
-	      Float_t ex_center = 0.66;
-	      Float_t ey_center = 0.35;
-	      Float_t esemimajor_axis = 0.28;
-	      Float_t esemiminor_axis = 0.04;
+	      Float_t ex_center = 0.375;
+	      Float_t ey_center = 0.360;
+	      Float_t esemimajor_axis = 0.38;
+	      Float_t esemiminor_axis = 0.05;
 	      if (pow((P_cal_fly_earray/p - ex_center)*cos(eangle) + (P_cal_pr_eplane/p - ey_center)*sin(eangle),2)/pow(esemimajor_axis,2) + 
 		  pow((P_cal_fly_earray/p - ex_center)*sin(eangle) - (P_cal_pr_eplane/p - ey_center)*cos(eangle),2)/pow(esemiminor_axis,2) < 1)
 		{
diff --git a/CALIBRATION/shms_hgcer_calib/calibration.h b/CALIBRATION/shms_hgcer_calib/calibration.h
index 728f1db5..f73c1ef2 100644
--- a/CALIBRATION/shms_hgcer_calib/calibration.h
+++ b/CALIBRATION/shms_hgcer_calib/calibration.h
@@ -319,6 +319,8 @@ public :
    Double_t        P_hgcer_goodAdcPulseIntRaw[4];   //[Ndata.P.hgcer.goodAdcPulseIntRaw]
    Int_t           Ndata_P_hgcer_goodAdcPulseTime;
    Double_t        P_hgcer_goodAdcPulseTime[4];   //[Ndata.P.hgcer.goodAdcPulseTime]
+   Int_t           Ndata_P_hgcer_goodAdcTdcDiffTime;
+   Double_t        P_hgcer_goodAdcTdcDiffTime[4];
    Int_t           Ndata_P_hgcer_npe;
    Double_t        P_hgcer_npe[4];   //[Ndata.P.hgcer.npe]
    Int_t           Ndata_P_hgcer_numGoodAdcHits;
@@ -1146,6 +1148,8 @@ public :
    TBranch        *b_P_hgcer_goodAdcPulseIntRaw;   //!
    TBranch        *b_Ndata_P_hgcer_goodAdcPulseTime;   //!
    TBranch        *b_P_hgcer_goodAdcPulseTime;   //!
+   TBranch        *b_Ndata_P_hgcer_goodAdcTdcDiffTime;
+   TBranch        *b_P_hgcer_goodAdcTdcDiffTime;
    TBranch        *b_Ndata_P_hgcer_npe;   //!
    TBranch        *b_P_hgcer_npe;   //!
    TBranch        *b_Ndata_P_hgcer_numGoodAdcHits;   //!
@@ -1723,7 +1727,7 @@ public :
    TBranch        *b_Event_Branch_fEvtHdr_fTargetPol;   //!
    TBranch        *b_Event_Branch_fEvtHdr_fRun;   //!
    
- calibration(TTree * /*tree*/ =0) : fChain(0) {fPulseInt = 0, fPulseInt_quad = 0, fCut_everything = 0, fCut_electron = 0, fCut_pion = 0, fFullRead = kFALSE, fFullShow = kFALSE, fNGC = kFALSE, fTrack = kFALSE, fCut = kFALSE, fPions = kFALSE;}
+ calibration(TTree * /*tree*/ =0) : fChain(0) {fPulseInt = 0, fPulseInt_quad = 0, fCut_everything = 0, fCut_electron = 0, fCut_pion = 0, fBeta_Cut = 0, fBeta_Full = 0, fTiming_Cut = 0, fTiming_Full = 0, fFullRead = kFALSE, fFullShow = kFALSE, fNGC = kFALSE, fTrack = kFALSE, fCut = kFALSE, fPions = kFALSE;}
    virtual ~calibration() { }
    virtual Int_t   Version() const { return 2; }
    virtual void    Begin(TTree *tree);
@@ -2008,6 +2012,8 @@ void calibration::Init(TTree *tree)
    fChain->SetBranchAddress("P.hgcer.goodAdcPulseIntRaw", P_hgcer_goodAdcPulseIntRaw, &b_P_hgcer_goodAdcPulseIntRaw);
    fChain->SetBranchAddress("Ndata.P.hgcer.goodAdcPulseTime", &Ndata_P_hgcer_goodAdcPulseTime, &b_Ndata_P_hgcer_goodAdcPulseTime);
    fChain->SetBranchAddress("P.hgcer.goodAdcPulseTime", P_hgcer_goodAdcPulseTime, &b_P_hgcer_goodAdcPulseTime);
+   fChain->SetBranchAddress("Ndata.P.hgcer.goodAdcTdcDiffTime", &Ndata_P_hgcer_goodAdcTdcDiffTime, &b_Ndata_P_hgcer_goodAdcTdcDiffTime);
+   fChain->SetBranchAddress("P.hgcer.goodAdcTdcDiffTime", P_hgcer_goodAdcTdcDiffTime, &b_P_hgcer_goodAdcTdcDiffTime);
    fChain->SetBranchAddress("Ndata.P.hgcer.npe", &Ndata_P_hgcer_npe, &b_Ndata_P_hgcer_npe);
    fChain->SetBranchAddress("P.hgcer.npe", P_hgcer_npe, &b_P_hgcer_npe);
    fChain->SetBranchAddress("Ndata.P.hgcer.numGoodAdcHits", &Ndata_P_hgcer_numGoodAdcHits, &b_Ndata_P_hgcer_numGoodAdcHits);
diff --git a/CALIBRATION/shms_hgcer_calib/efficiencies.C b/CALIBRATION/shms_hgcer_calib/efficiencies.C
index 570d974b..3d299a0e 100644
--- a/CALIBRATION/shms_hgcer_calib/efficiencies.C
+++ b/CALIBRATION/shms_hgcer_calib/efficiencies.C
@@ -171,20 +171,20 @@ void efficiencies::SlaveBegin(TTree * /*tree*/)
   fBeta_Full = new TH1F("Beta_Full", "Full beta for events;Beta;Counts", 1000, -5, 5);
   GetOutputList()->Add(fBeta_Full);
 
-  fTiming_Cut = new TH1F("Timing_Cut", "Timing cut used for 'good' hits;Time (ns);Counts", 10000, 1, 200);
+  fTiming_Cut = new TH1F("Timing_Cut", "Timing cut used for 'good' hits;Time (ns);Counts", 10000, -40, 0);
   GetOutputList()->Add(fTiming_Cut);
 
-  fTiming_Full = new TH1F("Timing_Full", "Full timing information for events;Time (ns);Counts", 10000, 1, 200);
+  fTiming_Full = new TH1F("Timing_Full", "Full timing information for events;Time (ns);Counts", 10000, -40, 0);
   GetOutputList()->Add(fTiming_Full);
 
   //Histograms examining particle ID cuts
-  fFly_Pr_Full = new TH2F("Fly_Pr_Full", "Particle ID from calorimeter & preshower;Calorimeter (GeV);Pre-Shower (GeV)", 200, 0.0, 1.0, 200, 0.0, 1.0);
+  fFly_Pr_Full = new TH2F("Fly_Pr_Full", "Particle ID from calorimeter & preshower;Calorimeter (GeV);Pre-Shower (GeV)", 250, 0.0, 0.7, 250, 0.0, 0.8);
   GetOutputList()->Add(fFly_Pr_Full);
   
-  fFly_Pr_eCut = new TH2F("Fly_Pr_eCut", "calorimeter & preshower electrons;Calorimeter (GeV);Pre-Shower (GeV)", 200, 0.0, 1.0, 200, 0.0, 1.0);
+  fFly_Pr_eCut = new TH2F("Fly_Pr_eCut", "calorimeter & preshower electrons;Calorimeter (GeV);Pre-Shower (GeV)", 250, 0.0, 0.7, 250, 0.0, 0.8);
   GetOutputList()->Add(fFly_Pr_eCut);
 
-  fFly_Pr_piCut = new TH2F("Fly_Pr_piCut", "calorimeter & preshower pions;Calorimeter (GeV);Pre-Shower (GeV)", 200, 0.0, 1.0, 200, 0.0, 1.0);
+  fFly_Pr_piCut = new TH2F("Fly_Pr_piCut", "calorimeter & preshower pions;Calorimeter (GeV);Pre-Shower (GeV)", 250, 0.0, 0.7, 250, 0.0, 0.8);
   GetOutputList()->Add(fFly_Pr_piCut);
 
   printf("\n\n");
@@ -225,18 +225,18 @@ Bool_t efficiencies::Process(Long64_t entry)
       //Require loose cut on particle velocity
       b_P_tr_beta->GetEntry(entry);
       fBeta_Full->Fill(P_tr_beta[itrack]);
-      if (TMath::Abs(P_tr_beta[itrack] - 0.7) > 0.3) return kTRUE;
+      if (TMath::Abs(P_tr_beta[itrack] - 1.0) > 0.2) return kTRUE;
       fBeta_Cut->Fill(P_tr_beta[itrack]);
 
       //Filling the histograms
       for (Int_t ipmt = 0; ipmt < hgc_pmts; ipmt++)
 	{
 	  //Require the signal passes a timing cut
-	  fNGC ? b_P_ngcer_goodAdcPulseTime->GetEntry(entry) : b_P_hgcer_goodAdcPulseTime->GetEntry(entry);
-	  fTiming_Full->Fill(fNGC ?  P_ngcer_goodAdcPulseTime[ipmt] : P_hgcer_goodAdcPulseTime[ipmt]);
+	  fNGC ? b_P_ngcer_goodAdcPulseTime->GetEntry(entry) : b_P_hgcer_goodAdcTdcDiffTime->GetEntry(entry);
+	  fTiming_Full->Fill(fNGC ?  P_ngcer_goodAdcPulseTime[ipmt] : P_hgcer_goodAdcTdcDiffTime[ipmt]);
 	  if (fNGC ? P_ngcer_goodAdcPulseTime[ipmt] < 50 || P_ngcer_goodAdcPulseTime[ipmt] > 125 :
-	  P_hgcer_goodAdcPulseTime[ipmt] < 50 || P_hgcer_goodAdcPulseTime[ipmt] > 70) continue;
-	  fTiming_Cut->Fill(fNGC ?  P_ngcer_goodAdcPulseTime[ipmt] : P_hgcer_goodAdcPulseTime[ipmt]);
+	  P_hgcer_goodAdcTdcDiffTime[ipmt] > -17.0 || P_hgcer_goodAdcTdcDiffTime[ipmt] < -30.0) continue;
+	  fTiming_Cut->Fill(fNGC ?  P_ngcer_goodAdcPulseTime[ipmt] : P_hgcer_goodAdcTdcDiffTime[ipmt]);
 
 	  //Require the signal passes a tracking cut, with a threshold NPE cut as well
 	  fNGC ? b_P_ngcer_numTracksFired->GetEntry(entry) : b_P_hgcer_numTracksFired->GetEntry(entry);
@@ -248,7 +248,7 @@ Bool_t efficiencies::Process(Long64_t entry)
 	  b_P_cal_fly_earray->GetEntry(entry);
 	  b_P_cal_pr_eplane->GetEntry(entry);
 	  b_P_gtr_dp->GetEntry(entry);
-	  Float_t central_p = 3.0;
+	  Float_t central_p = 2.2;
 	  Float_t p = ((P_gtr_dp/100.0)*central_p) + central_p;
 
 	  //Visualize what we have to cut with
@@ -256,14 +256,16 @@ Bool_t efficiencies::Process(Long64_t entry)
 
 	  //Perform cut for electrons
 	  //Cut on Shower vs preshower is a tilted ellipse, this requires an angle of rotation (in radians), x/y center, semimajor and semiminor axis
-	  Float_t eangle = 3.0*3.14159/4.0;
-	  //Float_t eangle2 = 3.14159/4.0;
+	  /*Float_t eangle = 3.0*3.14159/4.0;
 	  Float_t ex_center = 0.66;
-	  //Float_t ex_center2 = -0.04;
 	  Float_t ey_center = 0.35;
-	  //Float_t ey_center2 = -0.03;
 	  Float_t esemimajor_axis = 0.28;
-	  Float_t esemiminor_axis = 0.04;
+	  Float_t esemiminor_axis = 0.04;*/
+	  Float_t eangle = 3.0*3.14159/4.0;
+	  Float_t ex_center = 0.375;
+	  Float_t ey_center = 0.360;
+	  Float_t esemimajor_axis = 0.38;
+	  Float_t esemiminor_axis = 0.05;
 	  if (pow((P_cal_fly_earray/p - ex_center)*cos(eangle) + (P_cal_pr_eplane/p - ey_center)*sin(eangle),2)/pow(esemimajor_axis,2) + 
 	      pow((P_cal_fly_earray/p - ex_center)*sin(eangle) - (P_cal_pr_eplane/p - ey_center)*cos(eangle),2)/pow(esemiminor_axis,2) < 1)
 	    {
@@ -283,10 +285,14 @@ Bool_t efficiencies::Process(Long64_t entry)
 
 	  //Perform cut for pions
 	  //Cut on Shower vs preshower is a tilted ellipse, this requires an angle of rotation (in radians), x/y center, semimajor and semiminor axis
-	  Float_t piangle = 0.0;
+	  Float_t piangle = 0.0;/*
 	  Float_t pix_center = 0.26;
 	  Float_t piy_center = 0.03;
 	  Float_t pisemimajor_axis = 0.1;
+	  Float_t pisemiminor_axis = 0.02;*/
+	  Float_t pix_center = 0.00;
+	  Float_t piy_center = 0.00;
+	  Float_t pisemimajor_axis = 0.01;
 	  Float_t pisemiminor_axis = 0.02;
 	  if (pow((P_cal_fly_earray/p - pix_center)*cos(piangle) + (P_cal_pr_eplane/p - piy_center)*sin(piangle),2)/pow(pisemimajor_axis,2) + 
 	      pow((P_cal_fly_earray/p - pix_center)*sin(piangle) - (P_cal_pr_eplane/p - piy_center)*cos(piangle),2)/pow(pisemiminor_axis,2) < 1)
diff --git a/CALIBRATION/shms_hgcer_calib/efficiencies.h b/CALIBRATION/shms_hgcer_calib/efficiencies.h
index 2ca1d24c..2815ee91 100644
--- a/CALIBRATION/shms_hgcer_calib/efficiencies.h
+++ b/CALIBRATION/shms_hgcer_calib/efficiencies.h
@@ -297,6 +297,8 @@ public :
    Double_t        P_hgcer_goodAdcPulseIntRaw[4];   //[Ndata.P.hgcer.goodAdcPulseIntRaw]
    Int_t           Ndata_P_hgcer_goodAdcPulseTime;
    Double_t        P_hgcer_goodAdcPulseTime[4];   //[Ndata.P.hgcer.goodAdcPulseTime]
+   Int_t           Ndata_P_hgcer_goodAdcTdcDiffTime;
+   Double_t        P_hgcer_goodAdcTdcDiffTime[4];
    Int_t           Ndata_P_hgcer_npe;
    Double_t        P_hgcer_npe[4];   //[Ndata.P.hgcer.npe]
    Int_t           Ndata_P_hgcer_numGoodAdcHits;
@@ -1124,6 +1126,8 @@ public :
    TBranch        *b_P_hgcer_goodAdcPulseIntRaw;   //!
    TBranch        *b_Ndata_P_hgcer_goodAdcPulseTime;   //!
    TBranch        *b_P_hgcer_goodAdcPulseTime;   //!
+   TBranch        *b_Ndata_P_hgcer_goodAdcTdcDiffTime;
+   TBranch        *b_P_hgcer_goodAdcTdcDiffTime;
    TBranch        *b_Ndata_P_hgcer_npe;   //!
    TBranch        *b_P_hgcer_npe;   //!
    TBranch        *b_Ndata_P_hgcer_numGoodAdcHits;   //!
@@ -1986,6 +1990,8 @@ void efficiencies::Init(TTree *tree)
    fChain->SetBranchAddress("P.hgcer.goodAdcPulseIntRaw", P_hgcer_goodAdcPulseIntRaw, &b_P_hgcer_goodAdcPulseIntRaw);
    fChain->SetBranchAddress("Ndata.P.hgcer.goodAdcPulseTime", &Ndata_P_hgcer_goodAdcPulseTime, &b_Ndata_P_hgcer_goodAdcPulseTime);
    fChain->SetBranchAddress("P.hgcer.goodAdcPulseTime", P_hgcer_goodAdcPulseTime, &b_P_hgcer_goodAdcPulseTime);
+   fChain->SetBranchAddress("Ndata.P.hgcer.goodAdcTdcDiffTime", &Ndata_P_hgcer_goodAdcTdcDiffTime, &b_Ndata_P_hgcer_goodAdcTdcDiffTime);
+   fChain->SetBranchAddress("P.hgcer.goodAdcTdcDiffTime", P_hgcer_goodAdcTdcDiffTime, &b_P_hgcer_goodAdcTdcDiffTime);
    fChain->SetBranchAddress("Ndata.P.hgcer.npe", &Ndata_P_hgcer_npe, &b_Ndata_P_hgcer_npe);
    fChain->SetBranchAddress("P.hgcer.npe", P_hgcer_npe, &b_P_hgcer_npe);
    fChain->SetBranchAddress("Ndata.P.hgcer.numGoodAdcHits", &Ndata_P_hgcer_numGoodAdcHits, &b_Ndata_P_hgcer_numGoodAdcHits);
diff --git a/PARAM/SHMS/HGCER/CALIB/phgcer_calib.param b/PARAM/SHMS/HGCER/CALIB/phgcer_calib.param
index 399444f9..46a2d429 100644
--- a/PARAM/SHMS/HGCER/CALIB/phgcer_calib.param
+++ b/PARAM/SHMS/HGCER/CALIB/phgcer_calib.param
@@ -1,2 +1,2 @@
-; Garth H. gain calibration from run 488, June 20 2017
-phgcer_adc_to_npe = 1.0/6.587, 1.0/7.088, 1.0/6.462, 1.0/6.414
+; Garth H. gain calibration from Run 1583, Dec 14 2017
+phgcer_adc_to_npe = 1.0/6.587, 1.0/7.069, 1.0/6.507, 1.0/6.367
-- 
GitLab