229 if (!paramFilePath.empty()){
230 std::string total_path =
"DiTauMassTools/"+paramFilePath;
234 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) );
235 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) );
236 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) );
237 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) );
243 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) );
244 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) );
245 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) );
246 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) );
667 const int & type2,
const PtEtaPhiMVector & vis2,
const PtEtaPhiMVector & nu2,
const double & detmet) {
676 const double R1=nu1.P()/vis1.P();
677 const double R2=nu2.P()/vis2.P();
678 const double lep_p1[4]={0.417,0.64,0.52,0.678};
679 const double lep_p2[4]={0.23,0.17,0.315,0.319};
680 const double lep_p3[4]={0.18,0.33,0.41,0.299};
681 const double lep_p4[4]={0.033,0.109,0.129,0.096};
682 const double lep_p5[4]={0.145,0.107,0.259,0.304};
685 const double n_1pr[4]={-0.15,-0.13,-0.25,-0.114};
686 const double s_1pr[4]={0.40,0.54,0.62,0.57};
687 const double n_3pr[4]={-1.08,-1.57,-0.46,-0.39};
688 const double s_3pr[4]={0.53,0.85,0.61,0.53};
691 if(type1>=0 && type1<=5)
696 if(type2>=0 && type2<=5)
701 if(Plep<50.0 && Plep>=45.0) ind=2;
702 if(Plep<45.0 && Plep>=40.0) ind=1;
704 if(Ptau<50.0 && Ptau>=45.0) indT=2;
705 if(Ptau<45.0 && Ptau>=40.0) indT=1;
706 if(Ptau<40.0) indT=0;
707 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]);
708 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]);
710 if(type1>=0 && type1<=2) prob=prob*TMath::Gaus(R1,n_1pr[indT],s_1pr[indT]);
711 if(type2>=0 && type2<=2) prob=prob*TMath::Gaus(R2,n_1pr[indT],s_1pr[indT]);
712 if(type1>=3 && type1<=5) prob=prob*TMath::Gaus(R1,n_3pr[indT],s_3pr[indT]);
713 if(type2>=3 && type2<=5) prob=prob*TMath::Gaus(R2,n_3pr[indT],s_3pr[indT]);
718 const double R1=nu1.P()/vis1.P();
719 const double R2=nu2.P()/vis2.P();
720 const double lep_p1[4]={0.441,0.64,0.79,0.8692};
721 const double lep_p2[4]={0.218,0.28,0.29,0.3304};
722 const double lep_p3[4]={0.256,0.33,0.395,0.4105};
723 const double lep_p4[4]={0.048,0.072,0.148,0.1335};
724 const double lep_p5[4]={0.25,0.68,0.10,0.2872};
726 const double p_1prong=-3.706;
727 const double p_3prong=-5.845;
730 if(type1>=0 && type1<=5)
735 if(type2>=0 && type2<=5)
740 if(Plep<50.0 && Plep>=45.0) ind=2;
741 if(Plep<45.0 && Plep>=40.0) ind=1;
743 const double scale1prong=Ptau>45.0 ? 1.0 : -1.019/((Ptau*0.0074-0.059)*p_1prong);
744 const double scale3prong=Ptau>40.0 ? 1.0 : -1.24/((Ptau*0.0062-0.033)*p_3prong);
745 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]);
746 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]);
748 if(type1>=0 && type1<=2) prob=prob*exp(p_1prong*R1*scale1prong)*std::abs(p_1prong*scale1prong)*0.02;
749 if(type2>=0 && type2<=2) prob=prob*exp(p_1prong*R2*scale1prong)*std::abs(p_1prong*scale1prong)*0.02;
750 if(type1>=3 && type1<=5) prob=prob*exp(p_3prong*R1*scale3prong)*std::abs(p_3prong*scale3prong)*0.02;
751 if(type2>=3 && type2<=5) prob=prob*exp(p_3prong*R2*scale3prong)*std::abs(p_3prong*scale3prong)*0.02;
761 const double R[2]={nu1.P()/vis1.P(),nu2.P()/vis2.P()};
762 const double E[2]={(nu1+vis1).E(),(nu2+vis2).E()};
763 const int tau_type[2]={type1,type2};
764 int order1= vis1.Pt()>vis2.Pt() ? 0 : 1;
765 int order2= vis1.Pt()>vis2.Pt() ? 1 : 0;
770 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;
771 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;
772 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;
773 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;
775 const double C1p=0.062;
776 const double C3p=0.052;
777 const double G1p=1.055;
778 const double G3p=1.093;
781 if( tau_type[order1]>=0 && tau_type[order1]<=2 )
786 double x=std::min(E[order1],300.0);
787 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 ?
788 par_1p[0][0]+par_1p[0][1]/(par_1p[0][2]*
x+par_1p[0][3])+par_1p[0][4]*
x : 0.01;
789 prob=prob*exp(-R[order1]/slope)*0.04/std::abs(slope);
791 if( tau_type[order1]>=3 && tau_type[order1]<=5 )
795 double x=std::min(E[order1],300.0);
796 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 ?
797 par_3p[0][0]+par_3p[0][1]/(par_3p[0][2]*
x+par_3p[0][3])+par_3p[0][4]*
x : 0.01;
798 prob=prob*exp(-R[order1]/slope)*0.04/std::abs(slope);
801 if( tau_type[order2]>=0 && tau_type[order2]<=2 )
803 const double par[4]={0.1147,-0.09675,-35.0,3.711E-11};
804 double x=std::min(300.,std::max(E[order2],30.0));
806 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 ?
807 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;
809 const double mean=par[0]+par[1]/(
x+par[2])+par[3]*pow(
x,4);
810 prob=prob*C1p*TMath::Gaus(R[order2],
mean,sigma);
812 if( tau_type[order2]>=3 && tau_type[order2]<=5 )
814 double x=std::min(300.,std::max(E[order2],20.0));
816 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 ?
817 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;
818 const double par[4]={0.2302,-2.012,-36.08,-0.000373};
820 const double mean=par[0]+par[1]/(
x+par[2])+par[3]*
x;
821 prob=prob*C3p*TMath::Gaus(R[order2],
mean,sigma);
826 const double R1=nu1.P()/vis1.P();
827 const double R2=nu2.P()/vis2.P();
828 const double E1=(nu1+vis1).E();
829 const double E2=(nu2+vis2).E();
830 int order1= vis1.Pt()>vis2.Pt() ? 0 : 1;
831 int order2= vis1.Pt()>vis2.Pt() ? 1 : 0;
832 const double slope_1p[2]={-3.185,-2.052};
833 const double slope_3p[2]={-3.876,-2.853};
836 par_1p[0][0]=-0.3745; par_1p[0][1]=0.01417; par_1p[0][2]=-7.285E-5;
837 par_1p[1][0]=-0.3683; par_1p[1][1]=0.01807; par_1p[1][2]=-9.514E-5;
838 par_3p[0][0]=-0.3055; par_3p[0][1]=0.01149; par_3p[0][2]=-5.855E-5;
839 par_3p[1][0]=-0.3410; par_3p[1][1]=0.01638; par_3p[1][2]=-9.465E-5;
842 if(type1>=0 && type1<=2)
844 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]);
847 prob=prob*std::abs(slope_1p[order1])*
scale1*exp(slope_1p[order1]*
scale1*R1)*0.04;
849 if(type1>=3 && type1<=5)
851 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]);
854 prob=prob*std::abs(slope_3p[order1])*
scale1*exp(slope_3p[order1]*
scale1*R1)*0.04;
856 if(type2>=0 && type2<=2)
858 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]);
861 prob=prob*std::abs(slope_1p[order2])*
scale2*exp(slope_1p[order2]*
scale2*R2)*0.04;
863 if(type2>=3 && type2<=5)
865 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]);
868 prob=prob*std::abs(slope_3p[order2])*
scale2*exp(slope_3p[order2]*
scale2*R2)*0.04;
1102 if(preparedInput.
m_fUseVerbose==1) { Info(
"DiTauMassTools",
"Attempting to set LFV MMC settings"); }
1112 if(mT1>mT2) sr_switch = 0;
1117 if(mT1>mT2) sr_switch = 1;
1125 if(mT1>mT2) sr_switch = 0;
1130 if(mT1>mT2) sr_switch = 1;
1139 if(mT1>mT2) sr_switch = 0;
1144 if(mT1>mT2) sr_switch = 1;
1152 double sigmaSyst = 0.10;
1157 METresScale = 0.41*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1158 METoffset = 7.36*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1162 METresScale = 0.34*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1163 METoffset = 6.61*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1166 Info(
"DiTauMassTools",
"%s", (
"SumEt = "+std::to_string(preparedInput.
m_SumEt)).c_str());
1167 Info(
"DiTauMassTools",
"%s", (
"METoffset = "+std::to_string(METoffset)).c_str());
1168 Info(
"DiTauMassTools",
"%s", (
"METresScale = "+std::to_string(METresScale)).c_str());
1171 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1175 Info(
"DiTauMassTools",
"%s", (
"=> METsigmaP = "+std::to_string(preparedInput.
m_METsigmaP)).c_str());
1176 Info(
"DiTauMassTools",
"%s", (
"=> METsigmaL = "+std::to_string(preparedInput.
m_METsigmaL)).c_str());
1181 double sigmaSyst = 0.10;
1187 METresScale = 0.38*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1188 METoffset = 7.96*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1192 METresScale = 0.39*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1193 METoffset = 6.61*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1197 sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1217 if(preparedInput.
m_MetVec.R()<20.0)
1230 double sigmaSyst = 0.10;
1231 double METresScale = 0.32*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1232 double METoffset = 5.38*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1233 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1253 double sigmaSyst = 0.10;
1254 double METresScale = 0.87*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1255 double METoffset = 4.16*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1256 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1266 double sigmaSyst = 0.10;
1267 double METresScale = 0.65*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1268 double METoffset = 5.0*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1269 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1277 double sigmaSyst=0.10;
1282 double METresScale=0.86*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1283 double METoffset=3.0*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1285 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1292 double dphi_scale =
x > 0.3 ? 0.9429 - 0.059*
x + 0.054*
x*
x : 0.728;
1293 double METoffset = 1.875*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1294 double METresScale1 = 8.914*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1295 double METresScale2 = -8.53*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1298 sigma = preparedInput.
m_SumEt > 80.0 ? METoffset + METresScale1*TMath::Log(sqrt(preparedInput.
m_SumEt)+METresScale2) : 5.0;
1299 sigma = sigma * dphi_scale;
1317 double sigmaSyst=0.10;
1319 double METresScale=0.9*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1320 double METoffset=-1.8*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1321 double sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : std::abs(METoffset);
1326 else if(preparedInput.
m_Njet25==0 &&
1330 double sigmaSyst=0.10;
1332 double dphi_scale =
x > 2.5 ? 11.0796 - 4.61236*
x + 0.423617*
x*
x : 2.;
1333 double METoffset = -8.51013*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1334 double METresScale1 = 8.54378*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1335 double METresScale2 = -3.97146*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1336 double sigma= preparedInput.
m_SumEt>80.0 ? METoffset+METresScale1*TMath::Log(sqrt(preparedInput.
m_SumEt)+METresScale2) : 5.;
1337 sigma = sigma*dphi_scale;
1355 double METresScale=-1.;
1356 double METoffset=-1.;
1357 double sigmaSyst=0.10;
1362 METresScale = 1.1*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1363 METoffset = -5.0*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1366 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : std::abs(METoffset);
1371 double dphi_scale =
x > 0.6 ? 1.42047 - 0.666644*
x + 0.199986*
x*
x : 1.02;
1372 METoffset = 1.19769*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1373 double METresScale1 = 5.61687*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1374 double METresScale2 = -4.2076*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1375 sigma= preparedInput.
m_SumEt>115.0 ? METoffset+METresScale1*TMath::Log(sqrt(preparedInput.
m_SumEt)+METresScale2) : 12.1;
1376 sigma = sigma*dphi_scale;
1390 double sigmaSyst = 0.10;
1391 double METresScale = -1.0;
1392 double METoffset = -1.0;
1398 METresScale=-0.4307*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1399 METoffset=7.06*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1400 double METresScale2=0.07693*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1405 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt)+METresScale2*preparedInput.
m_SumEt : METoffset;
1410 METresScale=0.8149*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1411 METoffset=5.343*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1415 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1426 double sigmaSyst=0.10;
1427 double METresScale=-1.0;
1428 double METoffset=-1.0;
1430 double min_sigma = 2.0;
1435 METoffset = 4.22581*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1436 METresScale = 0.03818*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1437 double METresScale2= 0.12623;
1438 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt)+METresScale2*preparedInput.
m_SumEt : min_sigma;
1440 double p0 = 2.60131;
1441 double p1const = 1.22427;
1442 double p2quad = -1.71261;
1444 sigma *= (DphiLL < p0) ? p1const : p1const+
1445 p2quad*p0*p0 - 2*p2quad*p0*DphiLL+p2quad*DphiLL*DphiLL;
1447 if (sigma < min_sigma) sigma = min_sigma;
1452 METoffset = 5.42506*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1453 METresScale = 5.36760*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1454 double METoffset2 = -4.86808*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1455 if (preparedInput.
m_SumEt > 0.0) {
1456 double x = sqrt(preparedInput.
m_SumEt);
1457 sigma = (
x+METoffset2 > 1) ? METoffset+METresScale*log(
x+METoffset2) : METoffset;
1462 double p0 = 2.24786;
1463 double p1const = 0.908597;
1464 double p2quad = 0.544577;
1466 sigma *= (DphiLL < p0) ? p1const : p1const+
1467 p2quad*p0*p0 - 2*p2quad*p0*DphiLL+p2quad*DphiLL*DphiLL;
1469 if (sigma < min_sigma) sigma = min_sigma;