144 RooAbsArg(
name,title), _plotMin(0), _plotMax(0), _plotBins(100),
145 _value(0), _unit(unit), _forceNumInt(
kFALSE), _specIntegratorConfig(0), _selectComp(
kTRUE), _lastNSet(0)
158 Double_t inMaxVal,
const char *unit) :
159 RooAbsArg(
name,title), _plotMin(inMinVal), _plotMax(inMaxVal), _plotBins(100),
160 _value(0), _unit(unit), _forceNumInt(
kFALSE), _specIntegratorConfig(0), _selectComp(
kTRUE), _lastNSet(0)
172 RooAbsArg(other,
name), _plotMin(other._plotMin), _plotMax(other._plotMax),
173 _plotBins(other._plotBins), _value(other._value), _unit(other._unit), _label(other._label),
174 _forceNumInt(other._forceNumInt), _selectComp(other._selectComp), _lastNSet(0)
225 return (
getVal()==value) ;
245 if (!assumeSameType) {
261 if(appendUnit && 0 != strlen(
getUnit())) {
313 auto item = evalData.
spans.find(
this);
314 if (item != evalData.
spans.end()) {
367 <<
"): validation failed: " << value << endl ;
387 const RooArgSet* ,
const char* rangeName)
const
418 if (code==0)
return getVal(normSet) ;
432 coutF(Eval) <<
"RooAbsReal::analyticalIntegral(" <<
GetName() <<
") code " << code <<
" not implemented" << endl ;
493 os <<
indent <<
"--- RooAbsReal ---" << endl;
533 for (
auto const& arg : paramsOfInterest) {
539 name.append(arg->GetName()) ;
583 pc.
process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
614 if (!rangeName || strchr(rangeName,
',')==0) {
624 for (
const std::string& token : tokens) {
626 components.
add(*compIntegral);
630 title.
Prepend(
"Integral of ") ;
658 title.
Prepend(
"Integral of ") ;
683 title.
Prepend(
"Integral of ") ;
692 if (integrand !=
this) {
700 if (integrand ==
this && iset.
getSize()>0) {
701 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 ;
705 integrand = integral ;
713 coutE(Integration) <<
GetName() <<
" : ERROR while defining recursive integral over observables with parameterized integration ranges, please check that integration rangs specify uniquely defined integral " << endl;
722 if (cacheParamsStr && strlen(cacheParamsStr)) {
730 if (cacheParams->
getSize()>0) {
731 cxcoutD(Caching) <<
"RooAbsReal::createIntObj(" <<
GetName() <<
") INFO: constructing " << cacheParams->
getSize()
732 <<
"-dim value cache for integral over " << iset2 <<
" as a function of " << *cacheParams <<
" in range " << (rangeName?rangeName:
"<none>") << endl ;
742 integral = cachedIntegral ;
773 for (
const auto aarg : allObs) {
786 obsWithParamRange.
add(*aarg) ;
787 obsWithFixedRange.
remove(*aarg) ;
788 obsServingAsRangeParams.
add(*loBoundObs,
kFALSE) ;
789 obsServingAsRangeParams.
add(*hiBoundObs,
kFALSE) ;
798 RooArgSet obsWithFixedRangeNP(obsWithFixedRange) ;
799 obsWithFixedRangeNP.
remove(obsServingAsRangeParams) ;
802 RooArgSet obsWithParamRangeNP(obsWithParamRange) ;
803 obsWithParamRangeNP.
remove(obsServingAsRangeParams) ;
807 innerObs.
add(obsWithFixedRangeNP) ;
808 innerObs.
add(obsWithParamRangeNP) ;
825 name.Append(
"_Int[") ;
840 name.Append(rangeName) ;
843 }
else if (!omitEmpty) {
844 name.Append(
"_Int[]") ;
847 if (nset && nset->
getSize()>0 ) {
852 name.Append(
"_Norm[") ;
939 for (
const auto arg : dependentVars) {
940 if(!arg->isFundamental() && !
dynamic_cast<const RooAbsLValue*
>(arg)) {
941 coutE(Plotting) <<
ClassName() <<
"::" <<
GetName() <<
":createPlotProjection: variable \"" << arg->GetName()
942 <<
"\" of wrong type: " << arg->ClassName() << endl;
949 <<
"\" is not a dependent and will be ignored." << endl;
954 leafNodes.
replace(*found,*arg);
956 leafNodes.
add(*arg) ;
959 RooArgSet* lvDep = arg->getObservables(&leafNodes) ;
960 for (
const auto lvs : *lvDep) {
964 leafNodes.
add(*lvs) ;
971 if(0 != projectedVars && projectedVars->
find(arg->GetName())) {
973 <<
"\" cannot be both a dependent and a projected variable." << endl;
979 if(0 != projectedVars) leafNodes.
remove(*projectedVars,
kTRUE);
984 coutE(Plotting) <<
"RooAbsPdf::createPlotProjection(" <<
GetName() <<
") Couldn't deep-clone PDF, abort," << endl ;
997 delete plotLeafNodes ;
1001 if(0 != projectedVars) normSet.
add(*projectedVars);
1010 if(0 == projectedVars) projectedVars= ∅
1016 title.
Prepend(
"Projection of ");
1021 if(0 == projected || !projected->
isValid()) {
1022 coutE(Plotting) <<
ClassName() <<
"::" <<
GetName() <<
":createPlotProjection: cannot integrate out ";
1025 if(0 != projected)
delete projected;
1030 static_cast<RooRealIntegral*
>(projected)->setAllowComponentSelection(
true);
1067 coutE(InputArguments) <<
ClassName() <<
"::" <<
GetName() <<
":fillHistogram: no valid histogram to fill" << endl;
1073 if(hdim != plotVars.
getSize()) {
1074 coutE(InputArguments) <<
ClassName() <<
"::" <<
GetName() <<
":fillHistogram: plotVars has the wrong dimension" << endl;
1082 for(
Int_t index= 0; index < plotVars.
getSize(); index++) {
1087 <<
"\" of type " << var->
ClassName() << endl;
1092 <<
":fillHistogram: WARNING: variable is not an explicit dependent: " << realVar->
GetName() << endl;
1108 if (projectedVars) {
1109 allDeps.
add(*projectedVars) ;
1112 coutE(InputArguments) <<
"RooAbsReal::fillHistogram(" <<
GetName() <<
") error in checkObservables, abort" << endl ;
1120 cxcoutD(Plotting) <<
"RooAbsReal::fillHistogram(" <<
GetName() <<
") plot projection object is " << projected->
GetName() << endl ;
1123 Int_t xbins(0),ybins(1),zbins(1);
1135 assert(0 != zvar && 0 != zaxis);
1136 if (scaleForDensity) {
1144 assert(0 != yvar && 0 != yaxis);
1145 if (scaleForDensity) {
1153 assert(0 != xvar && 0 != xaxis);
1154 if (scaleForDensity) {
1159 coutE(InputArguments) <<
ClassName() <<
"::" <<
GetName() <<
":fillHistogram: cannot fill histogram with "
1160 << hdim <<
" dimensions" << endl;
1167 Int_t xbin(0),ybin(0),zbin(0);
1168 Int_t bins= xbins*ybins*zbins;
1169 for(
Int_t bin= 0; bin < bins; bin++) {
1172 if(bin % (xbins*ybins) == 0) {
1178 if(bin % xbins == 0) {
1179 ybin= (ybin%ybins) + 1;
1184 xbin= (xbin%xbins) + 1;
1188 coutE(InputArguments) <<
"RooAbsReal::fillHistogram: Internal Error!" << endl;
1194 coutW(Plotting) <<
"WARNING: Function evaluation error(s) at coordinates [x]=" << xvar->
getVal() ;
1195 if (hdim==2)
ccoutW(Plotting) <<
" [y]=" << yvar->
getVal() ;
1196 if (hdim==3)
ccoutW(Plotting) <<
" [z]=" << zvar->
getVal() ;
1197 ccoutW(Plotting) << endl ;
1243 coutE(InputArguments) <<
ClassName() <<
"::" <<
GetName() <<
":fillDataHist: no valid RooDataHist to fill" << endl;
1250 coutE(InputArguments) <<
"RooAbsReal::fillDataHist(" <<
GetName() <<
") error in checkObservables, abort" << endl ;
1267 if (showProgress && (i%onePct==0)) {
1268 ccoutP(Eval) <<
"." << flush ;
1271 Double_t binVal = theClone->
getVal(normSet?normSet:obs)*scaleFactor ;
1272 if (correctForBinSize) {
1275 hist->
set(i, binVal, 0.);
1304 strlcpy(buf,varNameList,1024) ;
1305 char* varName = strtok(buf,
",:") ;
1310 varName = strtok(0,
",") ;
1312 varName = strtok(0,
",") ;
1405 pc.
defineInt(
"intBinning",
"IntrinsicBinning",0,2) ;
1406 pc.
defineInt(
"extended",
"Extended",0,2) ;
1410 pc.
defineSet(
"projObs",
"ProjectedObservables",0,0) ;
1413 pc.
defineMutex(
"SelectCompSet",
"SelectCompSpec") ;
1415 pc.
defineMutex(
"IntrinsicBinning",
"BinningName") ;
1416 pc.
defineMutex(
"IntrinsicBinning",
"BinningSpec") ;
1444 if (!pdfSelf && doExtended>0) {
1445 coutW(InputArguments) <<
"RooAbsReal::createHistogram(" <<
GetName() <<
") WARNING extended mode requested for a non-pdf object, ignored" << endl ;
1449 coutW(InputArguments) <<
"RooAbsReal::createHistogram(" <<
GetName() <<
") WARNING extended mode requested for a non-extendable pdf, ignored" << endl ;
1452 if (pdfSelf && doExtended==2) {
1456 const char* compSpec = pc.
getString(
"compSpec") ;
1458 Bool_t haveCompSel = ( (compSpec && strlen(compSpec)>0) || compSet) ;
1461 if (doIntBinning>0) {
1466 if (doIntBinning==1) {
1467 coutW(InputArguments) <<
"RooAbsReal::createHistogram(" <<
GetName()
1468 <<
") WARNING, intrinsic model binning requested for histogram, but model does not define bin boundaries, reverting to default binning"<< endl ;
1471 if (doIntBinning==2) {
1472 coutI(InputArguments) <<
"RooAbsReal::createHistogram(" <<
GetName()
1473 <<
") INFO: Model has intrinsic binning definition, selecting that binning for the histogram"<< endl ;
1476 for (list<double>::iterator it=bl->begin() ; it!=bl->end() ; ++it) { ba[i++] = *it ; }
1477 intBinning =
new RooBinning(bl->size()-1,ba) ;
1483 pc.
stripCmdList(argListCreate,
"Scaling,ProjectedObservables,IntrinsicBinning,SelectCompSet,SelectCompSpec,Extended") ;
1488 argListCreate.
Add(&tmp) ;
1507 branchNodeSet.
remove(*arg) ;
1518 if (dirSelNodes->
getSize()>0) {
1519 coutI(Plotting) <<
"RooAbsPdf::createHistogram(" <<
GetName() <<
") directly selected PDF components: " << *dirSelNodes << endl ;
1525 coutE(Plotting) <<
"RooAbsPdf::createHistogram(" <<
GetName() <<
") ERROR: component selection set " << *compSet <<
" does not match any components of p.d.f." << endl ;
1527 coutE(Plotting) <<
"RooAbsPdf::createHistogram(" <<
GetName() <<
") ERROR: component selection expression '" << compSpec <<
"' does not select any components of p.d.f." << endl ;
1531 delete dirSelNodes ;
1567 for (
unsigned int i = 0; i < branchNodeSet.
size(); ++i) {
1568 const auto arg = branchNodeSet[i];
1570 branchNodeSet.
remove(*arg) ;
1577 for (
const auto arg : branchNodeSet) {
1586 for (
const auto arg : branchNodeSet) {
1587 for (
const auto selNode : *selNodes) {
1588 if (selNode->dependsOn(*arg)) {
1595 for (
const auto arg : branchNodeSet) {
1596 if (arg->dependsOn(*selNodes)) {
1601 tmp.
remove(*selNodes,
true);
1604 coutI(Plotting) <<
"RooAbsPdf::plotOn(" <<
GetName() <<
") indirectly selected PDF components: " << tmp << endl ;
1607 for (
const auto arg : branchNodeSet) {
1608 Bool_t select = selNodes->
find(arg->GetName()) !=
nullptr;
1756 argList.
Add(&rnorm) ;
1758 std::vector<string> rlist;
1762 rlist.emplace_back(rangeNameToken);
1765 for (
const auto& rangeString : rlist) {
1767 rcmd->
setString(0, rangeString.c_str());
1778 pc.
defineString(
"curveNameSuffix",
"CurveNameSuffix",0,
"") ;
1788 pc.
defineInt(
"doEvalError",
"EvalErrorValue",0,0) ;
1789 pc.
defineInt(
"shiftToZero",
"ShiftToZero",0,0) ;
1794 pc.
defineSet(
"errorPars",
"VisualizeError",0) ;
1795 pc.
defineInt(
"linearMethod",
"VisualizeError",0,0) ;
1796 pc.
defineInt(
"binProjData",
"ProjData",0,0) ;
1799 pc.
defineInt(
"numee",
"PrintEvalErrors",0,10) ;
1800 pc.
defineInt(
"rangeAdjustNorm",
"Range",0,0) ;
1801 pc.
defineInt(
"rangeWNAdjustNorm",
"RangeWithName",0,0) ;
1805 pc.
defineInt(
"markerColor",
"MarkerColor",0,-999) ;
1806 pc.
defineInt(
"markerStyle",
"MarkerStyle",0,-999) ;
1808 pc.
defineInt(
"lineColor",
"LineColor",0,-999) ;
1809 pc.
defineInt(
"lineStyle",
"LineStyle",0,-999) ;
1810 pc.
defineInt(
"lineWidth",
"LineWidth",0,-999) ;
1811 pc.
defineInt(
"fillColor",
"FillColor",0,-999) ;
1812 pc.
defineInt(
"fillStyle",
"FillStyle",0,-999) ;
1814 pc.
defineInt(
"curveInvisible",
"Invisible",0,0) ;
1815 pc.
defineInt(
"showProg",
"ShowProgress",0,0) ;
1817 pc.
defineInt(
"interleave",
"NumCPU",1,0) ;
1821 pc.
defineInt(
"moveToBack",
"MoveToBack",0,0) ;
1825 pc.
defineMutex(
"VisualizeError",
"VisualizeErrorData") ;
1840 if (!drawOpt.
Contains(
"P") && errFR) {
1867 const char* sliceCatState = pc.
getString(
"sliceCatState",0,
kTRUE) ;
1869 if (sliceCatState) {
1878 std::unique_ptr<TIterator> iter( sliceCatList.
MakeIterator() );
1879 for (
unsigned int i=0; i < catTokens.size(); ++i) {
1880 auto scat =
static_cast<RooCategory*
>(iter->Next());
1897 if (vlines==2) vlines=0 ;
1903 if (vlines==2) vlines=0 ;
1923 coutE(InputArguments) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") cannot find existing curve " << o.
addToCurveName <<
" to add to in RooPlot" << endl ;
1929 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: have slice " << *sliceSet << endl ;
1934 for (
const auto sliceArg : *sliceSet) {
1937 projectedVars.
remove(*arg) ;
1939 coutI(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") slice variable "
1940 << sliceArg->GetName() <<
" was not projected anyway" << endl ;
1943 }
else if (projSet) {
1944 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: have projSet " << *projSet << endl ;
1947 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: have neither sliceSet nor projSet " << endl ;
1952 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: projectedVars = " << projectedVars << endl ;
1984 if ((fillColor != -999 || fillStyle != -999) && !drawOpt.
Contains(
"F")) {
1985 coutW(Plotting) <<
"Fill color or style was set for plotting \"" <<
GetName()
1986 <<
"\", but these only have an effect when 'DrawOption(\"F\")' for fill is used at the same time." << std::endl;
2026 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") have ProjData with observables = " << *o.
projData->
get() << endl ;
2029 projDataVars.
add(*tmp) ;
2030 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") have ProjDataSet = " << *o.
projDataSet <<
" will only use this subset of projData" << endl ;
2033 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") using full ProjData" << endl ;
2038 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") ProjDataVars = " << projDataVars << endl ;
2044 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") have input projSet = " << *o.
projSet << endl ;
2046 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") calculated projectedVars = " << *o.
projSet << endl ;
2052 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") frame->getNormVars() that are also observables = " << *sliceSetTmp << endl ;
2064 coutI(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") plot on "
2065 << frame->
getPlotVar()->
GetName() <<
" represents a slice in " << *sliceSetTmp << endl ;
2067 sliceSet.
add(*sliceSetTmp) ;
2068 delete sliceSetTmp ;
2074 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") projectedVars = " << projectedVars <<
" sliceSet = " << sliceSet << endl ;
2087 if (!plotCloneSet) {
2088 coutE(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Couldn't deep-clone self, abort," << endl ;
2094 if (projectedVars.
getSize()) {
2095 coutI(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") plot on " << plotVar->
GetName()
2096 <<
" integrates over variables " << projectedVars
2099 if (projDataNeededVars && projDataNeededVars->
getSize()>0) {
2100 coutI(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") plot on " << plotVar->
GetName()
2101 <<
" averages using data variables " << *projDataNeededVars << endl ;
2109 if (projDataNeededVars) {
2113 deps->
add(*plotVar) ;
2119 coutE(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") error in checkObservables, abort" << endl ;
2121 delete plotCloneSet ;
2122 if (projDataNeededVars)
delete projDataNeededVars ;
2130 cxcoutD(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") plot projection object is " << projection->
GetName() << endl ;
2137 fullNormSet.
add(projectedVars) ;
2138 if (projDataNeededVars && projDataNeededVars->
getSize()>0) {
2139 fullNormSet.
add(*projDataNeededVars) ;
2155 if (o.
projData && projDataNeededVars && projDataNeededVars->
getSize()>0) {
2165 if (sliceDataSet->
getSize()>0) {
2186 delete sliceDataSet ;
2188 if (!cutString.
IsNull()) {
2190 coutI(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") reducing given projection dataset to entries with " << cutString << endl ;
2195 <<
") only the following components of the projection data will be used: " << *projDataNeededVars << endl ;
2211 coutI(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") unbinned projection dataset consist only of discrete variables,"
2212 <<
" performing projection with binned copy for optimization." << endl ;
2220 if (projDataSel!=o.
projData)
delete projDataSel ;
2227 projection->
getVal(projDataSel->
get()) ;
2285 if (projDataSel!=o.
projData)
delete projDataSel ;
2368 if (projDataNeededVars)
delete projDataNeededVars ;
2370 delete projectionCompList ;
2371 delete plotCloneSet ;
2393 projectedVars.
remove(*arg) ;
2395 coutI(Plotting) <<
"RooAbsReal::plotSliceOn(" <<
GetName() <<
") slice variable "
2396 << sliceArg->
GetName() <<
" was not projected anyway" << endl ;
2439 projDataVars.
add(*tmp) ;
2448 coutE(Plotting) <<
"RooAbsReal::plotAsymOn(" <<
GetName()
2449 <<
") function doesn't depend on asymmetry category " << asymCat.
GetName() << endl ;
2455 coutE(Plotting) <<
"RooAbsReal::plotAsymOn(" <<
GetName()
2456 <<
") asymmetry category must have 2 or 3 states with index values -1,0,1" << endl ;
2479 coutI(Plotting) <<
"RooAbsReal::plotAsymOn(" <<
GetName() <<
") plot on "
2480 << frame->
getPlotVar()->
GetName() <<
" represents a slice in " << *sliceSetTmp << endl ;
2482 sliceSet.
add(*sliceSetTmp) ;
2483 delete sliceSetTmp ;
2507 if (projectedVars.
getSize()) {
2508 coutI(Plotting) <<
"RooAbsReal::plotAsymOn(" <<
GetName() <<
") plot on " << plotVar->
GetName()
2509 <<
" projects variables " << projectedVars << endl ;
2511 if (projDataNeededVars && projDataNeededVars->
getSize()>0) {
2512 coutI(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") plot on " << plotVar->
GetName()
2513 <<
" averages using data variables "<< *projDataNeededVars << endl ;
2532 RooArgSet *posProjCompList, *negProjCompList ;
2538 depPos.
add(projDataVars) ;
2539 depNeg.
add(projDataVars) ;
2543 if (!posProj || !negProj) {
2544 coutE(Plotting) <<
"RooAbsReal::plotAsymOn(" <<
GetName() <<
") Unable to create projections, abort" << endl ;
2550 asymName.
Append(
"_Asym[") ;
2554 asymTitle.
Append(
" Asymmetry of ") ;
2567 if (sliceDataSet->
getSize()>0) {
2588 delete sliceDataSet ;
2590 if (!cutString.
IsNull()) {
2592 coutI(Plotting) <<
"RooAbsReal::plotAsymOn(" <<
GetName()
2593 <<
") reducing given projection dataset to entries with " << cutString << endl ;
2597 coutI(Plotting) <<
"RooAbsReal::plotAsymOn(" <<
GetName()
2598 <<
") only the following components of the projection data will be used: " << *projDataNeededVars << endl ;
2608 ((
RooAbsReal*)posProj)->attachDataSet(*projDataSel) ;
2609 ((
RooAbsReal*)negProj)->attachDataSet(*projDataSel) ;
2643 if (projDataSel!=o.
projData)
delete projDataSel ;
2682 delete posProjCompList ;
2683 delete negProjCompList ;
2717 fpf_stripped.
add(*frv);
2731 vector<int> fpf_idx;
2735 paramList.
add(*par);
2736 fpf_idx.push_back(i);
2740 vector<Double_t> plusVar, minusVar ;
2747 for (
Int_t ivar=0 ; ivar<paramList.
getSize() ; ivar++) {
2755 ((
RooRealVar*)paramList.
at(ivar))->setVal(cenVal+errVal) ;
2756 plusVar.push_back(cloneFunc->
getVal(nset)) ;
2759 ((
RooRealVar*)paramList.
at(ivar))->setVal(cenVal-errVal) ;
2760 minusVar.push_back(cloneFunc->
getVal(nset)) ;
2766 vector<double> errVec(paramList.
getSize()) ;
2767 for (
int i=0 ; i<paramList.
getSize() ; i++) {
2768 errVec[i] =
sqrt(V(i,i)) ;
2769 for (
int j=i ; j<paramList.
getSize() ; j++) {
2770 C(i,j) = V(i,j)/
sqrt(V(i,i)*V(j,j)) ;
2777 for (
unsigned int j=0 ; j<plusVar.size() ; j++) {
2778 F[j] = (plusVar[j]-minusVar[j])/2 ;
2785 delete errorParams ;
2837 pc.
stripCmdList(plotArgListTmp,
"VisualizeError,MoveToBack") ;
2844 if (std::string(
"Normalization")==cmd->
GetName()) {
2847 plotArgList.
Add(cmd) ;
2850 plotArgList.
Add(cmd) ;
2859 coutE(Plotting) <<
ClassName() <<
"::" <<
GetName() <<
":plotOnWithErrorBand: no curve for central value available" << endl;
2881 coutI(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") INFO: visualizing " << Z <<
"-sigma uncertainties in parameters "
2882 << *errorParams <<
" from fit result " << fr.
GetName() <<
" using " <<
n <<
" samplings." << endl ;
2888 vector<RooCurve*> cvec ;
2889 for (
int i=0 ; i<
d->numEntries() ; i++) {
2890 *cloneParams = (*
d->get(i)) ;
2892 cloneFunc->
plotOn(frame,tmp2) ;
2893 cvec.push_back(frame->
getCurve()) ;
2906 for (vector<RooCurve*>::iterator i=cvec.begin() ; i!=cvec.end() ; ++i) {
2928 fpf_stripped.
add(*frv);
2941 vector<int> fpf_idx ;
2945 paramList.
add(*par) ;
2946 fpf_idx.push_back(i) ;
2950 vector<RooCurve*> plusVar, minusVar ;
2959 for (
Int_t ivar=0 ; ivar<paramList.
getSize() ; ivar++) {
2967 ((
RooRealVar*)paramList.
at(ivar))->setVal(cenVal+Z*errVal) ;
2971 cloneFunc->
plotOn(frame,tmp2) ;
2972 plusVar.push_back(frame->
getCurve()) ;
2977 ((
RooRealVar*)paramList.
at(ivar))->setVal(cenVal-Z*errVal) ;
2979 cloneFunc->
plotOn(frame,tmp3) ;
2980 minusVar.push_back(frame->
getCurve()) ;
2987 vector<double> errVec(paramList.
getSize()) ;
2988 for (
int i=0 ; i<paramList.
getSize() ; i++) {
2989 errVec[i] =
sqrt(V(i,i)) ;
2990 for (
int j=i ; j<paramList.
getSize() ; j++) {
2991 C(i,j) = V(i,j)/
sqrt(V(i,i)*V(j,j)) ;
3001 for (vector<RooCurve*>::iterator i=plusVar.begin() ; i!=plusVar.end() ; ++i) {
3004 for (vector<RooCurve*>::iterator i=minusVar.begin() ; i!=minusVar.end() ; ++i) {
3011 if (!band)
return frame ;
3015 pc.
defineString(
"curveNameSuffix",
"CurveNameSuffix",0,
"") ;
3016 pc.
defineInt(
"lineColor",
"LineColor",0,-999) ;
3017 pc.
defineInt(
"lineStyle",
"LineStyle",0,-999) ;
3018 pc.
defineInt(
"lineWidth",
"LineWidth",0,-999) ;
3019 pc.
defineInt(
"markerColor",
"MarkerColor",0,-999) ;
3020 pc.
defineInt(
"markerStyle",
"MarkerStyle",0,-999) ;
3022 pc.
defineInt(
"fillColor",
"FillColor",0,-999) ;
3023 pc.
defineInt(
"fillStyle",
"FillStyle",0,-999) ;
3025 pc.
defineInt(
"curveInvisible",
"Invisible",0,0) ;
3026 pc.
defineInt(
"moveToBack",
"MoveToBack",0,0) ;
3092 <<
":plotOn: frame does not specify a plot variable" << endl;
3105 coutE(Plotting) <<
ClassName() <<
"::" <<
GetName() <<
":plotOn: WARNING: variable is not an explicit dependent: "
3126 cxcoutD(Plotting) <<
"RooAbsReal::makeProjectionSet(" <<
GetName() <<
") plotVar = " << plotVar->
GetName()
3127 <<
" allVars = " << (allVars?(*allVars):
RooArgSet()) << endl ;
3130 if (!allVars) return ;
3133 projectedVars.
add(*allVars) ;
3138 projectedVars.
remove(*found);
3147 cxcoutD(Plotting) <<
"RooAbsReal::makeProjectionSet(" <<
GetName() <<
") removing " << tmp->
GetName()
3148 <<
" from projection set because it a server of " << plotVar->
GetName() << endl ;
3149 projectedVars.
remove(*tmp) ;
3153 delete plotServers ;
3157 <<
") WARNING: cannot project out frame variable ("
3158 << found->
GetName() <<
"), ignoring" << endl ;
3170 <<
") function doesn't depend on projection variable "
3171 << arg->
GetName() <<
", ignoring" << endl ;
3210 if(binding && !binding->
isValid()) {
3211 coutE(InputArguments) <<
ClassName() <<
"::" <<
GetName() <<
":bindVars: cannot bind to " << vars << endl ;
3220struct TreeReadBuffer {
3221 virtual ~TreeReadBuffer() =
default;
3222 virtual operator double() = 0;
3233 auto other =
static_cast<const RooAbsReal*
>(source);
3234 assert(
dynamic_cast<const RooAbsReal*
>(source));
3257struct TypedTreeReadBuffer final :
public TreeReadBuffer {
3258 operator double()
override {
3269std::unique_ptr<TreeReadBuffer> createTreeReadBuffer(
const TString& branchName,
TTree&
tree) {
3270 auto buf =
new TypedTreeReadBuffer<T>();
3271 tree.SetBranchAddress(branchName.
Data(), &buf->_value);
3272 return std::unique_ptr<TreeReadBuffer>(buf);
3302 coutE(Eval) <<
"RooAbsReal::attachToTree(" <<
GetName() <<
") ERROR: TTree branch " <<
GetName()
3303 <<
" is an array and cannot be attached to a RooAbsReal" << endl ;
3313 std::map<std::string, std::pair<std::string, std::function<std::unique_ptr<TreeReadBuffer>()>>> typeMap {
3314 {
"Float_t", {
"FLOAT_TREE_BRANCH", [&](){
return createTreeReadBuffer<Float_t >(cleanName, t); }}},
3315 {
"Int_t", {
"INTEGER_TREE_BRANCH", [&](){
return createTreeReadBuffer<Int_t >(cleanName, t); }}},
3316 {
"UChar_t", {
"BYTE_TREE_BRANCH", [&](){
return createTreeReadBuffer<UChar_t >(cleanName, t); }}},
3317 {
"Bool_t", {
"BOOL_TREE_BRANCH", [&](){
return createTreeReadBuffer<Bool_t >(cleanName, t); }}},
3318 {
"Char_t", {
"SIGNEDBYTE_TREE_BRANCH", [&](){
return createTreeReadBuffer<Char_t >(cleanName, t); }}},
3319 {
"UInt_t", {
"UNSIGNED_INTEGER_TREE_BRANCH", [&](){
return createTreeReadBuffer<UInt_t >(cleanName, t); }}},
3320 {
"Long64_t", {
"LONG_TREE_BRANCH", [&](){
return createTreeReadBuffer<Long64_t >(cleanName, t); }}},
3321 {
"ULong64_t", {
"UNSIGNED_LONG_TREE_BRANCH", [&](){
return createTreeReadBuffer<ULong64_t>(cleanName, t); }}},
3322 {
"Short_t", {
"SHORT_TREE_BRANCH", [&](){
return createTreeReadBuffer<Short_t >(cleanName, t); }}},
3323 {
"UShort_t", {
"UNSIGNED_SHORT_TREE_BRANCH", [&](){
return createTreeReadBuffer<UShort_t >(cleanName, t); }}},
3326 auto typeDetails = typeMap.find(typeName.
Data());
3327 if (typeDetails != typeMap.end()) {
3328 coutI(DataHandling) <<
"RooAbsReal::attachToTree(" <<
GetName() <<
") TTree " << typeDetails->first <<
" branch " <<
GetName()
3329 <<
" will be converted to double precision." << endl ;
3339 coutE(InputArguments) <<
"RooAbsReal::attachToTree(" <<
GetName() <<
") data type " << typeName <<
" is not supported." << endl ;
3502 const TList &nameList)
const
3511 matched.
add(*found);
3525 if(isMatched) matchedArgs.
add(matched);
3574 if (config)
return config ;
3587 if (config)
return config ;
3689 if (inLogEvalError) {
3692 inLogEvalError =
kTRUE ;
3697 if (serverValueString) {
3702 oocoutE((
TObject*)0,Eval) <<
"RooAbsReal::logEvalError(" <<
"<STATIC>" <<
") evaluation error, " << endl
3703 <<
" origin : " << origName << endl
3704 <<
" message : " << ee.
_msg << endl
3705 <<
" server values: " << ee.
_srvval << endl ;
3712 inLogEvalError =
kFALSE ;
3744 if (inLogEvalError) {
3747 inLogEvalError =
kTRUE ;
3752 if (serverValueString) {
3772 ostringstream oss2 ;
3776 coutE(Eval) <<
"RooAbsReal::logEvalError(" <<
GetName() <<
") evaluation error, " << endl
3777 <<
" origin : " << oss2.str() << endl
3778 <<
" message : " << ee.
_msg << endl
3779 <<
" server values: " << ee.
_srvval << endl ;
3788 <<
") delayed evaluation error, " << endl
3789 <<
" origin : " << oss2.str() << endl
3790 <<
" message : " << oee.
_msg << endl
3791 <<
" server values: " << oee.
_srvval << endl ;
3798 inLogEvalError =
kFALSE ;
3854 if (maxPerNode<0) return ;
3856 map<const RooAbsArg*,pair<string,list<EvalError> > >::iterator iter =
_evalErrorList.begin() ;
3859 if (maxPerNode==0) {
3862 os << iter->second.first ;
3864 os <<
" has " << iter->second.second.size() <<
" errors" << endl ;
3869 os << iter->second.first << endl ;
3873 std::list<EvalError>::iterator iter2 = iter->second.second.begin() ;
3874 for(;iter2!=iter->second.second.end() ; ++iter2, i++) {
3875 os <<
" " << iter2->_msg <<
" @ " << iter2->_srvval << endl ;
3877 os <<
" ... (remaining " << iter->second.second.size() - maxPerNode <<
" messages suppressed)" << endl ;
3897 map<const RooAbsArg*,pair<string,list<EvalError> > >::iterator iter =
_evalErrorList.begin() ;
3899 ntot += iter->second.second.size() ;
3974 orderedObs.
add(obs) ;
4033 pc.
defineInt(
"numScanBins",
"ScanParameters",0,1000) ;
4034 pc.
defineInt(
"intOrder",
"ScanParameters",1,2) ;
4035 pc.
defineInt(
"doScanNum",
"ScanNum",0,1) ;
4036 pc.
defineInt(
"doScanAll",
"ScanAll",0,0) ;
4037 pc.
defineInt(
"doScanNon",
"ScanNone",0,0) ;
4041 pc.
process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
4071 coutI(NumIntegration) <<
"RooAbsPdf::createRunningIntegral(" <<
GetName() <<
") integration over observable(s) " << iset <<
" involves numeric integration," << endl
4072 <<
" constructing cdf though numeric integration of sampled pdf in " << numScanBins <<
" bins and applying order "
4073 << intOrder <<
" interpolation on integrated histogram." << endl
4074 <<
" To override this choice of technique use argument ScanNone(), to change scan parameters use ScanParameters(nbins,order) argument" << endl ;
4092 ivar->
setBins(numScanBins,
"numcdf") ;
4115 coutW(InputArguments) <<
"RooAbsPdf::createRunningIntegral(" <<
GetName() <<
") WARNING ignoring non-RooRealVar input argument " << arg->
GetName() << endl ;
4136 cloneList.
add(*cloneArg) ;
4142 loList.
add(*cloneLo) ;
4175 coutE(InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified observables are not variables of this p.d.f" << endl ;
4181 coutE(InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified parameters are not variables of this p.d.f" << endl ;
4202 coutE(InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified observables are not variables of this p.d.f" << endl ;
4208 coutE(InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified parameters are not variables of this p.d.f" << endl ;
4216 for (
int i=0 ; i<obs.
getSize() ; i++) {
4218 coutE(ObjectHandling) <<
"RooAbsReal::asTF(" <<
GetName() <<
") ERROR: proposed observable " << obs.
at(0)->
GetName() <<
" is not of type RooRealVar" << endl ;
4222 for (
int i=0 ; i<pars.
getSize() ; i++) {
4224 coutE(ObjectHandling) <<
"RooAbsReal::asTF(" <<
GetName() <<
") ERROR: proposed parameter " << pars.
at(0)->
GetName() <<
" is not of type RooRealVar" << endl ;
4256 <<
" observables specified, but a ROOT TFx can only have 1,2 or 3 observables" << endl ;
4261 for (
int i=0 ; i<pars.
getSize() ; i++) {
4291 return new RooDerivative(
name.c_str(),title.c_str(),*
this,obs,normSet,order,eps) ;
4306 string title=
Form(
"%sMoment of order %d of %s w.r.t %s ",(central?
"Central ":
""),order,
GetName(),obs.
GetName()) ;
4308 if (order==2)
return new RooSecondMoment(
name.c_str(),title.c_str(),*
this,obs,central,takeRoot) ;
4309 return new RooMoment(
name.c_str(),title.c_str(),*
this,obs,order,central,takeRoot) ;
4325 string title=
Form(
"%sMoment of order %d of %s w.r.t %s ",(central?
"Central ":
""),order,
GetName(),obs.
GetName()) ;
4327 if (order==1)
return new RooFirstMoment(
name.c_str(),title.c_str(),*
this,obs,normObs,intNormObs) ;
4328 if (order==2)
return new RooSecondMoment(
name.c_str(),title.c_str(),*
this,obs,normObs,central,takeRoot,intNormObs) ;
4329 return new RooMoment(
name.c_str(),title.c_str(),*
this,obs,normObs,order,central,takeRoot,intNormObs) ;
4464 return new RooChi2Var(
name.c_str(),
name.c_str(),*
this,data,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
4489 return createChi2(data,*cmds[0],*cmds[1],*cmds[2],*cmds[3],*cmds[4],*cmds[5],*cmds[6],*cmds[7]) ;
4604 pc.
defineInt(
"integrate",
"Integrate",0,0) ;
4641 pc.
defineInt(
"optConst",
"Optimize",0,1) ;
4645 pc.
defineInt(
"plevel",
"PrintLevel",0,1) ;
4647 pc.
defineInt(
"initHesse",
"InitialHesse",0,0) ;
4651 pc.
defineInt(
"numee",
"PrintEvalErrors",0,10) ;
4673#ifdef __ROOFIT_NOROOMINIMIZER
4674 const char* minType =0 ;
4676 const char* minType = pc.
getString(
"mintype",
"Minuit") ;
4677 const char* minAlg = pc.
getString(
"minalg",
"minuit") ;
4694#ifdef __ROOFIT_NOROOMINIMIZER
4697 if (
"OldMinuit" ==
string(minType)) {
4706 m.setPrintEvalErrors(numee) ;
4708 m.setPrintLevel(plevel) ;
4713 m.optimizeConst(optConst);
4719 ret =
m.fit(fitOpt) ;
4734 m.setStrategy(strat) ;
4753 m.minos(*minosSet) ;
4762 string title =
Form(
"Result of fit of %s ",
GetName()) ;
4763 ret =
m.save(
name.c_str(),title.c_str()) ;
4768#ifndef __ROOFIT_NOROOMINIMIZER
4771 m.setMinimizerType(minType);
4777 m.setPrintEvalErrors(numee) ;
4779 m.setPrintLevel(plevel) ;
4784 m.optimizeConst(optConst);
4790 ret =
m.fit(fitOpt) ;
4805 m.setStrategy(strat) ;
4814 m.minimize(minType, minAlg) ;
4824 m.minos(*minosSet) ;
4833 string title =
Form(
"Result of fit of %s ",
GetName()) ;
4834 ret =
m.save(
name.c_str(),title.c_str()) ;