Hello Rooters,
I was trying to calculate the significance value for every value using a signal and background histogram. I need to save this significance value and the corresponding bin value for later use. I was trying to use TH1D for storing significance values. I need to save the significance value for the first bin cut in the first bin. First I am not sure how to do that. Second I feel using a histogram to store a function is not the most natural way here, there must be something better. I have attached the code below. Thanks for your time!
int nent = h1_s->GetNbinsX();
for(int e=0; e<nent; e++){
double cut_value = h1_s->GetBinCenter(e);
s = h1_s->Integral(e,nent);
b = h1_b->Integral(e,nent);
significance = s/sqrt(s+b);
h_declengthNorm->Fill(significance);
h1_s and h1_b are signal and background histograms respectively. h_declengthNorm is a histogram with the same number of bins, bin min, and bin max as h1_s and h1_b, this is where I intend to save the significance function.
ROOT Version:6.24/02
Platform:(NAME=“HefftorLinux”,ID_LIKE=“arch”,VERSION_ID=v2021-02-05)
Compiler: gcc 11.1.0