From e0e3dbcc48151e9d461a34865166c5e7eb913549 Mon Sep 17 00:00:00 2001
From: Mark Jones <jones@jlab.org>
Date: Sun, 12 May 2019 11:09:58 -0400
Subject: [PATCH] Update ThcDriftChamber::LeftRight

The LeftRight method determines the sign of the wire
distance for each hit in the spacepoint by looping
through all combinations of wire signs and fitting each
combination with a line  and selecting
the combination with the lowest chi-squared.
The fit to the line is known as the "stub" which
is an array of the x,dx/dz, y and dy/dz of the fit
and is associated each spacepoint. The stubs are
used later in LinkStubs method
to match spacepoints between two chambers to give a
possible tracks.

Previously the LeftRight method would only fit a
stub for a spacepoint with 4 hits in the chamber if the
parameter flag  HMSStyleChamber was true.
HMSStyleChamber refers to the 6 GeV HMS chambers
and we do not have them anymore.
But not fitting the spacepoint, the stub
was filled with zeros for x,dx/dz,y and dy/dz
and these spacepoints would never be matched with
other spacepoints to form a possible track.
---
 src/THcDriftChamber.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/THcDriftChamber.cxx b/src/THcDriftChamber.cxx
index 6f2dac9..27e1440 100644
--- a/src/THcDriftChamber.cxx
+++ b/src/THcDriftChamber.cxx
@@ -1194,7 +1194,7 @@ void THcDriftChamber::LeftRight()
 	  iswhit <<= 1;
 	}
       }
-      if (nplaneshit >= fNPlanes-1) {
+      if ( (nplaneshit >= fNPlanes-1) || (nplaneshit >= fNPlanes-2 && !fHMSStyleChambers)) {
 	Double_t chi2;
 	chi2 = FindStub(nhits, sp,plane_list, bitpat, plusminus, stub);
 	if (fdebugstubchisq) cout << " pmloop = " << pmloop << " chi2 = " << chi2 << endl;
-- 
GitLab