|
1 | 1 | package org.jlab.analysis.physics; |
2 | 2 |
|
| 3 | +import java.io.File; |
3 | 4 | import org.jlab.io.hipo.HipoDataEvent; |
4 | 5 | import org.jlab.jnp.hipo4.data.Bank; |
5 | 6 | import org.jlab.jnp.hipo4.data.Event; |
6 | 7 | import org.jlab.jnp.hipo4.data.SchemaFactory; |
| 8 | +import org.jlab.jnp.hipo4.io.HipoReader; |
| 9 | +import org.jlab.jnp.hipo4.io.HipoWriterSorted; |
7 | 10 |
|
8 | 11 | /** |
9 | 12 | * |
10 | 13 | * @author naharrison |
11 | 14 | */ |
12 | 15 | public class TestEvent { |
13 | 16 |
|
| 17 | + public static void main(String args[]) { |
| 18 | + writeDCSector1ElectronEvent(); |
| 19 | + getDCSector1ElectronEvent(0).show(); |
| 20 | + } |
| 21 | + |
| 22 | + public static void writeDCSector1ElectronEvent() { |
| 23 | + HipoWriterSorted writer = new HipoWriterSorted(); |
| 24 | + writer.setCompressionType(2); |
| 25 | + writer.getSchemaFactory().initFromDirectory("/Users/baltzell/sw/coatjava/dev/etc/bankdefs/hipo4"); |
| 26 | + writer.open("/Users/baltzell/org.jlab.analysis.physics.TestEvent.hipo"); |
| 27 | + HipoDataEvent e = getDCSector1ElectronEvent(writer.getSchemaFactory()); |
| 28 | + writer.addEvent(e.getHipoEvent()); |
| 29 | + writer.close(); |
| 30 | + } |
| 31 | + |
| 32 | + public static HipoDataEvent getDCSector1ElectronEvent(int event) { |
| 33 | + HipoReader reader = new HipoReader(); |
| 34 | + Event e = new Event(); |
| 35 | + try { |
| 36 | + File file = new File(TestEvent.class.getResource("/test/TestEvent.hipo").toURI()); |
| 37 | + reader.open(file.getAbsolutePath());//"/Users/baltzell/org.jlab.analysis.physics.TestEvent.hipo"); |
| 38 | + reader.getEvent(e, event); |
| 39 | + return new HipoDataEvent(e,reader.getSchemaFactory()); |
| 40 | + } catch (java.net.URISyntaxException x) { |
| 41 | + return null; |
| 42 | + } |
| 43 | + } |
14 | 44 |
|
15 | 45 | public static HipoDataEvent getDCSector1ElectronEvent(SchemaFactory schemaFactory) { |
16 | | - Event testEvent = new Event(); |
17 | | - |
18 | | - |
| 46 | + Event testEvent = new Event(); |
19 | 47 |
|
20 | 48 | // this event is based on a gemc event with |
21 | 49 | // one generated electron with p=2.5, th=25, ph=0 |
|
0 commit comments