Skip to content

Commit e93a9f4

Browse files
committed
Merge branch 'development' into occupancy
2 parents 9967ca9 + fcfbe21 commit e93a9f4

32 files changed

Lines changed: 345 additions & 235 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
runs-on: macos-latest
6262
steps:
6363
- uses: actions/checkout@v7
64-
- uses: actions/setup-java@v5.7.0
64+
- uses: actions/setup-java@v6.0.0
6565
with:
6666
java-version: ${{ env.JAVA_VERSION }}
6767
distribution: ${{ env.java_distribution }}
@@ -91,7 +91,7 @@ jobs:
9191
runs-on: ubuntu-latest
9292
steps:
9393
- uses: actions/checkout@v7
94-
- uses: actions/setup-java@v5.7.0
94+
- uses: actions/setup-java@v6.0.0
9595
with:
9696
java-version: ${{ env.JAVA_VERSION }}
9797
distribution: ${{ env.java_distribution }}
@@ -137,7 +137,7 @@ jobs:
137137
runs-on: ubuntu-latest
138138
steps:
139139
- uses: actions/checkout@v7
140-
- uses: actions/setup-java@v5.7.0
140+
- uses: actions/setup-java@v6.0.0
141141
with:
142142
java-version: ${{ matrix.JAVA_VERSION }}
143143
distribution: ${{ env.java_distribution }}
@@ -161,7 +161,7 @@ jobs:
161161
steps:
162162
- uses: actions/checkout@v7
163163
- name: Set up JDK
164-
uses: actions/setup-java@v5.7.0
164+
uses: actions/setup-java@v6.0.0
165165
with:
166166
java-version: ${{ env.JAVA_VERSION }}
167167
distribution: ${{ env.java_distribution }}
@@ -170,7 +170,7 @@ jobs:
170170
with:
171171
name: build_ubuntu-latest
172172
- name: untar build
173-
run: tar xzvf coatjava.tar.gz
173+
run: tar xzf coatjava.tar.gz
174174
- name: spotbugs
175175
run: ./build-coatjava.sh --spotbugs --no-maps --no-progress
176176

