diff --git a/src/THcShower.cxx b/src/THcShower.cxx index 06d6d44d0ac9ad472ac4fae63b26ae132d875fdf..1d454d0dde76f35b4905ee425b007711c5c8e1ab 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -516,6 +516,8 @@ Int_t THcShower::DefineVariables( EMode mode ) { "etotnorm", "Total energy divided by Central Momentum", "fEtotNorm" }, { "etrack", "Track energy", "fEtrack" }, { "etracknorm", "Total energy divided by track momentum", "fEtrackNorm" }, + { "eprtrack", "Track Preshower energy", "fEPRtrack" }, + { "eprtracknorm", "Preshower energy divided by track momentum", "fEPRtrackNorm" }, { "ntracks", "Number of shower tracks", "fNtracks" }, { 0 } }; @@ -597,6 +599,8 @@ void THcShower::Clear(Option_t* opt) fEtotNorm = 0.; fEtrack = 0.; fEtrackNorm = 0.; + fEPRtrack = 0.; + fEPRtrackNorm = 0.; fSizeClustArray = 0; fNblockHighEnergy = 0.; @@ -767,13 +771,15 @@ Int_t THcShower::CoarseProcess( TClonesArray& tracks) // Do same for Array. if(fHasArray) fArray->CoarseProcess(tracks); + // Int_t Ntracks = tracks.GetLast()+1; // Number of reconstructed tracks Double_t save_energy=0; for (Int_t itrk=0; itrk<Ntracks; itrk++) { THaTrack* theTrack = static_cast<THaTrack*>( tracks[itrk] ); - save_energy = GetShEnergy(theTrack); + // save_energy = GetShEnergy(theTrack); + save_energy = GetShEnergy(theTrack, fNLayers); if (fHasArray) save_energy += fArray->GetShEnergy(theTrack); theTrack->SetEnergy(save_energy); } //over tracks @@ -1046,10 +1052,10 @@ Int_t THcShower::MatchCluster(THaTrack* Track, } //_____________________________________________________________________________ -Float_t THcShower::GetShEnergy(THaTrack* Track) { +Float_t THcShower::GetShEnergy(THaTrack* Track, UInt_t NLayers, UInt_t L0) { - // Get total energy deposited in the cluster matched to the given - // spectrometer Track. + // Get part of energy deposited in the cluster matched to the given + // spectrometer Track, limited by range of layers from L0 to L0+NLayers-1. // Track coordinates at front of the calorimeter, initialize out of // acceptance. @@ -1071,7 +1077,8 @@ Float_t THcShower::GetShEnergy(THaTrack* Track) { // Correct track energy depositions for the impact coordinate. - for (UInt_t ip=0; ip<fNLayers; ip++) { + // for (UInt_t ip=0; ip<fNLayers; ip++) { + for (UInt_t ip=L0; ip<L0+NLayers; ip++) { // Coordinate correction factors for positive and negative sides, // different for double PMT counters in the 1-st two layes and for @@ -1110,6 +1117,7 @@ Float_t THcShower::GetShEnergy(THaTrack* Track) { else cout << ", no matched cluster found." << endl; + cout << " Layers from " << L0+1 << " to " << L0+NLayers << ".\n"; cout << " Coordinate corrected track energy = " << Etrk << "." << endl; cout << "---------------------------------------------------------------\n"; } @@ -1132,6 +1140,8 @@ Int_t THcShower::FineProcess( TClonesArray& tracks ) if (theTrack->GetIndex()==0) { fEtrack=theTrack->GetEnergy(); fEtrackNorm=fEtrack/theTrack->GetP(); + fEPRtrack=GetShEnergy(theTrack,1); + fEPRtrackNorm=fEPRtrack/theTrack->GetP(); Xtr = -100.; Ytr = -100.; fNclustTrack = MatchCluster(theTrack, Xtr, Ytr); diff --git a/src/THcShower.h b/src/THcShower.h index 464f753d46384f2e565528979f622f4bf7d69124..4b7c9786b84ea98b9869f32dac99aabcaf1260b7 100644 --- a/src/THcShower.h +++ b/src/THcShower.h @@ -111,10 +111,10 @@ public: return (fCcor[side] + sign*y)/(fCcor[side] + sign*y/fDcor[side]); } - // Get total energy deposited in the cluster matched to the given - // spectrometer Track. + // Get part of energy deposited in the cluster matched to the given + // spectrometer Track, limited by a range of layers. - Float_t GetShEnergy(THaTrack*); + Float_t GetShEnergy(THaTrack*, UInt_t NLayers, UInt_t L0=0); THcShower(); // for ROOT I/O @@ -163,7 +163,9 @@ protected: Double_t fEtot; // Total energy Double_t fEtotNorm; // Total energy divided by spec central momentum Double_t fEtrack; // Cluster energy associated to the best track - Double_t fEtrackNorm; // Cluster energy associated to the best track + Double_t fEtrackNorm; // Normalized to momentum cluster energy associated to the best track + Double_t fEPRtrack; // Cluster's Preshower energy of the best track + Double_t fEPRtrackNorm; // Normalized to momentum cluster's Preshower energy of the best track THcShowerClusterList* fClusterList; // List of hit clusters