diff --git a/src/THcShower.cxx b/src/THcShower.cxx index 622473fad9f08cb27d92941caafadc4fbd7ad3cd..89304b36bc8b23fc878cc959d8ad24e858928e4f 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -1079,27 +1079,36 @@ Float_t THcShower::GetShEnergy(THaTrack* Track, UInt_t NLayers, UInt_t L0) { THcShowerCluster* cluster = *(fClusterList->begin()+mclust); + char prefix = GetApparatus()->GetName()[0]; + // Correct track energy depositions for the impact coordinate. // 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 - // single PMT counters in the rear two layers. + // different for double PMT counters in the 1-st two HMS layes, + // single PMT counters in the rear two HMS layers, and in the SHMS + // Preshower. Float_t corpos = 1.; Float_t corneg = 1.; if (ip < fNegCols) { - corpos = Ycor(Ytr,0); - corneg = Ycor(Ytr,1); + if (prefix == 'H') { //HMS 1-st 2 layers + corpos = Ycor(Ytr,0); + corneg = Ycor(Ytr,1); + } + else { //SHMS Preshower + corpos = YcorPr(Ytr,0); + corneg = YcorPr(Ytr,1); + } } else { corpos = Ycor(Ytr); corneg = 0.; } - // cout << ip << " clust energy pos = " << clEplane(cluster,ip,0)<< " clust energy pos = " << clEplane(cluster,ip,1) << endl; + // cout << ip << " clust energy pos = " << clEplane(cluster,ip,0)<< " clust energy neg = " << clEplane(cluster,ip,1) << endl; Etrk += clEplane(cluster,ip,0) * corpos; Etrk += clEplane(cluster,ip,1) * corneg; diff --git a/src/THcShower.h b/src/THcShower.h index d78e265adcc1ce013208045651c502eb5a77b7b1..05813db2b0190f77dc20261ea8300690f8f53a2e 100644 --- a/src/THcShower.h +++ b/src/THcShower.h @@ -94,14 +94,14 @@ public: return fNBlocks[layer]; } - //Coordinate correction for single PMT modules. + //Coordinate correction for HMS single PMT modules. //PMT attached at right (positive) side. Float_t Ycor(Double_t y) { return TMath::Exp(y/fAcor)/(1. + y*y/fBcor); } - //Coordinate correction for double PMT modules. + //Coordinate correction for HMS double PMT modules. // Float_t Ycor(Double_t y, Int_t side) { @@ -114,6 +114,28 @@ public: return (fCcor[side] + sign*y)/(fCcor[side] + sign*y/fDcor[side]); } + // Coordinate correction for SHMS Preshower modules. + // + + Float_t YcorPr(Double_t y, Int_t side) { + + if (side!=0&&side!=1) { + cout << "THcShower::YcorPr : wrong side " << side << endl; + return 0.; + } + + Float_t cor; + + // Check if the hit coordinate matches the fired block's side. + + if ((y < 0. && side == 1) || (y > 0. && side == 0)) + cor = 1./(1. + TMath::Power(TMath::Abs(y)/fAcor, fBcor)); + else + cor = 1.; + + return cor; + } + // Get part of energy deposited in the cluster matched to the given // spectrometer Track, limited by a range of layers.