ATLAS Offline Software
JfexSimMonitorAlgorithm.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 #
5  '''Function to configure LVL1 Efex simulation comparison algorithm in the monitoring system.'''
6 
7  # use L1Calo's special MonitoringCfgHelper
8  from AthenaConfiguration.ComponentFactory import CompFactory
9  from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig import L1CaloMonitorCfgHelper
10  helper = L1CaloMonitorCfgHelper(flags,CompFactory.JfexSimMonitorAlgorithm,'JfexSimMonAlg')
11  JfexSimMonAlg = helper.alg
12 
13  doXtobs = False
14  if doXtobs:
15  JfexSimMonAlg.jFexSRJetRoIContainer = "L1_jFexSRJetxRoI"
16  JfexSimMonAlg.jFexLRJetRoIContainer = "L1_jFexLRJetxRoI"
17  JfexSimMonAlg.jFexTauRoIContainer = "L1_jFexTauxRoI"
18  JfexSimMonAlg.jFexFwdElRoIContainer = "L1_jFexFwdElxRoI"
19  JfexSimMonAlg.jFexMETRoIContainer = "L1_jFexMETxRoI"
20  JfexSimMonAlg.jFexSumETRoIContainer = "L1_jFexSumETxRoI"
21 
22  JfexSimMonAlg.jFexSRJetRoISimContainer = "L1_jFexSRJetxRoISim"
23  JfexSimMonAlg.jFexLRJetRoISimContainer = "L1_jFexLRJetxRoISim"
24  JfexSimMonAlg.jFexTauRoISimContainer = "L1_jFexTauxRoISim"
25  JfexSimMonAlg.jFexFwdElRoISimContainer = "L1_jFexFwdElxRoISim"
26  JfexSimMonAlg.jFexMETRoISimContainer = "L1_jFexMETxRoISim"
27  JfexSimMonAlg.jFexSumETRoISimContainer = "L1_jFexSumETxRoISim"
28 
29  helper.defineDQAlgorithm("L1CaloMismatchRate",
30  hanConfig={"libname":"libdqm_summaries.so","name":"Bins_GreaterThan_Threshold","BinThreshold":"0.9"}, # counts bins with value>0.9
31  thresholdConfig={"NBins":[0,10]}, # warn if any high rate, error if more than 10 bins anywhere.
32  )
33 
34  helper.defineHistogram('EventType,Signature,tobMismatched;h_simSummary',title='Sim-HW Mismatches (percentage);Event Type;Signature',
35  fillGroup="mismatches",
36  path='Expert/Sim/detail', # place summary plot in the detail path in Expert audience
37  hanConfig={"display":"SetPalette(87),Draw=COLZTEXT"},
38  type='TProfile2D',
39  xlabels=["DataTowers","EmulatedTowers"],
40  ymin=0,ymax=len(L1CaloMonitorCfgHelper.SIGNATURES),ylabels=L1CaloMonitorCfgHelper.SIGNATURES,
41  opt=['kCanRebin','kAlwaysCreate'],merge="merge")
42  helper.defineHistogram('LBN,Signature;h_mismatched_SimReady',
43  fillGroup="mismatches_count",
44  paths=['Shifter/Sim'],
45  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)"},
46  type='TH2I', cutmask='SimulationReady',
47  title='Mismatched Simulation-Ready Events;LB;Signature;Events',
48  xbins=1,xmin=0,xmax=1,
49  ylabels=["gJ","gLJ","jJ","jTAU","jXE","jTE","eTAU","eEM"],
50  opt=['kAddBinsDynamically','kCanRebin','kAlwaysCreate'],merge='merge')
51  helper.defineHistogram('LBN,Signature,tobMismatched;h_mismatched_SimReadyRate',
52  fillGroup="mismatches",
53  paths=['Expert/Sim'],
54  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)"},
55  type='TProfile2D', cutmask='SimulationReady',
56  title='Mismatched Rate for Simulation-Ready Signatures;LB;Signature;Event Rate (%)',
57  xbins=1,xmin=0,xmax=1,
58  ylabels=["gJ","gLJ","jJ","jTAU","jXE","jTE","eTAU","eEM"],
59  opt=['kAddBinsDynamically','kCanRebin','kAlwaysCreate'],merge='merge')
60  helper.defineHistogram('LBNString,Signature;h_mismatched_DataTowerEvts',
61  fillGroup="mismatches",
62  type='TH2I', cutmask='IsDataTowers',
63  title='Mismatched DataTower Events;LB:FirstEvtNum;Signature;Events',
64  xbins=1,xmin=0,xmax=1,
65  ybins=1,ymin=0,ymax=1,
66  opt=['kCanRebin','kAlwaysCreate'],merge='merge')
67  helper.defineHistogram('LBN,Signature;h_mismatched_EmulatedTowerEvts',
68  fillGroup="mismatches",
69  type='TH2I', cutmask='IsEmulatedTowers',
70  title='Mismatched EmulatedTower Events;LB;Signature;Events',
71  xbins=1,xmin=0,xmax=1,
72  ybins=1,ymin=0,ymax=1,
73  opt=['kCanRebin','kAlwaysCreate','kAddBinsDynamically'],merge='merge')
74  helper.defineTree('LBN,Signature,LBNString,EventNumber,EventType,dataEtas,dataPhis,dataWord0s,simEtas,simPhis,simWord0s;mismatched',
75  "lbn/l:Signature/string:lbnString/string:eventNumber/l:EventType/string:dataEtas/vector<float>:dataPhis/vector<float>:dataWord0s/vector<unsigned int>:simEtas/vector<float>:simPhis/vector<float>:simWord0s/vector<unsigned int>",
76  title="mismatched;LBN;Signature",fillGroup="mismatches")
77 
78 
79  return helper.result()
80 
81 
82 if __name__=='__main__':
83  # set input file and config options
84  from AthenaConfiguration.AllConfigFlags import initConfigFlags
85  import glob
86 
87  import argparse
88  parser = argparse.ArgumentParser(prog='python -m TrigT1CaloMonitoring.JfexSimMonitorAlgorithm',
89  description="""Used to run jFEX Monitoring\n\n
90  Example: python -m TrigT1CaloMonitoring.JfexSimMonitorAlgorithm --filesInput file.root.\n
91  Overwrite inputs using standard athena opts --filesInput, evtMax etc. see athena --help""")
92  parser.add_argument('--evtMax',type=int,default=-1,help="number of events")
93  parser.add_argument('--filesInput',nargs='+',help="input files",required=True)
94  parser.add_argument('--skipEvents',type=int,default=0,help="number of events to skip")
95  args = parser.parse_args()
96 
97 
98  flags = initConfigFlags()
99  flags.Trigger.triggerConfig='DB'
100  flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)]
101  flags.Output.HISTFileName = 'jFexSimData_Monitoring.root'
102 
103  flags.Exec.MaxEvents = args.evtMax
104  flags.Exec.SkipEvents = args.skipEvents
105 
106  flags.lock()
107 
108  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
109  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
110  cfg = MainServicesCfg(flags)
111  cfg.merge(PoolReadCfg(flags))
112 
113  JfexSimMonitorCfg = JfexSimMonitoringConfig(flags)
114  cfg.merge(JfexSimMonitorCfg)
115 
116  from TrigT1CaloMonitoring.JfexInputMonitorAlgorithm import JfexInputMonitoringConfig
117  JfexInputMonitorCfg = JfexInputMonitoringConfig(flags)
118  cfg.merge(JfexInputMonitorCfg)
119 
120  cfg.run()
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
JfexSimMonitorAlgorithm.JfexSimMonitoringConfig
def JfexSimMonitoringConfig(flags)
Definition: JfexSimMonitorAlgorithm.py:4
JfexInputMonitorAlgorithm.JfexInputMonitoringConfig
def JfexInputMonitoringConfig(flags)
Definition: JfexInputMonitorAlgorithm.py:4
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69