Thanks, but I know these website. The problem is that website sometimes is not so clear for everybody.
I have codes, but I didn’t want to post them. I just wanted somebody who uses these everyday perfectly to write me 4 or 5 line of code to see the difference.
For instance, imagine my histogram starts from 0 keV to 600 keV. (Namely from 0 to 600 as a number) If you choose any number on X axis, let’s say 60, that will correspond to the bin number 60+1= 61. Thus,
when you say :
TAxis *axis = h1->GetXaxis();
int bin_no = axis->FindBin( 60 ); the answer is bin_no= 61, but
when you say:
h1->GetBin(61); the answer is 61 because you actually gave the answer already inside (61). What’ s the purpose here? Nothing.
In that perspetive, I think it is useless, but in the “for loop” it is more useful. However, I still need a little working code to see how it works.
These things are important because you may have energy on your X axis and it was channel number before calibration of the histogram’s x axis. When you might need a conversion between them. you use FindBin(…) not GetBin(…) in the case of channel number occasion.