本文整理汇总了C++中TProfile::DrawCopy方法的典型用法代码示例。如果您正苦于以下问题:C++ TProfile::DrawCopy方法的具体用法?C++ TProfile::DrawCopy怎么用?C++ TProfile::DrawCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TProfile
的用法示例。
在下文中一共展示了TProfile::DrawCopy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QAoccupancy
void QAoccupancy(const Char_t *fdata, const Char_t *fmc)
{
style();
TFile *fdtin = TFile::Open(fdata);
TList *ldtin = (TList *)fdtin->Get("clist");
TH2 *hdtin = (TH2 *)ldtin->FindObject("NClustersSPD2");
TProfile *pdtin = hdtin->ProfileY("pdtin_clusters");
pdtin->SetMarkerStyle(20);
pdtin->SetMarkerSize(2);
pdtin->SetMarkerColor(kAzure-3);
TFile *fmcin = TFile::Open(fmc);
TList *lmcin = (TList *)fmcin->Get("clist");
TH2 *hmcin = (TH2 *)lmcin->FindObject("NClustersSPD2");
TProfile *pmcin = hmcin->ProfileY("pmcin_clusters");
pmcin->SetMarkerStyle(25);
pmcin->SetMarkerSize(2);
pmcin->SetMarkerColor(kRed+1);
TCanvas *c = new TCanvas("cOccupancy", "cOccupancy", 800, 800);
c->SetLogy();
TH1 * hfr = c->DrawFrame(-0.5, 2., 10.5, 500.);
DrawBinLabelsX(hfr, kTRUE);
hfr->SetTitle(";;#LT#it{N}_{clusters,SPD-1}#GT");
pdtin->DrawCopy("same");
pmcin->DrawCopy("same");
TLegend *legend = new TLegend(0.20, 0.18, 0.50, 0.30);
legend->SetFillColor(0);
legend->SetBorderSize(0);
legend->SetTextFont(42);
legend->SetTextSize(0.04);
legend->AddEntry(pdtin, "data", "pl");
legend->AddEntry(pmcin, "Monte Carlo", "pl");
legend->Draw("same");
c->SaveAs(canvasPrefix+"occupancy.pdf");
return;
TCanvas *cr = new TCanvas("cOccupancyr", "cOccupancyr", 800, 800);
// hfr = cr->DrawFrame(-0.5, 0.75, 10.5, 1.25);
// DrawBinLabelsX(hfr, kTRUE);
// hfr->SetTitle(";;#LT#it{N}_{clusters,SPD-1}#GT ratio");
pdtin->SetLineColor(kAzure-3);
pdtin->SetLineWidth(3);
pdtin->Divide(pmcin);
pdtin->Draw("same,histo");
legend = new TLegend(0.505025, 0.760673, 0.805276, 0.930142);
legend->SetFillColor(0);
legend->SetBorderSize(0);
legend->SetTextFont(42);
legend->SetTextSize(0.04);
legend->AddEntry(pdtin, "data / Monte Carlo", "l");
legend->Draw("same");
cr->SaveAs(canvasPrefix+"occupancyr.pdf");
}
示例2: plotAndProfileXSpread
// Draw a 2-D plot within the specified Y range and superimpose its X profile,
// setting as sigmas that of the fit (and not the error of the mean)
void plotAndProfileXSpread (TH2* h2, float min, float max, bool profile=false, float ymin=-5., float ymax=5.) {
setStyle(h2);
gPad->SetGrid(1,1);
gStyle->SetGridColor(15);
gStyle->SetOptStat(0);
// h2->RebinX(3);
// h2->RebinY(2);
// h2->SetXTitle("distance from anode (cm)");
// h2->SetYTitle("(d_{reco}-d_{sim})/#sigma_{reco}");
h2->SetMarkerColor(2);
h2->SetLineColor(2);
h2->GetYaxis()->SetTitleOffset(1.4);
h2->GetXaxis()->SetRangeUser(min,max);
h2->GetYaxis()->SetRangeUser(ymin,ymax);
h2->DrawCopy("box");
if (profile) {
TProfile* prof = h2->ProfileX("profile",-1,-1,"s");
prof->SetMarkerStyle(20);
prof->SetMarkerSize(1.2);
prof->SetMarkerColor(1);
prof->SetLineColor(1);
prof->SetLineWidth(2);
prof->DrawCopy("same e1");
delete prof;
}
TLine * l = new TLine(h2->GetXaxis()->GetXmin(),0,h2->GetXaxis()->GetXmax(),0);
l->SetLineColor(3);
l->Draw();
}
示例3: draw_clouds_profiles
void draw_clouds_profiles()
{
// gROOT->ProcessLine(".L ../utils.C");
// gROOT->ProcessLine(".L AliLRCFit.cxx");
TFile *f[8];
// f[0] = new TFile( "output_classesByV0M_LHC10h.root" );
// f[0] = new TFile( "output_classesByV0M_LHC10h_c10_5_1.root" );
f[0] = new TFile( "output_classesByV0M_LHC10h_c10_5_25_1_05.root" );
// f[0] = new TFile( "output_classesByV0M_LHC11h_FemtoPlus_c10_5_CUT_OUTLIERS.root" );
// f[0] = new TFile( "output_classesByV0M_LHC15o_fieldMM_c10_5_CUT_OUTLIERS.root" );
// f[0] = new TFile( "output_classesByV0M_LHC15o_fieldPP_c10_5_CUT_OUTLIERS.root" );
// const int nCW = 2; //nCentrWidths
// const double cWidths[nCW] = { 10, 5 }; //width of the centrality bins
// const double cStep[nCW] = { 5, 2.5 }; //centrality bins step
// const int nCentrBins[nCW] = { 17, 35 }; //n centrality bins
// const int nCW = 3; //nCentrWidths
// const double cWidths[nCW] = { 10, 5, 1.0 }; //width of the centrality bins
// const double cStep[nCW] = { 5, 2.5, 1.0 }; //centrality bins step
// const int nCentrBins[nCW] = { 17, 35, 90 }; //n centrality bins
// const int nCW = 4; //nCentrWidths
// const double cWidths[nCW] = { 10, 5, 1.0, 0.5 }; //width of the centrality bins
// const double cStep[nCW] = { 5, 2.5, 1.0, 1.0 }; //centrality bins step
// const int nCentrBins[nCW] = { 17, 35, 90, 90 }; //n centrality bins
const int nCW = 5; //nCentrWidths
const double cWidths[nCW] = { 10, 5, 2.5, 1.0, 0.5 }; //width of the centrality bins
const double cStep[nCW] = { 5, 2.5, 2.5, 1.0, 1.0 }; //centrality bins step
const int nCentrBins[nCW] = { 17, 35, 36, 90, 90 }; //n centrality bins
TH2D *hist2D;//[200][3];
TProfile *profile;//[200][3];
int cW = 2;
int etaW = 1;
int phiW = 0;
const int kCorrType = 1; //0-NN, 1-PtPt, 2-PtN
TCanvas *canv_tmp_for_fit = new TCanvas("canv_tmp_for_fit","canv_tmp_for_fit",50,50,300,300 );
TCanvas *canv_2D_clouds = new TCanvas("canv_2D_clouds","canv_2D_clouds",150,250,1400,600 );
tuneCanvas(canv_2D_clouds);
canv_2D_clouds->Divide(2,1);
gStyle->SetOptStat( kFALSE );
TGraph *grFromFit2D = new TGraph;
bool firstDraw = true;
// for ( int cBin = 0; cBin < nCentrBins[cW]; cBin++ )
for ( int cBin = nCentrBins[cW]-1; cBin >= 0; cBin-- )
{
if (cBin%2!=0)
continue;
// cout << "cBin=" << cBin << endl;
float cBinMin = cStep[cW] * cBin;
float cBinMax = cWidths[cW] + cStep[cW] * cBin;
// ##### pad 1 - clouds
tunePad( canv_2D_clouds->cd(1) );
if ( kCorrType == 0 )
{
hist2D = (TH2D*)f[0]->Get( Form("hist2D_NN_c%.1f-%.1f_etaW_%d_phiW_%d", cBinMin, cBinMax, etaW, phiW) );
hist2D->SetTitle( "");
hist2D->GetXaxis()->SetTitle( "N_{ch} Forward");
hist2D->GetYaxis()->SetTitle( "N_{ch} Backward");
hist2D->GetXaxis()->SetRangeUser(0,650);
hist2D->GetYaxis()->SetRangeUser(0,650);
}
else if ( kCorrType == 1 )
{
hist2D = (TH2D*)f[0]->Get( Form("hist2D_PtPt_c%.1f-%.1f_etaW_%d_phiW_%d", cBinMin, cBinMax, etaW, phiW) );
hist2D->SetTitle( "");
hist2D->GetXaxis()->SetTitle( "#LTp_{T}#GT Forward");
hist2D->GetYaxis()->SetTitle( "#LTp_{T}#GT Backward");
} hist2D->SetMarkerColor(kOrange-9+cBin);
tuneHist2D_onPad(hist2D);
hist2D->GetXaxis()->CenterTitle();
hist2D->GetYaxis()->CenterTitle();
// removeBinsWithFewEntries(hist2D);
hist2D->DrawCopy( firstDraw ? "" : "same" );
// ##### pad 2 - profiles
tunePad( canv_2D_clouds->cd(2) );
profile = hist2D->ProfileX(); //(TProfile*)f[0]->Get( Form("hist2D_c%.1f-%.1f_etaW_%d_phiW_%d_pfx", cBinMin, cBinMax, etaW, phiW) );
if ( kCorrType == 0 )
{
profile->SetTitle( "");
profile->GetYaxis()->SetTitle( "#LTN_{ch}#GT Backward");
profile->GetXaxis()->SetRangeUser(0,650);
profile->GetYaxis()->SetRangeUser(0,650);
}
//.........这里部分代码省略.........