souvik
June 6, 2021, 11:29am
1
Dear All,
I want to count entries corresponding to each bin so that I can have idea which decay mode is contributing how much to the backgrounds. Could you please help me out with some sample code ?
Thanks.
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
souvik
June 6, 2021, 11:52am
3
Thanks for your reply. I am trying this hist1->GetBinContent(100);.
But it gives me nothing.
Shall I apply inside for loop ?
I want all the bin numbers to be printed with corresponding entries.
Please feel free to update my code.
modeadz.C (426 Bytes)
Your histogram has 80 bins in total, and you try to get the contents of the bin 100?
It seem to me that you want:
hist1->GetBinContent(hist1->FindFixBin(100.))
souvik
June 6, 2021, 12:03pm
5
No, it is not showing me anything extra. I tried with hist1->GetBinContent(hist1->FindFixBin(100.));.
Just drawing the hist1 but not giving any extra information.
Thanks
Why would it show anything?
It seems to me you want:
std::cout << hist... << std::endl;
souvik
June 6, 2021, 12:12pm
7
Right !
How can I apply a counter here so that it can keep on printing entries for all bins.
Thanks.
for (int i = 1; i <= hist1->GetNbinsX(); i++) std::cout << hist1->GetBinContent(i) << std::endl;
1 Like
Thanks a lot. It did work.
system
Closed
June 20, 2021, 1:17pm
10
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.