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

avoid hard-coded run group/period dependence #74

Open
5 of 7 tasks
c-dilks opened this issue Aug 3, 2023 · 2 comments · May be fixed by #101
Open
5 of 7 tasks

avoid hard-coded run group/period dependence #74

c-dilks opened this issue Aug 3, 2023 · 2 comments · May be fixed by #101

Comments

@c-dilks
Copy link
Member

c-dilks commented Aug 3, 2023

Can we move these sort of settings and implementations to config files?

MAIN="org.jlab.clas.timeline.run"
if [ $rungroup = "rgb" ]; then
MAIN="org.jlab.clas.timeline.run_rgb"
fi

  • run group dependent settings in QA monitorRead.groovy
    • do not set helFlip; the helicity should be fixed upstream
    • do not correct FC attenuation; this should be fixed upstream
    • do not set FCmode, although we may still have to use this for compatibility with old Pass1 data

//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
// RUN GROUP DEPENDENT SETTINGS //////////////////////////
def RG = "unknown"
if(runnum>=4763 && runnum<=5001) RG="RGA" // early period
else if(runnum>=5032 && runnum<=5262) RG="RGA" // inbending1
else if(runnum>=5300 && runnum<=5666) RG="RGA" // inbending1 + outbending
else if(runnum>=5674 && runnum<=6000) RG="RGK" // 6.5+7.5 GeV
else if(runnum>=6120 && runnum<=6604) RG="RGB" // spring 19
else if(runnum>=6616 && runnum<=6783) RG="RGA" // spring 19
else if(runnum>=11093 && runnum<=11300) RG="RGB" // fall 19
else if(runnum>=11323 && runnum<=11571) RG="RGB" // winter 20
else if(runnum>=12210 && runnum<=12951) RG="RGF" // spring+summer 20
else if(runnum>=15019 && runnum<=15884) RG="RGM"
else System.err.println "WARNING: unknown run group; using default run-group-dependent settings (see monitorRead.groovy)"
println "rungroup = $RG"
// helFlip: if true, REC::Event.helicity has opposite sign from reality
def helFlip = false
if(RG=="RGA") helFlip = true
else if(RG=="RGB") {
helFlip = true
if(runnum>=11093 && runnum<=11283) helFlip = false // fall, 10.4 GeV period only
else if(runnum>=11323 && runnum<=11571) helFlip = false // winter
};
else if(RG=="RGK") helFlip = false
else if(RG=="RGF") helFlip = true
else if(RG=="RGM") helFlip = true
// beam energy
// - hard-coded; could instead get from RCDB, but sometimes it is incorrect
def EBEAM = 10.6041 // RGA default
if(RG=="RGA") {
if(runnum>=6616 && runnum<=6783) EBEAM = 10.1998 // spring 19
else EBEAM = 10.6041
}
else if(RG=="RGB") {
if(runnum>=6120 && runnum<=6399) EBEAM = 10.5986 // spring
else if(runnum>=6409 && runnum<=6604) EBEAM = 10.1998 // spring
else if(runnum>=11093 && runnum<=11283) EBEAM = 10.4096 // fall
else if(runnum>=11284 && runnum<=11300) EBEAM = 4.17179 // fall BAND_FT
else if(runnum>=11323 && runnum<=11571) EBEAM = 10.3894 // winter (RCDB may still be incorrect)
else System.err.println "ERROR: unknown beam energy"
}
else if(RG=="RGK") {
if(runnum>=5674 && runnum<=5870) EBEAM = 7.546
else if(runnum>=5875 && runnum<=6000) EBEAM = 6.535
else System.err.println "ERROR: unknown beam energy"
}
else if(RG=="RGF") {
if (runnum>=12210 && runnum<=12388) EBEAM = 10.389 // RCDB may still be incorrect
else if(runnum>=12389 && runnum<=12443) EBEAM = 2.186 // RCDB may still be incorrect
else if(runnum>=12444 && runnum<=12951) EBEAM = 10.389 // RCDB may still be incorrect
else System.err.println "ERROR: unknown beam energy"
}
else if(RG=="RGM") {
if (runnum>=15013 && runnum<=15490) EBEAM = 5.98636
else if(runnum>=15533 && runnum<=15727) EBEAM = 2.07052
else if(runnum>=15728 && runnum<=15784) EBEAM = 4.02962
else if(runnum>=15787 && runnum<=15884) EBEAM = 5.98636
else System.err.println "ERROR: unknown beam energy"
}
/* gated FC charge determination: `FCmode`
* - 0: DAQ-gated FC charge is incorrect
* - recharge option was likely OFF during cook, and should be turned on
* - re-calculates DAQ-gated FC charge as: `ungated FC charge * average livetime`
* - typically applies to data cooked with version 6.5.3 or below
* - typically used as a fallback if there are "spikes" in gated charge when `FCmode==1`
* - 1: DAQ-gated FC charge can be trusted
* - recharge option was either ON or did not need to be ON
* - calculate DAQ-gated FC charge directly from `RUN::scaler:fcupgated`
* - if you find `fcupgated > fcup(un-gated)`, then most likely the recharge option was OFF
* but should have been ON, and `FCmode=0` should be used instead
* - 2: special case
* - calculate DAQ-gated FC charge from `REC::Event:beamCharge`
* - useful if `RUN::scaler` is unavailable
*/
def FCmode = 1 // default assumes DAQ-gated FC charge can be trusted
if(RG=="RGA") {
FCmode = 0 // fall18 inbending+outbending
if(runnum>=6616 && runnum<=6783) { // spring19
FCmode=1;
if(runnum==6724) FCmode=0; // fcupgated charge spike in file 230
}
}
else if(RG=="RGB") {
FCmode = 1
if( runnum in [6263, 6350, 6599, 6601, 11119] ) FCmode=0 // fcupgated charge spikes
}
else if(RG=="RGK") FCmode = 0
else if(RG=="RGF") FCmode = 0
else if(RG=="RGM") {
FCmode = 1
if(runnum>=15015 && runnum<=15199) {
FCmode = 2 //no scalars read out in this range probably dosen't work anyway
}
}
// FC attenuation fix
// FIXME: re-define this as a closure here, when resolving https://github.com/JeffersonLab/clasqaDB/issues/12
// RGB runs <6400 had wrong attenuation, need to use
// fc -> fc*9.96025
// (this is programmed in below, but mentioned here for documentation)
//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////

@drewkenjo
Copy link
Collaborator

I fully support this idea.

@c-dilks
Copy link
Member Author

c-dilks commented Aug 23, 2024

From issue description above:

@baltzell are #138 + #158 general enough such that we can finally close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants