ATLAS Offline Software
Loading...
Searching...
No Matches
MonTool.py
Go to the documentation of this file.
2# @file MonTool.py
3#
4# @author sutt@cern.ch
5# @date Tue 7 Jul 2026 12:53:51 BST
6#
7# create all the histograms for each analysis - this will get called once for each
8# configured chain - we can set the HistPath either already here, or from the c++
9# code
10#
11# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
12#
13
14import sys
15
16
17from TrigInDetAnalysisExample.TIDAMonTool import monGroup
18
19
20# histogram filler factory, so we can book
21# only the relevant fillers ...
22
23from TrigIDR4Monitoring.Tier0Config import Tier0_builder
24from TrigIDR4Monitoring.TrackParametersConfig import TrackParameters_builder
25from TrigIDR4Monitoring.ResolutionsConfig import Resolutions_builder
26from TrigIDR4Monitoring.EfficienciesConfig import Efficiencies_builder
27from TrigIDR4Monitoring.VerticesConfig import Vertices_builder
28from TrigIDR4Monitoring.SiHitPlotConfig import SiHitPlot_builder
29from TrigIDR4Monitoring.TRTPlotConfig import TRTPlot_builder
30
31# for when we want to configure histograms from json files ...
32# from JsonConfig import JsonHist_builder
33
34
35
36
37_factory = {
38 "Tier0" : Tier0_builder,
39 "Resolutions" : Resolutions_builder,
40 "Efficiencies" : Efficiencies_builder,
41 "Vertices" : Vertices_builder,
42 "TrackParameters" : TrackParameters_builder,
43 "SiHits" : SiHitPlot_builder,
44 "TRTHits" : TRTPlot_builder
45}
46
47
48
49
50# actually create the monTool to go along with a specific chain
51# stores the histogram, binning, creates all the histograms etc
52
53def createMonTool( flags, slicetag, chain, fillers ) :
54
55 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
56 monTool = GenericMonitoringTool( flags, chain )
57
58 histpath = slicetag + monGroup(chain)
59
60 from TrigInDetAnalysisExample.chainString import chainString
61 cs = chainString( chain )
62
63 # monTool.HistPath would this be better set in the c++ code ?
64
65 if flags is None:
66 mypath = "EXPERT"
67 monTool.HistPath = histpath
68 else:
69 # mypath = flags.DQ.FileKey
70 # can't set the "path" in the histograms as that gets apended
71 # to the histogram name when using the official monitoring
72 # framework and we absolutely don't want that
73 mypath = ""
74 monTool.HistPath = "/" + flags.DQ.FileKey + "/" + histpath
75 # monTool.HistPath = histpath
76
77# do we need this ?
78# monTool.UseCache = True
79
80 monTool.convention = 'OFFLINE'
81 monTool.defaultDuration = 'run'
82
83 # now add the requested histograms fro the builders ...
84 # should this function beome a class with the factory and
85 # builders as elements ?
86
87 for filler in fillers:
88 toolbuilder = _factory.get(filler)
89 if toolbuilder is None:
90 print(f"Unknown filler '{filler}'")
91 sys.exit(1)
92 toolbuilder( monTool, mypath, chain, cs )
93
94 # JsonHist_builder( monTool, mypath, "/afs/cern.ch/user/s/sutt/b/Trigger/TrigMonitoring/TrigIDR4Monitoring/data/NtracksPlotsDef.json" )
95
96 return monTool
97
void print(char *figname, TCanvas *c1)
createMonTool(flags, slicetag, chain, fillers)
Definition MonTool.py:53