ATLAS Offline Software
GfexInputMonitorAlgorithm.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 GfexInput algorithm in the monitoring system.'''
6 
7  import math
8  # get the component factory - used for getting the algorithms
9  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
10  result = ComponentAccumulator()
11 
12  # use L1Calo's special MonitoringCfgHelper
13  from AthenaConfiguration.ComponentFactory import CompFactory
14  from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig import L1CaloMonitorCfgHelper
15  helper = L1CaloMonitorCfgHelper(flags,CompFactory.GfexInputMonitorAlgorithm,'GfexInputMonAlg')
16 
17  # add any steering
18  groupName = 'GfexInputMonitor' # the monitoring group name is also used for the package name
19  helper.alg.PackageName = groupName
20 
21  # mainDir = 'L1Calo'
22  trigPath = 'Developer/GfexInput/'
23 
24  # See if the file contains xTOBs else use TOBs
25  #hasXtobs = True if "L1_eFexTower" in inputFlags.Input.Collections else False
26  #if not hasXtobs:
27  # EfexInputMonAlg.eFexTowerContainer = "L1_eEMRoI"
28 
29  #tobStr = "TOB"
30 
31 
32  # histograms of gFex tower variables
33  helper.defineHistogram('NGfexTowers;h_nGfexTowers', title='Number of gFex towers',
34  fillGroup = groupName, type='TH1I', path=trigPath, xbins=500,xmin=0,xmax=5000)
35 
36  helper.defineHistogram('TowerEta;h_TowerEta', title='gFex Tower Eta',
37  fillGroup = groupName, type='TH1F', path=trigPath, xbins=100,xmin=-5.0,xmax=5.0)
38 
39  helper.defineHistogram('TowerPhi;h_TowerPhi', title='gFex Tower Phi',
40  fillGroup = groupName, type='TH1F', path=trigPath, xbins=66,xmin=-math.pi,xmax=math.pi)
41 
42  helper.defineHistogram('TowerEta,TowerPhi;h_TowerEtaPhiMap', title='gFex Tower Eta vs Phi',
43  fillGroup = groupName, type='TH2F',path=trigPath, xbins=100,xmin=-5.0,xmax=5.0,ybins=66,ymin=-math.pi,ymax=math.pi)
44 
45  helper.defineHistogram('TowerEtaindex;h_TowerEtaindex', title='gFex Tower Eta Index',
46  fillGroup = groupName, type='TH1F', path=trigPath, xbins=50,xmin=0.0,xmax=35.0)
47 
48  helper.defineHistogram('TowerPhiindex;h_TowerPhiindex', title='gFex Tower Phi Index',
49  fillGroup = groupName, type='TH1F', path=trigPath, xbins=64,xmin=0.0,xmax=32.0)
50 
51  helper.defineHistogram('TowerEtaindex,TowerPhiindex;h_TowerEtaPhiMapindex', title='gFex Tower Eta vs Phi index',
52  fillGroup = groupName, type='TH2F',path=trigPath, xbins=50,xmin=0.0,xmax=35.0,ybins=64,ymin=0,ymax=32.0)
53 
54  helper.defineHistogram('TowerFpga;h_TowerFpga', title='gFex Tower FPGA Number',
55  fillGroup = groupName, type='TH1F', path=trigPath, xbins=4,xmin=0,xmax=4.0)
56 
57  helper.defineHistogram('TowerEt;h_TowerEt', title='gFex Tower Et',
58  fillGroup = groupName, type='TH1F', path=trigPath, xbins=1000,xmin=0,xmax=1000.0)
59 
60  helper.defineHistogram('TowerSaturationflag;h_TowerSaturationflag', title='gFex Tower Saturation FLag',
61  fillGroup = groupName, type='TH1F', path=trigPath, xbins=2,xmin=0,xmax=2.0)
62 
63  acc = helper.result()
64  result.merge(acc)
65  return result
66 
67 
68 if __name__=='__main__':
69  # set input file and config options
70  from AthenaConfiguration.AllConfigFlags import initConfigFlags
71  import glob
72 
73  inputs = glob.glob('/eos/atlas/atlastier0/rucio/data18_13TeV/physics_Main/00354311/data18_13TeV.00354311.physics_Main.recon.ESD.f1129/data18_13TeV.00354311.physics_Main.recon.ESD.f1129._lb0013._SFO-8._0001.1')
74 
75  flags = initConfigFlags()
76  flags.Input.Files = inputs
77  flags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1_MC.root'
78 
79  flags.lock()
80  flags.dump() # print all the configs
81 
82  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
83  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
84  cfg = MainServicesCfg(flags)
85  cfg.merge(PoolReadCfg(flags))
86 
87  GfexInputMonitorCfg = GfexInputMonitoringConfig(flags)
88  cfg.merge(GfexInputMonitorCfg)
89 
90  # options - print all details of algorithms, very short summary
91  cfg.printConfig(withDetails=False, summariseProps = True)
92 
93  nevents=10
94  cfg.run(nevents)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
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:69