ATLAS Offline Software
LArDigitMonAlg.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 LArDigitMonConfig(flags):
6  '''Function to configures some algorithms in the monitoring system.'''
7 
8  # The following class will make a sequence, configure algorithms, and link
9  # them to GenericMonitoringTools
10 
11  from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper
12  helper = AthMonitorCfgHelper(flags,'LArDigitMonAlgCfg')
13 
14  from AthenaConfiguration.ComponentFactory import CompFactory
15  return LArDigitMonConfigCore(helper, CompFactory.LArDigitMonAlg,flags)
16 
17 def LArDigitMonConfigCore(helper, algoinstance,flags):
18 
19 
20  from LArMonitoring.GlobalVariables import lArDQGlobals
21 
22  larDigitMonAlg = helper.addAlgorithm(algoinstance,'larDigitMonAlg')
23 
24  summaryGroupName="Summary"
25  nslots=[]
26  for i in range(0,len(lArDQGlobals.FEB_Slot)):
27  nslots.append(lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[i]][1])
28 
29  larDigitMonAlg.SummaryMonGroup=summaryGroupName
30  larDigitMonAlg.LArDigitsSubDetNames=lArDQGlobals.SubDet
31  larDigitMonAlg.LArDigitsPartitionNames=lArDQGlobals.Partitions
32  larDigitMonAlg.LArDigitsNslots=nslots
33  larDigitMonAlg.ProblemsToMask=["highNoiseHG","highNoiseMG","highNoiseLG","deadReadout","deadPhys"]
34  larDigitMonAlg.Streams=lArDQGlobals.defaultStreamNames
35 
36  summaryGroup = helper.addGroup(
37  larDigitMonAlg,
38  summaryGroupName,
39  '/LAr/Digits'
40  )
41 
42 
43  summary_hist_path=summaryGroupName+'/'
44 
45  summaryGroup.defineHistogram('gain,partition;SummaryGain',
46  title='Gain;Gain;Partition',
47  type='TH2F',
48  path=summary_hist_path,
49  xbins=lArDQGlobals.N_Gains,xmin=-0.5,xmax=lArDQGlobals.N_Gains-0.5,
50  ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions-0.5,
51  xlabels=lArDQGlobals.Gains,ylabels=lArDQGlobals.Partitions)
52 
53  summaryGroup.defineHistogram('LBN;LBN',type='TH1I',
54  title='Event counter per LB',
55  path='',
56  xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)
57 
58  # now individual partitions, because we need a different directories, will have only 2dim arrays (side)
59  for subdet in range(0,lArDQGlobals.N_SubDet):
60  array = helper.addArray([lArDQGlobals.Partitions[2*subdet:2*subdet+2]],larDigitMonAlg,lArDQGlobals.SubDet[subdet],topPath='/')
61  hist_path='/LAr/Digits/'+lArDQGlobals.SubDet[subdet]+'/'
62  slot_low = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet*2]][0] - 0.5
63  slot_up = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
64  slot_n = int(slot_up - slot_low)
65  ft_low = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][0] - 0.5
66  ft_up = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
67  ft_n = int(ft_up - ft_low)
68  chan_n = lArDQGlobals.FEB_N_channels
69  chan_low = lArDQGlobals.FEB_channels_Min
70  chan_up = lArDQGlobals.FEB_channels_Max
71  crates_n = lArDQGlobals.FEB_Crates[lArDQGlobals.Partitions[subdet*2]][1]
72  crates_low = 0.5
73  crates_up = lArDQGlobals.FEB_Crates[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
74  array.defineHistogram('Outslot,OutFT;RAW_OutOfRange',
75  title='% chan/FEB/events with max out of range;Slot;FT',
76  type='TH2F',
77  path=hist_path,
78  weight='Outweight',
79  xbins=int(slot_n),xmin=slot_low,xmax=slot_up,
80  ybins=int(ft_n), ymin=ft_low, ymax=ft_up)
81  array.defineHistogram('Outcrate,Outchan;RAW_OutOfRangeChan',
82  title='% chan/events with max out of range;Crate (Slot + N_slots*FT);Channel',
83  type='TH2F',
84  path=hist_path,
85  weight='weight',
86  xbins=crates_n,xmin=crates_low,xmax=crates_up,
87  ybins=chan_n, ymin=chan_low, ymax=chan_up)
88 
89  array.defineHistogram('Saturslot,SaturFT;RAW_Saturation',
90  title='% chan/FEB/events with max=4095 ADC;Slot;FT',
91  type='TH2F',
92  path=hist_path,
93  weight='Saturweight',
94  xbins=int(slot_n),xmin=slot_low,xmax=slot_up,
95  ybins=int(ft_n), ymin=ft_low, ymax=ft_up)
96  array.defineHistogram('Saturcrate,Saturchan;RAW_SaturationChan',
97  title='% chan/events with max=4095 ADC - Med/High Gain - All Stream;Crate (Slot + N_slots*FT);Channel',
98  type='TH2F',
99  path=hist_path,
100  weight='weight',
101  xbins=crates_n,xmin=crates_low,xmax=crates_up,
102  ybins=chan_n, ymin=chan_low, ymax=chan_up)
103 
104  array.defineHistogram('SaturLowslot,SaturLowFT;RAW_SaturationLow',
105  title='% chan/FEB/events with max=4095 ADC ;Slot;FT',
106  type='TH2F',
107  path=hist_path,
108  weight='SaturLowweight',
109  xbins=int(slot_n),xmin=slot_low,xmax=slot_up,
110  ybins=int(ft_n), ymin=ft_low, ymax=ft_up)
111  array.defineHistogram('SaturLowcrate,SaturLowchan;RAW_SaturationChanLow',
112  title='% chan/events with max=4095 ADC - Low Gain - All Stream;Crate (Slot + N_slots*FT);Channel',
113  type='TH2F',
114  path=hist_path,
115  weight='weight',
116  xbins=crates_n,xmin=crates_low,xmax=crates_up,
117  ybins=chan_n, ymin=chan_low, ymax=chan_up)
118 
119  array.defineHistogram('Nullslot,NullFT;tNullDigit',
120  title='% chan/FEB/events with min=0 ADC;Slot;FT',
121  type='TH2F',
122  path=hist_path,
123  weight='Nullweight',
124  xbins=int(slot_n),xmin=slot_low,xmax=slot_up,
125  ybins=int(ft_n), ymin=ft_low, ymax=ft_up)
126  array.defineHistogram('Nullcrate,Nullchan;RAW_NullDigitChan',
127  title='% chan/events with min=0 ADC - All Gain - All Stream;Crate;Channel',
128  type='TH2F',
129  path=hist_path,
130  xbins=crates_n,xmin=crates_low,xmax=crates_up,
131  ybins=chan_n, ymin=chan_low, ymax=chan_up)
132 
133  array.defineHistogram('slot,FT,MaxPos;RAW_AvePosMaxDig',
134  title='Average position of Max Digit;Slot;FT',
135  type='TProfile2D',
136  path=hist_path,
137  xbins=int(slot_n),xmin=slot_low,xmax=slot_up,
138  ybins=int(ft_n), ymin=ft_low, ymax=ft_up)
139 
140  array.defineHistogram('LBN,MaxPos;MaxVsTime',
141  title='Average Max Sample vs LumiBlock;Luminosity Block;Average Max Sample',
142  type='TProfile',
143  path=hist_path,
144  xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)
145  array.defineHistogram('MaxPos,Energy;EnVsMaxSample',
146  title='Energy vs max sample;Sample Number;Energy [ADC] ',
147  type='TH2F',
148  path=hist_path,
149  xbins=lArDQGlobals.Samples_Bins,xmin=lArDQGlobals.Samples_Min,xmax=lArDQGlobals.Samples_Max,
150  ybins=lArDQGlobals.Energy_Bins, ymin=lArDQGlobals.Energy_Min, ymax=lArDQGlobals.Energy_Max)
151 
152  array.defineHistogram('MaxPos,streamBin;MaxSample_PerStream',
153  title="Position of the Max Sample;Average Max Sample",
154  type='TH2F',
155  path=hist_path,
156  xbins=lArDQGlobals.Samples_Bins,xmin=lArDQGlobals.Samples_Min,xmax=lArDQGlobals.Samples_Max,
157  ybins=len(lArDQGlobals.defaultStreamNames),ymin=-0.5, ymax=len(lArDQGlobals.defaultStreamNames)-0.5,
158  ylabels=lArDQGlobals.defaultStreamNames)
159 
160 
161  array.defineHistogram('l1trig,MaxPos;TriggerWord',
162  title='Position of max sample per L1 trigger word (8 bits);L1 trigger word;Position of max Sample ',
163  type='TProfile',
164  path=hist_path,
165  xbins=lArDQGlobals.L1Trig_Bins,xmin=lArDQGlobals.L1Trig_Min,xmax=lArDQGlobals.L1Trig_Max)
166 
167  array.defineHistogram('Sample,SignalNorm;SignShape',
168  title='Normalized Signal Shape;Sample Number;Normalized Signal Shape ',
169  type='TProfile',
170  weight='weight',
171  path=hist_path,
172  xbins=lArDQGlobals.Samples_Bins,xmin=lArDQGlobals.Samples_Min,xmax=lArDQGlobals.Samples_Max)
173 
174 
175  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
177  cfg.merge(helper.result())
178  return cfg
179 
180 
181 if __name__=='__main__':
182 
183  from AthenaConfiguration.AllConfigFlags import initConfigFlags
184  flags = initConfigFlags()
185 
186  from AthenaCommon.Logging import log
187  from AthenaCommon.Constants import DEBUG
188  log.setLevel(DEBUG)
189 
190  from LArMonitoring.LArMonConfigFlags import addLArMonFlags
191  flags.addFlagsCategory("LArMon", addLArMonFlags)
192 
193  from AthenaConfiguration.TestDefaults import defaultTestFiles
194  flags.Input.Files = defaultTestFiles.RAW_RUN2
195 
196  flags.Output.HISTFileName = 'LArDigitsMonOutput.root'
197  flags.DQ.enableLumiAccess = False
198  flags.DQ.useTrigger = False
199  flags.lock()
200 
201  from CaloRec.CaloRecoConfig import CaloRecoCfg
202  cfg=CaloRecoCfg(flags)
203 
204  from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg
205  cfg.merge(LArNoisyROSummaryCfg(flags))
206 
207  # from LArMonitoring.LArDigitMonAlg import LArDigitMonConfig
208  aff_acc = LArDigitMonConfig(flags)
209  cfg.merge(aff_acc)
210 
211  flags.dump()
212  f=open("LArDigitMon.pkl","wb")
213  cfg.store(f)
214  f.close()
215 
216  #cfg.run(100)
python.CaloRecoConfig.CaloRecoCfg
def CaloRecoCfg(flags, clustersname=None)
Definition: CaloRecoConfig.py:9
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
LArDigitMonAlg.LArDigitMonConfig
def LArDigitMonConfig(flags)
Definition: LArDigitMonAlg.py:5
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
Constants
some useful constants -------------------------------------------------—
LArDigitMonAlg.LArDigitMonConfigCore
def LArDigitMonConfigCore(helper, algoinstance, flags)
Definition: LArDigitMonAlg.py:17
Trk::open
@ open
Definition: BinningType.h:40
LArNoisyROSummaryConfig.LArNoisyROSummaryCfg
def LArNoisyROSummaryCfg(configFlags, **kwargs)
Definition: LArNoisyROSummaryConfig.py:8
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19