Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
264 commits
Select commit Hold shift + click to select a range
251c6ed
go long
baltzell Aug 13, 2026
36bb119
cleanup
baltzell Aug 13, 2026
88099ba
cleanup
baltzell Aug 13, 2026
46ec581
cleanup
baltzell Aug 13, 2026
009daca
cleanup
baltzell Aug 13, 2026
69ae7ec
cleanup
baltzell Aug 13, 2026
7a1e184
doc
baltzell Aug 13, 2026
4c26270
cleanup
baltzell Aug 14, 2026
83c1af1
rename
baltzell Aug 14, 2026
dfa2a6a
cleanup
baltzell Aug 14, 2026
f94e5c5
add more detectors
baltzell Aug 14, 2026
a3c2f29
update
baltzell Aug 14, 2026
b370735
revert unrelated changes
baltzell Aug 14, 2026
e5c59d1
add occupancy banks to dst (all) schema
baltzell Aug 14, 2026
e0473eb
debug
baltzell Aug 14, 2026
567d19a
fix bank name
baltzell Aug 14, 2026
f022e8d
remove printouts
baltzell Aug 14, 2026
99e84e7
debug
baltzell Aug 14, 2026
a7797e2
ignore negative indices (BMT?)
baltzell Aug 14, 2026
4dc4701
cleanup
baltzell Aug 14, 2026
534cda6
fix counter, add DC::tdc
baltzell Aug 16, 2026
9472515
change default occupancy prescale to 100
baltzell Aug 16, 2026
884c553
cleanup
baltzell Aug 16, 2026
23fa50b
cleanup
baltzell Aug 16, 2026
b8e3741
rename occupancy banks
baltzell Aug 17, 2026
c999bdd
this should be final
baltzell Aug 17, 2026
9197667
fix bank name
baltzell Aug 17, 2026
c06f59e
cleanup
baltzell Aug 17, 2026
5ace9ba
use filtered banks
baltzell Aug 17, 2026
5cc41e0
fix bank names
baltzell Aug 17, 2026
33c8df3
add occupancy to uber engine
baltzell Aug 22, 2026
a43594b
change yaml variable name
baltzell Aug 25, 2026
d361dc3
cleanup, make it thread-safe
baltzell Aug 25, 2026
b1be734
fix build
baltzell Aug 26, 2026
b4fe565
read banks
baltzell Aug 26, 2026
27a7939
cleanup
baltzell Aug 26, 2026
40b1c1a
fix
baltzell Aug 26, 2026
cb1cc02
make it thread-safe
baltzell Aug 27, 2026
c2007e3
separate functionality
baltzell Sep 4, 2026
2c569d3
fix method name
baltzell Sep 4, 2026
e2ff578
add accessor
baltzell Sep 4, 2026
e566858
add serial class
baltzell Sep 4, 2026
2988f8a
separate "serial" functionality for reusability
baltzell Sep 4, 2026
d8b8802
relocate serial/postprocessing utilities to clas-detector
baltzell Sep 4, 2026
6522196
default to zero for easier event counting
baltzell Sep 4, 2026
b1f3a22
add support for io-services
baltzell Sep 4, 2026
c21f1f6
add ReconMutil
baltzell Sep 4, 2026
ea4cc85
add recon-mutil
baltzell Sep 4, 2026
152295a
fix
baltzell Sep 4, 2026
dad364d
only printout if interval is positive
baltzell Sep 4, 2026
60ce0df
update ci for recon-mutil
baltzell Sep 4, 2026
919f999
bugfix
baltzell Sep 4, 2026
d8eb345
quiet tarball extraction
baltzell Sep 4, 2026
12472a2
prep pp
baltzell Sep 5, 2026
1a852a7
add another queue, to prime for postprocessing
baltzell Sep 5, 2026
b6b715d
cleanup
baltzell Sep 5, 2026
2afd58d
cleanup
baltzell Sep 5, 2026
0fe93f8
Merge branch 'development' into recon-mutil
baltzell Sep 8, 2026
67cce53
null yaml bugfix
baltzell Sep 9, 2026
870d275
remove throwers and catchers
baltzell Sep 10, 2026
6574f29
add postproc to serial
baltzell Sep 10, 2026
252abb0
replace duplicate serial.read w/ read+process
baltzell Sep 10, 2026
d0c451f
remove post-processing from Clas12Writer
baltzell Sep 10, 2026
e17fcd6
convert to HelicitySequence, oopts
baltzell Sep 10, 2026
7d62e4d
prime the serial buffer
baltzell Sep 10, 2026
a9e1a2a
set read queue limit at 100k events, 2 GB
baltzell Sep 10, 2026
5d4b587
cleanup
baltzell Sep 11, 2026
e7100b4
add pausing
baltzell Sep 11, 2026
37f0766
cleanup
baltzell Sep 11, 2026
b5cbe3b
working state (with yaml)
baltzell Sep 11, 2026
5fc6715
fix oops
baltzell Sep 12, 2026
dceb40e
cleanup, add volatiles
baltzell Sep 13, 2026
bde0253
fix
baltzell Sep 14, 2026
d29de07
fix
baltzell Sep 14, 2026
0d85d1c
debug
baltzell Sep 14, 2026
0f138b6
change denoise group
baltzell Sep 15, 2026
9967ca9
add CND occupancy banks
baltzell Sep 15, 2026
e93a9f4
Merge branch 'development' into occupancy
baltzell Sep 15, 2026
d692c40
debug
baltzell Sep 15, 2026
15e154b
fix thread safety
baltzell Sep 15, 2026
267c3df
add comments
baltzell Sep 15, 2026
ff3c101
Merge branch 'development' into recon-mutil
baltzell Sep 15, 2026
e13e40d
make it if the user did not
baltzell Sep 15, 2026
817c766
cleanup
baltzell Sep 15, 2026
5139d2b
restore scaling test
baltzell Sep 15, 2026
93ab9ed
lower locks, only engine-process tag-0
baltzell Sep 16, 2026
4a90681
fix initialization
baltzell Sep 16, 2026
97c5c2c
restore test
baltzell Sep 16, 2026
c80b620
cleanup
baltzell Sep 16, 2026
76237fc
remove unecssary volatiles
baltzell Sep 16, 2026
bf8e90f
rename
baltzell Sep 16, 2026
aac53a6
Merge branch 'development' into recon-mutil
baltzell Sep 16, 2026
a148f73
update test
baltzell Sep 16, 2026
5be7019
reenable
baltzell Sep 16, 2026
fd9605a
reenable
baltzell Sep 16, 2026
23b403d
add abstract attempt
baltzell Sep 16, 2026
b9e54cc
undebugging
baltzell Sep 17, 2026
2a9f36b
let constructor be public
baltzell Sep 17, 2026
27f3298
switch to local instance
baltzell Sep 17, 2026
4e46732
new benchmark instead of reset
baltzell Sep 17, 2026
cbf9ed1
fudge
baltzell Sep 18, 2026
9b8a80b
cleanup
baltzell Sep 18, 2026
c2b6881
add TOTAL column
baltzell Sep 18, 2026
b9900e6
fix
baltzell Sep 18, 2026
c7c8d60
Merge branch 'development' into recon-mutil
baltzell Sep 18, 2026
07c9c12
fix
baltzell Sep 18, 2026
efddc2e
add total line
baltzell Sep 18, 2026
41a71be
prime rethreading
baltzell Sep 18, 2026
6015154
Merge branch 'development' into recon-mutil
baltzell Sep 19, 2026
ff24a18
Merge branch 'development' into recon-mutil
baltzell Sep 21, 2026
91fb43d
restore privacy
baltzell Sep 21, 2026
6609044
switch kpp test to recon-mutil
baltzell Sep 21, 2026
248df85
add another thread for status printing
baltzell Sep 21, 2026
8bb5db5
use lambda
baltzell Sep 21, 2026
52f1e1f
use 4 threads everywhere
baltzell Sep 21, 2026
af534ed
cleanup
baltzell Sep 21, 2026
5e9f495
avoid dependency tree printouts
baltzell Sep 21, 2026
e8c45d5
add option to reorder some benchmarks
baltzell Sep 21, 2026
7cd0e11
restore -n option, fixup benchmark csv printout
baltzell Sep 21, 2026
81b541d
cleanup
baltzell Sep 21, 2026
a0da0ad
add javadocs
baltzell Sep 21, 2026
6f402c7
cleanup
baltzell Sep 21, 2026
aa9f5cd
fix oops
baltzell Sep 21, 2026
e8c5a78
relocate recon-util's getParser
baltzell Sep 21, 2026
3515196
cleanup
baltzell Sep 21, 2026
6ad9436
add another convenience method
baltzell Sep 21, 2026
850cc87
wtf
baltzell Sep 21, 2026
238bcd7
fix
baltzell Sep 21, 2026
6fd2127
add -f
baltzell Sep 21, 2026
1669a1a
make threads remove themself
baltzell Sep 22, 2026
57500dc
fix solenoid/torus
baltzell Sep 22, 2026
15fc191
bugfix
baltzell Sep 22, 2026
6a5bb4f
cleanup, fix
baltzell Sep 22, 2026
a681207
cleanup
baltzell Sep 22, 2026
264dd90
cleanup
baltzell Sep 22, 2026
4262a13
add javadoc
baltzell Sep 22, 2026
fc6249f
split recon-mutil
baltzell Sep 22, 2026
0ec69dc
cleanup
baltzell Sep 22, 2026
0a5fe68
cleanup
baltzell Sep 22, 2026
16e4d92
cleanup
baltzell Sep 22, 2026
e524d8c
cleanup
baltzell Sep 22, 2026
9eb6b4a
cleanup
baltzell Sep 22, 2026
cb0297c
cleanup
baltzell Sep 22, 2026
f998a7c
cleanup
baltzell Sep 22, 2026
40e3b8d
cleanup
baltzell Sep 22, 2026
0fd7f21
update docs
baltzell Sep 22, 2026
a1c27cc
cleanup
baltzell Sep 23, 2026
22ce1be
add some env.sh functions
baltzell Sep 23, 2026
9ed0b38
cleanup
baltzell Sep 23, 2026
a21bca6
fix
baltzell Sep 23, 2026
74626d8
adapt gnuplot scaling to reco-mutil
baltzell Sep 23, 2026
8a6f6d9
cleanup
baltzell Sep 23, 2026
8891321
finish scaling plot for reco-mutil
baltzell Sep 23, 2026
40979a9
more flexible constructor
baltzell Sep 23, 2026
3ce7fa8
store it static
baltzell Sep 23, 2026
b949fbb
store it static
baltzell Sep 23, 2026
99f8bea
make benchmarking optional, cleanup
baltzell Sep 23, 2026
1866338
cleanup
baltzell Sep 23, 2026
f201b18
automatically enbable benchmarking in scaling mode
baltzell Sep 23, 2026
462b277
add taskset
baltzell Sep 23, 2026
140e6f3
give benchmark a name
baltzell Sep 23, 2026
3c443fc
add benchmark names
baltzell Sep 23, 2026
d34ecb9
fix units
baltzell Sep 23, 2026
a756daf
bugfix for certain arguments
baltzell Sep 23, 2026
58aa6f7
bigger chunks
baltzell Sep 24, 2026
5ec146c
reduce font size for big legend
baltzell Sep 24, 2026
162a1bf
give space
baltzell Sep 24, 2026
695458a
rename scaling outputs
baltzell Sep 24, 2026
96fcf34
synchronize progress
baltzell Sep 24, 2026
af95f21
run gnuplot
baltzell Sep 24, 2026
6007240
prime decoding differently, optimize, cleanup
baltzell Sep 24, 2026
8a88f37
give benchmarks a warmup too
baltzell Sep 24, 2026
4d95b02
try taskset
baltzell Sep 24, 2026
c5c1202
give benchmarks a warmup too
baltzell Sep 24, 2026
681fe1e
fix div-by-zero protection
baltzell Sep 24, 2026
25fe25b
fix div-by-zero protection
baltzell Sep 24, 2026
0dce884
warmup-correct #calls in printout
baltzell Sep 24, 2026
7f3a8bb
Merge branch 'benchmark-warmup' into recon-mutil
baltzell Sep 24, 2026
2b31578
fix merge mistake
baltzell Sep 24, 2026
1603e78
move postproc back to the writer
baltzell Sep 24, 2026
1746546
misc!
baltzell Sep 25, 2026
b9339ea
add convenience method
baltzell Sep 25, 2026
8444736
bugfix
baltzell Sep 25, 2026
d660e55
add total rate, restore
baltzell Sep 25, 2026
e819882
accommodate new rate column
baltzell Sep 25, 2026
dc07578
make it configurable
baltzell Sep 26, 2026
682a36d
make it configurable
baltzell Sep 26, 2026
da96af1
tasksetting
baltzell Sep 26, 2026
e354adc
make profiling script work for stuff other than clara
baltzell Sep 26, 2026
d45eb78
cleanup
baltzell Sep 28, 2026
b15434e
Merge branch 'development' into recon-mutil
baltzell Sep 28, 2026
a4415cd
fix
baltzell Sep 29, 2026
dfa1b45
make logfile unique
baltzell Sep 29, 2026
4d9495d
lower lock
baltzell Sep 29, 2026
0c55600
Merge branch 'development' into occupancy
baltzell Sep 30, 2026
3006033
fix version
baltzell Sep 30, 2026
bef9cd4
thread safety
baltzell Sep 30, 2026
5998e5d
convert to a list
baltzell Sep 30, 2026
4dcf5ca
rework
baltzell Sep 30, 2026
62720e3
cleanup
baltzell Sep 30, 2026
f9e0f99
remove oops
baltzell Sep 30, 2026
7460b21
fix
baltzell Sep 30, 2026
e312ef7
actually initialize!
baltzell Sep 30, 2026
6b56a44
fix
baltzell Oct 1, 2026
ba19e37
cleanup
baltzell Oct 1, 2026
4a5282b
revert
baltzell Oct 1, 2026
bd009ae
remove synchronized
baltzell Oct 1, 2026
c7f94ec
add order for FTOF/CTOF/CND
baltzell Oct 1, 2026
fd797d9
revert
baltzell Oct 1, 2026
ba28805
cleanup
baltzell Oct 2, 2026
8344b6c
revert
baltzell Oct 2, 2026
521a081
Merge branch 'development' into recon-mutil
baltzell Oct 2, 2026
cb1cf08
Merge branch 'occupancy' into recon-mutil
baltzell Oct 2, 2026
9dc2235
add occupancer to reco-mutil
baltzell Oct 2, 2026
bd8610a
remove unused imports
baltzell Oct 2, 2026
46df0d3
cleanup
baltzell Oct 5, 2026
119ae68
cleanup
baltzell Oct 5, 2026
c478fc2
cleanup
baltzell Oct 5, 2026
83294ae
adjust backpressure
baltzell Oct 5, 2026
a6f4b29
add concept
baltzell Oct 6, 2026
c9b4111
cleanup
baltzell Oct 6, 2026
d59f6b5
add dedicated serial thread
baltzell Oct 6, 2026
18c2a0b
new serial paradigm
baltzell Oct 6, 2026
977c2b2
cleanup
baltzell Oct 6, 2026
c1b0e8a
tune
baltzell Oct 6, 2026
f57a0f0
tune
baltzell Oct 6, 2026
f44d3c8
propagate to reco-mutil
baltzell Oct 6, 2026
8b95e15
fix olds
baltzell Oct 6, 2026
a076a54
fix olds
baltzell Oct 6, 2026
9af8ec9
debug
baltzell Oct 6, 2026
a2a88f2
fix
baltzell Oct 6, 2026
193ef09
Merge branch 'development' into recon-mutil
baltzell Oct 7, 2026
3177e72
fix
baltzell Oct 7, 2026
0b2e6f3
fix?
baltzell Oct 7, 2026
197878c
unify
baltzell Oct 7, 2026
f352b46
stagger a bit
baltzell Oct 7, 2026
26260f0
sort thread counts
baltzell Oct 7, 2026
c4437b9
get max threads
baltzell Oct 7, 2026
e6291e9
fix
baltzell Oct 7, 2026
4b47e17
volatilize
baltzell Oct 7, 2026
0439469
Merge branch 'development' into recon-mutil
baltzell Oct 7, 2026
977f37b
cleanup
baltzell Oct 7, 2026
3ae95bf
cleanup
baltzell Oct 7, 2026
be460e2
up it
baltzell Oct 7, 2026
7fd9caa
cleanup
baltzell Oct 7, 2026
162b90e
revert
baltzell Oct 8, 2026
2fc1a57
cleanup yamls
baltzell Oct 8, 2026
b975445
switch rgd-clarode.yml to data-ai
baltzell Oct 8, 2026
c93872a
guard against dry queue
baltzell Oct 9, 2026
eb37145
cleanup, dont prestart threads
baltzell Oct 9, 2026
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: 4 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,10 @@ jobs:
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: ls tmp
run: ls -lhtr tmp
- name: rename
run: mv -v tmp/rec_clas_018779.evio.00001.hipo rec.hipo
- 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 -o rec.hipo ./clas_018779.evio.00001
- uses: actions/upload-artifact@v7
with:
name: test_clara_result
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ hs_err_pid*

