Skip to main content

Posts

Showing posts from September, 2019

Example displaying two histograms and their ratio

// Example displaying two histograms and their ratio. void ratioplot() { // Define two gaussian histograms. Note the X and Y title are defined // at booking time using the convention "Hist_title ; X_title ; Y_title" TH1F *h1 = new TH1F ( "h1" , "Two gaussian plots and their ratio;x title; h1 and h2 gaussian histograms" , 100, -5, 5); TH1F *h2 = new TH1F ( "h2" , "h2" , 100, -5, 5); h1-> FillRandom ( "gaus" ); h2-> FillRandom ( "gaus" ); // Define the Canvas TCanvas *c = new TCanvas ( "c" , "canvas" , 800, 800); // Upper plot will be in pad1 TPad *pad1 = new TPad ( "pad1" , "pad1" , 0, 0.3, 1, 1.0); pad1-> SetBottomMargin (0); // Upper and lower plot are joined pad1-> SetGridx (); // Vertical grid pad1-> Draw (); // Draw the upper pad: pad1 pad1-> cd (); // pad1 becomes the c