ATLAS Offline Software
DQTDetSynchMonAlg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
5  from AthenaMonitoring import AthMonitorCfgHelper
6  from AthenaConfiguration.ComponentFactory import CompFactory
7  helper = AthMonitorCfgHelper(flags,'DQTDetSynchMonAlgCfg')
8  _DQTDetSynchMonAlgConfigCore(helper, CompFactory.DQTDetSynchMonAlg,
9  flags.Common.isOnline, False)
10  acc = helper.result()
11  # RPC currently crashes, switch off
12  acc.getEventAlgo('DQTDetSynchMonAlg').doRPC = False
13  from MagFieldServices.MagFieldServicesConfig import AtlasFieldCacheCondAlgCfg
14  acc.merge(AtlasFieldCacheCondAlgCfg(flags))
15  from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
16  acc.merge(TileCablingSvcCfg(flags))
17  return acc
18 
19 
20 def _DQTDetSynchMonAlgConfigCore(helper, algConfObj, isOnline=False, run2Compat=False):
21  monAlg = helper.addAlgorithm(algConfObj,'DQTDetSynchMonAlg')
22  monAlg.run2Compat = run2Compat
23 
24  # arguments are: algorithm, name of group used to access it from the alg,
25  # the 'top level path' to put outputs in, and the default duration of
26  # associated histograms
27  bcidg = helper.addGroup(monAlg, 'bcid', 'GLOBAL/DQTSynch/BCID')
28  l1idg = helper.addGroup(monAlg, 'l1id', 'GLOBAL/DQTSynch/L1ID')
29  bfieldg = helper.addGroup(monAlg, 'bfield', 'GLOBAL/DQTSynch/Bfield')
30 
31  bcidg.defineHistogram("diffx,diffy;m_BCID",
32  title="BCID subdetector summary",
33  type='TH2I',
34  xbins=7, xmin=-0.5, xmax=6.5,
35  ybins=7, ymin=-0.5, ymax=6.5,
36  xlabels = ["CTP", "SCT", "TRT", "LAr",
37  "Tile", "RPC", "Pixel"],
38  ylabels = ["CTP", "SCT", "TRT", "LAr",
39  "Tile", "RPC", "Pixel"]
40  )
41  bcidg.defineHistogram("bcidrates_idx,bcidrates;m_BCID_rate",
42  title="BCID subdetector rate summary",
43  type='TH2I',
44  xbins=6, xmin=0.5, xmax=6.5,
45  ybins=20, ymin=0.0, ymax=1.0,
46  xlabels = ["SCT", "TRT", "LAr",
47  "Tile", "RPC", "Pixel"]
48  )
49 
50  l1idg.defineHistogram("diffx,diffy;m_L1ID",
51  title="L1ID subdetector summary",
52  type='TH2I',
53  xbins=7, xmin=-0.5, xmax=6.5,
54  ybins=7, ymin=-0.5, ymax=6.5,
55  xlabels = ["CTP", "SCT", "TRT", "LAr",
56  "Tile", "RPC", "Pixel"],
57  ylabels = ["CTP", "SCT", "TRT", "LAr",
58  "Tile", "RPC", "Pixel"]
59  )
60 
61  detlist = ['CTP', 'SCT', 'TRT', 'LAR', 'Tile', 'RPC', 'Pixel']
62  for det in detlist:
63  bcidg.defineHistogram("%sbcid;m_%s_BCID" % (det.lower(), det),
64  title=(("BCID of %s" % det) +
65  (" detector" if det != 'CTP' else '')),
66  type='TH1I',
67  xbins=4096, xmin=-0.5, xmax=4095.5)
68  l1idg.defineHistogram("%sl1id;m_%s_L1ID" % (det.lower(), det),
69  title=("L1ID of %s detector" % det),
70  type='TH1I',
71  xbins=(10000 if det == 'CTP' else 1000),
72  xmin=-0.5, xmax=9999.5)
73 
74  # cross-detector correlations
75  for i1, det1 in enumerate(detlist):
76  for i2, det2 in enumerate(detlist[i1+1:]):
77  didx1, didx2 = i1, i2+i1+1
78  if run2Compat and det2 == 'Pixel':
79  didx1, didx2 = didx2, didx1
80  det1, det2 = det2, det1
81  # BCID
82  bcidg.defineHistogram('diff_%1d_%1d;m_diff_%s_%s_BCID' % (didx1, didx2, det1, det2),
83  title='BCID difference between %s and %s detectors' % (det1, det2),
84  type='TH1I',
85  opt=('kRebinAxes' if not run2Compat and not isOnline else ''), merge='merge',
86  xbins=51, xmin=-25.5, xmax=25.5)
87 
88  # L1ID
89  l1idg.defineHistogram('diff_%1d_%1d;m_diff_%s_%s_L1ID' % (didx1, didx2, det1, det2),
90  title='L1ID difference between %s and %s detectors' % (det1, det2),
91  type='TH1I',
92  opt=('kRebinAxes' if not run2Compat and not isOnline else ''), merge='merge',
93  xbins=51, xmin=-25.5, xmax=25.5)
94 
95  if run2Compat and not isOnline:
96  # BCID
97  bcidg.defineHistogram('diff_%1d_%1d;m_diff_%s_%s_BCID_Rebin' % (didx1, didx2, det1, det2),
98  title='BCID difference between %s and %s detectors. Full Range.' % (det1, det2),
99  type='TH1I',
100  opt='kRebinAxes', merge='merge',
101  xbins=51, xmin=-25.5, xmax=25.5)
102 
103  # L1ID
104  l1idg.defineHistogram('diff_%1d_%1d;m_diff_%s_%s_L1ID_Rebin' % (didx1, didx2, det1, det2),
105  title='L1ID difference between %s and %s detectors. Full Range.' % (det1, det2),
106  type='TH1I',
107  opt='kRebinAxes', merge='merge',
108  xbins=51, xmin=-25.5, xmax=25.5)
109 
110  if ((det1 == 'CTP'
111  or (det1 == 'Pixel' and det2 == 'CTP'))
112  and not isOnline):
113  if run2Compat and det1 == 'Pixel':
114  # reproducing old code ...
115  didx1, didx2, det1, det2 = didx2, didx1, det2, det1
116  bcidg.defineHistogram('LB,diff_%1d_%1d;m_diff_%s_%s_BCID_lumi' % (didx1, didx2, det1, det2),
117  title='BCID difference between %s and %s detectors as a function of the LumiBlock' % (det1, det2),
118  type='TProfile',
119  opt='kAddBinsDynamically', merge='merge',
120  xbins=30, xmin=0., xmax=30)
121 
122  l1idg.defineHistogram('LB,diff_%1d_%1d;m_diff_%s_%s_L1ID_lumi' % (didx1, didx2, det1, det2),
123  title='L1ID difference between %s and %s detectors as a function of the LumiBlock' % (det1, det2),
124  type='TProfile',
125  opt='kAddBinsDynamically', merge='merge',
126  xbins=30, xmin=0., xmax=30)
127 
128  bfieldg.defineHistogram("solenoid_bz;m_Bfield_solenoid",
129  title="Bz of Solenoid",
130  type='TH1I', xbins=50, xmin=-1, xmax=4)
131  bfieldg.defineHistogram("toroid_bx;m_Bfield_toroid",
132  title="Bx of Toroid",
133  type='TH1I', xbins=50, xmin=-1, xmax=4)
134  bfieldg.defineHistogram("LB,solenoid_bz;m_Bfield_solenoid_vsLB",
135  title="Bz of Solenoid vs LB",
136  opt='kAddBinsDynamically', merge='merge',
137  type='TProfile', xbins=1500, xmin=-0.5, xmax=1499.5)
138  bfieldg.defineHistogram("LB,toroid_bx;m_Bfield_toroid_vsLB",
139  title="Bx of Toroid vs LB",
140  opt='kAddBinsDynamically', merge='merge',
141  type='TProfile', xbins=1500, xmin=-0.5, xmax=1499.5)
142 
143 
144 
145 if __name__ == '__main__':
146  # Setup logs
147  from AthenaCommon.Logging import log
148  from AthenaCommon.Constants import INFO
149  from AthenaConfiguration.TestDefaults import defaultTestFiles
150  log.setLevel(INFO)
151 
152  # Set the Athena configuration flags
153  from AthenaConfiguration.AllConfigFlags import initConfigFlags
154  nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/'
155  file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1'
156  flags = initConfigFlags()
157  flags.Input.Files = defaultTestFiles.RAW_RUN2
158  #flags.Input.isMC = False
159  flags.Output.HISTFileName = 'ExampleMonitorOutput.root'
160 
161  flags.lock()
162 
163  # Initialize configuration object, add accumulator, merge, and run.
164  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
165  #from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
166  from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
167  cfg = MainServicesCfg(flags)
168  cfg.merge(ByteStreamReadCfg(flags))
169  from TrigInDetConfig.InDetConfig import TrigInDetConfig
170  cfg.merge(TrigInDetConfig(flags))
171 
172  cfg.merge(DQTDetSynchMonAlgConfig(flags))
173 
174  # If you want to turn on more detailed messages ...
175  #exampleMonitorAcc.getEventAlgo('ExampleMonAlg').OutputLevel = 2 # DEBUG
176  cfg.printConfig(withDetails=False) # set True for exhaustive info
177 
178  cfg.run() #use cfg.run(20) to only run on first 20 events
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
DQTDetSynchMonAlg.DQTDetSynchMonAlgConfig
def DQTDetSynchMonAlgConfig(flags)
Definition: DQTDetSynchMonAlg.py:4
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
Constants
some useful constants -------------------------------------------------—
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
DQTDetSynchMonAlg._DQTDetSynchMonAlgConfigCore
def _DQTDetSynchMonAlgConfigCore(helper, algConfObj, isOnline=False, run2Compat=False)
Definition: DQTDetSynchMonAlg.py:20
python.MagFieldServicesConfig.AtlasFieldCacheCondAlgCfg
def AtlasFieldCacheCondAlgCfg(flags, **kwargs)
Definition: MagFieldServicesConfig.py:8
python.TileCablingSvcConfig.TileCablingSvcCfg
def TileCablingSvcCfg(flags)
Definition: TileCablingSvcConfig.py:11