3 #include "StCustomFilter.h"
9 #include "StTrackGeometry.h"
10 #include "StTrackDetectorInfo.h"
12 #include "StarClassLibrary/BetheBloch.h"
13 #include "StEvent/StDedxPidTraits.h"
28 StCustomFilter::~StCustomFilter()
33 const char **StCustomFilter::GetNams()
const
36 static const char *nams[] = {
43 " dEdxFractionCutHigh ",
45 " dEdxFractionCutLow ",
51 const float *StCustomFilter::GetDefs()
const
55 static const float defs[] = {
73 Int_t StCustomFilter::Accept(
StPoints3DABC *pnt, Color_t&color, Size_t&size, Style_t&style)
104 to = pnt->GetObject();
107 if (!to->InheritsFrom(StTrack::Class()))
return 1;
111 return Accept(trk,color,size,style);
114 Int_t StCustomFilter::Accept(
const StTrack*
track,Color_t&color, Size_t&size, Style_t&style)
133 float pCutHigh = fpCutHigh;
134 int nHitsCutHighP = int(fnHitsCutHighP);
137 float pCutLow = fpCutLow;
138 int nHitsCutLowP = int(fnHitsCutLowP);
139 int chargeForLowP = int(fchargeForLowP);
140 float dEdxMassCutHigh = fdEdxMassCutHigh;
141 float dEdxFractionCutHigh = fdEdxFractionCutHigh;
142 float dEdxMassCutLow = fdEdxMassCutLow;
143 float dEdxFractionCutLow = fdEdxFractionCutLow;
150 float magnitude = track->geometry()->momentum().magnitude();
151 int nPoints = track->detectorInfo()->numberOfPoints();
153 if ( magnitude > pCutHigh && nPoints >= nHitsCutHighP) iret = 1;
155 if ( magnitude > pCutLow && nPoints >= nHitsCutLowP )
158 if (chargeForLowP==0)
160 else if (track->geometry()->charge() == chargeForLowP)
165 float dedxHigh = dEdxFractionCutHigh * mBB->Sirrf(magnitude/dEdxMassCutHigh);
166 float dedxLow = dEdxFractionCutLow * mBB->Sirrf(magnitude/dEdxMassCutLow);
170 const StSPtrVecTrackPidTraits& traits = track->pidTraits();
172 for (
unsigned int itrait = 0; itrait < traits.size(); itrait++){
174 if (traits[itrait]->detector() == kTpcId) {
177 if (dedxPidTr && dedxPidTr->method() == kTruncatedMeanId) {
179 dedx = 2 * dedxPidTr->mean();
183 if (dedx > dedxHigh && dedx > dedxLow)
186 iret = chargeOK * dedxOK;