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) );
665 const int & type2,
const PtEtaPhiMVector & vis2,
const PtEtaPhiMVector & nu2,
const double & detmet) {
674 const double R1=nu1.P()/vis1.P();
675 const double R2=nu2.P()/vis2.P();
676 const double lep_p1[4]={0.417,0.64,0.52,0.678};
677 const double lep_p2[4]={0.23,0.17,0.315,0.319};
678 const double lep_p3[4]={0.18,0.33,0.41,0.299};
679 const double lep_p4[4]={0.033,0.109,0.129,0.096};
680 const double lep_p5[4]={0.145,0.107,0.259,0.304};
683 const double n_1pr[4]={-0.15,-0.13,-0.25,-0.114};
684 const double s_1pr[4]={0.40,0.54,0.62,0.57};
685 const double n_3pr[4]={-1.08,-1.57,-0.46,-0.39};
686 const double s_3pr[4]={0.53,0.85,0.61,0.53};
689 if(type1>=0 && type1<=5)
694 if(type2>=0 && type2<=5)
699 if(Plep<50.0 && Plep>=45.0) ind=2;
700 if(Plep<45.0 && Plep>=40.0) ind=1;
702 if(Ptau<50.0 && Ptau>=45.0) indT=2;
703 if(Ptau<45.0 && Ptau>=40.0) indT=1;
704 if(Ptau<40.0) indT=0;
705 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]);
706 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]);
708 if(type1>=0 && type1<=2) prob=prob*TMath::Gaus(R1,n_1pr[indT],s_1pr[indT]);
709 if(type2>=0 && type2<=2) prob=prob*TMath::Gaus(R2,n_1pr[indT],s_1pr[indT]);
710 if(type1>=3 && type1<=5) prob=prob*TMath::Gaus(R1,n_3pr[indT],s_3pr[indT]);
711 if(type2>=3 && type2<=5) prob=prob*TMath::Gaus(R2,n_3pr[indT],s_3pr[indT]);
716 const double R1=nu1.P()/vis1.P();
717 const double R2=nu2.P()/vis2.P();
718 const double lep_p1[4]={0.441,0.64,0.79,0.8692};
719 const double lep_p2[4]={0.218,0.28,0.29,0.3304};
720 const double lep_p3[4]={0.256,0.33,0.395,0.4105};
721 const double lep_p4[4]={0.048,0.072,0.148,0.1335};
722 const double lep_p5[4]={0.25,0.68,0.10,0.2872};
724 const double p_1prong=-3.706;
725 const double p_3prong=-5.845;
728 if(type1>=0 && type1<=5)
733 if(type2>=0 && type2<=5)
738 if(Plep<50.0 && Plep>=45.0) ind=2;
739 if(Plep<45.0 && Plep>=40.0) ind=1;
741 const double scale1prong=Ptau>45.0 ? 1.0 : -1.019/((Ptau*0.0074-0.059)*p_1prong);
742 const double scale3prong=Ptau>40.0 ? 1.0 : -1.24/((Ptau*0.0062-0.033)*p_3prong);
743 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]);
744 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]);
746 if(type1>=0 && type1<=2) prob=prob*exp(p_1prong*R1*scale1prong)*std::abs(p_1prong*scale1prong)*0.02;
747 if(type2>=0 && type2<=2) prob=prob*exp(p_1prong*R2*scale1prong)*std::abs(p_1prong*scale1prong)*0.02;
748 if(type1>=3 && type1<=5) prob=prob*exp(p_3prong*R1*scale3prong)*std::abs(p_3prong*scale3prong)*0.02;
749 if(type2>=3 && type2<=5) prob=prob*exp(p_3prong*R2*scale3prong)*std::abs(p_3prong*scale3prong)*0.02;
759 const double R[2]={nu1.P()/vis1.P(),nu2.P()/vis2.P()};
760 const double E[2]={(nu1+vis1).E(),(nu2+vis2).E()};
761 const int tau_type[2]={type1,type2};
762 int order1= vis1.Pt()>vis2.Pt() ? 0 : 1;
763 int order2= vis1.Pt()>vis2.Pt() ? 1 : 0;
768 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;
769 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;
770 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;
771 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;
773 const double C1p=0.062;
774 const double C3p=0.052;
775 const double G1p=1.055;
776 const double G3p=1.093;
779 if( tau_type[order1]>=0 && tau_type[order1]<=2 )
784 double x=std::min(E[order1],300.0);
785 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 ?
786 par_1p[0][0]+par_1p[0][1]/(par_1p[0][2]*
x+par_1p[0][3])+par_1p[0][4]*
x : 0.01;
787 prob=prob*exp(-R[order1]/slope)*0.04/std::abs(slope);
789 if( tau_type[order1]>=3 && tau_type[order1]<=5 )
793 double x=std::min(E[order1],300.0);
794 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 ?
795 par_3p[0][0]+par_3p[0][1]/(par_3p[0][2]*
x+par_3p[0][3])+par_3p[0][4]*
x : 0.01;
796 prob=prob*exp(-R[order1]/slope)*0.04/std::abs(slope);
799 if( tau_type[order2]>=0 && tau_type[order2]<=2 )
801 const double par[4]={0.1147,-0.09675,-35.0,3.711E-11};
802 double x=std::min(300.,std::max(E[order2],30.0));
804 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 ?
805 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 const double mean=par[0]+par[1]/(
x+par[2])+par[3]*pow(
x,4);
808 prob=prob*C1p*TMath::Gaus(R[order2],
mean,sigma);
810 if( tau_type[order2]>=3 && tau_type[order2]<=5 )
812 double x=std::min(300.,std::max(E[order2],20.0));
814 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 ?
815 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;
816 const double par[4]={0.2302,-2.012,-36.08,-0.000373};
818 const double mean=par[0]+par[1]/(
x+par[2])+par[3]*
x;
819 prob=prob*C3p*TMath::Gaus(R[order2],
mean,sigma);
824 const double R1=nu1.P()/vis1.P();
825 const double R2=nu2.P()/vis2.P();
826 const double E1=(nu1+vis1).E();
827 const double E2=(nu2+vis2).E();
828 int order1= vis1.Pt()>vis2.Pt() ? 0 : 1;
829 int order2= vis1.Pt()>vis2.Pt() ? 1 : 0;
830 const double slope_1p[2]={-3.185,-2.052};
831 const double slope_3p[2]={-3.876,-2.853};
834 par_1p[0][0]=-0.3745; par_1p[0][1]=0.01417; par_1p[0][2]=-7.285E-5;
835 par_1p[1][0]=-0.3683; par_1p[1][1]=0.01807; par_1p[1][2]=-9.514E-5;
836 par_3p[0][0]=-0.3055; par_3p[0][1]=0.01149; par_3p[0][2]=-5.855E-5;
837 par_3p[1][0]=-0.3410; par_3p[1][1]=0.01638; par_3p[1][2]=-9.465E-5;
840 if(type1>=0 && type1<=2)
842 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]);
845 prob=prob*std::abs(slope_1p[order1])*
scale1*exp(slope_1p[order1]*
scale1*R1)*0.04;
847 if(type1>=3 && type1<=5)
849 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]);
852 prob=prob*std::abs(slope_3p[order1])*
scale1*exp(slope_3p[order1]*
scale1*R1)*0.04;
854 if(type2>=0 && type2<=2)
856 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]);
859 prob=prob*std::abs(slope_1p[order2])*
scale2*exp(slope_1p[order2]*
scale2*R2)*0.04;
861 if(type2>=3 && type2<=5)
863 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]);
866 prob=prob*std::abs(slope_3p[order2])*
scale2*exp(slope_3p[order2]*
scale2*R2)*0.04;
1100 if(preparedInput.
m_fUseVerbose==1) { Info(
"DiTauMassTools",
"Attempting to set LFV MMC settings"); }
1110 if(mT1>mT2) sr_switch = 0;
1115 if(mT1>mT2) sr_switch = 1;
1123 if(mT1>mT2) sr_switch = 0;
1128 if(mT1>mT2) sr_switch = 1;
1137 if(mT1>mT2) sr_switch = 0;
1142 if(mT1>mT2) sr_switch = 1;
1150 double sigmaSyst = 0.10;
1155 METresScale = 0.41*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1156 METoffset = 7.36*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1160 METresScale = 0.34*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1161 METoffset = 6.61*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1164 Info(
"DiTauMassTools",
"%s", (
"SumEt = "+std::to_string(preparedInput.
m_SumEt)).c_str());
1165 Info(
"DiTauMassTools",
"%s", (
"METoffset = "+std::to_string(METoffset)).c_str());
1166 Info(
"DiTauMassTools",
"%s", (
"METresScale = "+std::to_string(METresScale)).c_str());
1169 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1173 Info(
"DiTauMassTools",
"%s", (
"=> METsigmaP = "+std::to_string(preparedInput.
m_METsigmaP)).c_str());
1174 Info(
"DiTauMassTools",
"%s", (
"=> METsigmaL = "+std::to_string(preparedInput.
m_METsigmaL)).c_str());
1179 double sigmaSyst = 0.10;
1185 METresScale = 0.38*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1186 METoffset = 7.96*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1190 METresScale = 0.39*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1191 METoffset = 6.61*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1195 sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1215 if(preparedInput.
m_MetVec.R()<20.0)
1228 double sigmaSyst = 0.10;
1229 double METresScale = 0.32*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1230 double METoffset = 5.38*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1231 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1251 double sigmaSyst = 0.10;
1252 double METresScale = 0.87*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1253 double METoffset = 4.16*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1254 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1264 double sigmaSyst = 0.10;
1265 double METresScale = 0.65*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1266 double METoffset = 5.0*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1267 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1275 double sigmaSyst=0.10;
1280 double METresScale=0.86*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1281 double METoffset=3.0*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1283 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1290 double dphi_scale =
x > 0.3 ? 0.9429 - 0.059*
x + 0.054*
x*
x : 0.728;
1291 double METoffset = 1.875*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1292 double METresScale1 = 8.914*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1293 double METresScale2 = -8.53*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1296 sigma = preparedInput.
m_SumEt > 80.0 ? METoffset + METresScale1*TMath::Log(sqrt(preparedInput.
m_SumEt)+METresScale2) : 5.0;
1297 sigma = sigma * dphi_scale;
1315 double sigmaSyst=0.10;
1317 double METresScale=0.9*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1318 double METoffset=-1.8*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1319 double sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : std::abs(METoffset);
1324 else if(preparedInput.
m_Njet25==0 &&
1328 double sigmaSyst=0.10;
1330 double dphi_scale =
x > 2.5 ? 11.0796 - 4.61236*
x + 0.423617*
x*
x : 2.;
1331 double METoffset = -8.51013*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1332 double METresScale1 = 8.54378*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1333 double METresScale2 = -3.97146*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1334 double sigma= preparedInput.
m_SumEt>80.0 ? METoffset+METresScale1*TMath::Log(sqrt(preparedInput.
m_SumEt)+METresScale2) : 5.;
1335 sigma = sigma*dphi_scale;
1353 double METresScale=-1.;
1354 double METoffset=-1.;
1355 double sigmaSyst=0.10;
1360 METresScale = 1.1*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1361 METoffset = -5.0*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1364 double sigma = preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : std::abs(METoffset);
1369 double dphi_scale =
x > 0.6 ? 1.42047 - 0.666644*
x + 0.199986*
x*
x : 1.02;
1370 METoffset = 1.19769*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1371 double METresScale1 = 5.61687*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1372 double METresScale2 = -4.2076*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1373 sigma= preparedInput.
m_SumEt>115.0 ? METoffset+METresScale1*TMath::Log(sqrt(preparedInput.
m_SumEt)+METresScale2) : 12.1;
1374 sigma = sigma*dphi_scale;
1388 double sigmaSyst = 0.10;
1389 double METresScale = -1.0;
1390 double METoffset = -1.0;
1396 METresScale=-0.4307*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1397 METoffset=7.06*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1398 double METresScale2=0.07693*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1403 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt)+METresScale2*preparedInput.
m_SumEt : METoffset;
1408 METresScale=0.8149*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1409 METoffset=5.343*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1413 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt) : METoffset;
1424 double sigmaSyst=0.10;
1425 double METresScale=-1.0;
1426 double METoffset=-1.0;
1428 double min_sigma = 2.0;
1433 METoffset = 4.22581*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1434 METresScale = 0.03818*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1435 double METresScale2= 0.12623;
1436 sigma= preparedInput.
m_SumEt>0.0 ? METoffset+METresScale*sqrt(preparedInput.
m_SumEt)+METresScale2*preparedInput.
m_SumEt : min_sigma;
1438 double p0 = 2.60131;
1439 double p1const = 1.22427;
1440 double p2quad = -1.71261;
1442 sigma *= (DphiLL < p0) ? p1const : p1const+
1443 p2quad*p0*p0 - 2*p2quad*p0*DphiLL+p2quad*DphiLL*DphiLL;
1445 if (sigma < min_sigma) sigma = min_sigma;
1450 METoffset = 5.42506*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1451 METresScale = 5.36760*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1452 double METoffset2 = -4.86808*(1.0+preparedInput.
m_METresSyst*sigmaSyst);
1453 if (preparedInput.
m_SumEt > 0.0) {
1454 double x = sqrt(preparedInput.
m_SumEt);
1455 sigma = (
x+METoffset2 > 1) ? METoffset+METresScale*log(
x+METoffset2) : METoffset;
1460 double p0 = 2.24786;
1461 double p1const = 0.908597;
1462 double p2quad = 0.544577;
1464 sigma *= (DphiLL < p0) ? p1const : p1const+
1465 p2quad*p0*p0 - 2*p2quad*p0*DphiLL+p2quad*DphiLL*DphiLL;
1467 if (sigma < min_sigma) sigma = min_sigma;