Hello everyone,
Please refer to to code below could draw a histogram h_enu_sub by getting the content from h_ibd_sub (which is a returned value / histogram that have been generated), Now I need to use the bin center of the “old” histogram “h_ibd_sub” to generate a new histogram “h_enu_sub”
TH1F* h_enu_sub (TH1F* enu, h_ibd_sub->GetBinContent(ibin));
for ( int ibin = 1; ibin <= h_ibd_sub->GetNbinsX(); ++ibin) {
float ep = h_ibd_sub->GetBinCenter(ibin);
float cos = 1;
float e = 0.51099895;
float p = 938.27208816;
float n = 939.56542052;
float k = ep - 2 * e;
float q = sqrt (k * k + 2 * e * k)
float enu = (k * k - 2 * k * p + 2 * e * k - n * n + p * p - 2 * e * p - q * q + e * e) / (2 * (-cos * q + e + k - p));
TH1F* h_enu_sub = (TH1F*) h_enu_sub->Fill(enu, h_ibd_sub->GetBinContent(ibin));
return h_enu_sub
}
Your help will be appreciated