本文整理汇总了C++中TGraphErrors::GetMean方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraphErrors::GetMean方法的具体用法?C++ TGraphErrors::GetMean怎么用?C++ TGraphErrors::GetMean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraphErrors
的用法示例。
在下文中一共展示了TGraphErrors::GetMean方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SteadyStateCorrellation
int SteadyStateCorrellation()
{
TGraphErrors *graph = new TGraphErrors();
TGraphErrors *graph2 = new TGraphErrors();
vector<double> vec_errors;
vector<std::string> file_names =
{ // "DataFile_2016-12-07_23-20-47.csv",
"DataFile_2016-12-08_00-00-39.csv",
"DataFile_2016-12-08_00-24-50.csv",
"DataFile_2016-12-08_00-38-48.csv",
"DataFile_2016-12-08_01-01-59.csv",
"DataFile_2016-12-08_01-18-01.csv",
"DataFile_2016-12-08_01-35-56.csv",
"DataFile_2016-12-08_01-52-12.csv",
"DataFile_2016-12-08_02-12-19.csv",
"DataFile_2016-12-08_02-31-44.csv",
"DataFile_2016-12-08_02-50-58.csv",
"DataFile_2016-12-08_03-10-16.csv",
"DataFile_2016-12-08_03-29-53.csv",
"DataFile_2016-12-08_03-49-37.csv",
"DataFile_2016-12-08_04-09-26.csv",
"DataFile_2016-12-08_04-29-26.csv",
"DataFile_2016-12-08_04-49-57.csv",
"DataFile_2016-12-08_05-34-24.csv",
"DataFile_2016-12-08_05-58-20.csv",
"DataFile_2016-12-08_06-22-12.csv",
"DataFile_2016-12-08_06-46-48.csv",
"DataFile_2016-12-08_07-11-10.csv"
};
for(int i = 0; i < file_names.size(); i++)
{
RampCorrellation_single(file_names[i], *graph, *graph2, vec_errors);
}
TCanvas *c = new TCanvas();
graph->GetXaxis()->SetTitle("Nominal External Field (mT)");
graph->GetYaxis()->SetTitle("| B_{1} / B_{2} |");
graph->Draw();
double ratio_mean = graph->GetMean(2);
double ratio_std = graph->GetRMS(2);
cout << "Average value: " << graph->GetMean(2) << " +/- " << ratio_std << endl;
TCanvas *c2 = new TCanvas();
graph2->GetXaxis()->SetTitle("Nominal External Field (mT)");
graph2->GetYaxis()->SetTitle("B_{3} (mT)");
graph2->Draw();
double vec_average = 0;
double vec_max = 0, vec_min = 999999999999999;
for(int i =0; i< vec_errors.size(); i++)
{
// cout << vec_errors[i] << endl;
if(vec_errors[i]>vec_max) vec_max = vec_errors[i];
if(vec_errors[i]<vec_min) vec_min = vec_errors[i];
vec_average = vec_average+vec_errors[i];
}
vec_average = vec_average/vec_errors.size();
cout << "Average Error in (Non time dependant) measureemnts: " << vec_average << " mT" << endl;
cout << " (Min/Max = " << vec_min << " / " << vec_max << ")" << endl;
return 0;
}