From f99e0fbaaaa15fc46c8431ea5af2366812012655 Mon Sep 17 00:00:00 2001 From: Sandro Wenzel Date: Mon, 12 Feb 2024 14:12:11 +0100 Subject: [PATCH] Anchoring: Ability to get detector list from GRPECS (#1452) --- MC/bin/o2dpg_sim_workflow.py | 1 + MC/bin/o2dpg_sim_workflow_anchored.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/MC/bin/o2dpg_sim_workflow.py b/MC/bin/o2dpg_sim_workflow.py index 5f116bab5..aaf9f640a 100755 --- a/MC/bin/o2dpg_sim_workflow.py +++ b/MC/bin/o2dpg_sim_workflow.py @@ -59,6 +59,7 @@ parser.add_argument('-trigger',help='event selection: particle, external', default='') parser.add_argument('-ini',help='generator init parameters file (full paths required), for example: ${O2DPG_ROOT}/MC/config/PWGHF/ini/GeneratorHF.ini', default='') parser.add_argument('-confKey',help='generator or trigger configuration key values, for example: "GeneratorPythia8.config=pythia8.cfg;A.x=y"', default='') +parser.add_argument('--readoutDets',help='comma separated string of detectors readout (does not modify material budget - only hit creation)', default='all') parser.add_argument('-interactionRate',help='Interaction rate, used in digitization', default=-1) parser.add_argument('-bcPatternFile',help='Bunch crossing pattern file, used in digitization (a file name or "ccdb")', default='') diff --git a/MC/bin/o2dpg_sim_workflow_anchored.py b/MC/bin/o2dpg_sim_workflow_anchored.py index 1876e4877..a50a0532a 100755 --- a/MC/bin/o2dpg_sim_workflow_anchored.py +++ b/MC/bin/o2dpg_sim_workflow_anchored.py @@ -121,7 +121,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_sor_eor_fromGRPECS(ccdbreader, run_number, rct = None): +def retrieve_params_fromGRPECS(ccdbreader, run_number, rct = 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 @@ -191,8 +191,13 @@ def retrieve_sor_eor_fromGRPECS(ccdbreader, run_number, rct = None): print ("OrbitFirst", orbitFirst) # first orbit of this run print ("LastOrbit of run", orbitLast) + # Now fetch the detector list + print ("DetsReadout-Mask: ", grp["mDetsReadout"]['v']) + detList = o2.detectors.DetID.getNames(grp["mDetsReadout"]['v']) + print ("Detector list is ", detList) + # orbitReset.get(run_number) - return {"SOR": SOR, "EOR": EOR, "FirstOrbit" : orbitFirst, "LastOrbit" : orbitLast, "OrbitsPerTF" : int(grp["mNHBFPerTF"])} + return {"SOR": SOR, "EOR": EOR, "FirstOrbit" : orbitFirst, "LastOrbit" : orbitLast, "OrbitsPerTF" : int(grp["mNHBFPerTF"]), "detList" : detList} def retrieve_GRP(ccdbreader, timestamp): """ @@ -335,7 +340,7 @@ def main(): ccdbreader = CCDBAccessor(args.ccdb_url) # fetch the EOR/SOR rct_sor_eor = retrieve_sor_eor(ccdbreader, args.run_number) # <-- from RCT/Info - GLOparams = retrieve_sor_eor_fromGRPECS(ccdbreader, args.run_number, rct=rct_sor_eor) + GLOparams = retrieve_params_fromGRPECS(ccdbreader, args.run_number, rct=rct_sor_eor) if not GLOparams: print ("No time info found") sys.exit(1) @@ -419,7 +424,8 @@ def main(): # we finally pass forward to the unanchored MC workflow creation # TODO: this needs to be done in a pythonic way clearly - 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) + 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'] print ("forward args ", forwardargs) cmd = "${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py " + forwardargs print ("Creating time-anchored workflow...")