i have plotted two histograms on the same canvas by the following code, The output plot shows no axis (X and Y) across histograms.
#include <TStyle.h>
#include <TCanvas.h>
#include <vector>
#include <iostream>
#include "TFile.h"
#include <TLorentzVector.h>
#include "TROOT.h"
#include "TH1F.h"
#include "TLegend.h"
using namespace std;
int plots(){
//TFile * inputfile = new TFile("treeeight_out.root","READ"); TFile * inputfile2 = new TFile("treenine_out.root","READ");
TCanvas* comp = new TCanvas("comp","",1100,1100);
TFile *f1=TFile::Open("treeeight_out.root");
// TH1F *h1=(TH1F*)f1->Get("Tmomen");
// TH1F *h3=(TH1F*)f1->Get("Tenergy");
TH1F *h4=(TH1F*)f1->Get("Teta");
TFile *f2=TFile::Open("treenine_out.root");
//TH1F *h2=(TH1F*)f2->Get("Tmomendata");
// TH1F *h5=(TH1F*)f2->Get("Tenergydata");
TH1F *h6=(TH1F*)f2->Get("Tetadata");
// h1->Draw("histo");
// h1->SetLineColor(kRed);
// h2->Draw("histosame");
// h2->SetLineColor(kBlue);
// h3->Draw("plot");
// h3->SetLineColor(kRed);
// h5->Draw("plotsame");
// h5->SetLineColor(kBlue);
h4->Draw("graph");
h4->SetLineColor(kRed);
h6->Draw("graphsame");
h6->SetLineColor(kBlue);
TLegend *legend=new TLegend(0.75,0.34,0.85,0.44);
legend->SetTextSize(0);
legend->AddEntry(h4,"MC","l");
legend->AddEntry(h6,"DATA","l");
legend->Draw();
comp->Update();
comp->Print("pt");
return 0;
}
can anybody help to resolve this issue.
I am attaching the produced histogram also.
PFA
eta_Validation.pdf (15.6 KB)