Skip to content

Commit 82b1b8c

Browse files
authored
fix: do not try to write empty ftof_ctof_vtdiff timeline (#313)
1 parent b049c2e commit 82b1b8c

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def has_data = new AtomicBoolean(false)
4141
def write() {
4242

4343
if(!has_data.get()) {
44-
System.err.println "ERROR: no data for this ALERT timeline, not producing"
44+
System.err.println "WARNING: no data for this timeline, not producing"
4545
return
4646
}
4747

src/main/java/org/jlab/clas/timeline/analysis/ftof/ftof_ctof_vtdiff.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
package org.jlab.clas.timeline.analysis
22
import java.util.concurrent.ConcurrentHashMap
3+
import java.util.concurrent.atomic.AtomicBoolean
34
import org.jlab.groot.data.TDirectory
45
import org.jlab.groot.data.GraphErrors
56
import org.jlab.clas.timeline.fitter.MoreFitter
67

78
class ftof_ctof_vtdiff {
89

910
def data = new ConcurrentHashMap()
11+
def has_data = new AtomicBoolean(false)
1012

1113
def processRun(dir, run) {
1214
(1..6).collect{sec->
1315
def h1 = dir.getObject("/tof/ftof-ctof_vtdiff_S${sec}")
1416
if(h1.integral() > 0.0) {
1517
def f1 = MoreFitter.fitgaus(h1)
1618
data.computeIfAbsent(sec, {[]}).add([run:run, h1:h1, f1:f1, mean:f1.getParameter(1), sigma:f1.getParameter(2).abs()])
19+
has_data.set(true)
1720
}
1821
}
1922
}
@@ -22,6 +25,11 @@ def processRun(dir, run) {
2225

2326
def write() {
2427

28+
if(!has_data.get()) {
29+
System.err.println "WARNING: no data for this timeline, not producing"
30+
return
31+
}
32+
2533
['mean', 'sigma'].each{ name ->
2634
TDirectory out = new TDirectory()
2735
out.mkdir('/timelines')

0 commit comments

Comments
 (0)