Skip to content

Commit 036dd71

Browse files
committed
Merge remote-tracking branch 'origin/main' into rgk-pass2
2 parents 7f9b76a + 8bf795d commit 036dd71

20 files changed

Lines changed: 546 additions & 59 deletions

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
key: validation_files_lfs_${{ matrix.type }}
9696
path: validation_files.tar.zst
9797
- name: download timeline build
98-
uses: actions/download-artifact@v7
98+
uses: actions/download-artifact@v8
9999
with:
100100
name: build_timeline
101101
- name: untar
@@ -141,7 +141,7 @@ jobs:
141141
key: validation_files_lfs_${{ matrix.type }}
142142
path: validation_files.tar.zst
143143
- name: download timeline build
144-
uses: actions/download-artifact@v7
144+
uses: actions/download-artifact@v8
145145
with:
146146
name: build_timeline
147147
- name: untar
@@ -174,13 +174,13 @@ jobs:
174174
steps:
175175
- uses: actions/checkout@v6
176176
- name: download outfiles
177-
uses: actions/download-artifact@v7
177+
uses: actions/download-artifact@v8
178178
with:
179179
pattern: outfiles_*
180180
merge-multiple: true
181181
path: outfiles
182182
- name: download timeline build
183-
uses: actions/download-artifact@v7
183+
uses: actions/download-artifact@v8
184184
with:
185185
name: build_timeline
186186
- name: untar

bin/qtl-histogram

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ source $(dirname $0)/../libexec/environ.sh
88
# constants ############################################################
99
# slurm settings
1010
SLURM_MEMORY=2000 # must be more than max heap size in $TIMELINE_JAVA_OPTS
11+
SLURM_DISK=32M
1112
SLURM_TIME=10:00:00
1213
SLURM_LOG=/farm_out/%u/%x-%A_%a
1314
########################################################################
@@ -489,6 +490,7 @@ for key in ${jobkeys[@]}; do
489490
#SBATCH --account=clas12
490491
491492
#SBATCH --mem-per-cpu=$SLURM_MEMORY
493+
#SBATCH --gres=disk:$SLURM_DISK
492494
#SBATCH --time=$SLURM_TIME
493495
494496
#SBATCH --array=1-$(cat $joblist | wc -l)

