From 0c3b52bbadbea752a2f4a112a977f0b324df302b Mon Sep 17 00:00:00 2001 From: Javier Duarte Date: Mon, 24 Apr 2017 20:43:30 -0500 Subject: [PATCH] first commit of new razor pdf --- config/run2_new.config | 43 ++++ python/Makefile | 12 +- python/src/Linkdef.h | 2 + python/src/RooRazorGenTailBin.cc | 324 +++++++++++++++++++++++++++++++ python/src/RooRazorGenTailBin.h | 125 ++++++++++++ 5 files changed, 503 insertions(+), 3 deletions(-) create mode 100644 config/run2_new.config create mode 100644 python/src/RooRazorGenTailBin.cc create mode 100644 python/src/RooRazorGenTailBin.h diff --git a/config/run2_new.config b/config/run2_new.config new file mode 100644 index 00000000..a7e74b5e --- /dev/null +++ b/config/run2_new.config @@ -0,0 +1,43 @@ + +[DiJet] +variables = ['MR[500.,500.,4000.]', 'Rsq[0.25,0.25,1.5]', 'nBtag[0.,0.,4.]'] + +variables_range = ['MR_LowRsq[500.,4000.]', 'Rsq_LowRsq[0.25,0.3]', 'nBtag_LowRsq[0.,4.]', + 'MR_LowMR[500.,600.]', 'Rsq_LowMR[0.3,1.5]', 'nBtag_LowMR[0.,4.]', + 'MR_HighMR[600.,4000.]', 'Rsq_HighMR[0.3,1.5]', 'nBtag_HighMR[0.,4.]'] + +parameters = [#'MR0[6.]', 'R0[6.]', 'MRMR0[0.1]', 'RMR0[1.]','RR0[1.]','alpha[1.0]', + 'MR0[370.]', 'R0[220.]', 'MRMR0[-40.]', 'RMR0[98.]','RR0[-1.6]','alpha[0.5]', + #'MR0[-300]', 'R0[-0.25]', 'b[1.]', 'n[3.]', + 'R1[0.9]', 'R2[0.03]', + 'Ntot[2501.]'] + +pdfs = ['RooRazorGenTail::razor2dPdf(MR,Rsq,MR0,R0,MRMR0,RMR0,RR0,alpha)', + #'RooRazor2DTail_SYS::razor2dPdf(MR,Rsq,MR0,R0,b,n)', + 'RooSigmoid::rsqPdf(Rsq,R1,R2)', + 'PROD::razor2dPdf_turnoff(razor2dPdf,rsqPdf)', + #'SUM::extRazorPdf(Ntot*razor2dPdf_turnoff)', + 'SUM::extRazorPdf(Ntot*razor2dPdf)'] + + +combine_parameters = ['DiJet_TTj0b_norm[1.,0.,+INF]', + 'DiJet_TTj1b_norm[1.,0.,+INF]', + 'DiJet_TTj2b_norm[1.,0.,+INF]', + 'DiJet_TTj3b_norm[1.,0.,+INF]', + 'Ntot_TTj0b_DiJet[2501.]', 'Ntot_TTj1b_DiJet[200.]', 'Ntot_TTj2b_DiJet[100.]', 'Ntot_TTj3b_DiJet[50.]', + 'MRCut_DiJet[500.]','RCut_DiJet[0.25]', + 'BtagCut_TTj0b[0]','BtagCut_TTj1b[1]','BtagCut_TTj2b[2]','BtagCut_TTj3b[3]', + 'MR0[370.]', 'R0[220.]', 'MRMR0[-40.]', 'RMR0[98.]','RR0[-1.6]','alpha[0.5]',] + +combine_pdfs = ['RooRazorGenTailBin::DiJet_TTj0b(th1x,MR0,R0,MRMR0,RMR0,RR0,alpha,MRCut_DiJet,RCut_DiJet,BtagCut_TTj0b)', + #'RooRazorGenTailBin::DiJet_TTj1b(th1x,MR0,R0,MRMR0,RMR0,RR0,alpha,MRCut_DiJet,RCut_DiJet,BtagCut_TTj1b)', + #'RooRazorGenTailBin::DiJet_TTj2b(th1x,MR0,R0,MRMR0,RMR0,RR0,alpha,MRCut_DiJet,RCut_DiJet,BtagCut_TTj2b)', + #'RooRazorGenTailBin::DiJet_TTj3b(th1x,MR0,R0,MRMR0,RMR0,RR0,alpha,MRCut_DiJet,RCut_DiJet,BtagCut_TTj3b)', + #'SUM::extRazorPdf(Ntot_TTj0b_DiJet*DiJet_TTj0b,Ntot_TTj1b_DiJet*DiJet_TTj1b,Ntot_TTj2b_DiJet*DiJet_TTj2b,Ntot_TTj3b_DiJet*DiJet_TTj3b)', + 'SUM::extRazorPdf(Ntot_TTj0b_DiJet*DiJet_TTj0b)'] + +#signal and plotting binning +signal_MR = [500, 600, 700, 900, 1200, 1600, 2500, 4000] +signal_Rsq = [0.25,0.30,0.41,0.52,0.64,1.5] +signal_nBtag = [0.,4.] + \ No newline at end of file diff --git a/python/Makefile b/python/Makefile index a208112a..6e6314b1 100644 --- a/python/Makefile +++ b/python/Makefile @@ -2,7 +2,7 @@ include ../Makefile.inc INCLUDEDIR= src SHARED = lib/libRazorRun2.so -INCLUDELIST= RooRazor2DTail_SYS.h RooRazor3DBinPdf.h RooRazor3DBinReparamPdf.h RooRazor3DBinErrorPdf.h RooRazor3DBinNumericRsqTurnOffPdf.h RooRazor3DBinNumericMRSlopePdf.h RooRazor3DBinMRSlopePdf.h RooRazor3DBinMRSlopeErrorPdf.h MLMixedSample.h RooBTagMult.h RooSigmoid.h Linkdef.h +INCLUDELIST= RooRazor2DTail_SYS.h RooRazor3DBinPdf.h RooRazor3DBinReparamPdf.h RooRazor3DBinErrorPdf.h RooRazor3DBinNumericRsqTurnOffPdf.h RooRazor3DBinNumericMRSlopePdf.h RooRazor3DBinMRSlopePdf.h RooRazor3DBinMRSlopeErrorPdf.h MLMixedSample.h RooBTagMult.h RooSigmoid.h RooRazorGenTail.h RooRazorGenTailBin.h Linkdef.h .PHONY: clean all @@ -16,7 +16,13 @@ $(INCLUDEDIR)/RooRazor2DTail_SYS.o: $(INCLUDEDIR)/RooRazor3DBinPdf.o: $(CXX) $(INCLUDEDIR)/RooRazor3DBinPdf.cc $(CXXFLAGS) $(LDFLAGS) $(LIBS) -o $@ -I$(INCLUDEDIR) -c - + +$(INCLUDEDIR)/RooRazorGenTail.o: + $(CXX) $(INCLUDEDIR)/RooRazorGenTail.cc $(CXXFLAGS) $(LDFLAGS) $(LIBS) -o $@ -I$(INCLUDEDIR) -c + +$(INCLUDEDIR)/RooRazorGenTailBin.o: + $(CXX) $(INCLUDEDIR)/RooRazorGenTailBin.cc $(CXXFLAGS) $(LDFLAGS) $(LIBS) -o $@ -I$(INCLUDEDIR) -c + $(INCLUDEDIR)/RooRazor3DBinReparamPdf.o: $(CXX) $(INCLUDEDIR)/RooRazor3DBinReparamPdf.cc $(CXXFLAGS) $(LDFLAGS) $(LIBS) -o $@ -I$(INCLUDEDIR) -c @@ -44,7 +50,7 @@ $(INCLUDEDIR)/RooSigmoid.o: $(INCLUDEDIR)/MLMixedSample.o: $(CXX) $(INCLUDEDIR)/MLMixedSample.cc $(CXXFLAGS) $(LDFLAGS) $(LIBS) -o $@ -I$(INCLUDEDIR) -c -$(SHARED): $(INCLUDEDIR)/rootdict.o $(INCLUDEDIR)/RooRazor2DTail_SYS.o $(INCLUDEDIR)/RooRazor3DBinPdf.o $(INCLUDEDIR)/RooRazor3DBinReparamPdf.o $(INCLUDEDIR)/RooRazor3DBinErrorPdf.o $(INCLUDEDIR)/RooRazor3DBinNumericRsqTurnOffPdf.o $(INCLUDEDIR)/RooRazor3DBinNumericMRSlopePdf.o $(INCLUDEDIR)/RooRazor3DBinMRSlopePdf.o $(INCLUDEDIR)/RooRazor3DBinMRSlopeErrorPdf.o $(INCLUDEDIR)/RooBTagMult.o $(INCLUDEDIR)/RooSigmoid.o $(INCLUDEDIR)/MLMixedSample.o +$(SHARED): $(INCLUDEDIR)/rootdict.o $(INCLUDEDIR)/RooRazor2DTail_SYS.o $(INCLUDEDIR)/RooRazor3DBinPdf.o $(INCLUDEDIR)/RooRazor3DBinReparamPdf.o $(INCLUDEDIR)/RooRazor3DBinErrorPdf.o $(INCLUDEDIR)/RooRazorGenTail.o $(INCLUDEDIR)/RooRazorGenTailBin.o $(INCLUDEDIR)/RooRazor3DBinNumericRsqTurnOffPdf.o $(INCLUDEDIR)/RooRazor3DBinNumericMRSlopePdf.o $(INCLUDEDIR)/RooRazor3DBinMRSlopePdf.o $(INCLUDEDIR)/RooRazor3DBinMRSlopeErrorPdf.o $(INCLUDEDIR)/RooBTagMult.o $(INCLUDEDIR)/RooSigmoid.o $(INCLUDEDIR)/MLMixedSample.o $(LD) $(SOFLAGS) $(LDFLAGS) $(LIBS) -o $@ $^ clean: diff --git a/python/src/Linkdef.h b/python/src/Linkdef.h index 5f87fc9a..ebfbfb3b 100644 --- a/python/src/Linkdef.h +++ b/python/src/Linkdef.h @@ -18,6 +18,8 @@ #pragma link C++ defined_in "RooRazor3DBinMRSlopeErrorPdf.h"; #pragma link C++ defined_in "RooBTagMult.h"; #pragma link C++ defined_in "RooSigmoid.h"; +#pragma link C++ defined_in "RooRazorGenTail.h"; +#pragma link C++ defined_in "RooRazorGenTailBin.h"; #pragma link C++ defined_in "MLMixedSample.h"; #endif diff --git a/python/src/RooRazorGenTailBin.cc b/python/src/RooRazorGenTailBin.cc new file mode 100644 index 00000000..023eda70 --- /dev/null +++ b/python/src/RooRazorGenTailBin.cc @@ -0,0 +1,324 @@ +//--------------------------------------------------------------------------- +#include "RooFit.h" + +#include "Riostream.h" +#include +#include +#include +#include + +#include "RooRazorGenTailBin.h" +#include "RooRealVar.h" +#include "Math/Functor.h" +#include "Math/WrappedFunction.h" +#include "Math/IFunction.h" +#include "Math/Integrator.h" +#include "Math/GSLIntegrator.h" +#include "Math/IntegratorMultiDim.h" + +using namespace std; + +ClassImp(RooRazorGenTailBin) +//--------------------------------------------------------------------------- +RooRazorGenTailBin::RooRazorGenTailBin(const char *name, const char *title, + RooAbsReal& _th1x, + RooAbsReal &_bx, RooAbsReal &_by, RooAbsReal &_bxx, + RooAbsReal &_bxy, RooAbsReal &_byy, RooAbsReal &_alpha, + RooAbsReal& _xCut, RooAbsReal& _yCut, RooAbsReal& _zCut) : RooAbsPdf(name, title), +//TH3* _Hnominal) : RooAbsPdf(name, title), + th1x("th1x", "th1x Observable", this, _th1x), + BX("BX", "B X Coefficient", this, _bx), + BY("BY", "B Y Coefficient", this, _by), + BXX("BXX", "B XX Coefficient", this, _bxx), + BXY("BXY", "B XY Coefficient", this, _bxy), + BYY("BYY", "B YY Coefficient", this, _byy), + ALPHA("ALPHA", "Shape parameter", this, _alpha), + xCut("xCut", "X Cut parameter",this, _xCut), + yCut("yCut", "Y Cut parameter",this, _yCut), + zCut("zCut", "Z Cut parameter",this, _zCut), + xBins(0), + yBins(0), + zBins(0), + xMax(0), + yMax(0), + zMax(0), + xMin(0), + yMin(0), + zMin(0), + relTol(1E-12), + absTol(1E-12) +{ + memset(&xArray, 0, sizeof(xArray)); + memset(&yArray, 0, sizeof(yArray)); + memset(&zArray, 0, sizeof(zArray)); +} +//--------------------------------------------------------------------------- +RooRazorGenTailBin::RooRazorGenTailBin(const RooRazorGenTailBin& other, const char* name) : + RooAbsPdf(other, name), + th1x("th1x", this, other.th1x), + BX("BX", this, other.BX), + BY("BY", this, other.BY), + BXX("BXX", this, other.BXX), + BXY("BXY", this, other.BXY), + BYY("BYY", this, other.BYY), + ALPHA("ALPHA", this, other.ALPHA), + xCut("xCut", this, other.xCut), + yCut("yCut", this, other.yCut), + zCut("zCut", this, other.zCut), + xBins(other.xBins), + yBins(other.yBins), + zBins(other.zBins), + xMax(other.xMax), + yMax(other.yMax), + zMax(other.zMax), + xMin(other.xMin), + yMin(other.yMin), + zMin(other.zMin), + relTol(other.relTol), + absTol(other.absTol) +{ + //memset(&xArray, 0, sizeof(xArray)); + //memset(&yArray, 0, sizeof(yArray)); + //memset(&zArray, 0, sizeof(zArray)); + for (Int_t i=0; iGetXaxis()->GetNbins(); + yBins = _Hnominal->GetYaxis()->GetNbins(); + zBins = _Hnominal->GetZaxis()->GetNbins(); + xMin = _Hnominal->GetXaxis()->GetBinLowEdge(1); + yMin = _Hnominal->GetYaxis()->GetBinLowEdge(1); + zMin = _Hnominal->GetZaxis()->GetBinLowEdge(1); + xMax = _Hnominal->GetXaxis()->GetBinUpEdge(xBins); + yMax = _Hnominal->GetYaxis()->GetBinUpEdge(yBins); + zMax = _Hnominal->GetZaxis()->GetBinUpEdge(zBins); + memset(&xArray, 0, sizeof(xArray)); + memset(&yArray, 0, sizeof(yArray)); + memset(&zArray, 0, sizeof(zArray)); + for (Int_t i=0; iGetXaxis()->GetBinLowEdge(i+1); + } + for (Int_t j=0; jGetYaxis()->GetBinLowEdge(j+1); + } + for (Int_t k=0; kGetZaxis()->GetBinLowEdge(k+1); + } +} +//--------------------------------------------------------------------------- +void RooRazorGenTailBin::setRelTol(double _relTol){ + relTol = _relTol; +} +//--------------------------------------------------------------------------- +void RooRazorGenTailBin::setAbsTol(double _absTol){ + absTol = _absTol; +} +//--------------------------------------------------------------------------- +Double_t RooRazorGenTailBin::evaluate() const +{ + Double_t integral = 0.0; + Double_t total_integral = 1.0; + + Int_t nBins = xBins*yBins*zBins; + + Int_t iBin = (Int_t) th1x; + if(iBin < 0 || iBin >= nBins) { + //cout << "in bin " << iBin << " which is outside of range" << endl; + return 0.0; + } + + + Int_t zBin = iBin % zBins; + Int_t yBin = ( (iBin - zBin)/(zBins) ) % (yBins); + Int_t xBin = (iBin - zBin - yBin*zBins ) / (zBins*yBins); + + //cout << "in bin " << iBin << " which is in range" << endl; + //cout << "(" << xBin+1 << "," << yBin+1 << "," << zBin+1 << ")" << endl; + + Double_t zLow = zArray[zBin]; + Double_t zHigh = zArray[zBin+1]; + if (zCut >= zLow and zCut < zHigh){ + Double_t xLow = xArray[xBin]; + Double_t xHigh = xArray[xBin+1]; + Double_t yLow = yArray[yBin]; + Double_t yHigh = yArray[yBin+1]; + + + // define the function to be integrated numerically + RazorFunctionGenTail func; + double params[6]; + params[0] = BX; + params[1] = BY; + params[2] = BXX; + params[3] = BXY; + params[4] = BYY; + params[5] = ALPHA; + func.SetParameters(params); + ROOT::Math::IntegratorMultiDim ig(ROOT::Math::IntegrationMultiDim::kADAPTIVE); + ig.SetFunction(func); + + double a[2] = {0,0}; // (x, y) low point + double b[2] = {0,0}; // (x, y) high point + double c[2] = {0,0}; // (x, y) mid point + + if(xHigh <= xCut && yHigh <= yCut) { + return 0.0; + } + else if(xLow < xCut && xHigh > xCut && yHigh <= yCut) { + a[0] = xCut; a[1] = yLow; + b[0] = xHigh; b[1] = yHigh; + c[0] = (a[0]+b[0])/2.; c[1] = (a[1]+b[1])/2.; + integral = ig.Integral(a,b); + //std::cout << integral << std::endl; + //integral = func.DoEval(c)*(b[0]-a[0])*(b[1]-a[1]); + //std::cout << integral << std::endl; + } + else if(yLow < yCut && yHigh > yCut && xHigh <= xCut) { + a[0] = xLow; a[1] = yCut; + b[0] = xHigh; b[1] = yHigh; + c[0] = (a[0]+b[0])/2.; c[1] = (a[1]+b[1])/2.; + integral = ig.Integral(a,b); + //std::cout << integral << std::endl; + //integral = func.DoEval(c)*(b[0]-a[0])*(b[1]-a[1]); + //std::cout << integral << std::endl; + } + else if(xLow < xCut && xHigh > xCut && yLow < yCut && yHigh > yCut) { + a[0] = xLow; a[1] = yLow; + b[0] = xHigh; b[1] = yHigh; + c[0] = (a[0]+b[0])/2.; c[1] = (a[1]+b[1])/2.; + integral = ig.Integral(a,b); + //integral = func.DoEval(c)*(b[0]-a[0])*(b[1]-a[1]); + //std::cout << integral << std::endl; + a[0] = xLow; a[1] = yLow; + b[0] = xCut; b[1] = yCut; + c[0] = (a[0]+b[0])/2.; c[1] = (a[1]+b[1])/2.; + integral -= ig.Integral(a,b); + //integral -= func.DoEval(c)*(b[0]-a[0])*(b[1]-a[1]); + //std::cout << integral << std::endl; + } + else { + a[0] = xLow; a[1] = yLow; + b[0] = xHigh; b[1] = yHigh; + c[0] = (a[0]+b[0])/2.; c[1] = (a[1]+b[1])/2.; + integral = ig.Integral(a,b); + //std::cout << integral << std::endl; + //integral = func.DoEval(c)*(b[0]-a[0])*(b[1]-a[1]); + //std::cout << integral << std::endl; + } + + } + + if (total_integral>0.0) { + return integral; + } else return 0; + +} + +// //--------------------------------------------------------------------------- +Int_t RooRazorGenTailBin::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName) const{ + //if (matchArgs(allVars, analVars, th1x)) return 1; + return 0; +} + +// //--------------------------------------------------------------------------- +Double_t RooRazorGenTailBin::analyticalIntegral(Int_t code, const char* rangeName) const{ + + Double_t th1xMin = th1x.min(rangeName); Double_t th1xMax = th1x.max(rangeName); + Int_t iBinMin = (Int_t) th1xMin; Int_t iBinMax = (Int_t) th1xMax; + + + + Double_t integral = 0.0; + Double_t total_integral = 1.0; + + //cout << "iBinMin = " << iBinMin << ",iBinMax = " << iBinMax << endl; + Int_t nBins = xBins*yBins*zBins; + + // define the function to be integrated numerically + RazorFunctionGenTail func; + double params[6]; + params[0] = BX; + params[1] = BY; + params[2] = BXX; + params[3] = BXY; + params[4] = BYY; + params[5] = ALPHA; + func.SetParameters(params); + ROOT::Math::IntegratorMultiDim ig(ROOT::Math::IntegrationMultiDim::kADAPTIVE); + ig.SetFunction(func); + + double a[2] = {0,0}; + double b[2] = {0,0}; + + if(code==1) { + for (Int_t iBin=iBinMin; iBin= nBins) { + integral += 0.0; + } + else{ + if (zCut >= zLow and zCut < zHigh){ + Double_t xLow = xArray[xBin]; + Double_t xHigh = xArray[xBin+1]; + Double_t yLow = yArray[yBin]; + Double_t yHigh = yArray[yBin+1]; + + + if(xHigh <= xCut && yHigh <= yCut) { + integral += 0.0; + } + else if(xLow < xCut && xHigh > xCut && yHigh <= yCut) { + a[0] = xCut; a[1] = yLow; + b[0] = xHigh; b[1] = yHigh; + integral += ig.Integral(a,b); + } + else if(yLow < yCut && yHigh > yCut && xHigh <= xCut) { + a[0] = xLow; a[1] = yCut; + b[0] = xHigh; b[1] = yHigh; + integral += ig.Integral(a,b); + } + else if(xLow < xCut && xHigh > xCut && yLow < yCut && yHigh > yCut) { + a[0] = xLow; a[1] = yLow; + b[0] = xHigh; b[1] = yHigh; + integral += ig.Integral(a,b); + a[0] = xLow; a[1] = yLow; + b[0] = xCut; b[1] = yCut; + integral -= ig.Integral(a,b); + } + else { + a[0] = xLow; a[1] = yLow; + b[0] = xHigh; b[1] = yHigh; + integral += ig.Integral(a,b); + } + } + } + } + } else { + cout << "WARNING IN RooRazorGenTailBin: integration code is not correct" << endl; + cout << " what are you integrating on?" << endl; + return 1.0; + } + + if (total_integral>0.0) { + std::cout << integral << std::endl; + return integral; + } else return 1.0; +} +// //--------------------------------------------------------------------------- + diff --git a/python/src/RooRazorGenTailBin.h b/python/src/RooRazorGenTailBin.h new file mode 100644 index 00000000..cee00043 --- /dev/null +++ b/python/src/RooRazorGenTailBin.h @@ -0,0 +1,125 @@ +//--------------------------------------------------------------------------- +#ifndef ROO_RazorGenTailBin +#define ROO_RazorGenTailBin +//--------------------------------------------------------------------------- +#include "RooAbsPdf.h" +#include "RooConstVar.h" +#include "RooRealProxy.h" +//--------------------------------------------------------------------------- +class RooRealVar; +class RooAbsReal; + +#include "Riostream.h" +#include "TMath.h" +#include +#include "Math/SpecFuncMathCore.h" +#include "Math/SpecFuncMathMore.h" +#include "Math/Functor.h" +#include "Math/WrappedFunction.h" +#include "Math/IFunction.h" +#include "Math/Integrator.h" +#include "Math/IntegratorMultiDim.h" + +//--------------------------------------------------------------------------- +class RooRazorGenTailBin : public RooAbsPdf +{ +public: + RooRazorGenTailBin() {} ; + RooRazorGenTailBin(const char *name, const char *title, + RooAbsReal& _th1x, + RooAbsReal& _x0, RooAbsReal& _y0, + RooAbsReal& _b, RooAbsReal& _n, + RooAbsReal& _y1, RooAbsReal& _y2, + RooAbsReal& _xCut, RooAbsReal& _yCut, RooAbsReal& _zCut); + //TH3* _Hnominal); + RooRazorGenTailBin(const RooRazorGenTailBin& other, + const char* name = 0); + void setTH3Binning(TH3* _Hnominal); + void setAbsTol(double _absTol); + void setRelTol(double _relTol); + virtual TObject* clone(const char* newname) const { return new RooRazorGenTailBin(*this,newname); } + inline virtual ~RooRazorGenTailBin() { } + + Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=0) const; + Double_t analyticalIntegral(Int_t code, const char* rangeName=0) const; + +protected: + + RooRealProxy th1x; // dependent variable + RooRealProxy BX; // X offset + RooRealProxy BY; // Y offset + RooRealProxy BXX; // shape parameter + RooRealProxy BXY; // shape parameter + RooRealProxy BYY; // shape parameter + RooRealProxy ALPHA; // shape parameter + RooRealProxy xCut; // X cut constant (set pdf to 0 for X < Xcut && Y < Ycut) + RooRealProxy yCut; // Y cut constant (set pdf to 0 for X < Xcut && Y < Ycut) + RooRealProxy zCut; // Z cut constant (set pdf to 0 unless Zut <= Z < Zcut) + Int_t xBins; // X bins + Int_t yBins; // Y bins + Int_t zBins; // Z bins + Double_t xArray[20]; // xArray[xBins+1] + Double_t yArray[20]; // yArray[yBins+1] + Double_t zArray[5]; // zArray[zBins+1] + Double_t xMax; // X max + Double_t yMax; // Y max + Double_t zMax; // Z max + Double_t xMin; // X min + Double_t yMin; // Y min + Double_t zMin; // Z min + Double_t relTol; //relative tolerance for numerical integration + Double_t absTol; //absolute tolerance for numerical integration + + Double_t evaluate() const; +private: + ClassDef(RooRazorGenTailBin,1) // RooRazorGenTailBin function + +}; +//--------------------------------------------------------------------------- +#endif + +#include "Math/IFunction.h" +#include "Math/IParamFunction.h" + +class RazorFunctionGenTail: public ROOT::Math::IParametricFunctionMultiDim +{ +private: + const double *pars; + +public: + double DoEvalPar(const double* x,const double* p) const + { + double myexp = pow(p[0]*x[0]/1.E+3 + p[1]*x[1] + p[2]*x[0]*x[0]/1.E+6 + p[3]*x[0]*x[1]/1.E+3 + p[4]*x[1]*x[1], p[5]); + return exp(-myexp); + } + + double DoEval(const double* x) const + { + double myexp = pow(pars[0]*x[0]/1.E+3 + pars[1]*x[1] + pars[2]*x[0]*x[0]/1.E+6 + pars[3]*x[0]*x[1]/1.E+3 + pars[4]*x[1]*x[1], pars[5]); + return exp(-myexp); + } + + unsigned int NDim() const{ + return 2; + } + + ROOT::Math::IParametricFunctionMultiDim* Clone() const + { + return new RazorFunctionGenTail(); + } + + const double* Parameters() const + { + return pars; + } + + void SetParameters(const double* p) + { + pars = p; + } + + unsigned int NPar() const + { + return 6; + } +};