227 if (!paramFilePath.empty()){
228 std::string total_path =
"DiTauMassTools/"+paramFilePath;
232 m_probListConstant.push_back( std::bind(&
mEtAndTauProbabilityWrapper,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
233 m_probListOneTau.push_back( std::bind(&
dTheta3d_probabilityNewWrapper,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
234 m_probListTwoTau.push_back( std::bind(&
TauProbabilityNewWrapper,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
235 m_probListTwoTau.push_back( std::bind(&
MnuProbabilityNewWrapper,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
241 m_probListConstant.push_back( std::bind(&
mEtAndTauProbabilityWrapper,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
242 m_probListOneTau.push_back( std::bind(&
dTheta3d_probabilityFastWrapper,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
243 m_probListTwoTau.push_back( std::bind(&
TauProbabilityWrapper,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
244 m_probListTwoTau.push_back( std::bind(&
MnuProbabilityWrapper,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7) );
731 const int & type2,
const PtEtaPhiMVector & vis2,
const PtEtaPhiMVector & nu2,
const double & detmet) {
740 const double R1=nu1.P()/vis1.P();
741 const double R2=nu2.P()/vis2.P();
742 const double lep_p1[4]={0.417,0.64,0.52,0.678};
743 const double lep_p2[4]={0.23,0.17,0.315,0.319};
744 const double lep_p3[4]={0.18,0.33,0.41,0.299};
745 const double lep_p4[4]={0.033,0.109,0.129,0.096};
746 const double lep_p5[4]={0.145,0.107,0.259,0.304};
749 const double n_1pr[4]={-0.15,-0.13,-0.25,-0.114};
750 const double s_1pr[4]={0.40,0.54,0.62,0.57};
751 const double n_3pr[4]={-1.08,-1.57,-0.46,-0.39};
752 const double s_3pr[4]={0.53,0.85,0.61,0.53};
755 if(type1>=0 && type1<=5)
760 if(type2>=0 && type2<=5)
765 if(Plep<50.0 && Plep>=45.0) ind=2;
766 if(Plep<45.0 && Plep>=40.0) ind=1;
768 if(Ptau<50.0 && Ptau>=45.0) indT=2;
769 if(Ptau<45.0 && Ptau>=40.0) indT=1;
770 if(Ptau<40.0) indT=0;
771 if(type1==8) prob=prob*(lep_p5[ind]*TMath::Gaus(R1,lep_p1[ind],lep_p2[ind])+TMath::Landau(R1,lep_p3[ind],lep_p4[ind]))/(1+lep_p5[ind]);
772 if(type2==8) prob=prob*(lep_p5[ind]*TMath::Gaus(R2,lep_p1[ind],lep_p2[ind])+TMath::Landau(R2,lep_p3[ind],lep_p4[ind]))/(1+lep_p5[ind]);
774 if(type1>=0 && type1<=2) prob=prob*TMath::Gaus(R1,n_1pr[indT],s_1pr[indT]);
775 if(type2>=0 && type2<=2) prob=prob*TMath::Gaus(R2,n_1pr[indT],s_1pr[indT]);
776 if(type1>=3 && type1<=5) prob=prob*TMath::Gaus(R1,n_3pr[indT],s_3pr[indT]);
777 if(type2>=3 && type2<=5) prob=prob*TMath::Gaus(R2,n_3pr[indT],s_3pr[indT]);
782 const double R1=nu1.P()/vis1.P();
783 const double R2=nu2.P()/vis2.P();
784 const double lep_p1[4]={0.441,0.64,0.79,0.8692};
785 const double lep_p2[4]={0.218,0.28,0.29,0.3304};
786 const double lep_p3[4]={0.256,0.33,0.395,0.4105};
787 const double lep_p4[4]={0.048,0.072,0.148,0.1335};
788 const double lep_p5[4]={0.25,0.68,0.10,0.2872};
790 const double p_1prong=-3.706;
791 const double p_3prong=-5.845;
794 if(type1>=0 && type1<=5)
799 if(type2>=0 && type2<=5)
804 if(Plep<50.0 && Plep>=45.0) ind=2;
805 if(Plep<45.0 && Plep>=40.0) ind=1;
807 const double scale1prong=Ptau>45.0 ? 1.0 : -1.019/((Ptau*0.0074-0.059)*p_1prong);
808 const double scale3prong=Ptau>40.0 ? 1.0 : -1.24/((Ptau*0.0062-0.033)*p_3prong);
809 if(type1==8) prob=prob*(lep_p5[ind]*TMath::Gaus(R1,lep_p1[ind],lep_p2[ind])+TMath::Landau(R1,lep_p3[ind],lep_p4[ind]))/(1+lep_p5[ind]);
810 if(type2==8) prob=prob*(lep_p5[ind]*TMath::Gaus(R2,lep_p1[ind],lep_p2[ind])+TMath::Landau(R2,lep_p3[ind],lep_p4[ind]))/(1+lep_p5[ind]);
812 if(type1>=0 && type1<=2) prob=prob*exp(p_1prong*R1*scale1prong)*std::abs(p_1prong*scale1prong)*0.02;
813 if(type2>=0 && type2<=2) prob=prob*exp(p_1prong*R2*scale1prong)*std::abs(p_1prong*scale1prong)*0.02;
814 if(type1>=3 && type1<=5) prob=prob*exp(p_3prong*R1*scale3prong)*std::abs(p_3prong*scale3prong)*0.02;
815 if(type2>=3 && type2<=5) prob=prob*exp(p_3prong*R2*scale3prong)*std::abs(p_3prong*scale3prong)*0.02;
825 const double R[2]={nu1.P()/vis1.P(),nu2.P()/vis2.P()};
826 const double E[2]={(nu1+vis1).E(),(nu2+vis2).E()};
827 const int tau_type[2]={type1,type2};
828 int order1= vis1.Pt()>vis2.Pt() ? 0 : 1;
829 int order2= vis1.Pt()>vis2.Pt() ? 1 : 0;
834 par_1p[0][0]=0.1273; par_1p[0][1]=-0.2479; par_1p[0][2]=1.0; par_1p[0][3]=-43.16; par_1p[0][4]=0.0; par_1p[0][5]=0.0;
835 par_1p[1][0]=0.3736; par_1p[1][1]=-1.441; par_1p[1][2]=1.0; par_1p[1][3]=-29.82; par_1p[1][4]=0.0; par_1p[1][5]=0.0;
836 par_3p[0][0]=0.1167; par_3p[0][1]=-0.1388; par_3p[0][2]=1.0; par_3p[0][3]=-44.77; par_3p[0][4]=0.0; par_3p[0][5]=0.0;
837 par_3p[1][0]=0.3056; par_3p[1][1]=-2.18; par_3p[1][2]=1.0; par_3p[1][3]=-19.09; par_3p[1][4]=0.0; par_3p[1][5]=0.0;
839 const double C1p=0.062;
840 const double C3p=0.052;
841 const double G1p=1.055;
842 const double G3p=1.093;
845 if( tau_type[order1]>=0 && tau_type[order1]<=2 )
850 double x=std::min(E[order1],300.0);
851 const double slope=par_1p[0][0]+par_1p[0][1]/(par_1p[0][2]*
x+par_1p[0][3])+par_1p[0][4]*
x > 0.01 ?
852 par_1p[0][0]+par_1p[0][1]/(par_1p[0][2]*
x+par_1p[0][3])+par_1p[0][4]*
x : 0.01;
853 prob=prob*exp(-R[order1]/slope)*0.04/std::abs(slope);
855 if( tau_type[order1]>=3 && tau_type[order1]<=5 )
859 double x=std::min(E[order1],300.0);
860 const double slope=par_3p[0][0]+par_3p[0][1]/(par_3p[0][2]*
x+par_3p[0][3])+par_3p[0][4]*
x > 0.01 ?
861 par_3p[0][0]+par_3p[0][1]/(par_3p[0][2]*
x+par_3p[0][3])+par_3p[0][4]*
x : 0.01;
862 prob=prob*exp(-R[order1]/slope)*0.04/std::abs(slope);
865 if( tau_type[order2]>=0 && tau_type[order2]<=2 )
867 const double par[4]={0.1147,-0.09675,-35.0,3.711E-11};
868 double x=std::min(300.,std::max(E[order2],30.0));
870 const double sigma=G1p*(par_1p[1][0]+par_1p[1][1]/(par_1p[1][2]*
x+par_1p[1][3])+par_1p[1][4]*
x+par_1p[1][5]*
x*
x) > 0.01 ?
871 G1p*(par_1p[1][0]+par_1p[1][1]/(par_1p[1][2]*
x+par_1p[1][3])+par_1p[1][4]*
x+par_1p[1][5]*
x*
x) : 0.01;
873 const double mean=par[0]+par[1]/(
x+par[2])+par[3]*
pow(
x,4);
874 prob=prob*C1p*TMath::Gaus(R[order2],
mean,sigma);
876 if( tau_type[order2]>=3 && tau_type[order2]<=5 )
878 double x=std::min(300.,std::max(E[order2],20.0));
880 const double sigma=G3p*(par_3p[1][0]+par_3p[1][1]/(par_3p[1][2]*
x+par_3p[1][3])+par_3p[1][4]*
x+par_3p[1][5]*
x*
x) > 0.01 ?
881 G3p*(par_3p[1][0]+par_3p[1][1]/(par_3p[1][2]*
x+par_3p[1][3])+par_3p[1][4]*
x+par_3p[1][5]*
x*
x) : 0.01;
882 const double par[4]={0.2302,-2.012,-36.08,-0.000373};
884 const double mean=par[0]+par[1]/(
x+par[2])+par[3]*
x;
885 prob=prob*C3p*TMath::Gaus(R[order2],
mean,sigma);
890 const double R1=nu1.P()/vis1.P();
891 const double R2=nu2.P()/vis2.P();
892 const double E1=(nu1+vis1).E();
893 const double E2=(nu2+vis2).E();
894 int order1= vis1.Pt()>vis2.Pt() ? 0 : 1;
895 int order2= vis1.Pt()>vis2.Pt() ? 1 : 0;
896 const double slope_1p[2]={-3.185,-2.052};
897 const double slope_3p[2]={-3.876,-2.853};
900 par_1p[0][0]=-0.3745; par_1p[0][1]=0.01417; par_1p[0][2]=-7.285E-5;
901 par_1p[1][0]=-0.3683; par_1p[1][1]=0.01807; par_1p[1][2]=-9.514E-5;
902 par_3p[0][0]=-0.3055; par_3p[0][1]=0.01149; par_3p[0][2]=-5.855E-5;
903 par_3p[1][0]=-0.3410; par_3p[1][1]=0.01638; par_3p[1][2]=-9.465E-5;
906 if(type1>=0 && type1<=2)
908 scale1=E1>100.0 ? 1.0 : 1.0/std::abs((par_1p[order1][0]+par_1p[order1][1]*E1+par_1p[order1][2]*E1*E1)*slope_1p[order1]);
911 prob=prob*std::abs(slope_1p[order1])*
scale1*exp(slope_1p[order1]*
scale1*R1)*0.04;
913 if(type1>=3 && type1<=5)
915 scale1=E1>100.0 ? 1.0 : 1.0/std::abs((par_3p[order1][0]+par_3p[order1][1]*E1+par_3p[order1][2]*E1*E1)*slope_3p[order1]);
918 prob=prob*std::abs(slope_3p[order1])*
scale1*exp(slope_3p[order1]*
scale1*R1)*0.04;
920 if(type2>=0 && type2<=2)
922 scale2=E2>100.0 ? 1.0 : 1.0/std::abs((par_1p[order2][0]+par_1p[order2][1]*E2+par_1p[order2][2]*E2*E2)*slope_1p[order2]);
925 prob=prob*std::abs(slope_1p[order2])*
scale2*exp(slope_1p[order2]*
scale2*R2)*0.04;
927 if(type2>=3 && type2<=5)
929 scale2=E2>100.0 ? 1.0 : 1.0/std::abs((par_3p[order2][0]+par_3p[order2][1]*E2+par_3p[order2][2]*E2*E2)*slope_3p[order2]);
932 prob=prob*std::abs(slope_3p[order2])*
scale2*exp(slope_3p[order2]*
scale2*R2)*0.04;
1168 if(preparedInput.
m_fUseVerbose==1) { Info(
"DiTauMassTools",
"Attempting to set LFV MMC settings"); }
1178 if(mT1>mT2) sr_switch = 0;
1183 if(mT1>mT2) sr_switch = 1;
1191 if(mT1>mT2) sr_switch = 0;
1196 if(mT1>mT2) sr_switch = 1;
1205 if(mT1>mT2) sr_switch = 0;
1210 if(mT1>mT2) sr_switch = 1;
1218 double sigmaSyst = 0.10;
1223 METresScale = 0.41*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1224 METoffset = 7.36*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1228 METresScale = 0.34*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1229 METoffset = 6.61*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1232 Info(
"DiTauMassTools",
"%s", (
"SumEt = "+std::to_string(preparedInput.
m_SumEt)).c_str());
1233 Info(
"DiTauMassTools",
"%s", (
"METoffset = "+std::to_string(METoffset)).c_str());
1234 Info(
"DiTauMassTools",
"%s", (
"METresScale = "+std::to_string(METresScale)).c_str());
1237 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1241 Info(
"DiTauMassTools",
"%s", (
"=> METsigmaP = "+std::to_string(preparedInput.
m_METsigmaP)).c_str());
1242 Info(
"DiTauMassTools",
"%s", (
"=> METsigmaL = "+std::to_string(preparedInput.
m_METsigmaL)).c_str());
1247 double sigmaSyst = 0.10;
1253 METresScale = 0.38*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1254 METoffset = 7.96*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1258 METresScale = 0.39*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1259 METoffset = 6.61*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1263 sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1283 if(preparedInput.
m_MetVec.R()<20.0)
1296 double sigmaSyst = 0.10;
1297 double METresScale = 0.32*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1298 double METoffset = 5.38*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1299 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1319 double sigmaSyst = 0.10;
1320 double METresScale = 0.87*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1321 double METoffset = 4.16*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1322 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1332 double sigmaSyst = 0.10;
1333 double METresScale = 0.65*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1334 double METoffset = 5.0*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1335 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1343 double sigmaSyst=0.10;
1348 double METresScale=0.86*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1349 double METoffset=3.0*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1351 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1358 double dphi_scale =
x > 0.3 ? 0.9429 - 0.059*
x + 0.054*
x*
x : 0.728;
1359 double METoffset = 1.875*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1360 double METresScale1 = 8.914*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1361 double METresScale2 = -8.53*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1364 sigma = preparedInput.
m_SumEt > 80.0 ? METoffset + METresScale1*TMath::Log(sqrt(preparedInput.
m_SumEt)+METresScale2) : 5.0;
1365 sigma = sigma * dphi_scale;
1383 double sigmaSyst=0.10;
1385 double METresScale=0.9*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1386 double METoffset=-1.8*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1387 double sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : std::abs(METoffset);
1392 else if(preparedInput.
m_Njet25==0 &&
1396 double sigmaSyst=0.10;
1398 double dphi_scale =
x > 2.5 ? 11.0796 - 4.61236*
x + 0.423617*
x*
x : 2.;
1399 double METoffset = -8.51013*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1400 double METresScale1 = 8.54378*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1401 double METresScale2 = -3.97146*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1402 double sigma= preparedInput.
m_SumEt>80.0 ? METoffset+METresScale1*TMath::Log(sqrt(preparedInput.
m_SumEt)+METresScale2) : 5.;
1403 sigma = sigma*dphi_scale;
1421 double METresScale=-1.;
1422 double METoffset=-1.;
1423 double sigmaSyst=0.10;
1428 METresScale = 1.1*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1429 METoffset = -5.0*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1432 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : std::abs(METoffset);
1437 double dphi_scale =
x > 0.6 ? 1.42047 - 0.666644*
x + 0.199986*
x*
x : 1.02;
1438 METoffset = 1.19769*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1439 double METresScale1 = 5.61687*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1440 double METresScale2 = -4.2076*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1441 sigma= preparedInput.
m_SumEt>115.0 ? METoffset+METresScale1*TMath::Log(sqrt(preparedInput.
m_SumEt)+METresScale2) : 12.1;
1442 sigma = sigma*dphi_scale;
1456 double sigmaSyst = 0.10;
1457 double METresScale = -1.0;
1458 double METoffset = -1.0;
1464 METresScale=-0.4307*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1465 METoffset=7.06*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1466 double METresScale2=0.07693*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1471 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt)+METresScale2*preparedInput.
m_SumEt : METoffset;
1476 METresScale=0.8149*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1477 METoffset=5.343*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1481 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1492 double sigmaSyst=0.10;
1493 double METresScale=-1.0;
1494 double METoffset=-1.0;
1496 double min_sigma = 2.0;
1501 METoffset = 4.22581*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1502 METresScale = 0.03818*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1503 double METresScale2= 0.12623;
1504 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt)+METresScale2*preparedInput.
m_SumEt : min_sigma;
1506 double p0 = 2.60131;
1507 double p1const = 1.22427;
1508 double p2quad = -1.71261;
1510 sigma *= (DphiLL < p0) ? p1const : p1const+
1511 p2quad*p0*p0 - 2*p2quad*p0*DphiLL+p2quad*DphiLL*DphiLL;
1513 if (sigma < min_sigma) sigma = min_sigma;
1518 METoffset = 5.42506*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1519 METresScale = 5.36760*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1520 double METoffset2 = -4.86808*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1521 if (preparedInput.
m_SumEt > 0.0) {
1522 double x = sqrt(preparedInput.
m_SumEt);
1523 sigma = (
x+METoffset2 > 1) ? METoffset+METresScale*log(
x+METoffset2) : METoffset;
1528 double p0 = 2.24786;
1529 double p1const = 0.908597;
1530 double p2quad = 0.544577;
1532 sigma *= (DphiLL < p0) ? p1const : p1const+
1533 p2quad*p0*p0 - 2*p2quad*p0*DphiLL+p2quad*DphiLL*DphiLL;
1535 if (sigma < min_sigma) sigma = min_sigma;