lcsim/src/org/lcsim/contrib/CarstenHensel
diff -N HMatrixAnalyzerPlotter.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HMatrixAnalyzerPlotter.java 24 Aug 2005 15:10:31 -0000 1.1
@@ -0,0 +1,88 @@
+/*
+ * HMAtrixAnalyzerPlotter.java
+ *
+ * Created on August 23, 2005, 2:44 PM
+ *
+ * To change this template, choose Tools | Options and locate the template under
+ * the Source Creation and Management node. Right-click the template and choose
+ * Open. You can then make changes to the template in the Source Editor.
+ */
+
+//package org.lcsim.contrib.CarstenHensel;
+
+import hep.aida.*;
+import org.freehep.application.Application;
+import org.freehep.application.studio.Studio;
+import org.lcsim.util.aida.AIDA;
+
+
+/**
+ *
+ * @author carsten
+ */
+public class HMatrixAnalyzerPlotter {
+
+
+ private AIDA aida = AIDA.defaultInstance();
+ private static final String inputFile1 = "exampleAnalysisJava.aida";
+ private static final String inputFile2 = "exampleAnalysisJava2.aida";
+ private static final String tupleName = "HMatrixAnalyzerMyTuple";
+ private static final String[] columnNames = { "chisq", "chisqDiag", "prob", "clusterEnergy" };
+
+ /** Creates a new instance of HMAtrixAnalyzerPlotter */
+ public HMatrixAnalyzerPlotter() {
+ }
+
+
+
+
+
+
+ public static void main(String[] argv) {
+
+ HMatrixAnalyzerPlotter plotter = new HMatrixAnalyzerPlotter();
+ IAnalysisFactory af = IAnalysisFactory.create();
+ ITree tree = af.createTreeFactory().create();
+ IHistogramFactory hf = af.createHistogramFactory(tree);
+ ITree aidaMasterTree = (ITree) ((Studio) Application.getApplication()).getLookup().lookup(ITree.class);
+
+
+
+ aidaMasterTree.cd("/" + plotter.inputFile1);
+ ITuple tuple1 = (ITuple)aidaMasterTree.find(plotter.tupleName);
+ aidaMasterTree.cd("/" + plotter.inputFile2);
+ ITuple tuple2 = (ITuple)aidaMasterTree.find(plotter.tupleName);
+
+ ITuple[] tupleHolder = {tuple1, tuple2};
+
+ double[] prob = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9};
+
+ int entries = tuple1.rows();
+ tuple1.start();
+ for (int iTuple = 0; iTuple < tupleHolder.length; iTuple++) {
+ double[] sum = plotter.integrate(tupleHolder[iTuple], 2, prob, 1.0);
+ for (int i = 0; i < prob.length; i++) {
+ plotter.aida.cloud2D((new Integer(iTuple)).toString()).fill(prob[i], sum[i]);
+ }
+ }
+ }
+
+ private double[] integrate(ITuple tuple, int rowNumber, double[] probVals, double weight) {
+ int nTupleRows = tuple.rows();
+ double[] integral = new double[probVals.length];
+ tuple.start();
+ for (int iRow = 0; iRow < nTupleRows; iRow++) {
+ tuple.next();
+ for (int iProb = 0; iProb < probVals.length; iProb++) {
+ if (tuple.getDouble(rowNumber) > probVals[iProb]) {
+ integral[iProb] += weight;
+ }
+ }
+ }
+ return integral;
+ }
+
+}
+
+
+