35 #include <sys/types.h> 76 #ifndef __ROOFIT_NOROOMINIMIZER 109 using namespace std ;
154 Double_t inMaxVal,
const char *unit) :
198 return (
getVal()==value) ;
218 if (!assumeSameType) {
234 if(appendUnit && 0 != strlen(
getUnit())) {
301 <<
"): validation failed: " << value << endl ;
321 const RooArgSet* ,
const char* rangeName)
const 352 if (code==0)
return getVal(normSet) ;
366 coutF(
Eval) <<
"RooAbsReal::analyticalIntegral(" <<
GetName() <<
") code " << code <<
" not implemented" << endl ;
427 os << indent <<
"--- RooAbsReal ---" << endl;
429 if(!unit.IsNull()) unit.Prepend(
' ');
431 os << endl << indent <<
" Plot label is \"" <<
getPlotLabel() <<
"\"" << endl;
516 pc.
process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
547 if (!rangeName || strchr(rangeName,
',')==0) {
555 TObjArray* oa = TString(rangeName).Tokenize(
",");
561 components.
add(*compIntegral) ;
566 title.Prepend(
"Integral of ") ;
595 title.Prepend(
"Integral of ") ;
619 TString title(integrand->
GetTitle()) ;
620 title.Prepend(
"Integral of ") ;
629 if (integrand !=
this) {
637 if (integrand ==
this && iset.
getSize()>0) {
638 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 ;
642 integrand = integral ;
650 coutE(
Integration) <<
GetName() <<
" : ERROR while defining recursive integral over observables with parameterized integration ranges, please check that integration rangs specify uniquely defined integral " << endl;
659 if (cacheParamsStr && strlen(cacheParamsStr)) {
667 if (cacheParams->
getSize()>0) {
669 <<
"-dim value cache for integral over " << iset2 <<
" as a function of " << *cacheParams <<
" in range " << (rangeName?rangeName:
"<none>") << endl ;
673 cachedIntegral->addOwnedComponents(*integral) ;
674 cachedIntegral->setCacheSource(
kTRUE) ;
676 cachedIntegral->setOperMode(
ADirty) ;
679 integral = cachedIntegral ;
725 obsWithParamRange.
add(*aarg) ;
726 obsWithFixedRange.
remove(*aarg) ;
727 obsServingAsRangeParams.
add(*loBoundObs,
kFALSE) ;
728 obsServingAsRangeParams.
add(*hiBoundObs,
kFALSE) ;
738 RooArgSet obsWithFixedRangeNP(obsWithFixedRange) ;
739 obsWithFixedRangeNP.
remove(obsServingAsRangeParams) ;
742 RooArgSet obsWithParamRangeNP(obsWithParamRange) ;
743 obsWithParamRangeNP.
remove(obsServingAsRangeParams) ;
747 innerObs.
add(obsWithFixedRangeNP) ;
748 innerObs.
add(obsWithParamRangeNP) ;
765 name.Append(
"_Int[") ;
780 name.Append(rangeName) ;
783 }
else if (!omitEmpty) {
784 name.Append(
"_Int[]") ;
787 if (nset && nset->
getSize()>0 ) {
792 name.Append(
"_Norm[") ;
874 assert(0 != dependentIterator);
879 <<
"\" of wrong type: " << arg->
ClassName() << endl;
880 delete dependentIterator;
887 <<
"\" is not a dependent and will be ignored." << endl;
892 leafNodes.
replace(*found,*arg);
894 leafNodes.
add(*arg) ;
904 leafNodes.
add(*lvs) ;
913 if(0 != projectedVars && projectedVars->
find(arg->
GetName())) {
915 <<
"\" cannot be both a dependent and a projected variable." << endl;
916 delete dependentIterator;
922 if(0 != projectedVars) leafNodes.
remove(*projectedVars,
kTRUE);
927 coutE(
Plotting) <<
"RooAbsPdf::createPlotProjection(" <<
GetName() <<
") Couldn't deep-clone PDF, abort," << endl ;
940 delete plotLeafNodes ;
944 if(0 != projectedVars) normSet.
add(*projectedVars);
953 if(0 == projectedVars) projectedVars= ∅
959 title.Prepend(
"Projection of ");
964 if(0 == projected || !projected->
isValid()) {
968 if(0 != projected)
delete projected;
969 delete dependentIterator;
973 projected->
SetName(name.Data()) ;
980 delete dependentIterator;
1016 if(hdim != plotVars.
getSize()) {
1025 for(
Int_t index= 0; index < plotVars.
getSize(); index++) {
1030 <<
"\" of type " << var->
ClassName() << endl;
1035 <<
":fillHistogram: WARNING: variable is not an explicit dependent: " << realVar->
GetName() << endl;
1051 if (projectedVars) {
1052 allDeps.
add(*projectedVars) ;
1066 Int_t xbins(0),ybins(1),zbins(1);
1078 assert(0 != zvar && 0 != zaxis);
1079 if (scaleForDensity) {
1087 assert(0 != yvar && 0 != yaxis);
1088 if (scaleForDensity) {
1096 assert(0 != xvar && 0 != xaxis);
1097 if (scaleForDensity) {
1103 << hdim <<
" dimensions" << endl;
1110 Int_t xbin(0),ybin(0),zbin(0);
1111 Int_t bins= xbins*ybins*zbins;
1112 for(
Int_t bin= 0; bin < bins; bin++) {
1115 if(bin % (xbins*ybins) == 0) {
1121 if(bin % xbins == 0) {
1122 ybin= (ybin%ybins) + 1;
1127 xbin= (xbin%xbins) + 1;
1137 coutW(
Plotting) <<
"WARNING: Function evaluation error(s) at coordinates [x]=" << xvar->
getVal() ;
1210 if (showProgress && (i%onePct==0)) {
1214 Double_t binVal = theClone->
getVal(normSet?normSet:obs)*scaleFactor ;
1215 if (correctForBinSize) {
1242 strlcpy(buf,varNameList,1024) ;
1243 char* varName = strtok(buf,
",:") ;
1248 varName = strtok(0,
",") ;
1250 varName = strtok(0,
",") ;
1339 pc.
defineInt(
"intBinning",
"IntrinsicBinning",0,2) ;
1340 pc.
defineInt(
"extended",
"Extended",0,2) ;
1344 pc.
defineSet(
"projObs",
"ProjectedObservables",0,0) ;
1347 pc.
defineMutex(
"SelectCompSet",
"SelectCompSpec") ;
1349 pc.
defineMutex(
"IntrinsicBinning",
"BinningName") ;
1350 pc.
defineMutex(
"IntrinsicBinning",
"BinningSpec") ;
1378 if (!pdfSelf && doExtended>0) {
1379 coutW(
InputArguments) <<
"RooAbsReal::createHistogram(" <<
GetName() <<
") WARNING extended mode requested for a non-pdf object, ignored" << endl ;
1383 coutW(
InputArguments) <<
"RooAbsReal::createHistogram(" <<
GetName() <<
") WARNING extended mode requested for a non-extendable pdf, ignored" << endl ;
1386 if (pdfSelf && doExtended==2) {
1390 const char* compSpec = pc.
getString(
"compSpec") ;
1392 Bool_t haveCompSel = ( (compSpec && strlen(compSpec)>0) || compSet) ;
1395 if (doIntBinning>0) {
1400 if (doIntBinning==1) {
1402 <<
") WARNING, intrinsic model binning requested for histogram, but model does not define bin boundaries, reverting to default binning"<< endl ;
1405 if (doIntBinning==2) {
1407 <<
") INFO: Model has intrinsic binning definition, selecting that binning for the histogram"<< endl ;
1410 for (list<double>::iterator it=bl->begin() ; it!=bl->end() ; ++it) { ba[i++] = *it ; }
1411 intBinning =
new RooBinning(bl->size()-1,ba) ;
1417 pc.
stripCmdList(argListCreate,
"Scaling,ProjectedObservables,IntrinsicBinning,SelectCompSet,SelectCompSpec,Extended") ;
1422 argListCreate.
Add(&tmp) ;
1440 if (!dynamic_cast<RooAbsReal*>(arg)) {
1441 branchNodeSet.
remove(*arg) ;
1452 if (dirSelNodes->
getSize()>0) {
1453 coutI(
Plotting) <<
"RooAbsPdf::createHistogram(" <<
GetName() <<
") directly selected PDF components: " << *dirSelNodes << endl ;
1459 coutE(
Plotting) <<
"RooAbsPdf::createHistogram(" <<
GetName() <<
") ERROR: component selection set " << *compSet <<
" does not match any components of p.d.f." << endl ;
1461 coutE(
Plotting) <<
"RooAbsPdf::createHistogram(" <<
GetName() <<
") ERROR: component selection expression '" << compSpec <<
"' does not select any components of p.d.f." << endl ;
1465 delete dirSelNodes ;
1503 if (!dynamic_cast<RooAbsReal*>(arg)) {
1504 branchNodeSet.
remove(*arg) ;
1545 selNodes->
add(tmp) ;
1546 coutI(
Plotting) <<
"RooAbsPdf::plotOn(" <<
GetName() <<
") indirectly selected PDF components: " << tmp << endl ;
1705 if (rcmd && TString(rcmd->
getString(0)).Contains(
",")) {
1709 argList.
Add(&rnorm) ;
1711 list<string> rlist ;
1716 char* oneRange = strtok(buf,
",") ;
1718 rlist.push_back(oneRange) ;
1719 oneRange = strtok(0,
",") ;
1722 for (list<string>::iterator riter=rlist.begin() ; riter!=rlist.end() ; ++riter) {
1735 pc.
defineString(
"curveNameSuffix",
"CurveNameSuffix",0,
"") ;
1744 pc.
defineInt(
"doEvalError",
"EvalErrorValue",0,0) ;
1745 pc.
defineInt(
"shiftToZero",
"ShiftToZero",0,0) ;
1750 pc.
defineSet(
"errorPars",
"VisualizeError",0) ;
1751 pc.
defineInt(
"linearMethod",
"VisualizeError",0,0) ;
1752 pc.
defineInt(
"binProjData",
"ProjData",0,0) ;
1755 pc.
defineInt(
"numee",
"PrintEvalErrors",0,10) ;
1756 pc.
defineInt(
"rangeAdjustNorm",
"Range",0,0) ;
1757 pc.
defineInt(
"rangeWNAdjustNorm",
"RangeWithName",0,0) ;
1761 pc.
defineInt(
"lineColor",
"LineColor",0,-999) ;
1762 pc.
defineInt(
"lineStyle",
"LineStyle",0,-999) ;
1763 pc.
defineInt(
"lineWidth",
"LineWidth",0,-999) ;
1764 pc.
defineInt(
"fillColor",
"FillColor",0,-999) ;
1765 pc.
defineInt(
"fillStyle",
"FillStyle",0,-999) ;
1767 pc.
defineInt(
"curveInvisible",
"Invisible",0,0) ;
1768 pc.
defineInt(
"showProg",
"ShowProgress",0,0) ;
1770 pc.
defineInt(
"interleave",
"NumCPU",1,0) ;
1774 pc.
defineInt(
"moveToBack",
"MoveToBack",0,0) ;
1778 pc.
defineMutex(
"VisualizeError",
"VisualizeErrorData") ;
1816 const char* sliceCatState = pc.
getString(
"sliceCatState",0,
kTRUE) ;
1818 if (sliceCatState) {
1827 strlcpy(buf,sliceCatState,1024) ;
1828 const char* slabel = strtok(buf,
",") ;
1840 slabel = strtok(0,
",") ;
1852 if (vlines==2) vlines=0 ;
1858 if (vlines==2) vlines=0 ;
1884 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: have slice " << *sliceSet << endl ;
1891 while((sliceArg=(
RooAbsArg*)iter->Next())) {
1894 projectedVars.
remove(*arg) ;
1897 << sliceArg->
GetName() <<
" was not projected anyway" << endl ;
1901 }
else if (projSet) {
1902 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: have projSet " << *projSet << endl ;
1905 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: have neither sliceSet nor projSet " << endl ;
1910 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Preprocessing: projectedVars = " << projectedVars << endl ;
1976 projDataVars.
add(*tmp) ;
1999 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") frame->getNormVars() that are also observables = " << *sliceSetTmp << endl ;
2012 << frame->
getPlotVar()->
GetName() <<
" represents a slice in " << *sliceSetTmp << endl ;
2014 sliceSet.
add(*sliceSetTmp) ;
2015 delete sliceSetTmp ;
2021 cxcoutD(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") projectedVars = " << projectedVars <<
" sliceSet = " << sliceSet << endl ;
2034 if (!plotCloneSet) {
2035 coutE(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") Couldn't deep-clone self, abort," << endl ;
2041 if (projectedVars.
getSize()) {
2043 <<
" integrates over variables " << projectedVars
2046 if (projDataNeededVars && projDataNeededVars->
getSize()>0) {
2048 <<
" averages using data variables " << *projDataNeededVars << endl ;
2056 if (projDataNeededVars) {
2060 deps->
add(*plotVar) ;
2066 coutE(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") error in checkObservables, abort" << endl ;
2068 delete plotCloneSet ;
2069 if (projDataNeededVars)
delete projDataNeededVars ;
2084 fullNormSet.
add(projectedVars) ;
2085 if (projDataNeededVars && projDataNeededVars->
getSize()>0) {
2086 fullNormSet.
add(*projDataNeededVars) ;
2102 if (o.
projData && projDataNeededVars && projDataNeededVars->
getSize()>0) {
2112 if (sliceDataSet->
getSize()>0) {
2118 cutString.Append(
"&&") ;
2125 if ((real = dynamic_cast<RooAbsRealLValue*>(sliceVar))) {
2127 }
else if ((cat = dynamic_cast<RooAbsCategoryLValue*>(sliceVar))) {
2133 delete sliceDataSet ;
2135 if (!cutString.IsNull()) {
2137 coutI(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") reducing given projection dataset to entries with " << cutString << endl ;
2142 <<
") only the following components of the projection data will be used: " << *projDataNeededVars << endl ;
2146 if (!o.
binProjData && dynamic_cast<RooDataSet*>(projDataSel)!=0) {
2153 if (!dynamic_cast<RooCategory*>(arg2)) allCat =
kFALSE ;
2158 coutI(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") unbinned projection dataset consist only of discrete variables," 2159 <<
" performing projection with binned copy for optimization." << endl ;
2167 if (projDataSel!=o.
projData)
delete projDataSel ;
2174 projection->
getVal(projDataSel->
get()) ;
2194 TString curveName(projection->
GetName()) ;
2211 curve->
SetName(curveName.Data()) ;
2232 if (projDataSel!=o.
projData)
delete projDataSel ;
2272 TString curveName(projection->
GetName()) ;
2280 curve->
SetName(curveName.Data()) ;
2301 if (projDataNeededVars)
delete projDataNeededVars ;
2303 delete projectionCompList ;
2304 delete plotCloneSet ;
2323 while((sliceArg=(
RooAbsArg*)iter->Next())) {
2326 projectedVars.
remove(*arg) ;
2329 << sliceArg->
GetName() <<
" was not projected anyway" << endl ;
2372 projDataVars.
add(*tmp) ;
2382 <<
") function doesn't depend on asymmetry category " << asymCat.
GetName() << endl ;
2389 <<
") asymmetry category must have 2 or 3 states with index values -1,0,1" << endl ;
2413 << frame->
getPlotVar()->
GetName() <<
" represents a slice in " << *sliceSetTmp << endl ;
2415 sliceSet.
add(*sliceSetTmp) ;
2416 delete sliceSetTmp ;
2440 if (projectedVars.
getSize()) {
2442 <<
" projects variables " << projectedVars << endl ;
2444 if (projDataNeededVars && projDataNeededVars->getSize()>0) {
2446 <<
" averages using data variables "<< *projDataNeededVars << endl ;
2465 RooArgSet *posProjCompList, *negProjCompList ;
2471 depPos.
add(projDataVars) ;
2472 depNeg.
add(projDataVars) ;
2476 if (!posProj || !negProj) {
2477 coutE(
Plotting) <<
"RooAbsReal::plotAsymOn(" <<
GetName() <<
") Unable to create projections, abort" << endl ;
2483 asymName.Append(
"_Asym[") ;
2484 asymName.Append(asymCat.
GetName()) ;
2485 asymName.Append(
"]") ;
2486 TString asymTitle(asymCat.
GetName()) ;
2487 asymTitle.Append(
" Asymmetry of ") ;
2500 if (sliceDataSet->
getSize()>0) {
2506 cutString.Append(
"&&") ;
2513 if ((real = dynamic_cast<RooAbsRealLValue*>(sliceVar))) {
2515 }
else if ((cat = dynamic_cast<RooAbsCategoryLValue*>(sliceVar))) {
2521 delete sliceDataSet ;
2523 if (!cutString.IsNull()) {
2526 <<
") reducing given projection dataset to entries with " << cutString << endl ;
2531 <<
") only the following components of the projection data will be used: " << *projDataNeededVars << endl ;
2541 ((
RooAbsReal*)posProj)->attachDataSet(*projDataSel) ;
2542 ((
RooAbsReal*)negProj)->attachDataSet(*projDataSel) ;
2553 TString curveName(funcAsym->
GetName()) ;
2576 if (projDataSel!=o.
projData)
delete projDataSel ;
2595 TString curveName(funcAsym->
GetName()) ;
2603 curve->
SetName(curveName.Data()) ;
2615 delete posProjCompList ;
2616 delete negProjCompList ;
2649 vector<int> fpf_idx ;
2653 paramList.
add(*par) ;
2654 fpf_idx.push_back(i) ;
2658 vector<Double_t> plusVar, minusVar ;
2665 for (
Int_t ivar=0 ; ivar<paramList.
getSize() ; ivar++) {
2673 ((
RooRealVar*)paramList.
at(ivar))->setVal(cenVal+errVal) ;
2674 plusVar.push_back(cloneFunc->
getVal(nset)) ;
2677 ((
RooRealVar*)paramList.
at(ivar))->setVal(cenVal-errVal) ;
2678 minusVar.push_back(cloneFunc->
getVal(nset)) ;
2684 vector<double> errVec(paramList.
getSize()) ;
2685 for (
int i=0 ; i<paramList.
getSize() ; i++) {
2686 errVec[i] =
sqrt(V(i,i)) ;
2687 for (
int j=i ; j<paramList.
getSize() ; j++) {
2688 C(i,j) = V(i,j)/
sqrt(V(i,i)*V(j,j)) ;
2695 for (
unsigned int j=0 ; j<plusVar.size() ; j++) {
2696 F[j] = (plusVar[j]-minusVar[j])/2 ;
2703 delete errorParams ;
2745 pc.
stripCmdList(plotArgListTmp,
"VisualizeError,MoveToBack") ;
2752 if (std::string(
"Normalization")==cmd->
GetName()) {
2755 plotArgList.
Add(cmd) ;
2758 plotArgList.
Add(cmd) ;
2785 coutI(
Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") INFO: visualizing " << Z <<
"-sigma uncertainties in parameters " 2786 << *errorParams <<
" from fit result " << fr.
GetName() <<
" using " << n <<
" samplings." << endl ;
2791 RooDataSet* d = paramPdf->generate(*errorParams,n) ;
2792 vector<RooCurve*> cvec ;
2794 *cloneParams = (*d->
get(i)) ;
2796 cloneFunc->
plotOn(frame,tmp2) ;
2797 cvec.push_back(frame->
getCurve()) ;
2810 for (vector<RooCurve*>::iterator i=cvec.begin() ; i!=cvec.end() ; i++) {
2835 vector<int> fpf_idx ;
2839 paramList.add(*par) ;
2840 fpf_idx.push_back(i) ;
2844 vector<RooCurve*> plusVar, minusVar ;
2853 for (
Int_t ivar=0 ; ivar<paramList.getSize() ; ivar++) {
2861 ((
RooRealVar*)paramList.at(ivar))->setVal(cenVal+Z*errVal) ;
2865 cloneFunc->
plotOn(frame,tmp2) ;
2866 plusVar.push_back(frame->
getCurve()) ;
2871 ((
RooRealVar*)paramList.at(ivar))->setVal(cenVal-Z*errVal) ;
2873 cloneFunc->
plotOn(frame,tmp3) ;
2874 minusVar.push_back(frame->
getCurve()) ;
2877 ((
RooRealVar*)paramList.at(ivar))->setVal(cenVal) ;
2881 vector<double> errVec(paramList.getSize()) ;
2882 for (
int i=0 ; i<paramList.getSize() ; i++) {
2883 errVec[i] =
sqrt(V(i,i)) ;
2884 for (
int j=i ; j<paramList.getSize() ; j++) {
2885 C(i,j) = V(i,j)/
sqrt(V(i,i)*V(j,j)) ;
2895 for (vector<RooCurve*>::iterator i=plusVar.begin() ; i!=plusVar.end() ; i++) {
2898 for (vector<RooCurve*>::iterator i=minusVar.begin() ; i!=minusVar.end() ; i++) {
2905 if (!band)
return frame ;
2909 pc.
defineString(
"curveNameSuffix",
"CurveNameSuffix",0,
"") ;
2910 pc.
defineInt(
"lineColor",
"LineColor",0,-999) ;
2911 pc.
defineInt(
"lineStyle",
"LineStyle",0,-999) ;
2912 pc.
defineInt(
"lineWidth",
"LineWidth",0,-999) ;
2913 pc.
defineInt(
"fillColor",
"FillColor",0,-999) ;
2914 pc.
defineInt(
"fillStyle",
"FillStyle",0,-999) ;
2916 pc.
defineInt(
"curveInvisible",
"Invisible",0,0) ;
2917 pc.
defineInt(
"moveToBack",
"MoveToBack",0,0) ;
2978 <<
":plotOn: frame does not specify a plot variable" << endl;
2983 if(!dynamic_cast<RooAbsRealLValue*>(var)) {
3013 <<
" allVars = " << (allVars?(*allVars):
RooArgSet()) << endl ;
3019 projectedVars.
add(*allVars) ;
3024 projectedVars.
remove(*found);
3034 <<
" from projection set because it a server of " << plotVar->
GetName() << endl ;
3035 projectedVars.
remove(*tmp) ;
3039 delete plotServers ;
3043 <<
") WARNING: cannot project out frame variable (" 3044 << found->
GetName() <<
"), ignoring" << endl ;
3056 <<
") function doesn't depend on projection variable " 3057 << arg->
GetName() <<
", ignoring" << endl ;
3096 if(binding && !binding->
isValid()) {
3120 }
else if (source->
getAttribute(
"INTEGER_TREE_BRANCH")) {
3126 }
else if (source->
getAttribute(
"SIGNEDBYTE_TREE_BRANCH")) {
3128 }
else if (source->
getAttribute(
"UNSIGNED_INTEGER_TREE_BRANCH")) {
3166 TBranch* branch = t.GetBranch(cleanName) ;
3177 <<
" is an array and cannot be attached to a RooAbsReal" << endl ;
3183 if (!typeName.CompareTo(
"Float_t")) {
3185 <<
" will be converted to double precision" << endl ;
3189 }
else if (!typeName.CompareTo(
"Int_t")) {
3191 <<
" will be converted to double precision" << endl ;
3194 t.SetBranchAddress(cleanName,&
_intValue) ;
3195 }
else if (!typeName.CompareTo(
"UChar_t")) {
3197 <<
" will be converted to double precision" << endl ;
3201 }
else if (!typeName.CompareTo(
"Bool_t")) {
3203 <<
" will be converted to double precision" << endl ;
3207 }
else if (!typeName.CompareTo(
"Char_t")) {
3209 <<
" will be converted to double precision" << endl ;
3213 }
else if (!typeName.CompareTo(
"UInt_t")) {
3215 <<
" will be converted to double precision" << endl ;
3219 }
else if (!typeName.CompareTo(
"Double_t")) {
3220 t.SetBranchAddress(cleanName,&
_value) ;
3222 coutE(
InputArguments) <<
"RooAbsReal::attachToTree(" <<
GetName() <<
") data type " << typeName <<
" is not supported" << endl ;
3234 TString
format(cleanName);
3235 format.Append(
"/D");
3236 branch = t.Branch(cleanName, &
_value, (
const Text_t*)format, bufSize);
3394 const TList &nameList)
const 3403 matched.
add(*found);
3417 if(isMatched) matchedArgs.
add(matched);
3466 if (config)
return config ;
3479 if (config)
return config ;
3591 if (inLogEvalError) {
3594 inLogEvalError =
kTRUE ;
3599 if (serverValueString) {
3604 oocoutE((
TObject*)0,
Eval) <<
"RooAbsReal::logEvalError(" <<
"<STATIC>" <<
") evaluation error, " << endl
3605 <<
" origin : " << origName << endl
3606 <<
" message : " << ee.
_msg << endl
3607 <<
" server values: " << ee.
_srvval << endl ;
3614 inLogEvalError =
kFALSE ;
3646 if (inLogEvalError) {
3649 inLogEvalError =
kTRUE ;
3654 if (serverValueString) {
3674 ostringstream oss2 ;
3678 coutE(
Eval) <<
"RooAbsReal::logEvalError(" <<
GetName() <<
") evaluation error, " << endl
3679 <<
" origin : " << oss2.str() << endl
3680 <<
" message : " << ee.
_msg << endl
3681 <<
" server values: " << ee.
_srvval << endl ;
3690 <<
") delayed evaluation error, " << endl
3691 <<
" origin : " << oss2.str() << endl
3692 <<
" message : " << oee.
_msg << endl
3693 <<
" server values: " << oee.
_srvval << endl ;
3700 inLogEvalError =
kFALSE ;
3736 if (maxPerNode<0)
return ;
3738 map<const RooAbsArg*,pair<string,list<EvalError> > >::iterator iter =
_evalErrorList.begin() ;
3741 if (maxPerNode==0) {
3744 os << iter->second.first ;
3746 os <<
" has " << iter->second.second.size() <<
" errors" << endl ;
3751 os << iter->second.first << endl ;
3755 std::list<EvalError>::iterator iter2 = iter->second.second.begin() ;
3756 for(;iter2!=iter->second.second.end() ; ++iter2, i++) {
3757 os <<
" " << iter2->_msg <<
" @ " << iter2->_srvval << endl ;
3759 os <<
" ... (remaining " << iter->second.second.size() - maxPerNode <<
" messages suppressed)" << endl ;
3779 map<const RooAbsArg*,pair<string,list<EvalError> > >::iterator iter =
_evalErrorList.begin() ;
3781 ntot += iter->second.second.size() ;
3856 orderedObs.
add(obs) ;
3916 pc.
defineInt(
"numScanBins",
"ScanParameters",0,1000) ;
3917 pc.
defineInt(
"intOrder",
"ScanParameters",1,2) ;
3918 pc.
defineInt(
"doScanNum",
"ScanNum",0,1) ;
3919 pc.
defineInt(
"doScanAll",
"ScanAll",0,0) ;
3920 pc.
defineInt(
"doScanNon",
"ScanNone",0,0) ;
3924 pc.
process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
3954 coutI(
NumIntegration) <<
"RooAbsPdf::createRunningIntegral(" <<
GetName() <<
") integration over observable(s) " << iset <<
" involves numeric integration," << endl
3955 <<
" constructing cdf though numeric integration of sampled pdf in " << numScanBins <<
" bins and applying order " 3956 << intOrder <<
" interpolation on integrated histogram." << endl
3957 <<
" To override this choice of technique use argument ScanNone(), to change scan parameters use ScanParameters(nbins,order) argument" << endl ;
3975 ivar->
setBins(numScanBins,
"numcdf") ;
3995 if (dynamic_cast<RooRealVar*>(arg)) {
4019 cloneList.
add(*cloneArg) ;
4025 loList.
add(*cloneLo) ;
4058 coutE(
InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified observables are not variables of this p.d.f" << endl ;
4064 coutE(
InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified parameters are not variables of this p.d.f" << endl ;
4085 coutE(
InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified observables are not variables of this p.d.f" << endl ;
4091 coutE(
InputArguments) <<
"RooAbsReal::functor(" <<
GetName() <<
") ERROR: one or more specified parameters are not variables of this p.d.f" << endl ;
4099 for (
int i=0 ; i<obs.
getSize() ; i++) {
4100 if (dynamic_cast<RooRealVar*>(obs.
at(i))==0) {
4105 for (
int i=0 ; i<pars.
getSize() ; i++) {
4106 if (dynamic_cast<RooRealVar*>(pars.
at(i))==0) {
4139 <<
" observables specified, but a ROOT TFx can only have 1,2 or 3 observables" << endl ;
4144 for (
int i=0 ; i<pars.
getSize() ; i++) {
4162 return new RooDerivative(name.c_str(),title.c_str(),*
this,obs,order,eps) ;
4174 return new RooDerivative(name.c_str(),title.c_str(),*
this,obs,normSet,order,eps) ;
4186 string title=
Form(
"%sMoment of order %d of %s w.r.t %s ",(central?
"Central ":
""),order,
GetName(),obs.
GetName()) ;
4187 if (order==1)
return new RooFirstMoment(name.c_str(),title.c_str(),*
this,obs) ;
4188 if (order==2)
return new RooSecondMoment(name.c_str(),title.c_str(),*
this,obs,central,takeRoot) ;
4189 return new RooMoment(name.c_str(),title.c_str(),*
this,obs,order,central,takeRoot) ;
4201 string title=
Form(
"%sMoment of order %d of %s w.r.t %s ",(central?
"Central ":
""),order,
GetName(),obs.
GetName()) ;
4203 if (order==1)
return new RooFirstMoment(name.c_str(),title.c_str(),*
this,obs,normObs,intNormObs) ;
4204 if (order==2)
return new RooSecondMoment(name.c_str(),title.c_str(),*
this,obs,normObs,central,takeRoot,intNormObs) ;
4205 return new RooMoment(name.c_str(),title.c_str(),*
this,obs,normObs,order,central,takeRoot,intNormObs) ;
4337 return new RooChi2Var(name.c_str(),name.c_str(),*
this,
data,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
4361 return createChi2(data,*cmds[0],*cmds[1],*cmds[2],*cmds[3],*cmds[4],*cmds[5],*cmds[6],*cmds[7]) ;
4480 pc.
defineInt(
"integrate",
"Integrate",0,0) ;
4496 return new RooXYChi2Var(name.c_str(),name.c_str(),*
this,
data,*yvar,integrate) ;
4517 pc.
defineInt(
"optConst",
"Optimize",0,1) ;
4521 pc.
defineInt(
"plevel",
"PrintLevel",0,1) ;
4523 pc.
defineInt(
"initHesse",
"InitialHesse",0,0) ;
4527 pc.
defineInt(
"numee",
"PrintEvalErrors",0,10) ;
4549 #ifdef __ROOFIT_NOROOMINIMIZER 4550 const char* minType =0 ;
4552 const char* minType = pc.
getString(
"mintype",
"Minuit") ;
4553 const char* minAlg = pc.
getString(
"minalg",
"minuit") ;
4570 #ifdef __ROOFIT_NOROOMINIMIZER 4573 if (
"OldMinuit" ==
string(minType)) {
4595 ret = m.
fit(fitOpt) ;
4629 m.
minos(*minosSet) ;
4638 string title =
Form(
"Result of fit of %s ",
GetName()) ;
4639 ret = m.
save(name.c_str(),title.c_str()) ;
4644 #ifndef __ROOFIT_NOROOMINIMIZER 4666 ret = m.
fit(fitOpt) ;
4700 m.
minos(*minosSet) ;
4709 string title =
Form(
"Result of fit of %s ",
GetName()) ;
4710 ret = m.
save(name.c_str(),title.c_str()) ;
4752 while((arg=iter.
next())) {
4755 <<
") function does not depend on listed parameter " << arg->
GetName() <<
", ignoring" << endl ;
4758 if (plist.size()>0) plist +=
":" ;
virtual Double_t getMin(const char *name=0) const
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
static RooNumIntConfig & defaultConfig()
Return reference to instance of default numeric integrator configuration object.
virtual const char * GetName() const
Returns name of object.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual RooAbsArg * cloneTree(const char *newname=0) const
Clone tree expression of objects.
void setInterpolationOrder(Int_t order)
Set interpolation order of RooHistFunct representing cache histogram.
TIterator * createIterator(Bool_t dir=kIterForward) const
Bool_t postRangeFracScale
const char * getString(Int_t idx) const
static long int sum(long int i)
static void globalSelectComp(Bool_t flag)
Global switch controlling the activation of the selectComp() functionality.
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer, which is interpreted as an OR of 'enum ContentsOptions' values and in the style given by 'enum StyleOption'.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
void treeNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=0, Bool_t doBranch=kTRUE, Bool_t doLeaf=kTRUE, Bool_t valueOnly=kFALSE, Bool_t recurseNonDerived=kFALSE) const
Fill supplied list with nodes of the arg tree, following all server links, starting with ourself as t...
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg(), const RooCmdArg &arg10=RooCmdArg()) const
Plot (project) PDF on specified frame.
TObject * FindObject(const char *name) const
Return pointer to obejct with given name.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
void setServerValues(const char *tmp)
void setPrintEvalErrors(Int_t numEvalErrors)
A RooCurve is a one-dimensional graphical representation of a real-valued function.
static EvalErrorIter evalErrorIter()
Bool_t _boolValue
Transient cache for integer values from tree branches.
const RooArgList & floatParsFinal() const
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
virtual Double_t getMax(const char *name=0) const
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
virtual const RooArgSet * get() const
void setVerbose(Bool_t flag=kTRUE)
TMatrixDSym reducedCovarianceMatrix(const RooArgList ¶ms) const
Return a reduced covariance matrix (Note that Vred is a simple sub-matrix of V, row/columns are order...
void optimizeConst(Int_t flag)
If flag is true, perform constant term optimization on function being minimized.
virtual TObject * clone(const char *newname) const
const char * addToCurveName
Bool_t dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0, Bool_t valueOnly=kFALSE) const
Test whether we depend on (ie, are served by) any object in the specified collection.
virtual void SetParName(Int_t ipar, const char *name)
Set name of parameter number ipar.
void sort(Bool_t ascend=kTRUE)
const Text_t * getUnit() const
void plotOnCompSelect(RooArgSet *selNodes) const
Helper function for plotting of composite p.d.fs.
static RooNumIntConfig * defaultIntegratorConfig()
Returns the default numeric integration configuration for all RooAbsReals.
Class RooProfileLL implements the profile likelihood estimator for a given likelihood and set of para...
Bool_t defineDouble(const char *name, const char *argName, Int_t doubleNum, Double_t defValue=0.)
Define Double_t property name 'name' mapped to Double_t in slot 'doubleNum' in RooCmdArg with name ar...
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Collectable string class.
virtual const RooArgSet * get() const
void setPlotLabel(const char *label)
Set the label associated with this variable.
RooCmdArg ZVar(const RooAbsRealLValue &var, const RooCmdArg &arg=RooCmdArg::none())
Int_t GetCompressionLevel() const
void leafNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=0, Bool_t recurseNonDerived=kFALSE) const
Fill supplied list with all leaf nodes of the arg tree, starting with ourself as top node...
virtual Double_t evaluate() const =0
RooAbsCollection * selectCommon(const RooAbsCollection &refColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const
Interface function to check if given value is a valid value for this object.
Bool_t matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
virtual TObject * Clone(const char *newName=0) const
Make a clone of an object using the Streamer facility.
Int_t hesse()
Execute HESSE.
const char * getString(const char *name, const char *defaultValue="", Bool_t convEmptyToNull=kFALSE)
Return string property registered with name 'name'.
virtual Bool_t isParameterized() const
virtual Bool_t replace(const RooAbsArg &var1, const RooAbsArg &var2)
Replace var1 with var2 and return kTRUE for success.
Double_t getVal(const RooArgSet *set=0) const
Bool_t matchArgsByName(const RooArgSet &allArgs, RooArgSet &matchedArgs, const TList &nameList) const
Check if allArgs contains matching elements for each name in nameList.
void setString(Int_t idx, const char *value)
const TMatrixDSym & covarianceMatrix() const
Return covariance matrix.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported...
Lightweight interface adaptor that exports a RooAbsReal as a ROOT::Math::IMultiGenFunction.
RooFirstMoment represents the first, second, or third order derivative of any RooAbsReal as calculate...
virtual const char * GetTypeName() const
RooAbsMoment * moment(RooRealVar &obs, Int_t order, Bool_t central, Bool_t takeRoot)
Return function representing moment of function of given order.
virtual TLeaf * GetLeafCounter(Int_t &countval) const
Return a pointer to the counter of this leaf.
Class RooNumRunningInt is an implementation of RooAbsCachedReal that represents a running integral t...
void setBuffer(RooAbsReal *real, Double_t *newBuf)
RooAbsArg * createFundamental(const char *newname=0) const
Create a RooRealVar fundamental object with our properties.
void set(Double_t weight, Double_t wgtErr=-1)
Increment the weight of the bin enclosing the coordinates given by 'row' by the specified amount...
void addPlotable(RooPlotable *plotable, Option_t *drawOptions="", Bool_t invisible=kFALSE, Bool_t refreshNorm=kFALSE)
Add the specified plotable object to our plot.
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Double_t traceEval(const RooArgSet *set) const
Calculate current value of object, with error tracing wrapper.
void SetCompressionLevel(Int_t level=1)
Set compression level.
static std::map< const RooAbsArg *, std::pair< std::string, std::list< EvalError > > > _evalErrorList
Int_t minos()
Execute MINOS.
virtual Int_t GetNbinsZ() const
Bool_t defineSet(const char *name, const char *argName, Int_t setNum, const RooArgSet *set=0)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
TString getTitle(Bool_t appendUnit=kFALSE) const
Return this variable's title string.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
friend class RooRealIntegral
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
virtual RooAbsReal * createChi2(RooDataHist &data, const RooLinkedList &cmdList)
Internal back-end function to create a chi2.
void setNameList(const char *givenList)
virtual void selectNormalization(const RooArgSet *depSet=0, Bool_t force=kFALSE)
Interface function to force use of a given set of observables to interpret function value...
static Int_t numEvalErrorItems()
RooFIter fwdIterator() const
void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Driver function to propagate constant term optimizations in test statistic.
RooAbsData * reduce(const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg())
Create a reduced copy of this dataset.
TAttFill * getAttFill(const char *name=0) const
Return a pointer to the fill attributes of the named object in this plot, or zero if the named object...
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void fixAddCoefRange(const char *rangeName=0, Bool_t force=kTRUE)
Fix the interpretation of the coefficient of any RooAddPdf component in the expression tree headed by...
void allowUndefined(Bool_t flag=kTRUE)
RooAbsReal * createScanRI(const RooArgSet &iset, const RooArgSet &nset, Int_t numScanBins, Int_t intOrder)
Utility function for createRunningIntegral that construct an object implementing the numeric scanning...
virtual Int_t getIndex() const
Return index number of current state.
Bool_t isValueDirtyAndClear() const
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
Int_t migrad()
Execute MIGRAD.
void setStrategy(Int_t strat)
Change MINUIT strategy to istrat.
static std::string format(double x, double y, int digits, int width)
TObject * At(Int_t idx) const
RooAbsMoment represents the first, second, or third order derivative of any RooAbsReal as calculated ...
TObject * getObject(const char *name, TObject *obj=0)
Return TObject property registered with name 'name'.
RooCmdArg SupNormSet(const RooArgSet &nset)
static void setHideOffset(Bool_t flag)
void attachDataSet(const RooAbsData &set)
Replace server nodes with names matching the dataset variable names with those data set variables...
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)
Copy the cached value of another RooAbsArg to our cache.
virtual RooPlot * plotAsymOn(RooPlot *frame, const RooAbsCategoryLValue &asymCat, PlotOpt o) const
Iterator abstract base class.
virtual ~RooAbsReal()
Destructor.
void setMinimizerType(const char *type)
Choose the minimzer algorithm.
Double_t findRoot(RooRealVar &x, Double_t xmin, Double_t xmax, Double_t yval)
Return value of x (in range xmin,xmax) at which function equals yval.
RooAbsReal * createRunningIntegral(const RooArgSet &iset, const RooArgSet &nset=RooArgSet())
Create a running integral over this function, i.e.
void setStrategy(Int_t strat)
Change MINUIT strategy to istrat.
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)
Set value by specifying the name of the desired state If printError is set, a message will be printed...
virtual Bool_t isValid() const
Check if current value is valid.
const char * curveNameSuffix
void setValueDirty() const
RooDataHist * fillDataHist(RooDataHist *hist, const RooArgSet *nset, Double_t scaleFactor, Bool_t correctForBinVolume=kFALSE, Bool_t showProgress=kFALSE) const
Fill a RooDataHist with values sampled from this function at the bin centers.
Bool_t process(const RooCmdArg &arg)
Process given RooCmdArg.
static const RooCmdArg & none()
Return reference to null argument.
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
RooAbsReal * createIntRI(const RooArgSet &iset, const RooArgSet &nset=RooArgSet())
Utility function for createRunningIntegral that construct an object implementing the standard (analyt...
const char * normRange() const
virtual Int_t GetDimension() const
friend class RooRealBinding
void setVerbose(Bool_t flag=kTRUE)
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
void setBinning(const RooAbsBinning &binning, const char *name=0)
Add given binning under name 'name' with this variable.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
const char * normRangeName
RooDataSet is a container class to hold N-dimensional binned data.
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects The class perfor...
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from stream (dummy for now)
RooAbsPdf * createHessePdf(const RooArgSet ¶ms) const
Return a p.d.f that represents the fit result as a multi-variate probability densisty function on the...
void findInnerMostIntegration(const RooArgSet &allObs, RooArgSet &innerObs, const char *rangeName) const
Utility function for createIntObj() that aids in the construct of recursive integrals over functions ...
virtual Double_t getValV(const RooArgSet *set=0) const
Return value of object.
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
TH1 * createHistogram(const char *name, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
Int_t _intValue
Transient cache for floating point values from tree branches.
void removeRange(const char *name=0)
TH1 * createHistogram(const char *varNameList, Int_t xbins=0, Int_t ybins=0, Int_t zbins=0) const
Create and fill a ROOT histogram TH1,TH2 or TH3 with the values of this function for the variables wi...
double cdf(double *x, double *p)
RooVectorDataStore is the abstract base class for data collection that use a TTree as internal storag...
<