本文整理汇总了C++中TGraphErrors::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraphErrors::Set方法的具体用法?C++ TGraphErrors::Set怎么用?C++ TGraphErrors::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraphErrors
的用法示例。
在下文中一共展示了TGraphErrors::Set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bestFit
TGraphErrors bestFit(TTree *tree, TString alphaName, TString constTermName){
Double_t alpha, constTerm;
alphaName.ReplaceAll("-","_");
constTermName.ReplaceAll("-","_");
tree->SetBranchAddress(alphaName,&alpha);
tree->SetBranchAddress(constTermName,&constTerm);
//Long64_t nEntries=genTree->GetEntries();
TGraphErrors graph;
Int_t iPoint=0;
tree->GetEntry(0);
graph.SetPoint(0, constTerm, alpha);
graph.SetPointError(0,0, 0);
iPoint++;
graph.Set(iPoint);
tree->ResetBranchAddresses();
graph.Draw("A P");
// graph.SetFillColor(kBlue);
// graph.SetLineColor(kYellow);
// graph.GetXaxis()->SetTitle("Energy [GeV]");
// graph.GetYaxis()->SetTitle("Additional smearing [%]");
return graph;
}
示例2: g
TGraphErrors g(TTree *tree, TString alphaName, TString constTermName){
Double_t alpha, constTerm;
alphaName.ReplaceAll("-","_");
constTermName.ReplaceAll("-","_");
tree->SetBranchAddress(alphaName,&alpha);
tree->SetBranchAddress(constTermName,&constTerm);
//Long64_t nEntries=genTree->GetEntries();
TGraphErrors graph;
Int_t iPoint=0;
tree->GetEntry(0);
std::cout << alpha << "\t" << constTerm << std::endl;
Double_t alpha2=alpha*alpha;
Double_t const2=constTerm*constTerm;
for(Double_t energy=20; energy<150; energy+=10){
Double_t addSmearing = (sqrt(alpha2/energy+const2));
graph.SetPoint(iPoint, energy, addSmearing);
graph.SetPointError(iPoint,0, 0);
iPoint++;
}
graph.Set(iPoint);
tree->ResetBranchAddresses();
graph.Draw("A L");
graph.SetFillColor(kBlue);
graph.SetLineColor(kYellow);
graph.GetXaxis()->SetTitle("Energy [GeV]");
graph.GetYaxis()->SetTitle("Additional smearing [%]");
return graph;
}