bin/qtl-reheat

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ source $(dirname $0)/../libexec/environ.sh
66
# constants ############################################################
77
# slurm settings
88
SLURM_MEMORY=2000 # must be more than max heap size `java` calls
9+
SLURM_DISK=32M
910
SLURM_TIME=12:00:00
1011
SLURM_LOG=/farm_out/%u/%x-%A_%a
1112
# reheating methods: name -> description
@@ -16,7 +17,9 @@ declare -A REHEAT_METHODS=(
1617

1718
# default options
1819
dataset=train
19-
coatjava_version=13.3.0 # the first version with rollover correction, used for RG-A Spring 2018 reheating
20+
coatjava_version=13.8.0 # 13.3.0: first version with rollover correction, used for RG-A Spring 2018 reheating
21+
# 13.8.0: fix: avoid call to method that recalibrates already-calibrated dsc2
22+
# https://github.com/JeffersonLab/coatjava/pull/1153
2023
declare -A modes
2124
for key in submit; do
2225
modes[$key]=false
@@ -187,6 +190,7 @@ cat > $slurmScript << EOF
187190
#SBATCH --partition=production
188191
#SBATCH --account=clas12
189192
#SBATCH --mem-per-cpu=$SLURM_MEMORY
193+
#SBATCH --gres=disk:$SLURM_DISK
190194
#SBATCH --time=$SLURM_TIME
191195
#SBATCH --array=1-$(cat $jobList | wc -l)
192196
#SBATCH --ntasks=1

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>org.jlab.clas.timeline</groupId>
66
<artifactId>clas12-timeline</artifactId>
7-
<version>4.0.2</version>
7+
<version>4.0.4</version>
88
<name>clas12-timeline</name>
99
<url>http://www.github.com/JeffersonLab/clas12-timeline</url>
1010

@@ -35,21 +35,21 @@
3535
<dependency>
3636
<groupId>org.jlab.coat</groupId>
3737
<artifactId>coat-libs</artifactId>
38-
<version>13.6.0</version>
38+
<version>13.8.0</version>
3939
<type>jar</type>
4040
</dependency>
4141
<!-- https://mvnrepository.com/artifact/org.apache.groovy/groovy-all -->
4242
<dependency>
4343
<groupId>org.apache.groovy</groupId>
4444
<artifactId>groovy-all</artifactId>
45-
<version>5.0.4</version>
45+
<version>5.0.5</version>
4646
<type>pom</type>
4747
</dependency>
4848
<!-- https://mvnrepository.com/artifact/org.apache.groovy/groovy-dateutil -->
4949
<dependency>
5050
<groupId>org.apache.groovy</groupId>
5151
<artifactId>groovy-dateutil</artifactId>
52-
<version>5.0.4</version>
52+
<version>5.0.5</version>
5353
</dependency>
5454
<!-- https://mvnrepository.com/artifact/org.codehaus.gpars/gpars -->
5555
<dependency>
@@ -82,7 +82,7 @@
8282
<dependency>
8383
<groupId>org.codehaus.groovy</groupId>
8484
<artifactId>groovy-eclipse-batch</artifactId>
85-
<version>5.0.4-02</version> <!-- NOTE: if no release notes, try commit history of https://github.com/groovy/groovy-eclipse -->
85+
<version>5.0.5-01</version> <!-- NOTE: if no release notes, try commit history of https://github.com/groovy/groovy-eclipse -->
8686
</dependency>
8787
</dependencies>
8888
</plugin>

qa-physics/charge_analysis/analyze_charge.py

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ def main():
8282
fcupgateds = np.array(fcupgateds)
8383
live_times = np.array(live_times)
8484

85-
run_number = os.path.splitext(os.path.basename(hipo_file))[0]
85+
file_basename = os.path.splitext(os.path.basename(hipo_file))[0]
8686

8787
# ---------- Plot 1: Per-event data ----------
8888
# ---------- Plot 1: Per-event data ----------
8989
fig1, axs1 = plt.subplots(2, 2, figsize=(14, 8))
90-
fig1.suptitle(f'Run {run_number} - Event-Level Detector Data', fontsize=16)
90+
fig1.suptitle(f'{file_basename}', fontsize=16)
9191

9292
plots1 = [
9393
(axs1[0, 0], fcups, 'FCUP', 'FCUP vs Timestamp', 'darkgreen', 'line'),
@@ -103,18 +103,19 @@ def main():
103103
ax.scatter(timestamps, data, label=label, color=color, s=10, alpha=0.7)
104104

105105
ax.set_title(title, fontsize=12)
106-
ax.set_xlabel('Timestamp', fontsize=10)
106+
ax.set_xlabel('Timestamp', fontsize=10, loc='center')
107107
ax.set_ylabel(label, fontsize=10)
108108
ax.legend(fontsize=9)
109109
ax.grid(True, linestyle='--', alpha=0.6)
110110
ax.tick_params(axis='both', labelsize=9)
111111

112112
fig1.tight_layout(rect=[0, 0.03, 1, 0.95])
113-
fig1.savefig(f'{output_dir}/fcup_vs_timestamp_{run_number}_{output_suffix}.png', bbox_inches='tight', dpi=300)
113+
fig1.savefig(f'{output_dir}/fcup_vs_timestamp_{file_basename}_{output_suffix}.png', bbox_inches='tight', dpi=300)
114114
plt.close(fig1)
115115
# ---------- Compute Chunked FCUP Gated with neighbor handling ----------
116-
chunk_size = 2000
116+
chunk_size = 100
117117
num_chunks = len(timestamps) // chunk_size
118+
xlabel = f'Bin num. (size={chunk_size} scalers)'
118119

119120

120121
chunk_caseA, chunk_caseB, chunk_caseC, chunk_default, chunk_default_ungated = [], [], [], [], []
@@ -229,15 +230,16 @@ def main():
229230
5, 1, figsize=(12, 17), sharex=False,
230231
gridspec_kw={'height_ratios': [3, 1, 1, 1, 2]}
231232
)
232-
fig2.suptitle(f'Run {run_number} - Chunked FCUP Gated (Neighbor Handling)', fontsize=16)
233+
fig2.suptitle(f'{file_basename}', fontsize=16)
233234

234235
# Top: cumulative sums
235-
ax_top.plot(chunk_indices, cum_caseA, label='Cumulative Case A (LT_nn × FCUPungated)', color='darkred', marker='o')
236-
#ax_top.plot(chunk_indices, cum_caseB, label='Cumulative Case B (LT_nn × FCUPungated_nn)', color='darkgreen', marker='s')
237-
ax_top.plot(chunk_indices, cum_caseC, label='Cumulative Case C (20-NN mean × FCUPungated)', color='darkorange', marker='d')
238-
ax_top.plot(chunk_indices, cum_default, label='Cumulative Default (FCUPgated)', color='blue', marker='^')
239-
ax_top.plot(chunk_indices, cum_default_ungated, label='Cumulative Default Ungated (FCUPungated)', color='teal', marker='x',linestyle='--')
236+
ax_top.plot(chunk_indices, cum_default_ungated, label='U: ungated FC charge', color='black', marker='o', markersize=4, linestyle='--')
237+
ax_top.plot(chunk_indices, cum_default, label='G: gated FC charge', color='red', marker='^', markersize=4)
238+
ax_top.plot(chunk_indices, cum_caseA, label='G\': LiveTime × U', color='deepskyblue', marker='x', markersize=4, linestyle='--')
239+
# ax_top.plot(chunk_indices, cum_caseB, label='Cumulative Case B (LT_nn × FCUPungated_nn)', color='darkgreen', marker='s', markersize=4)
240+
# ax_top.plot(chunk_indices, cum_caseC, label='Cumulative Case C (20-NN mean × U)', color='darkorange', marker='d', markersize=4)
240241
ax_top.set_ylabel('Cumulative Σ', fontsize=11)
242+
ax_top.set_xlabel(xlabel, fontsize=11, loc='right')
241243
ax_top.grid(True, linestyle='--', alpha=0.6)
242244
ax_top.legend(fontsize=10)
243245
ax_top.tick_params(axis='both', labelsize=10)
@@ -248,28 +250,30 @@ def main():
248250
ratioC = np.divide(cum_caseC, cum_default, out=np.full_like(cum_caseC, np.nan, dtype=float), where=np.array(cum_default) != 0)
249251
ratioDefUng = np.divide(cum_default_ungated, cum_default, out=np.full_like(cum_default_ungated, np.nan, dtype=float), where=np.array(cum_default) != 0)
250252

251-
ax_mid.plot(chunk_indices, ratioA, label='Case A / Default', color='darkred', marker='o')
252-
#ax_mid.plot(chunk_indices, ratioB, label='Case B / Default', color='darkgreen', marker='s')
253-
ax_mid.plot(chunk_indices, ratioC, label='Case C / Default', color='darkorange', marker='d')
254-
ax_mid.plot(chunk_indices, ratioDefUng, label='Default FCUP Ungated / Default FCUP gated', color='teal', marker='x',linestyle='--')
253+
ax_mid.plot(chunk_indices, ratioA, label='G\' / G', color='magenta', marker='x', markersize=4, linestyle='--')
254+
#ax_mid.plot(chunk_indices, ratioB, label='Case B / G', color='darkgreen', marker='s', markersize=4)
255+
# ax_mid.plot(chunk_indices, ratioC, label='Case C / G', color='darkorange', marker='d', markersize=4)
256+
# ax_mid.plot(chunk_indices, ratioDefUng, label='U / G', color='teal', marker='x', markersize=4, linestyle='--')
255257
ax_mid.axhline(1.0, color='black', linestyle='--', linewidth=1)
256258
ax_mid.set_ylabel('Ratio', fontsize=11)
259+
ax_mid.set_xlabel(xlabel, fontsize=11, loc='right')
257260
ax_mid.grid(True, linestyle='--', alpha=0.6)
258261
ax_mid.legend(fontsize=10)
259262
ax_mid.tick_params(axis='both', labelsize=10)
260263

261264
# Gated / Ungated ratio panel
262265
ratio_gated_ung = np.divide(cum_default, cum_default_ungated, out=np.full_like(cum_default, np.nan, dtype=float), where=np.array(cum_default_ungated) != 0)
263-
ax_gatedrat.plot(chunk_indices, ratio_gated_ung, label='FCUPgated / FCUPungated', color='navy', marker='o')
266+
ax_gatedrat.plot(chunk_indices, ratio_gated_ung, label='G / U', color='orange', marker='o', markersize=4)
264267
ax_gatedrat.axhline(1.0, color='black', linestyle='--', linewidth=1)
265268
ax_gatedrat.set_ylabel('Gated / Ungated', fontsize=11)
269+
ax_gatedrat.set_xlabel(xlabel, fontsize=11, loc='right')
266270
ax_gatedrat.grid(True, linestyle='--', alpha=0.6)
267271
ax_gatedrat.legend(fontsize=10)
268272
ax_gatedrat.tick_params(axis='both', labelsize=10)
269273

270274
# Bottom-1: skipped events count
271275
ax_bottom.bar(chunk_indices, skipped_counts, color='gray', alpha=0.7)
272-
ax_bottom.set_xlabel(f'Chunk Index (Each = {chunk_size} events)', fontsize=11)
276+
ax_bottom.set_xlabel(xlabel, fontsize=11, loc='right')
273277
ax_bottom.set_ylabel('# Skipped', fontsize=11)
274278
ax_bottom.grid(True, linestyle='--', alpha=0.6)
275279
ax_bottom.tick_params(axis='both', labelsize=10)
@@ -286,20 +290,23 @@ def main():
286290
ax_ltdist.hist(corrected_livetimes_A, bins=bins, alpha=0.4,
287291
label=f'Case A LT (μ={mean_A:.3f}, σ={sigma_A:.3f})', color='red')
288292
#ax_ltdist.hist(corrected_livetimes_B, bins=bins, alpha=0.4,
289-
# label=f'Case B LT (μ={mean_B:.3f}, σ={sigma_B:.3f})', color='green')
290-
ax_ltdist.hist(corrected_livetimes_C, bins=bins, alpha=0.4,
291-
label=f'Case C LT (μ={mean_C:.3f}, σ={sigma_C:.3f})', color='orange')
293+
# label=f'Case B LT (μ={mean_B:.3f}, σ={sigma_B:.3f})', color='green')
294+
# ax_ltdist.hist(corrected_livetimes_C, bins=bins, alpha=0.4,
295+
# label=f'Case C LT (μ={mean_C:.3f}, σ={sigma_C:.3f})', color='orange')
292296

293-
ax_ltdist.set_xlabel('Live Time', fontsize=11)
297+
ax_ltdist.set_xlabel('Live Time', fontsize=11, loc='right')
294298
ax_ltdist.set_ylabel('Counts', fontsize=11)
295299
ax_ltdist.legend(fontsize=9)
296300
ax_ltdist.grid(True, linestyle='--', alpha=0.6)
297301
ax_ltdist.tick_params(axis='both', labelsize=10)
298302

299303
fig2.tight_layout(rect=[0, 0.03, 1, 0.95])
300-
fig2.savefig(f'{output_dir}/chunked_fcupgated_comparison_{run_number}_{output_suffix}.png', bbox_inches='tight', dpi=300)
304+
fig2.savefig(f'{output_dir}/chunked_fcupgated_comparison_{file_basename}_{output_suffix}.png', bbox_inches='tight', dpi=300)
301305
plt.close(fig2)
302306

307+
print(f'TOTAL UNGATED CHARGE = {fcups[-1]-fcups[0]}')
308+
print(f'TOTAL GATED CHARGE = {fcupgateds[-1]-fcupgateds[0]}')
309+
303310

304311
if __name__ == "__main__":
305312
main()

qa-physics/charge_analysis/analyze_clock.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import org.jlab.jnp.hipo4.data.Bank;
77
import org.jlab.jnp.hipo4.data.SchemaFactory;
88
import java.util.List;
99
import java.util.ArrayList;
10+
import java.util.logging.Logger;
11+
import java.util.logging.Level;
1012

1113
if(args.length<4) {
1214
System.err.println """
@@ -22,6 +24,7 @@ def rollover = args[3] == '1'
2224
List<String> filenames = new ArrayList<>();
2325
filenames.add(in_file);
2426

27+
Logger.getLogger("org.jlab.detector.scalers.DaqScalersSequence").setLevel(Level.INFO);
2528
ConstantsManager consts = new ConstantsManager();
2629
consts.init("/runcontrol/fcup","/runcontrol/slm","/runcontrol/helicity","/daq/config/scalers/dsc1","/runcontrol/hwp");
2730
DaqScalersSequence seq = DaqScalersSequence.rebuildSequence(1, consts, filenames);

src/main/java/org/jlab/clas/timeline/analysis/alert/alert_atof_time.groovy

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ def has_data = new AtomicBoolean(false)
2020
(0..<11).collect{component->
2121
def h1 = dir.getObject(String.format('/ALERT/ATOF_Time_component%02d', component))
2222
if(h1!=null) {
23-
if (h1.getBinContent(h1.getMaximumBin()) > 30 && h1.getEntries()>300){
23+
if (h1.getBinContent(h1.getMaximumBin()) > 3 && h1.getEntries()>10){
2424
data[run].put(String.format('atof_time_%02d', component), h1)
25-
def f1 = ALERTFitter.atof_time_fitter(h1,component)
25+
double fit_min = h1.getXaxis().getBinCenter(1)
26+
double fit_max = h1.getXaxis().getBinCenter(h1.getXaxis().getNBins())
27+
def f1 = ALERTFitter.atof_time_fitter(h1, component, fit_min, fit_max)
2628
data[run].put(String.format('fit_atof_time_%02d', component), f1)
27-
data[run].put(String.format('peak_location_atof_time_%02d', component), f1.getParameter(1).abs())
29+
data[run].put(String.format('peak_location_atof_time_%02d', component), f1.getParameter(1))
2830
data[run].put(String.format('sigma_atof_time_%02d', component), f1.getParameter(2).abs())
2931
has_data.set(true)
3032
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package org.jlab.clas.timeline.analysis
2+
import java.util.concurrent.ConcurrentHashMap
3+
import java.util.concurrent.atomic.AtomicBoolean
4+
import org.jlab.groot.data.TDirectory
5+
import org.jlab.groot.data.GraphErrors
6+
import org.jlab.clas.timeline.fitter.ALERTFitter
7+
8+
class alert_atof_time_sl {
9+
10+
def data = new ConcurrentHashMap()
11+
def has_data = new AtomicBoolean(false)
12+
int sector
13+
int layer
14+
15+
alert_atof_time_sl(int sector, int layer) {
16+
this.sector = sector
17+
this.layer = layer
18+
}
19+
20+
def getName() {
21+
return String.format("%s_sector%02d_layer%d", this.class.simpleName, sector, layer)
22+
}
23+
24+
def processRun(dir, run) {
25+
data[run] = [run:run]
26+
(0..<11).each { component ->
27+
def h1 = dir.getObject(String.format('/ALERT/ATOF_Time_sector%02d_layer%02d_component%02d', sector, layer, component))
28+
if (h1 != null) {
29+
if (h1.getBinContent(h1.getMaximumBin()) > 3 && h1.getEntries() > 10) {
30+
def name = String.format('atof_time_sl_s%02d_l%d_c%02d', sector, layer, component)
31+
data[run].put(name, h1)
32+
double fit_min = h1.getXaxis().getBinCenter(1)
33+
double fit_max = h1.getXaxis().getBinCenter(h1.getXaxis().getNBins())
34+
def f1 = ALERTFitter.atof_time_fitter(h1, component, fit_min, fit_max)
35+
data[run].put('fit_' + name, f1)
36+
data[run].put('peak_location_' + name, f1.getParameter(1))
37+
data[run].put('sigma_' + name, f1.getParameter(2).abs())
38+
has_data.set(true)
39+
}
40+
}
41+
}
42+
}
43+
44+
def write() {
45+
if (!has_data.get()) {
46+
System.err.println "WARNING: no data for this timeline, not producing"
47+
return
48+
}
49+
['peak_location', 'sigma'].each { variable ->
50+
TDirectory out = new TDirectory()
51+
out.mkdir('/timelines')
52+
(0..<11).each { component ->
53+
def name = String.format('atof_time_sl_s%02d_l%d_c%02d', sector, layer, component)
54+
def gr = new GraphErrors(name)
55+
gr.setTitle(String.format("ATOF Time %s Sector %02d Layer %d", variable.replace('_', ' '), sector, layer))
56+
gr.setTitleY(String.format("ATOF Time %s (ns)", variable.replace('_', ' ')))
57+
gr.setTitleX("run number")
58+
data.sort { it.key }.each { run, it ->
59+
out.mkdir('/' + it.run)
60+
out.cd('/' + it.run)
61+
if (it.containsKey(name)) {
62+
out.addDataSet(it[name])
63+
out.addDataSet(it['fit_' + name])
64+
gr.addPoint(it.run, it[variable + '_' + name], 0, 0)
65+
} else if (variable == 'peak_location') {
66+
println(String.format("run %d: %s either does not exist or does not have enough statistics.", it.run, name))
67+
}
68+
}
69+
out.cd('/timelines')
70+
out.addDataSet(gr)
71+
}
72+
out.writeFile(String.format('alert_atof_time_sl_%s_sector%02d_layer%d.hipo', variable, sector, layer))
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)