3 modified files
lcsim
diff -u -r1.62 -r1.63
--- project.xml 26 Sep 2007 20:42:17 -0000 1.62
+++ project.xml 4 Oct 2007 22:02:07 -0000 1.63
@@ -49,25 +49,31 @@
<dependency>
<groupId>aida</groupId>
<artifactId>aida</artifactId>
- <version>3.2.1</version>
+ <version>3.3</version>
<url>http://aida.freehep.org</url>
</dependency>
<dependency>
<groupId>aida</groupId>
<artifactId>aida-dev</artifactId>
- <version>3.2.1</version>
+ <version>3.3</version>
<url>http://aida.freehep.org</url>
</dependency>
<dependency>
<groupId>freehep</groupId>
<artifactId>freehep-hep</artifactId>
- <version>13032005</version>
+ <version>04112007</version>
<url>http://java.freehep.org</url>
</dependency>
<dependency>
+ <groupId>net.java.dev</groupId>
+ <artifactId>truezip</artifactId>
+ <version>6.6</version>
+ <url>https://truezip.dev.java.net</url>
+ </dependency>
+ <dependency>
<groupId>freehep</groupId>
<artifactId>freehep-base</artifactId>
- <version>27012005</version>
+ <version>26092007</version>
<url>http://java.freehep.org</url>
</dependency>
<dependency>
@@ -118,7 +124,7 @@
<dependency>
<groupId>jas</groupId>
<artifactId>jas3</artifactId>
- <version>0.8rc3</version>
+ <version>26092007</version>
<url>http://jas.freehep.org</url>
</dependency>
<dependency>
lcsim/src/org/lcsim/contrib/onoprien/tester
diff -u -r1.3 -r1.4
--- TrackingTestBase.java 21 Sep 2007 12:33:46 -0000 1.3
+++ TrackingTestBase.java 4 Oct 2007 22:02:07 -0000 1.4
@@ -56,7 +56,7 @@
* {@link #printCumulativeStatistics()}.
*
* @author D. Onoprienko
- * @version $Id: TrackingTestBase.java,v 1.3 2007/09/21 12:33:46 onoprien Exp $
+ * @version $Id: TrackingTestBase.java,v 1.4 2007/10/04 22:02:07 serbo Exp $
*/
abstract public class TrackingTestBase extends Driver {
@@ -483,22 +483,34 @@
// -- Miscellaneous utility methods : -----------------------------------------
public IHistogram1D efficiencyHistogram(String title, IHistogram1D good, IHistogram1D all) {
- IHistogramFactory hFac = _aida.histogramFactory();
- Histogram1D eff = (Histogram1D) hFac.divide(title,good, all);
- int nBins = eff.axis().bins();
- for (int bin = 0; bin<nBins; bin++) {
- double g = good.binHeight(bin);
- double a = all.binHeight(bin);
- double error;
- if (a < .1) {
- error = 0.;
- } else {
- double p = g/a;
- error = Math.min(1.-p, Math.sqrt((p*(1.-p))/a));
+ IHistogramFactory hFac = _aida.histogramFactory();
+ //Histogram1D eff = (Histogram1D) hFac.createHistogram1D(title, all.axis().bins(), all.axis().lowerEdge(), all.axis().upperEdge());
+ Histogram1D eff = (Histogram1D) hFac.divide(title, good, all);
+ int nBins = eff.axis().bins()+2;
+ double error[] = new double[nBins];
+ double height[] = new double[nBins];
+ for (int i = 0; i<nBins; i++) {
+ int bin;
+ if ( i == 0 ) {
+ bin = IAxis.UNDERFLOW_BIN;
+ } else if ( i == nBins+1 ) {
+ bin = IAxis.OVERFLOW_BIN;
+ } else {
+ bin = i - 1;
+ }
+
+ double g = good.binHeight(bin);
+ double a = all.binHeight(bin);
+ height[bin] = eff.binHeight(bin);
+ if (a < .1) {
+ error[bin] = 0.;
+ } else {
+ double p = g/a;
+ error[bin] = Math.min(1.-p, Math.sqrt((p*(1.-p))/a));
+ }
}
- eff.setBinError(bin, error);
- }
- return eff;
+ eff.setContents(height, error, null, null, null);
+ return eff;
}
// -- Private fields : --------------------------------------------------------
lcsim/src/org/lcsim/util/aida
diff -u -r1.5 -r1.6
--- AIDA.java 20 Feb 2006 22:02:04 -0000 1.5
+++ AIDA.java 4 Oct 2007 22:02:07 -0000 1.6
@@ -13,7 +13,7 @@
import hep.aida.IProfile1D;
import hep.aida.IProfile2D;
import hep.aida.ITree;
-import hep.aida.ref.tree.Tree;
+import hep.aida.ref.xml.AidaXMLStore;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -39,9 +39,11 @@
private int defMax = 10000;
private IAnalysisFactory af;
private ITree tree;
+ private String compressFormat;
private IHistogramFactory hf;
private File tempFile;
private static AIDA defaultInstance;
+ public static String aidaTreeCompressProperty = "org.lcsim.util.aida.CompressOption";
public static AIDA defaultInstance()
{
@@ -53,10 +55,11 @@
{
try
{
- tempFile = File.createTempFile("aida","aida");
+ compressFormat = System.getProperty(aidaTreeCompressProperty, "gzip");
+ tempFile = File.createTempFile("aida",".aida");
tempFile.deleteOnExit();
af = IAnalysisFactory.create();
- tree = af.createTreeFactory().create(tempFile.getAbsolutePath(),"xml",false,true);
+ tree = af.createTreeFactory().create(tempFile.getAbsolutePath(), "xml", false,true, "compress="+compressFormat);
hf = af.createHistogramFactory(tree);
Application app = Application.getApplication();
@@ -265,31 +268,45 @@
public void saveAs(String name) throws IOException
{
- tree.commit();
- File dest = new File(name);
- if (dest.exists()) dest.delete();
- boolean rc = tempFile.renameTo(dest);
- if (!rc)
- {
- byte[] buffer = new byte[32768];
- OutputStream out = new FileOutputStream(dest);
- InputStream in = new FileInputStream(tempFile);
- try
- {
- for (;;)
- {
- int l = in.read(buffer);
- if (l<0) break;
- out.write(buffer,0,l);
- }
- }
- finally
- {
- out.close();
- in.close();
- tempFile.delete();
- }
- }
+ save(name, false);
+ }
+
+ public void saveAsZip(String name) throws IOException
+ {
+ save(name, true);
+ }
+
+ void save(String name, boolean useZip) throws IOException {
+ if (!name.toLowerCase().endsWith(".aida")) name = name + ".aida";
+ File dest = new File(name);
+ if (!useZip) {
+ tree.commit();
+ if (dest.exists()) dest.delete();
+ boolean rc = tempFile.renameTo(dest);
+ if (!rc) {
+ byte[] buffer = new byte[32768];
+ OutputStream out = new FileOutputStream(dest);
+ InputStream in = new FileInputStream(tempFile);
+ try {
+ for (;;) {
+ int l = in.read(buffer);
+ if (l<0) break;
+ out.write(buffer,0,l);
+ }
+ } finally {
+ out.close();
+ in.close();
+ tempFile.delete();
+ }
+ }
+ } else {
+ AidaXMLStore store = new AidaXMLStore();
+ if (dest.exists()) dest.delete();
+ de.schlichtherle.io.File newFile = new de.schlichtherle.io.File(name);
+ //if (newFile.exists() && !newFile.isDirectory())
+ //throw new IOException("File already exists: "+newFile.getAbsolutePath());
+ store.commit(tree, newFile, null, useZip, false, false);
+ }
}
private class AIDAException extends RuntimeException
{
CVSspam 0.2.8