-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathEvioReadFileSimple.java
More file actions
45 lines (34 loc) · 1.17 KB
/
EvioReadFileSimple.java
File metadata and controls
45 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Copyright (c) 2014, Jefferson Science Associates
*
* Thomas Jefferson National Accelerator Facility
* Data Acquisition Group
*
* 12000, Jefferson Ave, Newport News, VA 23606
* Phone : (757)-269-7100
*
*/
package org.jlab.coda.jevio.dev;
import java.io.IOException;
import org.jlab.coda.jevio.EvioException;
import org.jlab.coda.jevio.EvioReader;
public class EvioReadFileSimple {
public static void main(String[] args) {
// This is a simple example of how to read an Evio file.
// It assumes that the Evio file is already created and contains events.
if (args.length != 1) {
System.out.println("Usage: java EvioReadFileSimple <evio-file>");
return;
}
String filename = args[0]; // Replace with your Evio file name
try {
EvioReader reader = new EvioReader(filename);
reader.addHeaderRecoveryCheck();
int evCount = reader.getEventCount();
System.out.println("Number of events in file: " + evCount);
reader.close();
} catch (EvioException | IOException e) {
e.printStackTrace();
}
}
}