Skip to content
Draft
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
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
with:
name: build_ubuntu-latest
- name: untar build
run: tar xzvf coatjava.tar.gz
run: tar xzf coatjava.tar.gz
- name: spotbugs
run: ./build-coatjava.sh --spotbugs --no-maps --no-progress

Expand All @@ -194,7 +194,7 @@ jobs:
path: |
clas_018779.evio.00001
- name: untar build
run: tar xzvf coatjava.tar.gz
run: tar xzf coatjava.tar.gz
- name: run test
run: |
ls -lhtr
Expand Down Expand Up @@ -224,15 +224,15 @@ jobs:
clas_018779.evio.00001
- name: untar build
run: |
tar xzvf clara.tar.gz
tar xzvf coatjava.tar.gz
tar xzf clara.tar.gz
tar xzf coatjava.tar.gz
- run: ls
- name: run test
run: ./bin/run-clara -y ./etc/services/rgd-clarode.yml -t 4 -n 500 -c ./clara -o ./tmp ./clas_018779.evio.00001
- name: run clara
run: ./coatjava/bin/run-clara -y ./etc/services/rgd-clarode.yml -t 4 -n 100 -c ./clara -o ./tmp ./clas_018779.evio.00001
- name: run mutil
run: ./coatjava/bin/recon-mutil -y ./etc/services/rgd-clarode.yml -t 4 -n 30 -o rec.hipo ./clas_018779.evio.00001
- name: ls tmp
run: ls -lhtr tmp
- name: rename
run: mv -v tmp/rec_clas_018779.evio.00001.hipo rec.hipo
run: ls -lhtr . tmp
- uses: actions/upload-artifact@v7
with:
name: test_clara_result
Expand Down Expand Up @@ -277,8 +277,8 @@ jobs:
name: build_${{ matrix.runner }}
- name: untar build
run: |
tar xzvf coatjava.tar.gz
tar xzvf clara.tar.gz
tar xzf coatjava.tar.gz
tar xzf clara.tar.gz
- name: run test
run: |
git lfs install
Expand All @@ -305,8 +305,8 @@ jobs:
name: build_macos
- name: untar build
run: |
tar xzvf coatjava.tar.gz
tar xzvf clara.tar.gz
tar xzf coatjava.tar.gz
tar xzf clara.tar.gz
- name: run test
run: |
git lfs install
Expand All @@ -333,7 +333,7 @@ jobs:
with:
name: build_ubuntu-latest
- name: untar build
run: tar xzvf coatjava.tar.gz
run: tar xzf coatjava.tar.gz
- name: test run-groovy
run: coatjava/bin/run-groovy validation/advanced-tests/test-run-groovy.groovy

Expand All @@ -355,7 +355,7 @@ jobs:
with:
name: build_ubuntu-latest
- name: untar build
run: tar xzvf coatjava.tar.gz
run: tar xzf coatjava.tar.gz
- name: hipo2npz
run: ./coatjava/bin/hipo2npz rec.hipo rec.npz
- name: hipo2npz-dump
Expand Down
8 changes: 8 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ clara:
- run-clara -v -c $CLARA_HOME -t 4 -y ./etc/services/rgd-clarode.yml -n 30 -o out $EVIOFILE
- mv out/rec_$EVIOFILE.hipo claroded.hipo

recon-mutil:
stage: test
needs: [build,download]
dependencies: [build,download]
script:
- tar -xzf coatjava.tar.gz
- recon-mutil -t 4 -y ./etc/services/rgd-clarode.yml -n 30 -o rec_$EVIOFILE.hipo $EVIOFILE

profile:
extends: .clon
allow_failure: true
Expand Down
2 changes: 1 addition & 1 deletion bin/postprocess2
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export MALLOC_ARENA_MAX=1

java ${JAVA_OPTS-} -Xmx768m -Xms768m -XX:+UseSerialGC \
-cp ${COATJAVA_CLASSPATH:-''} \
org.jlab.analysis.postprocess.Processor \
org.jlab.detector.serial.PostProcessor \
$*
12 changes: 12 additions & 0 deletions bin/recon-mutil
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

. `dirname $0`/../libexec/env.sh

