ATLAS Offline Software
L1CaloLegacyEDMMonitorAlgorithm.py
Go to the documentation of this file.
1 #!/usr/bin/env athena
2 #
3 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 #
6  '''Function to configure LVL1 L1CaloLegacyEDM algorithm in the monitoring system.'''
7 
8  #import math
9  #import numpy as np
10  # get the component factory - used for getting the algorithms
11  from AthenaConfiguration.ComponentFactory import CompFactory
12  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
13  result = ComponentAccumulator()
14 
15  # any things that need setting up for job e.g.
16 
17  # make the athena monitoring helper
18  from AthenaMonitoring import AthMonitorCfgHelper
19  helper = AthMonitorCfgHelper(inputFlags,'L1CaloLegacyEDMMonitoringCfg')
20 
21  # get any algorithms
22  L1CaloLegacyEDMMonAlg = helper.addAlgorithm(CompFactory.L1CaloLegacyEDMMonitorAlgorithm,'L1CaloLegacyEDMMonAlg')
23 
24  # add any steering
25  groupName = 'L1CaloLegacyEDMMonitor' # the monitoring group name is also used for the package name
26  L1CaloLegacyEDMMonAlg.PackageName = groupName
27 
28  mainDir = 'L1Calo'
29  trigPath = 'L1CaloLegacyEDM/'
30  inputPath = trigPath + '/Input/'
31  # add monitoring algorithm to group, with group name and main directory
32  myGroup = helper.addGroup(L1CaloLegacyEDMMonAlg, groupName , mainDir)
33 
34  # add run number plot
35  myGroup.defineHistogram('run',title='Run Number;run;Events', path=trigPath,xbins=1,xmin=-0.5, xmax=1.5, opt='kAddBinsDynamically', merge='merge')
36  #The LVL1EmTau Hists
37  myGroup.defineHistogram('LVL1EmTauRoIs_eta',title='EM Tau RoIs eta;EM Tau RoI #eta;Number of EM Tau RoIs', path=inputPath,xbins=100,xmin=-3.5,xmax=3.5)
38 
39  myGroup.defineHistogram('LVL1EmTauRoIs_phi',title='EM Tau RoIs eta;EM Tau RoI #phi;Number of EM Tau RoIs', path=inputPath,xbins=100,xmin=-3.5,xmax=3.5)
40 
41  myGroup.defineHistogram('LVL1EmTauRoIs_core',title='EM Tau Core Energy;EM Tau Core Energy [GeV];Number of EM Tau RoIs', path=inputPath,xbins=20,xmin=0,xmax=100)
42 
43  myGroup.defineHistogram('LVL1EmTauRoIs_emClus',title='EM Cluster Energy;EM Cluster Energy [GeV];Number of EM Tau RoIs', path=inputPath,xbins=20,xmin=0,xmax=100)
44 
45  myGroup.defineHistogram('LVL1EmTauRoIs_tauClus',title='Hadronic Isolation Sum;Hadronic Isolation Sum [GeV];Number of EM Tau RoIs',path=inputPath,xbins=20,xmin=0,xmax=10)
46 
47  myGroup.defineHistogram('LVL1EmTauRoIs_hadIsol',title='EM Isolation Sum;EM Isolation Sum [GeV];Number of EM Tau RoIs', path=inputPath,xbins=20,xmin=0,xmax=10)
48 
49  myGroup.defineHistogram('LVL1EmTauRoIs_emIsol',title='Hadronic Core ;EM Isolation Sum;EM Isolation Sum [GeV];Number of EM Tau RoIs',path=inputPath,xbins=20,xmin=0,xmax=20)
50 
51  myGroup.defineHistogram('LVL1EmTauRoIs_hadCore',title='Hadronic Core ;Hadronic Core [GeV];Number of EM Tau RoIs', path=inputPath,xbins=40,xmin=0,xmax=20)
52 
53  myGroup.defineHistogram('LVL1EmTauRoIs_thrPattern',title='LVL1EmTauRoIs_thrPattern', path=inputPath,xbins=20,xmin=0,xmax=100000)
54 
55  #The LVL1Jet Hists
56 
57  etabins_1d = [-4.9,-3.2,-2.9,-2.7,-2.4,-2.2,-2.0,-1.8,
58  -1.6,-1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,
59  0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,
60  2.0,2.2,2.4,2.7,2.9,3.2,4.9]
61  eta_bins = {
62  'xbins': etabins_1d
63  }
64 
65  myGroup.defineHistogram('LVL1JetRoIs_eta',title='Jet RoIs eta;Jet RoI #eta;Number of Jet RoIs', path=inputPath,type='TH1F',**eta_bins)
66 
67  myGroup.defineHistogram('LVL1JetRoIs_phi',title='Jet RoIs phi;Jet RoI #phi;Number of Jet RoIs', path=inputPath,xbins=100,xmin=-3.5,xmax=3.5)
68 
69  myGroup.defineHistogram('LVL1JetRoIs_et4x4',title='Jet RoIs ET 4x4;Jet ET 4x4 [GeV]; Number of Jet RoIs', path=inputPath,xbins=100,xmin=0,xmax=500)
70 
71  myGroup.defineHistogram('LVL1JetRoIs_et8x8',title='Jet RoIs ET 8x8;Jet ET 8x8 [GeV]; Number of Jet RoIs', path=inputPath,xbins=100,xmin=0,xmax=500)
72 
73  #The EnergySum Hists
74  myGroup.defineHistogram('LVL1EnergySumRoI_energyT',title='Energy Sum RoI energyT;Energy Sum RoI energyT [GeV];Number of Energy Sum RoIs', path=inputPath,xbins=100,xmin=0,xmax=1000)
75 
76  myGroup.defineHistogram('LVL1EnergySumRoI_energyX',title='Energy Sum RoI energyX;Energy Sum RoI energyX [GeV];Number of Energy Sum RoIs', path=inputPath,xbins=100,xmin=-500,xmax=500)
77 
78  myGroup.defineHistogram('LVL1EnergySumRoI_energyY',title='Energy Sum RoI energyY;Energy Sum RoI energyY [GeV];Number of Energy Sum RoIs', path=inputPath,xbins=100,xmin=-500,xmax=500)
79 
80  acc = helper.result()
81  result.merge(acc)
82  return result
83 
84 
85 if __name__=='__main__':
86  # set input file and config options
87  from AthenaConfiguration.AllConfigFlags import initConfigFlags
88  import glob
89 
90  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')
91 
92  flags = initConfigFlags()
93  flags.Input.Files = inputs
94  flags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1.root'
95 
96  flags.lock()
97  flags.dump() # print all the configs
98 
99  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
100  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
101  cfg = MainServicesCfg(flags)
102  cfg.merge(PoolReadCfg(flags))
103 
104  L1CaloLegacyEDMMonitorCfg = L1CaloLegacyEDMMonitoringConfig(flags)
105  cfg.merge(L1CaloLegacyEDMMonitorCfg)
106 
107  # options - print all details of algorithms, very short summary
108  cfg.printConfig(withDetails=False, summariseProps = True)
109 
110  nevents=-1
111  cfg.run(nevents)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
L1CaloLegacyEDMMonitorAlgorithm.L1CaloLegacyEDMMonitoringConfig
def L1CaloLegacyEDMMonitoringConfig(inputFlags)
Definition: L1CaloLegacyEDMMonitorAlgorithm.py:5
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69