bin/evio2hipotest
export.sh

*.txt

21 changes: 16 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,24 @@ 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
script:
- ./clara/plugins/clas12/libexec/profile -e cpu run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp1 -t 16 -l $EVIOFILE
- ./clara/plugins/clas12/libexec/profile -e alloc run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp2 -t 16 -l $EVIOFILE
- ./clara/plugins/clas12/libexec/profile -e lock run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp3 -t 16 -l $EVIOFILE
- ./clara/plugins/clas12/libexec/profile -e cpu -o _clara run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp1 -t 16 -l $EVIOFILE
- ./clara/plugins/clas12/libexec/profile -e alloc -o _clara run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp2 -t 16 -l $EVIOFILE
- ./clara/plugins/clas12/libexec/profile -e lock -o _clara run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp3 -t 16 -l $EVIOFILE
- ./clara/plugins/clas12/libexec/profile -e cpu -o _mutil recon-mutil -y ./etc/services/rgd-clarode.yml -o mutil1.hipo -t 16 -l SEVERE $EVIOFILE
- ./clara/plugins/clas12/libexec/profile -e alloc -o _mutil recon-mutil -y ./etc/services/rgd-clarode.yml -o mutil2.hipo -t 16 -l SEVERE $EVIOFILE
- ./clara/plugins/clas12/libexec/profile -e lock -o _mutil recon-mutil -y ./etc/services/rgd-clarode.yml -o mutil3.hipo -t 16 -l SEVERE $EVIOFILE
artifacts:
when: always
expire_in: 1 week
Expand All @@ -197,7 +208,7 @@ scaling:
when: always
expire_in: 1 week
paths:
- scaling.svg
- scaling-clara.svg

