ROOT Version: 6.26
Platform: Linux Suse
Compiler: g+±7
I could not find a smarter way to fill a 2d integer histogram with respect to its “x”, “y” other than
for (j_pul=0; j_pul<n_pulses; j_pul++){
int nheight = (int)(PulseHeight[j_pul]+0.5);
int nshape = (int)(PulseShape [j_pul]+0.5);
if ( (nheight > 0) && (nheight < nxCh) && (nshape > 0) && (nshape < nyCh) ){
ntmp = hpha->GetBinContent(nheight, nshape);
hpha->SetBinContent(nheight, nshape, ntmp+1);
}
}
I am quite sure such “count” histogram can be built a smarter way but I could not find anything browsing the documentation, the forum or google.
It’s basically what numpy.histogram2d does (by default).
If you have a proper reference or example, please let me know.
Thanks
Giovanni