-
Notifications
You must be signed in to change notification settings - Fork 155
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
[Anchor] Use STF and ETF #1597
[Anchor] Use STF and ETF #1597
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,9 @@ def fetch(self, path, obj_type, timestamp=None, meta_info=None): | |
|
||
return timestamp, obj | ||
|
||
def get_run_duration(self, run_number): | ||
return o2.ccdb.BasicCCDBManager.instance().getRunDuration(run_number) | ||
|
||
def fetch_header(self, path, timestamp=None): | ||
meta_info = std.map["std::string", "std::string"]() | ||
if timestamp is None: | ||
|
@@ -75,22 +78,6 @@ def fetch_header(self, path, timestamp=None): | |
return header | ||
|
||
|
||
|
||
def retrieve_sor_eor(ccdbreader, run_number): | ||
""" | ||
retrieves start of run (sor) and end of run (eor) given a run number | ||
from the RCT/Info/RunInformation table | ||
""" | ||
|
||
path_run_info = "RCT/Info/RunInformation" | ||
header = ccdbreader.fetch_header(path_run_info, run_number) | ||
if not header: | ||
print(f"WARNING: Cannot find run information for run number {run_number}") | ||
return None | ||
# return this a dictionary | ||
return {"SOR": int(header["SOR"]), "EOR": int(header["EOR"])} | ||
|
||
|
||
def retrieve_CCDBObject_asJSON(ccdbreader, path, timestamp, objtype_external = None): | ||
""" | ||
Retrieves a CCDB object as a JSON/dictionary. | ||
|
@@ -111,7 +98,7 @@ def retrieve_CCDBObject_asJSON(ccdbreader, path, timestamp, objtype_external = N | |
jsonTString = TBufferJSON.ConvertToJSON(obj, TClass.GetClass(objtype)) | ||
return json.loads(jsonTString.Data()) | ||
|
||
def retrieve_params_fromGRPECS(ccdbreader, run_number, rct = None): | ||
def retrieve_params_fromGRPECS(ccdbreader, run_number, run_start=None, run_end=None): | ||
""" | ||
Retrieves start of run (sor), end of run (eor) and other global parameters from the GRPECS object, | ||
given a run number. We first need to find the right object | ||
|
@@ -150,22 +137,18 @@ def retrieve_params_fromGRPECS(ccdbreader, run_number, rct = None): | |
# object, with which we can query the end time as well | ||
grp=retrieve_CCDBObject_asJSON(ccdbreader, "/GLO/Config/GRPECS" + "/runNumber=" + str(run_number) + "/", int(SOV)) | ||
|
||
|
||
# check that this object is really the one we wanted based on run-number | ||
assert(int(grp["mRun"]) == int(run_number)) | ||
|
||
SOR=int(grp["mTimeStart"]) # in milliseconds | ||
EOR=int(grp["mTimeEnd"]) | ||
# cross check with RCT if available | ||
if rct != None: | ||
# verify that the variaous sor_eor information are the same | ||
if SOR != rct["SOR"]: | ||
print ("WARNING: Inconsistent SOR information on CCDB (divergence between GRPECS and RCT) ... will take RCT one") | ||
SOR=rct["SOR"] | ||
|
||
if EOR != rct["EOR"]: | ||
print ("WARNING: Inconsistent EOR information on CCDB (divergence between GRPECS and RCT) ... will take RCT one") | ||
EOR=rct["EOR"] | ||
if run_start is not None: | ||
print (f"INFO: GRPECS SOR ({SOR}) will be superseded by externally provided run start ({run_start})") | ||
SOR = run_start | ||
if run_end is not None: | ||
print (f"INFO: GRPECS EOR ({EOR}) will be superseded by externally provided run end ({run_end})") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above |
||
EOR = run_end | ||
|
||
# fetch orbit reset to calculate orbitFirst | ||
ts, oreset = ccdbreader.fetch("CTP/Calib/OrbitReset", "vector<Long64_t>", timestamp = SOR) | ||
|
@@ -319,7 +302,6 @@ def main(): | |
parser.add_argument("-tf", type=int, help="number of timeframes per job", default=1) | ||
parser.add_argument("--ccdb-IRate", type=bool, help="whether to try fetching IRate from CCDB/CTP", default=True) | ||
parser.add_argument("--trig-eff", type=float, dest="trig_eff", help="Trigger eff needed for IR", default=-1.0) | ||
parser.add_argument("--use-rct-info", dest="use_rct_info", action="store_true", help=argparse.SUPPRESS) # Use SOR and EOR information from RCT instead of SOX and EOX from CTPScalers | ||
parser.add_argument('forward', nargs=argparse.REMAINDER) # forward args passed to actual workflow creation | ||
args = parser.parse_args() | ||
|
||
|
@@ -329,34 +311,21 @@ def main(): | |
# make a CCDB accessor object | ||
ccdbreader = CCDBAccessor(args.ccdb_url) | ||
# fetch the EOR/SOR | ||
rct_sor_eor = retrieve_sor_eor(ccdbreader, args.run_number) # <-- from RCT/Info | ||
GLOparams = retrieve_params_fromGRPECS(ccdbreader, args.run_number, rct=rct_sor_eor) | ||
run_duration = ccdbreader.get_run_duration(args.run_number) | ||
run_start = run_duration.first | ||
run_end = run_duration.second | ||
|
||
GLOparams = retrieve_params_fromGRPECS(ccdbreader, args.run_number, run_start=run_start, run_end=run_end) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it needed to pass run_start and run_end here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, to override what would otherwise be deduced from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we simply not avoid to retrieve it from GRPECS now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We get the orbit info from that. I asked @shahor02 specifically via email if we should stick to that method and as far as I understand, that should be the way. So we need to process There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but you can avoid retrieving SOR and EOR, this is what I mean. They will not be consistent with RCT. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, that's fine with me. Let me update so that we will not use that info anymore. You are right, additional or somewhat redundant info should be omitted now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! This is what I meant. |
||
if not GLOparams: | ||
print ("No time info found") | ||
print ("ERROR: Could not retrieve information from GRPECS") | ||
sys.exit(1) | ||
|
||
ctp_scalers = retrieve_CTPScalers(ccdbreader, args.run_number) | ||
if ctp_scalers is None: | ||
print(f"ERROR: Cannot retrive scalers for run number {args.run_number}") | ||
exit (1) | ||
|
||
first_orbit = ctp_scalers.getOrbitLimit().first | ||
# SOR and EOR values in milliseconds | ||
sor = ctp_scalers.getTimeLimit().first | ||
eor = ctp_scalers.getTimeLimit().second | ||
|
||
if args.use_rct_info: | ||
first_orbit = GLOparams["FirstOrbit"] | ||
# SOR and EOR values in milliseconds | ||
sor = GLOparams["SOR"] | ||
eor = GLOparams["EOR"] | ||
|
||
# determine timestamp, and production offset for the final MC job to run | ||
timestamp, prod_offset = determine_timestamp(sor, eor, [args.split_id - 1, args.prod_split], args.cycle, args.tf, GLOparams["OrbitsPerTF"]) | ||
timestamp, prod_offset = determine_timestamp(run_start, run_end, [args.split_id - 1, args.prod_split], args.cycle, args.tf, GLOparams["OrbitsPerTF"]) | ||
|
||
# this is anchored to | ||
print ("Determined start-of-run to be: ", sor) | ||
print ("Determined end-of-run to be: ", eor) | ||
print ("Determined start-of-run to be: ", run_start) | ||
print ("Determined end-of-run to be: ", run_end) | ||
print ("Determined timestamp to be : ", timestamp) | ||
print ("Determined offset to be : ", prod_offset) | ||
|
||
|
@@ -399,7 +368,10 @@ def main(): | |
effTrigger = 28.0 # this is ZDC | ||
else: | ||
effTrigger = 0.759 | ||
|
||
ctp_scalers = retrieve_CTPScalers(ccdbreader, args.run_number) | ||
if ctp_scalers is None: | ||
print(f"ERROR: Cannot retrive scalers for run number {args.run_number}") | ||
exit (1) | ||
# time needs to be converted to seconds ==> timestamp / 1000 | ||
rate = retrieve_MinBias_CTPScaler_Rate(ctp_scalers, timestamp/1000., effTrigger, grplhcif.getBunchFilling().getNBunches(), ColSystem) | ||
|
||
|
@@ -415,8 +387,8 @@ def main(): | |
# we finally pass forward to the unanchored MC workflow creation | ||
# TODO: this needs to be done in a pythonic way clearly | ||
# NOTE: forwardargs can - in principle - contain some of the arguments that are appended here. However, the last passed argument wins, so they would be overwritten. | ||
forwardargs += " -tf " + str(args.tf) + " --sor " + str(sor) + " --timestamp " + str(timestamp) + " --production-offset " + str(prod_offset) + " -run " + str(args.run_number) + " --run-anchored --first-orbit " \ | ||
+ str(first_orbit) + " -field ccdb -bcPatternFile ccdb" + " --orbitsPerTF " + str(GLOparams["OrbitsPerTF"]) + " -col " + str(ColSystem) + " -eCM " + str(eCM) + ' --readoutDets ' + GLOparams['detList'] | ||
forwardargs += " -tf " + str(args.tf) + " --sor " + str(run_start) + " --timestamp " + str(timestamp) + " --production-offset " + str(prod_offset) + " -run " + str(args.run_number) + " --run-anchored --first-orbit " \ | ||
+ str(GLOparams["FirstOrbit"]) + " -field ccdb -bcPatternFile ccdb" + " --orbitsPerTF " + str(GLOparams["OrbitsPerTF"]) + " -col " + str(ColSystem) + " -eCM " + str(eCM) + ' --readoutDets ' + GLOparams['detList'] | ||
print ("forward args ", forwardargs) | ||
cmd = "${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py " + forwardargs | ||
print ("Creating time-anchored workflow...") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not anymore from GRPECS, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as seen by this function, the value from
GRPECS
will be overridden.We can simply do that silently. Or make the output more clear that all the messages at this stage come from processing the
GRPECS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, but isn't run_start and run_end from RCT? Why GRPECS is used at all to retrieve the SOR?