I have a simple function which takes two histograms, plots them on separate pads, and then the division of the two in the third pad. For some reason only the second pad is drawing.
void Histogram::Superposition( std::string Slice, TFile *File1, TFile *File2, std::string Fit, std::map < TString, TH1*> &themap ){
TString myString1 = Form( "dSigmadBDT0%s_data_-10.0", Slice.c_str() );
TString myString2 = Form("dNdqT2_0%s_Truth_-10.0_5", Slice.c_str() );
double PhiLow = -3.142;
double PhiHigh = 3.142;
c->cd(1);
///Obtain the TH1Ds from the root file
TH1D *h1;
h1 = (TH1D*)File1->Get(myString1 );
// h1->SetDirectory(0);
if(h1 == nullptr){std::cout << "histogram not found" <<std::endl;}
h1->SetTitle(Form("dSigmadqT2_%s_data_-10.0", Slice.c_str() ));
h1->SetName(Form("dSigmadqT2_%s_data_-10.0", Slice.c_str() ));
h1->Draw();
c->cd(2);
TH1D *h2;
h2 = (TH1D*)File2->Get(myString2 );
//h2->SetDirectory(0);
if(h2 == nullptr){std::cout << "histogram not found" <<std::endl;}
h2->SetTitle(myString2);
h2->SetName(myString2);
h2->Draw();
c->cd(3);
TH1D *h3;
h3 = (TH1D*)h1->Clone();
h3->SetTitle("Ratio");
h3->SetName("Ratio");
h3->Divide(h1,h2,1.,1.);
h3->Draw();
c->Draw();
}
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided