ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloCTPMonitorAlgorithm.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
5 '''Function to configure LVL1 L1CaloCTP algorithm in the monitoring system.'''
6
7 #import math
8 # get the component factory - used for getting the algorithms
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11 result = ComponentAccumulator()
12
13 # any things that need setting up for job e.g.
14 #from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg
15 #result.merge(AtlasGeometryCfg(flags))
16
17 # make the athena monitoring helper
18 from AthenaMonitoring import AthMonitorCfgHelper
19 helper = AthMonitorCfgHelper(flags,'L1CaloCTPMonitoringCfg')
20
21 # get any algorithms
22 L1CaloCTPMonAlg = helper.addAlgorithm(CompFactory.L1CaloCTPMonitorAlgorithm,'L1CaloCTPMonAlg')
23
24 # add any steering
25 groupName = 'L1CaloCTPMonitor' # the monitoring group name is also used for the package name
26 L1CaloCTPMonAlg.PackageName = groupName
27
28 mainDir = 'LVL1_Interfaces'
29 trigPath = 'CTP/'
30
31 # add monitoring algorithm to group, with group name and main directory
32 myGroup = helper.addGroup(L1CaloCTPMonAlg, groupName , mainDir)
33
34 multiplicity_labels = ['EM1', 'EM2', 'Tau1', 'Tau2', 'Jet1 (3-bit)', 'Jet2 (2-bit)', 'TE (full eta)', 'XE (full eta)', 'XS', 'TE (restr. eta)', 'XE (restr. eta)']
35
36 # add run number plot
37 myGroup.defineHistogram('run',title='Run Number;run;Events',
38 path=trigPath,xbins=1000000,xmin=-0.5,xmax=999999.5)
39
40 myGroup.defineHistogram('ctp_1d_L1CaloNeCTPSummary;h_ctp_1d_L1CaloNeCTPSummary', title='L1Calo Ne CTP',
41 type='TH1F', path=trigPath, xlabels=multiplicity_labels, xbins=len(multiplicity_labels),xmin=0,xmax=len(multiplicity_labels))
42
43 myGroup.defineHistogram('ctp_1d_L1CaloEqCTPSummary;h_ctp_1d_L1CaloEqCTPSummary', title='L1Calo Eq CTP',
44 type='TH1F', path=trigPath, xlabels=multiplicity_labels, xbins=len(multiplicity_labels),xmin=0,xmax=len(multiplicity_labels))
45
46 myGroup.defineHistogram('ctp_1d_TIPMatches;h_ctp_1d_TIPMatches', title='TIP Matches',
47 type='TH1F', path=trigPath, xbins=512,xmin=0.0,xmax=512.0)
48
49 myGroup.defineHistogram('ctp_1d_HitNoTIPMismatch;h_ctp_1d_HitNoTIPMismatch', title='Hit No TIP Mismatches',
50 type='TH1F', path=trigPath, xbins=512,xmin=0.0,xmax=512.0)
51
52 myGroup.defineHistogram('ctp_1d_TIPNoHitMismatch;h_ctp_1d_TIPNoHitMismatch', title='TIP No Hit Mismatches',
53 type='TH1F', path=trigPath, xbins=512,xmin=0.0,xmax=512.0)
54
55
56 acc = helper.result()
57 result.merge(acc)
58 return result
59
60
61if __name__=='__main__':
62 # set debug level for whole job
63 from AthenaCommon.Logging import log
64 from AthenaCommon.Constants import INFO #DEBUG
65 log.setLevel(INFO)
66
67 # set input file and config options
68 from AthenaConfiguration.AllConfigFlags import initConfigFlags
69 import glob
70
71 #inputs = glob.glob('/eos/atlas/atlastier0/rucio/data18_13TeV/physics_Main/00357750/data18_13TeV.00357750.physics_Main.recon.ESD.f1072/data18_13TeV.00357750.physics_Main.recon.ESD.f1072._lb0117._SFO-1._0201.1')
72 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')
73
74 flags = initConfigFlags()
75 flags.Input.Files = inputs
76 flags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1.root'
77
78 flags.lock()
79 flags.dump() # print all the configs
80
81 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
82 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
83 cfg = MainServicesCfg(flags)
84 cfg.merge(PoolReadCfg(flags))
85
86 L1CaloCTPMonitorCfg = L1CaloCTPMonitoringConfig(flags)
87 cfg.merge(L1CaloCTPMonitorCfg)
88
89 # message level for algorithm
90 L1CaloCTPMonitorCfg.getEventAlgo('L1CaloCTPMonAlg').OutputLevel = 2 # 1/2 INFO/DEBUG
91 # options - print all details of algorithms, very short summary
92 cfg.printConfig(withDetails=False, summariseProps = True)
93
94 nevents=10
95 cfg.run(nevents)