Skip to content

Commit

Permalink
Fix histograms for Gaudi v40 and add a configurable histogram
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Sep 20, 2024
1 parent 4836052 commit 9722a66
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
13 changes: 8 additions & 5 deletions k4FWCore/scripts/k4run
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,9 @@ def add_arguments(parser, app_mgr):
# skip public tools and the applicationmgr itself
if "ToolSvc" in conf.name() or "ApplicationMgr" in conf.name():
continue
props = (
conf.getPropertiesWithDescription()
) # dict propertyname: (propertyvalue, propertydescription)
# dict propertyname: (propertyvalue, propertydescription)
props = conf.getPropertiesWithDescription()
for prop in props:
# only add arguments for relevant properties
if (
prop in FILTER_GAUDI_PROPS
or "Audit" in prop
Expand Down Expand Up @@ -208,7 +206,12 @@ def main():
opts_dict = vars(opts)
for optionName, propTuple in option_db.items():
logger.info("Option name: %s %s %s", propTuple[1], optionName, opts_dict[optionName])
propTuple[0].setProp(propTuple[1].rsplit(".", 1)[1], opts_dict[optionName])
if "_Axis" in optionName:
propTuple[0].setProp(
propTuple[1].rsplit(".", 1)[1], tuple(x for x in opts_dict[optionName] if x != ())
)
else:
propTuple[0].setProp(propTuple[1].rsplit(".", 1)[1], opts_dict[optionName])

if opts.verbose:
from Gaudi.Configuration import VERBOSE
Expand Down
8 changes: 8 additions & 0 deletions test/k4FWCoreTest/options/ExampleFunctionalTransformerHist.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@
root_hist_svc = RootHistoSink("RootHistoSink")
root_hist_svc.FileName = "functional_transformer_hist.root"

try:
transformer1.CustomHistogram_Title = "Custom Title"
# Bins can be defined here
transformer1.CustomHistogram_Axis0 = (10, -5.0, 10.0, "X")
# Before Gaudi v40 there isn't a way to set the bins from python
except Exception:
pass


app = ApplicationMgr(
TopAlg=[producer1, producer2, transformer1, transformer2],
Expand Down

0 comments on commit 9722a66

Please sign in to comment.