ATLAS Offline Software
LArCalibPedMonAlg.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 LArCalibPedMonConfig(flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False):
6 
7  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8  from AthenaMonitoring import AthMonitorCfgHelper
9  helper = AthMonitorCfgHelper(flags,'LArCalibPedMonCfg')
10 
11  from AthenaConfiguration.ComponentFactory import CompFactory
12  LArCalibPedMonConfigCore(helper,CompFactory.LArCalibPedMonAlg,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  # adding LArFebErrorSummary algo
22  from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg
23  rv.merge(LArFebErrorSummaryMakerCfg(flags))
24 
25  rv.merge(helper.result())
26 
27  return rv
28 
29 def LArCalibPedMonConfigCore(helper,algoinstance,flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False):
30 
31  from LArMonitoring.GlobalVariables import lArDQGlobals
32 
33  larPedMonAlgTest = helper.addAlgorithm(algoinstance,'larCalibPedMonAlgTest')
34  if gain != "":
35  if doAccDigit:
36  larPedMonAlgTest.LArAccumulatedDigitContainerKey=gain
37  elif doAccCalibDigit:
38  larPedMonAlgTest.LArAccumulatedCalibDigitContainerKey=gain
39  elif doCalibDigit:
40  larPedMonAlgTest.LArCalibDigitContainerKey=gain
41 
42 # this creates a "Group" called "PedMonGroup" which will put its histograms into the subdirectory "'/LAr/'+GroupName+'/'"
43  GroupName="PedMonGroup"
44 
45  larPedMonAlgTest.LArPedGroupName=GroupName
46  larPedMonAlgTest.PartitionNames=lArDQGlobals.Partitions
47  larPedMonAlgTest.SubDetNames=lArDQGlobals.SubDet
48 
49  Group = helper.addGroup(larPedMonAlgTest,GroupName,'/LAr/'+GroupName+'/')
50 
51 
52  #Summary histos
53  summary_hist_path='Summary/'
54 
55 # this defines a 1I histogram named "NbOfReadoutChannelsGlobal" monitoring "nbChan".
56 # the title will be "# of readout channels"; the x axis label is "Total channels for all FEB"; and the y axis label is "Events",
57 # which will be put into the subdirectory "summary_hist_path"
58  Group.defineHistogram('nbChan;NbOfReadoutChannelsGlobal',
59  title='# of readout channels;Total channels for all FEB;Events',
60  type='TH1I',
61  path=summary_hist_path,
62  xbins=lArDQGlobals.N_FEB*lArDQGlobals.FEB_N_channels+5,
63  xmin=-0.5, xmax=lArDQGlobals.N_FEB*lArDQGlobals.FEB_N_channels+4.5)
64  Group.defineHistogram('nbFEB;NbOfReadoutFEBGlobal',
65  title='# of readout FEB/DSP header;N_FEB;Events',
66  type='TH1I',
67  path=summary_hist_path,
68  xbins=lArDQGlobals.N_FEB+11, xmin=-0.5, xmax=lArDQGlobals.N_FEB+10+0.5)
69  Group.defineHistogram('nbFEBpart,part;NbOfEvts2d',
70  title='# of readout FEB/DSP header;N_FEB;Partition',
71  type='TH2I',
72  path=summary_hist_path,
73  xbins=lArDQGlobals.N_FEB_Parttions_Max, xmin=-0.5, xmax=lArDQGlobals.N_FEB_Parttions_Max-0.5,
74  ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions-0.5,
75  ylabels=lArDQGlobals.Partitions)
76  Group.defineHistogram('febError,part;NbOfFEBMonErrors_dE',
77  title='# of data corruption errors',
78  type='TH2I',
79  path=summary_hist_path,
80  xbins=lArDQGlobals.N_FEBErrors, xmin=0.5, xmax=lArDQGlobals.N_FEBErrors+0.5,
81  ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions-0.5,
82  xlabels=lArDQGlobals.FEBErrors, ylabels=lArDQGlobals.Partitions)
83  Group.defineHistogram('LB0,EvtRejYield;RAW_YieldOfRejectedEventsVsLB',
84  title='Yield of corrupted events (DATACORRUPTED);LBs;Yield(%)',
85  type='TProfile',
86  path=summary_hist_path,
87  xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max)
88  Group.defineHistogram('LB0;NbOfEventsVsLB',
89  title='Nb of events per LB;LBs;Events',
90  type='TH1I',
91  path=summary_hist_path,
92  xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max)
93  Group.defineHistogram('LB0,LArEvSize;LAreventSizeVsLB',
94  title='LAr event size (w/o ROS headers);LBs;Megabytes',
95  type='TProfile',
96  path=summary_hist_path,
97  xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max)
98  # Now per partition histograms
99  for subdet in range(0,lArDQGlobals.N_SubDet):
100  hist_path='/LAr/'+GroupName+'/'+lArDQGlobals.SubDet[subdet]+'/'
101  slot_low = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet*2]][0] - 0.5
102  slot_up = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
103  slot_n = int(slot_up - slot_low)
104  ft_low = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][0] - 0.5
105  ft_up = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
106  ft_n = int(ft_up - ft_low)
107 
108  darray = helper.addArray([lArDQGlobals.Partitions[2*subdet:2*subdet+2]],larPedMonAlgTest,lArDQGlobals.SubDet[subdet])
109 
110  darray.defineHistogram('nbFEBpart;nbOfFebBlocks',
111  title='# of readout FEBs (DSP header check only);N_FEB;Events',
112  type='TH1I',
113  path=hist_path,
114  xbins=lArDQGlobals.N_FEB_Parttions_Max, xmin=-0.5, xmax=lArDQGlobals.N_FEB_Parttions_Max-0.5)
115  darray.defineHistogram('slotnb,FTnb;RAW_nbOfEvts',
116  title='Nb of events (DSP header check only);Slot;FT',
117  type='TH2I',
118  path=hist_path,
119  xbins=slot_n,xmin=slot_low,xmax=slot_up,
120  ybins=ft_n, ymin=ft_low, ymax=ft_up)
121 
122  darray.defineHistogram('slotnb,FTnb;RAW_nbOfFT',
123  title='Average # of cells with (qfactor+time) readout;Slot;FT',
124  type='TProfile1D',
125  path=hist_path,
126  xbins=slot_n,xmin=slot_low,xmax=slot_up,
127  ybins=ft_n, ymin=ft_low, ymax=ft_up)
128 
129 
130 if __name__=='__main__':
131 
132  from AthenaConfiguration.AllConfigFlags import initConfigFlags
133 
134  flags = initConfigFlags()
135 
136  from AthenaCommon.Logging import log
137  from AthenaCommon.Constants import DEBUG
138  log.setLevel(DEBUG)
139 
140  from AthenaMonitoring.DQConfigFlags import DQDataType
141  from LArMonitoring.LArMonConfigFlags import addLArMonFlags
142 
143  flags.addFlagsCategory("LArMon", addLArMonFlags)
144 
145  run="00404637"
146 
147  flags.Input.Files = [
148  "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-32s-High-All/00404637/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW._lb0000._SFO-1._0001.data",
149  "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-32s-High-All/00404637/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW._lb0000._SFO-2._0001.data",
150  "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-32s-High-All/00404637/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW._lb0000._SFO-3._0001.data",
151  "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-32s-High-All/00404637/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW._lb0000._SFO-4._0001.data"]
152  flags.Output.HISTFileName = 'LArCalibPedMonOutput_'+run+'.root'
153 
154  flags.DQ.enableLumiAccess = False
155  flags.Input.isMC = False
156  flags.DQ.useTrigger = False
157  flags.LAr.doAlign=False
158  from AthenaConfiguration.Enums import BeamType
159  flags.Beam.Type = BeamType.Collisions
160  flags.DQ.DataType = DQDataType.Collisions
161  from AthenaConfiguration.TestDefaults import defaultGeometryTags
162  flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2
163  flags.Detector.GeometryCSC=False
164  flags.Detector.GeometrysTGC=False
165  flags.Detector.GeometryMM=False
166  flags.Exec.OutputLevel=DEBUG
167  flags.lock()
168 
169 # Initialize configuration object, add accumulator, merge, and run.
170  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
171  cfg = MainServicesCfg(flags)
172 
173  from LArByteStream.LArRawCalibDataReadingConfig import LArRawCalibDataReadingCfg
174  cfg.merge(LArRawCalibDataReadingCfg(flags,gain="HIGH",doAccDigit=True))
175 
176  cfg.merge(LArCalibPedMonConfig(flags, gain="HIGH",doAccDigit=True))
177 
178  cfg.printConfig(withDetails=False) #set True for exhaustive info
179 
180  flags.dump()
181  f=open("LArCalibPedMon_"+run+".pkl","wb")
182  cfg.store(f)
183  f.close()
184 
185  cfg.run(500) #to only run on first 500 events
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
LArCalibPedMonAlg.LArCalibPedMonConfigCore
def LArCalibPedMonConfigCore(helper, algoinstance, flags, gain="", doAccDigit=False, doCalibDigit=False, doAccCalibDigit=False)
Definition: LArCalibPedMonAlg.py:29
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.LArFebErrorSummaryMakerConfig.LArFebErrorSummaryMakerCfg
def LArFebErrorSummaryMakerCfg(flags)
Definition: LArFebErrorSummaryMakerConfig.py:7
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
Constants
some useful constants -------------------------------------------------—
LArCalibPedMonAlg.LArCalibPedMonConfig
def LArCalibPedMonConfig(flags, gain="", doAccDigit=False, doCalibDigit=False, doAccCalibDigit=False)
Definition: LArCalibPedMonAlg.py:5
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
LArCablingConfig.LArCalibIdMappingCfg
def LArCalibIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:83