90 #include "StMessMgr.h"
91 #include "StPhysicalHelixD.hh"
92 #include "PhysicalConstants.h"
94 #include "StuProbabilityPidAlgorithm.h"
96 #include "StEventUtilities/BetheBlochFunction.hh"
97 #include "StEventUtilities/MaxllBoltz.hh"
98 #include "StEventUtilities/Linear.hh"
100 #include "StEventUtilities/StuFtpcRefMult.hh"
101 #include "StEventUtilities/StuRefMult.hh"
106 StuProbabilityPidAlgorithm::StuProbabilityPidAlgorithm(
StEvent& ev):
127 table = StParticleTable::instance();
134 =
new TF1(
"myBandBGFcn",BetheBlochFunction, 0.,5., 7);
137 ={ 1.072, 0.3199, 1.66032e-07, 1, 1, 2.71172e-07, 0.0005 };
139 myBandBGFcn->SetParameters(&myPars[0]);
144 StuProbabilityPidAlgorithm::StuProbabilityPidAlgorithm():
165 table = StParticleTable::instance();
171 =
new TF1(
"myBandBGFcn",BetheBlochFunction, 0.,5., 7);
174 ={ 1.072, 0.3199, 1.66032e-07, 1, 1, 2.71172e-07, 0.0005 };
176 myBandBGFcn->SetParameters(&myPars[0]);
181 StuProbabilityPidAlgorithm::~StuProbabilityPidAlgorithm(){
186 void StuProbabilityPidAlgorithm::setDedxMethod(StDedxMethod method){
187 StuProbabilityPidAlgorithm::mDedxMethod=method;
191 bool StuProbabilityPidAlgorithm::isPIDTableRead(){
192 return StuProbabilityPidAlgorithm::mPIDTableRead;
200 return table->findParticleByGeantId(PID[0]);
207 return table->findParticleByGeantId(PID[1]);
214 return table->findParticleByGeantId(PID[2]);
220 return table->findParticleByGeantId(PID[i]);
223 gMessMgr->Error()<<
"StuProbabilityPidAlgorithm::getParticle(int i), i must be 0,1,2,3 only. "<<endm;
229 double StuProbabilityPidAlgorithm::getProbability(
int i){
234 gMessMgr->Error()<<
"StuProbabilityPidAlgorithm::getProbability(int i), i must be 0,1,2,3 only. "<<endm;
242 double StuProbabilityPidAlgorithm::mostLikelihoodProbability(){
246 double StuProbabilityPidAlgorithm::secondLikelihoodProbability(){
250 double StuProbabilityPidAlgorithm::thirdLikelihoodProbability(){
255 bool StuProbabilityPidAlgorithm::isExtrap(){
300 dca=helix.
distance(primaryVtx->position());
306 if ( (mProductionTag->GetString()).Contains(
"P01gl")
307 || (mProductionTag->GetString()).Contains(
"P02gd") ){
308 cent = getCentrality(uncorrectedNumberOfNegativePrimaries(*mEvent));
309 }
else if ( (mProductionTag->GetString()).Contains(
"P03ia_dAu") ){
310 cent = getCentrality(uncorrectedNumberOfFtpcEastPrimaries(*mEvent));
312 gMessMgr->Error()<<
"Production tag "<<mProductionTag->GetString().Data()<<
" in PIDTable is filled but its name is not recognized ! "<<endm;
317 cent = getCentrality(uncorrectedNumberOfNegativePrimaries(*mEvent));
325 charge=(theTrack.geometry())->charge();
327 for (
int itrait = 0; itrait < int(traits.size()); itrait++){
330 if (traits[itrait]->detector() == kTpcId) {
341 if (dedxPidTr && dedxPidTr->method() == mDedxMethod)
break;
346 dedx=dedxPidTr->mean();
347 nhits=dedxPidTr->numberOfPoints();
351 if (dedx!=0.0 && nhits>=0
352 && thisPEnd > 0. && thisEtaEnd > 0.
353 && thisNHitsEnd > 0. ){
356 rig=double(p.mag()/charge);
363 if ( (mProductionTag->GetString()).Contains(
"P01gl")
364 || (mProductionTag->GetString()).Contains(
"P02gd") ){
365 eta=fabs(p.pseudoRapidity());
366 }
else if ( (mProductionTag->GetString()).Contains(
"P03ia_dAu") ){
367 eta=p.pseudoRapidity();
369 gMessMgr->Error()<<
"Production tag "<<mProductionTag->GetString().Data()<<
" in PIDTable is filled but its name is not recognized ! "<<endm;
373 eta = fabs(p.pseudoRapidity());
377 dedx = (dedx>thisDedxStart) ? dedx : thisDedxStart;
378 rig = (rig >thisPStart) ? rig : thisPStart;
379 rig = (rig <thisPEnd ) ? rig : thisPEnd*0.9999;
380 eta = (eta >thisEtaStart) ? eta : thisEtaStart;
381 eta = (eta <thisEtaEnd ) ? eta : thisEtaEnd*0.9999;
382 nhits = (nhits > int(thisNHitsStart)) ? nhits :
int(thisNHitsStart);
383 nhits = (nhits < int(thisNHitsEnd) ) ? nhits :
int(thisNHitsEnd-1);
387 setCalibrations(eta, nhits);
389 if (dedx<thisDedxEnd){
391 fillPIDByLookUpTable(cent, dca, charge,rig, eta, nhits,dedx);
393 }
else { lowRigPID(rig,dedx,charge);}
395 }
else if (dedx==0.0){ fillAsUnknown();}
398 myBandBGFcn->SetParameter(3,1);
399 myBandBGFcn->SetParameter(4,1.45);
400 if (dedx>myBandBGFcn->Eval(rig,0,0)) fillAsUnknown();
402 }
else fillAsUnknown();
406 return table->findParticleByGeantId(PID[0]);
411 void StuProbabilityPidAlgorithm::lowRigPID(
double rig,
double dedx,
int theCharge){
415 double rigidity=fabs(rig);
422 myBandBGFcn->SetParameter(3,1);
423 myBandBGFcn->SetParameter(4,0.32075026 );
427 upper =myBandBGFcn->Eval(rigidity,0,0);
429 if (mdedx>lower && mdedx<upper){
430 PID[0]=(theCharge>0.0)? 8 : 9;
441 myBandBGFcn->SetParameter(3,1);
442 myBandBGFcn->SetParameter(4,fakeMass);
444 upper =myBandBGFcn->Eval(rigidity,0,0);
446 if (mdedx>lower && mdedx<upper){
447 PID[0]=(theCharge>0.0)? 11:12;
459 myBandBGFcn->SetParameter(3,1);
460 myBandBGFcn->SetParameter(4,fakeMass);
462 upper =myBandBGFcn->Eval(rigidity,0,0);
464 if (mdedx>lower && mdedx<upper){
465 PID[0]=(theCharge>0.0)? 14:15;
513 void StuProbabilityPidAlgorithm::fillAsUnknown(){
515 for (
int i=0; i<4; i++) {
516 PID[i]=-1; mProb[i]=-1;
522 void StuProbabilityPidAlgorithm::readParametersFromFile(TString fileName){
526 TFile f(fileName,
"READ");
530 delete StuProbabilityPidAlgorithm::mEAmp ;
531 delete StuProbabilityPidAlgorithm::mECenter ;
532 delete StuProbabilityPidAlgorithm::mESigma ;
533 delete StuProbabilityPidAlgorithm::mPiAmp ;
534 delete StuProbabilityPidAlgorithm::mPiCenter ;
535 delete StuProbabilityPidAlgorithm::mPiSigma ;
536 delete StuProbabilityPidAlgorithm::mKAmp ;
537 delete StuProbabilityPidAlgorithm::mKCenter ;
538 delete StuProbabilityPidAlgorithm::mKSigma ;
539 delete StuProbabilityPidAlgorithm::mPAmp ;
540 delete StuProbabilityPidAlgorithm::mPCenter ;
541 delete StuProbabilityPidAlgorithm::mPSigma ;
542 delete StuProbabilityPidAlgorithm::mEqualyDividableRangeStartSet;
543 delete StuProbabilityPidAlgorithm::mEqualyDividableRangeEndSet;
544 delete StuProbabilityPidAlgorithm::mEqualyDividableRangeNBinsSet;
545 delete StuProbabilityPidAlgorithm::mNoEqualyDividableRangeNBinsSet;
546 delete StuProbabilityPidAlgorithm::mMultiBinEdgeSet ;
547 delete StuProbabilityPidAlgorithm::mDcaBinEdgeSet ;
548 delete StuProbabilityPidAlgorithm::mBBPrePar;
549 delete StuProbabilityPidAlgorithm::mBBTurnOver;
550 delete StuProbabilityPidAlgorithm::mBBOffSet;
551 delete StuProbabilityPidAlgorithm::mBBScale;
552 delete StuProbabilityPidAlgorithm::mBBSaturate;
553 delete StuProbabilityPidAlgorithm::mProductionTag;
555 StuProbabilityPidAlgorithm::mEAmp =(TVectorD* )f.Get(
"eAmp");
556 StuProbabilityPidAlgorithm::mECenter =(TVectorD* )f.Get(
"eCenter");
557 StuProbabilityPidAlgorithm::mESigma =(TVectorD* )f.Get(
"eSigma");
559 StuProbabilityPidAlgorithm::mPiAmp =(TVectorD* )f.Get(
"piAmp");
560 StuProbabilityPidAlgorithm::mPiCenter =(TVectorD* )f.Get(
"piCenter");
561 StuProbabilityPidAlgorithm::mPiSigma =(TVectorD* )f.Get(
"piSigma");
563 StuProbabilityPidAlgorithm::mKAmp =(TVectorD* )f.Get(
"kAmp");
564 StuProbabilityPidAlgorithm::mKCenter =(TVectorD* )f.Get(
"kCenter");
565 StuProbabilityPidAlgorithm::mKSigma =(TVectorD* )f.Get(
"kSigma");
567 StuProbabilityPidAlgorithm::mPAmp =(TVectorD* )f.Get(
"pAmp");
568 StuProbabilityPidAlgorithm::mPCenter =(TVectorD* )f.Get(
"pCenter");
569 StuProbabilityPidAlgorithm::mPSigma =(TVectorD* )f.Get(
"pSigma");
571 StuProbabilityPidAlgorithm::mEqualyDividableRangeStartSet
572 =(TVectorD* )f.Get(
"EqualyDividableRangeStartSet");
573 StuProbabilityPidAlgorithm::mEqualyDividableRangeEndSet
574 =(TVectorD* )f.Get(
"EqualyDividableRangeEndSet");
575 StuProbabilityPidAlgorithm::mEqualyDividableRangeNBinsSet
576 =(TVectorD* )f.Get(
"EqualyDividableRangeNBinsSet");
577 StuProbabilityPidAlgorithm::mNoEqualyDividableRangeNBinsSet
578 =(TVectorD* )f.Get(
"NoEqualyDividableRangeNBinsSet");
580 StuProbabilityPidAlgorithm::mMultiBinEdgeSet
581 =(TVectorD* )f.Get(
"MultiBinEdgeSet");
582 StuProbabilityPidAlgorithm::mDcaBinEdgeSet
583 =(TVectorD* )f.Get(
"DcaBinEdgeSet");
586 StuProbabilityPidAlgorithm::mBBPrePar
587 =(TVectorD* )f.Get(
"BBPrePar");
588 StuProbabilityPidAlgorithm::mBBTurnOver
589 =(TVectorD* )f.Get(
"BBTurnOver");
590 StuProbabilityPidAlgorithm::mBBOffSet
591 =(TVectorD* )f.Get(
"BBOffSet");
592 StuProbabilityPidAlgorithm::mBBScale
593 =(TVectorD* )f.Get(
"BBScale");
594 StuProbabilityPidAlgorithm::mBBSaturate
595 =(TVectorD* )f.Get(
"BBSaturate");
597 StuProbabilityPidAlgorithm::mProductionTag
598 =(TObjString* )f.Get(
"productionTag");
602 StuProbabilityPidAlgorithm::thisMultBins
603 =int((*mNoEqualyDividableRangeNBinsSet)(0));
604 StuProbabilityPidAlgorithm::thisDcaBins
605 =int((*mNoEqualyDividableRangeNBinsSet)(1));
606 StuProbabilityPidAlgorithm::thisChargeBins
607 =int((*mNoEqualyDividableRangeNBinsSet)(2));
610 StuProbabilityPidAlgorithm::thisPBins
611 =int((*mEqualyDividableRangeNBinsSet)(1));
612 StuProbabilityPidAlgorithm::thisEtaBins
613 =int((*mEqualyDividableRangeNBinsSet)(2));
614 StuProbabilityPidAlgorithm::thisNHitsBins
615 =int((*mEqualyDividableRangeNBinsSet)(3));
618 StuProbabilityPidAlgorithm::thisDedxStart
619 =(*mEqualyDividableRangeStartSet)(0);
620 StuProbabilityPidAlgorithm::thisPStart
621 =(*mEqualyDividableRangeStartSet)(1);
622 StuProbabilityPidAlgorithm::thisEtaStart
623 =(*mEqualyDividableRangeStartSet)(2);
624 StuProbabilityPidAlgorithm::thisNHitsStart
625 =(*mEqualyDividableRangeStartSet)(3);
627 StuProbabilityPidAlgorithm::thisDedxEnd
628 =(*mEqualyDividableRangeEndSet)(0);
629 StuProbabilityPidAlgorithm::thisPEnd
630 =(*mEqualyDividableRangeEndSet)(1);
631 StuProbabilityPidAlgorithm::thisEtaEnd
632 =(*mEqualyDividableRangeEndSet)(2);
633 StuProbabilityPidAlgorithm::thisNHitsEnd
634 =(*mEqualyDividableRangeEndSet)(3);
639 StuProbabilityPidAlgorithm::mPIDTableRead=
true;
641 }
else if (!f.IsOpen()) {
643 gMessMgr->Error()<<
"Data file "<<fileName<<
" open failed "<<endm;
691 int StuProbabilityPidAlgorithm::thisMultBins=0;
692 int StuProbabilityPidAlgorithm::thisDcaBins=0;
693 int StuProbabilityPidAlgorithm::thisChargeBins=0;
695 int StuProbabilityPidAlgorithm::thisPBins=0;
696 int StuProbabilityPidAlgorithm::thisEtaBins=0;
697 int StuProbabilityPidAlgorithm::thisNHitsBins=0;
699 double StuProbabilityPidAlgorithm::thisDedxStart=0.;
700 double StuProbabilityPidAlgorithm::thisDedxEnd=0;
701 double StuProbabilityPidAlgorithm::thisPStart=0;
702 double StuProbabilityPidAlgorithm::thisPEnd=0;
703 double StuProbabilityPidAlgorithm::thisEtaStart=0;
704 double StuProbabilityPidAlgorithm::thisEtaEnd=0;
705 double StuProbabilityPidAlgorithm::thisNHitsStart=0;
706 double StuProbabilityPidAlgorithm::thisNHitsEnd=0;
709 bool StuProbabilityPidAlgorithm::mPIDTableRead=
false;
711 StDedxMethod StuProbabilityPidAlgorithm::mDedxMethod=kTruncatedMeanId;
713 TVectorD* StuProbabilityPidAlgorithm::mEAmp =
new TVectorD();
714 TVectorD* StuProbabilityPidAlgorithm::mECenter =
new TVectorD();
715 TVectorD* StuProbabilityPidAlgorithm::mESigma =
new TVectorD();
717 TVectorD* StuProbabilityPidAlgorithm::mPiAmp =
new TVectorD();
718 TVectorD* StuProbabilityPidAlgorithm::mPiCenter =
new TVectorD();
719 TVectorD* StuProbabilityPidAlgorithm::mPiSigma =
new TVectorD();
721 TVectorD* StuProbabilityPidAlgorithm::mKAmp =
new TVectorD();
722 TVectorD* StuProbabilityPidAlgorithm::mKCenter =
new TVectorD();
723 TVectorD* StuProbabilityPidAlgorithm::mKSigma =
new TVectorD();
725 TVectorD* StuProbabilityPidAlgorithm::mPAmp =
new TVectorD();
726 TVectorD* StuProbabilityPidAlgorithm::mPCenter =
new TVectorD();
727 TVectorD* StuProbabilityPidAlgorithm::mPSigma =
new TVectorD();
730 TVectorD* StuProbabilityPidAlgorithm::mEqualyDividableRangeStartSet =
new TVectorD();
731 TVectorD* StuProbabilityPidAlgorithm::mEqualyDividableRangeEndSet =
new TVectorD();
732 TVectorD* StuProbabilityPidAlgorithm::mEqualyDividableRangeNBinsSet =
new TVectorD();
733 TVectorD* StuProbabilityPidAlgorithm::mNoEqualyDividableRangeNBinsSet =
new TVectorD();
735 TVectorD* StuProbabilityPidAlgorithm::mMultiBinEdgeSet =
new TVectorD();
736 TVectorD* StuProbabilityPidAlgorithm::mDcaBinEdgeSet =
new TVectorD();
738 TVectorD* StuProbabilityPidAlgorithm::mBBPrePar =
new TVectorD();
739 TVectorD* StuProbabilityPidAlgorithm::mBBTurnOver =
new TVectorD();
740 TVectorD* StuProbabilityPidAlgorithm::mBBOffSet =
new TVectorD();
741 TVectorD* StuProbabilityPidAlgorithm::mBBScale =
new TVectorD();
742 TVectorD* StuProbabilityPidAlgorithm::mBBSaturate =
new TVectorD();
744 TObjString* StuProbabilityPidAlgorithm::mProductionTag =
new TObjString();
756 void StuProbabilityPidAlgorithm::fillPIDByLookUpTable(
double myCentrality,
double myDca,
int myCharge,
double myRig,
double myEta,
int myNhits,
double myDedx)
761 int theMultBin=getCentralityBin(myCentrality);
762 int theDcaBin = (myDca>(*mDcaBinEdgeSet)(1)) ? 1 : 0;
763 int theChargeBin=(myCharge>0) ? 1 : 0;
764 int thePBin=int(thisPBins*myRig/(thisPEnd-thisPStart));
765 int theEtaBin=int(thisEtaBins*(myEta-thisEtaStart)/(thisEtaEnd-thisEtaStart));
766 int theNHitsBin=int(thisNHitsBins*
float(myNhits)/(thisNHitsEnd-thisNHitsStart));
770 = thisMultBins*thisDcaBins*thisChargeBins*thisPBins*thisEtaBins*thisNHitsBins;
772 int positionPointer=0;
774 totalEntry=totalEntry/thisMultBins;
775 positionPointer=positionPointer+totalEntry*theMultBin;
777 totalEntry=totalEntry/thisDcaBins;
778 positionPointer=positionPointer+totalEntry*theDcaBin;
780 totalEntry=totalEntry/thisChargeBins;
781 positionPointer=positionPointer+totalEntry*theChargeBin;
783 totalEntry=totalEntry/thisPBins;
784 positionPointer=positionPointer+totalEntry*thePBin;
786 totalEntry=totalEntry/thisEtaBins;
787 positionPointer=positionPointer+totalEntry*theEtaBin;
789 totalEntry=totalEntry/thisNHitsBins;
790 positionPointer=positionPointer+totalEntry*theNHitsBin;
795 TF1 eGaus(
"eGaus",
"gaus",thisDedxStart,thisDedxStart);
796 TF1 piGaus(
"piGaus",
"gaus",thisDedxStart,thisDedxStart);
797 TF1 kGaus(
"kGaus",
"gaus",thisDedxStart,thisDedxStart);
798 TF1 pGaus(
"pGaus",
"gaus",thisDedxStart,thisDedxStart);
801 eGaus.SetParameter(0, (*mEAmp)(positionPointer));
802 eGaus.SetParameter(1, (*mECenter)(positionPointer));
803 eGaus.SetParameter(2, (*mESigma)(positionPointer));
805 piGaus.SetParameter(0, (*mPiAmp)(positionPointer));
806 piGaus.SetParameter(1, (*mPiCenter)(positionPointer));
807 piGaus.SetParameter(2, (*mPiSigma)(positionPointer));
809 kGaus.SetParameter(0, (*mKAmp)(positionPointer));
810 kGaus.SetParameter(1, (*mKCenter)(positionPointer));
811 kGaus.SetParameter(2, (*mKSigma)(positionPointer));
813 pGaus.SetParameter(0, (*mPAmp)(positionPointer));
814 pGaus.SetParameter(1, (*mPCenter)(positionPointer));
815 pGaus.SetParameter(2, (*mPSigma)(positionPointer));
818 double eContribution=0;
819 if (mEAmp && mECenter && mESigma) eContribution = eGaus.Eval(myDedx,0.,0.);
823 double piContribution=0;
824 if (mPiAmp && mPiCenter && mPiSigma) piContribution = piGaus.Eval(myDedx,0.,0.);
826 double kContribution=0;
827 if (mKAmp && mKCenter && mKSigma) kContribution = kGaus.Eval(myDedx,0.,0.);
829 double pContribution=0;
830 if (mPAmp && mPCenter && mPSigma) pContribution = pGaus.Eval(myDedx,0.,0.);
833 double total = eContribution+piContribution+kContribution+pContribution;
835 double eProb=0;
double piProb=0;
double kProb=0;
double pProb=0;
838 eProb=eContribution/total;
839 piProb=piContribution/total;
840 kProb=kContribution/total;
841 pProb=pContribution/total;
845 fill(eProb,
int((myCharge>0) ? 2 : 3 ));
846 fill(piProb,
int((myCharge>0) ? 8 : 9 ));
847 fill(kProb,
int((myCharge>0) ? 11 : 12 ));
848 fill(pProb,
int((myCharge>0) ? 14 : 15 ));
851 float PathHeight=1.0e-7;
852 float halfHeight=(11-2.0)*PathHeight/2.0;
854 if (fabs(myRig) > 0.3) {
855 if ((myDedx<(((*mPiCenter)(positionPointer))+halfHeight-nn*PathHeight))
856 && (myDedx > ( ((*mKCenter)(positionPointer))-halfHeight+nn*PathHeight) ))
861 void StuProbabilityPidAlgorithm::fillPIDHypothis(){
863 for (
int i=0; i<4; i++){
867 case 2 : mPositronProb=mProb[i];
869 case 3 : mElectronProb=mProb[i];
871 case 8 : mPionPlusProb=mProb[i];
873 case 9 : mPionMinusProb=mProb[i];
875 case 11 : mKaonPlusProb=mProb[i];
877 case 12 : mKaonMinusProb=mProb[i];
879 case 14 : mProtonProb=mProb[i];
881 case 15 : mAntiProtonProb=mProb[i];
888 int StuProbabilityPidAlgorithm::getCentralityBin(
double theCent){
891 for (
int mm = (thisMultBins-1); mm>0; mm--) {
892 if (theCent< (*mMultiBinEdgeSet)(mm) ) theBin=mm;
902 double StuProbabilityPidAlgorithm::getCentrality(
int theMult){
908 if ( (mProductionTag->GetString()).Contains(
"P01gl")
909 || (mProductionTag->GetString()).Contains(
"P02gd") ){
910 return getCentrality_P01gl(theMult);
911 }
else if ((mProductionTag->GetString()).Contains(
"P03ia_dAu")){
912 return getCentrality_P03ia_dAu(theMult);
914 gMessMgr->Error()<<
"Production tag "<<mProductionTag->GetString().Data()<<
" in PIDTable is filled but its name is not recognized ! "<<endm;
935 if (theMult > 225 )
return 0.03;
936 else if (theMult > 215 )
return 0.05;
937 else if (theMult > 200 )
return 0.07;
938 else if (theMult > 180 )
return 0.10;
939 else if (theMult > 140 )
return 0.18;
940 else if (theMult > 130 )
return 0.20;
941 else if (theMult > 120 )
return 0.23;
942 else if (theMult > 115 )
return 0.24;
943 else if (theMult > 100 )
return 0.28;
954 double StuProbabilityPidAlgorithm::getCentrality_P01gl(
int theMult){
967 if (theMult*2. > 474 )
return 0.03;
968 else if (theMult*2. > 409 )
return 0.10;
969 else if (theMult*2. > 302 )
return 0.20;
970 else if (theMult*2. > 216 )
return 0.30;
971 else if (theMult*2. > 149 )
return 0.40;
972 else if (theMult*2. > 98 )
return 0.50;
973 else if (theMult*2. > 59 )
return 0.60;
974 else if (theMult*2. > 32 )
return 0.70;
975 else if (theMult*2. > 14 )
return 0.80;
982 double StuProbabilityPidAlgorithm::getCentrality_P03ia_dAu(
int theMult){
990 if (theMult >= 18 )
return 0.19;
991 else if (theMult >= 12 )
return 0.39;
992 else if (theMult > 0 )
return 0.8;
997 void StuProbabilityPidAlgorithm::fill(
double prob,
int geantId){
1010 else if (prob>mProb[1]){
1019 else if (prob>mProb[2]){
1025 else if (prob>=mProb[3]){
1032 int StuProbabilityPidAlgorithm::getCalibPosition(
double theEta,
int theNHits){
1034 int theEtaBin=int(thisEtaBins*(theEta-thisEtaStart)/(thisEtaEnd-thisEtaStart));
1035 int theNHitsBin=int(thisNHitsBins*
float(theNHits)/(thisNHitsEnd-thisNHitsStart));
1038 = thisEtaBins*thisNHitsBins;
1040 int positionPointer=0;
1042 totalEntry=totalEntry/thisEtaBins;
1043 positionPointer=positionPointer+totalEntry*theEtaBin;
1045 totalEntry=totalEntry/thisNHitsBins;
1046 positionPointer=positionPointer+totalEntry*theNHitsBin;
1050 return positionPointer;
1053 void StuProbabilityPidAlgorithm::setCalibrations(
double theEta,
int theNhits){
1055 int thePosition=getCalibPosition(theEta,theNhits);
1057 myBandBGFcn->SetParameter(5,(*mBBScale)(thePosition));
1058 myBandBGFcn->SetParameter(2,(*mBBOffSet)(thePosition));
1061 if (mProductionTag){
1063 if ( (mProductionTag->GetString()).Contains(
"P01gl")
1064 || (mProductionTag->GetString()).Contains(
"P02gd")){
1066 myBandBGFcn->SetParameter(0,(*mBBPrePar)(thePosition));
1067 myBandBGFcn->SetParameter(1,(*mBBTurnOver)(thePosition));
1068 myBandBGFcn->SetParameter(6,(*mBBSaturate)(thePosition));
1076 void StuProbabilityPidAlgorithm::processPIDAsFunction (
double theCent,
double theDca,
int theCharge,
double theRig,
double theEta,
int theNhits,
double theDedx){
1102 if (mPIDTableRead) {
1104 double rig =fabs(theRig);
1105 double dedx =theDedx;
1107 int nhits =theNhits;
1108 int charge =theCharge;
1110 double cent =theCent;
1113 if (mProductionTag){
1116 if ( (mProductionTag->GetString()).Contains(
"P01gl")
1117 || (mProductionTag->GetString()).Contains(
"P02gd") ){
1119 }
else if ( (mProductionTag->GetString()).Contains(
"P03ia_dAu") ){
1122 gMessMgr->Error()<<
"Production tag "<<mProductionTag->GetString().Data()<<
" in PIDTable is filled but its name is not recognized ! "<<endm;
1133 if (dedx!=0.0 && nhits>=0
1134 && thisPEnd > 0. && thisEtaEnd > 0.
1135 && thisNHitsEnd > 0. ){
1138 dedx = (dedx>thisDedxStart) ? dedx : thisDedxStart;
1139 rig = (rig >thisPStart) ? rig : thisPStart;
1140 rig = (rig <thisPEnd ) ? rig : thisPEnd*0.9999;
1141 eta = (eta >thisEtaStart) ? eta : thisEtaStart;
1142 eta = (eta <thisEtaEnd ) ? eta : thisEtaEnd*0.9999;
1143 nhits = (nhits > int(thisNHitsStart)) ? nhits :
int(thisNHitsStart);
1144 nhits = (nhits < int(thisNHitsEnd) ) ? nhits :
int(thisNHitsEnd-1);
1148 setCalibrations(eta, nhits);
1150 if (dedx<thisDedxEnd){
1152 fillPIDByLookUpTable(cent, dca, charge,rig, eta, nhits,dedx);
1154 }
else { lowRigPID(rig,dedx,charge);}
1156 }
else if (dedx==0.0){ fillAsUnknown();}
1159 myBandBGFcn->SetParameter(3,1);
1160 myBandBGFcn->SetParameter(4,1.45);
1161 if (dedx>myBandBGFcn->Eval(rig,0,0)) fillAsUnknown();
1163 }
else fillAsUnknown();
double distance(const StThreeVector< double > &p, bool scanPeriods=true) const
minimal distance between point and helix