Dear experts,
I want to draw 2 different clone on the same pad but only the last on (KGreen) is draw despite the “same” option. Can you see please what is wrong [*]?
Regards
void fit(){
// read root file
TFile *fs = new TFile("hist.root");
TH1D *hrsp = (TH1D*)fs->Get("RelRsp");
TF1 *cb = new TF1("cb", fnc_dscb1, 0, 2 , 7);
TF1 *cbRound = new TF1("cbRound", fnc_dscb1_round, 0, 2 , 8);
int maxbin{hrsp->GetMaximumBin()};
double xbinmax {hrsp->GetXaxis()->GetBinCenter(maxbin)};
double ybinmax {hrsp->GetBinContent(maxbin)};
cb ->SetParName (0, "norm"); cb ->SetParameter(0, ybinmax);
...
cbRound ->SetParName (0, "norm"); cbRound ->SetParameter(0, ybinmax);
...
cb ->SetLineColor(kRed);
hrsp->Fit("cb", "R");
TH1D *hrsp1=(TH1D*)hrsp->DrawClone(); // clone1
cbRound ->SetLineColor(kGreen);
hrsp->Fit("cbRound", "R");
TH1D *hrsp2=(TH1D*)hrsp->DrawClone(); // clone2
TCanvas *c = new TCanvas("c", "", 700, 700);
c->Divide(1,2);
c->cd(1);
hrsp1->GetXaxis()->SetRangeUser(0, 2);
hrsp1->Draw();
hrsp2->GetXaxis()->SetRangeUser(0, 2);
hrsp2->Draw("same");
c->cd(2);
gPad->SetLogy();
TH1D* hrspClone1 = (TH1D*) hrsp1->DrawClone();
hrspClone1->GetXaxis()->SetRangeUser(0, 2);
hrspClone1->Draw();
hrsp2->GetXaxis()->SetRangeUser(0, 2);
hrsp2->Draw("same");
}