5 '''Function to configure LVL1 Efex simulation comparison algorithm in the monitoring system.'''
9 from AthenaConfiguration.ComponentFactory
import CompFactory
10 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
17 from LArBadChannelTool.LArBadChannelConfig
import LArMaskedSCCfg
21 from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig
import L1CaloMonitorCfgHelper
22 helper = L1CaloMonitorCfgHelper(flags,CompFactory.EfexSimMonitorAlgorithm,
'EfexSimMonAlg')
25 if not flags.Trigger.L1.doCaloInputs: helper.alg.eFexTowerContainer=
""
27 helper.defineDQAlgorithm(
"L1CaloMismatchRate",
28 hanConfig={
"libname":
"libdqm_summaries.so",
"name":
"Bins_GreaterThan_Threshold",
"BinThreshold":
"0.9"},
29 thresholdConfig={
"NBins":[0,10]},
32 helper.defineHistogram(
'EventType,Signature,tobMismatched;h_simSummary',title=
'Sim-HW Mismatches (percentage);Event Type;Signature',
33 fillGroup=
"mismatches",
34 path=
'Expert/Sim/detail',
35 hanConfig={
"display":
"SetPalette(87),Draw=COLZTEXT"},
37 xlabels=[
"DataTowers",
"EmulatedTowers"],
38 ymin=0,ymax=len(L1CaloMonitorCfgHelper.SIGNATURES),ylabels=L1CaloMonitorCfgHelper.SIGNATURES,
39 opt=[
'kCanRebin',
'kAlwaysCreate'],merge=
"merge")
40 helper.defineHistogram(
'LBN,Signature;h_mismatched_SimReady',
41 fillGroup=
"mismatches_count",
42 paths=[
'Shifter/Sim'],
43 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)"},
44 type=
'TH2I', cutmask=
'SimulationReady',
45 title=
'Mismatched Simulation-Ready Events;LB;Signature;Events',
46 xbins=1,xmin=0,xmax=1,
47 ylabels=[
"gJ",
"gLJ",
"jJ",
"jTAU",
"jXE",
"jTE",
"eTAU",
"eEM"],
48 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
49 helper.defineHistogram(
'LBN,Signature,tobMismatched;h_mismatched_SimReadyRate',
50 fillGroup=
"mismatches",
52 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)"},
53 type=
'TProfile2D', cutmask=
'SimulationReady',
54 title=
'Mismatched Rate for Simulation-Ready Signatures;LB;Signature;Event Rate (%)',
55 xbins=1,xmin=0,xmax=1,
56 ylabels=[
"gJ",
"gLJ",
"jJ",
"jTAU",
"jXE",
"jTE",
"eTAU",
"eEM"],
57 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
60 for sig
in [
"eEM",
"eTAU"]:
61 helper.defineHistogram(
"LBN,locIdx;h_"+sig+
"_mismatches_posLbnMap", title =
"Mismatched " + sig +
" [DataTower evts];LB;Position (Module:Proc:Eta:Phi);TOBs",
62 fillGroup = sig +
"_mismatches", cutmask=
'SimulationReady',
65 "algorithm":
"Histogram_Empty",
66 "display":
"SetPalette(87)",
67 "description":
"Location of mismatched " + sig +
" TOBs in simulation-ready events. Use this plot to identify any localized eFEX issues. N.B. this plot is only created if there are mismatches."},
69 xbins=1,xmin=0,xmax=1,
70 ybins=1,ymin=0,ymax=1,
71 opt=[
'kAddBinsDynamically'])
72 helper.defineHistogram(
'LBNString,Signature;h_mismatched_DataTowerEvts',
73 fillGroup=
"mismatches",
74 type=
'TH2I', cutmask=
'IsDataTowers',
75 title=
'Mismatched DataTower Events;LB:FirstEvtNum;Signature;Events',
76 xbins=1,xmin=0,xmax=1,
77 ybins=1,ymin=0,ymax=1,
78 opt=[
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
79 helper.defineHistogram(
'LBN,Signature;h_mismatched_EmulatedTowerEvts',
80 fillGroup=
"mismatches",
81 type=
'TH2I', cutmask=
'IsEmulatedTowers',
82 title=
'Mismatched EmulatedTower Events;LB;Signature;Events',
83 xbins=1,xmin=0,xmax=1,
84 ybins=1,ymin=0,ymax=1,
85 opt=[
'kCanRebin',
'kAlwaysCreate',
'kAddBinsDynamically'],merge=
'merge')
86 helper.defineTree(
'LBN,Signature,LBNString,EventNumber,EventType,timeSince,timeUntil,dataEtas,dataPhis,dataWord0s,simEtas,simPhis,simWord0s;mismatched',
87 "lbn/l:Signature/string:lbnString/string:eventNumber/l:EventType/string:timeSince/I:timeUntil/I:dataEtas/vector<float>:dataPhis/vector<float>:dataWord0s/vector<unsigned int>:simEtas/vector<float>:simPhis/vector<float>:simWord0s/vector<unsigned int>",
88 title=
"mismatched;LBN;Signature",fillGroup=
"mismatches")
91 result.merge(helper.result())
95 if __name__==
'__main__':
97 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
102 inputs = glob.glob(
'/eos/user/t/thompson/ATLAS/LVL1_mon/MC_ESD/l1calo.361024.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ4W.eFex_gFex_2022-01-13T2101.root')
104 flags.Input.Files = inputs
105 flags.Output.HISTFileName =
'ExampleMonitorOutput_LVL1_MC.root'
107 flags.Exec.MaxEvents=10
112 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
113 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
118 cfg.merge(EfexSimMonitorCfg)