From d276508b4b59c804f4741833f33c5b0e0ba446a7 Mon Sep 17 00:00:00 2001
From: Mark Jones <jones@jlab.org>
Date: Tue, 2 Sep 2014 15:50:34 -0400
Subject: [PATCH] Fix problem with uninitialized variables used in
 THcHodoscope::Clear THcHodoscope::Clear is called at beginning of analysis
 before ReadDatabase and Init methods and therefore  MAXHODHITS and fNPlanes
 are uninitiated. Change Clear to ClearEvent Add call to ClearEvent in Decode
 Eliminate Clear method in THcHodoscope.h

---
 src/THcHodoscope.cxx | 5 +++--
 src/THcHodoscope.h   | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx
index 2f3ceab..f59fb46 100644
--- a/src/THcHodoscope.cxx
+++ b/src/THcHodoscope.cxx
@@ -686,7 +686,7 @@ void THcHodoscope::DeleteArrays()
 
 //_____________________________________________________________________________
 inline 
-void THcHodoscope::Clear( Option_t* opt)
+void THcHodoscope::ClearEvent()
 {
   // Reset per-event data.
 
@@ -696,7 +696,7 @@ void THcHodoscope::Clear( Option_t* opt)
   }
 
   for(Int_t ip=0;ip<fNPlanes;ip++) {
-    fPlanes[ip]->Clear(opt);
+    fPlanes[ip]->Clear();
     fFPTime[ip]=0.;
     fPlaneCenter[ip]=0.;
     fPlaneSpacing[ip]=0.;
@@ -706,6 +706,7 @@ void THcHodoscope::Clear( Option_t* opt)
 //_____________________________________________________________________________
 Int_t THcHodoscope::Decode( const THaEvData& evdata )
 {
+  ClearEvent();
   // Get the Hall C style hitlist (fRawHitList) for this event
   Int_t nhits = DecodeToHitList(evdata);
   //
diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h
index a8cf788..18bbed3 100644
--- a/src/THcHodoscope.h
+++ b/src/THcHodoscope.h
@@ -39,7 +39,6 @@ public:
 		   THaApparatus* a = NULL );
   virtual ~THcHodoscope();
 
-  virtual void  Clear( Option_t* opt="" );
   virtual Int_t      Decode( const THaEvData& );
   virtual EStatus    Init( const TDatime& run_time );
   
-- 
GitLab