pages:
stage: deploy
Expand All @@ -207,7 +218,7 @@ pages:
- cp -r pages public
- mkdir public/perf
- cp asprof*.html public/perf
- cp scaling.svg public/perf
- cp scaling*.svg public/perf
pages: true
artifacts:
expire_in: 1 week
Expand Down
18 changes: 18 additions & 0 deletions bin/reco-mutil
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

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

split_cli $@

export MALLOC_ARENA_MAX=1

#threads=$(get_threads)
#node=$(((RANDOM % 2)))
#cpus=$(get_all_numa_cpus $node)
#cpus=$(get_numa_cpus $node)
#taskset -c $cpus \

java ${JAVA_OPTS-} -XX:MaxRAMPercentage=40.0 -Xms10240m ${jvm_options[@]} \
-cp ${COATJAVA_CLASSPATH:-''} \
org.jlab.clas.reco.RecoMutil \
${class_options[@]}
16 changes: 16 additions & 0 deletions bin/recon-mutil
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

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

split_cli $@

export MALLOC_ARENA_MAX=12

threads=$(get_threads)

#java ${JAVA_OPTS-} -Xmx256g -Xms10240m ${jvm_options[@]} \
#java ${JAVA_OPTS-} -Xms10240m -XX:+UseParallelGC ${jvm_options[@]} \
java ${JAVA_OPTS-} -XX:MaxRAMPercentage=40.0 -Xms10240m ${jvm_options[@]} \
-cp ${COATJAVA_CLASSPATH:-''} \
org.jlab.clas.reco.ReconMutil \
${class_options[@]}
2 changes: 1 addition & 1 deletion bin/recon-util
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

