ATLAS Offline Software
GfexSimMonitorAlgorithm.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 #
4 def GfexSimMonitoringConfig(flags, UseOfflineCopy = True):
5  '''Function to configure LVL1 Gfex 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.GfexSimMonitorAlgorithm,'GfexSimMonAlg')
11 
12  helper.defineDQAlgorithm("L1CaloMismatchRate",
13  hanConfig={"libname":"libdqm_summaries.so","name":"Bins_GreaterThan_Threshold","BinThreshold":"0.9"}, # counts bins with value>0.9
14  thresholdConfig={"NBins":[0,10]}, # warn if any high rate, error if more than 10 bins anywhere.
15  )
16 
17  helper.defineHistogram('LBN,Signature;h_mismatched_SimReady',
18  fillGroup="mismatches",
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='SimulationReadyMismatch',
22  title='Mismatched Simulation-Ready Events;LB;Signature;Events',
23  xbins=1,xmin=0,xmax=1,
24  ylabels=["gJ","gLJ","jJ","jTAU","jEM","jXE","jTE","eTAU","eEM"],
25  opt=['kAddBinsDynamically','kCanRebin','kAlwaysCreate'],merge='merge')
26  helper.defineHistogram('LBN,Signature,tobMismatched;h_mismatched_SimReadyRate',
27  fillGroup="mismatches",
28  paths=['Expert/Sim'],
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","jEM","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', # place summary plot in the detail path in Expert audience
38  hanConfig={"display":"SetPalette(87),Draw=COLZTEXT"},
39  type='TProfile2D',
40  xlabels=["DataTowers","EmulatedTowers"],
41  ymin=0,ymax=len(L1CaloMonitorCfgHelper.SIGNATURES),ylabels=L1CaloMonitorCfgHelper.SIGNATURES,
42  opt=['kCanRebin','kAlwaysCreate'],merge="merge")
43 
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,
47  type="TH2I",
48  path="Expert/Sim/detail",
49  hanConfig={
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'])
55 
56 
57  helper.defineTree('LBN,Signature,LBNString,L1ID,EventNumber,dataEtas,dataPhis,dataEts,dataWord0s,simEtas,simPhis,simEts,simWord0s;mismatched_jet',
58  "lbn/l:Signature/string:lbnString/string:L1ID/i:eventNumber/l:dataEtas/vector<float>:dataPhis/vector<float>:dataEts/vector<int>:dataWord0s/vector<unsigned int>:simEtas/vector<float>:simPhis/vector<float>:simEts/vector<int>:simWord0s/vector<unsigned int>",
59  title="mismatched;LBN;Signature",fillGroup="mismatches")
60 
61  helper.defineTree('LBN,Signature,LBNString,L1ID,EventNumber,dataTOB1,dataTOB2,dataWord0s,simTOB1,simTOB2,simWord0s;mismatched_global',
62  "lbn/l:Signature/string:lbnString/string:L1ID/i:eventNumber/l:dataTOB1/vector<float>:dataTOB2/vector<float>:dataWord0s/vector<unsigned int>:simTOB1/vector<float>:simTOB2/vector<float>:simWord0s/vector<unsigned int>",
63  title="mismatched;LBN;Signature",fillGroup="mismatches")
64 
65 
66 
67  return helper.result()
68 
69 
70 if __name__=='__main__':
71  # set input file and config options
72  from AthenaConfiguration.AllConfigFlags import initConfigFlags
73  import glob
74 
75  import argparse
76  parser = argparse.ArgumentParser(prog='python -m TrigT1CaloMonitoring.GfexSimMonitorAlgorithm',
77  description="""Used to run gFEX Monitoring\n\n
78  Example: python -m TrigT1CaloMonitoring.GfexSimMonitorAlgorithm --filesInput file.root.\n
79  Overwrite inputs using standard athena opts --filesInput, evtMax etc. see athena --help""")
80  parser.add_argument('--evtMax',type=int,default=-1,help="number of events")
81  parser.add_argument('--filesInput',nargs='+',help="input files",required=True)
82  parser.add_argument('--skipEvents',type=int,default=0,help="number of events to skip")
83  args = parser.parse_args()
84 
85 
86  flags = initConfigFlags()
87  flags.Trigger.triggerConfig='DB'
88  flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)]
89  flags.Output.HISTFileName = 'gFexSimData_Monitoring.root'
90 
91  flags.Exec.MaxEvents = args.evtMax
92  flags.Exec.SkipEvents = args.skipEvents
93 
94  flags.lock()
95 
96  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
97  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
98  cfg = MainServicesCfg(flags)
99  cfg.merge(PoolReadCfg(flags))
100 
101  GfexSimMonitorCfg = GfexSimMonitoringConfig(flags)
102  cfg.merge(GfexSimMonitorCfg)
103 
104  from TrigT1CaloMonitoring.GfexInputMonitorAlgorithm import GfexInputMonitoringConfig
105  GfexInputMonitorCfg = GfexInputMonitoringConfig(flags)
106  cfg.merge(GfexInputMonitorCfg)
107 
108  cfg.run()
GfexSimMonitorAlgorithm.GfexSimMonitoringConfig
def GfexSimMonitoringConfig(flags, UseOfflineCopy=True)
Definition: GfexSimMonitorAlgorithm.py:4
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:312
GfexInputMonitorAlgorithm.GfexInputMonitoringConfig
def GfexInputMonitoringConfig(flags)
Definition: GfexInputMonitorAlgorithm.py:4
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:71