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-A Sp19 Pass 2 QA #242

Merged
merged 11 commits into from
Oct 22, 2024
79 changes: 40 additions & 39 deletions qa-physics/QA/modifyQaTree.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,30 @@ Tools T = new Tools()

// list of commands and description
def usage = [:]
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)"
usage["lossFT"] = "lossFT: specify a FT loss"
usage["setbit"] = "overwrites stored defectBit(s) with specified bit"
usage["addbit"] = "add specified bit to defectBit(s)"
usage["delbit"] = "delete specified bit from defectBit(s)"
usage["sectorloss"] = "specify a sector loss"
usage["lossft"] = "specify a FT loss"
usage["nobeam"] = "add 'PossiblyNoBeam' bit"
usage["setcomment"] = "change or delete the comment"
usage["addcomment"] = "append a comment"
usage["custom"] = "do a custom action (see code)"
println("\n\n")


// check arguments and print usage
def exe = "modify.sh"
def cmd
if(args.length>=1) cmd = args[0]
if(args.length>=1) cmd = args[0].toLowerCase()
else {
System.err.println(
"""
syntax: modify.sh [command] [arguments]\n
SYNTAX: ${exe} [command] [arguments]\n
List of Commands:
""")
usage.each{ System.err.println("- "+it.value) }
System.err.println("\ntype any command without arguments for usage for that command\n")
usage.each{ key, value -> printf("%20s %s\n", key, value) }
printf("\nType any command without arguments for usage guidance for that command\n\n")
System.exit(101)
}

