Message: RE: FW: AIDA histogram analysis problem | Not Logged In (login) |
> It seems my case is a little complicated... I have the two > histograms: hist1 and hist2, and need to get the ratio > hist1/hist2. However, some part of hist2 is zero, so if I > follow the method you mentioned below, I will get infinity in > the resulted new histogram. What I want to do is just set > those parts zero, and the other still the ratio of the two > histograms. How to deal with this problem? Hi, I am not sure which implementation of AIDA you are using. In our implementation (JAIDA) you get 0 as the bin contents when you divide by 0 (like PAW). Arguably INFINITE is a more sensible result to get, provided the plotter deals with that reasonably. Perhaps there should be an option to control how to handle division by 0. Anyway, if you want to do something other than the default, after the division you could extact the contents of the histogram into a DataPointSet and then mamipulate the data as you like, something like: IAnalysisFactory = class hep.aida.IAnalysisFactory af = IAnalysisFactory::create() Random = class java.util.Random r = Random(12345) tree=af.createTreeFactory().create(); hf = af.createHistogramFactory(tree); pf = af.createDataPointSetFactory(tree); h1 = hf.createHistogram1D("test 1d",50,-3,6); h2 = hf.createHistogram1D("test 2d",50,-3,6); for (i=0; i<10000; i++) { h1.fill(r.nextGaussian()); h2.fill(3+r.nextGaussian()); } div = hf.divide("h1 divded by h2",h1,h2); points = pf.create("points",div); for (i=0; i<points.size(); i++) { point = points.point(i); y = point.coordinate(1); if (Double::isInfinite(y.value())) y.setValue(0); } plotter = af.createPlotterFactory().create("Plot"); plotter.createRegions(2,1,0); plotter.region(0).plot(div); plotter.region(1).plot(points); plotter.show(); |
Inline Depth: | Outline Depth: | Add message: |
to: |