Skip to content

Commit

Permalink
Adding HZZ patch
Browse files Browse the repository at this point in the history
  • Loading branch information
adewit committed Oct 27, 2020
1 parent 3fbd601 commit dd923fc
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions src/VerticalInterpPdf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "RooRealConstant.h"
#include "RooRealIntegral.h"
#include "RooMsgService.h"
#include "RooProdPdf.h"



Expand Down Expand Up @@ -52,6 +53,10 @@ VerticalInterpPdf::VerticalInterpPdf(const char *name, const char *title, const
coutE(InputArguments) << "ERROR: VerticalInterpPdf::VerticalInterpPdf(" << GetName() << ") function " << func->GetName() << " is not of type RooAbsReal" << std::endl;
assert(0);
}
if (!dynamic_cast<RooProdPdf*>(func)) {
coutE(InputArguments) << "ERROR: with the HZZ hack in place, VerticalInterpPdf can only take RooProdPdf pdfs"<<std::endl;
assert(0);
}
_funcList.add(*func) ;
}
delete funcIter;
Expand Down Expand Up @@ -209,12 +214,28 @@ Int_t VerticalInterpPdf::getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet&
// Create new cache element
cache = new CacheElem ;

TIterator* analVarsIter = analVars.createIterator();
RooRealVar *zmass = (RooRealVar*)analVarsIter->Next();
RooRealVar *dbkg = (RooRealVar*)analVarsIter->Next();

// Make list of function projection and normalization integrals
_funcIter->Reset() ;
RooAbsReal *func ;
/*RooAbsReal *func ;
while((func=(RooAbsReal*)_funcIter->Next())) {
RooAbsReal* funcInt = func->createIntegral(analVars) ;
cache->_funcIntList.addOwned(*funcInt) ;
cache->_funcIntList.addOwned(*funcInt) ;*/
RooProdPdf *func;
while((func=(RooProdPdf*)_funcIter->Next())){
int i = 0;
std::auto_ptr<TIterator> iter(func->pdfList().createIterator());
for (RooAbsArg *a = (RooAbsArg *) iter->Next(); a!=0; a=(RooAbsArg*) iter->Next()){
i++;
RooAbsPdf *cterm = dynamic_cast<RooAbsPdf*>(a);
RooAbsReal* funcInt;
if(i==1) funcInt = cterm->createIntegral(*zmass);
else funcInt=cterm->createIntegral(*dbkg);
cache->_funcIntList.addOwned(*funcInt);
}
if (normSet && normSet->getSize()>0) {
RooAbsReal* funcNorm = func->createIntegral(*normSet) ;
cache->_funcNormList.addOwned(*funcNorm) ;
Expand Down Expand Up @@ -251,15 +272,18 @@ Double_t VerticalInterpPdf::analyticalIntegralWN(Int_t code, const RooArgSet* no

TIterator* funcIntIter = cache->_funcIntList.createIterator() ;
RooAbsReal *funcInt = (RooAbsReal *) funcIntIter->Next();
RooAbsReal *funcInt2d = (RooAbsReal *) funcIntIter->Next();
Double_t central = funcInt->getVal();
value += central;
value += central*funcInt2d->getVal();

_coefIter->Reset() ;
while((coef=(RooAbsReal*)_coefIter->Next())) {
Double_t coefVal = coef->getVal(normSet2) ;
RooAbsReal * funcIntUp = (RooAbsReal*)funcIntIter->Next() ;
/*RooAbsReal * funcIntUp2d =*/ (RooAbsReal*)funcIntIter->Next() ;
RooAbsReal * funcIntDn = (RooAbsReal*)funcIntIter->Next() ;
value += interpolate(coefVal, central, funcIntUp, funcIntDn);
/*RooAbsReal * funcIntUp2d =*/ (RooAbsReal*)funcIntIter->Next() ;
value += interpolate(coefVal, central, funcIntUp, funcIntDn)*funcInt2d->getVal();
}

delete funcIntIter ;
Expand Down

0 comments on commit dd923fc

Please sign in to comment.