From b37bb562b7a80d3eb42f71b12c265a6c24bf8b11 Mon Sep 17 00:00:00 2001
From: Vardan Tadevosyan <tadevosn@jlab.org>
Date: Tue, 18 Feb 2014 08:53:45 +0400
Subject: [PATCH] Add number of calorimeter tracks (track associated clusters)

---
 setup.sh          | 3 ++-
 src/THcShower.cxx | 4 ++++
 src/THcShower.h   | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/setup.sh b/setup.sh
index 8dea062..40260e5 100644
--- a/setup.sh
+++ b/setup.sh
@@ -7,4 +7,5 @@ export HCANALYZER=${MYDIR}
 if [ ! ${LD_LIBRARY_PATH} ]; then
   export LD_LIBRARY_PATH=""
 fi
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ANALYZER:$HCANALYZER
+#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ANALYZER:$HCANALYZER
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ANALYZER:$HCANALYZER:$PATH
diff --git a/src/THcShower.cxx b/src/THcShower.cxx
index 558ce07..82a3556 100644
--- a/src/THcShower.cxx
+++ b/src/THcShower.cxx
@@ -425,6 +425,7 @@ Int_t THcShower::DefineVariables( EMode mode )
  //   { "asum_p", "Sum of ped-subtracted ADCs",         "fAsum_p" },
  //   { "asum_c", "Sum of calibrated ADCs",             "fAsum_c" },
     { "nclust", "Number of clusters",                            "fNclust" },
+    { "ntracks", "Number of shower tracks",                      "fNtracks" },
     { "emax",   "Energy of largest cluster",                     "fE" },
     { "eprmax",   "Preshower Energy of largest cluster",         "fEpr" },
     { "xmax",      "x-position (cm) of largest cluster",         "fX" },
@@ -501,6 +502,7 @@ void THcShower::Clear(Option_t* opt)
 
   fNhits = 0;
   fNclust = 0;
+  fNtracks = 0;
   fMult = 0;
   fE = 0.;
   fEpr = 0.;
@@ -757,6 +759,8 @@ Int_t THcShower::CoarseProcess( TClonesArray& tracks)
 
     Int_t mclust = MatchCluster(theTrack, ClusterList, Xtr, Ytr);
 
+    if (mclust >= 0) fNtracks++;  // number of shower tracks
+
     // Do this for the 1-st track only for now.
     //
     if (itrk==0) {
diff --git a/src/THcShower.h b/src/THcShower.h
index 3ce02c7..fa13670 100644
--- a/src/THcShower.h
+++ b/src/THcShower.h
@@ -127,6 +127,8 @@ protected:
 
   Int_t fNhits;              // Total number of hits
   Int_t fNclust;             // Number of clusters
+  Int_t fNtracks;            // Number of shower tracks, i.e. tracks with
+                             // associated clusters
   Double_t fE;               // Energy of the largest cluster
   Double_t fEpr;             // Preshower Energy of the largest cluster
   Double_t fX;               // x-position (cm) of the largest cluster
-- 
GitLab