I generate some TOY data sets from a PDF within a certain range. Now I want to get the number of data points with different sub-ranges from the generated data sets.
The generated toy data distribution is shown here.
Now I want to get how many events are there in between (1,1.3) and (1.3,1.8) etc. can anyone let me know how to calculate the number of entries within the subranges.
You can either set ranges on the observable, and name them one by one, or you just list cuts such as myDataSet.sumEntries("0 < x && x < 5").
Replace x with the name of your observable.
Thank You! This works directly without converting to TH1. But I try to convert to TH1. After converting,the Integral() is not working properly when I specify limits. But Integral() without mentioning the range gives the total number of entries.
cout<<“Sum of entries…”<< data->sumEntries(“1.3 < x && x < 1.5”)<<endl;
: warning: implicit conversion from ‘double’ to ‘Int_t’ (aka ‘int’) changes value from 1.5 to 1 [-Wliteral-conversion]
calc = h1->Integral(1.3,1.5);
~~~~~~~~ ^~~