Commit in projects/lcsim/trunk/aida/src/main/java/org/lcsim/util/aida on MAIN
AIDA.java+22-173082 -> 3083
Include the ROOT writer in the lcsim AIDA API.  (Makes Matt very happy!)

projects/lcsim/trunk/aida/src/main/java/org/lcsim/util/aida
AIDA.java 3082 -> 3083
--- projects/lcsim/trunk/aida/src/main/java/org/lcsim/util/aida/AIDA.java	2014-04-04 00:49:29 UTC (rev 3082)
+++ projects/lcsim/trunk/aida/src/main/java/org/lcsim/util/aida/AIDA.java	2014-04-04 18:09:30 UTC (rev 3083)
@@ -13,16 +13,19 @@
 import hep.aida.IProfile1D;
 import hep.aida.IProfile2D;
 import hep.aida.ITree;
+import hep.aida.ref.rootwriter.RootFileStore;
 //import hep.aida.ref.rootwriter.RootFileStore;
 import hep.aida.ref.xml.AidaXMLStore;
+
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.lang.ref.Reference;
 import java.lang.ref.WeakReference;
+
 import org.freehep.application.Application;
 import org.freehep.application.studio.Studio;
 import org.freehep.record.loop.AbstractLoopListener;
@@ -285,20 +288,20 @@
 
    public void saveAs(String name) throws IOException
    {
-       //if (name.toLowerCase().endsWith(".root")) {
-       //  saveAsRoot(name);
-       //  return;
-       //}
+       if (name.toLowerCase().endsWith(".root")) {
+         saveAsRoot(name);
+         return;
+       }
        if (!name.toLowerCase().endsWith(".aida")) name = name + ".aida";
        save(new File(name), false);
    }
 
    public void saveAs(File outFile) throws IOException
    {
-       //if (outFile.getName().toLowerCase().endsWith(".root")) {
-       //  saveAsRoot(outFile.getPath());
-       //  return;
-       //}
+       if (outFile.getName().toLowerCase().endsWith(".root")) {
+         saveAsRoot(outFile.getPath());
+         return;
+       }
        save(outFile,false);
    }
    
@@ -342,13 +345,15 @@
           store.commit(tree, newFile, null, useZip, false, false);
       }      
    }
-   //private void saveAsRoot(String path) throws IOException {
-     //RootFileStore store = new RootFileStore(path);
-   //  tree.commit();
-   //  store.open();
-   //  store.add(tree);
-   //  store.close();
-   //}
+   
+   private void saveAsRoot(String path) throws IOException {
+       RootFileStore store = new RootFileStore(path);
+       tree.commit();
+       store.open();
+       store.add(tree);
+       store.close();
+   }
+   
    private class AIDAException extends RuntimeException
    {
       AIDAException(String message, Throwable cause)
SVNspam 0.1


Use REPLY-ALL to reply to list

To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1