use("pnuts.lib") IAnalysisFactory = class hep.aida.IAnalysisFactory af = IAnalysisFactory::create() fitf = af.createFitFactory(); ff = af.createFunctionFactory(aidaMasterTree); fitter = fitf.createFitter(); hf = af.createHistogramFactory(aidaMasterTree); tf = af.createTupleFactory(aidaMasterTree); aidaMasterTree.cd("/JAS3DataSet.aida"); hist = aidaMasterTree.find("gauss Sum Hist"); leftGaussian = hf.createHistogram1D("leftGaussian","",hist.axis().bins(),hist.axis().lowerEdge(),hist.axis().upperEdge()); rightGaussian = hf.createHistogram1D("rightGaussian","",hist.axis().bins(),hist.axis().lowerEdge(),hist.axis().upperEdge()); tuple = aidaMasterTree.find("tuple"); leftFilter = tf.createFilter("gaussSum<1.5"); rightFilter = tf.createFilter("gaussSum>1.5"); eval = tf.createEvaluator("gaussSum"); tuple.project(rightGaussian, eval, rightFilter) tuple.project(leftGaussian, eval, leftFilter) g1 = ff.createFunctionByName("g1","g"); g1InitPars = [20,1,0.2] g1.setParameters(g1InitPars) leftResult = fitter.fit(leftGaussian,g1); g2 = ff.createFunctionByName("g2","g"); g2InitPars = [45,3,1] g2.setParameters(g2InitPars) rightResult = fitter.fit(rightGaussian,g2); plotter = af.createPlotterFactory().create("Example3bis Plot"); plotter.destroyRegions(); plotter.createRegion(0,0,.66,1).plot(hist); plotter.region(0).plot(leftResult.fittedFunction()); plotter.region(0).plot(rightResult.fittedFunction()); plotter.createRegion(.66,0,.33,.5).plot(leftGaussian); plotter.region(1).plot(leftResult.fittedFunction()); plotter.createRegion(.66,.5,.33,.5).plot(rightGaussian); plotter.region(2).plot(rightResult.fittedFunction()); plotter.show();