Skip to content

Commit 4f1dbe6

Browse files
committed
cleanup, just use $CLAS12DIR
1 parent 7b0ea8d commit 4f1dbe6

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

common-tools/clas-analysis/src/main/java/org/jlab/analysis/physics/TestEvent.java

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package org.jlab.analysis.physics;
22

3-
import java.io.File;
43
import org.jlab.io.hipo.HipoDataEvent;
54
import org.jlab.jnp.hipo4.data.Bank;
65
import org.jlab.jnp.hipo4.data.Event;
76
import org.jlab.jnp.hipo4.data.SchemaFactory;
87
import org.jlab.jnp.hipo4.io.HipoReader;
98
import org.jlab.jnp.hipo4.io.HipoWriterSorted;
9+
import org.jlab.utils.CLASResources;
1010

1111
/**
1212
*
@@ -15,31 +15,26 @@
1515
public class TestEvent {
1616

1717
public static void main(String args[]) {
18-
writeDCSector1ElectronEvent();
18+
//writeDCSector1ElectronEvent();
1919
getDCSector1ElectronEvent(0).show();
2020
}
2121

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();
22+
public static void writeDCSector1ElectronEvent(String path) {
23+
try (HipoWriterSorted writer = new HipoWriterSorted()) {
24+
writer.setCompressionType(2);
25+
writer.getSchemaFactory().initFromDirectory(CLASResources.getResourcePath("etc/bankdefs/hipo4"));
26+
writer.open(path);
27+
HipoDataEvent e = getDCSector1ElectronEvent(writer.getSchemaFactory());
28+
writer.addEvent(e.getHipoEvent());
29+
}
3030
}
31-
31+
3232
public static HipoDataEvent getDCSector1ElectronEvent(int event) {
3333
HipoReader reader = new HipoReader();
34+
reader.open(CLASResources.getResourcePath("etc/data/test/dc.hipo"));
3435
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-
}
36+
reader.getEvent(e, event);
37+
return new HipoDataEvent(e,reader.getSchemaFactory());
4338
}
4439

4540
public static HipoDataEvent getDCSector1ElectronEvent(SchemaFactory schemaFactory) {

common-tools/clas-analysis/src/main/resources/test/TestEvent.hipo renamed to etc/data/test/dc.hipo

File renamed without changes.

0 commit comments

Comments
 (0)