5 '''Function to configure LVL1 Gfex simulation comparison algorithm in the monitoring system.'''
8 from AthenaConfiguration.ComponentFactory
import CompFactory
9 from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig
import L1CaloMonitorCfgHelper
10 helper = L1CaloMonitorCfgHelper(flags,CompFactory.GfexSimMonitorAlgorithm,
'GfexSimMonAlg')
12 helper.defineDQAlgorithm(
"L1CaloMismatchRate",
13 hanConfig={
"libname":
"libdqm_summaries.so",
"name":
"Bins_GreaterThan_Threshold",
"BinThreshold":
"0.9"},
14 thresholdConfig={
"NBins":[0,10]},
17 helper.defineHistogram(
'LBN,Signature;h_mismatched_SimReady',
18 fillGroup=
"mismatches_count",
19 paths=[
'Shifter/Sim'],
20 hanConfig={
"algorithm":
"Histogram_Empty",
"description":
"Number of events with a mismatch, per LB (x-axis), per signature (y-axis) for signatures that are deemed simulation-ready",
"display":
"SetPalette(55)"},
21 type=
'TH2I', cutmask=
'SimulationReady',
22 title=
'Mismatched Simulation-Ready Events;LB;Signature;Events',
23 xbins=1,xmin=0,xmax=1,
24 ylabels=[
"gJ",
"gLJ",
"jJ",
"jTAU",
"jXE",
"jTE",
"eTAU",
"eEM"],
25 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
26 helper.defineHistogram(
'LBN,Signature,tobMismatched;h_mismatched_SimReadyRate',
27 fillGroup=
"mismatches",
29 hanConfig={
"algorithm":
"L1CaloMismatchRate",
"description":
"Mismatch rate, per LB (x-axis), per signature (y-axis) for signatures that are deemed simulation-ready - should not be high rate (see DQ algo)",
"display":
"SetPalette(55)"},
30 type=
'TProfile2D', cutmask=
'SimulationReady',
31 title=
'Mismatched Rate for Simulation-Ready Signatures;LB;Signature;Event Rate (%)',
32 xbins=1,xmin=0,xmax=1,
33 ylabels=[
"gJ",
"gLJ",
"jJ",
"jTAU",
"jXE",
"jTE",
"eTAU",
"eEM"],
34 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
35 helper.defineHistogram(
'EventType,Signature,tobMismatched;h_simSummary',title=
'Sim-HW Mismatches (percentage);Event Type;Signature',
36 fillGroup=
"mismatches",
37 path=
'Expert/Sim/detail',
38 hanConfig={
"display":
"SetPalette(87),Draw=COLZTEXT"},
40 xlabels=[
"DataTowers",
"EmulatedTowers"],
41 ymin=0,ymax=len(L1CaloMonitorCfgHelper.SIGNATURES),ylabels=L1CaloMonitorCfgHelper.SIGNATURES,
42 opt=[
'kCanRebin',
'kAlwaysCreate'],merge=
"merge")
44 for sig
in [
"gJ",
"gLJ"]:
45 helper.defineHistogram(
"LBN,locIdx;h_"+sig+
"_mismatches_posLbnMap", title =
"Mismatched " + sig +
" [DataTower evts];LB;Position (iEta:iPhi);TOBs",
46 fillGroup =
"mismatches"+ sig,
48 path=
"Expert/Sim/detail",
50 "display":
"SetPalette(87)",
51 "description":
"Location of mismatched " + sig +
" TOBs. Use this plot to identify any localized gFEX issues. N.B. this plot is only created if there are mismatches."},
52 xbins=1,xmin=0,xmax=1,
53 ybins=1,ymin=0,ymax=1,
54 opt=[
'kAddBinsDynamically'])
57 helper.defineTree(
'LBN,Signature,LBNString,EventNumber,dataEtas,dataPhis,dataWord0s,simEtas,simPhis,simWord0s;mismatched',
58 "lbn/l:Signature/string:lbnString/string:eventNumber/l:dataEtas/vector<float>:dataPhis/vector<float>:dataWord0s/vector<unsigned int>:simEtas/vector<float>:simPhis/vector<float>:simWord0s/vector<unsigned int>",
59 title=
"mismatched;LBN;Signature",fillGroup=
"mismatches")
61 return helper.result()
64 if __name__==
'__main__':
66 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
70 parser = argparse.ArgumentParser(prog=
'python -m TrigT1CaloMonitoring.GfexSimMonitorAlgorithm',
71 description=
"""Used to run gFEX Monitoring\n\n
72 Example: python -m TrigT1CaloMonitoring.GfexSimMonitorAlgorithm --filesInput file.root.\n
73 Overwrite inputs using standard athena opts --filesInput, evtMax etc. see athena --help""")
74 parser.add_argument(
'--evtMax',type=int,default=-1,help=
"number of events")
75 parser.add_argument(
'--filesInput',nargs=
'+',help=
"input files",required=
True)
76 parser.add_argument(
'--skipEvents',type=int,default=0,help=
"number of events to skip")
77 args = parser.parse_args()
81 flags.Trigger.triggerConfig=
'DB'
82 flags.Input.Files = [file
for x
in args.filesInput
for file
in glob.glob(x)]
83 flags.Output.HISTFileName =
'gFexSimData_Monitoring.root'
85 flags.Exec.MaxEvents = args.evtMax
86 flags.Exec.SkipEvents = args.skipEvents
90 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
91 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
96 cfg.merge(GfexSimMonitorCfg)
98 from TrigT1CaloMonitoring.GfexInputMonitorAlgorithm
import GfexInputMonitoringConfig
100 cfg.merge(GfexInputMonitorCfg)