Print

Print


Commit in lcsim on MAIN
pom.xml+71.218 -> 1.219
src/org/lcsim/util/aida/AIDA.java+171.10 -> 1.11
+24
2 modified files
Enable writing out root files.

lcsim
pom.xml 1.218 -> 1.219
diff -u -r1.218 -r1.219
--- pom.xml	12 Mar 2013 23:30:51 -0000	1.218
+++ pom.xml	13 Mar 2013 04:51:06 -0000	1.219
@@ -149,6 +149,8 @@
             <include>org.lcsim:trf</include>
             <include>xerces:xercesImpl</include>
             <include>commons-math:commons-math</include>
+            <include>org.freehep:freehep-jaida-root</include>
+            <include>org.freehep:freehep-rootio-output</include>
           </includes>
         </configuration>
       </plugin>
@@ -314,5 +316,10 @@
       <artifactId>trf</artifactId>
       <version>1.1</version>
     </dependency>
+    <dependency>
+      <groupId>org.freehep</groupId>
+      <artifactId>freehep-jaida-root</artifactId>
+      <version>3.4.4-SNAPSHOT</version>
+    </dependency>
   </dependencies>
 </project>

lcsim/src/org/lcsim/util/aida
AIDA.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- AIDA.java	15 Jun 2012 05:24:20 -0000	1.10
+++ AIDA.java	13 Mar 2013 04:51:06 -0000	1.11
@@ -13,6 +13,8 @@
 import hep.aida.IProfile1D;
 import hep.aida.IProfile2D;
 import hep.aida.ITree;
+import hep.aida.ref.rootwriter.RootFileStore;
+import hep.aida.ref.rootwriter.Writer;
 import hep.aida.ref.xml.AidaXMLStore;
 import java.io.File;
 import java.io.IOException;
@@ -284,12 +286,20 @@
 
    public void saveAs(String name) throws IOException
    {
+       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;
+       }
        save(outFile,false);
    }
    
@@ -333,6 +343,13 @@
           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 class AIDAException extends RuntimeException
    {
       AIDAException(String message, Throwable cause)
CVSspam 0.2.12


Use REPLY-ALL to reply to list

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