Hello Sebouh,

 It's not at all clear to me why you are trying to access a root histogram from within a

standalone java program. I think you would be much more efficient if you were to use

the tools already developed within HPS for such analyses or just do your analysis within

root itself. But having said that I'm willing to see if I can be of any assistance. How was

the root histogram produced? Is it just a single 1D histogram? Or are there more complicated

objects in the file? And what is it that you are trying to do with its contents?

Norman


From: [log in to unmask] <[log in to unmask]> on behalf of Sebouh Paul <[log in to unmask]>
Sent: Tuesday, September 15, 2015 1:25 PM
To: hps-software
Subject: read root files in java
 

Below are the program I am attempting to run, and the error I am getting.  I want to be able to access a root histogram in a program that I wrote in java, and not have to completely re-write my entire program in C++, because that would be an inefficient use of my time.  

Thanks.  


package hps.misc.bumpHunt;


import java.io.IOException;


import hep.aida.IAnalysisFactory;

import hep.aida.IHistogram1D;

import hep.aida.ITree;

import hep.aida.ITreeFactory;

import hps.misc.bumpHunt.BumpHunt;

import hps.misc.bumpHunt.BumpHuntMonitor;

import hps.misc.bumpHunt.PolynomialBackgroundFitter;


public class ReadHistogram {

public static void main(String arg[]) throws IllegalArgumentException, IOException{

IAnalysisFactory af = IAnalysisFactory.create();

ITreeFactory tf = af.createTreeFactory();

ITree tree0 = tf.create(arg[0], "root");

IHistogram1D hist1 = (IHistogram1D) tree0.find("mass");

//do some stuff with the histogram.

}

}



Root IO for Java, part of the FreeHEP library: http://java.freehep.org

Please report all bugs/problems to [log in to unmask]

Version $Id: RootFileReader.java 13538 2008-07-24 15:35:06Z tonyj $

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.bcel.Repository.lookupClass(Ljava/lang/Class;)Lorg/apache/bcel/classfile/JavaClass;

at hep.io.root.core.ProxyBuilder.build(ProxyBuilder.java:81)

at hep.io.root.core.RootClassLoader.findClass(RootClassLoader.java:55)

at java.lang.ClassLoader.loadClass(ClassLoader.java:423)

at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

at hep.io.root.core.GenericRootClass.getClass(GenericRootClass.java:136)

at hep.io.root.core.GenericRootClass.getProxyClass(GenericRootClass.java:152)

at hep.io.root.core.GenericRootClass.newInstance(GenericRootClass.java:92)

at hep.io.root.core.RootInputStream.readObject(RootInputStream.java:323)

at hep.io.root.core.RootRandomAccessFile.readObject(RootRandomAccessFile.java:138)

at hep.io.root.RootFileReader.init(RootFileReader.java:208)

at hep.io.root.RootFileReader.init(RootFileReader.java:156)

at hep.io.root.RootFileReader.<init>(RootFileReader.java:136)

at hep.aida.ref.root.RootStore.read(RootStore.java:75)

at hep.aida.ref.tree.Tree.init(Tree.java:1041)

at hep.aida.ref.tree.TreeFactory.createTree(TreeFactory.java:183)

at hep.aida.ref.tree.TreeFactory.create(TreeFactory.java:64)

at hps.misc.bumpHunt.ReadHistogram.main(ReadHistogram.java:17)



Use REPLY-ALL to reply to list

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



Use REPLY-ALL to reply to list

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