split_cli $@

export MALLOC_ARENA_MAX=1
export MALLOC_ARENA_MAX=12

java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \
-cp ${COATJAVA_CLASSPATH:-''} \
Expand Down
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
@@ -1,17 +1,13 @@
package org.jlab.io.clara;

import java.io.File;
import java.nio.file.Path;
import java.util.List;
import org.jlab.clara.std.services.EventWriterException;
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.detector.serial.Occupancer;
import org.jlab.jnp.hipo4.data.Bank;
import org.jlab.jnp.hipo4.data.Event;
import org.jlab.jnp.hipo4.data.SchemaFactory;
import org.jlab.jnp.hipo4.io.HipoReader;
import org.jlab.jnp.hipo4.io.HipoWriterSorted;
import org.jlab.jnp.utils.file.FileUtils;
import org.json.JSONObject;
Expand All @@ -21,32 +17,31 @@
* 1. Copies certain banks on-the-fly to new tag-1 events
* 2. Caches helicity states, scaler readouts, and unix time
* 3. Writes HEL::flip, RUN/HEL::scaler, and RUN::unix to new tag-1 events
* 4. Runs post-processing, writing tag-1 information to all events
* 5. Adds .hipo to the output filename, if necessary
* 6. Outputs a parallel file of select trigger bits with a raw schema
* @author baltzell
*/
public class Clas12Writer extends HipoToHipoWriter {

Occupancer occupancer;
SerialHoncho serial;
Bank runConfig;
ConstantsManager conman;
SchemaFactory fullSchema;
boolean postprocess;
Bank runConfig;

HipoWriterSorted paraWriter;
long paraCount;
long paraTriggerMask;
int paraTriggerPrescale;

private void init(JSONObject opts) {
occupancer = new Occupancer();
fullSchema = new SchemaFactory();
fullSchema.initFromDirectory(FileUtils.getEnvironmentPath("CLAS12DIR","etc/bankdefs/hipo4"));
serial = new SerialHoncho(fullSchema);
runConfig = new Bank(fullSchema.getSchema("RUN::config"));
conman = new ConstantsManager();
runConfig = new Bank(fullSchema.getSchema("RUN::config"));
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 @@ -78,6 +73,7 @@ protected HipoWriterSorted createWriter(Path file, JSONObject opts) throws Event
protected void writeEvent(Object event) throws EventWriterException {
Event t = serial.read((Event)event);
if (!t.isEmpty()) writer.addEvent(t, 1);
occupancer.process(((Event)event));
super.writeEvent(event);
writeRaw((Event)event, t);
}
Expand All @@ -96,48 +92,8 @@ void writeRaw(Event physics, Event tagged) {
protected void closeWriter() {
serial.closure(writer);
super.closeWriter();
if (postprocess) postprocess();
serial.clear();
if (paraTriggerMask > 0) paraWriter.close();
}

/**
* Get the first valid run number from a RUN::config bank.
* @return run
*/
private int getRunNumber() {
Event e = new Event();
HipoReader r = new HipoReader();
r.open(filename);
while (r.hasNext()) {
r.nextEvent(e);
e.read(runConfig);
if (runConfig.getRows()>0 && runConfig.getInt("run",0)>0)
return runConfig.getInt("run",0);
}
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));
}

}
Loading
Loading