Hi, there is a file evtest1.c in evio-4.0 which was used to generate sample file, it can be modified to generate something else. Please use everything from recent evio-4.0 and jevio-4.0 from my jlab home directory or Carl's svn, previous versions are not good, we did some changes over last week to fix java. Sergey > Hi, > > It looks like the test file sent earlier by Sergei does not strictly > conform to the EVIO v4 data format and cannot be read by jevio. Carl > pointed me to a different sample file that seems to be better. I'm still > having a few issues with parsing it, but the basics are (mostly) working. > > I've replaced the old file with this new one. > > http://www.lcsim.org/test/hps/evio4_sample.dat > > I have an additional question... > > Is there an example anywhere of creating an EVIO v4 file from scratch in a > Java test program? A C or C++ program would presumably be helpful, too. > > For instance, say I had the following Java data structure... > > class MyDataClass { > int t; > long id; > short[] adcCounts; // assume this is non-fixed size > } > > How would I map this example class to a composite record and then write > these events out to an EVIO file on disk? Any tips or sample programs > that would help me to figure out how to do this? > > Creating in-memory events was straightforward in EVIO v3, but with this > release there is the added complexity of setting valid formatting strings > in order to be able to correctly read the composite data back, among other > things. > > In the real experiment, we'll be getting data off the ET Ring, but for > testing purposes it would be very helpful if I could create some valid > sample data. The test programs I found in jevio 4.0 read in existing > files but don't create them. > > --Jeremy > > -----Original Message----- > From: McCormick, Jeremy I. > Sent: Tuesday, February 28, 2012 1:43 PM > To: [log in to unmask]; [log in to unmask]; 'Carl Timmer'; > [log in to unmask]; Neal, Homer A. > Cc: Graf, Norman A. > Subject: reading sample Evio v4 file > > Hi, > > I'm trying to test out the new EVIO 4 Java library. (Thanks for this!) > > Sergei sent this sample EVIO v4 file last week, which I'm attempting to > read and parse using the new Java library. > > http://www.lcsim.org/test/hps/evio4_sample.dat > > This file has three child structures in each event, containing sample > composite data in three different formats. I believe that this file > contains only composite data blocks. (Sergei can probably say more about > this.) > > Several things do not work for me, however. > > Firstly, the call to write out an XML file... > > reader.toXMLFile(fileName) > > fails with the error. > > org.jlab.coda.jevio.EvioException: no composite data > at org.jlab.coda.jevio.CompositeData.<init>(CompositeData.java:168) > > Secondly, attempting to actually parse one of the blocks as composite data > does not work. > > The parse error occurs when I attempt to access the second data block. > The first structure seems okay. But with the second, there is a null > pointer exception in the CompositeData constructor, just after the call to > the unpackRawBytesToString() method. A null pointer is returned by this > method rather than a sized String array. This call occurs just after line > 133 of CompositeData.java, where some operations are performed on this > null array object. > > Test program is quite simple... > > EvioReader reader = new EvioReader(new File(testFileName)); > reader.toXMLFile((new File(testFileName + > ".xml")).getCanonicalPath()); // Doesn't work! > > EvioEvent event = reader.parseNextEvent(); > while (event != null) { > for (BaseStructure b1 : event.getChildren()) { > CompositeData compData = b1.getCompositeData(); // Fails on > second data block. > } > event = reader.parseNextEvent(); > } > > As you can see, I'm not doing anything fancy/complicated here, just trying > to read each structure as composite data. > > If someone with more expertise could tell me the following, I would > appreciate it... > > Am I doing this right? > > Can you reproduce the issue(s)? > > Are there any know bugs/issues that would prevent the basic parsing and/or > the XML output from working for this file? > > Is there anything wrong with the sample data file? > > etc. > > If you need any additional info about this, please let me know. Thanks! > > --Jeremy > ######################################################################## 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