当前位置: 首页>>代码示例>>C++>>正文


C++ TGraphErrors::GetMean方法代码示例

本文整理汇总了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;
}
开发者ID:SBU-NSL,项目名称:magcloak-analysis,代码行数:67,代码来源:SteadyStateCorrellation.C


注:本文中的TGraphErrors::GetMean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。