From be05b391a7a335e98e1940eadc3725a9557bcb0a Mon Sep 17 00:00:00 2001
From: hallc-online <hallconline@gmail.com>
Date: Fri, 10 Aug 2018 14:19:06 -0400
Subject: [PATCH] Modify THcHodoscope to add tree variables

Add tree variables TimeHist_Sigma, TimeHist_Peak and TimeHist_Hits
for the peak,sigma and number of hits of the histogram
 of PMT times used in EstimateFocalPlaneTime
---
 src/THcHodoscope.cxx | 11 ++++++++++-
 src/THcHodoscope.h   |  3 +++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx
index 5269058..e151061 100644
--- a/src/THcHodoscope.cxx
+++ b/src/THcHodoscope.cxx
@@ -546,7 +546,10 @@ Int_t THcHodoscope::DefineVariables( EMode mode )
     {"starttime",         "Hodoscope Start Time",                         "fStartTime"},
     {"goodstarttime",     "Hodoscope Good Start Time (logical flag)",                    "fGoodStartTime"},
     {"goodscinhit",       "Hit in fid area",                              "fGoodScinHits"},
-    { 0 }
+    {"TimeHist_Sigma",       "",                              "fTimeHist_Sigma"},
+    {"TimeHist_Peak",       "",                              "fTimeHist_Peak"},
+    {"TimeHist_Hits",       "",                              "fTimeHist_Hits"},
+     { 0 }
   };
   return DefineVarsFromList( vars, mode );
   //  return kOK;
@@ -632,6 +635,9 @@ void THcHodoscope::ClearEvent()
    *  Called by  THcHodoscope::Decode
    *
    */
+  fTimeHist_Sigma=  kBig;
+  fTimeHist_Peak=  kBig;
+  fTimeHist_Hits=  kBig;
 
   fBeta = 0.0;
   fBetaNoTrk = 0.0;
@@ -780,6 +786,9 @@ void THcHodoscope::EstimateFocalPlaneTime()
   Bool_t goodplanetime[fNPlanes];
   Bool_t twogoodtimes[nscinhits];
   Double_t tmin = 0.5*hTime->GetMaximumBin();
+  fTimeHist_Peak=  tmin;
+  fTimeHist_Sigma=  hTime->GetRMS();
+  fTimeHist_Hits=  hTime->Integral();
   for(Int_t ip=0;ip<fNumPlanesBetaCalc;ip++) {
     goodplanetime[ip] = kFALSE;
     Int_t nphits=fPlanes[ip]->GetNScinHits();
diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h
index d9d8352..217644c 100644
--- a/src/THcHodoscope.h
+++ b/src/THcHodoscope.h
@@ -155,6 +155,9 @@ protected:
   Double_t fFPTimeAll;
   Int_t fNfptimes;
   Bool_t* fPresentP;
+  Double_t fTimeHist_Peak;
+  Double_t fTimeHist_Sigma;
+  Double_t fTimeHist_Hits;
 
   Double_t     fBeta;
 
-- 
GitLab