ATLAS Offline Software
Loading...
Searching...
No Matches
L0MuonSmearingConfig.py
Go to the documentation of this file.
1#Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2from AthenaConfiguration.ComponentFactory import CompFactory
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4
5from AthenaCommon.Logging import logging
6_log = logging.getLogger(__name__)
7
8def L0MuonSmearingCfg(flags, name = "L0MuonSmearingAlg", **kwargs):
9
10 result = ComponentAccumulator()
11
12 alg = CompFactory.L0Muon.L0MuonSmearingAlg(name = name,
13 **kwargs)
14
15 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
16 monTool = GenericMonitoringTool(flags, 'MonTool')
17 monTool.defineHistogram('track_input_eta', path='EXPERT', type='TH1F', title=';#eta_{#mu}^{truth};Muons', xbins=50, xmin=-3, xmax=3)
18 monTool.defineHistogram('track_input_phi', path='EXPERT', type='TH1F', title=';#phi_{#mu}^{truth};Muons', xbins=50, xmin=-4, xmax=4)
19 monTool.defineHistogram('track_input_pt', path='EXPERT', type='TH1F', title=';p_{T,#mu}^{truth} (GeV);Muons', xbins=50, xmin=0, xmax=250)
20 monTool.defineHistogram('track_input_curv',path='EXPERT', type='TH1F', title=';q/p_{T,#mu}^{truth} (1/GeV);Muons', xbins=50, xmin=-0.4, xmax=0.4)
21 monTool.defineHistogram('track_output_eta', path='EXPERT', type='TH1F', title=';#eta_{#mu}^{L0};Muons', xbins=50, xmin=-3, xmax=3)
22 monTool.defineHistogram('track_output_phi', path='EXPERT', type='TH1F', title=';#phi_{#mu}^{L0};Muons', xbins=50, xmin=-4, xmax=4)
23 monTool.defineHistogram('track_output_pt', path='EXPERT', type='TH1F', title=';p_{T,#mu}^{L0} (GeV);Muons', xbins=50, xmin=0, xmax=250)
24 monTool.defineHistogram('track_output_curv',path='EXPERT', type='TH1F', title=';q/p_{T,#mu}^{L0} (1/GeV);Muons', xbins=50, xmin=-0.4, xmax=0.4)
25 monTool.defineHistogram('roi_output_eta', path='EXPERT', type='TH1F', title=';#eta_{RoI}^{L0};RoIs', xbins=50, xmin=-3, xmax=3)
26 monTool.defineHistogram('roi_output_phi', path='EXPERT', type='TH1F', title=';#phi_{RoI}^{L0};RoIs', xbins=50, xmin=-4, xmax=4)
27 monTool.defineHistogram('roi_output_pt', path='EXPERT', type='TH1F', title=';p_{T,RoI}^{L0} (GeV);RoIs', xbins=64, xmin=0, xmax=128.0)
28 monTool.defineHistogram('roi_output_curv',path='EXPERT', type='TH1F', title=';q/p_{T,RoI}^{L0} (1/GeV);RoIs', xbins=50, xmin=-0.4, xmax=0.4)
29 monTool.defineHistogram('delta_eta', path='EXPERT', type='TH1F', title=';#eta_{RoI}^{L0}-#eta_{#mu}^{truth};', xbins=50, xmin=-0.005,xmax=0.005)
30 monTool.defineHistogram('delta_phi', path='EXPERT', type='TH1F', title=';#phi_{RoI}^{L0}-#phi_{#mu}^{truth};', xbins=50, xmin=-0.1,xmax=0.1)
31 monTool.defineHistogram('delta_pt', path='EXPERT', type='TH1F', title=';(p_{T}^{L0}-p_{T}^{truth})/p_{T}^{truth};', xbins=50, xmin=-1,xmax=1)
32 monTool.defineHistogram('delta_curv',path='EXPERT', type='TH1F', title=';((q/p_{T})^{L0} - (q/p_{T})^{truth}) / (q/p_{T})^{truth}',xbins=50,xmin=-1,xmax=1)
33
34 alg.MonTool = monTool
35
36 from TriggerJobOpts.TriggerHistSvcConfig import TriggerHistSvcConfig
37 result.merge(TriggerHistSvcConfig(flags))
38
39 result.addEventAlgo(alg)
40 return result
41
42
43if __name__ == "__main__":
44
45 from AthenaConfiguration.TestDefaults import defaultTestFiles
46 from AthenaConfiguration.AllConfigFlags import initConfigFlags
47 from AthenaCommon.Constants import DEBUG
48 flags = initConfigFlags()
49 flags.Input.Files = defaultTestFiles.AOD_RUN3_MC
50 flags.Input.isMC=True
51 flags.Exec.MaxEvents = 20
52 flags.Common.MsgSuppression = False
53 flags.lock()
54
55 # create basic infrastructure
56 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
57 acc = MainServicesCfg(flags)
58
59 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
60 acc.merge(PoolReadCfg(flags))
61
62 # example to smear the truth particles
63 smearerTruth = L0MuonSmearingCfg(flags,
64 name = "L0MuonTruthSmearing",
65 InputTruthParticle = "TruthParticles",
66 OutputLevel = DEBUG)
67 acc.merge(smearerTruth)
68
69 # below is validation
70 acc.printConfig(withDetails=True, summariseProps=True)
71
72 # run the job
73 status = acc.run()
74
75 # report the execution status (0 ok, else error)
76 import sys
77 sys.exit(not status.isSuccess())
78
L0MuonSmearingCfg(flags, name="L0MuonSmearingAlg", **kwargs)