Skip to content

Commit

Permalink
Anchoring: Ability to get detector list from GRPECS (#1452)
Browse files Browse the repository at this point in the history
  • Loading branch information
sawenzel authored Feb 12, 2024
1 parent e17e279 commit f99e0fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions MC/bin/o2dpg_sim_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='')
Expand Down
14 changes: 10 additions & 4 deletions MC/bin/o2dpg_sim_workflow_anchored.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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...")
Expand Down

0 comments on commit f99e0fb

Please sign in to comment.