1 #ifdef __TFG__VERSION__
2 #include "StPicoEvent/StPicoDst.h"
4 #include "StPidStatus.h"
5 #include "StBichsel/Bichsel.h"
6 #include "StBichsel/StdEdxModel.h"
7 #include "StBichsel/StdEdxPull.h"
8 #include "StGlobalTrack.h"
9 #include "StTrackGeometry.h"
16 btofPidTraits.setMatchFlag (pid.
matchFlag());
17 btofPidTraits.setYLocal (pid.yLocal());
18 btofPidTraits.setZLocal (pid.zLocal());
19 btofPidTraits.setThetaLocal (pid.thetaLocal());
21 btofPidTraits.setPathLength (pid.pathLength());
22 btofPidTraits.setBeta (pid.beta());
24 btofPidTraits.setPosition (pid.position());
27 btofPidTraits.setSigmaPion (pid.sigmaPion());
28 btofPidTraits.setSigmaKaon (pid.sigmaKaon());
29 btofPidTraits.setSigmaProton (pid.sigmaProton());
30 btofPidTraits.setProbElectron (pid.probElectron());
31 btofPidTraits.setProbPion (pid.probPion());
32 btofPidTraits.setProbKaon (pid.probKaon());
33 btofPidTraits.setProbProton (pid.probProton());
36 #ifdef __TFG__VERSION__
46 btofPidTraits.setBeta (pid.
btofBeta());
63 etofPidTraits.setMatchFlag( pid.
matchFlag ());
64 etofPidTraits.setLocalX( pid.localX ());
65 etofPidTraits.setLocalY( pid.localY ());
66 etofPidTraits.setThetaLocal( pid.thetaLocal ());
67 etofPidTraits.setPosition( pid.position ());
68 etofPidTraits.setDeltaX( pid.deltaX ());
69 etofPidTraits.setDeltaY( pid.deltaY ());
71 etofPidTraits.setPathLength( pid.pathLength ());
72 etofPidTraits.setBeta( pid.beta ());
75 #ifdef __TFG__VERSION__
79 etofPidTraits.setMatchFlag( pid.
matchFlag ());
84 etofPidTraits.setDeltaX( pid.
deltaX ());
85 etofPidTraits.setDeltaY( pid.
deltaY ());
86 etofPidTraits.setTimeOfFlight(pid.
tof ());
88 etofPidTraits.setBeta( pid.
beta ());
94 mtdPidTraits.setMatchFlag (pid.
matchFlag());
97 mtdPidTraits.setDeltaY (pid.
deltaY());
98 mtdPidTraits.setDeltaZ (pid.
deltaZ());
103 mtdPidTraits.setBeta (pid.
beta());
114 mtdPidTraits.setMatchFlag (pid.
matchFlag());
115 mtdPidTraits.setYLocal (pid.yLocal());
116 mtdPidTraits.setZLocal (pid.zLocal());
117 mtdPidTraits.setDeltaY (pid.deltaY());
118 mtdPidTraits.setDeltaZ (pid.deltaZ());
119 mtdPidTraits.setThetaLocal (pid.thetaLocal());
121 mtdPidTraits.setExpTimeOfFlight(pid.expTimeOfFlight());
122 mtdPidTraits.setPathLength (pid.pathLength());
123 mtdPidTraits.setBeta (pid.beta());
124 mtdPidTraits.setPosition (pid.position());
126 mtdPidTraits.setSigmaMuon (pid.
sigmaMuon());
127 mtdPidTraits.setProbMuon (pid.probMuon());
131 StPidStatus::StPidStatus(
StGlobalTrack *gTrack, Bool_t Usedx2) : PiDStatus(-1), fUsedx2(Usedx2) {
133 if (! gTrack)
return;
134 g3 = gTrack->geometry()->momentum();
135 StSPtrVecTrackPidTraits &traits = gTrack->pidTraits();
136 if (! traits.size())
return;
137 for (UInt_t i = 0; i < traits.size(); i++) {
139 if (! trait)
continue;
140 if ( trait->IsZombie())
continue;
141 Short_t
id = trait->detector()%100;
145 if (TMath::Abs(pid->yLocal()) < 1.8) fBTof =
new StBTofStatus(pid);
146 }
else if (
id == kETofId) {
150 }
else if (
id == kMtdId) {
154 }
else if (
id == kTpcId) {
157 switch (pid->method()) {
158 case kTruncatedMeanId: fI70 =
new StdEdxStatus(pid);
break;
159 case kLikelihoodFitId: fFit =
new StdEdxStatus(pid);
break;
160 case kEnsembleTruncatedMeanId: fI70U =
new StdEdxStatus(pid);
break;
161 case kWeightedTruncatedMeanId: fFitU =
new StdEdxStatus(pid);
break;
162 case kOtherMethodId: fdNdx =
new StdEdxStatus(pid);
break;
163 case kOtherMethodId2: fdNdxU =
new StdEdxStatus(pid);
break;
168 if (pidprob) fProb = pidprob;
175 StPidStatus::StPidStatus(
StMuTrack *muTrack, Bool_t Usedx2) : PiDStatus(-1), fUsedx2(Usedx2) {
177 if (! muTrack)
return;
197 if (probPidTraits.
dEdxFit() > 0) {
202 if (probPidTraits.
dNdxFit() > 0) {
209 btof= SetBTofPidTraits(muTrack->btofPidTraits());
219 mtd = SetMtdPidTraits(muTrack->mtdPidTraits());
225 #ifdef __TFG__VERSION__
227 StPidStatus::StPidStatus(
StPicoTrack *picoTrack, Bool_t Usedx2) : PiDStatus(-1), fUsedx2(Usedx2) {
229 if (! picoTrack)
return;
230 TVector3 gMom = picoTrack->
gMom();
241 if (picoTrack->
dEdx() > 0) {
251 if (picoTrack->
dNdx() > 0) {
259 pidBTof = SetBTofPidTraits(*StPicoDst::instance()->btofPidTraits(ibtof));
265 pidETof = SetETofPidTraits(*StPicoDst::instance()->etofPidTraits(ietof));
271 pidMtd = SetMtdPidTraits(*StPicoDst::instance()->mtdPidTraits(imtd));
279 void StPidStatus::Set() {
280 if (! fI70 && ! fFit && ! fdNdx)
return;
282 Double_t pMomentum = g3.mag();
285 PredBMN[0] = Pred70BMN[0] = 1;
286 PredBMN[1] = Pred70BMN[1] = -1;
287 memset (fStatus, 0,
sizeof(fStatus));
288 fStatus[kTruncatedMeanId] = fI70 ;
289 fStatus[kLikelihoodFitId] = fFit ;
290 fStatus[kEnsembleTruncatedMeanId] = fI70U ;
291 fStatus[kWeightedTruncatedMeanId] = fFitU ;
292 fStatus[kOtherMethodId] = fdNdx ;
293 fStatus[kOtherMethodId2] = fdNdxU ;
294 for (l = kPidElectron; l < KPidParticles; l++) {
295 Int_t charge = StProbPidTraits::mPidParticleDefinitions[l]->charge();
296 Double_t mass = StProbPidTraits::mPidParticleDefinitions[l]->mass();
297 Double_t betagamma = pMomentum*TMath::Abs(charge)/mass;
299 bghyp[l] = TMath::Log10(
bgs[l]);
300 for (Int_t k = 1; k <= kOtherMethodId2; k++) {
301 if (! fStatus[k])
continue;
303 if (k == kLikelihoodFitId || k == kWeightedTruncatedMeanId) fit = 1;
304 else if (k == kOtherMethodId || k == kOtherMethodId2) fit = 2;
306 fStatus[k]->Pred[l] = StdEdxPull::EvalPred2(betagamma, fStatus[k]->log2dX(), fit, charge);
308 fStatus[k]->Pred[l] = StdEdxPull::EvalPred(betagamma, fit, charge);
309 if (fStatus[k]->I() > 0) {
310 fStatus[k]->dev[l] = TMath::Log(fStatus[k]->I()/fStatus[k]->Pred[l]);
311 fStatus[k]->devS[l] = -999;
312 if (fStatus[k]->D() > 0) {
313 fStatus[k]->devS[l] = fStatus[k]->dev[l]/fStatus[k]->D();
316 if (fStatus[k]->Pred[l] < PredBMN[0]) PredBMN[0] = fStatus[k]->Pred[l];
317 if (fStatus[k]->Pred[l] > PredBMN[1]) PredBMN[1] = fStatus[k]->Pred[l];
327 Double_t devZkin = 999;
329 for (l = kPidElectron; l < KPidParticles; l++) {
330 if (l == kPidMuon ) devTof[l] = devTof[kPidPion];
331 else if (l >= kPidDeuteron) devTof[l] = devTof[kPidProton];
332 else devTof[l] = TMath::Abs(fBTof.Sigma(l));
334 for (l = kPidElectron; l < KPidParticles; l++) {
335 if (devTof[l] < 3.0) PiDStatus |= 1<<l;
336 if (devTof[l] < devZmin) {devZmin = devTof[l]; lBestTof = l;}
338 if (devZmin > 5) {lBestTof = -1;}
341 for (l = kPidElectron; l < KPidParticles; l++) {
342 if (devZs[l] < 3.0) PiDStatus |= 1<<l;
343 Double_t dev = devZs[l]*devZs[l];
344 if (lBestTof >= 0) dev += devTof[l]*devTof[l];
351 if (devZs[
lBest] < 3.0) {
355 for (l = kPidElectron; l < KPidParticles; l++) {
356 if (l ==
lBest)
continue;
357 Double_t dev = devZs[l]*devZs[l];
358 if (lBestTof >= 0) dev += devTof[l]*devTof[l];
359 if (dev < devZmin) {devZmin = dev; lNext = l;}
362 Double_t dev = devZs[lNext]*devZs[lNext];
363 if (lBestTof >= 0) dev += devTof[lNext]*devTof[lNext];
374 void StPidStatus::Print(Option_t *opt)
const {
375 for (Int_t k = 1; k <= kOtherMethodId2; k++) {
376 if (! fStatus[k])
continue;
377 if (k == kUndefinedMethodId) cout <<
"UndefinedMethod ";
378 else if (k == kTruncatedMeanId) cout <<
"TruncatedMean ";
379 else if (k == kEnsembleTruncatedMeanId) cout <<
"EnsembleTruncatedMean ";
380 else if (k == kLikelihoodFitId) cout <<
"LikelihoodFit ";
381 else if (k == kWeightedTruncatedMeanId) cout <<
"WeightedTruncatedMean ";
382 else if (k == kOtherMethodId) cout <<
"OtherMethod ";
383 else if (k == kOtherMethodId2) cout <<
"OtherMethodIdentifier2";
388 void StdEdxStatus::Print(Option_t *option)
const {
389 if (! fPiD) {cout <<
"\tEmpty" << endl;}
392 if (I() < 10) cout <<
"\tI = " << scale*I() <<
"keV";
393 else cout <<
"\tI = " << I();
394 cout <<
" +/- " << 100*D() <<
"%\tPred: ";
395 for (Int_t l = kPidElectron; l <= kPidPion; l++) {cout <<
"\t" << scale*Pred[l];}
397 for (Int_t l = kPidElectron; l <= kPidPion; l++) {cout <<
"\t" << dev[l];}
399 for (Int_t l = kPidElectron; l <= kPidPion; l++) {cout <<
"\t" << devS[l];}
Float_t btofZLocal() const
Return zLocal (compression = zLocal * 1000)
Float_t dEdxError() const
Return dE/dx error of the track (in GeV/cm)
Float_t beta() const
Return beta.
Holds information about MTD-matched track.
Float_t btofHitPosY() const
Return y comonent of hit position.
Float_t crossingX() const
Return global X coordinate (cm) of the track intersection with an eTOF volume.
float sigmaMuon() const
PID functions.
UShort_t nHitsDedx() const
Return number of hits used for dEdx.
unsigned char matchFlag() const
Matching information.
Float_t dNdxError() const
Return dN/dx error of the track.
Float_t btofYLocal() const
Return yLocal (compression = yLocal * 1000)
Float_t deltaY() const
Return delta Y.
virtual void Clear(Option_t *option="")
User defined functions.
double dEdxFit() const
returns the fitted dEdx value
const StMuETofPidTraits & etofPidTraits() const
dongx
Float_t btofBeta() const
Return beta (compression = beta * 20000)
Hold information about eTOF-matched tracks.
Int_t eTofPidTraitsIndex() const
Return index to the corresponding ETOF PID trait.
Float_t btofHitPosZ() const
Return z comonent of hit position.
TVector3 gMom() const
Return momentum (GeV/c) of the global tracks at the point of DCA to the primary vertex.
Float_t dNdx() const
Return dN/dx of the track.
Float_t crossingY() const
Return global Y coordinate (cm) of the track intersection with an eTOF volume.
unsigned char matchFlag() const
Matching information.
Holds information about track parameters.
Float_t deltaY() const
Return difference between track intersection and eTOF hit in local Y coordinate (cm) along strips...
Float_t deltaZ() const
Return delta Z.
Int_t PiDkeyU3
only one with devZs<3,
Float_t tof() const
Return time of flight (ns)
Float_t crossingZ() const
Return global Z coordinate (cm) of the track intersection with an eTOF volume.
const StThreeVectorF & p() const
Returns 3-momentum at dca to primary vertex.
double dNdxErrorFit() const
returns the fitted dNdx resolution value
const StMuProbPidTraits & probPidTraits() const
Returns Yuri Fisyak new pid probabilities.
Int_t nHitsDedx() const
Return number of hits used for dE/dx measurement.
Float_t dEdx() const
Return dE/dx (in keV/cm) of the track.
float timeOfFlight() const
timing for PID
Int_t lBest
-"- and devZs > 5 for all others
Float_t nSigmaKaon() const
Return nSigma(kaon)
float timeOfFlight() const
timing for PID
Float_t deltaX() const
Return difference between track intersection and eTOF hit in local X coordinate (cm) across strips...
double dEdxErrorFit() const
returns the fitted dEdx resolution value
Float_t nSigmaPion() const
Return nSigma(pion)
double dEdxTrackLength() const
returns the track length in TPC used for dE/dx calculations
double dEdxErrorTruncated() const
returns the truncated 70% dEdx resolution value
Float_t nSigmaProton() const
Return nSigma(proton)
Int_t btofMatchFlag() const
Return matching flag (0 - no match, 1 - one-to-one, 2 - one-to-multiple)
float timeOfFlight() const
timing for PID
float sigmaElectron() const
PID functions.
double dNdxFit() const
returns the fitted dNdx value
Int_t mtdPidTraitsIndex() const
Return index to the corresponding MTD PID trait.
Float_t btofHitPosX() const
Return x comonent of hit position.
Int_t bTofPidTraitsIndex() const
Return index to the corresponding BTOF PID trait.
double dEdxTruncated() const
returns the truncated 70% dEdx value
Double_t bgs[KPidParticles]
log10(bg)
Int_t matchFlag() const
Return match flag.
Float_t nSigmaElectron() const
Return nSigma(electron)
Float_t beta() const
Return beta.
unsigned short matchFlag() const
matching information