23 #ifndef RooStats_MCMCInterval
26 #ifndef ROOSTATS_MarkovChain
29 #ifndef RooStats_Heaviside
41 #ifndef RooStats_RooStatsUtils
50 #ifndef ROOT_TIterator
65 #ifndef ROO_MSG_SERVICE
68 #ifndef ROO_GLOBAL_FUNC
74 #ifndef ROOT_THnSparse
90 using namespace RooFit;
91 using namespace RooStats;
97 MCMCInterval::MCMCInterval(
const char* name)
100 fConfidenceLevel = 0.0;
101 fHistConfLevel = 0.0;
102 fKeysConfLevel = 0.0;
113 fKeysDataHist =
NULL;
122 fIsHistStrict =
kTRUE;
125 fIntervalType = kShortest;
132 MCMCInterval::MCMCInterval(
const char* name,
136 fConfidenceLevel = 0.0;
137 fHistConfLevel = 0.0;
138 fKeysConfLevel = 0.0;
149 fKeysDataHist =
NULL;
156 fIsHistStrict =
kTRUE;
160 fIntervalType = kShortest;
167 MCMCInterval::~MCMCInterval()
179 delete fKeysDataHist;
183 struct CompareDataHistBins {
184 CompareDataHistBins(
RooDataHist* hist) : fDataHist(hist) {}
186 fDataHist->get(bin1);
188 fDataHist->get(bin2);
195 struct CompareSparseHistBins {
196 CompareSparseHistBins(
THnSparse* hist) : fSparseHist(hist) {}
198 Double_t n1 = fSparseHist->GetBinContent(bin1);
199 Double_t n2 = fSparseHist->GetBinContent(bin2);
205 struct CompareVectorIndices {
207 fChain(chain), fParam(param) {}
209 Double_t xi = fChain->Get(i)->getRealValue(fParam->GetName());
210 Double_t xj = fChain->Get(j)->getRealValue(fParam->GetName());
225 if (fIntervalType == kShortest) {
227 if (fKeysPdf ==
NULL)
232 return fKeysPdf->getVal(&fParameters) >= fKeysCutoff;
234 if (fUseSparseHist) {
235 if (fSparseHist ==
NULL)
241 const_cast<RooArgSet*>(&fParameters));
245 for (
Int_t i = 0; i < fDimension; i++)
246 x[i] = fAxes[i]->getVal();
247 bin = fSparseHist->GetBin(x,
kFALSE);
250 return (weight >= (
Double_t)fHistCutoff);
252 if (fDataHist ==
NULL)
258 bin = fDataHist->getIndex(point);
260 return (fDataHist->weight() >= (
Double_t)fHistCutoff);
263 }
else if (fIntervalType == kTailFraction) {
264 if (fVector.size() == 0)
269 if (fTFLower <= x && x <= fTFUpper)
276 <<
"Interval type not set. Returning false." << endl;
280 void MCMCInterval::SetConfidenceLevel(
Double_t cl)
282 fConfidenceLevel = cl;
311 if (size != fDimension) {
313 "number of variables in axes (" << size <<
314 ") doesn't match number of parameters ("
315 << fDimension <<
")" << endl;
318 for (
Int_t i = 0; i < size; i++)
322 void MCMCInterval::CreateKeysPdf()
327 if (fAxes ==
NULL || fParameters.getSize() == 0) {
329 <<
"parameters have not been set." << endl;
333 if (fNumBurnInSteps >= fChain->Size()) {
335 "MCMCInterval::CreateKeysPdf: creation of Keys PDF failed: " <<
336 "Number of burn-in steps (num steps to ignore) >= number of steps " <<
337 "in Markov chain." << endl;
352 for (
Int_t i = 0; i < fDimension; i++)
353 paramsList->
add(*fAxes[i]);
357 fKeysPdf =
new RooNDKeysPdf(
"keysPDF",
"Keys PDF", *paramsList, *chain,
"a");
358 fCutoffVar =
new RooRealVar(
"cutoff",
"cutoff", 0);
359 fHeaviside =
new Heaviside(
"heaviside",
"Heaviside", *fKeysPdf, *fCutoffVar);
360 fProduct =
new RooProduct(
"product",
"Keys PDF & Heaviside Product",
364 void MCMCInterval::CreateHist()
366 if (fAxes ==
NULL || fChain ==
NULL) {
367 coutE(
Eval) <<
"* Error in MCMCInterval::CreateHist(): " <<
368 "Crucial data member was NULL." << endl;
369 coutE(
Eval) <<
"Make sure to fully construct/initialize." << endl;
375 if (fNumBurnInSteps >= fChain->Size()) {
377 "MCMCInterval::CreateHist: creation of histogram failed: " <<
378 "Number of burn-in steps (num steps to ignore) >= number of steps " <<
379 "in Markov chain." << endl;
385 fHist =
new TH1F(
"posterior",
"MCMC Posterior Histogram",
386 fAxes[0]->numBins(), fAxes[0]->getMin(), fAxes[0]->getMax());
388 else if (fDimension == 2)
389 fHist =
new TH2F(
"posterior",
"MCMC Posterior Histogram",
390 fAxes[0]->numBins(), fAxes[0]->getMin(), fAxes[0]->getMax(),
391 fAxes[1]->numBins(), fAxes[1]->getMin(), fAxes[1]->getMax());
393 else if (fDimension == 3)
394 fHist =
new TH3F(
"posterior",
"MCMC Posterior Histogram",
395 fAxes[0]->numBins(), fAxes[0]->getMin(), fAxes[0]->getMax(),
396 fAxes[1]->numBins(), fAxes[1]->getMin(), fAxes[1]->getMax(),
397 fAxes[2]->numBins(), fAxes[2]->getMin(), fAxes[2]->getMax());
400 coutE(
Eval) <<
"* Error in MCMCInterval::CreateHist() : " <<
401 "TH1* couldn't handle dimension: " << fDimension << endl;
406 Int_t size = fChain->Size();
408 for (
Int_t i = fNumBurnInSteps; i < size; i++) {
409 entry = fChain->Get(i);
411 ((TH1F*)fHist)->Fill(entry->
getRealValue(fAxes[0]->GetName()),
413 else if (fDimension == 2)
414 ((TH2F*)fHist)->Fill(entry->
getRealValue(fAxes[0]->GetName()),
425 fHist->GetXaxis()->SetTitle(fAxes[0]->GetName());
427 fHist->GetYaxis()->SetTitle(fAxes[1]->GetName());
429 fHist->GetZaxis()->SetTitle(fAxes[2]->GetName());
432 void MCMCInterval::CreateSparseHist()
434 if (fAxes ==
NULL || fChain ==
NULL) {
436 <<
"Crucial data member was NULL." << endl;
441 if (fSparseHist !=
NULL)
447 for (
Int_t i = 0; i < fDimension; i++) {
448 min[i] = fAxes[i]->getMin();
449 max[i] = fAxes[i]->getMax();
450 bins[i] = fAxes[i]->numBins();
452 fSparseHist =
new THnSparseF(
"posterior",
"MCMC Posterior Histogram",
453 fDimension, bins, min, max);
462 fSparseHist->Sumw2();
464 if (fNumBurnInSteps >= fChain->Size()) {
466 "MCMCInterval::CreateSparseHist: creation of histogram failed: " <<
467 "Number of burn-in steps (num steps to ignore) >= number of steps " <<
468 "in Markov chain." << endl;
472 Int_t size = fChain->Size();
475 for (
Int_t i = fNumBurnInSteps; i < size; i++) {
476 entry = fChain->Get(i);
479 fSparseHist->Fill(x, fChain->Weight());
484 void MCMCInterval::CreateDataHist()
486 if (fParameters.getSize() == 0 || fChain ==
NULL) {
487 coutE(
Eval) <<
"* Error in MCMCInterval::CreateDataHist(): " <<
488 "Crucial data member was NULL or empty." << endl;
489 coutE(
Eval) <<
"Make sure to fully construct/initialize." << endl;
493 if (fNumBurnInSteps >= fChain->Size()) {
495 "MCMCInterval::CreateDataHist: creation of histogram failed: " <<
496 "Number of burn-in steps (num steps to ignore) >= number of steps " <<
497 "in Markov chain." << endl;
502 fDataHist = fChain->GetAsDataHist(
SelectVars(fParameters),
506 void MCMCInterval::CreateVector(
RooRealVar* param)
511 if (fChain ==
NULL) {
513 "Crucial data member (Markov chain) was NULL." << endl;
519 if (fNumBurnInSteps >= fChain->Size()) {
521 "MCMCInterval::CreateVector: creation of vector failed: " <<
522 "Number of burn-in steps (num steps to ignore) >= number of steps " <<
523 "in Markov chain." << endl;
527 Int_t size = fChain->Size() - fNumBurnInSteps;
528 fVector.resize(size);
531 for (i = 0; i < size; i++) {
532 chainIndex = i + fNumBurnInSteps;
533 fVector[i] = chainIndex;
534 fVecWeight += fChain->Weight(chainIndex);
537 stable_sort(fVector.begin(), fVector.end(),
538 CompareVectorIndices(fChain, param));
543 fParameters.removeAll();
544 fParameters.add(parameters);
545 fDimension = fParameters.getSize();
549 TIterator* it = fParameters.createIterator();
552 while ((obj = it->
Next()) !=
NULL) {
553 if (dynamic_cast<RooRealVar*>(obj) !=
NULL)
556 coutE(
Eval) <<
"* Error in MCMCInterval::SetParameters: " <<
557 obj->
GetName() <<
" not a RooRealVar*" << std::endl;
563 void MCMCInterval::DetermineInterval()
565 switch (fIntervalType) {
567 DetermineShortestInterval();
570 DetermineTailFractionInterval();
574 "Error: Interval type not set" << endl;
579 void MCMCInterval::DetermineShortestInterval()
587 void MCMCInterval::DetermineTailFractionInterval()
589 if (fLeftSideTF < 0 || fLeftSideTF > 1) {
591 <<
"Fraction must be in the range [0, 1]. "
592 << fLeftSideTF <<
"is not allowed." << endl;
596 if (fDimension != 1) {
598 <<
"Error: Can only find a tail-fraction interval for 1-D intervals"
605 <<
"Crucial data member was NULL." << endl;
616 if (fVector.size() == 0)
617 CreateVector(fAxes[0]);
619 if (fVector.size() == 0 || fVecWeight == 0) {
636 Double_t leftTailCutoff = fVecWeight * (1 -
c) * fLeftSideTF;
637 Double_t rightTailCutoff = fVecWeight * (1 -
c) * (1 - fLeftSideTF);
649 const char* name = param->
GetName();
653 for (i = 0; i < (
Int_t)fVector.size(); i++) {
654 x = fChain->Get(fVector[i])->getRealValue(name);
655 w = fChain->Weight();
657 if (
TMath::Abs(leftTailSum + w - leftTailCutoff) <
668 for (i = (
Int_t)fVector.size() - 1; i >= 0; i--) {
669 x = fChain->Get(fVector[i])->getRealValue(name);
670 w = fChain->Weight();
672 if (
TMath::Abs(rightTailSum + w - rightTailCutoff) <
684 fTFConfLevel = 1 - (leftTailSum + rightTailSum) / fVecWeight;
687 void MCMCInterval::DetermineByKeys()
689 if (fKeysPdf ==
NULL)
692 if (fKeysPdf ==
NULL) {
698 fKeysConfLevel = 0.0;
705 fCutoffVar->setVal(cutoff);
711 coutW(
Eval) <<
"Warning: Integral of Keys PDF came out to " << full
712 <<
" intead of expected value 1. Will continue using this "
713 <<
"factor to normalize further integrals of this PDF." << endl;
722 TIterator* it = fParameters.createIterator();
730 Double_t confLevel = CalcConfLevel(topCutoff, full);
731 if (AcceptableConfLevel(confLevel)) {
732 fKeysConfLevel = confLevel;
733 fKeysCutoff = topCutoff;
738 while (confLevel > fConfidenceLevel) {
740 confLevel = CalcConfLevel(topCutoff, full);
741 if (AcceptableConfLevel(confLevel)) {
742 fKeysConfLevel = confLevel;
743 fKeysCutoff = topCutoff;
749 bottomCutoff = topCutoff / 2.0;
753 confLevel = CalcConfLevel(bottomCutoff, full);
754 if (AcceptableConfLevel(confLevel)) {
755 fKeysConfLevel = confLevel;
756 fKeysCutoff = bottomCutoff;
759 while (confLevel < fConfidenceLevel) {
761 confLevel = CalcConfLevel(bottomCutoff, full);
762 if (AcceptableConfLevel(confLevel)) {
763 fKeysConfLevel = confLevel;
764 fKeysCutoff = bottomCutoff;
770 topCutoff = bottomCutoff * 2.0;
774 coutI(
Eval) <<
"range set: [" << bottomCutoff <<
", " << topCutoff <<
"]"
777 cutoff = (topCutoff + bottomCutoff) / 2.0;
778 confLevel = CalcConfLevel(cutoff, full);
786 while (!AcceptableConfLevel(confLevel) &&
787 !WithinDeltaFraction(topCutoff, bottomCutoff)) {
788 if (confLevel > fConfidenceLevel)
789 bottomCutoff = cutoff;
790 else if (confLevel < fConfidenceLevel)
792 cutoff = (topCutoff + bottomCutoff) / 2.0;
793 coutI(
Eval) <<
"cutoff range: [" << bottomCutoff <<
", "
794 << topCutoff <<
"]" << endl;
795 confLevel = CalcConfLevel(cutoff, full);
798 fKeysCutoff = cutoff;
799 fKeysConfLevel = confLevel;
802 void MCMCInterval::DetermineByHist()
805 DetermineBySparseHist();
807 DetermineByDataHist();
810 void MCMCInterval::DetermineBySparseHist()
813 if (fSparseHist ==
NULL)
816 if (fSparseHist ==
NULL) {
819 fHistConfLevel = 0.0;
823 numBins = (
Long_t)fSparseHist->GetNbins();
825 std::vector<Long_t>
bins(numBins);
826 for (
Int_t ibin = 0; ibin < numBins; ibin++)
827 bins[ibin] = (
Long_t)ibin;
828 std::stable_sort(bins.begin(), bins.end(), CompareSparseHistBins(fSparseHist));
830 Double_t nEntries = fSparseHist->GetSumw();
835 for (i = numBins - 1; i >= 0; i--) {
836 content = fSparseHist->GetBinContent(bins[i]);
837 if ((sum + content) / nEntries >= fConfidenceLevel) {
838 fHistCutoff = content;
853 for ( ; i >= 0; i--) {
854 content = fSparseHist->GetBinContent(bins[i]);
855 if (content == fHistCutoff)
862 for ( ; i < numBins; i++) {
863 content = fSparseHist->GetBinContent(bins[i]);
864 if (content > fHistCutoff) {
865 fHistCutoff = content;
869 if (i == numBins - 1)
872 fHistCutoff = content + 1.0;
876 fHistConfLevel = sum / nEntries;
879 void MCMCInterval::DetermineByDataHist()
882 if (fDataHist ==
NULL)
884 if (fDataHist ==
NULL) {
887 fHistConfLevel = 0.0;
891 numBins = fDataHist->numEntries();
893 std::vector<Int_t>
bins(numBins);
894 for (
Int_t ibin = 0; ibin < numBins; ibin++)
896 std::stable_sort(bins.begin(), bins.end(), CompareDataHistBins(fDataHist));
902 for (i = numBins - 1; i >= 0; i--) {
903 fDataHist->get(bins[i]);
904 content = fDataHist->weight();
905 if ((sum + content) / nEntries >= fConfidenceLevel) {
906 fHistCutoff = content;
921 for ( ; i >= 0; i--) {
922 fDataHist->get(bins[i]);
923 content = fDataHist->weight();
924 if (content == fHistCutoff)
931 for ( ; i < numBins; i++) {
932 fDataHist->get(bins[i]);
933 content = fDataHist->weight();
934 if (content > fHistCutoff) {
935 fHistCutoff = content;
939 if (i == numBins - 1)
942 fHistCutoff = content + 1.0;
946 fHistConfLevel = sum / nEntries;
949 Double_t MCMCInterval::GetActualConfidenceLevel()
951 if (fIntervalType == kShortest) {
953 return fKeysConfLevel;
955 return fHistConfLevel;
956 }
else if (fIntervalType == kTailFraction) {
960 <<
"not implemented for this type of interval. Returning 0." << endl;
967 switch (fIntervalType) {
969 return LowerLimitShortest(param);
971 return LowerLimitTailFraction(param);
974 "Error: Interval type not set" << endl;
981 switch (fIntervalType) {
983 return UpperLimitShortest(param);
985 return UpperLimitTailFraction(param);
988 "Error: Interval type not set" << endl;
996 DetermineTailFractionInterval();
1004 DetermineTailFractionInterval();
1012 return LowerLimitByKeys(param);
1014 return LowerLimitByHist(param);
1020 return UpperLimitByKeys(param);
1022 return UpperLimitByHist(param);
1030 return LowerLimitBySparseHist(param);
1032 return LowerLimitByDataHist(param);
1040 return UpperLimitBySparseHist(param);
1042 return UpperLimitByDataHist(param);
1049 if (fDimension != 1) {
1051 <<
"Sorry, will not compute lower limit unless dimension == 1" << endl;
1054 if (fHistCutoff < 0)
1055 DetermineBySparseHist();
1057 if (fHistCutoff < 0) {
1059 coutE(
Eval) <<
"In MCMCInterval::LowerLimitBySparseHist: "
1060 <<
"couldn't determine cutoff. Check that num burn in steps < num "
1061 <<
"steps in the Markov chain. Returning param.getMin()." << endl;
1065 std::vector<Int_t> coord(fDimension);
1066 for (
Int_t d = 0;
d < fDimension;
d++) {
1067 if (strcmp(fAxes[
d]->GetName(), param.
GetName()) == 0) {
1071 for (
Long_t i = 0; i < numBins; i++) {
1072 if (fSparseHist->GetBinContent(i, &coord[0]) >= fHistCutoff) {
1073 val = fSparseHist->GetAxis(
d)->GetBinCenter(coord[
d]);
1074 if (val < lowerLimit)
1088 if (fHistCutoff < 0)
1089 DetermineByDataHist();
1091 if (fHistCutoff < 0) {
1093 coutE(
Eval) <<
"In MCMCInterval::LowerLimitByDataHist: "
1094 <<
"couldn't determine cutoff. Check that num burn in steps < num "
1095 <<
"steps in the Markov chain. Returning param.getMin()." << endl;
1099 for (
Int_t d = 0;
d < fDimension;
d++) {
1100 if (strcmp(fAxes[
d]->GetName(), param.
GetName()) == 0) {
1101 Int_t numBins = fDataHist->numEntries();
1104 for (
Int_t i = 0; i < numBins; i++) {
1106 if (fDataHist->weight() >= fHistCutoff) {
1107 val = fDataHist->get()->getRealValue(param.
GetName());
1108 if (val < lowerLimit)
1122 if (fDimension != 1) {
1124 <<
"Sorry, will not compute upper limit unless dimension == 1" << endl;
1127 if (fHistCutoff < 0)
1128 DetermineBySparseHist();
1130 if (fHistCutoff < 0) {
1132 coutE(
Eval) <<
"In MCMCInterval::UpperLimitBySparseHist: "
1133 <<
"couldn't determine cutoff. Check that num burn in steps < num "
1134 <<
"steps in the Markov chain. Returning param.getMax()." << endl;
1138 std::vector<Int_t> coord(fDimension);
1139 for (
Int_t d = 0;
d < fDimension;
d++) {
1140 if (strcmp(fAxes[
d]->GetName(), param.
GetName()) == 0) {
1144 for (
Long_t i = 0; i < numBins; i++) {
1145 if (fSparseHist->GetBinContent(i, &coord[0]) >= fHistCutoff) {
1146 val = fSparseHist->GetAxis(
d)->GetBinCenter(coord[
d]);
1147 if (val > upperLimit)
1161 if (fHistCutoff < 0)
1162 DetermineByDataHist();
1164 if (fHistCutoff < 0) {
1166 coutE(
Eval) <<
"In MCMCInterval::UpperLimitByDataHist: "
1167 <<
"couldn't determine cutoff. Check that num burn in steps < num "
1168 <<
"steps in the Markov chain. Returning param.getMax()." << endl;
1172 for (
Int_t d = 0;
d < fDimension;
d++) {
1173 if (strcmp(fAxes[
d]->GetName(), param.
GetName()) == 0) {
1174 Int_t numBins = fDataHist->numEntries();
1177 for (
Int_t i = 0; i < numBins; i++) {
1179 if (fDataHist->weight() >= fHistCutoff) {
1180 val = fDataHist->get()->getRealValue(param.
GetName());
1181 if (val > upperLimit)
1195 if (fKeysCutoff < 0)
1198 if (fKeysDataHist ==
NULL)
1199 CreateKeysDataHist();
1201 if (fKeysCutoff < 0 || fKeysDataHist ==
NULL) {
1203 coutE(
Eval) <<
"in MCMCInterval::LowerLimitByKeys(): "
1204 <<
"couldn't find lower limit, check that the number of burn in "
1205 <<
"steps < number of total steps in the Markov chain. Returning "
1206 <<
"param.getMin()" << endl;
1210 for (
Int_t d = 0;
d < fDimension;
d++) {
1211 if (strcmp(fAxes[
d]->GetName(), param.
GetName()) == 0) {
1212 Int_t numBins = fKeysDataHist->numEntries();
1215 for (
Int_t i = 0; i < numBins; i++) {
1216 fKeysDataHist->get(i);
1217 if (fKeysDataHist->weight() >= fKeysCutoff) {
1218 val = fKeysDataHist->get()->getRealValue(param.
GetName());
1219 if (val < lowerLimit)
1233 if (fKeysCutoff < 0)
1236 if (fKeysDataHist ==
NULL)
1237 CreateKeysDataHist();
1239 if (fKeysCutoff < 0 || fKeysDataHist ==
NULL) {
1241 coutE(
Eval) <<
"in MCMCInterval::UpperLimitByKeys(): "
1242 <<
"couldn't find upper limit, check that the number of burn in "
1243 <<
"steps < number of total steps in the Markov chain. Returning "
1244 <<
"param.getMax()" << endl;
1248 for (
Int_t d = 0;
d < fDimension;
d++) {
1249 if (strcmp(fAxes[
d]->GetName(), param.
GetName()) == 0) {
1250 Int_t numBins = fKeysDataHist->numEntries();
1253 for (
Int_t i = 0; i < numBins; i++) {
1254 fKeysDataHist->get(i);
1255 if (fKeysDataHist->weight() >= fKeysCutoff) {
1256 val = fKeysDataHist->get()->getRealValue(param.
GetName());
1257 if (val > upperLimit)
1268 Double_t MCMCInterval::GetKeysMax()
1270 if (fKeysCutoff < 0)
1273 if (fKeysDataHist ==
NULL)
1274 CreateKeysDataHist();
1276 if (fKeysDataHist ==
NULL) {
1278 coutE(
Eval) <<
"in MCMCInterval::KeysMax(): "
1279 <<
"couldn't find Keys max value, check that the number of burn in "
1280 <<
"steps < number of total steps in the Markov chain. Returning 0"
1285 Int_t numBins = fKeysDataHist->numEntries();
1288 for (
Int_t i = 0; i < numBins; i++) {
1289 fKeysDataHist->get(i);
1290 w = fKeysDataHist->weight();
1298 Double_t MCMCInterval::GetHistCutoff()
1300 if (fHistCutoff < 0)
1306 Double_t MCMCInterval::GetKeysPdfCutoff()
1308 if (fKeysCutoff < 0)
1315 return fKeysCutoff / fFull;
1322 fCutoffVar->setVal(cutoff);
1324 confLevel = integral->
getVal(fParameters) / full;
1325 coutI(
Eval) <<
"cutoff = " << cutoff <<
", conf = " << confLevel << endl;
1331 TH1* MCMCInterval::GetPosteriorHist()
1333 if(fConfidenceLevel == 0)
1335 <<
"confidence level not set " << endl;
1343 return (
TH1*) fHist->Clone(
"MCMCposterior_hist");
1348 if (fConfidenceLevel == 0)
1350 <<
"confidence level not set " << endl;
1351 if (fKeysPdf ==
NULL)
1354 if (fKeysPdf ==
NULL)
1358 return (
RooNDKeysPdf*) fKeysPdf->Clone(
"MCMCPosterior_keys");
1361 RooProduct* MCMCInterval::GetPosteriorKeysProduct()
1363 if (fConfidenceLevel == 0)
1365 <<
"confidence level not set " << endl;
1366 if (fProduct ==
NULL) {
1371 if (fProduct ==
NULL)
1375 return (
RooProduct*) fProduct->Clone(
"MCMCPosterior_keysproduct");
1386 return (
TMath::Abs(confLevel - fConfidenceLevel) < fEpsilon);
1394 void MCMCInterval::CreateKeysDataHist()
1398 if (fProduct ==
NULL)
1400 if (fProduct ==
NULL)
1422 Bool_t tempChangeBinning =
true;
1423 for (i = 0; i < fDimension; i++) {
1424 if (!fAxes[i]->getBinning(
NULL,
false,
false).isUniform()) {
1425 tempChangeBinning =
false;
1433 if (fDimension >= 2)
1434 tempChangeBinning =
false;
1436 if (tempChangeBinning) {
1438 for (i = 0; i < fDimension; i++) {
1447 fKeysDataHist =
new RooDataHist(
"_productDataHist",
1448 "Keys PDF & Heaviside Product Data Hist", fParameters);
1449 fKeysDataHist = fProduct->fillDataHist(fKeysDataHist, &fParameters, 1.);
1451 if (tempChangeBinning) {
1453 for (i = 0; i < fDimension; i++)
1456 fAxes[i]->setBins(savedBins[i],
NULL);
1463 Bool_t MCMCInterval::CheckParameters(
const RooArgSet& parameterPoint)
const
1467 if (parameterPoint.
getSize() != fParameters.getSize() ) {
1468 coutE(
Eval) <<
"MCMCInterval: size is wrong, parameters don't match" << std::endl;
1471 if ( ! parameterPoint.
equals( fParameters ) ) {
1472 coutE(
Eval) <<
"MCMCInterval: size is ok, but parameters don't match" << std::endl;
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
3-D histogram with a float per channel (see TH1 documentation)}
Bool_t equals(const RooAbsCollection &otherColl) const
Check if this and other collection have identically named contents.
RooCmdArg NormSet(const RooArgSet &nset)
void SetParameters(const RooArgSet *desiredVals, RooArgSet *paramsToChange)
const RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const
Return binning definition with name.
virtual Double_t getMin(const char *name=0) const
const TKDTreeBinning * bins
Iterator abstract base class.
RooDataSet is a container class to hold N-dimensional binned data.
void SetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Restore the parameters from pars into the function.
Efficient multidimensional histogram.
Double_t getVal(const RooArgSet *set=0) const
void setBins(Int_t nBins, const char *name=0)
virtual RooDataSet * GetAsDataSet(RooArgSet *whichVars=NULL) const
get this MarkovChain as a RooDataSet whose entries contain the values of whichVars.
THnSparseT< TArrayF > THnSparseF
RooRealVar represents a fundamental (non-derived) real valued object.
RooCmdArg SelectVars(const RooArgSet &vars)
static Double_t infinity()
Return internal infinity representation.
void GetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Stores the parameters of the given function into pars.
virtual const char * GetName() const
Returns name of object.
static const Double_t DEFAULT_EPSILON
RooDataSet is a container class to hold unbinned data.
Represents the Heaviside function.
Generic N-dimensional implementation of a kernel estimation p.d.f.
RooProduct a RooAbsReal implementation that represent the product of a given set of other RooAbsReal ...
static const Double_t DEFAULT_DELTA
ConfInterval is an interface class for a generic interval in the RooStats framework.
Stores the steps in a Markov Chain of points.
TRObject operator()(const T1 &t1) const
RooCmdArg EventRange(Int_t nStart, Int_t nStop)
RooAbsArg * at(Int_t idx) const
ClassImp(RooStats::MCMCInterval)
virtual const char * GetName() const
Returns name of object.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
Mother of all ROOT objects.
virtual Double_t getMax(const char *name=0) const
virtual TObject * Next()=0
RooAbsReal * createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, 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
Create an object that represents the integral of the function over one or more observables listed in ...
Double_t getRealValue(const char *name, Double_t defVal=0, Bool_t verbose=kFALSE) const
Get value of a RooAbsReal stored in set with given name.