Expand Down Expand Up @@ -66,15 +67,15 @@ def recomputeDefMask = { runnum,binnum ->
///////////////////////


if( cmd=="setBit" || cmd=="addBit" || cmd=="delBit") {
if( cmd=="setbit" || cmd=="addbit" || cmd=="delbit") {
def rnum,bnumL,bnumR
def bit
def secList = []
if(args.length>4) {
if(args.length>2) {
bit = args[1].toInteger()
rnum = args[2].toInteger()
bnumL = args[3].toInteger()
bnumR = args[4].toInteger()
bnumL = args.length < 4 ? 0 : args[3].toInteger()
bnumR = args.length < 5 ? -1 : args[4].toInteger()
if(args.length<6 || args[5]=="all") secList = (1..6).collect{it}
else (5..<args.length).each{ secList<<args[it].toInteger() }

Expand All @@ -90,17 +91,17 @@ if( cmd=="setBit" || cmd=="addBit" || cmd=="delBit") {
def qaFnum = k.toInteger()
if( qaFnum>=bnumL && ( bnumR==-1 || qaFnum<=bnumR ) ) {

if(cmd=="setBit") {
if(cmd=="setbit") {
secList.each{
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] = [bit]
}
}
else if(cmd=="addBit") {
else if(cmd=="addbit") {
secList.each{
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] += bit
}
}
else if(cmd=="delBit") {
else if(cmd=="delbit") {
secList.each{
qaTree["$rnum"]["$qaFnum"]["sectorDefects"]["$it"] -= bit
}
Expand All @@ -114,10 +115,10 @@ if( cmd=="setBit" || cmd=="addBit" || cmd=="delBit") {

}
else {
def helpStr = usage["$cmd"].tokenize(':')[1]
def helpStr = usage["$cmd"]
System.err.println(
"""
SYNTAX: ${cmd} [defectBit] [run] [firstBin] [lastBin] [list_of_sectors (default=all)]
SYNTAX: ${exe} ${cmd} [defectBit] [run] [firstBin (default=0)] [lastBin (default=-1)] [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 @@ -132,7 +133,7 @@ if( cmd=="setBit" || cmd=="addBit" || cmd=="delBit") {
}
}

else if(cmd=="sectorLoss") {
else if(cmd=="sectorloss") {
def rnum,bnumL,bnumR
def secList = []
if(args.length>3) {
Expand Down Expand Up @@ -168,10 +169,10 @@ else if(cmd=="sectorLoss") {

}
else {
def helpStr = usage["$cmd"].tokenize(':')[1]
def helpStr = usage["$cmd"]
System.err.println(
"""
SYNTAX: ${cmd} [run] [firstBin] [lastBin] [list_of_sectors (default=all)]
SYNTAX: ${exe} ${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 @@ -183,7 +184,7 @@ else if(cmd=="sectorLoss") {
}
}

else if(cmd=="noBeam") {
else if(cmd=="nobeam") {
def rnum,bnumL,bnumR
def secList = (1..6).collect{it}
if(args.length>3) {
Expand Down Expand Up @@ -221,10 +222,10 @@ else if(cmd=="noBeam") {

}
else {
def helpStr = usage["$cmd"].tokenize(':')[1]
def helpStr = usage["$cmd"]
System.err.println(
"""
SYNTAX: ${cmd} [run] [firstBin] [lastBin]
SYNTAX: ${exe} ${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
Expand All @@ -235,7 +236,7 @@ else if(cmd=="noBeam") {
}
}

else if(cmd=="lossFT") {
else if(cmd=="lossft") {
def rnum,bnumL,bnumR
if(args.length>4) {
rnum = args[1].toInteger()
Expand Down Expand Up @@ -265,10 +266,10 @@ else if(cmd=="lossFT") {

}
else {
def helpStr = usage["$cmd"].tokenize(':')[1]
def helpStr = usage["$cmd"]
println(
"""
SYNTAX: ${cmd} [run] [firstBin] [lastBin]
SYNTAX: ${exe} ${cmd} [run] [firstBin] [lastBin]
-$helpStr
- set [lastBin] to -1 to denote last time bin of run
- this will set the LossFT bit for specified time bins;
Expand All @@ -279,7 +280,7 @@ else if(cmd=="lossFT") {
}
}

else if( cmd=="addComment" || cmd=="setComment") {
else if( cmd=="addcomment" || cmd=="setcomment") {
def rnum,bnumL,bnumR
def secList = []
if(args.length==4) {
Expand All @@ -288,16 +289,16 @@ 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()
qaTree["$rnum"].each { k,v ->
def qaFnum = k.toInteger()
if( qaFnum>=bnumL && ( bnumR==-1 || qaFnum<=bnumR ) ) {
if (cmd=="addComment") {
if (cmd=="addcomment") {
if(!qaTree["$rnum"]["$qaFnum"].containsKey("comment")) {
qaTree["$rnum"]["$qaFnum"]["comment"] = cmt
}
Expand All @@ -307,15 +308,15 @@ else if( cmd=="addComment" || cmd=="setComment") {
qaTree["$rnum"]["$qaFnum"]["comment"] += cmt
}
}
else if (cmd=="setComment")
else if (cmd=="setcomment")
qaTree["$rnum"]["$qaFnum"]["comment"] = cmt
}
}
}
else {
System.err.println(
"""
SYNTAX: ${cmd} [run] [firstBin] [lastBin]
SYNTAX: ${exe} ${cmd} [run] [firstBin] [lastBin]
- set [lastBin] to -1 to denote last time bin of run
- you will be prompted to enter the comment
""")
Expand Down Expand Up @@ -358,7 +359,7 @@ else if( cmd=="custom") {

///* // add misc bit to sector 6 only
qaTree["$rnum"]["$bnum"]["sectorDefects"]["6"] += T.bit("Misc")
def cmt = "FADC failure in sector 6"
def cmt = "FADC failure in ECAL sector 6; see https://logbooks.jlab.org/entry/3678262"
//*/

if(!qaTree["$rnum"]["$bnum"].containsKey("comment")) {
Expand All @@ -369,7 +370,7 @@ else if( cmd=="custom") {
qaTree["$rnum"]["$bnum"]["comment"] += "; "
qaTree["$rnum"]["$bnum"]["comment"] += cmt
}
println("modify $rnum $bnum")
// println("modify $rnum $bnum")

recomputeDefMask(rnum,bnum)

Expand Down
1 change: 1 addition & 0 deletions qa-physics/epochs/epochs.rga_sp19_nSidis.txt
1 change: 1 addition & 0 deletions qa-physics/epochs/epochs.rga_sp19_prescaled.txt
64 changes: 64 additions & 0 deletions qa-physics/notes/rga_sp19.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Run Group A, Spring 2019, Pass 2

## Produce prescaled trains

> [!NOTE]
> Bad tape 803771 (April, 2024) included DSTs that were not recooked;
> this QA therefore did not check the 'prescale' train (but commands
> are still written below)

Check the commands carefully before you run; these are just notes...
```bash
cd qa-physics/prescaler
cook-train.rb --dataset rga_sp19 --coatjava 10.1.1
start-workflow.sh rga-a-sp19*.json ## check that this is the correct JSON file before running
```

## Check prescaled trains

> [!IMPORTANT]
> To be sure the workflows succeeded and we have all the data, run `check-train.rb`.

## Run monitoring

> [!IMPORTANT]
> Check any run-dependent settings in `qa-physics/monitorRead.groovy`, such as beam energy.

For the prescaled train:
```bash
bin/run-monitoring.sh -d rga_sp19_prescaled --submit --focus-physics PATH_TO_PRESCALED_TRAIN
```

For the SIDIS train, `nSidis`, first make sure all skim files are cached:
```bash
bin/run-monitoring.sh -d rga_sp19_nSidis --check-cache --flatdir --focus-physics /cache/clas12/rg-a/production/recon/spring2019/torus-1/pass2/dst/train/nSidis
```
If they are not:
```bash
ls /mss/clas12/rg-a/production/recon/spring2019/torus-1/pass2/dst/train/nSidis/* | tee jlist.txt
jcache get $(cat jlist.txt)
# then wait for them to be cached
```
then run monitoring
```bash
bin/run-monitoring.sh -d rga_sp19_nSidis --submit --flatdir --focus-physics /cache/clas12/rg-a/production/recon/spring2019/torus-1/pass2/dst/train/nSidis
```

## Make timelines

Make the timelines:
```bash
bin/run-physics-timelines.sh -d rga_sp19_prescaled
bin/run-physics-timelines.sh -d rga_sp19_nSidis
```

Deploy either to your area or the common area (remove the `-D` option once you confirm this is the correct directory):
```bash
# your area, for testing
bin/deploy-timelines.sh -d rga_sp19_prescaled -t $LOGNAME -D
bin/deploy-timelines.sh -d rga_sp19_nSidis -t $LOGNAME -D

# common area
bin/deploy-timelines.sh -d rga_sp19_prescaled -t rga/pass2/sp19/qa -D
bin/deploy-timelines.sh -d rga_sp19_nSidis -t rga/pass2/sp19/qa -D
```
2 changes: 1 addition & 1 deletion qa-physics/notes/rgc_su22.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Run Group C QA
# Run Group C, Summer 2022, Pass 1

This is the first QA to use the time bins and the prescaling.

Expand Down
Loading