Skip to content

Commit 06c2f37

Browse files
authored
Merge branch 'main' into Issue_441
2 parents 6099aa0 + c2c6975 commit 06c2f37

19 files changed

Lines changed: 719 additions & 32 deletions

File tree

bin/qtl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ usage() {
1818
physics Generate and analyze physics QA timelines (Step 2)
1919
error Scan for errors in Slurm logs (for Step 1)
2020
reheat Reproduce a data file, e.g., to rerun postprocessing
21+
xtrain Cross check run list from trains and DSTs
2122
2223
OPTIONS: Each command has its own set of options; run a command with no
2324
additional options to see usage for that command.
@@ -41,6 +42,7 @@ case $cmd in
4142
ph*) exec $TIMELINESRC/bin/qtl-physics "$@" ;;
4243
er*) exec $TIMELINESRC/bin/qtl-error "$@" ;;
4344
re*) exec $TIMELINESRC/bin/qtl-reheat "$@" ;;
45+
xt*) exec $TIMELINESRC/bin/qtl-xtrain "$@" ;;
4446
-v|--version)
4547
echo $(mvn -q help:evaluate -Dexpression=project.version -DforceStdout -f $TIMELINESRC/pom.xml || echo "UNKNOWN")
4648
exit 0

bin/qtl-reheat

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ declare -A REHEAT_METHODS=(
1616

1717
# default options
1818
dataset=train
19+
declare -A modes
20+
for key in submit; do
21+
modes[$key]=false
22+
done
1923

2024
# usage
2125
sep="================================================================"
@@ -37,6 +41,8 @@ $(for key in "${!REHEAT_METHODS[@]}"; do printf "%24s %-11s %-s\n" "" "$key" "${
3741
OPTIONAL OPTIONS:
3842
-d [DATASET] unique name for this dataset
3943
default: $dataset
44+
--submit submit the slurm jobs, rather than just
45+
printing the \`sbatch\` command
4046
""" >&2
4147
}
4248
if [ $# -lt 1 ]; then
@@ -48,7 +54,7 @@ fi
4854
inputDir=""
4955
outputDir=""
5056
cmd=""
51-
while getopts "i:o:c:d:h" opt; do
57+
while getopts "i:o:c:d:h-:" opt; do
5258
case $opt in
5359
i) inputDir=$OPTARG ;;
5460
o) outputDir=$OPTARG ;;
@@ -61,6 +67,12 @@ while getopts "i:o:c:d:h" opt; do
6167
usage
6268
exit 101
6369
;;
70+
-)
71+
for key in "${!modes[@]}"; do
72+
[ "$key" == "$OPTARG" ] && modes[$OPTARG]=true && break
73+
done
74+
[ -z "${modes[$OPTARG]-}" ] && printError "unknown option --$OPTARG" && exit 100
75+
;;
6476
*) exit 100 ;;
6577
esac
6678
done
@@ -159,6 +171,12 @@ EOF
159171
echo """
160172
SLURM SCRIPT: $slurmScript
161173
JOB LIST: $jobList
162-
Now submitting!
163174
"""
164-
sbatch $slurmScript
175+
if ${modes['submit']}; then
176+
echo "Now submitting!"
177+
sbatch $slurmScript
178+
else
179+
echo """Run this command to submit:
180+
sbatch $slurmScript
181+
"""
182+
fi

bin/qtl-xtrain

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'set'
4+
5+
unless ARGV.length == 2
6+
puts """
7+
Verify that a directory of a train's skim files has the same list of
8+
run numbers as a directory of DST-file run directories.
9+
10+
USAGE: qtl xtrain [TRAIN_DIR] [DST_DIR]
11+
12+
Both directories must be on /mss
13+
"""
14+
exit 2
15+
end
16+
train_dir, dst_dir = ARGV
17+
18+
# function to get a set of run numbers from one of the argument dirs
19+
def get_runnums(path, type)
20+
runnums = Set.new
21+
raise "#{type} dir `#{path}` is not on /mss" unless path.match? /^\/mss\//
22+
raise "#{type} dir `#{path}` does not exist" unless Dir.exist? path
23+
24+
# get list of files/directories within
25+
files = []
26+
case type
27+
when :train
28+
files = Dir.glob File.join(path, '*.hipo')
29+
when :DST
30+
files = Dir.glob File.join(path, '*/')
31+
else
32+
raise 'bad type'
33+
end
34+
raise "no #{type} files found in #{type} dir `#{path}`" if files.empty?
35+
36+
# extract their run numbers
37+
files.each do |file|
38+
nums = File.basename(file).scan(/\d+/).map &:to_i
39+
raise "failed to get run number from #{type} object `#{file}`" unless nums.length == 1
40+
runnums << nums[0]
41+
end
42+
raise "failed to get run numbers from #{type} dir `#{path}`" if runnums.empty?
43+
runnums
44+
end
45+
46+
# get runnum lists
47+
train_runs = get_runnums train_dir, :train
48+
dst_runs = get_runnums dst_dir, :DST
49+
puts """----------------------------------------------------------------------------------
50+
train dir run list:
51+
#{train_runs}
52+
DST dir run list:
53+
#{dst_runs}
54+
----------------------------------------------------------------------------------"""
55+
56+
# compare runnum sets
57+
only_in_trains = train_runs - dst_runs
58+
only_in_dsts = dst_runs - train_runs
59+
60+
# return results
61+
code = 0
62+
unless only_in_trains.empty?
63+
$stderr.puts "ERROR: there are runs with skim files, but no corresponding DST-file directories:"
64+
$stderr.puts only_in_trains
65+
code = 1
66+
end
67+
unless only_in_dsts.empty?
68+
$stderr.puts "ERROR: there are runs with DST-file directories, but no corresponding skim files:"
69+
$stderr.puts only_in_dsts
70+
code = 1
71+
end
72+
puts "All good" if code == 0
73+
exit code

doc/qa.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ If you are performing a manual QA as part of a cross check, skip to the next sec
4949
- use the scripts in the [`prescaler/` directory](/qadb/prescaler)
5050
</details>
5151

52+
<details>
53+
<summary>- [ ] cross check run list from trains and from DSTs</summary>
54+
55+
- use `qtl xtrain` to make sure the list of DST runs is consistent with the list of runs from a train
56+
- sometimes there are missing train files
57+
- the script also checks for missing DST files (though that should be impossible to happen)
58+
</details>
59+
5260
<details>
5361
<summary>- [ ] make sure all data are cached</summary>
5462

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@
3535
<dependency>
3636
<groupId>org.jlab.coat</groupId>
3737
<artifactId>coat-libs</artifactId>
38-
<version>13.5.1</version>
38+
<version>13.5.3</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.3</version>
45+
<version>5.0.4</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.3</version>
52+
<version>5.0.4</version>
5353
</dependency>
5454
<!-- https://mvnrepository.com/artifact/org.codehaus.gpars/gpars -->
5555
<dependency>
@@ -65,7 +65,7 @@
6565
<plugin>
6666
<groupId>org.apache.maven.plugins</groupId>
6767
<artifactId>maven-compiler-plugin</artifactId>
68-
<version>3.14.1</version>
68+
<version>3.15.0</version>
6969
<configuration>
7070
<release>21</release>
7171
<compilerId>groovy-eclipse-compiler</compilerId>
@@ -82,7 +82,7 @@
8282
<dependency>
8383
<groupId>org.codehaus.groovy</groupId>
8484
<artifactId>groovy-eclipse-batch</artifactId>
85-
<version>5.0.3-02</version> <!-- NOTE: if no release notes, try commit history of https://github.com/groovy/groovy-eclipse -->
85+
<version>5.0.4-01</version> <!-- NOTE: if no release notes, try commit history of https://github.com/groovy/groovy-eclipse -->
8686
</dependency>
8787
</dependencies>
8888
</plugin>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__pycache__
2+
*.png
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Charge Analysis
2+
3+
From Bhawani Singh
4+
5+
```bash
6+
./analyze HIPO_FILE
7+
```
8+
Produces PNG files comparing the DAQ-gated FC charge determined from
9+
- directly from the `RUN::scaler` bank
10+
- from the livetime and ungated charge, by multiplication

0 commit comments

Comments
 (0)