ATLAS Offline Software
LArCalibDelayMonAlg.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 LArCalibDelayMonConfig(flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False):
6 
7  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8  from AthenaMonitoring import AthMonitorCfgHelper
9  helper = AthMonitorCfgHelper(flags,'LArCalibDelayMonCfg')
10 
11  from AthenaConfiguration.ComponentFactory import CompFactory
12  LArCalibDelayMonConfigCore(helper,CompFactory.LArCalibDelayMonAlg,flags,gain,doAccDigit,doCalibDigit,doAccCalibDigit)
13 
15 
16  # adding LAr*Mapping algos
17  from LArCabling.LArCablingConfig import LArFebRodMappingCfg, LArCalibIdMappingCfg
18  rv.merge(LArFebRodMappingCfg(flags))
19  rv.merge(LArCalibIdMappingCfg(flags))
20 
21  rv.merge(helper.result())
22 
23  return rv
24 
25 def LArCalibDelayMonConfigCore(helper,algoinstance,flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False):
26 
27  from LArMonitoring.GlobalVariables import lArDQGlobals
28 
29  larDelayMonAlgTest = helper.addAlgorithm(algoinstance,'larCalibDelayMonAlgTest')
30  if gain != "":
31  if doAccDigit:
32  larDelayMonAlgTest.LArAccumulatedDigitContainerKey=gain
33  elif doAccCalibDigit:
34  larDelayMonAlgTest.LArAccumulatedCalibDigitContainerKey=gain
35  elif doCalibDigit:
36  larDelayMonAlgTest.LArCalibDigitContainerKey=gain
37 
38  GroupName="DelayMonGroup"
39 
40  larDelayMonAlgTest.LArDelayGroupName=GroupName
41  larDelayMonAlgTest.PartitionNames=lArDQGlobals.Partitions
42  larDelayMonAlgTest.SubDetNames=lArDQGlobals.SubDet
43 
44  Group = helper.addGroup(larDelayMonAlgTest,GroupName,'/LAr/'+GroupName+'/')
45 
46 
47  #Summary histos
48  summary_hist_path='Summary/'
49 
50  FEBchan_n = lArDQGlobals.FEB_N_channels
51  FEBchan_low = lArDQGlobals.FEB_channels_Min
52  FEBchan_up = lArDQGlobals.FEB_channels_Max
53 
54  Group.defineHistogram('febchid,sample_max;FEBvsMaxSamples',
55  title='Max samples per FEB;FEB_N_channels;MaxSample',
56  type='TProfile',
57  path=summary_hist_path,
58  xbins=FEBchan_n, xmin=FEBchan_low, xmax=FEBchan_up)
59  Group.defineHistogram('febchid,sample_min;FEBvsMinSamples',
60  title='Min samples per FEB;FEB_N_channels;MinSample',
61  type='TProfile',
62  path=summary_hist_path,
63  xbins=FEBchan_n, xmin=FEBchan_low, xmax=FEBchan_up)
64  Group.defineHistogram('sample_max;NbOfMaxSamples',
65  title='Max samples;ADC;Events',
66  type='TH1F',
67  path=summary_hist_path,
68  xbins=lArDQGlobals.Samples_Bins*lArDQGlobals.FEB_N_channels-2,
69  xmin=-0.5, xmax=lArDQGlobals.Samples_Bins*lArDQGlobals.FEB_N_channels-2.5)
70  Group.defineHistogram('sample_min;NbOfMinSamples',
71  title='Min samples;ADC;Events',
72  type='TH1F',
73  path=summary_hist_path,
74  xbins=lArDQGlobals.Samples_Bins*lArDQGlobals.FEB_N_channels-2,
75  xmin=-0.5, xmax=lArDQGlobals.Samples_Bins*lArDQGlobals.FEB_N_channels-2.5)
76  Group.defineHistogram('dac;ValueOfDAC',
77  title='Value of dac;DAC;Events',
78  type='TH1F',
79  path=summary_hist_path,
80  xbins=60,
81  xmin=0.-0.5, xmax=6000.+0.5)
82  Group.defineHistogram('delay;ValueOfDelay',
83  title='Value of delay;Delay;Events',
84  type='TH1F',
85  path=summary_hist_path,
86  xbins=200,
87  xmin=-0.5, xmax=200.+0.5)
88  Group.defineHistogram('febchid,dac;FEBvsDAC',
89  title='DAC per FEB;FEB_N_channels;DAC',
90  type='TProfile',
91  path=summary_hist_path,
92  xbins=FEBchan_n, xmin=FEBchan_low, xmax=FEBchan_up)
93  Group.defineHistogram('febchid,delay;FEBvsDelay',
94  title='Delay per FEB;FEB_N_channels;Delay',
95  type='TProfile',
96  path=summary_hist_path,
97  xbins=FEBchan_n, xmin=FEBchan_low, xmax=FEBchan_up)
98 
99  # Now per partition histograms
100  for subdet in range(0,lArDQGlobals.N_SubDet):
101  hist_path='/LAr/'+GroupName+'/'+lArDQGlobals.SubDet[subdet]+'/'
102  slot_low = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet*2]][0] - 0.5
103  slot_up = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
104  slot_n = int(slot_up - slot_low)
105  ft_low = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][0] - 0.5
106  ft_up = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
107  ft_n = int(ft_up - ft_low)
108 
109  darray = helper.addArray([lArDQGlobals.Partitions[2*subdet:2*subdet+2]],larDelayMonAlgTest,lArDQGlobals.SubDet[subdet])
110 
111  darray.defineHistogram('slot,FT;NbOfEvents2D',
112  title='Number of Events;Slot;FT',
113  type='TH2F',
114  path=hist_path,
115  xbins=slot_n,xmin=slot_low,xmax=slot_up,
116  ybins=ft_n, ymin=ft_low, ymax=ft_up)
117  darray.defineHistogram('slot,FT,sample_max;SlotvsFTvsMaxSamples',
118  title='Average of MaxSamples;Slot;FT',
119  type='TProfile2D',
120  path=hist_path,
121  xbins=slot_n,xmin=slot_low,xmax=slot_up,
122  ybins=ft_n, ymin=ft_low, ymax=ft_up)
123  darray.defineHistogram('slot,FT,sample_min;SlotvsFTvsMinSamples',
124  title='Average of MinSamples;Slot;FT',
125  type='TProfile2D',
126  path=hist_path,
127  xbins=slot_n,xmin=slot_low,xmax=slot_up,
128  ybins=ft_n, ymin=ft_low, ymax=ft_up)
129  darray.defineHistogram('slot30,FT30,sample_max30;SlotvsFTvsMaxSamples30',
130  title='Average of MaxSamples>3000;Slot;FT',
131  type='TProfile2D',
132  path=hist_path,
133  xbins=slot_n,xmin=slot_low,xmax=slot_up,
134  ybins=ft_n, ymin=ft_low, ymax=ft_up)
135 
136 if __name__=='__main__':
137 
138  from AthenaConfiguration.AllConfigFlags import initConfigFlags
139  flags = initConfigFlags()
140 
141  from AthenaCommon.Logging import log
142  from AthenaCommon.Constants import DEBUG
143  log.setLevel(DEBUG)
144 
145  from AthenaMonitoring.DQConfigFlags import DQDataType
146 
147  from LArMonitoring.LArMonConfigFlags import addLArMonFlags
148  flags.addFlagsCategory("LArMon", addLArMonFlags)
149 
150  type_run="Delay"
151  run="00404654"
152  part="HecFcal"
153 
154  flags.Input.Files = [
155  "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Delay-32s-High-HecFcal/00404654/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW._lb0000._SFO-1._0001.data",
156 
157  "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Delay-32s-High-HecFcal/00404654/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW._lb0000._SFO-2._0001.data",
158 
159  "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Delay-32s-High-HecFcal/00404654/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW._lb0000._SFO-3._0001.data",
160 
161  "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Delay-32s-High-HecFcal/00404654/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW._lb0000._SFO-4._0001.data"]
162  flags.Output.HISTFileName = 'LArCalib'+type_run+'MonOutput_'+run+'-'+part+'.root'
163  flags.DQ.enableLumiAccess = False
164  flags.Input.isMC = False
165  flags.DQ.useTrigger = False
166  flags.LAr.doAlign=False
167  from AthenaConfiguration.Enums import BeamType
168  flags.Beam.Type = BeamType.Collisions
169  flags.DQ.DataType = DQDataType.Collisions
170  from AthenaConfiguration.TestDefaults import defaultGeometryTags
171  flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2
172  flags.Detector.GeometryCSC=False
173  flags.Detector.GeometrysTGC=False
174  flags.Detector.GeometryMM=False
175  flags.Exec.OutputLevel=DEBUG
176  flags.lock()
177 
178 # Initialize configuration object, add accumulator, merge, and run.
179  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
180  cfg = MainServicesCfg(flags)
181 
182  from LArByteStream.LArRawCalibDataReadingConfig import LArRawCalibDataReadingCfg
183  cfg.merge(LArRawCalibDataReadingCfg(flags,gain="HIGH",doAccCalibDigit=True))
184 
185  cfg.merge(LArCalibDelayMonConfig(flags, gain="HIGH",doAccCalibDigit=True))
186 
187  cfg.printConfig(withDetails=False) #set True for exhaustive info
188 
189  flags.dump()
190  f=open("LArCalibDelayMon_"+run+".pkl","wb")
191  cfg.store(f)
192  f.close()
193 
194  cfg.run(500) #to only run on first 500 events
LArCalibDelayMonAlg.LArCalibDelayMonConfigCore
def LArCalibDelayMonConfigCore(helper, algoinstance, flags, gain="", doAccDigit=False, doCalibDigit=False, doAccCalibDigit=False)
Definition: LArCalibDelayMonAlg.py:25
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.LArRawCalibDataReadingConfig.LArRawCalibDataReadingCfg
def LArRawCalibDataReadingCfg(configFlags, gain="HIGH", doAccDigit=False, doAccCalibDigit=False, doCalibDigit=False, doDigit=False)
Definition: LArRawCalibDataReadingConfig.py:8
LArCablingConfig.LArFebRodMappingCfg
def LArFebRodMappingCfg(configFlags)
Definition: LArCablingConfig.py:80
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
Constants
some useful constants -------------------------------------------------—
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
LArCalibDelayMonAlg.LArCalibDelayMonConfig
def LArCalibDelayMonConfig(flags, gain="", doAccDigit=False, doCalibDigit=False, doAccCalibDigit=False)
Definition: LArCalibDelayMonAlg.py:5
LArCablingConfig.LArCalibIdMappingCfg
def LArCalibIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:83