From c30c06cf2237c941c20b0db9a3846dbf3d26e488 Mon Sep 17 00:00:00 2001
From: Vardan Tadevosyan <tadevosn@jlab.org>
Date: Thu, 27 Apr 2017 10:26:46 -0400
Subject: [PATCH] Small Shower Calorimeter corrections, chagnes and cleanups

Make matched cluster variables of the array part of calorimeter private.

Initialize fY variable in the THcShowerHit::THcShowerHit default
constructor.

Correct typo in THcShowerArray::Clear, assign -1000 to fMatchClY.

Edit debug output in THcShowerArray::CoarseProcess and remove obsolete
comments THcShowerArray::MatchCluster.

Clear fSizeClustArray and fNblockHighEnergy quantitites in
THcShower::Clear, for just in case.
---
 src/THcShower.cxx      | 2 ++
 src/THcShowerArray.cxx | 8 +++-----
 src/THcShowerArray.h   | 9 +++++----
 src/THcShowerHit.cxx   | 2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/THcShower.cxx b/src/THcShower.cxx
index 0b0c06f..06d6d44 100644
--- a/src/THcShower.cxx
+++ b/src/THcShower.cxx
@@ -597,6 +597,8 @@ void THcShower::Clear(Option_t* opt)
   fEtotNorm = 0.;
   fEtrack = 0.;
   fEtrackNorm = 0.;
+  fSizeClustArray = 0;
+  fNblockHighEnergy = 0.;
 
   // Purge cluster list
 
diff --git a/src/THcShowerArray.cxx b/src/THcShowerArray.cxx
index f6aaa2c..57a231f 100644
--- a/src/THcShowerArray.cxx
+++ b/src/THcShowerArray.cxx
@@ -388,7 +388,7 @@ void THcShowerArray::Clear( Option_t* )
   fClustSize = 0;
   fNtracks = 0;
   fMatchClX = -1000.;
-  fMatchClX = -1000.;
+  fMatchClY = -1000.;
   fMatchClMaxEnergyBlock = -1000.;
 
   for (THcShowerClusterListIt i=fClusterList->begin(); i!=fClusterList->end();
@@ -495,6 +495,7 @@ Int_t THcShowerArray::CoarseProcess( TClonesArray& tracks )
 	   <<":  E=" << clE(*ppcl)
 	   << "  Epr=" << clEpr(*ppcl)
 	   << "  X=" << clX(*ppcl)
+	   << "  Y=" << clY(*ppcl)
 	   << "  Z=" << clZ(*ppcl)
 	   << "  size=" << (**ppcl).size()
 	   << endl;
@@ -578,16 +579,13 @@ Int_t THcShowerArray::MatchCluster(THaTrack* Track,
 
     // Since hits and clusters are in reverse order (with respect to Engine),
     // search backwards to be consistent with Engine.
-    //
-    // Note: cluster Z coordinate is used here as Y, for Z variable
-    // of the THcShowerHit class was used to save Y coordinates of hits.
 
     for (Int_t i=fNclust-1; i>-1; i--) {
 
       THcShowerCluster* cluster = *(fClusterList->begin()+i);
       fClustSize = (*cluster).size();
       Double_t dx = TMath::Abs( clX(cluster) - XTrFront );
-      Double_t dy = TMath::Abs( clY(cluster) - YTrFront ); //cluster Z for Y.
+      Double_t dy = TMath::Abs( clY(cluster) - YTrFront );
       Double_t distance = TMath::Sqrt(dx*dx+dy*dy);        //cluster-track dist.
   if (fParent->fdbg_tracks_cal) {  
     cout << " match clust = " << i << " clX = " << clX(cluster)<< " clY = " << clY(cluster) << " distacne = " << distance << " test = " << (0.5*(fXStep + fYStep) + fParent->fSlop) << endl;
diff --git a/src/THcShowerArray.h b/src/THcShowerArray.h
index ee3740a..a7e2a0e 100644
--- a/src/THcShowerArray.h
+++ b/src/THcShowerArray.h
@@ -61,10 +61,6 @@ public:
   // spectrometer Track.
 
   Float_t GetShEnergy(THaTrack*);
-  Double_t fMatchClX;
-  Double_t fMatchClY;
-  Double_t fMatchClMaxEnergyBlock;
-  Double_t fClustSize;
   Double_t GetClMaxEnergyBlock() {
     return fMatchClMaxEnergyBlock;
   };
@@ -169,6 +165,11 @@ Int_t fPedSampLow;		// Sample range for
   Int_t fNtracks;            // Number of shower tracks, i.e. number of
                              // cluster-to-track associations
 
+  Double_t fMatchClX;
+  Double_t fMatchClY;
+  Double_t fMatchClMaxEnergyBlock;
+  Double_t fClustSize;
+
   THcShowerClusterList* fClusterList;   // List of hit clusters
 
   TClonesArray* frAdcPedRaw;
diff --git a/src/THcShowerHit.cxx b/src/THcShowerHit.cxx
index 3345f90..28be5d4 100644
--- a/src/THcShowerHit.cxx
+++ b/src/THcShowerHit.cxx
@@ -10,7 +10,7 @@ using namespace std;
 
 THcShowerHit::THcShowerHit() {         //default constructor
   fCol=fRow=0;
-  fX=fZ=0.;
+  fX=fY=fZ=0.;
   fE=0.;
   fEpos=0.;
   fEneg=0.;
-- 
GitLab