本文整理汇总了C++中TBenchmark::Summary方法的典型用法代码示例。如果您正苦于以下问题:C++ TBenchmark::Summary方法的具体用法?C++ TBenchmark::Summary怎么用?C++ TBenchmark::Summary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBenchmark
的用法示例。
在下文中一共展示了TBenchmark::Summary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GradeCorrelation
//.........这里部分代码省略.........
// Find next regular term only
bool foundRegTerm = false;
for (int jTerm = iTerm + 1; jTerm < nTerms && !foundRegTerm; ++jTerm) {
const Student::Enrollment jEnrollment = student->Enrollments()[jTerm];
if (!MyFunctions::regularSemester(jEnrollment.term)) continue;
foundRegTerm = true;
for (Student::Grade jGrade : jEnrollment.grades) {
if (jGrade.course == iGrade.course) continue;
if (!MyFunctions::ValidGrade(jGrade.grade)) continue;
double prediction_j = student->CourseGradePrediction(jGrade, Student::DISTRIBUTION);
double delta_j = jGrade.quality - prediction_j;
corrMap[std::make_pair(iGrade.course, jGrade.course)].Add(delta_i, delta_j);
++nPairAll;
}
}
}
}
}
myBenchmark->Stop("Main Loop");
std::cout << "nPairAll = " << nPairAll << std::endl;
std::cout << "Unique Pairs = " << corrMap.size() << std::endl;
TH1D* rHist = new TH1D("rHist", "Correlation Coefficient, #rho", 120, -1.2, 1.2);
TH1D* pHist = new TH1D("pHist", "Probablity Distribution", 100, 0., 1.);
TH1D* nHist = new TH1D("nHist", "Number of entries", 100, 0., 2000.);
TH2D* pVrHist = new TH2D("pVrHist", "Prob vs. #rho", 100, -1., 1., 100, 0., 1.);
myBenchmark->Start("Prune");
for (auto iter = corrMap.begin(); iter != corrMap.end();) {
if (iter->second.n() < nCut) {
corrMap.erase(iter++);
continue;
}
double p = iter->second.p();
double r = iter->second.r();
// Test for nan?
if (p != p) {
std::cout << "Found p = nan: n = " << iter->second.n() << std::endl;
corrMap.erase(iter++);
continue;
}
if (p < 0.) {
corrMap.erase(iter++);
continue;
}
rHist->Fill(r);
pHist->Fill(p);
nHist->Fill(iter->second.n());
pVrHist->Fill(r, p);
if (p < 1. - prob && p > prob) {
corrMap.erase(iter++);
}
else {
std::cout << "r = " << iter->second.r() << ", p = " << p << std::endl;
++iter;
}
}
myBenchmark->Stop("Prune");
std::cout << "Post Cut = " << corrMap.size() << std::endl;
myBenchmark->Start("Sort");
std::vector<std::pair<std::pair<TString, TString>, CorrelationCalculator>> corrVec(corrMap.begin(), corrMap.end());
std::sort(corrVec.begin(), corrVec.end(), &sortFunc);
myBenchmark->Stop("Sort");
int printTop = 50;
int printed = 0;
for (auto const& entry : corrVec) {
std::cout << entry.first.first << " : " << entry.first.second << "\t, n = " << entry.second.n() << "\t, r = " << entry.second.r()
<< "\t, p = " << entry.second.p() << std::endl;
++printed;
if (printed >= printTop) break;
}
TCanvas* c1 = new TCanvas("c1", "Grade Correlation", 1600, 1200);
c1->Divide(2,2);
c1->cd(1);
TF1* myGaus = new TF1("myGaus", "gaus", -1., 1.);
myGaus->SetParameters(600., 0., 0.2);
myGaus->FixParameter(1, 0.);
rHist->Fit(myGaus, "0B", "", -1., 0.);
rHist->DrawCopy();
myGaus->DrawCopy("SAME");
c1->cd(2);
pHist->DrawCopy();
c1->cd(3);
nHist->DrawCopy();
c1->cd(4);
pVrHist->DrawCopy();
float rt, cp;
myBenchmark->Summary(rt, cp);
}