138 RooAbsArg(
name,title), _plotMin(0), _plotMax(0), _plotBins(100),
139 _value(0), _unit(unit), _forceNumInt(
kFALSE), _specIntegratorConfig(0), _selectComp(
kTRUE), _lastNSet(0)
153 RooAbsArg(
name,title), _plotMin(inMinVal), _plotMax(inMaxVal), _plotBins(100),
154 _value(0), _unit(unit), _forceNumInt(
kFALSE), _specIntegratorConfig(0), _selectComp(
kTRUE), _lastNSet(0)
167 _plotBins(other._plotBins), _value(other._value), _unit(other._unit), _label(other._label),
168 _forceNumInt(other._forceNumInt), _selectComp(other._selectComp), _lastNSet(0)
173 _specIntegratorConfig = 0 ;
219 return (
getVal()==value) ;
239 if (!assumeSameType) {
255 if(appendUnit && 0 != strlen(
getUnit())) {
312 maxSize = ret.size();
352 <<
"): validation failed: " << value << endl ;
372 const RooArgSet* ,
const char* rangeName)
const
403 if (code==0)
return getVal(normSet) ;
417 coutF(
Eval) <<
"RooAbsReal::analyticalIntegral(" <<
GetName() <<
") code " << code <<
" not implemented" << endl ;
478 os <<
indent <<
"--- RooAbsReal ---" << endl;
568 pc.defineString(
"rangeName",
"RangeWithName",0,
"",
kTRUE) ;
569 pc.defineObject(
"normSet",
"NormSet",0,0) ;
570 pc.defineObject(
"numIntConfig",
"NumIntConfig",0,0) ;
573 pc.process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
579 const char* rangeName =
pc.getString(
"rangeName",0,
kTRUE) ;
604 if (!rangeName || strchr(rangeName,
',')==0) {
614 for (
const std::string& token : tokens) {
616 components.
add(*compIntegral);
620 title.
Prepend(
"Integral of ") ;
648 title.
Prepend(
"Integral of ") ;
673 title.
Prepend(
"Integral of ") ;
682 if (integrand !=
this) {
690 if (integrand ==
this && iset.
getSize()>0) {
691 coutI(
Integration) <<
GetName() <<
" : multidimensional integration over observables with parameterized ranges in terms of other integrated observables detected, using recursive integration strategy to construct final integral" << endl ;
695 integrand = integral ;
703 coutE(
Integration) <<
GetName() <<
" : ERROR while defining recursive integral over observables with parameterized integration ranges, please check that integration rangs specify uniquely defined integral " << endl;
712 if (cacheParamsStr && strlen(cacheParamsStr)) {
720 if (cacheParams->
getSize()>0) {
722 <<
"-dim value cache for integral over " << iset2 <<
" as a function of " << *cacheParams <<
" in range " << (rangeName?rangeName:
"<none>") << endl ;
732 integral = cachedIntegral ;
763 for (
const auto aarg : allObs) {
776 obsWithParamRange.
add(*aarg) ;
777 obsWithFixedRange.
remove(*aarg) ;
778 obsServingAsRangeParams.
add(*loBoundObs,
kFALSE) ;
779 obsServingAsRangeParams.
add(*hiBoundObs,
kFALSE) ;
788 RooArgSet obsWithFixedRangeNP(obsWithFixedRange) ;
789 obsWithFixedRangeNP.
remove(obsServingAsRangeParams) ;
792 RooArgSet obsWithParamRangeNP(obsWithParamRange) ;
793 obsWithParamRangeNP.
remove(obsServingAsRangeParams) ;
797 innerObs.
add(obsWithFixedRangeNP) ;
798 innerObs.
add(obsWithParamRangeNP) ;
815 name.Append(
"_Int[") ;
830 name.Append(rangeName) ;
833 }
else if (!omitEmpty) {
834 name.Append(
"_Int[]") ;
837 if (nset && nset->
getSize()>0 ) {
842 name.Append(
"_Norm[") ;
929 for (
const auto arg : dependentVars) {
930 if(!arg->isFundamental() && !
dynamic_cast<const RooAbsLValue*
>(arg)) {
932 <<
"\" of wrong type: " << arg->ClassName() << endl;
939 <<
"\" is not a dependent and will be ignored." << endl;
944 leafNodes.
replace(*found,*arg);
946 leafNodes.
add(*arg) ;
949 RooArgSet* lvDep = arg->getObservables(&leafNodes) ;
950 for (
const auto lvs : *lvDep) {
954 leafNodes.
add(*lvs) ;
961 if(0 != projectedVars && projectedVars->
find(arg->GetName())) {
963 <<
"\" cannot be both a dependent and a projected variable." << endl;
969 if(0 != projectedVars) leafNodes.
remove(*projectedVars,
kTRUE);
974 coutE(
Plotting) <<
"RooAbsPdf::createPlotProjection(" <<
GetName() <<
") Couldn't deep-clone PDF, abort," << endl ;
987 delete plotLeafNodes ;
991 if(0 != projectedVars) normSet.
add(*projectedVars);
1000 if(0 == projectedVars) projectedVars= ∅
1006 title.
Prepend(
"Projection of ");
1011 if(0 == projected || !projected->
isValid()) {
1015 if(0 != projected)
delete projected;
1020 static_cast<RooRealIntegral*
>(projected)->setAllowComponentSelection(
true);
1063 if(hdim != plotVars.
getSize()) {
1072 for(
Int_t index= 0; index < plotVars.
getSize(); index++) {
1077 <<
"\" of type " << var->
ClassName() << endl;
1082 <<
":fillHistogram: WARNING: variable is not an explicit dependent: " << realVar->
GetName() << endl;
1098 if (projectedVars) {
1099 allDeps.
add(*projectedVars) ;
1113 Int_t xbins(0),ybins(1),zbins(1);
1125 assert(0 != zvar && 0 != zaxis);
1126 if (scaleForDensity) {
1134 assert(0 != yvar && 0 != yaxis);
1135 if (scaleForDensity) {
1143 assert(0 != xvar && 0 != xaxis);
1144 if (scaleForDensity) {
1150 << hdim <<
" dimensions" << endl;
1157 Int_t xbin(0),ybin(0),zbin(0);
1158 Int_t bins= xbins*ybins*zbins;
1159 for(
Int_t bin= 0; bin < bins; bin++) {
1162 if(bin % (xbins*ybins) == 0) {
1168 if(bin % xbins == 0) {
1169 ybin= (ybin%ybins) + 1;
1174 xbin= (xbin%xbins) + 1;
1184 coutW(
Plotting) <<
"WARNING: Function evaluation error(s) at coordinates [x]=" << xvar->
getVal() ;
1257 if (showProgress && (i%onePct==0)) {
1261 Double_t binVal = theClone->
getVal(normSet?normSet:obs)*scaleFactor ;
1262 if (correctForBinSize) {
1294 strlcpy(buf,varNameList,1024) ;
1295 char* varName = strtok(buf,
",:") ;
1300 varName = strtok(0,
",") ;
1302 varName = strtok(0,
",") ;
1394 pc.defineInt(
"scaling",
"Scaling",0,1) ;
1395 pc.defineInt(
"intBinning",
"IntrinsicBinning",0,2) ;
1396 pc.defineInt(
"extended",
"Extended",0,2) ;
1398 pc.defineObject(
"compSet",
"SelectCompSet",0) ;
1399 pc.defineString(
"compSpec",
"SelectCompSpec",0) ;
1400 pc.defineSet(
"projObs",
"ProjectedObservables",0,0) ;
1401 pc.defineObject(
"yvar",
"YVar",0,0) ;
1402 pc.defineObject(
"zvar",
"ZVar",0,0) ;
1403 pc.defineMutex(
"SelectCompSet",
"SelectCompSpec") ;
1404 pc.defineMutex(
"IntrinsicBinning",
"Binning") ;
1405 pc.defineMutex(
"IntrinsicBinning",
"BinningName") ;
1406 pc.defineMutex(
"IntrinsicBinning",
"BinningSpec") ;
1407 pc.allowUndefined() ;
1410 pc.process(argList) ;
1428 Bool_t doScaling =
pc.getInt(
"scaling") ;
1429 Int_t doIntBinning =
pc.getInt(
"intBinning") ;
1430 Int_t doExtended =
pc.getInt(
"extended") ;
1434 if (!pdfSelf && doExtended>0) {
1435 coutW(
InputArguments) <<
"RooAbsReal::createHistogram(" <<
GetName() <<
") WARNING extended mode requested for a non-pdf object, ignored" << endl ;
1439 coutW(
InputArguments) <<
"RooAbsReal::createHistogram(" <<
GetName() <<
") WARNING extended mode requested for a non-extendable pdf, ignored" << endl ;
1442 if (pdfSelf && doExtended==2) {
1446 const char* compSpec =
pc.getString(
"compSpec") ;
1448 Bool_t haveCompSel = ( (compSpec && strlen(compSpec)>0) || compSet) ;
1451 if (doIntBinning>0) {
1456 if (doIntBinning==1) {
1458 <<
") WARNING, intrinsic model binning requested for histogram, but model does not define bin boundaries, reverting to default binning"<< endl ;
1461 if (doIntBinning==2) {
1463 <<
") INFO: Model has intrinsic binning definition, selecting that binning for the histogram"<< endl ;
1466 for (list<double>::iterator it=bl->begin() ; it!=bl->end() ; ++it) { ba[i++] = *it ; }
1467 intBinning =
new RooBinning(bl->size()-1,ba) ;
1473 pc.stripCmdList(argListCreate,
"Scaling,ProjectedObservables,IntrinsicBinning,SelectCompSet,SelectCompSpec,Extended") ;
1478 argListCreate.
Add(&tmp) ;
1497 branchNodeSet.
remove(*arg) ;
1508 if (dirSelNodes->
getSize()>0) {
1509 coutI(
Plotting) <<
"RooAbsPdf::createHistogram(" <<
GetName() <<
") directly selected PDF components: " << *dirSelNodes << endl ;
1515 coutE(
Plotting) <<
"RooAbsPdf::createHistogram(" <<
GetName() <<
") ERROR: component selection set " << *compSet <<
" does not match any components of p.d.f." << endl ;
1517 coutE(
Plotting) <<
"RooAbsPdf::createHistogram(" <<
GetName() <<
") ERROR: component selection expression '" << compSpec <<
"' does not select any components of p.d.f." << endl ;
1521 delete dirSelNodes ;
1557 for (
unsigned int i = 0; i < branchNodeSet.
size(); ++i) {
1558 const auto arg = branchNodeSet[i];
1560 branchNodeSet.
remove(*arg) ;
1567 for (
const auto arg : branchNodeSet) {
1576 for (
const auto arg : branchNodeSet) {
1577 for (
const auto selNode : *selNodes) {
1578 if (selNode->dependsOn(*arg)) {
1585 for (
const auto arg : branchNodeSet) {
1586 if (arg->dependsOn(*selNodes)) {
1591 tmp.
remove(*selNodes,
true);
1594 coutI(
Plotting) <<
"RooAbsPdf::plotOn(" <<
GetName() <<
") indirectly selected PDF components: " << tmp << endl ;
1597 for (
const auto arg : branchNodeSet) {
1598 Bool_t select = selNodes->
find(arg->GetName()) !=
nullptr;
1743 argList.
Add(&rnorm) ;
1745 std::vector<string> rlist;
1749 rlist.emplace_back(rangeNameToken);
1752 for (
const auto& rangeString : rlist) {
1754 rcmd->
setString(0, rangeString.c_str());
1763 pc.defineString(
"drawOption",
"DrawOption",0,
"L") ;
1764 pc.defineString(
"projectionRangeName",
"ProjectionRange",0,
"",
kTRUE) ;
1765 pc.defineString(
"curveNameSuffix",
"CurveNameSuffix",0,
"") ;
1766 pc.defineString(
"sliceCatState",
"SliceCat",0,
"",
kTRUE) ;
1767 pc.defineDouble(
"scaleFactor",
"Normalization",0,1.0) ;
1768 pc.defineInt(
"scaleType",
"Normalization",0,
Relative) ;
1769 pc.defineObject(
"sliceSet",
"SliceVars",0) ;
1770 pc.defineObject(
"sliceCatList",
"SliceCat",0,0,
kTRUE) ;
1771 pc.defineObject(
"projSet",
"Project",0) ;
1772 pc.defineObject(
"asymCat",
"Asymmetry",0) ;
1773 pc.defineDouble(
"precision",
"Precision",0,1
e-3) ;
1774 pc.defineDouble(
"evalErrorVal",
"EvalErrorValue",0,0) ;
1775 pc.defineInt(
"doEvalError",
"EvalErrorValue",0,0) ;
1776 pc.defineInt(
"shiftToZero",
"ShiftToZero",0,0) ;
1777 pc.defineObject(
"projDataSet",
"ProjData",0) ;
1778 pc.defineObject(
"projData",
"ProjData",1) ;
1779 pc.defineObject(
"errorFR",
"VisualizeError",0) ;
1780 pc.defineDouble(
"errorZ",
"VisualizeError",0,1.) ;
1781 pc.defineSet(
"errorPars",
"VisualizeError",0) ;
1782 pc.defineInt(
"linearMethod",
"VisualizeError",0,0) ;
1783 pc.defineInt(
"binProjData",
"ProjData",0,0) ;
1784 pc.defineDouble(
"rangeLo",
"Range",0,-999.) ;
1785 pc.defineDouble(
"rangeHi",
"Range",1,-999.) ;
1786 pc.defineInt(
"numee",
"PrintEvalErrors",0,10) ;
1787 pc.defineInt(
"rangeAdjustNorm",
"Range",0,0) ;
1788 pc.defineInt(
"rangeWNAdjustNorm",
"RangeWithName",0,0) ;
1789 pc.defineInt(
"VLines",
"VLines",0,2) ;
1790 pc.defineString(
"rangeName",
"RangeWithName",0,
"") ;
1791 pc.defineString(
"normRangeName",
"NormRange",0,
"") ;
1792 pc.defineInt(
"markerColor",
"MarkerColor",0,-999) ;
1793 pc.defineInt(
"markerStyle",
"MarkerStyle",0,-999) ;
1794 pc.defineDouble(
"markerSize",
"MarkerSize",0,-999) ;
1795 pc.defineInt(
"lineColor",
"LineColor",0,-999) ;
1796 pc.defineInt(
"lineStyle",
"LineStyle",0,-999) ;
1797 pc.defineInt(
"lineWidth",
"LineWidth",0,-999) ;
1798 pc.defineInt(
"fillColor",
"FillColor",0,-999) ;
1799 pc.defineInt(
"fillStyle",
"FillStyle",0,-999) ;
1800 pc.defineString(
"curveName",
"Name",0,
"") ;
1801 pc.defineInt(
"curveInvisible",
"Invisible",0,0) ;
1802 pc.defineInt(
"showProg",
"ShowProgress",0,0) ;
1803 pc.defineInt(
"numCPU",
"NumCPU",0,1) ;
1804 pc.defineInt(
"interleave",
"NumCPU",1,0) ;
1805 pc.defineString(
"addToCurveName",
"AddTo",0,
"") ;
1806 pc.defineDouble(
"addToWgtSelf",
"AddTo",0,1.) ;
1807 pc.defineDouble(
"addToWgtOther",
"AddTo",1,1.) ;
1808 pc.defineInt(
"moveToBack",
"MoveToBack",0,0) ;
1809 pc.defineMutex(
"SliceVars",
"Project") ;
1810 pc.defineMutex(
"AddTo",
"Asymmetry") ;
1811 pc.defineMutex(
"Range",
"RangeWithName") ;
1812 pc.defineMutex(
"VisualizeError",
"VisualizeErrorData") ;
1815 pc.process(argList) ;
1821 TString drawOpt(
pc.getString(
"drawOption"));
1826 Bool_t linMethod =
pc.getInt(
"linearMethod") ;
1827 if (!drawOpt.
Contains(
"P") && errFR) {
1834 o.
numee =
pc.getInt(
"numee") ;
1844 o.
eeval =
pc.getDouble(
"evalErrorVal") ;
1854 const char* sliceCatState =
pc.getString(
"sliceCatState",0,
kTRUE) ;
1855 const RooLinkedList& sliceCatList =
pc.getObjectList(
"sliceCatList") ;
1856 if (sliceCatState) {
1865 strlcpy(buf,sliceCatState,1024) ;
1866 const char* slabel = strtok(buf,
",") ;
1878 slabel = strtok(0,
",") ;
1885 Int_t vlines =
pc.getInt(
"VLines");
1886 if (
pc.hasProcessed(
"Range")) {
1890 if (vlines==2) vlines=0 ;
1891 }
else if (
pc.hasProcessed(
"RangeWithName")) {
1896 if (vlines==2) vlines=0 ;
1901 if (
pc.hasProcessed(
"NormRange")) {
1922 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: have slice " << *sliceSet << endl ;
1932 projectedVars.
remove(*arg) ;
1935 << sliceArg->
GetName() <<
" was not projected anyway" << endl ;
1939 }
else if (projSet) {
1940 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: have projSet " << *projSet << endl ;
1943 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: have neither sliceSet nor projSet " << endl ;
1948 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: projectedVars = " << projectedVars << endl ;
1963 Int_t lineColor =
pc.getInt(
"lineColor") ;
1964 Int_t lineStyle =
pc.getInt(
"lineStyle") ;
1965 Int_t lineWidth =
pc.getInt(
"lineWidth") ;
1966 Int_t markerColor =
pc.getInt(
"markerColor") ;
1967 Int_t markerStyle =
pc.getInt(
"markerStyle") ;
1968 Size_t markerSize =
pc.getDouble(
"markerSize") ;
1969 Int_t fillColor =
pc.getInt(
"fillColor") ;
1970 Int_t fillStyle =
pc.getInt(
"fillStyle") ;
1980 if ((fillColor != -999 || fillStyle != -999) && !drawOpt.
Contains(
"F")) {
1982 <<
"\", but these only have an effect when 'DrawOption(\"F\")' for fill is used at the same time." << std::endl;
1986 if (
pc.getInt(
"moveToBack") && frame->
numItems()>1) {
2025 projDataVars.
add(*tmp) ;
2048 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") frame->getNormVars() that are also observables = " << *sliceSetTmp << endl ;
2061 << frame->
getPlotVar()->
GetName() <<
" represents a slice in " << *sliceSetTmp << endl ;
2063 sliceSet.
add(*sliceSetTmp) ;
2064 delete sliceSetTmp ;
2070 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") projectedVars = " << projectedVars <<
" sliceSet = " << sliceSet << endl ;
2083 if (!plotCloneSet) {
2084 coutE(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Couldn't deep-clone self, abort," << endl ;
2090 if (projectedVars.
getSize()) {
2092 <<
" integrates over variables " << projectedVars
2095 if (projDataNeededVars && projDataNeededVars->
getSize()>0) {
2097 <<
" averages using data variables " << *projDataNeededVars << endl ;
2105 if (projDataNeededVars) {
2109 deps->
add(*plotVar) ;
2115 coutE(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") error in checkObservables, abort" << endl ;
2117 delete plotCloneSet ;
2118 if (projDataNeededVars)
delete projDataNeededVars ;
2133 fullNormSet.
add(projectedVars) ;
2134 if (projDataNeededVars && projDataNeededVars->
getSize()>0) {
2135 fullNormSet.
add(*projDataNeededVars) ;
2151 if (o.
projData && projDataNeededVars && projDataNeededVars->
getSize()>0) {
2161 if (sliceDataSet->
getSize()>0) {
2182 delete sliceDataSet ;
2184 if (!cutString.
IsNull()) {
2186 coutI(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") reducing given projection dataset to entries with " << cutString << endl ;
2191 <<
") only the following components of the projection data will be used: " << *projDataNeededVars << endl ;
2207 coutI(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") unbinned projection dataset consist only of discrete variables,"
2208 <<
" performing projection with binned copy for optimization." << endl ;
2216 if (projDataSel!=o.
projData)
delete projDataSel ;
2223 projection->
getVal(projDataSel->
get()) ;
2281 if (projDataSel!=o.
projData)
delete projDataSel ;
2364 if (projDataNeededVars)
delete projDataNeededVars ;
2366 delete projectionCompList ;
2367 delete plotCloneSet ;
2389 projectedVars.
remove(*arg) ;
2392 << sliceArg->
GetName() <<
" was not projected anyway" << endl ;
2435 projDataVars.
add(*tmp) ;
2445 <<
") function doesn't depend on asymmetry category " << asymCat.
GetName() << endl ;
2452 <<
") asymmetry category must have 2 or 3 states with index values -1,0,1" << endl ;
2476 << frame->
getPlotVar()->
GetName() <<
" represents a slice in " << *sliceSetTmp << endl ;
2478 sliceSet.
add(*sliceSetTmp) ;
2479 delete sliceSetTmp ;
2503 if (projectedVars.
getSize()) {
2505 <<
" projects variables " << projectedVars << endl ;
2507 if (projDataNeededVars && projDataNeededVars->
getSize()>0) {
2509 <<
" averages using data variables "<< *projDataNeededVars << endl ;
2528 RooArgSet *posProjCompList, *negProjCompList ;
2534 depPos.
add(projDataVars) ;
2535 depNeg.
add(projDataVars) ;
2539 if (!posProj || !negProj) {
2540 coutE(
Plotting) <<
"RooAbsReal::plotAsymOn(" <<
GetName() <<
") Unable to create projections, abort" << endl ;
2546 asymName.
Append(
"_Asym[") ;
2550 asymTitle.
Append(
" Asymmetry of ") ;
2563 if (sliceDataSet->
getSize()>0) {
2584 delete sliceDataSet ;
2586 if (!cutString.
IsNull()) {
2589 <<
") reducing given projection dataset to entries with " << cutString << endl ;
2594 <<
") only the following components of the projection data will be used: " << *projDataNeededVars << endl ;
2604 ((
RooAbsReal*)posProj)->attachDataSet(*projDataSel) ;
2605 ((
RooAbsReal*)negProj)->attachDataSet(*projDataSel) ;
2639 if (projDataSel!=o.
projData)
delete projDataSel ;
2678 delete posProjCompList ;
2679 delete negProjCompList ;
2711 fpf_stripped.
add(*frv);
2725 vector<int> fpf_idx;
2729 paramList.
add(*par);
2730 fpf_idx.push_back(i);
2734 vector<Double_t> plusVar, minusVar ;
2741 for (
Int_t ivar=0 ; ivar<paramList.
getSize() ; ivar++) {
2749 ((
RooRealVar*)paramList.
at(ivar))->setVal(cenVal+errVal) ;
2750 plusVar.push_back(cloneFunc->
getVal(nset)) ;
2753 ((
RooRealVar*)paramList.
at(ivar))->setVal(cenVal-errVal) ;
2754 minusVar.push_back(cloneFunc->
getVal(nset)) ;
2760 vector<double> errVec(paramList.
getSize()) ;
2761 for (
int i=0 ; i<paramList.
getSize() ; i++) {
2762 errVec[i] =
sqrt(V(i,i)) ;
2763 for (
int j=i ; j<paramList.
getSize() ; j++) {
2764 C(i,j) = V(i,j)/
sqrt(V(i,i)*V(j,j)) ;
2771 for (
unsigned int j=0 ; j<plusVar.size() ; j++) {
2772 F[j] = (plusVar[j]-minusVar[j])/2 ;
2779 delete errorParams ;
2831 pc.stripCmdList(plotArgListTmp,
"VisualizeError,MoveToBack") ;
2838 if (std::string(
"Normalization")==cmd->
GetName()) {
2841 plotArgList.
Add(cmd) ;
2844 plotArgList.
Add(cmd) ;
2875 coutI(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") INFO: visualizing " << Z <<
"-sigma uncertainties in parameters "
2876 << *errorParams <<
" from fit result " << fr.
GetName() <<
" using " <<
n <<
" samplings." << endl ;
2882 vector<RooCurve*> cvec ;
2883 for (
int i=0 ; i<
d->numEntries() ; i++) {
2884 *cloneParams = (*
d->get(i)) ;
2886 cloneFunc->
plotOn(frame,tmp2) ;
2887 cvec.push_back(frame->
getCurve()) ;
2900 for (vector<RooCurve*>::iterator i=cvec.begin() ; i!=cvec.end() ; ++i) {
2922 fpf_stripped.
add(*frv);
2935 vector<int> fpf_idx ;
2939 paramList.add(*par) ;
2940 fpf_idx.push_back(i) ;
2944 vector<RooCurve*> plusVar, minusVar ;
2953 for (
Int_t ivar=0 ; ivar<paramList.getSize() ; ivar++) {
2961 ((
RooRealVar*)paramList.at(ivar))->setVal(cenVal+Z*errVal) ;
2965 cloneFunc->
plotOn(frame,tmp2) ;
2966 plusVar.push_back(frame->
getCurve()) ;
2971 ((
RooRealVar*)paramList.at(ivar))->setVal(cenVal-Z*errVal) ;
2973 cloneFunc->
plotOn(frame,tmp3) ;
2974 minusVar.push_back(frame->
getCurve()) ;
2977 ((
RooRealVar*)paramList.at(ivar))->setVal(cenVal) ;
2981 vector<double> errVec(paramList.getSize()) ;
2982 for (
int i=0 ; i<paramList.getSize() ; i++) {
2983 errVec[i] =
sqrt(V(i,i)) ;
2984 for (
int j=i ; j<paramList.getSize() ; j++) {
2985 C(i,j) = V(i,j)/
sqrt(V(i,i)*V(j,j)) ;
2995 for (vector<RooCurve*>::iterator i=plusVar.begin() ; i!=plusVar.end() ; ++i) {
2998 for (vector<RooCurve*>::iterator i=minusVar.begin() ; i!=minusVar.end() ; ++i) {
3005 if (!band)
return frame ;
3008 pc.defineString(
"drawOption",
"DrawOption",0,
"F") ;
3009 pc.defineString(
"curveNameSuffix",
"CurveNameSuffix",0,
"") ;
3010 pc.defineInt(
"lineColor",
"LineColor",0,-999) ;
3011 pc.defineInt(
"lineStyle",
"LineStyle",0,-999) ;
3012 pc.defineInt(
"lineWidth",
"LineWidth",0,-999) ;
3013 pc.defineInt(
"markerColor",
"MarkerColor",0,-999) ;
3014 pc.defineInt(
"markerStyle",
"MarkerStyle",0,-999) ;
3015 pc.defineDouble(
"markerSize",
"MarkerSize",0,-999) ;
3016 pc.defineInt(
"fillColor",
"FillColor",0,-999) ;
3017 pc.defineInt(
"fillStyle",
"FillStyle",0,-999) ;
3018 pc.defineString(
"curveName",
"Name",0,
"") ;
3019 pc.defineInt(
"curveInvisible",
"Invisible",0,0) ;
3020 pc.defineInt(
"moveToBack",
"MoveToBack",0,0) ;
3021 pc.allowUndefined() ;
3024 pc.process(argList) ;
3030 frame->
addPlotable(band,
pc.getString(
"drawOption"),
pc.getInt(
"curveInvisible")) ;
3033 Int_t lineColor =
pc.getInt(
"lineColor") ;
3034 Int_t lineStyle =
pc.getInt(
"lineStyle") ;
3035 Int_t lineWidth =
pc.getInt(
"lineWidth") ;
3036 Int_t markerColor =
pc.getInt(
"markerColor") ;
3037 Int_t markerStyle =
pc.getInt(
"markerStyle") ;
3038 Size_t markerSize =
pc.getDouble(
"markerSize") ;
3039 Int_t fillColor =
pc.getInt(
"fillColor") ;
3040 Int_t fillStyle =
pc.getInt(
"fillStyle") ;
3051 if (
pc.getString(
"curveName",0,
kTRUE)) {
3053 }
else if (
pc.getString(
"curveNameSuffix",0,
kTRUE)) {
3055 name.Append(
pc.getString(
"curveNameSuffix",0,
kTRUE)) ;
3060 if (
pc.getInt(
"moveToBack") && frame->
numItems()>1) {
3086 <<
":plotOn: frame does not specify a plot variable" << endl;
3121 <<
" allVars = " << (allVars?(*allVars):
RooArgSet()) << endl ;
3124 if (!allVars) return ;
3127 projectedVars.
add(*allVars) ;
3132 projectedVars.
remove(*found);
3142 <<
" from projection set because it a server of " << plotVar->
GetName() << endl ;
3143 projectedVars.
remove(*tmp) ;
3147 delete plotServers ;
3151 <<
") WARNING: cannot project out frame variable ("
3152 << found->
GetName() <<
"), ignoring" << endl ;
3164 <<
") function doesn't depend on projection variable "
3165 << arg->
GetName() <<
", ignoring" << endl ;
3204 if(binding && !binding->
isValid()) {
3214struct TreeReadBuffer {
3215 virtual ~TreeReadBuffer() =
default;
3216 virtual operator double() = 0;
3227 auto other =
static_cast<const RooAbsReal*
>(source);
3228 assert(
dynamic_cast<const RooAbsReal*
>(source));
3230 _value = other->_treeReadBuffer ? other->_treeReadBuffer->operator
double() : other->_value;
3253struct TypedTreeReadBuffer final :
public TreeReadBuffer {
3254 operator double()
override {
3265std::unique_ptr<TreeReadBuffer> createTreeReadBuffer(
const TString& branchName,
TTree&
tree) {
3266 auto buf =
new TypedTreeReadBuffer<T>();
3267 tree.SetBranchAddress(branchName.
Data(), &buf->_value);
3268 return std::unique_ptr<TreeReadBuffer>(buf);
3299 <<
" is an array and cannot be attached to a RooAbsReal" << endl ;
3309 std::map<std::string, std::pair<std::string, std::function<std::unique_ptr<TreeReadBuffer>()>>> typeMap {
3310 {
"Float_t", {
"FLOAT_TREE_BRANCH", [&](){
return createTreeReadBuffer<Float_t >(cleanName, t); }}},
3311 {
"Int_t", {
"INTEGER_TREE_BRANCH", [&](){
return createTreeReadBuffer<Int_t >(cleanName, t); }}},
3312 {
"UChar_t", {
"BYTE_TREE_BRANCH", [&](){
return createTreeReadBuffer<UChar_t >(cleanName, t); }}},
3313 {
"Bool_t", {
"BOOL_TREE_BRANCH", [&](){
return createTreeReadBuffer<Bool_t >(cleanName, t); }}},
3314 {
"Char_t", {
"SIGNEDBYTE_TREE_BRANCH", [&](){
return createTreeReadBuffer<Char_t >(cleanName, t); }}},
3315 {
"UInt_t", {
"UNSIGNED_INTEGER_TREE_BRANCH", [&](){
return createTreeReadBuffer<UInt_t >(cleanName, t); }}},
3316 {
"Long64_t", {
"LONG_TREE_BRANCH", [&](){
return createTreeReadBuffer<Long64_t >(cleanName, t); }}},
3317 {
"ULong64_t", {
"UNSIGNED_LONG_TREE_BRANCH", [&](){
return createTreeReadBuffer<ULong64_t>(cleanName, t); }}},
3318 {
"Short_t", {
"SHORT_TREE_BRANCH", [&](){
return createTreeReadBuffer<Short_t >(cleanName, t); }}},
3319 {
"UShort_t", {
"UNSIGNED_SHORT_TREE_BRANCH", [&](){
return createTreeReadBuffer<UShort_t >(cleanName, t); }}},
3322 auto typeDetails = typeMap.find(typeName.
Data());
3323 if (typeDetails != typeMap.end()) {
3325 <<
" will be converted to double precision." << endl ;
3335 coutE(
InputArguments) <<
"RooAbsReal::attachToTree(" <<
GetName() <<
") data type " << typeName <<
" is not supported." << endl ;
3498 const TList &nameList)
const
3507 matched.
add(*found);
3521 if(isMatched) matchedArgs.
add(matched);
3570 if (config)
return config ;
3583 if (config)
return config ;
3685 if (inLogEvalError) {
3688 inLogEvalError =
kTRUE ;
3693 if (serverValueString) {
3698 oocoutE((
TObject*)0,
Eval) <<
"RooAbsReal::logEvalError(" <<
"<STATIC>" <<
") evaluation error, " << endl
3699 <<
" origin : " << origName << endl
3700 <<
" message : " << ee.
_msg << endl
3701 <<
" server values: " << ee.
_srvval << endl ;
3708 inLogEvalError =
kFALSE ;
3740 if (inLogEvalError) {
3743 inLogEvalError =
kTRUE ;
3748 if (serverValueString) {
3768 ostringstream oss2 ;
3772 coutE(
Eval) <<
"RooAbsReal::logEvalError(" <<
GetName() <<
") evaluation error, " << endl
3773 <<
" origin : " << oss2.str() << endl
3774 <<
" message : " << ee.
_msg << endl
3775 <<
" server values: " << ee.
_srvval << endl ;
3784 <<
") delayed evaluation error, " << endl
3785 <<
" origin : " << oss2.str() << endl
3786 <<
" message : " << oee.
_msg << endl
3787 <<
" server values: " << oee.
_srvval << endl ;
3794 inLogEvalError =
kFALSE ;
3830 if (maxPerNode<0) return ;
3832 map<const RooAbsArg*,pair<string,list<EvalError> > >::iterator iter =
_evalErrorList.begin() ;
3835 if (maxPerNode==0) {
3838 os << iter->second.first ;
3840 os <<
" has " << iter->second.second.size() <<
" errors" << endl ;
3845 os << iter->second.first << endl ;
3849 std::list<EvalError>::iterator iter2 = iter->second.second.begin() ;
3850 for(;iter2!=iter->second.second.end() ; ++iter2, i++) {
3851 os <<
" " << iter2->_msg <<
" @ " << iter2->_srvval << endl ;
3853 os <<
" ... (remaining " << iter->second.second.size() - maxPerNode <<
" messages suppressed)" << endl ;
3873 map<const RooAbsArg*,pair<string,list<EvalError> > >::iterator iter =
_evalErrorList.begin() ;
3875 ntot += iter->second.second.size() ;
3950 orderedObs.
add(obs) ;
4008 pc.defineObject(
"supNormSet",
"SupNormSet",0,0) ;
4009 pc.defineInt(
"numScanBins",
"ScanParameters",0,1000) ;
4010 pc.defineInt(
"intOrder",
"ScanParameters",1,2) ;
4011 pc.defineInt(
"doScanNum",
"ScanNum",0,1) ;
4012 pc.defineInt(
"doScanAll",
"ScanAll",0,0) ;
4013 pc.defineInt(
"doScanNon",
"ScanNone",0,0) ;
4014 pc.defineMutex(
"ScanNum",
"ScanAll",
"ScanNone") ;
4017 pc.process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
4028 Int_t numScanBins =
pc.getInt(
"numScanBins") ;
4029 Int_t intOrder =
pc.getInt(
"intOrder") ;
4030 Int_t doScanNum =
pc.getInt(
"doScanNum") ;
4031 Int_t doScanAll =
pc.getInt(
"doScanAll") ;
4032 Int_t doScanNon =
pc.getInt(
"doScanNon") ;
4047 coutI(
NumIntegration) <<
"RooAbsPdf::createRunningIntegral(" <<
GetName() <<
") integration over observable(s) " << iset <<
" involves numeric integration," << endl
4048 <<
" constructing cdf though numeric integration of sampled pdf in " << numScanBins <<
" bins and applying order "
4049 << intOrder <<
" interpolation on integrated histogram." << endl
4050 <<
" To override this choice of technique use argument ScanNone(), to change scan parameters use ScanParameters(nbins,order) argument" << endl ;
4068 ivar->
setBins(numScanBins,
"numcdf") ;
4112 cloneList.
add(*cloneArg) ;
4118 loList.
add(*cloneLo) ;
4151 coutE(
InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified observables are not variables of this p.d.f" << endl ;
4157 coutE(
InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified parameters are not variables of this p.d.f" << endl ;
4178 coutE(
InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified observables are not variables of this p.d.f" << endl ;
4184 coutE(
InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified parameters are not variables of this p.d.f" << endl ;
4192 for (
int i=0 ; i<obs.
getSize() ; i++) {
4198 for (
int i=0 ; i<pars.
getSize() ; i++) {
4232 <<
" observables specified, but a ROOT TFx can only have 1,2 or 3 observables" << endl ;
4237 for (
int i=0 ; i<pars.
getSize() ; i++) {
4267 return new RooDerivative(
name.c_str(),title.c_str(),*
this,obs,normSet,order,eps) ;
4282 string title=
Form(
"%sMoment of order %d of %s w.r.t %s ",(central?
"Central ":
""),order,
GetName(),obs.
GetName()) ;
4284 if (order==2)
return new RooSecondMoment(
name.c_str(),title.c_str(),*
this,obs,central,takeRoot) ;
4285 return new RooMoment(
name.c_str(),title.c_str(),*
this,obs,order,central,takeRoot) ;
4301 string title=
Form(
"%sMoment of order %d of %s w.r.t %s ",(central?
"Central ":
""),order,
GetName(),obs.
GetName()) ;
4303 if (order==1)
return new RooFirstMoment(
name.c_str(),title.c_str(),*
this,obs,normObs,intNormObs) ;
4304 if (order==2)
return new RooSecondMoment(
name.c_str(),title.c_str(),*
this,obs,normObs,central,takeRoot,intNormObs) ;
4305 return new RooMoment(
name.c_str(),title.c_str(),*
this,obs,normObs,order,central,takeRoot,intNormObs) ;
4405 RooLinkedList chi2CmdList =
pc.filterCmdList(fitCmdList,
"Range,RangeWithName,NumCPU,Optimize") ;
4438 return new RooChi2Var(
name.c_str(),
name.c_str(),*
this,data,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
4463 return createChi2(data,*cmds[0],*cmds[1],*cmds[2],*cmds[3],*cmds[4],*cmds[5],*cmds[6],*cmds[7]) ;
4529 RooLinkedList chi2CmdList =
pc.filterCmdList(fitCmdList,
"YVar,Integrate") ;
4578 pc.defineInt(
"integrate",
"Integrate",0,0) ;
4579 pc.defineObject(
"yvar",
"YVar",0,0) ;
4582 pc.process(cmdList) ;
4588 Bool_t integrate =
pc.getInt(
"integrate") ;
4613 pc.defineString(
"fitOpt",
"FitOptions",0,
"") ;
4615 pc.defineInt(
"optConst",
"Optimize",0,1) ;
4616 pc.defineInt(
"verbose",
"Verbose",0,0) ;
4617 pc.defineInt(
"doSave",
"Save",0,0) ;
4618 pc.defineInt(
"doTimer",
"Timer",0,0) ;
4619 pc.defineInt(
"plevel",
"PrintLevel",0,1) ;
4620 pc.defineInt(
"strat",
"Strategy",0,1) ;
4621 pc.defineInt(
"initHesse",
"InitialHesse",0,0) ;
4622 pc.defineInt(
"hesse",
"Hesse",0,1) ;
4623 pc.defineInt(
"minos",
"Minos",0,0) ;
4624 pc.defineInt(
"ext",
"Extended",0,2) ;
4625 pc.defineInt(
"numee",
"PrintEvalErrors",0,10) ;
4626 pc.defineInt(
"doWarn",
"Warnings",0,1) ;
4627 pc.defineString(
"mintype",
"Minimizer",0,
"Minuit") ;
4628 pc.defineString(
"minalg",
"Minimizer",1,
"minuit") ;
4629 pc.defineObject(
"minosSet",
"Minos",0,0) ;
4631 pc.defineMutex(
"FitOptions",
"Verbose") ;
4632 pc.defineMutex(
"FitOptions",
"Save") ;
4633 pc.defineMutex(
"FitOptions",
"Timer") ;
4634 pc.defineMutex(
"FitOptions",
"Strategy") ;
4635 pc.defineMutex(
"FitOptions",
"InitialHesse") ;
4636 pc.defineMutex(
"FitOptions",
"Hesse") ;
4637 pc.defineMutex(
"FitOptions",
"Minos") ;
4640 pc.process(cmdList) ;
4646 const char* fitOpt =
pc.getString(
"fitOpt",0,
kTRUE) ;
4647#ifdef __ROOFIT_NOROOMINIMIZER
4648 const char* minType =0 ;
4650 const char* minType =
pc.getString(
"mintype",
"Minuit") ;
4651 const char* minAlg =
pc.getString(
"minalg",
"minuit") ;
4653 Int_t optConst =
pc.getInt(
"optConst") ;
4655 Int_t doSave =
pc.getInt(
"doSave") ;
4656 Int_t doTimer =
pc.getInt(
"doTimer") ;
4657 Int_t plevel =
pc.getInt(
"plevel") ;
4658 Int_t strat =
pc.getInt(
"strat") ;
4659 Int_t initHesse=
pc.getInt(
"initHesse") ;
4660 Int_t hesse =
pc.getInt(
"hesse") ;
4661 Int_t minos =
pc.getInt(
"minos") ;
4662 Int_t numee =
pc.getInt(
"numee") ;
4663 Int_t doWarn =
pc.getInt(
"doWarn") ;
4668#ifdef __ROOFIT_NOROOMINIMIZER
4671 if (
"OldMinuit" ==
string(minType)) {
4680 m.setPrintEvalErrors(numee) ;
4682 m.setPrintLevel(plevel) ;
4687 m.optimizeConst(optConst);
4693 ret =
m.fit(fitOpt) ;
4708 m.setStrategy(strat) ;
4727 m.minos(*minosSet) ;
4736 string title =
Form(
"Result of fit of %s ",
GetName()) ;
4737 ret =
m.save(
name.c_str(),title.c_str()) ;
4742#ifndef __ROOFIT_NOROOMINIMIZER
4745 m.setMinimizerType(minType);
4751 m.setPrintEvalErrors(numee) ;
4753 m.setPrintLevel(plevel) ;
4758 m.optimizeConst(optConst);
4764 ret =
m.fit(fitOpt) ;