ATLAS Offline Software
Loading...
Searching...
No Matches
TrigTRTMonitoring.py
Go to the documentation of this file.
2# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3#
4"""
5@brief Configuration for the heavy-ion part of MinBias monitoring
6"""
7
8from .utils import getMinBiasChains
9from AthenaCommon.Logging import logging
10
11log = logging.getLogger('TrigTRTMonitoring')
12
13
14def TrigTRTMonCfg(flags):
15 from AthenaMonitoring import AthMonitorCfgHelper
16 monConfig = AthMonitorCfgHelper(flags, 'TRTMonitoring')
17
18 from AthenaConfiguration.ComponentFactory import CompFactory
19 alg = monConfig.addAlgorithm(CompFactory.TRTMonitoringAlg, 'TRTMonitoringAlg')
20
21 from InDetTrackSelectionTool.InDetTrackSelectionToolConfig import (
22 InDetTrackSelectionTool_LoosePrimary_Cfg)
23 trkSel = monConfig.resobj.popToolsAndMerge(InDetTrackSelectionTool_LoosePrimary_Cfg(flags))
24 alg.TrackSelectionTool = trkSel
25
26 from TrigConfigSvc.TriggerConfigAccess import getHLTMonitoringAccess
27 monAccess = getHLTMonitoringAccess(flags)
28 chains = getMinBiasChains(monAccess, 'HLT_noalg_L1TRT_FILLED|HLT_mb_excl_1trk5_pt1_hi_FgapAC5_L1TRT_VjTE20|HLT_noalg_L1TRT_VjTE50')
29
30 ref_chains = ['HLT_mb_sptrk_L1ZDC_XOR_VjTE200', 'HLT_mb_sptrk_L1ZDC_1XOR5_VjTE200', 'HLT_mb_sptrk_L11ZDC_A_1ZDC_C_VjTE200'
31 'HLT_mb_sptrk_hi_FgapC5_L1VjTE200', 'HLT_mb_sptrk_hi_FgapA5_L1VjTE200', 'HLT_noalg_L1RD0_FILLED', 'HLT_mb_sptrk_L1VjTE50']
32
33 log.info(f'Monitoring {len(chains)} L1TRT chain(s)')
34 log.debug([name for name, _ in chains])
35
36 alg.triggerList = [name for name, _ in chains]
37 alg.refTriggerList = ref_chains
38
39 for chain, group in chains:
40 hiTRTGroup = monConfig.addGroup(alg, f'{chain}', topPath=f'HLT/MinBiasMon/{group}/L1TRT/{chain}/')
41
42 # 1D histograms
43 hiTRTGroup.defineHistogram('n_trk', title='Track multiplicity;N_{trk};Events / 1', xbins=20, xmin=-0.5, xmax=19.5)
44 hiTRTGroup.defineHistogram('lead_trk_pT', title='Leading track p_{T};p_{T}^{lead} [GeV];Events / 100 MeV', xbins=40, xmin=0, xmax=4)
45
46 # TEfficiency
47 hiTRTGroup.defineHistogram(f'effPassed,n_trk;{chain}_eff_ntrk', type='TEfficiency',
48 title='L1 TRT efficiency;N_{trk};Efficiency', xbins=20, xmin=-0.5, xmax=19.5)
49 hiTRTGroup.defineHistogram(f'effPassed,lead_trk_pT;{chain}_eff_pT', type='TEfficiency',
50 title='L1 TRT efficiency;p_{T}^{lead} [GeV];Efficiency', xbins=40, xmin=0, xmax=4)
51
52 return monConfig.result()
53
54
55if __name__ == "__main__":
56 # Set the Athena configuration flags
57 from AthenaConfiguration.AllConfigFlags import initConfigFlags
58 flags = initConfigFlags()
59 flags.DQ.Environment = "AOD"
60 flags.Concurrency.NumConcurrentEvents = 5
61
62 flags.Output.HISTFileName = "TestTRTMonitorOutput.root"
63 flags.fillFromArgs()
64 from AthenaCommon.Logging import logging
65 log = logging.getLogger(__name__)
66 log.info("Input %s", str(flags.Input.Files))
67 flags.lock()
68
69 # Initialize configuration object, add accumulator, merge, and run.
70 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
71 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
72
73 cfg = MainServicesCfg(flags)
74
75 cfg.merge(PoolReadCfg(flags))
76 cfg.merge(TrigTRTMonCfg(flags))
77
78 from AthenaCommon.Constants import DEBUG
79 cfg.getEventAlgo("TRTMonitoringAlg").OutputLevel = DEBUG
80 cfg.printConfig(withDetails=True)
81 with open("cfg.pkl", "wb") as f:
82 cfg.store(f)
83
84 cfg.run()
85 # to run:
86 # python -m TrigMinBiasMonitoring.TrigTRTMonitoring --filesInput=...