Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: RG-C Su22 manual QA #221

Merged
merged 29 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bd009e0
feat: establish RG-C Su22 epochs
c-dilks Jul 26, 2024
a99eb16
feat: initial epochs
c-dilks Jul 27, 2024
19ac886
fix: better mkTree
c-dilks Jul 27, 2024
5e2a8cf
doc: comments describing epochs
c-dilks Jul 28, 2024
d28b16b
fix: handle epochs file comments downstream
c-dilks Jul 28, 2024
7987332
fix(doc): better dataset name
c-dilks Jul 28, 2024
4ea4ec5
test: which epochs have bad N/F median
c-dilks Jul 28, 2024
a88a39c
doc: sidisdvcs notes
c-dilks Aug 22, 2024
b7888b9
fix: don't run `hipo-check` for trains
c-dilks Aug 22, 2024
80e6b59
fix: symlink epoch files for alternate dataset names
c-dilks Aug 22, 2024
8bad075
Merge branch 'main' into rgc-su22-epochs
c-dilks Sep 9, 2024
5c81002
fix: wait for parsing to finish
c-dilks Sep 10, 2024
5dab5c7
fix: decrease 'ChargeHigh' QA sensitivity
c-dilks Sep 10, 2024
3ff9ef6
fix: modify `meld.groovy` to handle `ChargeHigh` meld
c-dilks Sep 10, 2024
ae32130
fix: revert to previous cuts for `PossiblyNoBeam`
c-dilks Sep 10, 2024
8ae2722
feat: default `list_of_sectors` is all of them
c-dilks Sep 11, 2024
1242305
Merge branch 'rgc-su22-epochs' of github.com:JeffersonLab/clas12-time…
c-dilks Sep 11, 2024
a76a059
feat: `noBeam` command
c-dilks Sep 11, 2024
0ee3e1c
fix: add -> set
c-dilks Sep 11, 2024
09b3c55
fix: preserve existing comments in command `noBeam`
c-dilks Sep 11, 2024
f2c21bb
fix: prefer to not remove outlier bits when sectorLoss
c-dilks Sep 11, 2024
f5a103d
fix: better `PossiblyNoBeam` assignment
c-dilks Sep 11, 2024
8249d59
Merge remote-tracking branch 'origin/main' into rgc-su22-epochs
c-dilks Sep 11, 2024
cfa3e1e
doc: update deploy commands for metadata
c-dilks Sep 11, 2024
ba3de69
fix: move `live_time_average` timeline to extras
c-dilks Sep 16, 2024
57504cd
fix: add new bits to `exeQAtimelines`
c-dilks Sep 16, 2024
02547b0
fix: make `exeQAtimelines` work
c-dilks Sep 16, 2024
66e78b8
fix: staging of files from `exeQAtimelines`
c-dilks Sep 16, 2024
ac07b1d
fix: staging should `mv`, not `cp`
c-dilks Sep 17, 2024
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
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Timeline production for CLAS12. Timelines are deployed to [`clas12mon`](https://clas12mon.jlab.org).

| Table of Contents | |
| --- | --- |
| [:star: **Chefs' Documentation** :star:](/doc/chef_guide.md) | Summary documentation for chefs |
| [Setup Guide](/doc/setup.md) | How to compile the timeline code |
| [Detailed Procedure](/doc/procedure.md) | Full procedure how to run the timeline code |
| [Developers' Notes](/doc/dev_notes.md) | Additional notes for developers (_e.g._, flowcharts |
| [QADB Production](/qa-physics/README.md) | Quality Assurance Database (QADB) production guide |
| Table of Contents | |
| --- | --- |
| [:star: **Chefs' Documentation** :star:](/doc/chef_guide.md) | Summary documentation for chefs |
| [Setup Guide](/doc/setup.md) | How to compile the timeline code |
| [Detailed Procedure](/doc/procedure.md) | Full procedure how to run the timeline code |
| [Developers' Notes](/doc/dev_notes.md) | Additional notes for developers (_e.g._, flowcharts) |
| [QADB Production](/qa-physics/README.md) | Quality Assurance Database (QADB) production guide |
44 changes: 29 additions & 15 deletions qa-physics/QA/meld/meld.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ qaTreeNew.each{ runnum, binTree ->
binTree.each{ binnum, binQAnew ->
if(debug) println "\nrun=$runnum bin=$binnum"
qaTreeMelded[runnum][binnum] = [:]

// get QA info from old qaTree
runQAold = qaTreeOld[runnum]
if(runQAold!=null) binQAold = qaTreeOld[runnum][binnum]
Expand All @@ -62,34 +62,48 @@ qaTreeNew.each{ runnum, binTree ->

// meld new defect bits
defectListNew.each{ defect ->
if(defect==T.bit("TotalOutlier")) meldList << defect
if(defect==T.bit("TerminalOutlier")) meldList << defect
if(defect==T.bit("MarginalOutlier")) meldList << defect
if(defect==T.bit("LowLiveTime")) meldList << defect
// meldList << defect
if(defect==T.bit("PossiblyNoBeam")) meldList << defect
// if(defect==T.bit("TotalOutlier")) meldList << defect
// if(defect==T.bit("TerminalOutlier")) meldList << defect
// if(defect==T.bit("MarginalOutlier")) meldList << defect
// if(defect==T.bit("LowLiveTime")) meldList << defect
}

// meld old defect bits
if(binQAold!=null) {
defectListOld = T.getLeaf(binQAold,['sectorDefects',sector])
defectListOld.each{ defect ->


if(defect==T.bit("PossiblyNoBeam")) {
if(defectListNew.findAll{it==T.bit("PossiblyNoBeam")}.size()==1) {
meldList << defect
if(comment.contains("manually added")) {
deleteComment = true
}
}
}
else {
meldList << defect
}

if(defect==T.bit("SectorLoss")) {
meldList << defect
// remove outlier bits
meldList.removeAll(T.bit("TotalOutlier"))
meldList.removeAll(T.bit("TerminalOutlier"))
meldList.removeAll(T.bit("MarginalOutlier"))
// meldList.removeAll(T.bit("TotalOutlier"))
// meldList.removeAll(T.bit("TerminalOutlier"))
// meldList.removeAll(T.bit("MarginalOutlier"))
}
if(defect==T.bit("Misc")) {
if(comment.contains("please delete this comment")) deleteComment=true
else {
meldList << defect
// remove all other bits
meldList.removeAll(T.bit("TotalOutlier"))
meldList.removeAll(T.bit("TerminalOutlier"))
meldList.removeAll(T.bit("MarginalOutlier"))
meldList.removeAll(T.bit("SectorLoss"))
meldList.removeAll(T.bit("LowLiveTime"))
// meldList.removeAll(T.bit("TotalOutlier"))
// meldList.removeAll(T.bit("TerminalOutlier"))
// meldList.removeAll(T.bit("MarginalOutlier"))
// meldList.removeAll(T.bit("SectorLoss"))
// meldList.removeAll(T.bit("LowLiveTime"))
}
}
}
Expand Down Expand Up @@ -126,4 +140,4 @@ qaTreeNew.each{ runnum, binTree ->

// output melded qaTree.json
new File("qaTree.json.melded").write(JsonOutput.toJson(qaTreeMelded))
['new','old','melded'].each{"./prettyPrint.sh $it".execute()}
['new','old','melded'].each{"./prettyPrint.sh $it".execute().waitFor()}
99 changes: 76 additions & 23 deletions qa-physics/QA/modifyQaTree.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ usage["setBit"] = "setBit: overwrites stored defectBit(s) with specified bit"
usage["addBit"] = "addBit: add specified bit to defectBit(s)"
usage["delBit"] = "delBit: delete specified bit from defectBit(s)"
usage["sectorLoss"] = "sectorLoss: specify a sector loss"
usage["noBeam"] = "noBeam: add 'PossiblyNoBeam' bit"
usage["setComment"] = "setComment: change or delete the comment"
usage["addComment"] = "addComment: append a comment"
usage["custom"] = "custom: do a custom action (see code)"
Expand All @@ -21,7 +22,7 @@ println("\n\n")
// check arguments and print usage
def cmd
if(args.length>=1) cmd = args[0]
else {
else {
System.err.println(
"""
syntax: modify.sh [command] [arguments]\n
Expand Down Expand Up @@ -49,7 +50,7 @@ def qaTree = slurper.parse(jsonFile)
def recomputeDefMask = { runnum,binnum ->
defList = []
defMask = 0
(1..6).each{ s ->
(1..6).each{ s ->
qaTree["$runnum"]["$binnum"]["sectorDefects"]["$s"].unique()
defList +=
qaTree["$runnum"]["$binnum"]["sectorDefects"]["$s"].collect{it.toInteger()}
Expand All @@ -69,15 +70,15 @@ if( cmd=="setBit" || cmd=="addBit" || cmd=="delBit") {
def rnum,bnumL,bnumR
def bit
def secList = []
if(args.length>5) {
if(args.length>4) {
bit = args[1].toInteger()
rnum = args[2].toInteger()
bnumL = args[3].toInteger()
bnumR = args[4].toInteger()
if(args[5]=="all") secList = (1..6).collect{it}
if(args.length<6 || args[5]=="all") secList = (1..6).collect{it}
else (5..<args.length).each{ secList<<args[it].toInteger() }

println("run $rnum bins ${bnumL}-"+(bnumR==-1 ? "END" : bnumR) +
println("run $rnum bins ${bnumL}-"+(bnumR==-1 ? "END" : bnumR) +
" sectors ${secList}: $cmd ${bit}="+T.bitNames[bit])

println("Enter a comment, if you want, otherwise press return")
Expand All @@ -90,7 +91,7 @@ if( cmd=="setBit" || cmd=="addBit" || cmd=="delBit") {
if( qaFnum>=bnumL && ( bnumR==-1 || qaFnum<=bnumR ) ) {

if(cmd=="setBit") {
secList.each{
secList.each{
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] = [bit]
}
}
Expand All @@ -116,7 +117,7 @@ if( cmd=="setBit" || cmd=="addBit" || cmd=="delBit") {
def helpStr = usage["$cmd"].tokenize(':')[1]
System.err.println(
"""
SYNTAX: ${cmd} [defectBit] [run] [firstBin] [lastBin] [list_of_sectors]
SYNTAX: ${cmd} [defectBit] [run] [firstBin] [lastBin] [list_of_sectors (default=all)]
-$helpStr
- set [lastBin] to -1 to denote last time bin of run
- use \"all\" in place of [list_of_sectors] to apply to all sectors
Expand All @@ -134,14 +135,14 @@ if( cmd=="setBit" || cmd=="addBit" || cmd=="delBit") {
else if(cmd=="sectorLoss") {
def rnum,bnumL,bnumR
def secList = []
if(args.length>4) {
if(args.length>3) {
rnum = args[1].toInteger()
bnumL = args[2].toInteger()
bnumR = args[3].toInteger()
if(args[4]=="all") secList = (1..6).collect{it}
if(args.length<5 || args[4]=="all") secList = (1..6).collect{it}
else (4..<args.length).each{ secList<<args[it].toInteger() }

println("run $rnum bins ${bnumL}-"+(bnumR==-1 ? "END" : bnumR) +
println("run $rnum bins ${bnumL}-"+(bnumR==-1 ? "END" : bnumR) +
" sectors ${secList}: define sector loss")

println("Enter a comment, if you want, otherwise press return")
Expand All @@ -152,10 +153,10 @@ else if(cmd=="sectorLoss") {
def qaFnum = k.toInteger()
if( qaFnum>=bnumL && ( bnumR==-1 || qaFnum<=bnumR ) ) {

secList.each{
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] -= T.bit("TotalOutlier")
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] -= T.bit("TerminalOutlier")
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] -= T.bit("MarginalOutlier")
secList.each{
// qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] -= T.bit("TotalOutlier")
// qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] -= T.bit("TerminalOutlier")
// qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] -= T.bit("MarginalOutlier")
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] += T.bit("SectorLoss")
}

Expand All @@ -170,7 +171,7 @@ else if(cmd=="sectorLoss") {
def helpStr = usage["$cmd"].tokenize(':')[1]
System.err.println(
"""
SYNTAX: ${cmd} [run] [firstBin] [lastBin] [list_of_sectors]
SYNTAX: ${cmd} [run] [firstBin] [lastBin] [list_of_sectors (default=all)]
-$helpStr
- set [lastBin] to -1 to denote last time bin of run
- use \"all\" in place of [list_of_sectors] to apply to all sectors
Expand All @@ -182,6 +183,58 @@ else if(cmd=="sectorLoss") {
}
}

else if(cmd=="noBeam") {
def rnum,bnumL,bnumR
def secList = (1..6).collect{it}
if(args.length>3) {
rnum = args[1].toInteger()
bnumL = args[2].toInteger()
bnumR = args[3].toInteger()

println("run $rnum bins ${bnumL}-"+(bnumR==-1 ? "END" : bnumR) +
" sectors ${secList}: add PossiblyNoBeam bit")

println("Enter an additional comment, if you want, otherwise press return")
print("> ")
def cmt = System.in.newReader().readLine()
cmt = ['manually added PossiblyNoBeam defect bit', cmt].findAll{it.length()>0}.join('; ')

qaTree["$rnum"].each { k,v ->
def qaFnum = k.toInteger()
if( qaFnum>=bnumL && ( bnumR==-1 || qaFnum<=bnumR ) ) {
secList.each{
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] += T.bit("PossiblyNoBeam")
}
recomputeDefMask(rnum,qaFnum)
if(cmt.length()>0) {
if(!qaTree["$rnum"]["$qaFnum"].containsKey("comment")) {
qaTree["$rnum"]["$qaFnum"]["comment"] = cmt
}
else {
if(qaTree["$rnum"]["$qaFnum"]["comment"].length()>0)
qaTree["$rnum"]["$qaFnum"]["comment"] += "; "
qaTree["$rnum"]["$qaFnum"]["comment"] += cmt
}
}
}
}

}
else {
def helpStr = usage["$cmd"].tokenize(':')[1]
System.err.println(
"""
SYNTAX: ${cmd} [run] [firstBin] [lastBin]
-$helpStr
- set [lastBin] to -1 to denote last time bin of run
- this will set the PossiblyNoBeam bit for specified time bins, and add
a comment saying this was done
- you will be prompted to enter an additional comment
""")
System.exit(101)
}
}

else if(cmd=="lossFT") {
def rnum,bnumL,bnumR
if(args.length>4) {
Expand All @@ -199,9 +252,9 @@ else if(cmd=="lossFT") {
def qaFnum = k.toInteger()
if( qaFnum>=bnumL && ( bnumR==-1 || qaFnum<=bnumR ) ) {

qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["1"] -= T.bit("TotalOutlierFT")
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["1"] -= T.bit("TerminalOutlierFT")
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["1"] -= T.bit("MarginalOutlierFT")
// qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["1"] -= T.bit("TotalOutlierFT")
// qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["1"] -= T.bit("TerminalOutlierFT")
// qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["1"] -= T.bit("MarginalOutlierFT")
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["1"] += T.bit("LossFT")

recomputeDefMask(rnum,qaFnum)
Expand Down Expand Up @@ -235,9 +288,9 @@ else if( cmd=="addComment" || cmd=="setComment") {
bnumR = args[3].toInteger()

println("run $rnum bins ${bnumL}-"+(bnumR==-1 ? "END" : bnumR) + ": $cmd")
if(cmd=="addComment")
if(cmd=="addComment")
println("Enter the new comment to be appended")
else if(cmd=="setComment")
else if(cmd=="setComment")
println("Enter the new comment, or leave it blank to delete any stored comment")
print("> ")
def cmt = System.in.newReader().readLine()
Expand All @@ -254,7 +307,7 @@ else if( cmd=="addComment" || cmd=="setComment") {
qaTree["$rnum"]["$qaFnum"]["comment"] += cmt
}
}
else if (cmd=="setComment")
else if (cmd=="setComment")
qaTree["$rnum"]["$qaFnum"]["comment"] = cmt
}
}
Expand Down Expand Up @@ -293,7 +346,7 @@ else if( cmd=="custom") {

/* // remove outlier bits and add misc bit, to all sectors
def secList = (1..6).collect{it}
secList.each{
secList.each{
qaTree["$rnum"]["$bnum"]["sectorDefects"]["$it"] += T.bit("Misc") // add bit
//qaTree["$rnum"]["$bnum"]["sectorDefects"]["$it"] = [T.bit("Misc")] // set bit
qaTree["$rnum"]["$bnum"]["sectorDefects"]["$it"] -= T.bit("TotalOutlier") // delete bit
Expand Down Expand Up @@ -329,4 +382,4 @@ else { System.err.println("ERROR: unknown command!"); System.exit(100) }

// update qaTree.json
new File("qa/qaTree.json").write(JsonOutput.toJson(qaTree))
"run-groovy parseQaTree.groovy".execute()
["run-groovy", "parseQaTree.groovy"].execute().waitFor()
2 changes: 1 addition & 1 deletion qa-physics/QA/parseQaTree.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Tools T = new Tools()

infile="qa/qaTree.json"
outfile="qa/qaTree.json.table"
if(args.size()>=1 && args[0].endsWith(".json")) {
if(args.size()>=1) {
infile = args[0]
outfile = "${infile}.table"
args = args.minus([args[0]]) // remove json file from args since no longer needed
Expand Down
20 changes: 20 additions & 0 deletions qa-physics/epochs/epochs.rgc_su22.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
16042 16044 # ET, beam E = 2.2 GeV
16047 16054 # C
16066 16078 # NH3
16089 16090 # ET, beam E = 10.5 GeV
16096 16134 # C
16137 16178 # NH3
16184 16186 # ET
16188 16191 # Align
16194 16195 # ET
16211 16260 # NH3
16262 16289 # ND3
16290 16297 # C
16298 16303 # CH2
16306 16309 # ET
16317 16357 # NH3
16358 16636 # ND3
16658 16695 # NH3
16697 16704 # C
16709 16772 # NH3
16783 16786 # Align
1 change: 1 addition & 0 deletions qa-physics/epochs/epochs.rgc_su22_prescaled.txt
1 change: 1 addition & 0 deletions qa-physics/epochs/epochs.rgc_su22_sidisdvcs.txt
Loading