Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions bin/postprocess2

This file was deleted.

6 changes: 0 additions & 6 deletions common-tools/clara-io/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@
<version>14.2.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-utils</artifactId>
<version>14.2.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.jlab.detector.calib.utils.ConstantsManager;
import org.jlab.detector.helicity.HelicitySequenceDelayed;
import org.jlab.detector.serial.SerialHoncho;
import org.jlab.detector.serial.PostProcessor;
import org.jlab.jnp.hipo4.data.Bank;
import org.jlab.jnp.hipo4.data.Event;
import org.jlab.jnp.hipo4.data.SchemaFactory;
Expand All @@ -32,7 +31,6 @@ public class Clas12Writer extends HipoToHipoWriter {
Bank runConfig;
ConstantsManager conman;
SchemaFactory fullSchema;
boolean postprocess;

HipoWriterSorted paraWriter;
long paraCount;
Expand All @@ -46,7 +44,6 @@ private void init(JSONObject opts) {
runConfig = new Bank(fullSchema.getSchema("RUN::config"));
conman = new ConstantsManager();
conman.init("/runcontrol/hwp","/runcontrol/helicity");
postprocess = opts.optBoolean("postprocess", false);
paraTriggerMask = opts.optLong("paraTriggerMask", 0);
paraTriggerPrescale = opts.optInt("paraTriggerPrescale", 0);
if (opts.has("variation")) conman.setVariation(opts.getString("variation"));
Expand Down Expand Up @@ -96,7 +93,6 @@ void writeRaw(Event physics, Event tagged) {
protected void closeWriter() {
serial.closure(writer);
super.closeWriter();
if (postprocess) postprocess();
serial.clear();
if (paraTriggerMask > 0) paraWriter.close();
}
Expand All @@ -118,26 +114,4 @@ private int getRunNumber() {
return 0;
}

/**
* Copy helicity/charge tag-1 information to all events.
*/
private void postprocess() {
int d = conman.getConstants(getRunNumber(), "/runcontrol/helicity").getIntValue("delay",0,0,0);
HelicitySequenceDelayed helicity = new HelicitySequenceDelayed(d);
helicity.addStream(serial.getHelicities());
PostProcessor p = new PostProcessor(List.of(filename), fullSchema, helicity, serial.getScalers());
HipoReader r = new HipoReader();
r.open(filename);
Event e = new Event();
writer.open("pp_"+filename);
while (r.hasNext()) {
r.nextEvent(e);
p.processEvent(e);
HipoToHipoWriter.writeEvent(writer, e, schemaBankList);
}
writer.close();
new File(filename).delete();
new File("pp_"+filename).renameTo(new File(filename));
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jlab.analysis.postprocess;

import org.jlab.detector.serial.PostProcessor;
import java.util.List;
import java.util.TreeMap;
import java.util.logging.Logger;
import org.jlab.clas.reco.ReconstructionEngine;
Expand Down Expand Up @@ -35,6 +35,31 @@ public class Tag1ToEvent {

static final Logger LOGGER = Logger.getLogger(Tag1ToEvent.class.getName());

/**
* Load the mapping from event number to unix time
* @param schema
* @param files
* @return map
*/
public static TreeMap<Integer,Integer> getEventUnixMap(SchemaFactory schema, List<String> files) {
TreeMap<Integer,Integer> m = new TreeMap<>();
Event e = new Event();
Bank b = schema.getBank("RUN::unix");//new Bank(schema.getSchema("RUN::unix"));
for (String f : files) {
HipoReader r = new HipoReader();
r.setTags(1);
r.open(f);
while (r.hasNext()) {
r.nextEvent(e);
e.read(b);
int size = b.getRows();
for (int i=0; i<size; i++) m.put(b.getInt("event",i), b.getInt("unixtime",i));
}
r.close();
}
return m;
}

public static void main(String[] args) {

OptionParser parser = new OptionParser("postprocess");
Expand Down Expand Up @@ -104,7 +129,7 @@ public static void main(String[] args) {
}

// Initialize the unix-event map:
TreeMap<Integer,Integer> eventUnix = PostProcessor.getEventUnixMap(schema, parser.getInputList());
TreeMap<Integer,Integer> eventUnix = getEventUnixMap(schema, parser.getInputList());

// Loop over the input HIPO files:
LOGGER.info("\n>>> Starting post-processing ...\n");
Expand Down
Loading
Loading