I’m trying to divide two histograms, “top” by “bottom”, to produce a third histogram, “Forward-Backward Asymmetry…”. However, checking individual bins shows a discrepancy between the third histogram and what the division output should be. For example, in the images provided, dividing bin 8 in “top” by bin 8 in “bottom” should result in about 0.15, however, the value of bin 8 in “Forward…” is about 0.6. Furthermore, this only seems to be an issue when inputting particle event data, and not Monte Carlo simulations.

I have included some of my code below.

bottom->Add(h_lep_cos_decang_pos,h_lep_cos_decang_neg);

flip->Add(h_lep_cos_decang_neg,-1);

top->Add(h_lep_cos_decang_pos,flip);

TH1F *clone = (TH1F*)top->Clone(“clone”);

top->Divide(bottom);

h_lep_cos_w->Add(top);

h_lep_cos_decang_pos and h_lep_cos_decang_neg are both TH1F* objects. Am I perhaps misunderstanding the Add/Divide functions, or is there an error in the code that I am missing?

Edit: Posted the running code

Analysis.C (7.0 KB) Analysis.h (575 Bytes) CLoop.C (2.6 KB) CLoop.h (17.4 KB)