本文整理汇总了C++中TAxis::SetTimeFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ TAxis::SetTimeFormat方法的具体用法?C++ TAxis::SetTimeFormat怎么用?C++ TAxis::SetTimeFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TAxis
的用法示例。
在下文中一共展示了TAxis::SetTimeFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlotLightYieldGraph
TGraphErrors* PlotLightYieldGraph()
{
string filename;
vector<double> x,y,ex,ey;
while(1){
cout<<"\n\nEnter next file to process; <enter> to finish."<<endl;
getline(cin, filename);
if(filename=="")
break;
//load the tree
TTree* Events = GetEventsTree(filename.c_str());
if(!Events)
continue;
gROOT->ProcessLine(".x analysis/Aliases.C");
double start = Events->GetMinimum("timestamp");
double end = Events->GetMaximum("timestamp");
double error = 0;
TString title = TString("Na22 Spectrum, ") +
TString(filename)(TRegexp("Run......"));
TH1F* hist = new TH1F("Na22Spec",title,200,1000,2500);
Events->Draw("sumspec >> Na22Spec","min > 0","e");
double yield = Fit511Photopeak(hist,&error);
x.push_back((start+end)/2.);
ex.push_back((end-start)/2.);
y.push_back(yield);
ey.push_back(error);
}
if(x.size() == 0){
cerr<<"No valid points found!"<<endl;
return 0;
}
TGraphErrors* graph = new TGraphErrors(x.size(),&x[0],&y[0],&ex[0],&ey[0]);
graph->Draw("ape");
TAxis* xax = graph->GetXaxis();
xax->SetTitle("Run Time");
xax->SetTimeDisplay(1);
xax->SetTimeFormat("%Y/%m/%d");
xax->SetTimeOffset(1,"gmt");
TAxis* yax = graph->GetYaxis();
yax->SetTitle("511 keV Light Yield [pe/keV]");
graph->Draw("ape");
return graph;
}