Entries under a gaussian?

Hi everyone, I’m a total rookie when it comes to ROOT and I am sorry I’m probably going to ask a silly question. I’m using a piece of code provided by one of my teachers which opens a .Spe file, skips the first 12 lines, draws a histogram of the following 2048 lines, and plots a gaussian curve based on the data and the range you provide:

const char *one = “fileone.Spe”;
fstream file(one, ios::in);
string dummy;
for(Int_t i=0; i<12; i++) getline(file, dummy);
TH1I *hspectrum = new TH1I(“hspectrum”,“hspectrum”,2048,0,2047);
Int_t n=0;
Int_t counts;
while((file >> counts) && n < 2048){

Now, my problem is that I need to get the number of entries under the gaussian I just drew, and I don’t know hot wo do it.
Thank you for your help.

std::cout << hspectrum->GetFunction("gaus")->Integral(2, 45) / hspectrum->GetBinWidth(1) << std::endl;
1 Like

Thank you very, very, very much.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.