本文整理汇总了C++中TGraph2D::GetHistogram方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph2D::GetHistogram方法的具体用法?C++ TGraph2D::GetHistogram怎么用?C++ TGraph2D::GetHistogram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraph2D
的用法示例。
在下文中一共展示了TGraph2D::GetHistogram方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InterpolateThisHistogram
TH2F* InterpolateThisHistogram(TH2F *hold/*, TH2F* hnew*/){
float binsize = hold->GetXaxis()->GetBinWidth(1)/2.;
TString name = hold->GetName();
name.ReplaceAll("Org","");
TGraph2D *g = new TGraph2D(hold);
//cout << g->GetXmax() << " " << g->GetXmin() << " " << g->GetYmax() << " " << g->GetYmin() << " " << binsize << endl;
g->SetNpx(int(g->GetXmax()-g->GetXmin())/binsize);
g->SetNpy(int(g->GetYmax()-g->GetYmin())/binsize);
TH2F *hnew = (TH2F*)g->GetHistogram();
//TH2F *htemp = (TH2F*)hnew->Clone(name);
//name.ReplaceAll("YXZ","");
TH2F *h = new TH2F(name.Data(),hold->GetTitle(),hnew->GetNbinsX(),g->GetXmin()-binsize,g->GetXmax()-binsize,hnew->GetNbinsY(),g->GetYmin()-binsize,g->GetYmax()-binsize);
for(unsigned int x = 1; x<=hnew->GetNbinsX(); ++x){
for(unsigned int y = 1; y<=hnew->GetNbinsY(); ++y){
h->SetBinContent(x,y,hnew->GetBinContent(x,y));
}
}
delete g;
return h;
}
示例2: grMu
TH2D grMu(TTree *tree, double quantileExpected){
TGraph2D *gr = new TGraph2D();
float X, Y, qE;
double limit;
std::string x = "trackedParam_proc_scaling_muV";
std::string y = "trackedParam_proc_scaling_muF";
tree->SetBranchAddress(Form("%s",x.c_str()),&X);
tree->SetBranchAddress(Form("%s",y.c_str()),&Y);
tree->SetBranchAddress("quantileExpected",&qE);
tree->SetBranchAddress("limit",&limit);
int pt = 0;
for (int i=0;i<tree->GetEntries();i++){
tree->GetEntry(i);
if (TMath::Abs(qE-quantileExpected)>0.001) continue;
gr->SetPoint(pt,X,Y,limit); pt++;
//std::cout << " Lim " << X << ", " << Y << ", " << limit << std::endl;
}
gr->Draw("colz");
TH2D * expected = (TH2D*) gr->GetHistogram();
expected->SetTitle("");
expected->GetZaxis()->SetTitleOffset(1.2);
expected->GetYaxis()->SetTitle("#it{#mu}_{ggH}");
expected->GetXaxis()->SetTitle("#it{#mu}_{qqH,VH}");
expected->GetZaxis()->SetTitle("B(H #rightarrow inv.) - 95% CL upper limit");
expected->GetXaxis()->SetRangeUser(MUVMIN,MUVMAX);
expected->GetYaxis()->SetRangeUser(MUFMIN,MUFMAX);
//expected->GetXaxis()->SetLimits(MUVMIN,MUVMAX);
//expected->GetYaxis()->SetLimits(MUFMIN,MUFMAX);
expected->SetMaximum(0.6);
expected->SetMinimum(0.05);
return *expected;
}
示例3: CommandMSUGRA
void CommandMSUGRA(TString plotName_,Int_t tanBeta_, Bool_t plotLO_){
gROOT->SetStyle("CMS");//jmt specific
gROOT->ForceStyle();
gStyle->SetOptTitle(0);
gStyle->SetOptStat(0);
gStyle->SetPalette(1);
gStyle->SetTextFont(42);
gStyle->SetFrameBorderMode(0);
//convert tanb value to string
std::stringstream tmp;
tmp << tanBeta_;
TString tanb( tmp.str() );
// Output file
std::cout << " create " << plotName_ << std::endl;
TFile* output = new TFile( plotName_, "RECREATE" );
if ( !output || output->IsZombie() ) { std::cout << " zombie alarm output is a zombie " << std::endl; }
//set old exclusion Limits
TGraph* LEP_ch = set_lep_ch(tanBeta_);
TGraph* LEP_sl = set_lep_sl(tanBeta_);//slepton curve
TGraph* TEV_sg_cdf = set_tev_sg_cdf(tanBeta_);//squark gluino cdf
TGraph* TEV_sg_d0 = set_tev_sg_d0(tanBeta_);//squark gluino d0
// TGraph* TEV_tlp_cdf = set_tev_tlp_cdf(tanBeta_);//trilepton cdf
// TGraph* TEV_tlp_d0 = set_tev_tlp_d0(tanBeta_);//trilepton d0
TGraph* stau = set_tev_stau(tanBeta_);//stau
TGraph* NoEWSB = set_NoEWSB(tanBeta_);
TGraph* TEV_sn_d0_1 = set_sneutrino_d0_1(tanBeta_);
TGraph* TEV_sn_d0_2 = set_sneutrino_d0_2(tanBeta_);
int nPoints = nSusyGridPoints();
double m0[nPoints],m12[nPoints],squarkMass[nPoints],gluinoMass[nPoints];
susyGrid(m0,m12,squarkMass,gluinoMass);
TGraph2D* squarkMasses = new TGraph2D("squarkMasses","",nPoints,m0,m12,squarkMass);
TGraph2D* gluinoMasses = new TGraph2D("gluinoMasses","",nPoints,m0,m12,gluinoMass);
TH2D* gluinoMassPlot = gluinoMasses->GetHistogram();
TH2D* squarkMassPlot = squarkMasses->GetHistogram();
//constant ssqquark and gluino lines
TF1* lnsq[15];
TF1* lngl[15];
TGraph* lnsq_40[15];
TGraph* lngl_40[15];
TLatex* sq_text[15];
TLatex* gl_text[15];
TLatex* sq_40_text[15];
TLatex* gl_40_text[15];
for(int i = 1; i < 15; i++){
//lnsq[i] = constant_squark(tanBeta_,i);
//sq_text[i] = constant_squark_text(i,*lnsq[i],tanBeta_);
//lngl[i] = constant_gluino(tanBeta_,i);
//gl_text[i] = constant_gluino_text(i,*lngl[i]);
lnsq_40[i] = constant_mass(i*250,squarkMasses);
lngl_40[i] = constant_mass(i*250,gluinoMasses);
sq_40_text[i] = constant_squark_text_tanBeta40(i*250,lnsq_40[i]);
gl_40_text[i] = constant_gluino_text_tanBeta40(i*250,lngl_40[i]);;
}
//Legends
TLegend* legst = makeStauLegend(0.05,tanBeta_);
TLegend* legNoEWSB = makeNoEWSBLegend(0.05,tanBeta_);
TLegend* legexp = makeExpLegend( *TEV_sg_cdf,*TEV_sg_d0,*LEP_ch,*LEP_sl,*TEV_sn_d0_1,0.035,tanBeta_);
//make Canvas
TCanvas* cvsSys = new TCanvas("cvsnm","cvsnm",0,0,800,600);
gStyle->SetOptTitle(0);
cvsSys->SetFillColor(0);
cvsSys->GetPad(0)->SetRightMargin(0.07);
cvsSys->Range(-120.5298,26.16437,736.0927,750);
// cvsSys->Range(-50.5298,26.16437,736.0927,500);
cvsSys->SetFillColor(0);
cvsSys->SetBorderMode(0);
cvsSys->GetPad(0)->SetBorderMode(0);
cvsSys->GetPad(0)->SetBorderSize(2);
cvsSys->GetPad(0)->SetLeftMargin(0.1407035);
cvsSys->GetPad(0)->SetTopMargin(0.08);
cvsSys->GetPad(0)->SetBottomMargin(0.13);
cvsSys->SetTitle("tan#beta="+tanb);
output->cd();
//and now the exclusion limits
TGraph* SSdilep;
//.........这里部分代码省略.........
示例4: main
//.........这里部分代码省略.........
std::cout << "Simpson integral: " <<s_integral <<std::endl;
integral_hist->Fill(s_integral);
cmp_int[i] = s_integral;
Int_t lines = (Int_t)intb.size();
TGraph *r_integral = new TGraph(lines, _inta, _intb);
std::cout << "ROOT integral: " << r_integral->Integral() << std::endl;
cmp_int_root[i] = r_integral->Integral();
//expanding
//expand(y, THRS_EXPAND, RATIO_EXPAND, LINES);
//Filling TGraph2D
for(Int_t j = 0; j <LINES ; j++){
if (y[j] > max){
max = y[j];
maxwl = x[j];
}
gr->SetPoint(j+i*LINES, x[j],i,y[j]);
}
in.seekg(0, std::ios::beg);
in.close();
//Plotting each spectrum
TGraph *_gr = new TGraph(LINES,x,y);
_gr->GetHistogram()->GetXaxis()->SetTitle("#lambda in nm");
_gr->GetHistogram()->GetYaxis()->SetTitle("Intensity in dB");
c1->cd(i-NUM_ARGS);
_gr->Draw("AP");
_gr->GetYaxis()->SetRangeUser(-80.,-10.);
_gr->GetXaxis()->SetRangeUser(startwl,stopwl);
_gr->SetTitle(tmp.c_str());
c1->Update();
//Calculating asymmetry
std::cout << "maximum: " << max << std::endl;
double leftlimit, rightlimit = 1;
leftlimit = findlower(x,y, max);
rightlimit = findupper(x,y, max);
if (leftlimit != 1 && rightlimit != 1){
width_ary[i] = (leftlimit +rightlimit)/2;
}else{
width_ary[i] = maxwl;
}
double calced_asy = (maxwl-leftlimit)/(rightlimit-maxwl);
asymmety_ary[i-NUM_ARGS] = calced_asy;
std::cout << "Asymmetry: " << calced_asy << std::endl;
}catch(std::exception e){
std::cout << e.what()<< std::endl;
}
}
//Setting style for 3D Plot
TCanvas *d = new TCanvas("big","big",10,10,1500,800);
示例5: calculatePadBoundaries
PadBoundaries PlotBundle::calculatePadBoundaries() const {
PadBoundaries union_pad_boundaries;
bool nothing_drawn(true);
std::vector<DrawableDataObjectDrawOptionPair<TH1*> >::const_iterator hist_it;
for (hist_it = histograms.begin(); hist_it != histograms.end(); hist_it++) {
TH1* hist = hist_it->data_object;
std::string draw_option(hist_it->draw_option);
if (hist) {
hist->Draw(draw_option.c_str());
if (plot_axis.x_axis_range.active)
hist->GetXaxis()->SetRangeUser(plot_axis.x_axis_range.low,
plot_axis.x_axis_range.high);
PadBoundaries current_pad_boundaries(*hist);
if (nothing_drawn) {
union_pad_boundaries = current_pad_boundaries;
nothing_drawn = false;
} else {
union_pad_boundaries = union_pad_boundaries.getUnionBoundaries(
current_pad_boundaries);
}
}
}
std::vector<DrawableDataObjectDrawOptionPair<TGraph*> >::const_iterator graph_it;
for (graph_it = graphs.begin(); graph_it != graphs.end(); graph_it++) {
TGraph* graph = graph_it->data_object;
std::string draw_option("A");
draw_option.append(graph_it->draw_option);
if (graph) {
graph->Draw(draw_option.c_str());
if (plot_axis.x_axis_range.active)
graph->GetXaxis()->SetRangeUser(plot_axis.x_axis_range.low,
plot_axis.x_axis_range.high);
PadBoundaries current_pad_boundaries(*graph->GetHistogram());
if (nothing_drawn) {
union_pad_boundaries = current_pad_boundaries;
nothing_drawn = false;
} else {
union_pad_boundaries = union_pad_boundaries.getUnionBoundaries(
current_pad_boundaries);
}
}
}
std::vector<DrawableDataObjectDrawOptionPair<TGraph2D*> >::const_iterator graph2d_it;
for (graph2d_it = graphs2d.begin(); graph2d_it != graphs2d.end();
graph2d_it++) {
TGraph2D* graph = graph2d_it->data_object;
std::string draw_option("A");
draw_option.append(graph2d_it->draw_option);
if (graph) {
graph->Draw(draw_option.c_str());
PadBoundaries current_pad_boundaries(*(TH1*) graph->GetHistogram());
current_pad_boundaries.is_2d = true;
current_pad_boundaries.z_min = graph->GetZmin();
current_pad_boundaries.z_max = graph->GetZmax();
if (nothing_drawn) {
union_pad_boundaries = current_pad_boundaries;
nothing_drawn = false;
} else {
union_pad_boundaries = union_pad_boundaries.getUnionBoundaries(
current_pad_boundaries);
}
}
}
return union_pad_boundaries;
}