@@ -180,7 +180,7 @@ jobs:
180180
steps:
181181
- uses: actions/checkout@v7
182182
- name: Set up JDK
183-
uses: actions/setup-java@v5.7.0
183+
uses: actions/setup-java@v6.0.0
184184
with:
185185
java-version: ${{ env.JAVA_VERSION }}
186186
distribution: ${{ env.java_distribution }}
@@ -194,7 +194,7 @@ jobs:
194194
path: |
195195
clas_018779.evio.00001
196196
- name: untar build
197-
run: tar xzvf coatjava.tar.gz
197+
run: tar xzf coatjava.tar.gz
198198
- name: run test
199199
run: |
200200
ls -lhtr
@@ -209,7 +209,7 @@ jobs:
209209
steps:
210210
- uses: actions/checkout@v7
211211
- name: Set up JDK
212-
uses: actions/setup-java@v5.7.0
212+
uses: actions/setup-java@v6.0.0
213213
with:
214214
java-version: ${{ env.JAVA_VERSION }}
215215
distribution: ${{ env.java_distribution }}
@@ -224,8 +224,8 @@ jobs:
224224
clas_018779.evio.00001
225225
- name: untar build
226226
run: |
227-
tar xzvf clara.tar.gz
228-
tar xzvf coatjava.tar.gz
227+
tar xzf clara.tar.gz
228+
tar xzf coatjava.tar.gz
229229
- run: ls
230230
- name: run test
231231
run: ./bin/run-clara -y ./etc/services/rgd-clarode.yml -t 4 -n 500 -c ./clara -o ./tmp ./clas_018779.evio.00001
@@ -267,7 +267,7 @@ jobs:
267267
steps:
268268
- uses: actions/checkout@v7
269269
- name: Set up JDK
270-
uses: actions/setup-java@v5.7.0
270+
uses: actions/setup-java@v6.0.0
271271
with:
272272
java-version: ${{ env.JAVA_VERSION }}
273273
distribution: ${{ env.java_distribution }}
@@ -277,8 +277,8 @@ jobs:
277277
name: build_${{ matrix.runner }}
278278
- name: untar build
279279
run: |
280-
tar xzvf coatjava.tar.gz
281-
tar xzvf clara.tar.gz
280+
tar xzf coatjava.tar.gz
281+
tar xzf clara.tar.gz
282282
- name: run test
283283
run: |
284284
git lfs install
@@ -295,7 +295,7 @@ jobs:
295295
steps:
296296
- uses: actions/checkout@v7
297297
- name: Set up JDK
298-
uses: actions/setup-java@v5.7.0
298+
uses: actions/setup-java@v6.0.0
299299
with:
300300
java-version: ${{ env.JAVA_VERSION }}
301301
distribution: ${{ env.java_distribution }}
@@ -305,8 +305,8 @@ jobs:
305305
name: build_macos
306306
- name: untar build
307307
run: |
308-
tar xzvf coatjava.tar.gz
309-
tar xzvf clara.tar.gz
308+
tar xzf coatjava.tar.gz
309+
tar xzf clara.tar.gz
310310
- name: run test
311311
run: |
312312
git lfs install
@@ -320,7 +320,7 @@ jobs:
320320
steps:
321321
- uses: actions/checkout@v7
322322
- name: Set up JDK
323-
uses: actions/setup-java@v5.7.0
323+
uses: actions/setup-java@v6.0.0
324324
with:
325325
java-version: ${{ env.JAVA_VERSION }}
326326
distribution: ${{ env.java_distribution }}
@@ -333,7 +333,7 @@ jobs:
333333
with:
334334
name: build_ubuntu-latest
335335
- name: untar build
336-
run: tar xzvf coatjava.tar.gz
336+
run: tar xzf coatjava.tar.gz
337337
- name: test run-groovy
338338
run: coatjava/bin/run-groovy validation/advanced-tests/test-run-groovy.groovy
339339

@@ -343,7 +343,7 @@ jobs:
343343
steps:
344344
- uses: actions/checkout@v7
345345
- name: Set up JDK
346-
uses: actions/setup-java@v5.7.0
346+
uses: actions/setup-java@v6.0.0
347347
with:
348348
java-version: ${{ env.JAVA_VERSION }}
349349
distribution: ${{ env.java_distribution }}
@@ -355,7 +355,7 @@ jobs:
355355
with:
356356
name: build_ubuntu-latest
357357
- name: untar build
358-
run: tar xzvf coatjava.tar.gz
358+
run: tar xzf coatjava.tar.gz
359359
- name: hipo2npz
360360
run: ./coatjava/bin/hipo2npz rec.hipo rec.npz
361361
- name: hipo2npz-dump
@@ -384,7 +384,7 @@ jobs:
384384
path: pages/jacoco
385385
### javadoc
386386
- name: set up JDK
387-
uses: actions/setup-java@v5.7.0
387+
uses: actions/setup-java@v6.0.0
388388
with:
389389
java-version: ${{ env.JAVA_VERSION }}
390390
distribution: ${{ env.java_distribution }}
@@ -440,7 +440,7 @@ jobs:
440440
mv coatjava{,-${{ env.TAG_NAME }}}
441441
tar czf coatjava-${{ env.TAG_NAME }}{.tar.gz,}
442442
- name: release
443-
uses: softprops/action-gh-release@v3.0.2
443+
uses: softprops/action-gh-release@v3.0.3
444444
with:
445445
files: coatjava-${{ env.TAG_NAME }}.tar.gz
446446
- name: open issue if failed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ target
88
tmp
99
/common-tools/clas-io/src/main/java/org/jlab/io/banks
1010

