本文整理汇总了C++中TPad::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ TPad::Update方法的具体用法?C++ TPad::Update怎么用?C++ TPad::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPad
的用法示例。
在下文中一共展示了TPad::Update方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcEvent
void ProcEvent(Int_t event, Int_t px, Int_t py, TObject *sel)
{
// print event type and current cursor position
TCanvas *c = (TCanvas *) gTQSender;
TPad *pad = (TPad *) c->GetSelectedPad();
if(!pad) return;
gROOT->SetEditHistograms(kFALSE);
//printf("event=%d, px=%d, py=%d\n", event, px, py);
//Float_t x = pad->AbsPixeltoX(px);
//Float_t y = pad->AbsPixeltoY(py);
//x = pad->PadtoX(x);
//y = pad->PadtoY(y);
//printf("x=%.3g, y=%.3g\n",x,y);
if(event==kButton1Double){
pad->Pop();
//printf("%s %d\n",pad->GetName(),pad->GetNumber());
pad->cd();
TCanvas *c_blow;
TIter next(pad->GetListOfPrimitives());
if((TCanvas*)gROOT->GetListOfCanvases()->FindObject("c_blow")){
c_blow=(TCanvas*)gROOT->GetListOfCanvases()->FindObject("c_blow");
c_blow->Clear();
//printf("show %d\n",c_blow->GetUniqueID());
//c_blow->GetCanvasImp()->Show();
//c_blow->RaiseWindow();
//c_blow->GetCanvasImp()->RaiseWindow();
//c_blow->Flush();
//gVirtualX->RaiseWindow(c_blow->GetUniqueID());
//c_blow->Show();
}
else{
// c_blow = new TCanvas("c_blow","blowup",750,0,743,525);
c_blow = new TCanvas("c_blow","blowup",100,50,600,600);
c_blow->SetFillColor(10); //white
//c_blow->ToggleEventStatus();
//c_blow->SetCrosshair();
c_blow->Draw();
}
c_blow->cd();
gROOT->SetSelectedPad((TPad*)c_blow);
TPad *clone =(TPad*)pad->Clone();
clone->SetPad(0,0,1,1);
clone->Draw();
clone->Modified();
clone->Update();
c_blow->Show();
}
}
示例2: genDisplay
// draws the decay vertices of the Lambda_s
void genDisplay(std::string fullPath, int iGen, int iReco = -1, bool savePdf = false)
{
const int fVerbose(0);
setTDRStyle();
//gStyle->SetOptStat(112211);
gStyle->SetOptStat(0);
gStyle->SetPalette(1);
// Canvases
crz = new TCanvas("crz","crz",1000,600);
TPad* padrz = (TPad*)crz->cd(1);
setPadMargins(padrz, 0.02, 0.05, 0.02, 0.05);
crphi = new TCanvas("crphi","crphi",600,600);
TPad* padrphi = (TPad*)crphi->cd(1);
setPadMargins(padrphi, 0.02, 0.05, 0.02, 0.05);
// Open file
TFile *f = TFile::Open(fullPath.c_str());
if (f==0)
{
cout << "File " << fullPath << " not found -- exiting" << endl;
return;
}
if(fVerbose>0)
cout << "Succesfully opened file " << fullPath << endl;
// Get TTree with GenEvents
TTree* tgen = (TTree*) f->Get("genevents");
if(fVerbose>0) cout << "Got TTree with " << tgen->GetEntries() << " entries" << endl;
// Do a cut, if needed
tgen->Draw(">>lst","ptmu1>3&&ptmu2>3&&TMath::Abs(etamu1)<2.5&&TMath::Abs(etamu2)<2.5");
TEventList *lst;
lst = (TEventList*)gDirectory->Get("lst");
tgen->SetEventList(lst);
// Get TTree with iRecoEvents
TTree* treco = (TTree*) f->Get("events");
if(fVerbose>0) cout << "Got TTree with " << treco->GetEntries() << " entries" << endl;
// Do plots
const int nbins(30);
const double rangeR(30), rangeZ(100); // standard
//const double rangeR(60), rangeZ(200); // zoomed out
//const double rangeR(100), rangeZ(200); // zoomed in
//const double rangeR(12), rangeZ(30); // zoomed further in
padrz->cd();
TH2F *hrz = new TH2F("hdisp","", nbins,-rangeZ,rangeZ,nbins,-rangeR,rangeR);
hrz->Draw();
padrphi->cd();
TH2F *hrphi = new TH2F("hdisp","", nbins,-rangeR,rangeR,nbins,-rangeR,rangeR);
hrphi->Draw();
// add tracker
padrz->Modified();
padrz->Update();
drawTrackerRZ(padrz);
padrphi->Modified();
padrphi->Update();
drawTrackerRPhi(padrphi);
// set branch addresses for gentree
double vrl0,vxl0,vyl0,vzl0,vrlb,vxlb,vylb,vzlb;
double pmu1,phimu1,etamu1,pmu2,phimu2,etamu2;
double ppr,ppi,phipr,phipi,etapr,etapi;
tgen->SetBranchAddress("vrl0",&vrl0);
tgen->SetBranchAddress("vxl0",&vxl0);
tgen->SetBranchAddress("vyl0",&vyl0);
tgen->SetBranchAddress("vzl0",&vzl0);
tgen->SetBranchAddress("vrlb",&vrlb);
tgen->SetBranchAddress("vxlb",&vxlb);
tgen->SetBranchAddress("vylb",&vylb);
tgen->SetBranchAddress("vzlb",&vzlb);
tgen->SetBranchAddress("pmu1",&pmu1);
tgen->SetBranchAddress("etamu1",&etamu1);
tgen->SetBranchAddress("phimu1",&phimu1);
tgen->SetBranchAddress("pmu2",&pmu2);
tgen->SetBranchAddress("etamu2",&etamu2);
tgen->SetBranchAddress("phimu2",&phimu2);
tgen->SetBranchAddress("ppr",&ppr);
tgen->SetBranchAddress("etapr",&etapr);
tgen->SetBranchAddress("phipr",&phipr);
tgen->SetBranchAddress("ppi",&ppi);
tgen->SetBranchAddress("etapi",&etapi);
tgen->SetBranchAddress("phipi",&phipi);
int genrun, genls, genevt;
tgen->SetBranchAddress("run",&genrun);
tgen->SetBranchAddress("LS",&genls);
tgen->SetBranchAddress("event",&genevt);
// set branch addresses for recotree
double rvrl0,rvxl0,rvyl0,rvzl0,rvrlb,rvxlb,rvylb,rvzlb;
double rpmu1,retamu1,rphimu1,rpmu2,retamu2,rphimu2;
double rppr,rppi,retapr,retapi,rphipr,rphipi;
treco->SetBranchAddress("vrl0",&rvrl0);
treco->SetBranchAddress("vxl0",&rvxl0);
treco->SetBranchAddress("vyl0",&rvyl0);
treco->SetBranchAddress("vzl0",&rvzl0);
treco->SetBranchAddress("vrlb",&rvrlb);
treco->SetBranchAddress("vxlb",&rvxlb);
treco->SetBranchAddress("vylb",&rvylb);
treco->SetBranchAddress("vzlb",&rvzlb);
treco->SetBranchAddress("rpt1m",&rpmu1);
//.........这里部分代码省略.........
示例3: makeInvMassHistosNoBGKK
//.........这里部分代码省略.........
//histos[i]->Draw("HIST");
printf("mean PT: %f\n", meanPT);
TF1 *fit = new TF1(Form("fitPTbin%d00particle%d", nfile*2+1, i), FitFunRelBW, 0.68, 1.05, 5);
//TF1 *fit = new TF1(Form("fitPTbin%d00particle%d", nfile*2+1, i), "gaus(0)", 0.86, 0.92);
fit->SetParNames("BW Area", "Mass", "Width", "PT", "Temp");
fit->SetParameters(TMath::Power(10.0, (float)(nfile)/1.7), 0.89, 0.1, 0.5, 0.130);
//fit->SetParNames("BW Area", "Mass", "Width");
//fit->SetParameters(100, 0.89, 0.0474);
//fit->SetParLimits(0, -10, 1.5e9);
Float_t max = histos[i]->GetXaxis()->GetBinCenter(histos[i]->GetMaximumBin());
//if(max < 0.91 && max > 0.892){
// fit->SetParLimits(1, max-0.001, max+0.001);
//}else{
fit->SetParLimits(1, 0.82, 0.98);
//}
//fit->SetParLimits(2, 0.005, 0.15);
fit->FixParameter(2, 0.042);
fit->FixParameter(3, meanPT);
//fit->SetParLimits(4, 0.05, 0.2);
fit->FixParameter(4, 0.100001);
fit->SetLineColor(2);
printf("%s\n", fit->GetName());
histos[i]->Fit(Form("fitPTbin%d00particle%d", nfile*2+1, i), "BRIM", "SAME");
TVirtualFitter *fitter = TVirtualFitter::GetFitter();
histos[i]->SetStats(1);
histos[i]->Draw();
gPad->Update();
pad->Update();
st = (TPaveStats*)histos[i]->FindObject("stats");
st->SetX1NDC(0.524);
st->SetY1NDC(0.680);
st->SetX2NDC(0.884);
st->SetY2NDC(0.876);
//fit->Draw("SAME");
//histos[i]->Draw();
gPad->Update();
pad->Update();
printf("\n");
diffHistos[i] = (TH1D*)histos[i]->Clone(Form("diffPTbin%d00particl%d", nfile*2+1, i));
diffHistos[i]->Add(fit, -1);
diffCanvas[i]->cd(nfile+1);
diffHistos[i]->Draw("HIST E");
diffHistos[i]->Write();
//counting bins
Float_t integral = histos[i]->Integral(1, 500)*500.0;
//integrals << integral <<" \n";
histos[i]->Write();
fit->Write();
//Do mass and width vs. pT plots just for K*0
if(i==PARTICLE_NUM){
mass = fit->GetParameter(1);
massError = fit->GetParError(1);
collWidth = fit->GetParameter(2);
collWidthError = fit->GetParError(2);
width = Gamma(mass, collWidth);
示例4: composeTrackAnalysisbyAssociator
//.........这里部分代码省略.........
double minX = 0;
double minY = 0;
double maxX = 110;
double maxY = 40;
TCanvas* myCanvas = new TCanvas("Canvas", "Canvas", 800, 600);
myCanvas->cd();
TPad* myPad = new TPad("Pad", "Pad", 0, 0, 1, 1);
myPad->Draw();
myPad->cd();
((TH1D*)(myParticleHist->At(0)))->SetStats(0);
((TH1D*)(myParticleHist->At(0)))->GetXaxis()->SetTitle("simPt/Gev");
((TH1D*)(myParticleHist->At(0)))->GetXaxis()->CenterTitle(1);
((TH1D*)(myParticleHist->At(0)))->Draw();
for(int Index = 0; Index < FileNumber; Index++) {
((TH1D*)(mySTAHist->At(Index)))->SetStats(0);
((TH1D*)(mySTAHist->At(Index)))->SetLineColor(kRed+Index);
((TH1D*)(mySTAHist->At(Index)))->Draw("same");
}
TLegend *STALeg = new TLegend(0.6,0.1,0.9,0.3);
STALeg->SetBorderSize(1);
TString LegKey = "ParticleTrack";
STALeg->AddEntry(myParticleHist->At(0), LegKey, "lpf");
for(int Index = 0; Index < FileNumber; Index++) {
LegKey = TypeName[Index];
STALeg->AddEntry(mySTAHist->At(Index), LegKey, "lpf");
}
STALeg->Draw();
string SaveName = OutputPlotNamepreFix + "_STA2simPt" + OutputPlotNameFix;
myCanvas->SaveAs(SaveName.c_str());
myPad->Clear();
myPad->Update();
double YScale = myPad->GetUymax() / 110.;
((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->SetTitle("simPt/Gev");
((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->CenterTitle(1);
((TH1D*)(myEfficiencyHist->At(0)))->SetStats(0);
((TH1D*)(myEfficiencyHist->At(0)))->Scale(YScale);
((TH1D*)(myEfficiencyHist->At(0)))->SetLineColor(kRed);
((TH1D*)(myEfficiencyHist->At(0)))->Draw("same,ah");
for(int Index = 1; Index < FileNumber; Index++) {
((TH1D*)(myEfficiencyHist->At(Index)))->SetStats(0);
((TH1D*)(myEfficiencyHist->At(Index)))->Scale(YScale);
((TH1D*)(myEfficiencyHist->At(Index)))->SetLineColor(kRed+Index);
((TH1D*)(myEfficiencyHist->At(Index)))->Draw("same,ah");
}
myPad->Update();
if(debug) cout << "Y: " << myPad->GetUymax() << endl;
double YAxisMinValue=((TH1D*)(myEfficiencyHist->At(0)))->GetYaxis()->GetXmin();
double YAxisMaxValue=((TH1D*)(myEfficiencyHist->At(0)))->GetYaxis()->GetXmax();
int YAxisNBins=((TH1D*)(myEfficiencyHist->At(0)))->GetYaxis()->GetNbins();
TGaxis* YAxis = new TGaxis(myPad->GetUxmin(), myPad->GetUymin(), myPad->GetUxmin(), myPad->GetUymax(), 0, 110, 510, "-R");
YAxis->SetLineColor(kGreen);
YAxis->SetLabelColor(kGreen);
YAxis->SetTitle("Efficiency of STA for simPts");
YAxis->CenterTitle(1);
YAxis->Draw();
double XAxisMinValue=((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->GetXmin();
double XAxisMaxValue=((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->GetXmax();
int XAxisNBins=((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->GetNbins();
TGaxis* XAxis = new TGaxis(myPad->GetUxmin(), myPad->GetUymin(), myPad->GetUxmax(), myPad->GetUymin(), XAxisMinValue, XAxisMaxValue, 510, "+L");
XAxis->SetTitle("simPt/Gev");
XAxis->CenterTitle(1);
XAxis->Draw();
TLegend *EffLeg = new TLegend(0.1,0.9,0.4,1.0);
示例5: t1pfmetPhiwithCorr
//.........这里部分代码省略.........
/*leg->AddEntry(h1,"m_{#chi} = 1 GeV","l");
leg->AddEntry(h2,"m_{#chi} = 10 GeV","l");
leg->AddEntry(h3,"m_{#chi} = 100 GeV","l");
leg->AddEntry(h4,"m_{#chi} = 1000 GeV","l");*/
// leg->AddEntry(h1,"m_{Z'} = 600 GeV","l");
leg->AddEntry(hbkg1,"#gamma #gamma","f");
// leg->AddEntry(h2,"m_{Z'} = 800 GeV","l");
leg->AddEntry(hbkg2,"Drell Yann","f");
// leg->AddEntry(h3,"m_{Z'} = 1000 GeV","l");
leg->AddEntry(hbkg3,"#gamma + Jets","f");
// leg->AddEntry(h4,"m_{Z'} = 1200 GeV","l");
leg->AddEntry(hbkg5,"QCD","f");
// leg->AddEntry(h5,"m_{Z'} = 1400 GeV","l"); //only for 25ns samples
leg->AddEntry(hbkg4,"ggH","f");
//leg->AddEntry(h6,"m_{Z'} = 1700 GeV","l"); //only for 25ns samples
leg->AddEntry(hbkg6,"VH","f");
// leg->AddEntry(h7,"m_{Z'} = 2500 GeV","l"); //only for 25ns samples
leg->AddEntry(hbkg7,"ttH","f");
leg->AddEntry(hbkg8,"VBF H","f");
leg->AddEntry(hbkg9,"t + #gamma + Jets","f");
leg->AddEntry(hbkg10,"tt + #gamma +Jets","f");
leg->AddEntry(hbkg11,"#gamma+W","f");
leg->AddEntry(hbkg12,"#gamma+Z","f");
leg->AddEntry(hsum,"Bkg uncertainty","f");
leg->Draw("same");
gStyle->SetOptStat(0);
canvas->cd();
smallPad->Draw();
smallPad->cd();
TGraphErrors *gr = new TGraphErrors(0);
double integralData=hdata->Integral();
double integralBKG=hsum->Integral();
double error, ratio;
for(int w=1; w<20; w++){
if((hdata->GetBinContent(w)!=0) && (hsum->GetBinContent(w)!=0)){
gr->SetPoint(w, hdata->GetBinCenter(w),(hdata->GetBinContent(w))/(hsum->GetBinContent(w)));
ratio= (hdata->GetBinContent(w))/(hsum->GetBinContent(w));
error= (hdata->GetBinContent(w)*sqrt(hsum->GetBinContent(w))/(hsum->GetBinContent(w)*hsum->GetBinContent(w)) + sqrt(hdata->GetBinContent(w))/hsum->GetBinContent(w));
std::cout<<"VALUE: "<<ratio<<" ERROR: "<<error<<std::endl;
gr->SetPointError(w, hdata->GetBinWidth(w)/2,error);
}else{
gr->SetPoint(w, hdata->GetBinCenter(w),10);
}
}
gStyle->SetPadTickY(1);
gStyle->SetPadTickX(1);
gr->GetHistogram()->SetMaximum(2);
gr->GetHistogram()->SetMinimum(0.1);
gStyle->SetTextSize(14);
gROOT->ForceStyle();
gr->GetXaxis()->SetLabelFont(43);
gr->GetXaxis()->SetLabelSize(15);
gr->GetYaxis()->SetLabelFont(43);
gr->GetYaxis()->SetLabelSize(15);
gr->GetXaxis()->SetLimits(-4,4);
gPad->SetGrid();
gStyle->SetStripDecimals(kTRUE);
gr->SetMarkerStyle(20);
gr->SetMarkerSize(0.7);
gr->Draw("AZP");
gr->GetXaxis()->SetTitle("#phi_{MET}^{corr}");
gr->GetXaxis()->SetTitleSize(0.1);
gr->GetYaxis()->SetTitleSize(0.1);
gr->GetYaxis()->SetNdivisions(505);
gr->GetXaxis()->SetTitleOffset(1);
gr->GetYaxis()->SetTitle("Data/MC");
gr->GetYaxis()->SetTitleOffset(0.4);
gr->SetTitle("");
smallPad->Update();
TF1* line = new TF1("line","1",-4,4);
line->SetLineColor(kRed);
line->SetLineWidth(2);
line->Draw("L same");
gr->Draw("ZP SAME");
canvas->SaveAs(Form("./25ns_2246inv_v3/plots/kinematics/metphicorr_MET%.0lf.pdf",METmin));
canvas->SaveAs(Form("./25ns_2246inv_v3/plots/kinematics/metphicorr_MET%.0lf.png",METmin));
}
示例6: createPlot
//.........这里部分代码省略.........
|| hname.Contains("NumberOfGoodTracks",TString::kExact)
|| hname.Contains("TrackPt",TString::kExact)
|| hname.Contains("Chi2Prob",TString::kExact)
){
mainpad->SetLogy(1);
}
else{
mainpad->SetLogy(0);
}
if (hname.Contains("NumberOfTracks",TString::kExact)){
histV1->GetXaxis()->SetRangeUser(0,500);
histV2->GetXaxis()->SetRangeUser(0,500);
}
if (hname.Contains("NumberOfGoodTracks",TString::kExact)) {
histV1->GetXaxis()->SetRangeUser(0,200);
histV2->GetXaxis()->SetRangeUser(0,200);
}
if (hname.Contains("Chi2oNDF",TString::kExact)) {
histV1->GetXaxis()->SetRangeUser(0,10);
histV2->GetXaxis()->SetRangeUser(0,10);
}
if (hname.Contains("vtxNbr")){
histV1->GetXaxis()->SetTitle("Number of Primary Vertices per Event");
histV1->GetYaxis()->SetTitle("Number of Events");
}
histV1->Draw(); // Draw old histo first, ratio is new/old
histV2->Draw("sames");
mainpad->Update();
TPaveStats *st1 = (TPaveStats*)(histV1->GetListOfFunctions()->FindObject("stats"));
st1->SetX1NDC(0.77);
st1->SetY1NDC(0.80);
st1->SetX2NDC(0.98);
st1->SetY2NDC(0.97);
Double_t defaulth = st1->GetY2NDC() - st1->GetY1NDC();
Double_t gaph = 0.02;
TPaveStats *st2 = (TPaveStats*)(histV2->GetListOfFunctions()->FindObject("stats"));
st2->SetX1NDC(0.77);
st2->SetY1NDC(st1->GetY1NDC() - 1.0*defaulth - gaph);
st2->SetX2NDC(0.98);
st2->SetY2NDC(st1->GetY1NDC() - gaph);
TLegend *leg = new TLegend(0.32,0.86,0.76,0.97);
leg->SetTextSize(0.042);
leg->SetTextFont(42);
leg->SetFillColor(10);
leg->SetBorderSize(1); // no frame, no shadow
leg->AddEntry(histV1, V1_V1run, "L" );
leg->AddEntry(histV2, V2_V2run, "L" );
leg->Draw("SAME");
// Draw ratio histogram
if (DrawRatio){
canvas->cd();
TPad* respad = new TPad("respad","respad",0.0,0.78,1.0,0.95);
respad->SetTopMargin(1.05);
respad->Draw();
respad->cd();
示例7: rulevisHists
//.........这里部分代码省略.........
TPad *cPad = (TPad *)(c[countCanvas]->GetPad(countPad));
c[countCanvas]->cd(countPad);
countPad++;
// find the corredponding background histo
TString bgname = hname;
bgname.ReplaceAll("__S","__B");
hkey = vardir->GetKey(bgname);
bgd = (TH1F*)hkey->ReadObj();
if (bgd == NULL) {
cout << "ERROR!!! couldn't find backgroung histo for" << hname << endl;
exit;
}
TString rfname = hname;
rfname.ReplaceAll("__S","__RF");
TKey *hrfkey = rfdir->GetKey(rfname);
TH2F *hrf = (TH2F*)hrfkey->ReadObj();
Double_t wv = hrf->GetMaximum();
// if (rfmax>0.0)
// hrf->Scale(1.0/rfmax);
hrf->SetMinimum(rfmin); // make sure it's zero -> for palette axis
hrf->SetMaximum(rfmax); // make sure max is 1.0 -> idem
hrf->SetContour(nContours,&contourLevels[0]);
// this is set but not stored during plot creation in MVA_Factory
// TMVAGlob::SetSignalAndBackgroundStyle( sigK, bgd );
sig->SetFillStyle(3002);
sig->SetFillColor(1);
sig->SetLineColor(1);
sig->SetLineWidth(2);
bgd->SetFillStyle(3554);
bgd->SetFillColor(1);
bgd->SetLineColor(1);
bgd->SetLineWidth(2);
// chop off "signal"
TString title(hrf->GetTitle());
title.ReplaceAll("signal","");
// finally plot and overlay
Float_t sc = 1.1;
if (countPad==2) sc = 1.3;
sig->SetMaximum( TMath::Max( sig->GetMaximum(), bgd->GetMaximum() )*sc );
Double_t smax = sig->GetMaximum();
if (first) {
hrf->SetTitle( maintitle );
first = kFALSE;
} else {
hrf->SetTitle( "" );
}
hrf->Draw("colz ah");
TMVAGlob::SetFrameStyle( hrf, 1.2 );
sig->Draw("same ah");
bgd->Draw("same ah");
// draw axis using range [0,smax]
hrf->GetXaxis()->SetTitle( title );
hrf->GetYaxis()->SetTitleOffset( 1.30 );
hrf->GetYaxis()->SetTitle("Events");
hrf->GetYaxis()->SetLimits(0,smax);
hrf->Draw("same axis");
cPad->SetRightMargin(0.13);
cPad->Update();
// Draw legend
if (countPad==2){
TLegend *legend= new TLegend( cPad->GetLeftMargin(),
1-cPad->GetTopMargin()-.18,
cPad->GetLeftMargin()+.4,
1-cPad->GetTopMargin() );
legend->AddEntry(sig,"Signal","F");
legend->AddEntry(bgd,"Background","F");
legend->Draw("same");
legend->SetBorderSize(1);
legend->SetMargin( 0.3 );
legend->SetFillColor(19);
legend->SetFillStyle(1);
}
// save canvas to file
if (countPad > noPad) {
c[countCanvas]->Update();
TString fname = Form( "plots/%s_c%i", outputName.Data(), countCanvas+1 );
TMVAGlob::imgconv( c[countCanvas], fname );
// TMVAGlob::plot_logo(); // don't understand why this doesn't work ... :-(
countCanvas++;
}
}
}
if (countPad <= noPad) {
c[countCanvas]->Update();
TString fname = Form( "plots/%s_c%i", outputName.Data(), countCanvas+1 );
TMVAGlob::imgconv( c[countCanvas], fname );
}
}
示例8: genPlotsRatio0102
void genPlotsRatio0102(std::string fullPath, bool custBinning = false)
{
genPlots01(fullPath, 0, custBinning);
TH2F *h1 = (TH2F*)gDirectory->GetList()->FindObject("hrzL0vtx");
genPlots02(fullPath, 0, custBinning);
TH2F *h2 = (TH2F*)gDirectory->GetList()->FindObject("hrzL0vtxreco");
if (0==h1)
{
cout << "Histo hrzL0vtx not present" << endl;
return;
}
if (0==h2)
{
cout << "Histo hrzL0vtxreco not present" << endl;
return;
}
TH2F *hratio;
if (custBinning)
{
double newbinsX[]={0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50};
const int newbinsX_size = sizeof(newbinsX)/sizeof(double);
double newbinsY[]={0,0.5,1,2,4,8,16,32};
const int newbinsY_size = sizeof(newbinsY)/sizeof(double);
hratio = new TH2F("hratio","hratio",newbinsX_size-1,newbinsX,newbinsY_size-1,newbinsY);
}
else
{
hratio = new TH2F("hratio","hratio",30,0,50,30,0,30);
}
c = new TCanvas("c3","c3",1000,600);
const unsigned int nPadX = 1;
const unsigned int nPadY = 1;
c->Divide(nPadX,nPadY);
const unsigned int nPads=nPadX*nPadY;
for(unsigned int i=1; i<=nPads; i++)
{
TPad* pad= (TPad*)c->cd(i);
pad->SetTopMargin(0.10);
pad->SetRightMargin(0.20);
pad->SetLeftMargin(0.15);
//pad->SetLogy();
}
for(int i=1; i<=h1->GetNbinsX(); i++)
for(int j=1; j<=h1->GetNbinsY(); j++)
{
if (h1->GetBinContent(i,j) != 0.)
hratio->SetBinContent(i,j,h2->GetBinContent(i,j) / h1->GetBinContent(i,j));
else
hratio->SetBinContent(i,j,0);
}
hratio->Draw("COLZ");
// add tracker
TPad* pad;
pad = (TPad*)c->cd(1);
pad->Modified();
pad->Update();
repositionPalette("hratio");
pad->Update();
drawTracker(pad);
}
示例9: genPlots02
// draw the same thing but after reco
void genPlots02(std::string fullPath, int nOverlay = 500, bool custBinning = false)
{
const int fVerbose(1);
setTDRStyle();
gStyle->SetOptStat(112211);
gStyle->SetPalette(1);
// Canvas
c = new TCanvas("c2","c2",1000,600);
const unsigned int nPadX = 1;
const unsigned int nPadY = 1;
c->Divide(nPadX,nPadY);
const unsigned int nPads=nPadX*nPadY;
for(unsigned int i=1; i<=nPads; i++)
{
TPad* pad= (TPad*)c->cd(i);
pad->SetTopMargin(0.10);
pad->SetRightMargin(0.20);
pad->SetLeftMargin(0.15);
}
// Open file
TFile *f = TFile::Open(fullPath.c_str());
if (f==0)
{
cout << "File " << fullPath << " not found -- exiting" << endl;
return;
}
if(fVerbose>0)
cout << "Succesfully opened file " << fullPath << endl;
// Get TTree
TTree* t = (TTree*) f->Get("events");
if(fVerbose>0) cout << "Got TTree with " << t->GetEntries() << " entries" << endl;
// Do a cut, if needed
//t->Draw(">>lst","chi2lb>.1&&mlb>5.61&&mlb<5.63");
//t->Draw(">>lst","chi2lb>.1&&isSig==1");
t->Draw(">>lst","(rid1m&4)==4&&(rid2m&4)==4&&mjp>2.895&&mjp<3.295&&prob1m>0.1&&prob2m>0.1&&ptjp>2&&probjp>0.005&&ml0>1.101&&ml0<1.129&&probpr>0.02&&probpi>0.02&&rptpr>rptpi&&ptl0>3&&rptpr>1&&rptpi>0.5&&probl0>0.02&&alphal0<0.3&&d3l0>1&&d3l0/d3El0>10&&problb>0.001&&alphalb<0.3");
TEventList *lst;
lst = (TEventList*)gDirectory->Get("lst");
t->SetEventList(lst);
if(fVerbose>0) cout << "Got TTree with " << t->GetEntries() << " entries" << endl;
// Do plots
c->cd(1);
//doPlot2d(t,"hrzL0vtx", "vrl0:TMath::Abs(vzl0)",30,0,300,30,0,120,"Tit","|z|","r","cm","cm");
if (custBinning)
{
double newbinsX[]={0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50};
const int newbinsX_size = sizeof(newbinsX)/sizeof(double);
std::vector<double> binvecX(newbinsX,newbinsX+newbinsX_size);
//double newbinsY[]={0,1,2,3,4,5,6,7,8,9,10};
double newbinsY[]={0,0.5,1,2,4,8,16,32};
const int newbinsY_size = sizeof(newbinsY)/sizeof(double);
std::vector<double> binvecY(newbinsY,newbinsY+newbinsY_size);
doPlot2d(t,"hrzL0vtxreco", "vrl0:TMath::Abs(vzl0)",binvecX, binvecY,"#Lambda vertices","|z|","r","cm","cm");
}
else
{
doPlot2d(t,"hrzL0vtxreco", "vrl0:TMath::Abs(vzl0)",30,0,50,30,0,30,"#Lambda vertices","|z|","r","cm","cm");
}
// add tracker
TPad* pad;
pad = (TPad*)c->cd(1);
pad->Modified();
pad->Update();
repositionPalette("hrzL0vtxreco");
pad->Update();
pad->SetLogz();
drawTracker(pad);
if (nOverlay<=0) return;
int maxN = nOverlay;
if (maxN > t->GetEntries()) maxN = t->GetEntries();
double vrl0,vzl0,ppr,ppi,etapr,etapi;
t->SetBranchAddress("vrl0",&vrl0);
t->SetBranchAddress("vzl0",&vzl0);
t->SetBranchAddress("ppr",&ppr);
t->SetBranchAddress("etapr",&etapr);
t->SetBranchAddress("ppi",&ppi);
t->SetBranchAddress("etapi",&etapi);
double scalepr = 4;
double scalepi = 8;
{ // reference indicator
const double x1pr = 0; const double y1pr = -3;
const double x2pr = scalepr; const double y2pr = y1pr;
const double versatz = 14;
const double x1pi = x1pr+versatz; const double y1pi = -3;
const double x2pi = x2pr+versatz+scalepi; const double y2pi = y1pi;
TArrow *a;
a = new TArrow(x1pr,y1pr,x2pr,y2pr,.01,">");
a->SetLineColor(24);
a->Draw();
TLatex tl;
tl.SetTextSize(20);
tl.SetTextFont(4);
tl.DrawLatex(x1pr,y2pr-1.2,"p(p) / 1 GeV");
a = new TArrow(x1pi,y1pi,x2pi,y2pi,.01,">");
a->SetLineColor(20);
a->Draw();
//.........这里部分代码省略.........
示例10: createPlot
//.........这里部分代码省略.........
mainpad->SetLogy(0);
}
if (hname.Contains("NumberOfGoodTracks",TString::kExact)) {
histV1->GetXaxis()->SetRangeUser(0,200);
histV2->GetXaxis()->SetRangeUser(0,200);
}
if (hname.Contains("Chi2oNDF",TString::kExact)) {
histV1->GetXaxis()->SetRangeUser(0,10);
histV2->GetXaxis()->SetRangeUser(0,10);
}
if (hname.Contains("vtxNbr")){
histV1->GetXaxis()->SetTitle(x_title);
histV1->GetYaxis()->SetTitle("Number of Events");
}
if ( hname.Contains("NumberOfTracks",TString::kExact)){
histV1->GetXaxis()->SetRangeUser(125,range_upper);
histV2->GetXaxis()->SetRangeUser(125,range_upper);
}
double max = 0;
double V1max = histV1->GetBinContent(histV1->GetMaximumBin());
double V2max = histV2->GetBinContent(histV2->GetMaximumBin());
max = (V1max>V2max) ? V1max : V2max;
histV1->SetMaximum(max*(1.1));
histV1->Draw();
histV2->Draw("sames");
mainpad->Update();
TPaveStats *st1 = (TPaveStats*)(histV1->GetListOfFunctions()->FindObject("stats"));
st1->SetX1NDC(0.77);
st1->SetY1NDC(0.80);
st1->SetX2NDC(0.98);
st1->SetY2NDC(0.97);
Double_t defaulth = st1->GetY2NDC() - st1->GetY1NDC();
Double_t gaph = 0.02;
TPaveStats *st2 = (TPaveStats*)(histV2->GetListOfFunctions()->FindObject("stats"));
st2->SetX1NDC(0.77);
st2->SetY1NDC(st1->GetY1NDC() - 1.0*defaulth - gaph);
st2->SetX2NDC(0.98);
st2->SetY2NDC(st1->GetY1NDC() - gaph);
TLegend *leg = new TLegend(0.32,0.86,0.76,0.97);
leg->SetTextSize(0.042);
leg->SetTextFont(42);
leg->SetFillColor(10);
leg->SetBorderSize(1); // no frame, no shadow
leg->AddEntry(histV1, V1_V1run, "L" );
leg->AddEntry(histV2, V2_V2run, "L" );
leg->Draw("SAME");
// Draw ratio histogram
if (DrawRatio){
canvas->cd();
TPad* respad = new TPad("respad","respad",0.0,0.78,1.0,0.95);
respad->SetTopMargin(1.05);
respad->Draw();
respad->cd();
示例11: phi2
//.........这里部分代码省略.........
leg->AddEntry(hbkg3,"#gamma + Jets","f");
leg->AddEntry(h2,"m_{Z'} = 800 GeV","l");
leg->AddEntry(hbkg5,"QCD","f");
leg->AddEntry(hbkg4,"ggH","f");
leg->AddEntry(h3,"m_{Z'} = 1000 GeV","l");
leg->AddEntry(hbkg6,"VH","f");
leg->AddEntry(hbkg7,"ttH","f");
leg->AddEntry(h4,"m_{Z'} = 1200 GeV","l");
leg->AddEntry(hbkg8,"VBF H","f");
leg->AddEntry(hbkg9,"t + #gamma + Jets","f");
leg->AddEntry(h5,"m_{Z'} = 1400 GeV","l");
leg->AddEntry(hbkg10,"tt + #gamma +Jets","f");
leg->AddEntry(hbkg11,"#gamma+W","f");
leg->AddEntry(h6,"m_{Z'} = 1700 GeV","l");
leg->AddEntry(hbkg12,"#gamma+Z","f");
leg->AddEntry(hsum,"Bkg uncertainty","f");
leg->AddEntry(h7,"m_{Z'} = 2500 GeV","l");
leg->Draw("same");
c1->cd();
smallPad->Draw();
smallPad->cd();
TGraphErrors *gr = new TGraphErrors(0);
double integralData=hdata->Integral();
double integralBKG=hsum->Integral();
double error, ratio;
for(int w=1; w<20; w++){
if((hdata->GetBinContent(w)!=0) && (hsum->GetBinContent(w)!=0)){
gr->SetPoint(w, hdata->GetBinCenter(w),(hdata->GetBinContent(w))/(hsum->GetBinContent(w)));
ratio= (hdata->GetBinContent(w))/(hsum->GetBinContent(w));
error= (hdata->GetBinContent(w)*sqrt(hsum->GetBinContent(w))/(hsum->GetBinContent(w)*hsum->GetBinContent(w)) + sqrt(hdata->GetBinContent(w))/hsum->GetBinContent(w));
std::cout<<"VALUE: "<<ratio<<" ERROR: "<<error<<std::endl;
gr->SetPointError(w, hdata->GetBinWidth(w)/2,error);
}else{
gr->SetPoint(w, hdata->GetBinCenter(w),10);
}
}
gStyle->SetPadTickY(1);
gStyle->SetPadTickX(1);
gr->GetHistogram()->SetMaximum(2);
gr->GetHistogram()->SetMinimum(0.1);
gStyle->SetTextSize(14);
gROOT->ForceStyle();
gr->GetXaxis()->SetLabelFont(43);
gr->GetXaxis()->SetLabelSize(15);
gr->GetYaxis()->SetLabelFont(43);
gr->GetYaxis()->SetLabelSize(15);
gr->GetXaxis()->SetLimits(-4,4);
gPad->SetGrid();
gStyle->SetStripDecimals(kTRUE);
gr->SetMarkerStyle(20);
gr->SetMarkerSize(0.7);
gr->Draw("AZP");
gr->GetXaxis()->SetTitle("#phi_{2}");
gr->GetXaxis()->SetTitleSize(0.1);
gr->GetYaxis()->SetTitleSize(0.1);
gr->GetYaxis()->SetNdivisions(505);
gr->GetXaxis()->SetTitleOffset(1);
gr->GetYaxis()->SetTitle("Data/MC");
gr->GetYaxis()->SetTitleOffset(0.4);
gr->SetTitle("");
smallPad->Update();
TF1* line = new TF1("line","1",-4,4);
line->SetLineColor(kRed);
line->SetLineWidth(2);
line->Draw("L same");
gr->Draw("ZP SAME");
if(pt1min==0 && pt2min == 0 && METmin == 0){
c1->SaveAs("./25ns_2246inv_v3/plots/kinematics/phi2.png");
c1->SaveAs("./25ns_2246inv_v3/plots/kinematics/phi2.pdf");
}
if(pt1min==0.65 && pt2min == 0.25){
c1->SaveAs(Form("./25ns_2246inv_v3/plots/kinematics/phi2_optcuts_MET%.0lf.png",METmin));
c1->SaveAs(Form("./25ns_2246inv_v3/plots/kinematics/phi2_optcuts_MET%.0lf.pdf",METmin));
}
}
示例12: DeltaPhi
//.........这里部分代码省略.........
gStyle->SetPadTickY(1);
gStyle->SetPadTickX(1);
gr->GetHistogram()->SetMaximum(2);
gr->GetHistogram()->SetMinimum(0.1);
gStyle->SetTextSize(14);
gROOT->ForceStyle();
gr->GetXaxis()->SetLabelFont(43);
gr->GetXaxis()->SetLabelSize(15);
gr->GetYaxis()->SetLabelFont(43);
gr->GetYaxis()->SetLabelSize(15);
gr->GetXaxis()->SetLimits(0,3.5);
gPad->SetGrid();
gStyle->SetStripDecimals(kTRUE);
gr->SetMarkerStyle(20);
gr->SetMarkerSize(0.7);
gr->Draw("AZP");
gr->GetXaxis()->SetTitle("|#Delta#phi(#gamma#gamma,E^{miss}_{T})|");
gr->GetXaxis()->SetTitleSize(0.1);
gr->GetYaxis()->SetTitleSize(0.1);
gr->GetYaxis()->SetNdivisions(505);
gr->GetXaxis()->SetTitleOffset(1);
gr->GetYaxis()->SetTitle("Data/MC");
gr->GetYaxis()->SetTitleOffset(0.4);
gr->SetTitle("");
smallPad->Update();
TF1* line = new TF1("line","1",0,3.5);
line->SetLineColor(kRed);
line->SetLineWidth(2);
line->Draw("L same");
gr->Draw("ZP SAME");
TCanvas *c2 = new TCanvas("c2","",500,500);
tree_sig1->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h1_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *h1_norm =(TH1F*)gPad->GetPrimitive("h1_norm");
tree_sig2->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h2_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *h2_norm =(TH1F*)gPad->GetPrimitive("h2_norm");
tree_sig3->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h3_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *h3_norm =(TH1F*)gPad->GetPrimitive("h3_norm");
tree_sig4->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h4_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *h4_norm =(TH1F*)gPad->GetPrimitive("h4_norm");
tree_sig5->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h5_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *h5_norm =(TH1F*)gPad->GetPrimitive("h5_norm");
tree_sig6->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h6_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *h6_norm =(TH1F*)gPad->GetPrimitive("h6_norm");
tree_sig7->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>h7_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *h7_norm =(TH1F*)gPad->GetPrimitive("h7_norm");
tree_bkg1->Draw("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>>hbkg1_norm(15,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *hbkg1_norm =(TH1F*)gPad->GetPrimitive("hbkg1_norm");
示例13: plotFinalEnergy
void plotFinalEnergy() {
gStyle->SetStatH(0.3);
gStyle->SetStatY(0.88);
gStyle->SetStatW(0.3);
char canTitle[180];
sprintf(canTitle,"Energy at Terminal Interaction (10000 tries)");
TCanvas *canFinalEnergy = new TCanvas("canFinalEnergy","Final Energy",800,800);
TPaveLabel *pl = new TPaveLabel(0.1,0.96,0.9,0.99,canTitle,"br NDC");
pl->SetBorderSize(0);
pl->SetFillColor(0);
pl->SetFillStyle(0);
pl->Draw();
TPad *subCanFinalEnergy = new TPad("subCanFinalEnergy","",0,0,1,0.95);
subCanFinalEnergy->Draw();
subCanFinalEnergy->cd();
subCanFinalEnergy->Divide(2,4);
subCanFinalEnergy->Update();
// gStyle->SetOptStat(0);
char fileName[80];
char histTitle[80];
char theEnergies[4][5]={"1e9","1e10","1e11","1e12"};
int theColours[2][3]={{50,42,46},{40,30,38}};
for(int isATau=0;isATau<=1;isATau++) {
for(int i=0;i<4;i++) {
sprintf(fileName,
"newest%sFile%sIce.root",getParticleNameCaps(isATau),theEnergies[i]);
sprintf(histTitle,"%s -- %s GeV",getParticleNameCaps(isATau),theEnergies[i]);
TFile *fp = new TFile(fileName);
TH1F *histEnergy =
new TH1F("histEnergy",histTitle,100,7.5,12.5);
TH1F *histEnergy2 =
new TH1F("histEnergy2","Last Energy",100,7.5,12.5);
TH1F *histEnergy3 =
new TH1F("histEnergy3","Last Energy",100,7.5,12.5);
TTree *theTree = (TTree*) fp->Get("theTree");
cout << theTree->GetEntries() << endl;
subCanFinalEnergy->cd((2*i)+isATau+1);
gPad->SetTopMargin(0.12);
// gPad->SetBottomMargin(0.2);
histEnergy->SetLineWidth(3);
histEnergy->SetLineColor(theColours[isATau][0]);
histEnergy2->SetLineWidth(3);
histEnergy2->SetLineColor(theColours[isATau][1]);
histEnergy3->SetLineWidth(3);
histEnergy3->SetLineColor(theColours[isATau][2]);
theTree->Draw("log10(stepIntEnergy)>>histEnergy","stepIntType>=4");
// histEnergy->GetXaxis()->SetTitle("IntType (#mus)");
// histEnergy->GetXaxis()->SetBinLabel(2,"Bremsstrahlung");
// histEnergy->GetXaxis()->SetBinLabel(3,"Pair Production");
// histEnergy->GetXaxis()->SetBinLabel(4,"Photonuclear");
// histEnergy->GetXaxis()->SetLabelSize(0.09);
// histEnergy->GetXaxis()->SetLabelOffset(0.02);
theTree->Draw("log10(stepIntEnergy)>>histEnergy2","stepIntType==4");
theTree->Draw("log10(stepIntEnergy)>>histEnergy3","stepIntType==5");
histEnergy->DrawCopy();
if(histEnergy2->GetEntries())
histEnergy2->DrawCopy("same");
if(histEnergy3->GetEntries())
histEnergy3->DrawCopy("same");
if(histEnergy->GetEntries())
gPad->SetLogy();
if(i==0) {
TLegend *leg = new TLegend(0.7,0.2,0.9,0.6);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->SetBorderSize(0);
leg->AddEntry(histEnergy2,"Decay","l");
leg->AddEntry(histEnergy3,"Weak (CC)","l");
leg->AddEntry(histEnergy,"Either","l");
leg->Draw("same");
}
}
}
for(int i=0;i<8;i++) {
// cout << "Doing title "<< i+1 << endl;
subCanFinalEnergy->cd(i+1);
sortOutTitle(0.07);
}
// gStyle->SetOptStat(1110);
}
示例14: plotWithRatio
//----------------------------------------//
// Plot ZHS and G4 on same figure
//----------------------------------------//
void plotWithRatio(vector<TString> f_zhs,
vector<TString> f_g4,
TString p_zhs,
TString p_g4,
vector<TString> savenames)
{
// Make canvas
TCanvas* c = makeCanvas("c");
//c->SetLogy();
// Make a legend
TLegend* leg = makeLegend(0.15,0.3,0.79,0.92);
leg->SetTextSize(0.055);
// Titles
TString xtitle = "time [ns]";
TString ytitle = "A [Vs/m]";
// Loop and get plots
TProfile* prof_Z = NULL;
TProfile* prof_G = NULL;
TH1D* h_resetZ = NULL;
for(unsigned int i=0; i<f_zhs.size(); ++i){
// Load ZHS profile
TFile* file_Z = new TFile(f_zhs.at(i).Data());
prof_Z = getProfile(file_Z, p_zhs, xtitle, ytitle, kBlue, 20);
prof_Z->SetDirectory(0);
file_Z->Close();
leg->AddEntry(prof_Z,"ZHS","lep");
// Load Geant profile
TFile* file_G = new TFile(f_g4.at(i).Data());
prof_G = getProfile(file_G, p_g4, xtitle, ytitle, kRed, 20);
prof_G->SetDirectory(0);
file_G->Close();
leg->AddEntry(prof_G,"Geant4","lep");
// Scale Geant4 profile up by factor of R
//prof_G->Scale(m_R);
// reset the zhs timing info
//prof_Z = resetZHS(prof_Z, prof_G, kBlue, m_R);
h_resetZ = resetZHS(prof_Z, prof_G, kBlue, m_R);
//prof_Z->Scale(1/m_R);
// Get maximum
float maximum = prof_G->GetMaximum();
if( maximum < h_resetZ->GetMaximum() )
maximum = h_resetZ->GetMaximum();
prof_G->SetMaximum(maximum*5);
prof_G->SetMinimum(maximum*1e-5);
// Make two pads
TPad* top = NULL;
TPad* bot = NULL;
makePads(c, top, bot);
// Set some attributes
prof_G->GetYaxis()->SetLabelSize(0.05);
prof_G->GetYaxis()->SetTitleSize(0.05);
prof_G->GetYaxis()->SetTitleOffset(1.0);
prof_G->GetXaxis()->SetLabelSize(0);
// Draw top plots
c->cd();
top->Draw();
top->cd();
top->SetLogy();
prof_G->Draw();
//prof_Z->Draw("sameep");
h_resetZ->Draw("sameep");
leg->Draw("same");
top->Update();
// Draw bot ratio
c->cd();
bot->Draw();
bot->cd();
//TProfile* prof = prof_G->Clone("ratio");
TH1D* prof = prof_G->ProjectionX("ratio");
prof->SetLineColor(prof_G->GetLineColor());
prof->SetMarkerColor(prof_G->GetMarkerColor());
prof->SetStats(0);
//prof->Divide(prof_Z);
prof->Divide(h_resetZ);
prof->GetYaxis()->SetTitle("G4/ZHS");
prof->SetMinimum(0);
//prof->SetMaximum(50);
prof->SetMaximum(2);
prof->GetXaxis()->SetLabelSize(0.1);
prof->GetYaxis()->SetLabelSize(0.1);
prof->GetXaxis()->SetTitleSize(0.12);
prof->GetYaxis()->SetTitleSize(0.12);
prof->GetYaxis()->SetTitleOffset(0.4);
prof->GetYaxis()->SetNdivisions(405);
//.........这里部分代码省略.........