The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
axes_labels Namespace Reference

Functions

 config ()
 
 check (causes, result)
 

Variables

str FILENAME = f"{__name__}.root"
 
str FILENAMEJSON = f"{__name__}.json"
 

Function Documentation

◆ check()

axes_labels.check ( causes,
result )

Definition at line 47 of file axes_labels.py.

47def check(causes, result):
48 result["root_output_file"] = FILENAME
49
50 if not os.path.exists(FILENAME):
51 causes.append("missing histogram file")
52 return False
53
54 try:
55 import ROOT
56
57 f = ROOT.TFile.Open(FILENAME)
58 h = f.Get("HistoAlgo/hist")
59 axis = h.GetXaxis()
60 labels = list(axis.GetLabels())
61 expected = ["a", "b", "c", "d", "e"]
62 if labels != expected:
63 causes.append("wrong axis labels")
64 result["expected_labels"] = ", ".join(repr(l) for l in expected)
65 result["found_labels"] = ", ".join(repr(l) for l in labels)
66 return False
67
68 except Exception:
69 causes.append("failure reading histogram file")
70 result["python_exception"] = result.Quote(format_exc())
71 return False
72
73 return True

◆ config()

axes_labels.config ( )

Definition at line 18 of file axes_labels.py.

18def config():
20 import GaudiConfig2.Configurables.Gaudi.Tests.Histograms.AxesLabels as T
21
22 algs = []
23 svcs = []
24
25 HistoAlgo = T.HistWithLabelsAlg
26 algs.append(HistoAlgo("HistoAlgo"))
27
28 svcs.append(C.Gaudi.Histograming.Sink.Root(FileName=FILENAME))
29 svcs.append(C.Gaudi.Monitoring.JSONSink(FileName=FILENAMEJSON))
30 svcs.append(C.Gaudi.Monitoring.MessageSvcSink())
31
32 yield from algs
33 yield from svcs
34
35 yield C.ApplicationMgr(
36 EvtMax=5,
37 EvtSel="NONE",
38 TopAlg=algs,
39 ExtSvc=svcs,
40 )
41
42 # make sure the histogram file is not already there
43 if os.path.exists(FILENAME):
44 os.remove(FILENAME)
45
46

Variable Documentation

◆ FILENAME

str axes_labels.FILENAME = f"{__name__}.root"

Definition at line 14 of file axes_labels.py.

◆ FILENAMEJSON

str axes_labels.FILENAMEJSON = f"{__name__}.json"

Definition at line 15 of file axes_labels.py.