11+
# data files
12+
*.evio
13+
*.hipo
14+
!/etc/data/test/*.hipo
15+
1116
# deployment
1217
/myLocalMvnRepo
1318
/coatjava-*.tar.gz
@@ -50,7 +55,6 @@ hs_err_pid*
5055

5156
# no log files:
5257
*.log
53-
*.evio
5458

5559
bin/evio2hipotest
5660
export.sh

bin/postprocess2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export MALLOC_ARENA_MAX=1
66

77
java ${JAVA_OPTS-} -Xmx768m -Xms768m -XX:+UseSerialGC \
88
-cp ${COATJAVA_CLASSPATH:-''} \
9-
org.jlab.analysis.postprocess.Processor \
9+
org.jlab.detector.serial.PostProcessor \
1010
$*

common-tools/clara-io/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@
4848
<version>14.2.0-SNAPSHOT</version>
4949
</dependency>
5050

51-
<dependency>
52-
<groupId>org.jlab.clas</groupId>
53-
<artifactId>clas-analysis</artifactId>
54-
<version>14.2.0-SNAPSHOT</version>
55-
</dependency>
56-
5751
<dependency>
5852
<groupId>org.jlab.clas</groupId>
5953
<artifactId>clas-utils</artifactId>

common-tools/clara-io/src/main/java/org/jlab/io/clara/Clas12Writer.java

Lines changed: 9 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
import java.util.List;
66
import java.util.TreeMap;
77
import java.util.TreeSet;
8-
import org.jlab.analysis.postprocess.Processor;
98
import org.jlab.clara.std.services.EventWriterException;
109
import org.jlab.detector.calib.utils.ConstantsManager;
11-
import org.jlab.detector.decode.CLASDecoder4;
12-
import org.jlab.detector.helicity.HelicitySequence;
1310
import org.jlab.detector.helicity.HelicitySequenceDelayed;
14-
import org.jlab.detector.helicity.HelicityState;
15-
import org.jlab.detector.scalers.DaqScalersSequence;
11+
import org.jlab.detector.serial.SerialHoncho;
12+
import org.jlab.detector.serial.PostProcessor;
1613
import org.jlab.jnp.hipo4.data.Bank;
1714
import org.jlab.jnp.hipo4.data.Event;
1815
import org.jlab.jnp.hipo4.data.SchemaFactory;
@@ -33,34 +30,22 @@
3330
*/
3431
public class Clas12Writer extends HipoToHipoWriter {
3532

36-
static final String[] TAG1BANKS = {"RUN::scaler","HEL::scaler","RAW::scaler","RAW::epics","HEL::flip","COAT::config"};
37-
38-
Bank[] tag1banks;
33+
SerialHoncho serial;
3934
Bank runConfig;
40-
Bank helicityAdc;
4135
ConstantsManager conman;
42-
TreeMap<Integer,Integer> eventUnix;
43-
TreeSet<HelicityState> helicities;
44-
DaqScalersSequence scalers;
4536
SchemaFactory fullSchema;
4637
boolean postprocess;
4738

4839
private void init(JSONObject opts) {
4940
fullSchema = new SchemaFactory();
5041
fullSchema.initFromDirectory(FileUtils.getEnvironmentPath("CLAS12DIR","etc/bankdefs/hipo4"));
42+
serial = new SerialHoncho(fullSchema);
5143
runConfig = new Bank(fullSchema.getSchema("RUN::config"));
52-
helicityAdc = new Bank(fullSchema.getSchema("HEL::adc"));
53-
helicities = new TreeSet<>();
54-
scalers = new DaqScalersSequence(fullSchema);
5544
conman = new ConstantsManager();
56-
eventUnix = new TreeMap<>();
5745
conman.init("/runcontrol/hwp","/runcontrol/helicity");
5846
postprocess = opts.optBoolean("postprocess", false);
5947
if (opts.has("variation")) conman.setVariation(opts.getString("variation"));
6048
if (opts.has("timestamp")) conman.setTimeStamp(opts.getString("timestamp"));
61-
tag1banks = new Bank[TAG1BANKS.length];
62-
for (int i=0; i<tag1banks.length; ++i)
63-
tag1banks[i] = new Bank(fullSchema.getSchema(TAG1BANKS[i]));
6449
}
6550

6651
@Override
@@ -78,29 +63,17 @@ protected HipoWriterSorted createWriter(Path file, JSONObject opts) throws Event
7863

7964
@Override
8065
protected void writeEvent(Object event) throws EventWriterException {
81-
scalers.add((Event)event);
82-
((Event)event).read(runConfig);
83-
((Event)event).read(helicityAdc);
84-
if (runConfig.getRows() > 0) {
85-
int unix = runConfig.getInt("unixtime",0);
86-
int evno = runConfig.getInt("event",0);
87-
if (unix > 0 && evno > 0) eventUnix.put(evno, unix);
88-
}
89-
helicities.add(HelicityState.createFromFadcBank(helicityAdc, runConfig, conman));
90-
Event t = CLASDecoder4.createTaggedEvent((Event)event, runConfig, tag1banks);
66+
Event t = serial.read((Event)event);
9167
if (!t.isEmpty()) writer.addEvent(t, 1);
9268
super.writeEvent(event);
9369
}
9470

9571
@Override
9672
protected void closeWriter() {
97-
HelicitySequence.writeFlips(fullSchema, writer, helicities);
98-
writer.addEvent(getUnixEvent(runConfig),1);
73+
serial.finish(writer);
9974
super.closeWriter();
10075
if (postprocess) postprocess();
101-
// keep the latest helicity/scaler reading for the next file:
102-
while (helicities.size() > 60) helicities.pollFirst();
103-
scalers.clear(10);
76+
serial.clear();
10477
}
10578

10679
/**
@@ -120,35 +93,14 @@ private int getRunNumber() {
12093
return 0;
12194
}
12295

123-
/**
124-
* Get a new event with a RUN::unix bank containing event-timestamp mapping,
125-
* and the latest RUN::config bank.
126-
* @param config
127-
* @return
128-
*/
129-
private Event getUnixEvent(Bank config) {
130-
Bank unix = new Bank(fullSchema.getSchema("RUN::unix"));
131-
unix.setRows(eventUnix.size());
132-
int row = 0;
133-
for (int evno : eventUnix.keySet()) {
134-
unix.putInt("event", row, evno);
135-
unix.putInt("unixtime",row, eventUnix.get(evno));
136-
row++;
137-
}
138-
Event e = new Event();
139-
e.write(config);
140-
e.write(unix);
141-
return e;
142-
}
143-
14496
/**
14597
* Copy helicity/charge tag-1 information to all events.
14698
*/
14799
private void postprocess() {
148100
int d = conman.getConstants(getRunNumber(), "/runcontrol/helicity").getIntValue("delay",0,0,0);
149101
HelicitySequenceDelayed helicity = new HelicitySequenceDelayed(d);
150-
helicity.addStream(helicities);
151-
Processor p = new Processor(List.of(filename), fullSchema, helicity, scalers);
102+
helicity.addStream(serial.getHelicities());
103+
PostProcessor p = new PostProcessor(List.of(filename), fullSchema, helicity, serial.getScalers());
152104
HipoReader r = new HipoReader();
153105
r.open(filename);
154106
Event e = new Event();

common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/RebuildScalers.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.jlab.detector.scalers.DaqScalers;
1010
import org.jlab.detector.helicity.HelicitySequenceManager;
1111
import org.jlab.detector.scalers.DaqScalersSequence;
12+
import org.jlab.detector.serial.SerialUtil;
1213
import org.jlab.jnp.hipo4.data.Bank;
1314
import org.jlab.jnp.hipo4.data.Event;
1415
import org.jlab.jnp.hipo4.io.HipoReader;
@@ -122,7 +123,7 @@ else if (seq != null) {
122123
runScalerBank = ds.createRunBank(writer.getSchemaFactory());
123124
helScalerBank = ds.createHelicityBank(writer.getSchemaFactory());
124125

125-
Util.assignScalerHelicity(event, helScalerBank, helSeq);
126+
SerialUtil.assignScalerHelicity(event, helScalerBank, helSeq);
126127

127128
// put modified HEL/RUN::scaler back in the event:
128129
event.write(runScalerBank);

0 commit comments

Comments
 (0)