本文整理汇总了C++中TGraph::GetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph::GetTitle方法的具体用法?C++ TGraph::GetTitle怎么用?C++ TGraph::GetTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraph
的用法示例。
在下文中一共展示了TGraph::GetTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adcs
void
TestShaping(int max=4)
{
TArrayI adcs(10);
TGraph* orig = new TGraph(adcs.fN);
orig->SetName("Original");
orig->SetTitle("Original");
orig->SetMarkerStyle(25);
orig->SetMarkerColor(1);
orig->SetMarkerSize(2);
orig->SetLineColor(1);
for (Int_t i = 0; i < adcs.fN; i++) {
adcs.fArray[i] = Int_t(gRandom->Uniform(0, 1023));
orig->SetPoint(i, i, adcs.fArray[i]);
}
TCanvas* c = new TCanvas("c", "c");
c->SetFillColor(0);
c->SetTopMargin(.02);
c->SetRightMargin(.02);
TH1* h = new TH1F("frame","frame", adcs.fN+1, -2, adcs.fN);
h->SetMinimum(0);
h->SetMaximum(1300);
h->SetStats(0);
h->Draw("");
orig->Draw("pl same");
TLegend* l = new TLegend(adcs.fN*3./4, 1023, adcs.fN, 1300, "", "");
l->SetFillColor(0);
l->SetBorderSize(1);
l->AddEntry(orig, orig->GetTitle(), "lp");
for (int i = 1; i <= max; i++) {
TGraph* g = makeGraph(adcs, i);
g->Draw("pl same");
l->AddEntry(g, g->GetTitle(), "lp");
}
l->Draw();
c->Modified();
c->Update();
c->cd();
}
示例2: makePlots_crosscheck1
//.........这里部分代码省略.........
g_crosscheck_single->SetPoint(i,cut_single,(*vec_sigma_inel)[1]);
g_crosscheck_double->SetPoint(i,cut_double,(*vec_sigma_inel)[2]); //inel has three
g_crosscheck_had_single->SetPoint(i,cut_single,(*vec_sigma_had)[0]); //vis has two elements
g_crosscheck_had_double->SetPoint(i,cut_double,(*vec_sigma_had)[1]);
}
TCanvas* can1 = new TCanvas;
TH1D* eposin=(TH1D*)file->Get("Epos/Epos_h_hf_cut_single");
TH1D* epossd2in=(TH1D*)file->Get("EposSDWeight2/EposSDWeight2_h_hf_cut_single");
TH1D* qgsjetin=(TH1D*)file->Get("QGSJetII/QGSJetII_h_hf_cut_single");
eposin->Scale(g_crosscheck_had_single->Eval(8.)/eposin->Interpolate(8./modfactor));
epossd2in->Scale(g_crosscheck_had_single->Eval(8.)/epossd2in->Interpolate(8./modfactor));
qgsjetin->Scale(g_crosscheck_had_single->Eval(8.)/qgsjetin->Interpolate(8./modfactor));
TGraph* epos = new TGraph(eposin->GetNbinsX());
TGraph* epossd2 = new TGraph(eposin->GetNbinsX());
TGraph* qgsjet = new TGraph(qgsjetin->GetNbinsX());
for(int j=0; j<eposin->GetNbinsX(); j++)
{
int bin=j+1;
epos->SetPoint(j,eposin->GetBinCenter(bin)*modfactor,eposin->GetBinContent(bin));
epossd2->SetPoint(j,epossd2in->GetBinCenter(bin)*modfactor,epossd2in->GetBinContent(bin));
qgsjet->SetPoint(j,qgsjetin->GetBinCenter(bin)*modfactor,qgsjetin->GetBinContent(bin));
}
epos->SetTitle("EPOS-LHC");
epossd2->SetTitle("EPOS-LHC (#sigma_{SD}x2)");
qgsjet->SetTitle("QGSJetII-04");
qgsjet->SetLineWidth(3);
epossd2->SetLineWidth(3);
epos->SetLineWidth(3);
epos->SetLineColor(kBlue);
epossd2->SetLineColor(kBlue);
qgsjet->SetLineColor(kRed);
epossd2->SetLineStyle(6);
qgsjet->SetLineStyle(9);
g_crosscheck_single->GetYaxis()->SetRangeUser(1.5,2.5);
g_crosscheck_single->GetXaxis()->SetRangeUser(0,13);
g_crosscheck_single->Draw("AP");
g_crosscheck_had_single->Draw("P");
TLegend* leg1 = new TLegend(0.55,0.71,0.82,0.92);
leg1->AddEntry(g_crosscheck_single,"inelastic","p");
leg1->AddEntry(g_crosscheck_had_single,"hadronic","p");
leg1->AddEntry(epos,epos->GetTitle(),"l");
leg1->AddEntry(epossd2,epossd2->GetTitle(),"l");
leg1->AddEntry(qgsjet,qgsjet->GetTitle(),"l");
SetLegAtt(leg1,1.2);
leg1->Draw();
epos->Draw("L SAME");
epossd2->Draw("L SAME");
qgsjet->Draw("L SAME");
CMSText(0,1,1,"single-arm selection");
can1->SaveAs((string("plots/cross_check_1_single_30")+string(".pdf")).c_str());
TCanvas* can2 = new TCanvas;
eposin=(TH1D*)file->Get("Epos/Epos_h_hf_cut_double");
epossd2in=(TH1D*)file->Get("EposSDWeight2/EposSDWeight2_h_hf_cut_double");
qgsjetin=(TH1D*)file->Get("QGSJetII/QGSJetII_h_hf_cut_double");
eposin->Scale(g_crosscheck_had_double->Eval(2.5)/eposin->Interpolate(2.5/modfactor));
epossd2in->Scale(g_crosscheck_had_double->Eval(2.5)/epossd2in->Interpolate(2.5/modfactor));
qgsjetin->Scale(g_crosscheck_had_double->Eval(2.5)/qgsjetin->Interpolate(2.5/modfactor));
TGraph* epos = new TGraph(eposin->GetNbinsX());
TGraph* epossd2 = new TGraph(epossd2in->GetNbinsX());
TGraph* qgsjet = new TGraph(qgsjetin->GetNbinsX());
for(int j=0; j<eposin->GetNbinsX(); j++)
{
int bin=j+1;
epos->SetPoint(j,eposin->GetBinCenter(bin)*modfactor,eposin->GetBinContent(bin));
epossd2->SetPoint(j,epossd2in->GetBinCenter(bin)*modfactor,epossd2in->GetBinContent(bin));
qgsjet->SetPoint(j,qgsjetin->GetBinCenter(bin)*modfactor,qgsjetin->GetBinContent(bin));
}
epos->SetTitle("EPOS-LHC");
epossd2->SetTitle("EPOS-LHC (#sigma_{SD}x2)");
qgsjet->SetTitle("QGSJetII-04");
qgsjet->SetLineWidth(3);
epossd2->SetLineWidth(3);
epos->SetLineWidth(3);
epos->SetLineColor(kBlue);
epossd2->SetLineColor(kBlue);
qgsjet->SetLineColor(kRed);
epossd2->SetLineStyle(6);
qgsjet->SetLineStyle(9);
g_crosscheck_double->GetYaxis()->SetRangeUser(1.5,2.5);
g_crosscheck_double->Draw("AP");
g_crosscheck_had_double->Draw("P");
TLegend* leg2 = new TLegend(0.55,0.71,0.82,0.92);
leg2->AddEntry(g_crosscheck_double,"inelastic","p");
leg2->AddEntry(g_crosscheck_had_double,"hadronic","p");
leg2->AddEntry(epos,epos->GetTitle(),"l");
leg2->AddEntry(epossd2,epossd2->GetTitle(),"l");
leg2->AddEntry(qgsjet,qgsjet->GetTitle(),"l");
SetLegAtt(leg2,1.2);
leg2->Draw();
epos->Draw("L SAME");
epossd2->Draw("L SAME");
qgsjet->Draw("L SAME");
CMSText(0,1,1,"double-arm selection");
can2->SaveAs((string("plots/cross_check_1_double_30")+string(".pdf")).c_str());
}
示例3: createNNLOplot
void createNNLOplot(TString theory="ahrens")
{
// theory="ahrens", "kidonakis"
TString outputRootFile="test.root";
// NB: add new datset name here
if(theory.Contains("ahrens") ){
outputRootFile="AhrensNLONNLL";
//if(theory.Contains("mtt") ) outputRootFile+="mttbar" ;
//else if(theory.Contains("pt")) outputRootFile+="pTttbar";
outputRootFile+=".root";
}
else if(theory=="kidonakis") outputRootFile="KidonakisAproxNNLO.root";
// general options
gStyle->SetOptStat(0);
bool usequad=true;
bool divideByBinwidth=true;
// list of variables
std::vector<TString> xSecVariables_, xSecLabel_;
// NB: add variables for new datset name here
TString xSecVariablesUsedAhrens[] ={"ttbarMass", "ttbarPt"};
TString xSecVariablesUsedKidonakis[] ={"topPt" , "topY" };
if( theory.Contains("ahrens") ) xSecVariables_ .insert( xSecVariables_.begin(), xSecVariablesUsedAhrens , xSecVariablesUsedAhrens + sizeof(xSecVariablesUsedAhrens )/sizeof(TString) );
else if(theory=="kidonakis") xSecVariables_ .insert( xSecVariables_.begin(), xSecVariablesUsedKidonakis, xSecVariablesUsedKidonakis + sizeof(xSecVariablesUsedKidonakis)/sizeof(TString) );
// get variable binning used for final cross sections
std::map<TString, std::vector<double> > bins_=makeVariableBinning();
//std::vector<double> tempbins_;
//double ttbarMassBins[]={345,445,545,745, 1045};
//tempbins_.insert( tempbins_.begin(), ttbarMassBins, ttbarMassBins + sizeof(ttbarMassBins)/sizeof(double) );
//bins_["ttbarMass"]=tempbins_;
// loop all variables
for(unsigned var=0; var<xSecVariables_.size(); ++var){
TString variable=xSecVariables_[var];
std::cout << "----------" << std::endl;
std::cout << theory << ": " << variable << std::endl;
// get bin boundaries
double low =bins_[variable][0];
double high=bins_[variable][bins_[variable].size()-1];
// --------------------------
// get raw nnlo theory points
// --------------------------
// NB: add new datset file names here
TGraph * rawHist;
TString predictionfolder="/afs/naf.desy.de/group/cms/scratch/tophh/CommonFiles/";
if(theory=="ahrens" ){
if(variable.Contains("ttbarMass")) rawHist= new TGraph(predictionfolder+"AhrensTheory_Mttbar_8000_172.5_NLONNLL_norm.dat");//AhrensTheory_Mtt_7000_172.5_Mtt_fin.dat
if(variable.Contains("ttbarPt" )) rawHist= new TGraph(predictionfolder+"AhrensTheory_pTttbar_8000_172.5_NLONNLL_abs.dat");//AhrensTheory_pTttbar_7000_172.5_NLONNLL_abs.dat
}
else if(theory=="kidonakis"){
if(variable.Contains("topPt")) rawHist= new TGraph(predictionfolder+"pttopnnloapprox8lhc173m.dat");//"ptnormalNNLO7lhc173m.dat" //"pttopnnloapprox8lhc173m.dat"
if(variable.Contains("topY" )) rawHist= new TGraph(predictionfolder+"ytopnnloapprox8lhc173m.dat" );//"ynormalNNLO7lhc173m.dat" //"ytopnnloapprox8lhc173m.dat"
}
// NB: say if points should be interpreted as single points with
// nothing in between or as integrated value over the range
bool points=true;
if(theory.Contains("ahrens")) points=false;
else if(theory=="kidonakis") points=true;
std::cout << "input: " << rawHist->GetTitle() << std::endl;
std::cout << "interprete values as points?: " << points << std::endl;
// --------------------
// convertion to TH1F*
// --------------------
double *Xvalues = rawHist->GetX();
int Nbins=rawHist->GetN();
//double *Yvalues = rawHist->GetY(); // not working
double xmax=-1;
double xmin=-1;
double binwidth=-1;
//
TH1F* hist;
// NB: add additional binning for new theory here
// NB: if loaded data should be interpreted as points with
// nothing in between (like kidonakis), make suree you
// choose a binning that is fine enough for the
// data points loaded
if(theory=="ahrens"){
if(variable.Contains("ttbarMass")){
xmin= 345.;
xmax=2720.;
binwidth=25.;// 5 for 8TeV, 25 for 7TeV
if(TString(rawHist->GetTitle()).Contains("8000")) binwidth=5.;
}
else if(variable.Contains("ttbarPt")){
xmin= 0.;
xmax=1300.;
binwidth=5.;
}
}
else if(theory=="kidonakis"){
if(variable.Contains("topPt")){
xmin= 0.;
xmax=1500.;
binwidth=1.;
}
else if(variable.Contains("topY")){
xmin=-3.8;
xmax= 3.8;
binwidth=0.01;
}
//.........这里部分代码省略.........