120 #include "StTpcDedxPidAlgorithm.h"
122 #include "StGlobalTrack.h"
123 #include "StParticleTypes.hh"
125 #include "StDedxPidTraits.h"
126 #include "StTrackNode.h"
127 #include "StTrackGeometry.h"
129 #include "BetheBloch.h"
131 #include "StBichsel/Bichsel.h"
132 #include "StBichsel/StdEdxModel.h"
135 static const char rcsid[] =
"$Id: StTpcDedxPidAlgorithm.cxx,v 2.31 2016/09/18 23:02:11 fisyak Exp $";
137 StTpcDedxPidAlgorithm::StTpcDedxPidAlgorithm(StDedxMethod dedxMethod)
138 : mTraits(0), mTrack(0), mDedxMethod(dedxMethod)
144 mParticles.push_back(StPionMinus::instance());
145 mParticles.push_back(StPionPlus::instance());
146 mParticles.push_back(StKaonMinus::instance());
147 mParticles.push_back(StKaonPlus::instance());
148 mParticles.push_back(StProton::instance());
152 StTpcDedxPidAlgorithm::operator() (
const StTrack&
track,
const StSPtrVecTrackPidTraits& vec)
161 for (UInt_t i=0; i<vec.size(); i++) {
163 if (p && p->detector() == kTpcId && p->method() == mDedxMethod) mTraits = p;
165 if (!mTraits)
return 0;
171 Double_t sigma, minSigma = 100000;
172 UInt_t minIndex = mParticles.size();
173 for (UInt_t k=0; k<mParticles.size(); k++) {
174 if (mParticles[k]->charge()*mTrack->geometry()->charge() > 0) {
175 if ((sigma = fabs(numberOfSigma(mParticles[k]))) < minSigma) {
177 minSigma = fabs(sigma);
181 return minIndex < mParticles.size() ? mParticles[minIndex] : 0;
187 if (!mTraits)
return DBL_MAX;
189 if (mTraits->numberOfPoints()==0)
return DBL_MAX;
196 Double_t dedx_expected;
197 Double_t dedx_resolution;
200 if (mTraits->mean() > 0) {
202 static_cast<const StGlobalTrack*
>( mTrack->node()->track(global));
203 if (gTrack && mTraits->length() > 0 ) {
204 Double_t pq = abs(gTrack->geometry()->momentum())*TMath::Abs(particle->charge());
205 Double_t bg = pq/particle->mass();
206 if (! m_Bichsel) m_Bichsel = Bichsel::Instance();
207 if (mDedxMethod == kTruncatedMeanId) {
208 Double_t log2dX = mTraits->log2dX();
209 if (log2dX <= 0) log2dX = 1;
210 dedx_expected = 1.e-6*m_Bichsel->GetI70M(TMath::Log10(bg),log2dX);
211 dedx_resolution = mTraits->errorOnMean();
212 if (dedx_resolution > 0)
213 z = TMath::Log(mTraits->mean()/dedx_expected)/dedx_resolution;
214 }
else if (mDedxMethod == kLikelihoodFitId) {
215 dedx_expected = 1.e-6*TMath::Exp(m_Bichsel->GetMostProbableZ(TMath::Log10(bg)));
216 dedx_resolution = mTraits->errorOnMean();
217 if (dedx_resolution > 0)
218 z = TMath::Log(mTraits->mean()/dedx_expected)/dedx_resolution;
219 }
else if (mDedxMethod == kOtherMethodId) {
220 dedx_expected = StdEdxModel::instance()->dNdx(bg);
221 dedx_resolution = mTraits->errorOnMean();
222 if (dedx_resolution > 0)
223 z = TMath::Log(mTraits->mean()/dedx_expected)/dedx_resolution;