|
[Rivet] rivet: normalizing histograms to variable bin widthOldrich Kepka oldrich.kepka at cern.chMon Mar 17 13:09:36 GMT 2014
Hi Andy, On 17 March 2014 13:20, Andy Buckley <andy.buckley at cern.ch> wrote: > Hi Oldrich (and CC'ing the Rivet list -- please send to that rather than > me directly!), > > In the API of YODA the bin width is taken into account when calling the > HistoBin::height() method: > > https://yoda.hepforge.org/trac/browser/include/YODA/HistoBin1D.h#L97 > > (and a corresponding divide by x-y bin area in HistoBin2D) > > By "normalize to bin width", I'm guessing that you mean "divide by > integral = sum of bin & overflows weight sums". For bins, the sum of > weights is the area rather than the height. Is that what you had in > mind? If so (and I'm sure this is the physically correct approach) then > this is already what YODA does: > > Histo1D::normalize: > https://yoda.hepforge.org/trac/browser/include/YODA/Histo1D.h#L146 > calls Histo1D::integral: > https://yoda.hepforge.org/trac/browser/include/YODA/Histo1D.h#L298 > calls Histo1D::sumW: > https://yoda.hepforge.org/trac/browser/src/Histo1D.cc#L43 > > Does that answer your question? In the mkScatter function that converts Histo1D etc. to TGraphAsymmErrs-like Scatter2Ds. This answers my question. I knew I must have been missing something fundamental. Histograms are converted to scatter, where the height() comes into play, so that the plotted result is a differential cross section. Thanks, Oldrich we use the > Bin::height() function so that the plotting will look correct, but > internally the area() == sumW() are much more important. > > Andy > > > On 17/03/14 12:38, Oldrich Kepka wrote: >> Hi Andy, >> >> sorry for this basic question. Is there already an implementation of a >> method normalizing histograms to produce differential cross section, >> i.e. normalizing to bin width. >> >> Presumably, there must be, because there are several differential >> cross sections implemented. I am probably missing something, but I >> cannot find the place where the bin widtf is taken into account >> (looking through Histo1D, Bin1D, Dpn1D ... ). The usual Analysis >> scale/normalize methods boil down to scaleW of Dbn1D; scaling >> according to global desired factor. >> >> Otherwise, I would go for something like this. >> >> _h_ZZ_ZpT.scale( norm); >> for(size_t i = 0; i< _h_ZZ_ZpT-> numBins(); i++) { >> _h_ZZ_ZpT->bin(i). scaleW( 1/_h_ZZ_ZpT->bin(i). width() ); >> } >> normalize(_h_ZZ_ZpT , 1); >> >> http://hepdata.cedar.ac.uk/view/ins1203852 >> >> >> Thanks, >> Oldrich >> > > > -- > Dr Andy Buckley, Royal Society University Research Fellow > Particle Physics Expt Group, University of Glasgow / PH Dept, CERN
More information about the Rivet mailing list |