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 
30  helper.defineHistogram('EventType,Signature,tobMismatched;h_simSummary',title='Sim-HW Mismatches (percentage);Event Type;Signature',
31  fillGroup="mismatches",
32  path='Expert/Sim/detail', # place summary plot in the detail path in Expert audience
33  hanConfig={"display":"SetPalette(87),Draw=COLZTEXT"},
34  type='TProfile2D', # would like TProfile2D but binning with labels doesn't work
35  xlabels=["DataTowers","EmulatedTowers"],
36  ymin=0,ymax=len(L1CaloMonitorCfgHelper.SIGNATURES),ylabels=L1CaloMonitorCfgHelper.SIGNATURES,
37  opt=['kCanRebin','kAlwaysCreate'],merge="merge")
38  helper.defineHistogram('LBN,Signature;h_mismatched_SimReady',
39  fillGroup="mismatches",
40  paths=['Shifter/Sim','Expert/Sim'],
41  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"},
42  type='TH2I', cutmask='SimulationReady',
43  title='Mismatched Simulation-Ready Events;LB;Signature;Events',
44  xbins=1,xmin=0,xmax=1,
45  ylabels=["gJ","gLJ","jJ","jTAU","jXE","jTE","eTAU","eEM"],
46  opt=['kAddBinsDynamically','kCanRebin','kAlwaysCreate'],merge='merge')
47  helper.defineHistogram('LBNString,Signature;h_mismatched_DataTowerEvts',
48  fillGroup="mismatches",
49  type='TH2I', cutmask='IsDataTowers',
50  title='Mismatched DataTower Events;LB:FirstEvtNum;Signature;Events',
51  xbins=1,xmin=0,xmax=1,
52  ybins=1,ymin=0,ymax=1,
53  opt=['kCanRebin','kAlwaysCreate'],merge='merge')
54  helper.defineHistogram('LBNString,Signature;h_mismatched_EmulatedTowerEvts',
55  fillGroup="mismatches",
56  type='TH2I', cutmask='IsEmulatedTowers',
57  title='Mismatched EmulatedTower Events;LB:FirstEvtNum;Signature;Events',
58  xbins=1,xmin=0,xmax=1,
59  ybins=1,ymin=0,ymax=1,
60  opt=['kCanRebin','kAlwaysCreate'],merge='merge')
61  helper.defineTree('LBNString,Signature,LBN,EventNumber,EventType,dataEtas,dataPhis,dataWord0s,simEtas,simPhis,simWord0s;mismatched',
62  "lbnString/string:Signature/string:lbn/l:eventNumber/l:EventType/string:dataEtas/vector<float>:dataPhis/vector<float>:dataWord0s/vector<unsigned int>:simEtas/vector<float>:simPhis/vector<float>:simWord0s/vector<unsigned int>",
63  title="mismatched;LBN;Signature",fillGroup="mismatches")
64 
65 
66  return helper.result()
67 
68 
69 if __name__=='__main__':
70  # set input file and config options
71  from AthenaConfiguration.AllConfigFlags import initConfigFlags
72  import glob
73 
74  import argparse
75  parser = argparse.ArgumentParser(prog='python -m TrigT1CaloMonitoring.JfexSimMonitorAlgorithm',
76  description="""Used to run jFEX Monitoring\n\n
77  Example: python -m TrigT1CaloMonitoring.JfexSimMonitorAlgorithm --filesInput file.root.\n
78  Overwrite inputs using standard athena opts --filesInput, evtMax etc. see athena --help""")
79  parser.add_argument('--evtMax',type=int,default=-1,help="number of events")
80  parser.add_argument('--filesInput',nargs='+',help="input files",required=True)
81  parser.add_argument('--skipEvents',type=int,default=0,help="number of events to skip")
82  args = parser.parse_args()
83 
84 
85  flags = initConfigFlags()
86  flags.Trigger.triggerConfig='DB'
87  flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)]
88  flags.Output.HISTFileName = 'jFexSimData_Monitoring.root'
89 
90  flags.Exec.MaxEvents = args.evtMax
91  flags.Exec.SkipEvents = args.skipEvents
92 
93  flags.lock()
94 
95  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
96  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
97  cfg = MainServicesCfg(flags)
98  cfg.merge(PoolReadCfg(flags))
99 
100  JfexSimMonitorCfg = JfexSimMonitoringConfig(flags)
101  cfg.merge(JfexSimMonitorCfg)
102 
103  from TrigT1CaloMonitoring.JfexInputMonitorAlgorithm import JfexInputMonitoringConfig
104  JfexInputMonitorCfg = JfexInputMonitoringConfig(flags)
105  cfg.merge(JfexInputMonitorCfg)
106 
107  cfg.run()
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
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