ATLAS Offline Software
LArHVCorrMonAlg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 def LArHVCorrMonConfig(flags):
6  from AthenaMonitoring import AthMonitorCfgHelper
7  helper = AthMonitorCfgHelper(flags,'LArHVCorrMonAlgCfg')
8 
9  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
10  acc = LArGMCfg(flags)
11  from TileGeoModel.TileGMConfig import TileGMCfg
12  acc.merge(TileGMCfg(flags))
13  from LArCalibUtils.LArHVScaleConfig import LArHVScaleCfg
14  acc.merge(LArHVScaleCfg(flags))
15 
16  from AthenaConfiguration.ComponentFactory import CompFactory
17  LArHVCorrMonConfigCore(helper, CompFactory.LArHVCorrectionMonAlg, flags)
18 
19  acc.merge(helper.result())
20  return acc
21 
22 def LArHVCorrMonConfigCore(helper, algoinstance,flags):
23 
24  larHVCorrAlg = helper.addAlgorithm(algoinstance,'larHVCorrMonAlg')
25 
26  #define the group names here, as you'll use them multiple times
27  hvCorrGroupName="LArHVCorrMonGroup"
28 
29 
30  # Edit properties of a algorithm
31  larHVCorrAlg.HVCorrMonGroupName=hvCorrGroupName
32  delta_eta=0.01
33  larHVCorrAlg.EtaGranularity=delta_eta
34  delta_phi=0.01
35  larHVCorrAlg.EtaGranularity=delta_phi
36  num_LB=3000
37  larHVCorrAlg.NumberOfLBs=num_LB
38  threshold=0.02
39  larHVCorrAlg.ErrorThreshold=threshold
40 
41 
42  from LArMonitoring.GlobalVariables import lArDQGlobals #to define the ranges
43  larHVCorr_hist_path='HVCorrection/' #histogram path
44 
45 
46  hvCorrGroup = helper.addGroup( larHVCorrAlg,
47  hvCorrGroupName, '/LAr/'
48  )
49 
50  #EMB
51  hvCorrGroup.defineHistogram('etaEMBA,phiEMBA;LArHVCorrectionEMBA',
52  title='HV deviation (nominal - corrected) - EMBA;#eta;#phi',
53  type='TH2F',
54  path=larHVCorr_hist_path,
55  opt='kAlwaysCreate',
56  weight='hvcorrEMBA',
57  xbins=int(lArDQGlobals.HVeta_EMB["EMBAPS"][2]/delta_eta),xmin=lArDQGlobals.HVeta_EMB["EMBAPS"][1],xmax=lArDQGlobals.HVeta_EMB["EMBAPS"][2],
58  ybins=lArDQGlobals.HVphi_EMB["EMBAPS"][0],ymin=lArDQGlobals.HVphi_EMB["EMBAPS"][1],ymax=lArDQGlobals.HVphi_EMB["EMBAPS"][2],
59  merge='weightedAverage')
60 
61  hvCorrGroup.defineHistogram('etaEMBC,phiEMBC;LArHVCorrectionEMBC',
62  title='HV deviation (nominal - corrected) - EMBA;#eta;#phi',
63  type='TH2F',
64  path=larHVCorr_hist_path,
65  opt='kAlwaysCreate',
66  weight='hvcorrEMBC',
67  xbins=int(lArDQGlobals.HVeta_EMB["EMBAPS"][2]/delta_eta),xmax=lArDQGlobals.HVeta_EMB["EMBAPS"][1]-0.01,xmin=-lArDQGlobals.HVeta_EMB["EMBAPS"][2]-0.01,
68  ybins=lArDQGlobals.HVphi_EMB["EMBAPS"][0],ymin=lArDQGlobals.HVphi_EMB["EMBAPS"][1],ymax=lArDQGlobals.HVphi_EMB["EMBAPS"][2],
69  merge='weightedAverage')
70 
71  hvCorrGroup.defineHistogram('LB,nonnominalEMBA;NDeviatingChannelsEMBA',
72  title='Number of channels per LB with HV corr>'+str(100*threshold)+' - EMBA;LumiBlock',
73  type='TProfile',
74  path=larHVCorr_hist_path,
75  xbins=num_LB,xmin=0.5,xmax=num_LB+0.5,
76  merge='weightedAverage')
77 
78  hvCorrGroup.defineHistogram('LB,nonnominalEMBC;NDeviatingChannelsEMBC',
79  title='Number of channels per LB with HV corr>'+str(100*threshold)+' - EMBC;LumiBlock',
80  type='TProfile',
81  path=larHVCorr_hist_path,
82  xbins=num_LB,xmin=0.5,xmax=num_LB+0.5,
83  merge='weightedAverage')
84 
85  #EMEC
86  hvCorrGroup.defineHistogram('etaEMECA,phiEMECA;LArHVCorrectionEMECA',
87  title='HV deviation (nominal - corrected) - EMECA;#eta;#phi',
88  type='TH2F',
89  path=larHVCorr_hist_path,
90  opt='kAlwaysCreate',
91  weight='hvcorrEMECA',
92  xbins=lArDQGlobals.HVeta_EMEC["EMECA"],
93  ybins=lArDQGlobals.HVphi_EMEC["EMECA"],
94  merge='weightedAverage')
95 
96  hvCorrGroup.defineHistogram('etaEMECC,phiEMECC;LArHVCorrectionEMECC',
97  title='HV deviation (nominal - corrected) - EMECA;#eta;#phi',
98  type='TH2F',
99  path=larHVCorr_hist_path,
100  opt='kAlwaysCreate',
101  weight='hvcorrEMECC',
102  xbins=lArDQGlobals.HVeta_EMEC["EMECC"],
103  ybins=lArDQGlobals.HVphi_EMEC["EMECC"],
104  merge='weightedAverage')
105 
106  hvCorrGroup.defineHistogram('LB,nonnominalEMECA;NDeviatingChannelsEMECA',
107  title='Number of channels per LB with HV corr>'+str(100*threshold)+' - EMECA;LumiBlock',
108  type='TProfile',
109  path=larHVCorr_hist_path,
110  xbins=num_LB,xmin=0.5,xmax=num_LB+0.5,
111  merge='weightedAverage')
112 
113  hvCorrGroup.defineHistogram('LB,nonnominalEMECC;NDeviatingChannelsEMECC',
114  title='Number of channels per LB with HV corr>'+str(100*threshold)+' - EMECC;LumiBlock',
115  type='TProfile',
116  path=larHVCorr_hist_path,
117  xbins=num_LB,xmin=0.5,xmax=num_LB+0.5,
118  merge='weightedAverage')
119 
120  #HEC
121  hvCorrGroup.defineHistogram('etaHECA,phiHECA;LArHVCorrectionHECA',
122  title='HV deviation (nominal - corrected) - HECA;#eta;#phi',
123  type='TH2F',
124  path=larHVCorr_hist_path,
125  opt='kAlwaysCreate',
126  weight='hvcorrHECA',
127  xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1], xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2],
128  ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0], ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1], ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2],
129  merge='weightedAverage')
130 
131  hvCorrGroup.defineHistogram('etaHECC,phiHECC;LArHVCorrectionHECC',
132  title='HV deviation (nominal - corrected) - HECA;#eta;#phi',
133  type='TH2F',
134  path=larHVCorr_hist_path,
135  opt='kAlwaysCreate',
136  weight='hvcorrHECC',
137  xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1], xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2],
138  ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0], ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1], ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2],
139  merge='weightedAverage')
140 
141  hvCorrGroup.defineHistogram('LB,nonnominalHECA;NDeviatingChannelsHECA',
142  title='Number of channels per LB with HV corr>'+str(100*threshold)+' - HECA;LumiBlock',
143  type='TProfile',
144  path=larHVCorr_hist_path,
145  xbins=num_LB,xmin=0.5,xmax=num_LB+0.5,
146  merge='weightedAverage')
147 
148  hvCorrGroup.defineHistogram('LB,nonnominalHECC;NDeviatingChannelsHECC',
149  title='Number of channels per LB with HV corr>'+str(100*threshold)+' - HECC;LumiBlock',
150  type='TProfile',
151  path=larHVCorr_hist_path,
152  xbins=num_LB,xmin=0.5,xmax=num_LB+0.5,
153  merge='weightedAverage')
154 
155  #FCAL
156  hvCorrGroup.defineHistogram('etaFCALA,phiFCALA;LArHVCorrectionFCALA',
157  title='HV deviation (nominal - corrected) - FCALA;#eta;#phi',
158  type='TH2F',
159  path=larHVCorr_hist_path,
160  opt='kAlwaysCreate',
161  weight='hvcorrFCALA',
162  xbins=lArDQGlobals.HVeta_HECFcal["FCalA"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalA"][1], xmax=lArDQGlobals.HVeta_HECFcal["FCalA"][2],
163  ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0], ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1], ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2],
164  merge='weightedAverage')
165 
166  hvCorrGroup.defineHistogram('etaFCALC,phiFCALC;LArHVCorrectionFCALC',
167  title='HV deviation (nominal - corrected) - FCALA;#eta;#phi',
168  type='TH2F',
169  path=larHVCorr_hist_path,
170  opt='kAlwaysCreate',
171  weight='hvcorrFCALC',
172  xbins=lArDQGlobals.HVeta_HECFcal["FCalC"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalC"][1], xmax=lArDQGlobals.HVeta_HECFcal["FCalC"][2],
173  ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0], ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1], ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2],
174  merge='weightedAverage')
175 
176  hvCorrGroup.defineHistogram('LB,nonnominalFCALA;NDeviatingChannelsFCALA',
177  title='Number of channels per LB with HV corr>'+str(100*threshold)+' - FCALA;LumiBlock',
178  type='TProfile',
179  path=larHVCorr_hist_path,
180  xbins=num_LB,xmin=0.5,xmax=num_LB+0.5,
181  merge='weightedAverage')
182 
183  hvCorrGroup.defineHistogram('LB,nonnominalFCALC;NDeviatingChannelsFCALC',
184  title='Number of channels per LB with HV corr>'+str(100*threshold)+' - FCALC;LumiBlock',
185  type='TProfile',
186  path=larHVCorr_hist_path,
187  xbins=num_LB,xmin=0.5,xmax=num_LB+0.5,
188  merge='weightedAverage')
189 
190 
191 if __name__=='__main__':
192 
193  # Set the Athena configuration flags
194  from AthenaConfiguration.AllConfigFlags import initConfigFlags
195  flags = initConfigFlags()
196 
197  nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/'
198  file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1'
199  flags.Input.Files = [nightly+file]
200  flags.Input.isMC = False
201  flags.Output.HISTFileName = 'LArHVCorrMonOutput.root'
202  flags.lock()
203 
204  # Initialize configuration object, add accumulator, merge, and run.
205  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
206  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
207  cfg = MainServicesCfg(flags)
208  cfg.merge(PoolReadCfg(flags))
209 
210  cfg.merge(LArHVCorrMonConfig(flags))
211 
212  Nevents=10
213  cfg.run(Nevents) #use cfg.run() to run on all events
LArHVCorrMonAlg.LArHVCorrMonConfig
def LArHVCorrMonConfig(flags)
Definition: LArHVCorrMonAlg.py:5
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
LArHVCorrMonAlg.LArHVCorrMonConfigCore
def LArHVCorrMonConfigCore(helper, algoinstance, flags)
Definition: LArHVCorrMonAlg.py:22
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
str
Definition: BTagTrackIpAccessor.cxx:11
python.LArHVScaleConfig.LArHVScaleCfg
def LArHVScaleCfg(configFlags)
Definition: LArHVScaleConfig.py:8
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7