Skip to content

Commit d0c451f

Browse files
committed
remove post-processing from Clas12Writer
1 parent 252abb0 commit d0c451f

2 files changed

Lines changed: 1 addition & 63 deletions

File tree

common-tools/clara-io/pom.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@
3636
<artifactId>jnp-hipo4</artifactId>
3737
</dependency>
3838

39-
<dependency>
40-
<groupId>org.jlab.clas</groupId>
41-
<artifactId>clas-io</artifactId>
42-
<version>14.2.0-SNAPSHOT</version>
43-
</dependency>
44-
4539
<dependency>
4640
<groupId>org.jlab.clas</groupId>
4741
<artifactId>clas-detector</artifactId>
@@ -50,7 +44,7 @@
5044

5145
<dependency>
5246
<groupId>org.jlab.clas</groupId>
53-
<artifactId>clas-utils</artifactId>
47+
<artifactId>clas-io</artifactId>
5448
<version>14.2.0-SNAPSHOT</version>
5549
</dependency>
5650

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
package org.jlab.io.clara;
22

3-
import java.io.File;
43
import java.nio.file.Path;
5-
import java.util.List;
6-
import java.util.TreeMap;
7-
import java.util.TreeSet;
84
import org.jlab.clara.std.services.EventWriterException;
95
import org.jlab.detector.calib.utils.ConstantsManager;
10-
import org.jlab.detector.helicity.HelicitySequenceDelayed;
11-
import org.jlab.detector.helicity.HelicityState;
12-
import org.jlab.detector.scalers.DaqScalersSequence;
13-
import org.jlab.detector.serial.PostProcessor;
146
import org.jlab.detector.serial.SerialHoncho;
15-
import org.jlab.jnp.hipo4.data.Bank;
167
import org.jlab.jnp.hipo4.data.Event;
178
import org.jlab.jnp.hipo4.data.SchemaFactory;
18-
import org.jlab.jnp.hipo4.io.HipoReader;
199
import org.jlab.jnp.hipo4.io.HipoWriterSorted;
2010
import org.jlab.jnp.utils.file.FileUtils;
2111
import org.json.JSONObject;
@@ -25,27 +15,22 @@
2515
* 1. Copies certain banks on-the-fly to new tag-1 events
2616
* 2. Caches helicity states, scaler readouts, and unix time
2717
* 3. Writes HEL::flip, RUN/HEL::scaler, and RUN::unix to new tag-1 events
28-
* 4. Runs post-processing, writing tag-1 information to all events
2918
* 5. Adds .hipo to the output filename, if necessary
3019
*
3120
* @author baltzell
3221
*/
3322
public class Clas12Writer extends HipoToHipoWriter {
3423

3524
SerialHoncho serial;
36-
Bank runConfig;
3725
ConstantsManager conman;
3826
SchemaFactory fullSchema;
39-
boolean postprocess;
4027

4128
private void init(JSONObject opts) {
4229
fullSchema = new SchemaFactory();
4330
fullSchema.initFromDirectory(FileUtils.getEnvironmentPath("CLAS12DIR","etc/bankdefs/hipo4"));
4431
serial = new SerialHoncho(fullSchema);
45-
runConfig = new Bank(fullSchema.getSchema("RUN::config"));
4632
conman = new ConstantsManager();
4733
conman.init("/runcontrol/hwp","/runcontrol/helicity");
48-
postprocess = opts.optBoolean("postprocess", false);
4934
if (opts.has("variation")) conman.setVariation(opts.getString("variation"));
5035
if (opts.has("timestamp")) conman.setTimeStamp(opts.getString("timestamp"));
5136
}
@@ -74,47 +59,6 @@ protected void writeEvent(Object event) throws EventWriterException {
7459
protected void closeWriter() {
7560
serial.finish(writer);
7661
super.closeWriter();
77-
if (postprocess) postprocess();
7862
serial.clear();
7963
}
80-
81-
/**
82-
* Get the first valid run number from a RUN::config bank.
83-
* @return run
84-
*/
85-
private int getRunNumber() {
86-
Event e = new Event();
87-
HipoReader r = new HipoReader();
88-
r.open(filename);
89-
while (r.hasNext()) {
90-
r.nextEvent(e);
91-
e.read(runConfig);
92-
if (runConfig.getRows()>0 && runConfig.getInt("run",0)>0)
93-
return runConfig.getInt("run",0);
94-
}
95-
return 0;
96-
}
97-
98-
/**
99-
* Copy helicity/charge tag-1 information to all events.
100-
*/
101-
private void postprocess() {
102-
int d = conman.getConstants(getRunNumber(), "/runcontrol/helicity").getIntValue("delay",0,0,0);
103-
HelicitySequenceDelayed helicity = new HelicitySequenceDelayed(d);
104-
helicity.addStream(serial.getHelicities());
105-
PostProcessor p = new PostProcessor(List.of(filename), fullSchema, helicity, serial.getScalers());
106-
HipoReader r = new HipoReader();
107-
r.open(filename);
108-
Event e = new Event();
109-
writer.open("pp_"+filename);
110-
while (r.hasNext()) {
111-
r.nextEvent(e);
112-
p.processEvent(e);
113-
HipoToHipoWriter.writeEvent(writer, e, schemaBankList);
114-
}
115-
writer.close();
116-
new File(filename).delete();
117-
new File("pp_"+filename).renameTo(new File(filename));
118-
}
119-
12064
}

0 commit comments

Comments
 (0)