split_cli $@

export MALLOC_ARENA_MAX=1

java ${JAVA_OPTS-} -Xms10240m -XX:+UseParallelGC ${jvm_options[@]} \
-cp ${COATJAVA_CLASSPATH:-''} \
org.jlab.clas.reco.ReconMutil \
${class_options[@]}
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.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-analysis</artifactId>
<version>14.2.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-utils</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
import java.io.File;
import java.nio.file.Path;
import java.util.List;
import java.util.TreeMap;
import java.util.TreeSet;
import org.jlab.analysis.postprocess.Processor;
import org.jlab.detector.serial.PostProcessor;
import org.jlab.clara.std.services.EventWriterException;
import org.jlab.detector.calib.utils.ConstantsManager;
import org.jlab.detector.decode.CLASDecoder4;
import org.jlab.detector.helicity.HelicitySequence;
import org.jlab.detector.helicity.HelicitySequenceDelayed;
import org.jlab.detector.helicity.HelicityState;
import org.jlab.detector.scalers.DaqScalersSequence;
import org.jlab.detector.serial.SerialHoncho;
import org.jlab.jnp.hipo4.data.Bank;
import org.jlab.jnp.hipo4.data.Event;
import org.jlab.jnp.hipo4.data.SchemaFactory;
Expand All @@ -33,34 +28,22 @@
*/
public class Clas12Writer extends HipoToHipoWriter {

static final String[] TAG1BANKS = {"RUN::scaler","HEL::scaler","RAW::scaler","RAW::epics","HEL::flip","COAT::config"};

Bank[] tag1banks;
SerialHoncho serial;
Bank runConfig;
Bank helicityAdc;
ConstantsManager conman;
TreeMap<Integer,Integer> eventUnix;
TreeSet<HelicityState> helicities;
DaqScalersSequence scalers;
SchemaFactory fullSchema;
boolean postprocess;

private void init(JSONObject opts) {
fullSchema = new SchemaFactory();
fullSchema.initFromDirectory(FileUtils.getEnvironmentPath("CLAS12DIR","etc/bankdefs/hipo4"));
serial = new SerialHoncho(fullSchema);
runConfig = new Bank(fullSchema.getSchema("RUN::config"));
helicityAdc = new Bank(fullSchema.getSchema("HEL::adc"));
helicities = new TreeSet<>();
scalers = new DaqScalersSequence(fullSchema);
conman = new ConstantsManager();
eventUnix = new TreeMap<>();
conman.init("/runcontrol/hwp","/runcontrol/helicity");
postprocess = opts.optBoolean("postprocess", false);
if (opts.has("variation")) conman.setVariation(opts.getString("variation"));
if (opts.has("timestamp")) conman.setTimeStamp(opts.getString("timestamp"));
tag1banks = new Bank[TAG1BANKS.length];
for (int i=0; i<tag1banks.length; ++i)
tag1banks[i] = new Bank(fullSchema.getSchema(TAG1BANKS[i]));
}

@Override
Expand All @@ -78,29 +61,17 @@ protected HipoWriterSorted createWriter(Path file, JSONObject opts) throws Event

@Override
protected void writeEvent(Object event) throws EventWriterException {
scalers.add((Event)event);
((Event)event).read(runConfig);
((Event)event).read(helicityAdc);
if (runConfig.getRows() > 0) {
int unix = runConfig.getInt("unixtime",0);
int evno = runConfig.getInt("event",0);
if (unix > 0 && evno > 0) eventUnix.put(evno, unix);
}
helicities.add(HelicityState.createFromFadcBank(helicityAdc, runConfig, conman));
Event t = CLASDecoder4.createTaggedEvent((Event)event, runConfig, tag1banks);
Event t = serial.read((Event)event);
if (!t.isEmpty()) writer.addEvent(t, 1);
super.writeEvent(event);
}

@Override
protected void closeWriter() {
HelicitySequence.writeFlips(fullSchema, writer, helicities);
writer.addEvent(getUnixEvent(runConfig),1);
serial.finish(writer);
super.closeWriter();
if (postprocess) postprocess();
// keep the latest helicity/scaler reading for the next file:
while (helicities.size() > 60) helicities.pollFirst();
scalers.clear(10);
serial.clear();
}

/**
Expand All @@ -120,35 +91,14 @@ private int getRunNumber() {
return 0;
}

/**
* Get a new event with a RUN::unix bank containing event-timestamp mapping,
* and the latest RUN::config bank.
* @param config
* @return
*/
private Event getUnixEvent(Bank config) {
Bank unix = new Bank(fullSchema.getSchema("RUN::unix"));
unix.setRows(eventUnix.size());
int row = 0;
for (int evno : eventUnix.keySet()) {
unix.putInt("event", row, evno);
unix.putInt("unixtime",row, eventUnix.get(evno));
row++;
}
Event e = new Event();
e.write(config);
e.write(unix);
return e;
}

/**
* 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(helicities);
Processor p = new Processor(List.of(filename), fullSchema, helicity, scalers);
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.jlab.detector.scalers.DaqScalers;
import org.jlab.detector.helicity.HelicitySequenceManager;
import org.jlab.detector.scalers.DaqScalersSequence;
import org.jlab.detector.serial.SerialUtil;
import org.jlab.jnp.hipo4.data.Bank;
import org.jlab.jnp.hipo4.data.Event;
import org.jlab.jnp.hipo4.io.HipoReader;
Expand Down Expand Up @@ -122,7 +123,7 @@ else if (seq != null) {
runScalerBank = ds.createRunBank(writer.getSchemaFactory());
helScalerBank = ds.createHelicityBank(writer.getSchemaFactory());

Util.assignScalerHelicity(event, helScalerBank, helSeq);
SerialUtil.assignScalerHelicity(event, helScalerBank, helSeq);

// put modified HEL/RUN::scaler back in the event:
event.write(runScalerBank);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jlab.analysis.postprocess;

import org.jlab.detector.serial.PostProcessor;
import java.util.TreeMap;
import java.util.logging.Logger;
import org.jlab.clas.reco.ReconstructionEngine;
Expand All @@ -13,6 +14,7 @@
import org.jlab.detector.scalers.DaqScalersSequence;
import org.jlab.detector.helicity.HelicityBit;
import org.jlab.detector.helicity.HelicitySequenceDelayed;
import org.jlab.detector.serial.SerialUtil;
import org.jlab.jnp.hipo4.data.SchemaFactory;
import org.jlab.utils.groups.IndexedTable;
import org.jlab.utils.options.OptionParser;
Expand Down Expand Up @@ -81,7 +83,7 @@ public static void main(String[] args) {
LOGGER.info("\n>>> Initializing helicity configuration from CCDB ...\n");
ConstantsManager conman = new ConstantsManager();
conman.init("/runcontrol/hwp","/runcontrol/helicity");
final int run = Util.getRunNumber(parser.getInputList().get(0));
final int run = SerialUtil.getRunNumber(parser.getInputList().get(0));
IndexedTable helTable = conman.getConstants(run, "/runcontrol/helicity");

// Initialize the scaler sequence from tag-1 events:
Expand All @@ -102,7 +104,7 @@ public static void main(String[] args) {
}

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

// Loop over the input HIPO files:
LOGGER.info("\n>>> Starting post-processing ...\n");
Expand Down Expand Up @@ -138,7 +140,7 @@ public static void main(String[] args) {
if (doHelicityDelay) {
recEventBank.putByte("helicity",0,hb.value());
recEventBank.putByte("helicityRaw",0,hbraw.value());
Util.assignScalerHelicity(runConfigBank.getLong("timestamp",0), helScalerBank, helSeq);
SerialUtil.assignScalerHelicity(runConfigBank.getLong("timestamp",0), helScalerBank, helSeq);
}

// Write beam charge to REC::Event:
Expand Down Expand Up @@ -169,7 +171,7 @@ public static void main(String[] args) {
writer.addEvent(event, event.getEventTag());

// Copy config banks to new, tag-1 events:
Util.createTag1Events(writer, event, configEvent, configBanks);
SerialUtil.createTag1Events(writer, event, configEvent, configBanks);
}

reader.close();
Expand Down
Loading
Loading