From c543140a59a51236811bf235ef596e3126286a37 Mon Sep 17 00:00:00 2001 From: Vardan Tadevosyan <tadevosn@jlab.org> Date: Sun, 10 Jan 2016 18:30:53 +0400 Subject: [PATCH] Add tracking in THcShowerArray. --- src/THcShower.cxx | 1 + src/THcShowerArray.cxx | 49 ++++++++++++++++++++++++++++++++++++++++++ src/THcShowerArray.h | 7 +++++- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/THcShower.cxx b/src/THcShower.cxx index 7c5b9b0..051d1df 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -1069,6 +1069,7 @@ Int_t THcShower::FineProcess( TClonesArray& tracks ) THaTrack* theTrack = static_cast<THaTrack*>( tracks[itrk] ); Float_t energy = GetShEnergy(theTrack); + if (fHasArray) energy += fArray->GetShEnergy(theTrack); theTrack->SetEnergy(energy); } //over tracks diff --git a/src/THcShowerArray.cxx b/src/THcShowerArray.cxx index 6cd59e6..29e3f48 100644 --- a/src/THcShowerArray.cxx +++ b/src/THcShowerArray.cxx @@ -531,6 +531,55 @@ Int_t THcShowerArray::MatchCluster(THaTrack* Track, return mclust; } +//_____________________________________________________________________________ +Float_t THcShowerArray::GetShEnergy(THaTrack* Track) { + + // Get total energy deposited in the Array cluster matched to the given + // spectrometer Track. + + // Track coordinates at the front of Array, initialize out of acceptance. + Double_t Xtr = -100.; + Double_t Ytr = -100.; + + // Associate a cluster to the track. + + Int_t mclust = MatchCluster(Track, Xtr, Ytr); + + // Coordinate corrected total energy deposition in the cluster. + + Float_t Etrk = 0.; + if (mclust >= 0) { // if there is a matched cluster + + // Get matched cluster. + THcShowerCluster* cluster = *(fClusterList->begin()+mclust); + + // No coordinate correction for now. + Etrk = clE(cluster); + + } //mclust>=0 + + //Debug output. + + THcShower* fParent = (THcShower*) GetParent(); + + if (fParent->fdbg_tracks_cal) { + cout << "---------------------------------------------------------------\n"; + cout << "Debug output from THcShowerArray::GetShEnergy for " + << GetName() << endl; + + cout << " Track at Array: X = " << Xtr << " Y = " << Ytr; + if (mclust >= 0) + cout << ", matched cluster #" << mclust << "." << endl; + else + cout << ", no matched cluster found." << endl; + + cout << " Track's Array energy = " << Etrk << "." << endl; + cout << "---------------------------------------------------------------\n"; + } + + return Etrk; +} + //_____________________________________________________________________________ Int_t THcShowerArray::FineProcess( TClonesArray& tracks ) { diff --git a/src/THcShowerArray.h b/src/THcShowerArray.h index 7260c2f..6f1b4c0 100644 --- a/src/THcShowerArray.h +++ b/src/THcShowerArray.h @@ -52,6 +52,11 @@ public: // Cluster to track association method. Int_t MatchCluster(THaTrack*, Double_t&, Double_t&); + // Get total energy deposited in the cluster matched to the given + // spectrometer Track. + + Float_t GetShEnergy(THaTrack*); + // Double_t fSpacing; not used TClonesArray* fParentHitList; @@ -125,7 +130,7 @@ protected: Double_t fEarray; // Total Energy deposition in the array. Int_t fNhits; // Total number of hits - Int_t fNclust; // Number of clusters +Int_t fNclust; // Number of clusters Int_t fNtracks; // Number of shower tracks, i.e. number of // cluster-to-track association -- GitLab