diff --git a/LArCalorimeter/LArMonitoring/python/GlobalVariables.py b/LArCalorimeter/LArMonitoring/python/GlobalVariables.py index 1f8767095b0107e0eaffce16ac2b51350af8fbb1..3b852fc3dd8aa6d0dc065225bd4b4c835b8608f3 100644 --- a/LArCalorimeter/LArMonitoring/python/GlobalVariables.py +++ b/LArCalorimeter/LArMonitoring/python/GlobalVariables.py @@ -1,26 +1,38 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +from __future__ import print_function + from ROOT import TMath +import AthenaCommon.SystemOfUnits as Units class LArDQGlobals(object): __slots__ = ('HVeta_EMB','HVphi_EMB','HVeta_EMEC','HVphi_EMEC','HVeta_HECFcal','HVphi_HECFcal', 'LB_Bins','LB_Min','LB_Max','BCID_Bins','BCID_Min','BCID_Max', - 'colTime_Bins','colTime_Min','colTime_Max','avgColTime_Bins','avgColTime_Min','avgColTime_Max', + 'colTime_BinWidth','colTime_Bins','colTime_Min','colTime_Max','avgColTime_BinWidth','avgColTime_Bins','avgColTime_Min','avgColTime_Max', + 'etaCaloNoise_Bins','etaCaloNoise_Max','etaCaloNoise_Min','etaCaloNoise_FcalBins','etaCaloNoise_FcalMax','etaCaloNoise_FcalMin', 'FEB_Feedthrough','FEB_Slot','FEB_Crates', 'FEB_N_channels','FEB_channels_Min','FEB_channels_Max', 'N_FEBErrors','FEBErrors', - 'N_FEB_Parttions_Max','N_Cells', 'N_FEB', 'N_Partitions','Partitions','N_Gains','Gains', + 'N_FEB_Parttions_Max','N_Cells', 'N_FEB', 'N_Partitions','N_Gains','Gains', + 'Feedthrough_Slot_Nbins','Feedthrough_Slot_range','Feedthrough_Slot_labels_Barrel','Feedthrough_Slot_labels_Endcap', + 'ROD_Crates','ROD_Slots','ROS_link', 'N_DigitsSummary','DigitsSummary', 'N_SubDet','SubDet','Samples_Bins','Samples_Min','Samples_Max', 'Energy_Bins','Energy_Min','Energy_Max', 'DSPEnergy_Bins', 'DSPEnergy_Min', 'DSPEnergy_Max', 'DSPTime_Bins', 'DSPTime_Min', 'DSPTime_Max', 'DSPQuality_Bins', 'DSPQuality_Min', 'DSPQuality_Max', 'DSP1Energy_Bins', 'DSP1Energy_Min', 'DSP1Energy_Max','DSPRanges_Bins', 'DSPRanges_Min', 'DSPRanges_Max', 'DSPRanges', 'DSPEonEoff_Bins','DSPEonEoff_Max', 'DSPTonToff_Bins','DSPTonToff_Max', 'DSPQonQoff_Bins','DSPQonQoff_Max', 'DSPThr_Bins', - 'Energy_Bins','Energy_Min','Energy_Max','L1Trig_Bins','L1Trig_Min','L1Trig_Max', + 'L1Trig_Bins','L1Trig_Min','L1Trig_Max', 'Evt_Bins','Evt_Min','Evt_Max','Evt_labels', - 'EvtRej_Bins','EvtRej_Min','EvtRej_Max','EvtRej_labels','EvtRejYield_labels', - 'L1Trig_Bins','L1Trig_Min','L1Trig_Max','rejBits_Bins', + 'EvtRej_Bins','EvtRej_Min','EvtRej_Max','EvtRej_labels','EvtRejYield_labels','rejBits_Bins', 'defaultStreamNames', - 'noisyFEB_Bins','noisyFEB_Max','noisyFEB_Min') + 'TotalNcell', + 'noisyFEB_Bins','noisyFEB_Max','noisyFEB_Min', +#'Sample_N_Min','Sample_N_Max', + 'Cell_Time_Min','Cell_Time_Max','Emin','Emax','DEmin','DEmax','Qmin','Qmax','DQmin','DQmax', + 'Tmin','Tmax','DTmin','DTmax','OnlineOffline','TTriggerTypeMax','MaxCellThresholdADC', + 'CorruptionSource','Streams', + 'Partitions','Sides','Variables','Layers','Cell_Variables') + lArDQGlobals = LArDQGlobals() @@ -59,12 +71,22 @@ lArDQGlobals.BCID_Bins=3564 lArDQGlobals.BCID_Min=0.5 lArDQGlobals.BCID_Max=lArDQGlobals.BCID_Min+lArDQGlobals.BCID_Bins #LArCollisionTime (A-C) ranges -lArDQGlobals.colTime_Bins=101 -lArDQGlobals.colTime_Min=-50.5 -lArDQGlobals.colTime_Max=50.5 -lArDQGlobals.avgColTime_Bins=320 -lArDQGlobals.avgColTime_Min=-40 -lArDQGlobals.avgColTime_Max=40 +lArDQGlobals.colTime_BinWidth = 0.25*Units.nanosecond +lArDQGlobals.colTime_Min=-50.5*Units.nanosecond +lArDQGlobals.colTime_Max=50.5*Units.nanosecond +lArDQGlobals.colTime_Bins=(int)((lArDQGlobals.colTime_Max-lArDQGlobals.colTime_Min)//lArDQGlobals.colTime_BinWidth) +lArDQGlobals.avgColTime_BinWidth = 0.25*Units.nanosecond +lArDQGlobals.avgColTime_Min=-40*Units.nanosecond +lArDQGlobals.avgColTime_Max=40*Units.nanosecond +lArDQGlobals.avgColTime_Bins=(int)((lArDQGlobals.avgColTime_Max-lArDQGlobals.avgColTime_Min)//lArDQGlobals.avgColTime_BinWidth) +#eta ranges for caloNoise +lArDQGlobals.etaCaloNoise_Bins=320 +lArDQGlobals.etaCaloNoise_Max=3.2 +lArDQGlobals.etaCaloNoise_Min=-3.2 +lArDQGlobals.etaCaloNoise_FcalBins=500 +lArDQGlobals.etaCaloNoise_FcalMax=5.0 +lArDQGlobals.etaCaloNoise_FcalMin=-5.0 + #FEB ranges lArDQGlobals.FEB_Feedthrough={"EMBA":[0,31],"EMBC":[0,31],"EMECA":[0,24],"EMECC":[0,24],"HECA":[0,24],"HECC":[0,24],"FCalA":[0,24],"FCalC":[0,24]} lArDQGlobals.FEB_Slot={"EMBA":[1,14],"EMBC":[1,14],"EMECA":[1,15],"EMECC":[1,15],"HECA":[1,15],"HECC":[1,15],"FCalA":[1,15],"FCalC":[1,15]} @@ -79,9 +101,27 @@ lArDQGlobals.N_FEB=1524 lArDQGlobals.N_FEB_Parttions_Max=500 lArDQGlobals.N_Cells=200000 +#feedthrough+slot ranges +lArDQGlobals.Feedthrough_Slot_Nbins={p : (lArDQGlobals.FEB_Feedthrough[p][1]+1)*lArDQGlobals.FEB_Slot[p][1] for p in lArDQGlobals.FEB_Feedthrough } +lArDQGlobals.Feedthrough_Slot_range={p : [lArDQGlobals.FEB_Feedthrough[p][0]*lArDQGlobals.FEB_Slot[p][1]+lArDQGlobals.FEB_Slot[p][0]-0.5,lArDQGlobals.FEB_Feedthrough[p][1]*lArDQGlobals.FEB_Slot[p][1]+lArDQGlobals.FEB_Slot[p][1]+0.5] for p in lArDQGlobals.FEB_Feedthrough } +lArDQGlobals.Feedthrough_Slot_labels_Barrel=[str(If) if Is==1 else '' for If in range(32) for Is in range(1,15)] +lArDQGlobals.Feedthrough_Slot_labels_Endcap=[str(If) if Is==1 else '' for If in range(25) for Is in range(1,16)] + + +#ROD ranges +lArDQGlobals.ROD_Crates={"EMBA":[1,4],"EMBC":[1,4],"EMECA":[1,3],"EMECC":[1,3],"HECA":[1],"HECC":[1],"FCalA":[1],"FCalC":[1]} +lArDQGlobals.ROD_Slots={"EMBA":[1,14],"EMBC":[1,14],"EMECA":[1,13],"EMECC":[1,13],"HECA":[1,6],"HECC":[1,6],"FCalA":[1,4],"FCalC":[1,4]} + +#ROS ranges +lArDQGlobals.ROS_link={"EMBA":[0,31],"EMBC":[0,31],"EMECA":[0,24],"EMECC":[0,24],"HECA":[0,24],"HECC":[0,24],"FCalA":[0,24],"FCalC":[0,24]} + #FEB errors lArDQGlobals.N_FEBErrors=13 lArDQGlobals.FEBErrors=["Parity","BCID","Sample Header","EVTID","SCAC status","Sca out of range","Gain mismatch","Type mismatch","# of samples","Empty data block","Checksum / block size","Missing header","Bad gain"] + +#number of cells +lArDQGlobals.TotalNcell=182468 + #partitions lArDQGlobals.N_Partitions=8 lArDQGlobals.Partitions=["EMBC","EMBA","EMECC","EMECA","HECC","HECA","FCalC","FCalA"] @@ -99,11 +139,50 @@ lArDQGlobals.Samples_Bins=32 lArDQGlobals.Samples_Min=-0.5 lArDQGlobals.Samples_Max=lArDQGlobals.Samples_Bins-0.5 +#Samples +#check if any algo uses this lArDQGlobals.Sample_N_Min=0 +#check if any algo uses this lArDQGlobals.Sample_N_Max=32 + +#Cell time (in ns) +lArDQGlobals.Cell_Time_Min=-200 +lArDQGlobals.Cell_Time_Max=200 + +#Energies ranges +lArDQGlobals.Emin=-20000.0 +lArDQGlobals.Emax=20000.0 + +#Difference Energies +lArDQGlobals.DEmin=-512 +lArDQGlobals.DEmax=512 + +#Qfactor range +lArDQGlobals.Qmin=0 +lArDQGlobals.Qmax=6553 + +#Differences Q factor +lArDQGlobals.DQmin=-3000 +lArDQGlobals.DQmax=1000 + +#Time ranges (ps) +lArDQGlobals.Tmin=-80000 +lArDQGlobals.Tmax=80000 + +#Time ranges (ps) +lArDQGlobals.Tmin=-80000 +lArDQGlobals.Tmax=80000 + +#Diff Time ranges (ps) +lArDQGlobals.DTmin=-800 +lArDQGlobals.DTmax=800 + #ADC energy range lArDQGlobals.Energy_Bins=300 lArDQGlobals.Energy_Min=0. lArDQGlobals.Energy_Max=3000. +#Cell threshold ADC counts +lArDQGlobals.MaxCellThresholdADC=1900 + #DSP diff lArDQGlobals.DSPEnergy_Bins=400 lArDQGlobals.DSPEnergy_Min=-40. @@ -134,6 +213,12 @@ lArDQGlobals.L1Trig_Bins=256 lArDQGlobals.L1Trig_Min=-0.5 lArDQGlobals.L1Trig_Max=lArDQGlobals.L1Trig_Bins-0.5 +#triggerWord +lArDQGlobals.TTriggerTypeMax=256 + +#Corruption errors +lArDQGlobals.CorruptionSource=["Parity","BCID Mismatch","Sample header","EVT ID","SCAC status","Sca out of range","Gain mismatch","Type mismatch","# of samples","Empty data block","Checksum /block size","Missing header","Bad gain"] + #Event types histo lArDQGlobals.Evt_Bins = 15 lArDQGlobals.Evt_Min = -0.5 @@ -154,3 +239,113 @@ lArDQGlobals.noisyFEB_Bins=51 lArDQGlobals.noisyFEB_Min=-0.5 lArDQGlobals.noisyFEB_Max=50.5 +#Collision time range +#check if anyone needs this lArDQGlobals.CollTimeRange=[-50,50] + + + +#Gains +lArDQGlobals.Gains=["Low Gain","Medium Gain","High Gain"] + +#Creation of the dictionnary +lArDQGlobals.Cell_Variables={} +lArDQGlobals.Sides=["A","C"] +lArDQGlobals.Variables=["etaRange","phiRange","etaNbin", "phiNbin","etasize","etaCellSize","etaMin"] +lArDQGlobals.Layers=["0","1","2","3"] +for Variable in lArDQGlobals.Variables : + lArDQGlobals.Cell_Variables[Variable]={} + for sdet in lArDQGlobals.SubDet : + lArDQGlobals.Cell_Variables[Variable][sdet]={} + for Side in lArDQGlobals.Sides : + lArDQGlobals.Cell_Variables[Variable][sdet][Side]={} + for Layer in lArDQGlobals.Layers: + lArDQGlobals.Cell_Variables[Variable][sdet][Side][Layer]=list() + +#Number of Bins in phi +lArDQGlobals.Cell_Variables["phiNbin"]["EMB"]["A"]= {"0":64,"1":256,"2":256,"3":256} +lArDQGlobals.Cell_Variables["phiNbin"]["EMB"]["C"]= lArDQGlobals.Cell_Variables["phiNbin"]["EMB"]["A"] + +lArDQGlobals.Cell_Variables["phiNbin"]["EMEC"]["A"]= {"0":64,"1":64,"2":256,"3":256} +lArDQGlobals.Cell_Variables["phiNbin"]["EMEC"]["C"]= lArDQGlobals.Cell_Variables["phiNbin"]["EMEC"]["A"] + +lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]= {"0":64,"1":64,"2":64,"3":64} +lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["C"]= lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"] + +lArDQGlobals.Cell_Variables["phiNbin"]["FCal"]["A"]= {"1":16,"2":16,"3":16} +lArDQGlobals.Cell_Variables["phiNbin"]["FCal"]["C"]= lArDQGlobals.Cell_Variables["phiNbin"]["FCal"]["A"] + + +#Number of bins in eta in each range of cells (defining only for A side since C side is symmetric) +#To be read as follow : +#The EMB Layer 1 have 3 types of cell sizes +#The first bin start at eta=0.0, and have a size of 0.025/4 +#The bins [2;446], have a size of 0.025/8 +#The bins [447;450, have a size of 0.025 + +lArDQGlobals.Cell_Variables["etaNbin"]["EMB"]["A"]= {"0":[0,61],"1":[0,1,446,450],"2":[0,56,57],"3":[0,27]} +lArDQGlobals.Cell_Variables["etaMin" ]["EMB"]["A"]= {"0":0.0,"1":0.0,"2":0.0,"3":0.0} +lArDQGlobals.Cell_Variables["etaCellSize"]["EMB"]["A"]={"0":[0.025],"1":[0.025/4,0.025/8,0.025],"2":[0.025,0.05],"3":[0.05]} + +lArDQGlobals.Cell_Variables["etaNbin"]["EMEC"]["A"]= {"0":[0,12],"1":[0,1,3,99,147,211,215,223],"2":[0,1,43,51],"3":[0,20]} +lArDQGlobals.Cell_Variables["etaMin" ]["EMEC"]["A"]= {"0":1.5,"1":1.375,"2":1.375,"3":1.5} +lArDQGlobals.Cell_Variables["etaCellSize"]["EMEC"]["A"]={"0":[0.025],"1":[0.05,0.025,0.025/8,0.025/6,0.025/4,0.025,0.1],"2":[0.05,0.025,0.1],"3":[0.05]} + +lArDQGlobals.Cell_Variables["etaNbin"]["HEC"]["A"]= {"0":[0,10,14],"1":[0,10,13],"2":[0,9,12],"3":[0,8,12]} +lArDQGlobals.Cell_Variables["etaMin" ]["HEC"]["A"]= {"0":1.5,"1":1.5,"2":1.6,"3":1.7} +lArDQGlobals.Cell_Variables["etaCellSize"]["HEC"]["A"]={"0":[0.1,0.2],"1":[0.1,0.2],"2":[0.1,0.2],"3":[0.1,0.2]} + +lArDQGlobals.Cell_Variables["etaNbin"]["FCal"]["A"]= {"1":[0,63],"2":[0,32],"3":[0,16]} +lArDQGlobals.Cell_Variables["etaMin" ]["FCal"]["A"]= {"1":-0.5,"2":-0.5,"3":-0.5} +lArDQGlobals.Cell_Variables["etaCellSize"]["FCal"]["A"]={"1":[1],"2":[1],"3":[1]} + + +################### +#Filling Phi ranges +for Layer in lArDQGlobals.Layers : + for sdet in lArDQGlobals.SubDet: + if sdet=="FCal": + if Layer=="0": #there's only fcal1, fcal2 and fcal3 + continue + else: + lArDQGlobals.Cell_Variables["phiRange"][sdet]["A"][Layer]=[-0.5+x for x in xrange(lArDQGlobals.Cell_Variables["phiNbin"][sdet]["A"][Layer]+1)] + lArDQGlobals.Cell_Variables["phiRange"][sdet]["C"]=lArDQGlobals.Cell_Variables["phiRange"][sdet]["A"] + else: #all other partitions + lArDQGlobals.Cell_Variables["phiRange"][sdet]["A"][Layer]=[-TMath.Pi()+ x*2*TMath.Pi()/lArDQGlobals.Cell_Variables["phiNbin"][sdet]["A"][Layer] for x in xrange(lArDQGlobals.Cell_Variables["phiNbin"][sdet]["A"][Layer]+1)] + lArDQGlobals.Cell_Variables["phiRange"][sdet]["C"]=lArDQGlobals.Cell_Variables["phiRange"][sdet]["A"] + pass + pass #partition loop + pass #layer loop + +################### +#Filling Eta range + +for sdet in lArDQGlobals.SubDet: + for Lay in lArDQGlobals.Layers: + if sdet=="FCal" and Lay=="0": + continue + Ranges=lArDQGlobals.Cell_Variables["etaNbin"][sdet]["A"][Lay] + Sizes=lArDQGlobals.Cell_Variables["etaCellSize"][sdet]["A"][Lay] + if not len(Ranges)-len(Sizes)==1 : + print("Bad list of ranges and size please check") + continue + #exit(1) + etamin=lArDQGlobals.Cell_Variables["etaMin"][sdet]["A"][Lay] + currange=[etamin] + for k in xrange(len(Ranges)-1) : + currange+=[round(currange[-1] + x * Sizes[k],5) for x in xrange(1,Ranges[k+1]-Ranges[k]+1)] + + lArDQGlobals.Cell_Variables["etaRange"][sdet]["A"][Lay]=currange + #The C side is just the symmeteric of the A side + if sdet=="FCal": + lArDQGlobals.Cell_Variables["etaRange"][sdet]["C"][Lay] = lArDQGlobals.Cell_Variables["etaRange"][sdet]["A"][Lay] + else: #all other partitions + lArDQGlobals.Cell_Variables["etaRange"][sdet]["C"][Lay] =map(lambda x: x*-1,lArDQGlobals.Cell_Variables["etaRange"][sdet]["A"][Lay])[::-1] + + + +#if __name__=='__main__': + # for subdet in range(0,lArDQGlobals.N_SubDet): + # ft_low = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][0] - 0.5 + # ft_up = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][1] + 0.5 + # ft_n = int(ft_up - ft_low) + # print(ft_low, " ", ft_up, " ", ft_n) diff --git a/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py b/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py index 069ed54543e4addf643b2981ae1088d552ea59a2..147192d036f69b345ca31f1d79b0de87cb037239 100644 --- a/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py @@ -1,22 +1,17 @@ # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # + def LArAffectedRegionsConfig(inputFlags): '''Function to configures some algorithms in the monitoring system.''' from AthenaMonitoring import AthMonitorCfgHelper helper = AthMonitorCfgHelper(inputFlags,'LArAffectedRegionsCfg') - from LArGeoAlgsNV.LArGMConfig import LArGMCfg - acc = LArGMCfg(inputFlags) - from TileGeoModel.TileGMConfig import TileGMCfg - acc.merge(TileGMCfg(inputFlags)) - from LArCalibUtils.LArHVScaleConfig import LArHVScaleCfg - acc.merge(LArHVScaleCfg(inputFlags)) - from AthenaConfiguration.ComponentFactory import CompFactory - larAffectedRegAlg = helper.addAlgorithm(CompFactory.LArAffectedRegionsAlg,'larAffectedRegAlg') + from LArMonitoring.LArMonitoringConf import LArAffectedRegionsAlg + larAffectedRegAlg = helper.addAlgorithm(LArAffectedRegionsAlg,'larAffectedRegAlg') #define the group names here, as you'll use them multiple times affectedRegGroupName="LArAffectedRegionsMonGroup" @@ -37,7 +32,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupEMBPS = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupEMBPS.defineHistogram('etaPOS,phi;LArAffectedRegionsEMBAPS', @@ -46,7 +42,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_EMB["EMBAPS"][0],xmin=lArDQGlobals.HVeta_EMB["EMBAPS"][1],xmax=lArDQGlobals.HVeta_EMB["EMBAPS"][2], - ybins=lArDQGlobals.HVphi_EMB["EMBAPS"][0],ymin=lArDQGlobals.HVphi_EMB["EMBAPS"][1],ymax=lArDQGlobals.HVphi_EMB["EMBAPS"][2] + ybins=lArDQGlobals.HVphi_EMB["EMBAPS"][0],ymin=lArDQGlobals.HVphi_EMB["EMBAPS"][1],ymax=lArDQGlobals.HVphi_EMB["EMBAPS"][2], + merge='weightedAverage' ) affectedRegGroupEMBPS.defineHistogram('etaNEG,phi;LArAffectedRegionsEMBCPS', title='HV Affected Regions - EMBC - Presampler;#eta;#phi', @@ -54,8 +51,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_EMB["EMBCPS"][0],xmin=lArDQGlobals.HVeta_EMB["EMBCPS"][1],xmax=lArDQGlobals.HVeta_EMB["EMBCPS"][2], - ybins=lArDQGlobals.HVphi_EMB["EMBCPS"][0],ymin=lArDQGlobals.HVphi_EMB["EMBCPS"][1],ymax=lArDQGlobals.HVphi_EMB["EMBCPS"][2] - + ybins=lArDQGlobals.HVphi_EMB["EMBCPS"][0],ymin=lArDQGlobals.HVphi_EMB["EMBCPS"][1],ymax=lArDQGlobals.HVphi_EMB["EMBCPS"][2], + merge='weightedAverage' ) @@ -65,7 +62,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupEMB = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupEMB.defineHistogram('etaPOS,phi;LArAffectedRegionsEMBA', @@ -74,8 +72,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_EMB["EMBA"][0],xmin=lArDQGlobals.HVeta_EMB["EMBA"][1],xmax=lArDQGlobals.HVeta_EMB["EMBA"][2], - ybins=lArDQGlobals.HVphi_EMB["EMBA"][0],ymin=lArDQGlobals.HVphi_EMB["EMBA"][1],ymax=lArDQGlobals.HVphi_EMB["EMBA"][2] - + ybins=lArDQGlobals.HVphi_EMB["EMBA"][0],ymin=lArDQGlobals.HVphi_EMB["EMBA"][1],ymax=lArDQGlobals.HVphi_EMB["EMBA"][2], + merge='weightedAverage' ) affectedRegGroupEMB.defineHistogram('etaNEG,phi;LArAffectedRegionsEMBC', title='HV Affected Regions - EMBC - Samplings 1-3;#eta;#phi', @@ -83,7 +81,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_EMB["EMBC"][0],xmin=lArDQGlobals.HVeta_EMB["EMBC"][1],xmax=lArDQGlobals.HVeta_EMB["EMBC"][2], - ybins=lArDQGlobals.HVphi_EMB["EMBC"][0],ymin=lArDQGlobals.HVphi_EMB["EMBC"][1],ymax=lArDQGlobals.HVphi_EMB["EMBC"][2] + ybins=lArDQGlobals.HVphi_EMB["EMBC"][0],ymin=lArDQGlobals.HVphi_EMB["EMBC"][1],ymax=lArDQGlobals.HVphi_EMB["EMBC"][2], + merge='weightedAverage' ) @@ -93,7 +92,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupEMECPS = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupEMECPS.defineHistogram('etaPOS,phi;LArAffectedRegionsEMECAPS', @@ -102,7 +102,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_EMEC["EMECAPS"], - ybins=lArDQGlobals.HVphi_EMEC["EMECAPS"] + ybins=lArDQGlobals.HVphi_EMEC["EMECAPS"], + merge='weightedAverage' ) affectedRegGroupEMECPS.defineHistogram('etaNEG,phi;LArAffectedRegionsEMECCPS', title='HV Affected Regions - EMECC - Presampler;#eta;#phi', @@ -110,7 +111,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_EMEC["EMECCPS"], - ybins=lArDQGlobals.HVphi_EMEC["EMECCPS"] + ybins=lArDQGlobals.HVphi_EMEC["EMECCPS"], + merge='weightedAverage' ) @@ -120,7 +122,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupEMEC = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupEMEC.defineHistogram('etaPOS,phi;LArAffectedRegionsEMECA', @@ -129,7 +132,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_EMEC["EMECA"], - ybins=lArDQGlobals.HVphi_EMEC["EMECA"] + ybins=lArDQGlobals.HVphi_EMEC["EMECA"], + merge='weightedAverage' ) affectedRegGroupEMEC.defineHistogram('etaNEG,phi;LArAffectedRegionsEMECC', title='HV Affected Regions - EMECC - Samplings 1-3;#eta;#phi', @@ -137,7 +141,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_EMEC["EMECC"], - ybins=lArDQGlobals.HVphi_EMEC["EMECC"] + ybins=lArDQGlobals.HVphi_EMEC["EMECC"], + merge='weightedAverage' ) @@ -147,7 +152,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupHEC0 = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupHEC0.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA0', @@ -156,7 +162,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2], - ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2] + ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2], + merge='weightedAverage' ) affectedRegGroupHEC0.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC0', title='HV Affected Regions - HECC - Layer 1;#eta;#phi', @@ -164,7 +171,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2], - ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2] + ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2], + merge='weightedAverage' ) #HEC1 @@ -173,7 +181,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupHEC1 = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupHEC1.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA1', @@ -182,7 +191,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2], - ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2] + ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2], + merge='weightedAverage' ) affectedRegGroupHEC1.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC1', title='HV Affected Regions - HECC - Layer 2;#eta;#phi', @@ -190,7 +200,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2], - ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2] + ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2], + merge='weightedAverage' ) #HEC2 @@ -199,7 +210,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupHEC2 = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupHEC2.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA2', @@ -208,7 +220,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2], - ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2] + ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2], + merge='weightedAverage' ) affectedRegGroupHEC2.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC2', title='HV Affected Regions - HECC - Layer 3;#eta;#phi', @@ -216,7 +229,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2], - ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2] + ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2], + merge='weightedAverage' ) #HEC3 @@ -225,7 +239,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupHEC3 = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupHEC3.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA3', @@ -234,7 +249,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2], - ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2] + ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2], + merge='weightedAverage' ) affectedRegGroupHEC3.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC3', title='HV Affected Regions - HECC - Layer 4;#eta;#phi', @@ -242,7 +258,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2], - ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2] + ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2], + merge='weightedAverage' ) #FCAL0 @@ -251,7 +268,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupFCAL0 = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupFCAL0.defineHistogram('etaPOS,phi;LArAffectedRegionsFCALA0', @@ -260,7 +278,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["FCalA"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalA"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalA"][2], - ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2] + ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2], + merge='weightedAverage' ) affectedRegGroupFCAL0.defineHistogram('etaNEG,phi;LArAffectedRegionsFCALC0', title='HV Affected Regions - FCALC - Layer 1;#eta;#phi', @@ -268,7 +287,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["FCalC"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalC"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalC"][2], - ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2] + ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2], + merge='weightedAverage' ) #FCAL1 @@ -277,7 +297,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupFCAL1 = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupFCAL1.defineHistogram('etaPOS,phi;LArAffectedRegionsFCALA1', @@ -286,7 +307,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["FCalA"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalA"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalA"][2], - ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2] + ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2], + merge='weightedAverage' ) affectedRegGroupFCAL1.defineHistogram('etaNEG,phi;LArAffectedRegionsFCALC1', title='HV Affected Regions - FCALC - Layer 2;#eta;#phi', @@ -294,8 +316,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["FCalC"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalC"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalC"][2], - ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2] - + ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2], + merge='weightedAverage' ) #FCAL2 @@ -304,7 +326,8 @@ def LArAffectedRegionsConfig(inputFlags): affectedRegGroupFCAL2 = helper.addGroup( larAffectedRegAlg, affectedRegGroupName+group_name_ending, - '/LAr/' + '/LAr/', + 'run' ) affectedRegGroupFCAL2.defineHistogram('etaPOS,phi;LArAffectedRegionsFCALA2', @@ -313,7 +336,8 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["FCalA"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalA"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalA"][2], - ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2] + ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2], + merge='weightedAverage' ) affectedRegGroupFCAL2.defineHistogram('etaNEG,phi;LArAffectedRegionsFCALC2', title='HV Affected Regions - FCALC - Layer 3;#eta;#phi', @@ -321,16 +345,14 @@ def LArAffectedRegionsConfig(inputFlags): path=larAffReg_hist_path, weight='problem', xbins=lArDQGlobals.HVeta_HECFcal["FCalC"][0],xmin=lArDQGlobals.HVeta_HECFcal["FCalC"][1],xmax=lArDQGlobals.HVeta_HECFcal["FCalC"][2], - ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2] + ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2], + merge='weightedAverage' ) - + return helper.result() - acc.merge(helper.result()) - return acc - if __name__=='__main__': @@ -345,21 +367,31 @@ if __name__=='__main__': # Set the Athena configuration flags from AthenaConfiguration.AllConfigFlags import ConfigFlags - nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/' - file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1' - ConfigFlags.Input.Files = [nightly+file] - ConfigFlags.Input.isMC = False + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() + + from AthenaConfiguration.TestDefaults import defaultTestFiles + ConfigFlags.Input.Files = defaultTestFiles.RAW + ConfigFlags.Output.HISTFileName = 'LArAffectedRegionsOutput.root' + ConfigFlags.DQ.enableLumiAccess = False + ConfigFlags.DQ.useTrigger = False + ConfigFlags.Beam.Type = 'collisions' ConfigFlags.lock() - # Initialize configuration object, add accumulator, merge, and run. - from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg - from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - cfg = MainServicesSerialCfg() - cfg.merge(PoolReadCfg(ConfigFlags)) -# larAffectedRegionsAcc, larAffectedRegionsAlg = LArAffectedRegionsConfig(ConfigFlags) - cfg.merge(LArAffectedRegionsConfig(ConfigFlags)) + from CaloRec.CaloRecoConfig import CaloRecoCfg + cfg=CaloRecoCfg(ConfigFlags) + + #add affected regions + affregmon = LArAffectedRegionsConfig(ConfigFlags) + cfg.merge(affregmon) + + ConfigFlags.dump() + f=open("AffectedRegionsMonMaker.pkl","w") + cfg.store(f) + f.close() + - Nevents=10 - cfg.run(Nevents) #use cfg.run() to run on all events +# Nevents=10 +# cfg.run(Nevents) #use cfg.run() to run on all events diff --git a/LArCalorimeter/LArMonitoring/python/LArCollisionTimeMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArCollisionTimeMonAlg.py index a2b7806dbf572d1d0f65528f7a91f6f9ce808239..4598fd1bfa198f2b937abc29bf0c824f7b7e8c1e 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCollisionTimeMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCollisionTimeMonAlg.py @@ -5,15 +5,17 @@ def LArCollisionTimeMonConfigOld(inputFlags): from AthenaMonitoring import AthMonitorCfgHelperOld from LArMonitoring.LArMonitoringConf import LArCollisionTimeMonAlg + #from AthenaCommon.GlobalFlags import globalflags helper = AthMonitorCfgHelperOld(inputFlags, 'LArCollisionTimeMonAlgCfg') LArCollisionTimeMonConfigCore(helper, LArCollisionTimeMonAlg,inputFlags) return helper.result() -def LArCollisisonTimeMonConfig(inputFlags): +def LArCollisionTimeMonConfig(inputFlags): '''Function to configures some algorithms in the monitoring system.''' - # The following class will make a sequence, configure algorithms, and link # them to GenericMonitoringTools + # The following class will make a sequence, configure algorithms, and link + # them to GenericMonitoringTools from AthenaMonitoring import AthMonitorCfgHelper helper = AthMonitorCfgHelper(inputFlags,'LArCollisionTimeMonCfg') @@ -24,8 +26,14 @@ def LArCollisisonTimeMonConfig(inputFlags): def LArCollisionTimeMonConfigCore(helper, algoinstance,inputFlags): + #from AthenaMonitoring import AthMonitorCfgHelper + #helper = AthMonitorCfgHelper(inputFlags,'LArCollisionTimeMonCfg') + + + #from LArMonitoring.LArMonitoringConf import LArCollisionTimeMonAlg larCollTimeMonAlg = helper.addAlgorithm(algoinstance,'larCollTimeMonAlg') + collTimeGroupName="LArCollisionTimeMonGroup" larCollTimeMonAlg.CollTimeGroupName=collTimeGroupName @@ -141,11 +149,11 @@ def LArCollisionTimeMonConfigCore(helper, algoinstance,inputFlags): ) larCollTimeMonAlg.InTrain_CollTimeGroupName=collTimeGroupName_intrain #pass the group name to the algorithm, this way you let the algorithm now that this group has been defined (won't be filled otherwise) - intrain_title=" inside the train" + intrain_tit=" inside the train" intrain_name="_intrain" collTimeGroup_intrain.defineHistogram('ecTimeDiff;LArCollTime'+intrain_name, - title='LArCollisionTime - difference of avg time from ECC and ECA'+intrain_title+';<t_{C}> - <t_{A}> ('+timeUnitName+(');Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.colTime_BinWidth/timeUnit))+timeUnitName, + title='LArCollisionTime - difference of avg time from ECC and ECA'+intrain_tit+';<t_{C}> - <t_{A}> ('+timeUnitName+(');Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.colTime_BinWidth/timeUnit))+timeUnitName, type='Th1F', path=larColTime_hist_path, weight='weight', @@ -153,7 +161,7 @@ def LArCollisionTimeMonConfigCore(helper, algoinstance,inputFlags): collTimeGroup_intrain.defineHistogram('ecTimeAvg;LArCollAvgTime'+intrain_name, - title='LArCollisionAverageTime - avg time of ECC and ECA'+intrain_title+';(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+(');Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.avgColTime_BinWidth/timeUnit))+timeUnitName, + title='LArCollisionAverageTime - avg time of ECC and ECA'+intrain_tit+';(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+(');Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.avgColTime_BinWidth/timeUnit))+timeUnitName, type='Th1F', path=larColTime_hist_path, weight='weight', @@ -161,7 +169,7 @@ def LArCollisionTimeMonConfigCore(helper, algoinstance,inputFlags): collTimeGroup_intrain.defineHistogram('ecTimeDiff;LArCollTimeLumiBlock'+intrain_name, - title='LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> ('+timeUnitName+')'+intrain_title+(';Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.colTime_BinWidth/timeUnit))+timeUnitName, + title='LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> ('+timeUnitName+')'+intrain_tit+(';Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.colTime_BinWidth/timeUnit))+timeUnitName, type='Th1F', path=larColTime_hist_path, weight='weight', @@ -171,14 +179,14 @@ def LArCollisionTimeMonConfigCore(helper, algoinstance,inputFlags): collTimeGroup_intrain.defineHistogram('(lumi_block_timeWindow);LArCollTimeLumiBlockTimeCut'+intrain_name, - title='Events with abs(<t_{C}> - <t_{A}>) < 10ns as a function of LB'+intrain_title+';Luminosity Block Number;Number of events per LB', + title='Events with abs(<t_{C}> - <t_{A}>) < 10ns as a function of LB'+intrain_tit+';Luminosity Block Number;Number of events per LB', path=larColTime_hist_path, weight='weight', xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max) collTimeGroup_intrain.defineHistogram('(lumi_block_singleBeam_timeWindow);LArCollTimeLumiBlockSingleBeamTimeCut'+intrain_name, - title='Events with 20 ns < abs(<t_{C}> - <t_{A}>) < 30ns as a function of LB'+intrain_title+';Luminosity Block Number;Number of events per LB', + title='Events with 20 ns < abs(<t_{C}> - <t_{A}>) < 30ns as a function of LB'+intrain_tit+';Luminosity Block Number;Number of events per LB', type='Th1F', path=larColTime_hist_path, weight='weight', @@ -186,7 +194,7 @@ def LArCollisionTimeMonConfigCore(helper, algoinstance,inputFlags): collTimeGroup_intrain.defineHistogram('lumi_block,ecTimeDiff;LArCollTime_vs_LB'+intrain_name, - title='LArCollisionTime Vs Luminosity Block - difference of avg time of ECC and ECA as a function of luminosity block;Luminosity Block Number'+intrain_title+';<t_{C}> - <t_{A}> ('+timeUnitName+');Number of events (weighted by energy/GeV)', + title='LArCollisionTime Vs Luminosity Block - difference of avg time of ECC and ECA as a function of luminosity block;Luminosity Block Number'+intrain_tit+';<t_{C}> - <t_{A}> ('+timeUnitName+');Number of events (weighted by energy/GeV)', type='TH2F', path=larColTime_hist_path, weight='weight', @@ -195,7 +203,7 @@ def LArCollisionTimeMonConfigCore(helper, algoinstance,inputFlags): collTimeGroup_intrain.defineHistogram('bunch_crossing_id,ecTimeDiff;LArCollTime_vs_BCID'+intrain_name, - title='LArCollisionTime Vs BCID - difference of avg time of ECC and ECA as a function of BCID'+intrain_title+';Bunch Crossing Number;<t_{C}> - <t_{A}> ('+timeUnitName+');Number of events (weighted by energy/GeV)', + title='LArCollisionTime Vs BCID - difference of avg time of ECC and ECA as a function of BCID'+intrain_tit+';Bunch Crossing Number;<t_{C}> - <t_{A}> ('+timeUnitName+');Number of events (weighted by energy/GeV)', type='TH2F', path=larColTime_hist_path, weight='weight', @@ -203,7 +211,7 @@ def LArCollisionTimeMonConfigCore(helper, algoinstance,inputFlags): ybins=lArDQGlobals.colTime_Bins,ymin=lArDQGlobals.colTime_Min/timeUnit,ymax=lArDQGlobals.colTime_Max/timeUnit) collTimeGroup_intrain.defineHistogram('lumi_block,ecTimeAvg;LArCollAvgTime_vs_LB'+intrain_name, - title='LArCollisionAvgTime Vs Luminosity Block - avg time of ECC and ECA as a function of luminosity block'+intrain_title+';Luminosity Block Number;(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+');Number of events (weighted by energy/GeV)', + title='LArCollisionAvgTime Vs Luminosity Block - avg time of ECC and ECA as a function of luminosity block'+intrain_tit+';Luminosity Block Number;(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+');Number of events (weighted by energy/GeV)', type='TH2F', path=larColTime_hist_path, weight='weight', @@ -211,7 +219,7 @@ def LArCollisionTimeMonConfigCore(helper, algoinstance,inputFlags): ybins=lArDQGlobals.avgColTime_Bins,ymin=lArDQGlobals.avgColTime_Min/timeUnit,ymax=lArDQGlobals.avgColTime_Max/timeUnit) collTimeGroup_intrain.defineHistogram('bunch_crossing_id,ecTimeAvg;LArCollAvgTime_vs_BCID'+intrain_name, - title='LArCollisionAvgTime Vs BCID - avg time of ECC and ECA as a function of BCID'+intrain_title+';Bunch Crossing Number;(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+');Number of events (weighted by energy/GeV)', + title='LArCollisionAvgTime Vs BCID - avg time of ECC and ECA as a function of BCID'+intrain_tit+';Bunch Crossing Number;(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+');Number of events (weighted by energy/GeV)', type='TH2F', path=larColTime_hist_path, weight='weight', diff --git a/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py b/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py new file mode 100644 index 0000000000000000000000000000000000000000..78b63eddab8557bc28740bf90d9bbb535352cd94 --- /dev/null +++ b/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py @@ -0,0 +1,493 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +'''@file LArCoverageAlg +@author M. Spalla +@date 2019-07-24 +@brief Adapted from ExampleLArMonitorAlgorithm.py by C. D. Burton and P. Onyisi +''' +def LArCoverageConfigOld(inputFlags): + from AthenaMonitoring import AthMonitorCfgHelperOld + from LArMonitoring.LArMonitoringConf import LArCoverageAlg + #from AthenaCommon.GlobalFlags import globalflags + + helper = AthMonitorCfgHelperOld(inputFlags, 'LArCoverageAlgCfg') + LArCoverageConfigCore(helper, LArCoverageAlg,inputFlags) + + return helper.result() + +def LArCoverageConfig(inputFlags): + '''Function to configures some algorithms in the monitoring system.''' + + # The following class will make a sequence, configure algorithms, and link + # them to GenericMonitoringTools + from AthenaMonitoring import AthMonitorCfgHelper + helper = AthMonitorCfgHelper(inputFlags,'LArCoverageCfg') + + from AthenaConfiguration.ComponentFactory import CompFactory + LArCoverageConfigCore(helper, CompFactory.LArCoverageAlg,inputFlags) + + return helper.result() + +def LArCoverageConfigCore(helper, algoinstance,inputFlags): + + larCoverageAlg = helper.addAlgorithm(algoinstance,'LArCoverageAlg') + + from LArMonitoring.GlobalVariables import lArDQGlobals + + #define the group names here, as you'll use them multiple times + caloNoiseToolGroupName="CaloNoise" + nLayers = 4 + badChannelsGroupName="BadChannels" + coverageHWGroupName="Coverage" + partitionsBarrel = [lArDQGlobals.SubDet[0]+side for side in lArDQGlobals.Sides] + partitionsEndcap = [lArDQGlobals.SubDet[ip]+side for side in lArDQGlobals.Sides for ip in range(1,len(lArDQGlobals.SubDet))] + + # Edit properties of a algorithm + larCoverageAlg.CaloNoiseToolGroupName=caloNoiseToolGroupName + larCoverageAlg.Nsample = nLayers + larCoverageAlg.BadChannelsGroupName=badChannelsGroupName + larCoverageAlg.Sides = lArDQGlobals.Sides + larCoverageAlg.CoverageHWGroupName=coverageHWGroupName + larCoverageAlg.CoverageBarrelPartitions = partitionsBarrel + larCoverageAlg.CoverageEndcapPartitions = partitionsEndcap + larCoverageAlg.NphiBinsEMB1=lArDQGlobals.Cell_Variables["phiNbin"]["EMB"]["A"]["1"] + larCoverageAlg.NphiBinsEMEC2=lArDQGlobals.Cell_Variables["phiNbin"]["EMEC"]["A"]["2"] + larCoverageAlg.NphiBinsHEC=[lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["0"],lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["1"],lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["2"],lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["3"]] + + + # adding BadChan masker private tool + + + #Configure the CaloNoise + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + CaloNoiseCondAlg(noisetype="electronicNoise") + + #-- caloNoise groups -- + caloNoiseToolArrayEM = helper.addArray([nLayers],larCoverageAlg,caloNoiseToolGroupName+"EM") + caloNoiseToolArrayHEC = helper.addArray([nLayers],larCoverageAlg,caloNoiseToolGroupName+"HEC") + caloNoiseToolArrayFCAL = helper.addArray([nLayers],larCoverageAlg,caloNoiseToolGroupName+"FCAL") + caloNoiseToolGroup = helper.addGroup( #for the LB histogram + larCoverageAlg, + caloNoiseToolGroupName, + '/LAr/', + 'run' + ) + + + #-- badChannels groups -- + + #badChannelToolArrayBarrel = helper.addArray([lArDQGlobals.Sides],larCoverageAlg,badChannelsGroupName,'/LAr/','lb') + #badChannelToolArrayEndcap = helper.addArray([lArDQGlobals.Sides],larCoverageAlg,badChannelsGroupName,'/LAr/','lb') + + #-- CoverageHW groups -- + coverageHWToolArrayBarrel = helper.addArray([partitionsBarrel],larCoverageAlg,coverageHWGroupName,'/LAr/','run') + coverageHWToolArrayEndcap = helper.addArray([partitionsEndcap],larCoverageAlg,coverageHWGroupName,'/LAr/','run') + + #-- Coverage groups (eta-phi plots) -- + coverageGroupEMBA0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBA0','/LAr/','run') + coverageGroupEMBA1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBA1','/LAr/','run') + coverageGroupEMBA2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBA2','/LAr/','run') + coverageGroupEMBA3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBA3','/LAr/','run') + coverageGroupEMBC0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBC0','/LAr/','run') + coverageGroupEMBC1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBC1','/LAr/','run') + coverageGroupEMBC2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBC2','/LAr/','run') + coverageGroupEMBC3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMBC3','/LAr/','run') + coverageGroupEMECA0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECA0','/LAr/','run') + coverageGroupEMECA1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECA1','/LAr/','run') + coverageGroupEMECA2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECA2','/LAr/','run') + coverageGroupEMECA3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECA3','/LAr/','run') + coverageGroupEMECC0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECC0','/LAr/','run') + coverageGroupEMECC1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECC1','/LAr/','run') + coverageGroupEMECC2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECC2','/LAr/','run') + coverageGroupEMECC3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'EMECC3','/LAr/','run') + coverageGroupHECA0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECA0','/LAr/','run') + coverageGroupHECA1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECA1','/LAr/','run') + coverageGroupHECA2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECA2','/LAr/','run') + coverageGroupHECA3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECA3','/LAr/','run') + coverageGroupHECC0 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECC0','/LAr/','run') + coverageGroupHECC1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECC1','/LAr/','run') + coverageGroupHECC2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECC2','/LAr/','run') + coverageGroupHECC3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'HECC3','/LAr/','run') + coverageGroupFCalA1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalA1','/LAr/','run') + coverageGroupFCalA2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalA2','/LAr/','run') + coverageGroupFCalA3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalA3','/LAr/','run') + coverageGroupFCalC1 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalC1','/LAr/','run') + coverageGroupFCalC2 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalC2','/LAr/','run') + coverageGroupFCalC3 = helper.addGroup(larCoverageAlg,coverageHWGroupName+'FCalC3','/LAr/','run') + + + ### Configure histograms + + # -- caloNoiseTool histograms -- + + caloNoiseTool_path='Coverage/CaloNoiseTool/' + #LB histogram: need to know which LB the CaloNoiseTool histogram is about. Only add to caloNoiseToolGroup to avoid duplicates + caloNoiseToolGroup.defineHistogram('lb1_x;FirstLBnumber', + type='TH1D', + path=caloNoiseTool_path, + title='CaloNoiseTool histogram are filled from this LB;;LB number', + weight='lb1', + xbins=1,xmin=-1,xmax=1) + + caloNoiseToolArrayEM.defineHistogram('etaChan,noise;CaloNoiseEM_Sampling', + type='TProfile', + path='LAr/'+caloNoiseTool_path, + title='DBNoise in EM', + xbins=lArDQGlobals.etaCaloNoise_Bins,xmax=lArDQGlobals.etaCaloNoise_Max,xmin=lArDQGlobals.etaCaloNoise_Min) + + caloNoiseToolArrayHEC.defineHistogram('etaChan,noise;CaloNoiseHEC_Sampling', + type='TProfile', + path='LAr/'+caloNoiseTool_path, + title='DBNoise in HEC', + xbins=lArDQGlobals.etaCaloNoise_Bins,xmax=lArDQGlobals.etaCaloNoise_Max,xmin=lArDQGlobals.etaCaloNoise_Min) + caloNoiseToolArrayFCAL.defineHistogram('etaChan,noise;CaloNoiseFCAL_Sampling', + type='TProfile', + path='LAr/'+caloNoiseTool_path, + title='DBNoise in FCAL', + xbins=lArDQGlobals.etaCaloNoise_FcalBins,xmax=lArDQGlobals.etaCaloNoise_FcalMax,xmin=lArDQGlobals.etaCaloNoise_FcalMin) + + + # -- badChannels histograms -- + # badChannels_path='Coverage/BadChannels/' + # badChannelToolArrayBarrel.defineHistogram('mon_FtSlot,single_channel;DBBadChannelsBarrel', + # type='TH2I', + # path=badChannels_path, + # title='Known Bad Channels - Barrel;Feedthrough(+Slot increasing);Channel', + # weight='flag', + # xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMB"+side], + # xmin=lArDQGlobals.Feedthrough_Slot_range["EMB"+side][0], + # xmax=lArDQGlobals.Feedthrough_Slot_range["EMB"+side][1], + # ybins=lArDQGlobals.FEB_N_channels, + # ymin=-0.5, + # ymax=lArDQGlobals.FEB_N_channels-0.5, + # labels=lArDQGlobals.Feedthrough_Slot_labels_Barrel) + # badChannelToolArrayEndcap.defineHistogram('mon_FtSlot,single_channel;DBBadChannelsEndcap', + # type='TH2I', + # path=badChannels_path, + # title='Known Bad Channels - Endcap '+side+';Feedthrough(+Slot increasing);Channel', + # weight='flag', + # xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMEC"+side], + # xmin=lArDQGlobals.Feedthrough_Slot_range["EMEC"+side][0], + # xmax=lArDQGlobals.Feedthrough_Slot_range["EMEC"+side][1], + # ybins=lArDQGlobals.FEB_N_channels, + # ymin=-0.5, + # ymax=lArDQGlobals.FEB_N_channels-0.5, + # labels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) + + + #--coverageHW histograms + coverage_path='Coverage/perPartition/' + coverageHWToolArrayBarrel.defineHistogram('mon_FtSlot,mon_Channels;CoverageHW', + type='TH2I', + path=coverage_path, + title='Coverage;Feedthrough(+Slot increasing);Channel', + weight='mon_coverage', + xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMBA"], #used also for EMBC + xmin=lArDQGlobals.Feedthrough_Slot_range["EMBA"][0], #used also for EMBC + xmax=lArDQGlobals.Feedthrough_Slot_range["EMBA"][1], #used also for EMBC + ybins=lArDQGlobals.FEB_N_channels, + ymin=-0.5, + ymax=lArDQGlobals.FEB_N_channels-0.5, + labels=lArDQGlobals.Feedthrough_Slot_labels_Barrel) + + coverageHWToolArrayEndcap.defineHistogram('mon_FtSlot,mon_Channels;CoverageHW', + type='TH2I', + path=coverage_path, + title='Coverage;Feedthrough(+Slot increasing);Channel', + weight='mon_coverage', + xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMECA"], #used also for HEC, FCAL and C side + xmin=lArDQGlobals.Feedthrough_Slot_range["EMECA"][0], #used also for HEC, FCAL and C side + xmax=lArDQGlobals.Feedthrough_Slot_range["EMECA"][1], #used also for HEC, FCAL and C side + ybins=lArDQGlobals.FEB_N_channels, + ymin=-0.5, + ymax=lArDQGlobals.FEB_N_channels-0.5, + labels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) + + + coverageGroupEMBA0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMBA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 0 - EMBA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["0"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["0"]) + + coverageGroupEMBA1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMBA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 1 - EMBA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["1"]) + + coverageGroupEMBA2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMBA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 2 - EMBA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["2"]) + + coverageGroupEMBA3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMBA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 3 - EMBA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["3"]) + + + coverageGroupEMBC0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMBC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 0 - EMBC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["0"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["0"]) + + coverageGroupEMBC1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMBC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 1 - EMBC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["1"]) + + coverageGroupEMBC2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMBC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 2 - EMBC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["2"]) + + coverageGroupEMBC3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMBC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 3 - EMBC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["3"]) + + coverageGroupEMECA0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMECA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 0 - EMECA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["0"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["0"]) + + coverageGroupEMECA1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMECA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 1 - EMECA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["1"]) + + coverageGroupEMECA2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMECA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 2 - EMECA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["2"]) + + coverageGroupEMECA3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMECA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 3 - EMECA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["3"]) + + coverageGroupEMECC0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0EMECC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 0 - EMECC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["0"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["0"]) + + coverageGroupEMECC1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1EMECC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 1 - EMECC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["1"]) + + coverageGroupEMECC2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2EMECC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 2 - EMECC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["2"]) + + coverageGroupEMECC3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3EMECC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 3 - EMECC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["3"]) + + + coverageGroupHECA0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0HECA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 0 - HECA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["0"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["0"]) + + coverageGroupHECA1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1HECA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 1 - HECA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["1"]) + + coverageGroupHECA2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2HECA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 2 - HECA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["2"]) + + coverageGroupHECA3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3HECA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 3 - HECA;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["3"]) + + coverageGroupHECC0.defineHistogram('mon_Eta,mon_Phi;CoverSampling0HECC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 0 - HECC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["0"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["0"]) + + coverageGroupHECC1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1HECC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 1 - HECC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["1"]) + + coverageGroupHECC2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2HECC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 2 - HECC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["2"]) + + coverageGroupHECC3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3HECC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 3 - HECC;#eta;#phi', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["3"]) + + coverageGroupFCalA1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1FCalA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 1 - FCalA;cell number (from outside to inside);sector number (#phi)', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["1"]) + + coverageGroupFCalA2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2FCalA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 2 - FCalA;cell number (from outside to inside);sector number (#phi)', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["2"]) + + coverageGroupFCalA3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3FCalA', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 3 - FCalA;cell number (from outside to inside);sector number (#phi)', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["3"]) + + coverageGroupFCalC1.defineHistogram('mon_Eta,mon_Phi;CoverSampling1FCalC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 1 - FCalC;cell number (from outside to inside);sector number (#phi)', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["1"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["1"]) + + coverageGroupFCalC2.defineHistogram('mon_Eta,mon_Phi;CoverSampling2FCalC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 2 - FCalC;cell number (from outside to inside);sector number (#phi)', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["2"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["2"]) + + coverageGroupFCalC3.defineHistogram('mon_Eta,mon_Phi;CoverSampling3FCalC', + type='TH2I', + path=coverage_path, + title='Coverage - Sampling 3 - FCalC;cell number (from outside to inside);sector number (#phi)', + weight='mon_coverage', + xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["3"], + ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["3"]) + + + + #return helper.result() + + + + +if __name__=='__main__': + + # Setup the Run III behavior + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = 1 + + # Setup logs + from AthenaCommon.Logging import log + from AthenaCommon.Constants import INFO + log.setLevel(INFO) + + # Set the Athena configuration flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() + + from AthenaConfiguration.TestDefaults import defaultTestFiles + ConfigFlags.Input.Files = defaultTestFiles.RAW + + ConfigFlags.Output.HISTFileName = 'LArCoverageOutput.root' + ConfigFlags.lock() + + ## Cell building + from CaloRec.CaloRecoConfig import CaloRecoCfg + cfg=CaloRecoCfg(ConfigFlags) + + larCoverageAcc = LArCoverageConfig(ConfigFlags) + cfg.merge(larCoverageAcc) + + ConfigFlags.dump() + f=open("CoverageMaker.pkl","w") + cfg.store(f) + f.close() + +# Nevents=10 +# cfg.run(Nevents) #use cfg.run() to run on all events diff --git a/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py index 233d820cc0f67de29ea8f914a25f132cab94e666..cbc1ccf95691b5a1a363265aea6962779b106544 100644 --- a/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py @@ -1,16 +1,31 @@ # # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # +def LArFEBMonConfigOld(inputFlags, cellDebug=False, dspDebug=False): + from AthenaMonitoring import AthMonitorCfgHelperOld + from LArMonitoring.LArMonitoringConf import LArFEBMonAlg + + helper = AthMonitorCfgHelperOld(inputFlags, 'LArFEBMonCfg') + LArFEBMonConfigCore(helper, LArFEBMonAlg,inputFlags,cellDebug, dspDebug) + + return helper.result() + def LArFEBMonConfig(inputFlags, cellDebug=False, dspDebug=False): from AthenaMonitoring import AthMonitorCfgHelper helper = AthMonitorCfgHelper(inputFlags,'LArFEBMonCfg') + from AthenaConfiguration.ComponentFactory import CompFactory + LArFEBMonConfigCore(helper, CompFactory.LArFEBMonAlg,inputFlags,cellDebug, dspDebug) + + return helper.result() + +def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebug=False): + from LArMonitoring.GlobalVariables import lArDQGlobals - from AthenaConfiguration.ComponentFactory import CompFactory - larFEBMonAlg = helper.addAlgorithm(CompFactory.LArFEBMonAlg,'larFEBMonAlg') + larFEBMonAlg = helper.addAlgorithm(algoinstance,'larFEBMonAlg') GroupName="FEBMon" nslots=[] @@ -22,11 +37,6 @@ def LArFEBMonConfig(inputFlags, cellDebug=False, dspDebug=False): larFEBMonAlg.SubDetNames=lArDQGlobals.SubDet larFEBMonAlg.Streams=lArDQGlobals.defaultStreamNames - # adding LArFebErrorSummary algo - from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg - acc = LArFebErrorSummaryMakerCfg(inputFlags) - helper.resobj.merge(acc) - if "COMP200" not in inputFlags.IOVDb.DatabaseInstance: iovDbSvc=helper.resobj.getService("IOVDbSvc") condLoader=helper.resobj.getCondAlgo("CondInputLoader") @@ -43,6 +53,18 @@ def LArFEBMonConfig(inputFlags, cellDebug=False, dspDebug=False): helper.resobj.addFolderList(inputFlags,[(fld,db,obj)]) larFEBMonAlg.keyDSPThresholds="LArDSPThresholds" + #from AthenaCommon.Constants import VERBOSE + #larFEBMonAlg.OutputLevel=VERBOSE + + # adding LArFebErrorSummary algo + from AthenaCommon.Configurable import Configurable + if Configurable.configurableRun3Behavior : + from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg + acc = LArFebErrorSummaryMakerCfg(inputFlags) + helper.resobj.merge(acc) + else : + #put here what to do else + pass Group = helper.addGroup( larFEBMonAlg, GroupName, @@ -358,7 +380,7 @@ if __name__=='__main__': from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log - from AthenaCommon.Constants import DEBUG,WARNING + from AthenaCommon.Constants import DEBUG from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=1 log.setLevel(DEBUG) @@ -367,20 +389,18 @@ if __name__=='__main__': from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags createLArMonConfigFlags() - ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/data17_13TeV.00330470.physics_Main.daq.RAW._lb0310._SFO-1._0001.data",] + from AthenaConfiguration.TestDefaults import defaultTestFiles + ConfigFlags.Input.Files = defaultTestFiles.RAW ConfigFlags.Output.HISTFileName = 'LArFEBMonOutput.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.DQ.useTrigger = False + ConfigFlags.DQ.enableLumiAccess = True + ConfigFlags.DQ.useTrigger = True ConfigFlags.Beam.Type = 'collisions' ConfigFlags.lock() - from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg - cfg = MainServicesSerialCfg() - from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg.merge(CaloRecoCfg(ConfigFlags)) + cfg=CaloRecoCfg(ConfigFlags) #from CaloD3PDMaker.CaloD3PDConfig import CaloD3PDCfg,CaloD3PDAlg #cfg.merge(CaloD3PDCfg(ConfigFlags, filename=ConfigFlags.Output.HISTFileName, streamname='CombinedMonitoring')) @@ -395,4 +415,4 @@ if __name__=='__main__': cfg.store(f) f.close() - cfg.run(10,OutputLevel=WARNING) + #cfg.run(100,OutputLevel=WARNING) diff --git a/LArCalorimeter/LArMonitoring/python/LArHVDBConfig.py b/LArCalorimeter/LArMonitoring/python/LArHVDBConfig.py index da97cd6f240e8b734daa6a7347d3e2ff8a06ee2d..142c897465e8e81a9f642561d1b9cbe57d72465f 100644 --- a/LArCalorimeter/LArMonitoring/python/LArHVDBConfig.py +++ b/LArCalorimeter/LArMonitoring/python/LArHVDBConfig.py @@ -3,7 +3,6 @@ # python fragment to configure LAr HV conditions chain from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg,addFolders def LArHVDBCfg(configFlags): @@ -18,16 +17,16 @@ def LArHVDBCfg(configFlags): result.merge(addFolders(configFlags,["/LAR/DCS/HV/BARREl/I16","/LAR/DCS/HV/BARREL/I8"],detDb="DCS_OFL",className="CondAttrListCollection")) result.merge(addFolders(configFlags,["/LAR/IdentifierOfl/HVLineToElectrodeMap","/LAR/HVPathologiesOfl/Pathologies"],detDb="LAR_OFL",className="AthenaAttributeList")) - LArHVIdMappingAlg=CompFactory.LArHVIdMappingAlg + from LArRecUtils.LArRecUtilsConf import LArHVIdMappingAlg result.addCondAlgo(LArHVIdMappingAlg(ReadKey="/LAR/IdentifierOfl/HVLineToElectrodeMap",WriteKey="LArHVIdMap")) - LArHVPathologyDbCondAlg=CompFactory.LArHVPathologyDbCondAlg + from LArRecUtils.LArRecUtilsConf import LArHVPathologyDbCondAlg result.addCondAlgo(LArHVPathologyDbCondAlg(PathologyFolder="/LAR/HVPathologiesOfl/Pathologies",HVMappingKey="LArHVIdMap", HVPAthologyKey="LArHVPathology")) - LArHVCondAlg=CompFactory.LArHVCondAlg + from LArRecUtils.LArRecUtilsConf import LArHVCondAlg result.addCondAlgo(LArHVCondAlg(HVPathologies="LArHVPathology",OutputHVData="LArHVData")) - LArHVScaleCorrCondAlg=CompFactory.LArHVScaleCorrCondAlg + from LArRecUtils.LArRecUtilsConf import LArHVScaleCorrCondAlg hvscale = LArHVScaleCorrCondAlg(keyHVdata="LArHVData",keyOutputCorr="LArHVScaleCorrRecomputed") hvscale.UndoOnlineHVCorr=True result.addCondAlgo(hvscale) @@ -58,6 +57,6 @@ if __name__=="__main__": cfg.merge(LArHVDBCfg(ConfigFlags)) - f=open("LArHVDBConfig.pkl","wb") + f=open("LArHVDBConfig.pkl","w") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py index 2cb768088fe4c23da770ec84c00390905c49d828..2e0a84150dd07cd40baa9765aa37bb0b64761516 100644 --- a/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py @@ -4,13 +4,6 @@ def LArNoisyROMonConfig(inputFlags, inKey="", NoisyFEBDefStr="(>30 chan with Q>4000)"): - # first configure known bad FEBs - from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator - cfg=ComponentAccumulator() - from LArBadChannelTool.LArBadFebsConfig import LArKnownBadFebCfg, LArKnownMNBFebCfg - cfg.merge(LArKnownBadFebCfg(inputFlags)) - cfg.merge(LArKnownMNBFebCfg(inputFlags)) - from AthenaMonitoring import AthMonitorCfgHelper helper = AthMonitorCfgHelper(inputFlags,'LArNoisyROMonCfg') @@ -80,8 +73,7 @@ def LArNoisyROMonConfig(inputFlags, inKey="", NoisyFEBDefStr="(>30 chan with Q>4 ybins=ft_n, ymin=ft_low, ymax=ft_up) pass - cfg.merge(helper.result()) - return cfg + return helper.result() if __name__=='__main__': diff --git a/LArCalorimeter/LArMonitoring/python/LArReco_fromraw_Cfg.py b/LArCalorimeter/LArMonitoring/python/LArReco_fromraw_Cfg.py index d3e1a6d86dc006bd8caae12fea4efc5544e29c64..4482ebcae0241eb1a4b5d410aff7a5d25232b65f 100644 --- a/LArCalorimeter/LArMonitoring/python/LArReco_fromraw_Cfg.py +++ b/LArCalorimeter/LArMonitoring/python/LArReco_fromraw_Cfg.py @@ -17,29 +17,49 @@ if __name__=="__main__": ConfigFlags.Input.Files = defaultTestFiles.RAW ConfigFlags.Output.HISTFileName = 'LArMonitoringOutput.root' + ConfigFlags.DQ.enableLumiAccess = False + ConfigFlags.DQ.useTrigger = False + ConfigFlags.Beam.Type = 'collisions' ConfigFlags.lock() ## Cell building from CaloRec.CaloRecoConfig import CaloRecoCfg cfg=CaloRecoCfg(ConfigFlags) + #larCoverage monitoring + from LArMonitoring.LArCoverageAlg import LArCoverageConfig + cov_acc = LArCoverageConfig(ConfigFlags) + cfg.merge(cov_acc) + + #affectedRegions monitoring from LArMonitoring.LArAffectedRegionsAlg import LArAffectedRegionsConfig aff_acc = LArAffectedRegionsConfig(ConfigFlags) cfg.merge(aff_acc) - # try collision time algo + #collision time algo from LArCellRec.LArCollisionTimeConfig import LArCollisionTimeCfg cfg.merge(LArCollisionTimeCfg(ConfigFlags)) cfg.getEventAlgo("LArCollisionTimeAlg").cutIteration=False - # and finally monitoring algo + # and collision time monitoring algo from LArMonitoring.LArCollisionTimeMonAlg import LArCollisionTimeMonConfig collmon=LArCollisionTimeMonConfig(ConfigFlags) - collmon.getEventAlgo("larCollTimeMonAlg").timeDiffCut=5.0 - collmon.getEventAlgo("larCollTimeMonAlg").nCells=1 - collmon.getEventAlgo("larCollTimeMonAlg").TrainFrontDistance=30 cfg.merge(collmon) + #ROD monitoring + from LArMonitoring.LArRODMonAlg import LArRODMonConfig + rodmon = LArRODMonConfig(ConfigFlags) + cfg.merge(rodmon) + + #Digit monitoring + + from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg + cfg.merge(LArNoisyROSummaryCfg(ConfigFlags)) + + from LArMonitoring.LArDigitMonAlg import LArDigitMonConfig + digimon = LArDigitMonConfig(ConfigFlags) + cfg.merge(digimon) + ConfigFlags.dump() f=open("LArMonMaker.pkl","w") diff --git a/LArCalorimeter/LArMonitoring/python/initBadChannelsMask.py b/LArCalorimeter/LArMonitoring/python/initBadChannelsMask.py new file mode 100644 index 0000000000000000000000000000000000000000..463938c76f4ac89e1923e8b371636c2d816aec68 --- /dev/null +++ b/LArCalorimeter/LArMonitoring/python/initBadChannelsMask.py @@ -0,0 +1,12 @@ +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# + +def init_mask(tool_name): + from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker + theLArBadChannelsMasker=LArBadChannelMasker(tool_name) #,this) + theLArBadChannelsMasker.DoMasking=True + theLArBadChannelsMasker.ProblemsToMask=[ + "deadReadout","deadPhys","short","almostDead", + "highNoiseHG","highNoiseMG","highNoiseLG","sporadicBurstNoise"] + return theLArBadChannelsMasker diff --git a/LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.cxx b/LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.cxx index 080a83df33435d147592ad4c85fa50cf40a27d3e..f39b59467bbb453c3f3162f24926f2442f809e16 100644 --- a/LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.cxx +++ b/LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.cxx @@ -130,12 +130,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<phimax){ if(eta>=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_embpsName,etaPOS,phi,problem); + fill(m_MonGroupName+m_embpsName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMBAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta<0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_embpsName,etaNEG,phi,problem); + fill(m_MonGroupName+m_embpsName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMBCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/32); @@ -147,12 +147,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<TMath::Pi()){ if(eta>=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_embpsName,etaPOS,phi,problem); + fill(m_MonGroupName+m_embpsName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMBAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta<0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_embpsName,etaNEG,phi,problem); + fill(m_MonGroupName+m_embpsName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMBCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/32); @@ -162,12 +162,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<phimax){ if(eta>=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_embpsName,etaPOS,phi,problem); + fill(m_MonGroupName+m_embpsName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMBAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta<0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_embpsName,etaNEG,phi,problem); + fill(m_MonGroupName+m_embpsName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMBCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/32); @@ -189,12 +189,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<phimax){ if(eta >=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_embName,etaPOS,phi,problem); + fill(m_MonGroupName+m_embName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMBA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta <0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_embName,etaNEG,phi,problem); + fill(m_MonGroupName+m_embName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMBC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/128); @@ -206,12 +206,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<TMath::Pi()){ if(eta >=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_embName,etaPOS,phi,problem); + fill(m_MonGroupName+m_embName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMBA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta <0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_embName,etaNEG,phi,problem); + fill(m_MonGroupName+m_embName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMBC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/128); @@ -221,12 +221,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<phimax){ if(eta >=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_embName,etaPOS,phi,problem); + fill(m_MonGroupName+m_embName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMBA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta <0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_embName,etaNEG,phi,problem); + fill(m_MonGroupName+m_embName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMBC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/128); @@ -248,12 +248,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<phimax){ if(eta>=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_emecpsName,etaPOS,phi,problem); + fill(m_MonGroupName+m_emecpsName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMECAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta<0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_emecpsName,etaNEG,phi,problem); + fill(m_MonGroupName+m_emecpsName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMECCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/64); @@ -265,12 +265,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<TMath::Pi()){ if(eta>=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_emecpsName,etaPOS,phi,problem); + fill(m_MonGroupName+m_emecpsName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMECAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta<0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_emecpsName,etaNEG,phi,problem); + fill(m_MonGroupName+m_emecpsName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMECCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/64); @@ -280,12 +280,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<phimax){ if(eta>=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_emecpsName,etaPOS,phi,problem); + fill(m_MonGroupName+m_emecpsName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMECAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta<0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_emecpsName,etaNEG,phi,problem); + fill(m_MonGroupName+m_emecpsName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMECCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/64); @@ -308,12 +308,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<phimax){ if(eta>=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_emecName,etaPOS,phi,problem); + fill(m_MonGroupName+m_emecName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMECA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta<0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_emecName,etaNEG,phi,problem); + fill(m_MonGroupName+m_emecName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMECC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/256); @@ -325,12 +325,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<TMath::Pi()){ if(eta>=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_emecName,etaPOS,phi,problem); + fill(m_MonGroupName+m_emecName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMECA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta<0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_emecName,etaNEG,phi,problem); + fill(m_MonGroupName+m_emecName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMECC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/256); @@ -340,12 +340,12 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const while(phi<phimax){ if(eta>=0){ etaPOS=eta; - fill(std::string(m_MonGroupName)+m_emecName,etaPOS,phi,problem); + fill(m_MonGroupName+m_emecName,etaPOS,phi,problem); ATH_MSG_DEBUG( "EMECA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } if(eta<0){ etaNEG=eta; - fill(std::string(m_MonGroupName)+m_emecName,etaNEG,phi,problem); + fill(m_MonGroupName+m_emecName,etaNEG,phi,problem); ATH_MSG_DEBUG( "EMECC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); } phi+=(2*TMath::Pi()/256); @@ -432,6 +432,7 @@ LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const } // FCAL + ATH_MSG_INFO("layermin=" << layermin << " layermin-21=" << layermin-21); if(layermin>=21 && layermin<=23){ //set the group to fill(only depends on layer) std::string fcal_layer_name=m_MonGroupName; diff --git a/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.cxx b/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.cxx index d923a18c00ec97e3e517a821e600969985e24139..40f8f5a9bd1c5012dfabfa5ea81fe1ef18c6c165 100755 --- a/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.cxx +++ b/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.cxx @@ -17,7 +17,10 @@ #include "LArCollisionTimeMonAlg.h" -#include "GaudiKernel/SystemOfUnits.h" + + +#include "TrigAnalysisInterfaces/IBunchCrossingTool.h" + using namespace std; @@ -27,7 +30,12 @@ using namespace std; /*---------------------------------------------------------*/ LArCollisionTimeMonAlg::LArCollisionTimeMonAlg( const std::string& name, ISvcLocator* pSvcLocator ) : AthMonitorAlgorithm(name,pSvcLocator) -{} + ,m_LArCollisionTimeKey("LArCollisionTime") + ,m_bunchCrossingTool("BunchCrossingTool") +{ + declareProperty( "Key" , m_LArCollisionTimeKey); + declareProperty( "BunchCrossingTool" , m_bunchCrossingTool); +} /*---------------------------------------------------------*/ LArCollisionTimeMonAlg::~LArCollisionTimeMonAlg() @@ -39,7 +47,6 @@ LArCollisionTimeMonAlg::initialize() { //init handlers ATH_CHECK( m_LArCollisionTimeKey.initialize() ); - ATH_CHECK( m_bcKey.initialize() ); return AthMonitorAlgorithm::initialize(); } @@ -78,66 +85,67 @@ LArCollisionTimeMonAlg::fillHistograms( const EventContext& ctx ) const // luminosity block number lumi_block = event_info->lumiBlock(); - SG::ReadCondHandle<BunchCrossingCondData> bcData(m_bcKey, ctx); - if(bcData->bcType(bunch_crossing_id) == BunchCrossingCondData::Empty) { + + if(m_bunchCrossingTool->bcType(bunch_crossing_id) == Trig::IBunchCrossingTool::Empty) { ATH_MSG_INFO("BCID: "<<bunch_crossing_id<<" empty ? not filling the coll. time" ); return StatusCode::SUCCESS; // not filling anything in empty bunches } - int bcid_distance = bcData->distanceFromFront(bunch_crossing_id, BunchCrossingCondData::BunchCrossings); + int bcid_distance = m_bunchCrossingTool->distanceFromFront(bunch_crossing_id, Trig::IBunchCrossingTool::BunchCrossings); ATH_MSG_DEBUG("BCID distance: "<<bcid_distance ); // Retrieve LArCollision Timing information SG::ReadHandle<LArCollisionTime> larTime(m_LArCollisionTimeKey, ctx); if(! larTime.isValid()) - { - ATH_MSG_WARNING( "Unable to retrieve LArCollisionTime event store" ); - return StatusCode::SUCCESS; // Check if failure shd be returned. VB - } else { + { + ATH_MSG_WARNING( "Unable to retrieve LArCollisionTime" ); + return StatusCode::SUCCESS; // Check if failure shd be returned. VB + } else { ATH_MSG_DEBUG( "LArCollisionTime successfully retrieved from event store" ); } - + if(!event_info->isEventFlagBitSet(xAOD::EventInfo::LAr,3)) { // Do not fill histo if noise burst suspected // Calculate the time diff between ECC and ECA - ecTimeDiff = (larTime->timeC() - larTime->timeA()) * Gaudi::Units::picosecond; - ecTimeAvg = (larTime->timeC() + larTime->timeA()) * Gaudi::Units::picosecond / 2.0; - if (larTime->ncellA() > m_minCells && larTime->ncellC() > m_minCells && std::fabs(ecTimeDiff) < m_timeCut ) { // Only fill histograms if a minimum number of cells were found and time difference was sensible + ecTimeDiff = (larTime->timeC() - larTime->timeA())/m_timeUnit; + ecTimeAvg = (larTime->timeC() + larTime->timeA())/(m_timeUnit*2.); + if (larTime->ncellA() > m_minCells && larTime->ncellC() > m_minCells && std::fabs(ecTimeDiff) < m_timeCut/m_timeUnit ) { // Only fill histograms if a minimum number of cells were found and time difference was sensible ATH_MSG_DEBUG( "filling !" ); //set the weight if needed if (m_eWeighted) weight = (larTime->energyA()+larTime->energyC())*1e-3; //fill your group + ATH_MSG_DEBUG( "time A = " << larTime->timeA() << " time C = " << larTime->timeC() << " diff = " << larTime->timeC() - larTime->timeA() << "saved diff = " << ecTimeDiff ); fill(m_MonGroupName,ecTimeDiff,ecTimeAvg,lumi_block,bunch_crossing_id,weight); //check timeWindow lumi_block_timeWindow=lumi_block; - if ( fabs(ecTimeDiff) < 10 ) fill(m_MonGroupName,lumi_block_timeWindow,weight); + if ( fabs(ecTimeDiff) < 10*Gaudi::Units::nanosecond/m_timeUnit) fill(m_MonGroupName,lumi_block_timeWindow,weight); //check singleBeam-timeWindow lumi_block_singleBeam_timeWindow=lumi_block; - if ( fabs(ecTimeDiff) > 20 && fabs(ecTimeDiff) < 30 ) fill(m_MonGroupName,lumi_block_singleBeam_timeWindow,weight); + if ( fabs(ecTimeDiff) > 20*Gaudi::Units::nanosecond/m_timeUnit && fabs(ecTimeDiff) < 30*Gaudi::Units::nanosecond/m_timeUnit ) fill(m_MonGroupName,lumi_block_singleBeam_timeWindow,weight); //check in-train (online only) if(m_IsOnline && bcid_distance > m_distance) { // fill histos inside the train - ATH_MSG_INFO("BCID: "<<bunch_crossing_id<<" distance from Front: "<<bcid_distance<<"Filling in train..."); + ATH_MSG_DEBUG("BCID: "<<bunch_crossing_id<<" distance from Front: "<<bcid_distance<<"Filling in train..."); if(m_InTrain_MonGroupName!="") { //group name is empty by default, give it a name when you define it in the python //fill the intrain group fill(m_InTrain_MonGroupName,ecTimeDiff,ecTimeAvg,lumi_block,bunch_crossing_id,weight); //check timeWindow - if ( fabs(ecTimeDiff) < 10 ) fill(m_InTrain_MonGroupName,lumi_block_timeWindow,weight); + if ( fabs(ecTimeDiff) < 10*Gaudi::Units::nanosecond/m_timeUnit ) fill(m_InTrain_MonGroupName,lumi_block_timeWindow,weight); //check singleBeam-timeWindow - if ( fabs(ecTimeDiff) > 20 && fabs(ecTimeDiff) < 30 ) fill(m_InTrain_MonGroupName,lumi_block_singleBeam_timeWindow,weight); + if ( fabs(ecTimeDiff) > 20*Gaudi::Units::nanosecond/m_timeUnit && fabs(ecTimeDiff) < 30*Gaudi::Units::nanosecond/m_timeUnit ) fill(m_InTrain_MonGroupName,lumi_block_singleBeam_timeWindow,weight); } else ATH_MSG_WARNING( "I should be filling the 'inTrain' group now, but it looks undefined. Did you remember to set 'm_InTrain_MonGroupName' in the python?" ); } } else { - ATH_MSG_DEBUG( "LAr bellow cuts ncells: " << larTime->ncellA() << " " << larTime->ncellC() << " times: " << larTime->timeA() << " " <<larTime->timeC() << " " << std::fabs(ecTimeDiff) <<", not filling !" ); + ATH_MSG_DEBUG( "LAr below cuts ncells: " << larTime->ncellA() << " " << larTime->ncellC() << " times: " << larTime->timeA() << " " <<larTime->timeC() << " " << std::fabs(ecTimeDiff) <<", not filling !" ); } } diff --git a/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.h b/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.h index 7ec2114bd9d1b5185c29434b698f41e00ff80974..eb2e29c7f4330a8a70c9e2f7a6c4cbe43c015144 100755 --- a/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.h +++ b/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.h @@ -16,11 +16,17 @@ #include "StoreGate/ReadHandleKey.h" #include "LArRecEvent/LArCollisionTime.h" -#include "LumiBlockData/BunchCrossingCondData.h" +#include "GaudiKernel/SystemOfUnits.h" #include <string> #include <vector> + +namespace Trig { +class IBunchCrossingTool; +} + + class LArCollisionTimeMonAlg: public AthMonitorAlgorithm { public: @@ -40,21 +46,24 @@ class LArCollisionTimeMonAlg: public AthMonitorAlgorithm private: - //MonGroup(s) name - Gaudi::Property<std::string> m_MonGroupName {this,"CollTimeGroupName","LArCollisionTimeMonGroup"}; - Gaudi::Property<std::string> m_InTrain_MonGroupName {this,"InTrain_CollTimeGroupName",""}; + //MonGroup(s) name + Gaudi::Property<std::string> m_MonGroupName {this,"CollTimeGroupName","LArCollisionTimeMonGroup"}; + Gaudi::Property<std::string> m_InTrain_MonGroupName {this,"InTrain_CollTimeGroupName",""}; // Other properties - Gaudi::Property<int> m_distance {this,"TrainFrontDistance",30}; // distance from train front to fill second histos - Gaudi::Property<float> m_timeCut {this,"timeDiffCut",5.0}; - Gaudi::Property<int> m_minCells {this,"nCells",2}; + Gaudi::Property<double> m_timeUnit {this,"TimeUnit",Gaudi::Units::nanosecond}; + Gaudi::Property<int> m_distance {this,"TrainFrontDistance",30*Gaudi::Units::nanosecond}; // distance from train front to fill second histos Gaudi::Property<bool> m_IsOnline {this,"IsOnline",false}; + Gaudi::Property<float> m_timeCut {this,"timeDiffCut",5.0*Gaudi::Units::nanosecond}; + Gaudi::Property<int> m_minCells {this,"nCells",2}; Gaudi::Property<bool> m_eWeighted {this,"eWeighted",true}; //containers' handles - SG::ReadHandleKey<LArCollisionTime> m_LArCollisionTimeKey{this, "Key", "LArCollisionTime", "Key for the LArCollisionTime data"}; - SG::ReadCondHandleKey<BunchCrossingCondData> m_bcKey{this,"BunchCrossingKey","BunchCrossingData","Key for the bunch crossing conditions data"}; + SG::ReadHandleKey<LArCollisionTime> m_LArCollisionTimeKey; + + //tools handles + ToolHandle<Trig::IBunchCrossingTool> m_bunchCrossingTool; }; diff --git a/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.cxx b/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.cxx new file mode 100755 index 0000000000000000000000000000000000000000..163d254b5f5217e5a20f1feecb0f8d477bfabbd9 --- /dev/null +++ b/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.cxx @@ -0,0 +1,839 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: LArCoverageAlg.cxx +// PACKAGE: LArMonitoring +// +// AUTHOR: Margherita Spalla, migrated from LArCoverage by Jessica Leveque +// +// Class for monitoring : Detector cells in the readout +// Masked Channels from database +// Availability of calibration constants +// Bad calibration at FEB level +// ******************************************************************** + +#include "LArCoverageAlg.h" + +#include "GaudiKernel/ISvcLocator.h" +#include "GaudiKernel/IToolSvc.h" + +#include "Identifier/IdentifierHash.h" + +#include "TMath.h" + +#include <sstream> +#include <iomanip> +#include <fstream> +#include <string> +#include <vector> +#include <cstdlib> +#include <functional> +#include <map> +#include <utility> + + + + +using namespace std; + +/*---------------------------------------------------------*/ +LArCoverageAlg::LArCoverageAlg(const std::string& name, ISvcLocator* pSvcLocator ) + : AthMonitorAlgorithm(name,pSvcLocator), + m_badChannelMask("BadLArRawChannelMask",this) +{ + declareProperty("LArBadChannelMask",m_badChannelMask); + declareProperty("LArRawChannelKey",m_rawChannelsKey="LArRawChannels"); + + m_LArOnlineIDHelper = nullptr; + m_LArEM_IDHelper = nullptr; + m_LArFCAL_IDHelper = nullptr; + m_LArHEC_IDHelper = nullptr; + m_caloIdMgr = nullptr; + } + +/*---------------------------------------------------------*/ +LArCoverageAlg::~LArCoverageAlg() +{} + +/*---------------------------------------------------------*/ +StatusCode +LArCoverageAlg::initialize() +{ + ATH_MSG_INFO( "Initialize LArCoverageAlg" ); + + /** check binning (for filling white bins in eta-phi coverage plots) */ + TString warn_binning=""; + if(m_NphiBinsEMB1!=256) warn_binning="NphiBinsEMB1!=256 "; + if(m_NphiBinsEMEC2!=256) warn_binning="NphiBinsEMEC2!=256 "; + if((int)(m_NphiBinsHEC.size())<m_Nsample) ATH_MSG_ERROR("NphiBinsHEC must contain " << m_Nsample << " elements"); + if(m_NphiBinsHEC[0]!=64) warn_binning="NphiBinsHEC[0]!=64 "; + if(m_NphiBinsHEC[1]!=64) warn_binning="NphiBinsHEC[1]!=64 "; + if(m_NphiBinsHEC[2]!=64) warn_binning="NphiBinsHEC[2]!=64 "; + if(m_NphiBinsHEC[3]!=64) warn_binning="NphiBinsHEC[3]!=64 "; + if(warn_binning!="") ATH_MSG_WARNING(warn_binning+"Did you remember to adjust the white bin filling? The algorithm fills in white eta-phi bins in EMB1, EMEC2 and HEC coverage plots: this expects 256 phi bins. If you change the number of bins, you should change the white bin filling as well. Tip: look at the fill() call where deltaPhi is not zero"); + + /** Retrieve ID helpers */ + ATH_CHECK( detStore()->retrieve( m_caloIdMgr ) ); + m_LArEM_IDHelper = m_caloIdMgr->getEM_ID(); + m_LArHEC_IDHelper = m_caloIdMgr->getHEC_ID(); + m_LArFCAL_IDHelper = m_caloIdMgr->getFCAL_ID(); + + ATH_CHECK( detStore()->retrieve(m_LArOnlineIDHelper, "LArOnlineID") ); + ATH_CHECK( m_BCKey.initialize() ); + ATH_CHECK( m_BFKey.initialize() ); + /** retrieve bad channel tool */ + ATH_CHECK( m_badChannelMask.retrieve() ); + + /** Initialize cabling key */ + ATH_CHECK(m_cablingKey.initialize()); + + + /** calo noise key */ + ATH_CHECK( m_noiseCDOKey.initialize() ); + + /** raw channel key */ + ATH_CHECK( m_rawChannelsKey.initialize() ); + + /** tool maps (arrays of histograms) */ + m_CaloNoiseGroupArrEM = Monitored::buildToolMap<int>(m_tools,m_CaloNoiseToolGroupName+"EM",m_Nsample); + m_CaloNoiseGroupArrHEC = Monitored::buildToolMap<int>(m_tools,m_CaloNoiseToolGroupName+"HEC",m_Nsample); + m_CaloNoiseGroupArrFCAL = Monitored::buildToolMap<int>(m_tools,m_CaloNoiseToolGroupName+"FCAL",m_Nsample); + m_CoverageHWToolArrayBarrel = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName,m_CoverageBarrelPartitions); + m_CoverageHWToolArrayEndcap = Monitored::buildToolMap<int>(m_tools,m_CoverageHWGroupName,m_CoverageEndcapPartitions); + + m_BadChannelToolArrayBarrel = Monitored::buildToolMap<int>(m_tools,m_BadChannelsGroupName,m_Sides); + m_BadChannelToolArrayEndcap = Monitored::buildToolMap<int>(m_tools,m_BadChannelsGroupName,m_Sides); + + /** End Initialize */ + return AthMonitorAlgorithm::initialize(); +} + + + +/*---------------------------------------------------------*/ +StatusCode +LArCoverageAlg::fillHistograms( const EventContext& ctx ) const +{ + ATH_MSG_DEBUG( "in fillHists()" ); + + if(ctx.evt()+1 > m_nevents ) return StatusCode::SUCCESS; //ctx.evt() counts from 0 + + auto noise = Monitored::Scalar<float>("noise",0.); + auto etaChan = Monitored::Scalar<float>("etaChan",1e3); + auto flag = Monitored::Scalar<int>("flag",0); + auto single_channel = Monitored::Scalar<int>("single_channel",-1); + auto lb1 = Monitored::Scalar<float>("lb1",0); + auto lb1_x = Monitored::Scalar<float>("lb1_x",0); + + /** monitoring of coverage maps */ + auto mon_FtSlot = Monitored::Scalar<int>("mon_FtSlot",-1); + std::vector<LArChanHelp> the_coverageMap(0); + //Note for when we'll have the proper histogram class: the feedthrough-slot coverage plot must be filled with the latest value, the eta-phi coverage plot must be filled with the maximum value + auto mon_coverage = Monitored::Collection("mon_coverage",the_coverageMap,[](const LArChanHelp ch){return ch.getChStatus();}); + auto mon_Channels = Monitored::Collection("mon_Channels",the_coverageMap,[](const LArChanHelp ch){return ch.getChNumber();}); + auto mon_Eta = Monitored::Collection("mon_Eta",the_coverageMap,[](const LArChanHelp ch){return ch.getChEta();}); + double deltaPhi=0; + auto mon_Phi = Monitored::Collection("mon_Phi",the_coverageMap,[&deltaPhi](const LArChanHelp ch){return ch.getChPhi()+deltaPhi;}); + + /** lambda functions and arrays for manipulating the_coverageMap when filling the white bins, defined here since they will be called twice */ + auto etaRangeEMB1_lambda = [](const LArChanHelp ch){return !(std::abs(ch.getChEta())<1.4);}; + const int n_binSteps = 3; + int binStepsEM_A[n_binSteps] = {-1,+1,+2}; + int binStepsEM_C[n_binSteps] = {-2,-1,+1}; + auto etaRangeEMEC2andHEC_lambda = [](const LArChanHelp ch){return !(std::abs(ch.getChEta())>2.5);}; + int binStepsHEC = -1; + + /** Coverage map + * each line is a FEB, each column a sampling (needed for eta-phi plots): coverageMapHWEMBA[ft*(Nslot)+slot-1][sampling]=channelStatus. + * NOTE the -1 with the slot, needed because slots counts from 1 and vectors want 0. + * also: GlobalVariables::slotEMBA=[1,14]-->Nslot=14 (index=slot-1 from 0 to 13), while feedthroughEMBS=[0,31]-->Nfeedthrough=32. + */ + std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapEMBA(m_NftEMB*m_NslotEMB,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); + std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapEMBC(m_NftEMB*m_NslotEMB,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); + std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapEMECA(m_NftEMEC*m_NslotEMEC,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); + std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapEMECC(m_NftEMEC*m_NslotEMEC,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); + std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapHECA(m_NftHEC*m_NslotHEC,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); + std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapHECC(m_NftHEC*m_NslotHEC,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); + std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapFCALA(m_NftFCAL*m_NslotFCAL,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); + std::vector<std::vector<std::vector<LArChanHelp> > > coverageMapFCALC(m_NftFCAL*m_NslotFCAL,std::vector<std::vector<LArChanHelp> >(m_Nsample,std::vector<LArChanHelp>(0))); + + + /** retrieve det. description manager */ + const CaloDetDescrManager* ddman = nullptr; + ATH_CHECK( detStore()->retrieve (ddman, "CaloMgr") ); + + /** retrieve cabling (copied from LArCalibUtils/src/LArAutoCorrExtrapolate.cxx) */ + SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey,ctx}; + const LArOnOffIdMapping* larCabling{*cablingHdl}; + if(!larCabling){ + ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key() ); + return StatusCode::FAILURE; + } + + /** Retrieve Raw Channels Container */ + SG::ReadHandle<LArRawChannelContainer> pRawChannelsContainer(m_rawChannelsKey, ctx); + if(! pRawChannelsContainer.isValid() ) { + ATH_MSG_WARNING( "Can\'t retrieve LArRawChannelContainer with key " << m_rawChannelsKey ); + return StatusCode::SUCCESS; + } + + /** Retrieve CaloNoise */ + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey, ctx}; + const CaloNoise* noiseCDO=*noiseHdl; + + if(ctx.evt() == 0){ //first event + lb1 = (float)GetEventInfo(ctx)->lumiBlock(); + fill(m_CaloNoiseToolGroupName,lb1,lb1_x); + } + + ATH_MSG_DEBUG( "now loop on channels" ); + /** Loop over LArRawChannels */ + for (const LArRawChannel& pRawChannel : *pRawChannelsContainer) { + int provenanceChan = pRawChannel.provenance(); + float energyChan = pRawChannel.energy(); + HWIdentifier id = pRawChannel.hardwareID(); + Identifier offlineID = larCabling->cnvToIdentifier(id); + + /** Skip disconnected channels */ + if(!larCabling->isOnlineConnected(id)) continue; + + /** Get ft/slot info */ + HWIdentifier febID = m_LArOnlineIDHelper->feb_Id(id); + HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(id); + single_channel = m_LArOnlineIDHelper->channel(id); + int slot = m_LArOnlineIDHelper->slot(febID); + int ft = m_LArOnlineIDHelper->feedthrough(feedthroughID); + + /** Get Physical Coordinates */ + float phiChan = 0.; + const CaloDetDescrElement* caloDetElement = ddman->get_element(offlineID); + if(caloDetElement == 0 ){ + ATH_MSG_ERROR( "Cannot retrieve (eta,phi) coordinates for raw channels" ); + continue; + }else{ + etaChan = caloDetElement->eta_raw(); + phiChan = caloDetElement->phi_raw(); + } + + /** Fix phi range in HEC */ + if (m_LArOnlineIDHelper->isHECchannel(id)) phiChan = CaloPhiRange::fix(phiChan); + + /** Retrieve expected noise */ + noise = noiseCDO->getNoise(offlineID,m_highestGain[caloDetElement->getSubCalo()]); + + if(ctx.evt() == 0){ //first event + /** Plot the average expected noise vs eta for reference */ + std::string cnGroup_toFill=""; + if(m_LArOnlineIDHelper->isEMBchannel(id) || m_LArOnlineIDHelper->isEMECchannel(id)){ + int sampling = m_LArEM_IDHelper->sampling(offlineID); + if(sampling>=0 && sampling<m_Nsample) fill(m_tools[m_CaloNoiseGroupArrEM.at(sampling)],etaChan,noise); + else ATH_MSG_WARNING( "LAr IDhelper returned unexpected sampling: " << sampling << ". Group EM could not be filled."); + } + if(m_LArOnlineIDHelper->isHECchannel(id)){ + int sampling = m_LArHEC_IDHelper->sampling(offlineID); + if(sampling>=0 && sampling<m_Nsample) fill(m_tools[m_CaloNoiseGroupArrHEC.at(sampling)],etaChan,noise); + else ATH_MSG_WARNING( "LAr IDhelper returned unexpected sampling: " << sampling << ". Group HEC could not be filled."); + } + if(m_LArOnlineIDHelper->isFCALchannel(id)){ + int sampling = m_LArFCAL_IDHelper->module(offlineID); + if(sampling>=0 && sampling<m_Nsample) fill(m_tools[m_CaloNoiseGroupArrFCAL.at(sampling)],etaChan,noise); + else ATH_MSG_WARNING( "LAr IDhelper returned unexpected sampling: " << sampling << ". Group FCAL could not be filled."); + } + + + /*THIS WILL BE MODIFIED ONCE WE HAVE FILL SOLUTION FOR 'SETBINCONTENT' PROBLEM, FROM CENTRAL MONITORING*/ + + /** Fill Bad Channels histograms */ + flag = DBflag(id); + if (flag!=0) {//only fill bad channels + std::string the_side= (etaChan >= 0 ? "A" : "C"); + if(m_LArOnlineIDHelper->isEMBchannel(id)){ + mon_FtSlot=ft*m_NftEMB+slot; + fill(m_tools[m_BadChannelToolArrayBarrel.at(the_side)],mon_FtSlot,single_channel,flag); + }else{ + mon_FtSlot=ft*m_NftEMEC+slot; + fill(m_tools[m_BadChannelToolArrayEndcap.at(the_side)],mon_FtSlot,single_channel,flag); + } + } + } //end of 'if(ctx.evt() == 0)' + + + // + // Compute cells status + // + + int cellContent = 0; + + /** Cell is connected and in the Readout + * Select raw channels properly reconstructed, with all calib constants available + * provenance&0x00ff == 0x00a5 : raw channels from OFC iteration, all calib constants found in DB + * provenance&0x1000 == 0x1000 : raw channels from DSP. If no constant loaded in DSP, energy==0 + */ + if ( (provenanceChan&0x00ff) == 0x00a5 || (provenanceChan&0x1000) == 0x1000 ){ + + if(m_badChannelMask->cellShouldBeMasked(id)) cellContent=2; + else if(energyChan != 0) cellContent=3; + } + + + /** Fill Coverage maps */ + /** A-Side */ + if(etaChan >= 0){ + /** EM Barrel */ + if(m_LArOnlineIDHelper->isEMBchannel(id) ) { + int sampling = m_LArEM_IDHelper->sampling(offlineID); + coverageMapEMBA[ft*m_NslotEMB+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); + } + /** EM Endcap */ + if(m_LArOnlineIDHelper->isEMECchannel(id)) { + int sampling = m_LArEM_IDHelper->sampling(offlineID); + coverageMapEMECA[ft*m_NslotEMEC+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); + } + /** HEC */ + if (m_LArOnlineIDHelper->isHECchannel(id)) { + int sampling = m_LArHEC_IDHelper->sampling(offlineID); + coverageMapHECA[ft*m_NslotHEC+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); + } + /** FCAL */ + if (m_LArOnlineIDHelper->isFCALchannel(id)) { + int sampling = m_LArFCAL_IDHelper->module(offlineID); + double etaFCal = m_LArFCAL_IDHelper->eta(offlineID); + double phiFCal = m_LArFCAL_IDHelper->phi(offlineID); + coverageMapFCALA[ft*m_NslotFCAL+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaFCal,phiFCal)); + } + /** C-Side */ + }else{ + /** EM Barrel */ + if(m_LArOnlineIDHelper->isEMBchannel(id) ) { + int sampling = m_LArEM_IDHelper->sampling(offlineID); + coverageMapEMBC[ft*m_NslotEMB+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); + } + /** EM Endcap */ + if(m_LArOnlineIDHelper->isEMECchannel(id)) { + int sampling = m_LArEM_IDHelper->sampling(offlineID); + coverageMapEMECC[ft*m_NslotEMEC+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); + } + /** HEC */ + if (m_LArOnlineIDHelper->isHECchannel(id)) { + int sampling = m_LArHEC_IDHelper->sampling(offlineID); + coverageMapHECC[ft*m_NslotHEC+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaChan,phiChan)); + } + /** FCAL */ + if (m_LArOnlineIDHelper->isFCALchannel(id)) { + int sampling = m_LArFCAL_IDHelper->module(offlineID); + double etaFCal = m_LArFCAL_IDHelper->eta(offlineID); + double phiFCal = m_LArFCAL_IDHelper->phi(offlineID); + coverageMapFCALC[ft*m_NslotFCAL+slot-1][sampling].push_back(LArChanHelp(single_channel,cellContent,etaFCal,phiFCal)); + } + } + }// end Raw Channels Loop + + + /** now correct for missing febs and pass the coverage maps to the fill() method. */ + + SG::ReadCondHandle<LArBadFebCont> bf{m_BFKey,ctx}; + const LArBadFebCont* mfCont{*bf}; + ATH_MSG_DEBUG( "now check missing FEBS"); + if(!mfCont) { + ATH_MSG_WARNING( "Do not have Missing FEBs container !!" ); + /** simply fill in what you have */ + //EMB + for(int i_feb=0;i_feb<m_NftEMB*m_NslotEMB;i_feb++) { + mon_FtSlot=i_feb; + for(int i_sam=0;i_sam<m_Nsample;i_sam++) { + the_coverageMap.clear(); + the_coverageMap=coverageMapEMBA[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayBarrel.at("EMBA")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"EMBA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + if(i_sam==1) { + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMB1_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + for(int i_step=0;i_step<n_binSteps;i_step++) { + deltaPhi=(2*TMath::Pi()/m_NphiBinsEMB1)*binStepsEM_A[i_step]; + fill(m_CoverageHWGroupName+"EMBA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } //done filling the white bins + the_coverageMap.clear(); + the_coverageMap=coverageMapEMBC[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayBarrel.at("EMBC")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"EMBC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + if(i_sam==1) { + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMB1_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + for(int i_step=0;i_step<n_binSteps;i_step++) { + deltaPhi=(2*TMath::Pi()/m_NphiBinsEMB1)*binStepsEM_C[i_step]; + fill(m_CoverageHWGroupName+"EMBC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } //done filling the white bins + } + } + //EMEC + for(int i_feb=0;i_feb<m_NftEMEC*m_NslotEMEC;i_feb++) { + mon_FtSlot=i_feb; + for(int i_sam=0;i_sam<m_Nsample;i_sam++) { + the_coverageMap.clear(); + the_coverageMap=coverageMapEMECA[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("EMECA")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"EMECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + if(i_sam==2) { + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + for(int i_step=0;i_step<n_binSteps;i_step++) { + deltaPhi=(2*TMath::Pi()/m_NphiBinsEMEC2)*binStepsEM_A[i_step]; + fill(m_CoverageHWGroupName+"EMECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } //done filling the white bins + the_coverageMap.clear(); + the_coverageMap=coverageMapEMECC[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("EMECC")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"EMECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + if(i_sam==2) { + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + for(int i_step=0;i_step<n_binSteps;i_step++) { + deltaPhi=(2*TMath::Pi()/m_NphiBinsEMEC2)*binStepsEM_C[i_step]; + fill(m_CoverageHWGroupName+"EMECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } //done filling the white bins + } + } + //HEC + for(int i_feb=0;i_feb<m_NftHEC*m_NslotHEC;i_feb++) { + mon_FtSlot=i_feb; + for(int i_sam=0;i_sam<m_Nsample;i_sam++) { + the_coverageMap.clear(); + the_coverageMap=coverageMapHECA[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("HECA")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"HECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + deltaPhi=(2*TMath::Pi()/m_NphiBinsHEC[i_sam])*binStepsHEC; + fill(m_CoverageHWGroupName+"HECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //done filling the white bins + + the_coverageMap.clear(); + the_coverageMap=coverageMapHECC[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("HECC")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"HECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); +//fill in white bins + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + deltaPhi=(2*TMath::Pi()/m_NphiBinsHEC[i_sam])*binStepsHEC; + fill(m_CoverageHWGroupName+"HECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //done filling the white bins + } + } + //FCAL + for(int i_feb=0;i_feb<m_NftFCAL*m_NslotFCAL;i_feb++) { + mon_FtSlot=i_feb; + for(int i_sam=1;i_sam<m_Nsample;i_sam++) { //starting from 1 in fcal + the_coverageMap=coverageMapFCALA[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("FCalA")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"FCalA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + the_coverageMap=coverageMapFCALC[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("FCalC")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"FCalC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } + return StatusCode::SUCCESS; +} + + /** since you have the missing FEB information, apply the correction */ + for (std::vector<HWIdentifier>::const_iterator allFeb = m_LArOnlineIDHelper->feb_begin();allFeb != m_LArOnlineIDHelper->feb_end(); ++allFeb) { + HWIdentifier febid = HWIdentifier(*allFeb); + + /** + * Known missing FEB: set content to 1 + * Known missing FEB but cells actually readout: set content to 4 + * Known FEB with error: set content to 0 (CaloCells not produced) + */ + + int barrel_ec = m_LArOnlineIDHelper->barrel_ec(febid); + int pos_neg = m_LArOnlineIDHelper->pos_neg(febid); + int ft = m_LArOnlineIDHelper->feedthrough(febid); + int slot = m_LArOnlineIDHelper->slot(febid); + const LArBadFeb febStatus = mfCont->status(febid); + + //Barrel + if (barrel_ec==0) { + int i_feb=ft*m_NslotEMB+slot-1; + mon_FtSlot=i_feb; + + // EMBA + if (pos_neg==1){ + //check for replacement + int replace=-100; + bool isMapEmpty=true; + for(uint i_sam=0;i_sam<coverageMapEMBA[i_feb].size();i_sam++) { + if(coverageMapEMBA[i_feb][i_sam].size()>0) { + ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapEMBA[i_feb][i_sam][1]).getChNumber() ); + replace = CheckReplacement((coverageMapEMBA[i_feb][i_sam][1]).getChStatus(),febStatus); + isMapEmpty=false; + break; + } + } + if(isMapEmpty) continue; + + /** replace content if you have to */ + bool doReplace=(replace>-100); + for(uint i_sam=0;i_sam<coverageMapEMBA[i_feb].size();i_sam++) { + if(doReplace) { + for (auto chanElement : coverageMapEMBA[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place + } + + /** now that everything is set, fill */ + the_coverageMap.clear(); + the_coverageMap=coverageMapEMBA[i_feb][i_sam]; + ATH_MSG_DEBUG( "fill EMBA: i_feb=" << i_feb << " i_sam=" << i_sam << " size="<< the_coverageMap.size()); + fill(m_tools[m_CoverageHWToolArrayBarrel.at("EMBA")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"EMBA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + if(i_sam==1) { + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMB1_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + for(int i_step=0;i_step<n_binSteps;i_step++) { + deltaPhi=(2*TMath::Pi()/m_NphiBinsEMB1)*binStepsEM_A[i_step]; + fill(m_CoverageHWGroupName+"EMBA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } //done filling the white bins + } + } + + // EMBC + if (pos_neg==0){ + + //check for replacement + int replace=-100; + bool isMapEmpty=true; + for(uint i_sam=0;i_sam<coverageMapEMBC[i_feb].size();i_sam++) { + if(coverageMapEMBC[i_feb][i_sam].size()>0) { + replace = CheckReplacement((coverageMapEMBC[i_feb][i_sam][1]).getChStatus(),febStatus); + isMapEmpty=false; + break; + } + } + if(isMapEmpty) continue; + + /** replace content if you have to */ + bool doReplace=(replace>-100); + for(uint i_sam=0;i_sam<coverageMapEMBC[i_feb].size();i_sam++) { + if(doReplace) { + for (auto chanElement : coverageMapEMBC[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place + } + + /** now that everything is set, fill */ + the_coverageMap.clear(); + the_coverageMap=coverageMapEMBC[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayBarrel.at("EMBC")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"EMBC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + if(i_sam==1) { + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMB1_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + for(int i_step=0;i_step<n_binSteps;i_step++) { + deltaPhi=(2*TMath::Pi()/m_NphiBinsEMB1)*binStepsEM_C[i_step]; + fill(m_CoverageHWGroupName+"EMBC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } //done filling the white bins + } + } + } + //Endcap + if (barrel_ec==1) { + // First find out if it's EMEC, HEC or FCAL ! + HWIdentifier test_chid = m_LArOnlineIDHelper->channel_Id(febid,1); + + //EMEC + if(m_LArOnlineIDHelper->isEMECchannel(test_chid)) { + int i_feb=ft*m_NslotEMEC+slot-1; + mon_FtSlot=i_feb; + + // EMECA + if (pos_neg==1){ + + //check for replacement + int replace=-100; + bool isMapEmpty=true; + for(uint i_sam=0;i_sam<coverageMapEMECA[i_feb].size();i_sam++) { + if(coverageMapEMECA[i_feb][i_sam].size()>0) { + ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapEMECA[i_feb][i_sam][1]).getChNumber() ); + replace = CheckReplacement((coverageMapEMECA[i_feb][i_sam][1]).getChStatus(),febStatus); + isMapEmpty=false; + break; + } + } + if(isMapEmpty) continue; + + /** replace content if you have to */ + bool doReplace=(replace>-100); + for(uint i_sam=0;i_sam<coverageMapEMECA[i_feb].size();i_sam++) { + if(doReplace) { + for (auto chanElement : coverageMapEMECA[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place + } + + /** now that everything is set, fill */ + the_coverageMap.clear(); + the_coverageMap=coverageMapEMECA[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("EMECA")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"EMECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + if(i_sam==2) { + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + for(int i_step=0;i_step<n_binSteps;i_step++) { + deltaPhi=(2*TMath::Pi()/m_NphiBinsEMEC2)*binStepsEM_A[i_step]; + fill(m_CoverageHWGroupName+"EMECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } //done filling the white bins + } + } + + // EMECC + if (pos_neg==0){ + + //check for replacement + int replace=-100; + bool isMapEmpty=true; + for(uint i_sam=0;i_sam<coverageMapEMECC[i_feb].size();i_sam++) { + if(coverageMapEMECC[i_feb][i_sam].size()>0) { + ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapEMECC[i_feb][i_sam][1]).getChNumber() ); + replace = CheckReplacement((coverageMapEMECC[i_feb][i_sam][1]).getChStatus(),febStatus); + isMapEmpty=false; + break; + } + } + if(isMapEmpty) continue; + + /** replace content if you have to */ + bool doReplace=(replace>-100); + for(uint i_sam=0;i_sam<coverageMapEMECC[i_feb].size();i_sam++) { + if(doReplace) { + for (auto chanElement : coverageMapEMECC[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place + } + + //now that everything is set, fill + the_coverageMap.clear(); + the_coverageMap=coverageMapEMECC[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("EMECC")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"EMECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + if(i_sam==2) { + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + for(int i_step=0;i_step<n_binSteps;i_step++) { + deltaPhi=(2*TMath::Pi()/m_NphiBinsEMEC2)*binStepsEM_C[i_step]; + fill(m_CoverageHWGroupName+"EMECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } //done filling the white bins + } + } + } + + //HEC + if(m_LArOnlineIDHelper->isHECchannel(test_chid)){ + int i_feb=ft*m_NslotHEC+slot-1; + mon_FtSlot=i_feb; + + // HECA + if (pos_neg==1){ + + //check for replacement + int replace=-100; + bool isMapEmpty=true; + for(uint i_sam=0;i_sam<coverageMapHECA[i_feb].size();i_sam++) { + if(coverageMapHECA[i_feb][i_sam].size()>0) { + ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapHECA[i_feb][i_sam][1]).getChNumber() ); + replace = CheckReplacement((coverageMapHECA[i_feb][i_sam][1]).getChStatus(),febStatus); + isMapEmpty=false; + break; + } + } + if(isMapEmpty) continue; + + /** replace content if you have to */ + bool doReplace=(replace>-100); + for(uint i_sam=0;i_sam<coverageMapHECA[i_feb].size();i_sam++) { + if(doReplace) { + for (auto chanElement : coverageMapHECA[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place + } + + //now that everything is set, fill + the_coverageMap.clear(); + the_coverageMap=coverageMapHECA[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("HECA")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"HECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + deltaPhi=(2*TMath::Pi()/m_NphiBinsHEC[i_sam])*binStepsHEC; + fill(m_CoverageHWGroupName+"HECA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //done filling the white bins + } + } + + // HECC + if (pos_neg==0){ + + //check for replacement + int replace=-100; + bool isMapEmpty=true; + for(uint i_sam=0;i_sam<coverageMapHECC[i_feb].size();i_sam++) { + if(coverageMapHECC[i_feb][i_sam].size()>0) { + ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapHECC[i_feb][i_sam][1]).getChNumber() ); + replace = CheckReplacement((coverageMapHECC[i_feb][i_sam][1]).getChStatus(),febStatus); + isMapEmpty=false; + break; + } + } + if(isMapEmpty) continue; + + /** replace content if you have to */ + bool doReplace=(replace>-100); + for(uint i_sam=0;i_sam<coverageMapHECC[i_feb].size();i_sam++) { + if(doReplace) { + for (auto chanElement : coverageMapHECC[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place + } + + //now that everything is set, fill + the_coverageMap.clear(); + the_coverageMap=coverageMapHECC[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("HECC")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"HECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //fill in white bins + the_coverageMap.erase(std::remove_if(the_coverageMap.begin(),the_coverageMap.end(),etaRangeEMEC2andHEC_lambda),the_coverageMap.end()); //remove eta region which doesn't need additional fill + deltaPhi=(2*TMath::Pi()/m_NphiBinsHEC[i_sam])*binStepsHEC; + fill(m_CoverageHWGroupName+"HECC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + //done filling the white bins + } + } + } + + //FCAL + if(m_LArOnlineIDHelper->isFCALchannel(test_chid)){ + int i_feb=ft*m_NslotFCAL+slot-1; + mon_FtSlot=i_feb; + + // FCALA + if (pos_neg==1){ + + //check for replacement + int replace=-100; + bool isMapEmpty=true; + for(uint i_sam=0;i_sam<coverageMapFCALA[i_feb].size();i_sam++) { + if(coverageMapFCALA[i_feb][i_sam].size()>0) { + ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapFCALA[i_feb][i_sam][1]).getChNumber() ); + replace = CheckReplacement((coverageMapFCALA[i_feb][i_sam][1]).getChStatus(),febStatus); + isMapEmpty=false; + break; + } + } + if(isMapEmpty) continue; + + /** replace content if you have to */ + bool doReplace=(replace>-100); + for(uint i_sam=1;i_sam<coverageMapFCALA[i_feb].size();i_sam++) { //starting from 1 in FCal + if(doReplace) { + for (auto chanElement : coverageMapFCALA[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place + } + + //now that everything is set, fill + the_coverageMap.clear(); + the_coverageMap=coverageMapFCALA[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("FCalA")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"FCalA"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } + + // FCALC + if (pos_neg==0){ + + //check for replacement + int replace=-100; + bool isMapEmpty=true; + for(uint i_sam=0;i_sam<coverageMapFCALC[i_feb].size();i_sam++) { + if(coverageMapFCALC[i_feb][i_sam].size()>0) { + ATH_MSG_DEBUG( "Feedthrough=" << ft << ", Slot=" << slot << ". Channel checked for replacement: " << (coverageMapFCALC[i_feb][i_sam][1]).getChNumber() ); + replace = CheckReplacement((coverageMapFCALC[i_feb][i_sam][1]).getChStatus(),febStatus); + isMapEmpty=false; + break; + } + } + if(isMapEmpty) continue; + + /** replace content if you have to */ + bool doReplace=(replace>-100); + //set content + for(uint i_sam=1;i_sam<coverageMapFCALC[i_feb].size();i_sam++) { //starting from 1 in fcal + if(doReplace) { + for (auto chanElement : coverageMapFCALC[i_feb][i_sam]) chanElement.setChanStatus(replace); //no need to check if connected, since channels not connected are not saved in the map in the first place + } + + //now that everything is set, fill + the_coverageMap.clear(); + the_coverageMap=coverageMapFCALC[i_feb][i_sam]; + fill(m_tools[m_CoverageHWToolArrayEndcap.at("FCalC")],mon_Channels,mon_FtSlot,mon_coverage); + deltaPhi=0; + fill(m_CoverageHWGroupName+"FCalC"+std::to_string(i_sam),mon_Eta,mon_Phi,mon_coverage); + } + } + } + } + }// end of FEB loop + + return StatusCode::SUCCESS; +} + + +/*---------------------------------------------------------*/ +int LArCoverageAlg::CheckReplacement(int content,LArBadFeb febStatus) const +{ + /** check if this FEB needs replacement */ + int replace=-100; + if (febStatus.deadAll() || febStatus.deadReadout()) { + if(content==0 || content==1) replace=1; + else replace=4; + } + if(febStatus.inError()) { + replace=1; + } + return replace; +} + +/*---------------------------------------------------------*/ +int LArCoverageAlg::DBflag(HWIdentifier onID) const +{ + SG::ReadCondHandle<LArBadChannelCont> bch{m_BCKey}; + const LArBadChannelCont* bcCont{*bch}; + if(!bcCont) { + ATH_MSG_WARNING( "Do not have Bad chan container " << m_BCKey.key() ); + return -1; + } + + LArBadChannel bc = bcCont->status(onID); + + int flag = 0; + if(bc.deadCalib()) flag = 1; + if(bc.lowNoiseHG()||bc.lowNoiseMG()||bc.lowNoiseLG()) flag = 2; + if(bc.distorted()) flag = 3; + if(bc.unstable()) flag = 4; + if(bc.sporadicBurstNoise()) flag = 5; + if(bc.highNoiseHG()|| bc.highNoiseMG() || bc.highNoiseLG()) flag = 6; + if(bc.deadReadout()||bc.deadPhys()||bc.almostDead()||bc.shortProblem()) flag = 7; + + return flag; + } + + + diff --git a/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.h b/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..5e10745278f611775661c9b5011e8be88eab9244 --- /dev/null +++ b/LArCalorimeter/LArMonitoring/src/LArCoverageAlg.h @@ -0,0 +1,148 @@ + + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @class LArCoverageAlg + * @author Margherita Spalla (margherita.spalla@cern.ch) [migrated from LArCoverage algorithm by Jessica Leveque <jleveque@in2p3.fr>] + * + */ + +#ifndef LARCOVERAGEALG_H +#define LARCOVERAGEALG_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoringKernel/Monitored.h" + + +#include "StoreGate/ReadHandleKey.h" +#include "CaloIdentifier/CaloGain.h" +#include "CaloIdentifier/CaloIdManager.h" +#include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloGeoHelpers/CaloPhiRange.h" + +#include "Identifier/HWIdentifier.h" +#include "LArIdentifier/LArOnlineID.h" +#include "LArRawEvent/LArRawChannelContainer.h" +#include "LArCabling/LArOnOffIdMapping.h" +#include "LArRecConditions/ILArBadChannelMasker.h" +#include "LArRecConditions/LArBadChannelCont.h" +#include "CaloConditions/CaloNoise.h" + + +class LArEM_ID; +class CaloDetDescrElement; + + +class LArCoverageAlg: public AthMonitorAlgorithm +{ + public: + LArCoverageAlg( const std::string& name, ISvcLocator* pSvcLocator ); + + /** @brief Default destructor */ + virtual ~LArCoverageAlg(); + + /** @brief Overwrite dummy method from AlgTool */ + StatusCode initialize() override; + + /** Called each event */ + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + + + + private: + + class LArChanHelp { + public: + LArChanHelp(int chan=-1,int status=-100,double eta=-100,double phi=-100): m_channelNumber(chan), m_channelStatus(status), m_channelEta(eta), m_channelPhi(phi) {}; + ~LArChanHelp() {}; + + void setChanStatus(int status){m_channelStatus=status;}; + void setChanPhi(double phi){m_channelPhi=phi;}; + int getChNumber() const { return m_channelNumber; }; + int getChStatus() const { return m_channelStatus; }; + double getChEta() const { return m_channelEta; }; + double getChPhi() const { return m_channelPhi; }; + + private: + int m_channelNumber; + int m_channelStatus; + double m_channelEta; + double m_channelPhi; + + }; + + const LArOnlineID* m_LArOnlineIDHelper; + const LArEM_ID* m_LArEM_IDHelper; + const LArFCAL_ID* m_LArFCAL_IDHelper; + const LArHEC_ID* m_LArHEC_IDHelper; + const CaloIdManager* m_caloIdMgr; + + + /** Handle to LArOnOffIdMapping (former LArCablingService) */ + SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; + + /** Key for CaloNoise */ + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","electronicNoise","SG Key of CaloNoise data object"}; + + /** Handle to bad-channel tools */ + ToolHandle<ILArBadChannelMasker> m_badChannelMask ; + + SG::ReadHandleKey<LArRawChannelContainer> m_rawChannelsKey; + SG::ReadCondHandleKey<LArBadChannelCont> m_BCKey{this, "BadChanKey", "LArBadChannel", "SG bad channels key"}; + SG::ReadCondHandleKey<LArBadFebCont> m_BFKey{this, "MFKey", "LArBadFeb", "SG missing FEBs key"}; + + + /** To retrieve bad channel DB keywords */ + int DBflag(HWIdentifier) const; + + /** To check if FEB status in map needs to be replaced */ + int CheckReplacement(int ,LArBadFeb) const; + + /** Properties */ + Gaudi::Property<EventContext::ContextEvt_t> m_nevents {this,"Nevents",50}; + Gaudi::Property<int> m_Nchannels {this,"Nchannels",128}; + Gaudi::Property<int> m_Nsample {this,"Nsample",4}; + Gaudi::Property<int> m_NftEMB {this,"NftEMB",32}; + Gaudi::Property<int> m_NslotEMB {this,"NslotEMB",14}; + Gaudi::Property<int> m_NftEMEC {this,"NftEMEC",25}; + Gaudi::Property<int> m_NslotEMEC {this,"NslotEMEC",15}; + Gaudi::Property<int> m_NftHEC {this,"NftHEC",25}; + Gaudi::Property<int> m_NslotHEC {this,"NslotHEC",15}; + Gaudi::Property<int> m_NftFCAL {this,"NftFCAL",25}; + Gaudi::Property<int> m_NslotFCAL {this,"NslotFCAL",15}; + Gaudi::Property<int> m_NphiBinsEMB1 {this,"NphiBinsEMB1",256}; + Gaudi::Property<int> m_NphiBinsEMEC2 {this,"NphiBinsEMEC2",256}; + Gaudi::Property<std::vector<int> > m_NphiBinsHEC {this,"NphiBinsHEC",{64,64,64,64}}; + + + Gaudi::Property<std::string> m_CaloNoiseToolGroupName {this,"CaloNoiseToolGroupName","CaloNoise"}; + Gaudi::Property<std::string> m_BadChannelsGroupName {this,"BadChannelsGroupName","BadChannels"}; + Gaudi::Property<std::string> m_CoverageHWGroupName {this,"CoverageHWGroupName","CoverageHW"}; + Gaudi::Property< std::vector<std::string> > m_CoverageBarrelPartitions {this, "CoverageBarrelPartitions", {"EMBA","EMBC"}}; + Gaudi::Property< std::vector<std::string> > m_CoverageEndcapPartitions {this, "CoverageEndcapPartitions", {"EMECA","EMECC","HECA","HECC","FCalA","FCalC"}}; + Gaudi::Property< std::vector<std::string> > m_Sides {this, "Sides", {"A","C"}}; + + /** for tools array */ + std::vector<int> m_CaloNoiseGroupArrEM; + std::vector<int> m_CaloNoiseGroupArrHEC; + std::vector<int> m_CaloNoiseGroupArrFCAL; + std::map<std::string,int> m_CoverageHWToolArrayBarrel; + std::map<std::string,int> m_CoverageHWToolArrayEndcap; + std::map<std::string,int> m_BadChannelToolArrayBarrel; + std::map<std::string,int> m_BadChannelToolArrayEndcap; + + + /** for CaloNoise*/ + const std::array<CaloGain::CaloGain,CaloCell_Base_ID::NSUBCALO> m_highestGain{ + CaloGain::LARHIGHGAIN, //LAREM + CaloGain::LARMEDIUMGAIN, //LARHEC + CaloGain::LARHIGHGAIN, //LARFCAL + CaloGain::TILEHIGHHIGH, //TILE + CaloGain::LARHIGHGAIN //LARMINIFCAL + }; +}; + +#endif diff --git a/LArCalorimeter/LArMonitoring/src/LArDigitMonAlg.h b/LArCalorimeter/LArMonitoring/src/LArDigitMonAlg.h index 7088f9c899ea14bed3fa1388be14e44ec7b06b81..fb2331ce41287cf0bea438846e17961393803c3d 100755 --- a/LArCalorimeter/LArMonitoring/src/LArDigitMonAlg.h +++ b/LArCalorimeter/LArMonitoring/src/LArDigitMonAlg.h @@ -18,6 +18,8 @@ #include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/ReadHandleKey.h" +//Events infos: +#include "xAODEventInfo/EventInfo.h" #include "LArRecEvent/LArNoisyROSummary.h" #include "LArRawEvent/LArDigitContainer.h" #include "LArCabling/LArOnOffIdMapping.h" @@ -27,6 +29,7 @@ class LArEM_ID; class LArOnlineID; class HWIdentifier; +class LArOnlineIDStrHelper; class LArOnOffIdMapping; class LArDigitMonAlg: public AthMonitorAlgorithm @@ -64,6 +67,7 @@ private: Gaudi::Property<int> m_NumberBadFebs {this, "NumberBadFebs", 5}; /**bool use to mask the bad channels*/ Gaudi::Property<bool> m_ignoreKnownBadChannels{this, "IgnoreBadChannels", false}; + bool m_PercComputed; /** Switch to online/offline mode*/ Gaudi::Property<bool> m_IsOnline {this, "IsOnline", false}; /** Treshold to declare a bad event*/ diff --git a/LArCalorimeter/LArMonitoring/src/LArNoisyROMonAlg.cxx b/LArCalorimeter/LArMonitoring/src/LArNoisyROMonAlg.cxx index c789c860f7e59f29e93e707aa0967b91f0701c6a..256dd0974fe76574514f6a4d19b9df8546a77036 100644 --- a/LArCalorimeter/LArMonitoring/src/LArNoisyROMonAlg.cxx +++ b/LArCalorimeter/LArMonitoring/src/LArNoisyROMonAlg.cxx @@ -37,6 +37,51 @@ StatusCode LArNoisyROMonAlg::initialize() return AthMonitorAlgorithm::initialize(); } +/* +StatusCode LArNoisyROMonAlg::bookHistograms() +{ + + m_eventCounter=0; + std::string hTitle; + std::stringstream tit; + + MonGroup overall(this, "/LAr/NoisyRO", run, ATTRIB_MANAGED ); + if(m_doHisto) { + // Book histograms per partitions + MonGroup GroupBarrel(this, "/LAr/NoisyRO/Barrel", run, ATTRIB_MANAGED ); + MonGroup GroupBarrelFrac(this, "/LAr/NoisyRO/Barrel", run, ATTRIB_MANAGED ,"", "weightedEff"); + MonGroup GroupBarrelFracBin(this, "/LAr/NoisyRO/Barrel", run, ATTRIB_MANAGED ,"", "perBinEffPerCent"); + m_partHistos.resize(4); + bookPartitionHistos(m_partHistos[1],"EMBA",GroupBarrel,GroupBarrelFrac,GroupBarrelFracBin); + bookPartitionHistos(m_partHistos[2],"EMBC",GroupBarrel,GroupBarrelFrac,GroupBarrelFracBin); + + MonGroup GroupEMEC(this, "/LAr/NoisyRO/EMEC", run, ATTRIB_MANAGED ); + MonGroup GroupEMECFrac(this, "/LAr/NoisyRO/EMEC", run, ATTRIB_MANAGED,"", "weightedEff" ); + MonGroup GroupEMECFracBin(this, "/LAr/NoisyRO/EMEC", run, ATTRIB_MANAGED,"", "perBinEffPerCent" ); + bookPartitionHistos(m_partHistos[0],"EMECA",GroupEMEC,GroupEMECFrac,GroupEMECFracBin); + bookPartitionHistos(m_partHistos[3],"EMECC",GroupEMEC,GroupEMECFrac,GroupEMECFracBin); + + + // Fill Suspicious MNB FEBs + for (uint i=0;i<m_knownMNBFEBs.size();i++){ + const HWIdentifier& febid = HWIdentifier(m_knownMNBFEBs[i]); + HWIdentifier id = m_LArOnlineIDHelper->channel_Id(febid,0); + int FT = m_LArOnlineIDHelper->feedthrough(id); + int slot = m_LArOnlineIDHelper->slot(id); + int partition = partitionNumber(febid); + m_partHistos[partition].h_MNBKnownFEB->Fill(slot,FT); + } + + + } + + + return StatusCode::SUCCESS; +} + +*/ + + StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const { { // extra namespace for mutex @@ -172,6 +217,9 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const if ( algo != 0 ) { if ( burstveto ) algo |= 0x4; + //unsigned uf=algo; + //std::cout<<"LArNoisyROMonAlg flag: "<<uf<<std::endl; + //m_NoiseTimeTree->Fill(); ATH_MSG_DEBUG("Filling LArNoise tree with algo: " << algo); fill(m_MonGroupName,time,time_ns,algo); } else { @@ -204,16 +252,15 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const for (size_t i = 0; i<noisyFEB.size(); i++) { + //std::cout << "Noisy FEB " << noisyFEB[i].get_compact() << std::endl; NbNoisyFEB++; const HWIdentifier& febid = noisyFEB[i]; - // Will be used in nest versions: - //HWIdentifier id = m_LArOnlineIDHelper->channel_Id(febid,0); - //int FT = m_LArOnlineIDHelper->feedthrough(id); - //int slot = m_LArOnlineIDHelper->slot(id); + HWIdentifier id = m_LArOnlineIDHelper->channel_Id(febid,0); + int FT = m_LArOnlineIDHelper->feedthrough(id); + int slot = m_LArOnlineIDHelper->slot(id); int partition = partitionNumber(febid); if (partition<4){ - // FIXME: //if (m_IsOnline) // m_partHistos[partition].h_NoisyFEBPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); // else @@ -230,30 +277,27 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const // Fill two histograms with veto cut and all events for (size_t i = 0; i<mnbtightFEB.size(); i++) { + //std::cout << "MNBTight FEB " << noisyFEB[i].get_compact() << std::endl; const HWIdentifier& febid = mnbtightFEB[i]; - // Will be used in next iteration - //HWIdentifier id = m_LArOnlineIDHelper->channel_Id(febid,0); - //int FT = m_LArOnlineIDHelper->feedthrough(id); - //int slot = m_LArOnlineIDHelper->slot(id); + HWIdentifier id = m_LArOnlineIDHelper->channel_Id(febid,0); + int FT = m_LArOnlineIDHelper->feedthrough(id); + int slot = m_LArOnlineIDHelper->slot(id); int partition = partitionNumber(febid); if (partition<4){ - //FIXME if (m_IsOnline) { //m_partHistos[partition].h_CandidateMNBTightFEBPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); - if((noisyRO->MNBTightFlaggedPartitions() & partMask[partition]) != 0){ + if((noisyRO->MNBTightFlaggedPartitions() & partMask[partition]) != 0) //m_partHistos[partition].h_MNBTightFEBPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); ; - } } else { //m_partHistos[partition].h_CandidateMNBTightFEBFracPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); - if((noisyRO->MNBTightFlaggedPartitions() & partMask[partition]) != 0){ + if((noisyRO->MNBTightFlaggedPartitions() & partMask[partition]) != 0) //m_partHistos[partition].h_MNBTightFEBFracPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); ; - } } } @@ -266,29 +310,27 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const for (size_t i = 0; i<mnbtight_PsVetoFEB.size(); i++) { const HWIdentifier& febid = mnbtight_PsVetoFEB[i]; - // Will be used in next iteration - //HWIdentifier id = m_LArOnlineIDHelper->channel_Id(febid,0); - //int FT = m_LArOnlineIDHelper->feedthrough(id); - //int slot = m_LArOnlineIDHelper->slot(id); + HWIdentifier id = m_LArOnlineIDHelper->channel_Id(febid,0); + int FT = m_LArOnlineIDHelper->feedthrough(id); + int slot = m_LArOnlineIDHelper->slot(id); int partition = partitionNumber(febid); +// std::cout << "MNBTight_PsVeto FEB " << mnbtight_PsVetoFEB[i].get_compact() << std::endl; +// std::cout << "Partitions : " << (noisyRO->MNBTight_PsVetoFlaggedPartitions() & partMask[partition]) << std::endl; if (partition<4){ - //FIXME if (m_IsOnline) { //m_partHistos[partition].h_CandidateMNBTight_PsVetoFEBPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); - if((noisyRO->MNBTight_PsVetoFlaggedPartitions() & partMask[partition]) != 0){ + if((noisyRO->MNBTight_PsVetoFlaggedPartitions() & partMask[partition]) != 0) //m_partHistos[partition].h_MNBTight_PsVetoFEBPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); ; - } } else { //m_partHistos[partition].h_CandidateMNBTight_PsVetoFEBFracPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); - if((noisyRO->MNBTight_PsVetoFlaggedPartitions() & partMask[partition]) != 0){ + if((noisyRO->MNBTight_PsVetoFlaggedPartitions() & partMask[partition]) != 0) //m_partHistos[partition].h_MNBTight_PsVetoFEBFracPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); ; - } } } @@ -301,29 +343,25 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const { //std::cout << "MNBLoose FEB " << noisyFEB[i].get_compact() << std::endl; const HWIdentifier& febid = mnblooseFEB[i]; - // Will be used in next iteration: - //HWIdentifier id = m_LArOnlineIDHelper->channel_Id(febid,0); - //int FT = m_LArOnlineIDHelper->feedthrough(id); - //int slot = m_LArOnlineIDHelper->slot(id); + HWIdentifier id = m_LArOnlineIDHelper->channel_Id(febid,0); + int FT = m_LArOnlineIDHelper->feedthrough(id); + int slot = m_LArOnlineIDHelper->slot(id); int partition = partitionNumber(febid); if (partition<4){ - // FIXME if (m_IsOnline) { //m_partHistos[partition].h_CandidateMNBLooseFEBPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); - if((noisyRO->MNBLooseFlaggedPartitions() & partMask[partition]) != 0) { + if((noisyRO->MNBLooseFlaggedPartitions() & partMask[partition]) != 0) //m_partHistos[partition].h_MNBLooseFEBPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); ; - } } else { //m_partHistos[partition].h_CandidateMNBLooseFEBFracPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); - if((noisyRO->MNBLooseFlaggedPartitions() & partMask[partition]) != 0){ + if((noisyRO->MNBLooseFlaggedPartitions() & partMask[partition]) != 0) //m_partHistos[partition].h_MNBLooseFEBFracPerEvt->Fill(static_cast<double>(slot), static_cast<double>(FT)+0.1); ; - } } } @@ -337,7 +375,6 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const if ( BadFEBPartitions != 0) { for (int i= 0;i<4;i++){ if ( (BadFEBPartitions & partMask[i]) != 0 ) { - //FIXME //m_partHistos[i].h_NoisyEvent->Fill(LBN); //if ( m_doTrigger ) fillTriggerHisto(m_partHistos[i],trigbits,L1trigbits); //if ( ! burstveto ) m_partHistos[i].h_NoisyEventTimeVeto->Fill(LBN); @@ -350,7 +387,6 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const if ( eventInfo->isEventFlagBitSet(xAOD::EventInfo::LAr,LArEventBitInfo::TIGHTSATURATEDQ) ) { for (int i= 0;i<4;i++){ if ( (SatTightPartitions & partMask[i]) != 0 ) { - //FIXME //m_partHistos[i].h_SaturatedNoisyEvent->Fill(LBN); //if ( ! burstveto ) m_partHistos[i].h_SaturatedNoisyEventTimeVeto->Fill(LBN); } @@ -363,7 +399,6 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const if ( MNBTightPartitions != 0) { for (int i= 0;i<4;i++){ if ( (MNBTightPartitions & partMask[i]) != 0 ) { - //FIXME //m_partHistos[i].h_MNBTightEvent->Fill(LBN); //if ( ! burstveto ) m_partHistos[i].h_MNBTightEventTimeVeto->Fill(LBN); } @@ -375,7 +410,6 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const if ( MNBTight_PsVetoPartitions != 0) { for (int i= 0;i<4;i++){ if ( (MNBTight_PsVetoPartitions & partMask[i]) != 0 ) { - //FIXME //m_partHistos[i].h_MNBTight_PsVetoEvent->Fill(LBN); //if ( ! burstveto ) m_partHistos[i].h_MNBTight_PsVetoEventTimeVeto->Fill(LBN); } @@ -387,7 +421,6 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const if ( MNBLoosePartitions != 0) { for (int i= 0;i<4;i++){ if ( (MNBLoosePartitions & partMask[i]) != 0 ) { - //FIXME //m_partHistos[i].h_MNBLooseEvent->Fill(LBN); //if ( ! burstveto ) m_partHistos[i].h_MNBLooseEventTimeVeto->Fill(LBN); } @@ -397,3 +430,378 @@ StatusCode LArNoisyROMonAlg::fillHistograms(const EventContext& ctx) const return StatusCode::SUCCESS; } +/* +StatusCode LArNoisyROMonAlg::procHistograms() +{ + if(!m_doHisto) return StatusCode::SUCCESS; + + if ( endOfRunFlag() || endOfEventsBlockFlag()){ + if ( m_IsOnline ){ + // copy the "running" histo to the final ones, to be normalised + for (int i=0;i<4;i++){ + copyHisto(m_partHistos[i].h_NoisyFEBPerEvt,m_partHistos[i].h_NoisyFEBFracPerEvt); + copyHisto(m_partHistos[i].h_MNBTightFEBPerEvt,m_partHistos[i].h_MNBTightFEBFracPerEvt); + copyHisto(m_partHistos[i].h_MNBTight_PsVetoFEBPerEvt,m_partHistos[i].h_MNBTight_PsVetoFEBFracPerEvt); + copyHisto(m_partHistos[i].h_MNBLooseFEBPerEvt,m_partHistos[i].h_MNBLooseFEBFracPerEvt); + copyHisto(m_partHistos[i].h_CandidateMNBTightFEBPerEvt,m_partHistos[i].h_CandidateMNBTightFEBFracPerEvt); + copyHisto(m_partHistos[i].h_CandidateMNBTight_PsVetoFEBPerEvt,m_partHistos[i].h_CandidateMNBTight_PsVetoFEBFracPerEvt); + copyHisto(m_partHistos[i].h_CandidateMNBLooseFEBPerEvt,m_partHistos[i].h_CandidateMNBLooseFEBFracPerEvt); + } + } + + if (m_eventCounter>0) { + const double scale = 100./static_cast<double>(m_eventCounter); + + for (int i=0;i<4;i++){ + m_partHistos[i].h_NoisyFEBFracPerEvt->scaleContentsAndErrors(scale); + m_partHistos[i].h_NoisyFEBFracPerEvt->SetEntries(m_eventCounter); + m_partHistos[i].h_MNBTightFEBFracPerEvt->scaleContentsAndErrors(scale); + m_partHistos[i].h_MNBTightFEBFracPerEvt->SetEntries(m_eventCounter); + m_partHistos[i].h_MNBTight_PsVetoFEBFracPerEvt->scaleContentsAndErrors(scale); + m_partHistos[i].h_MNBTight_PsVetoFEBFracPerEvt->SetEntries(m_eventCounter); + m_partHistos[i].h_MNBLooseFEBFracPerEvt->scaleContentsAndErrors(scale); + m_partHistos[i].h_MNBLooseFEBFracPerEvt->SetEntries(m_eventCounter); + m_partHistos[i].h_CandidateMNBTightFEBFracPerEvt->scaleContentsAndErrors(scale); + m_partHistos[i].h_CandidateMNBTightFEBFracPerEvt->SetEntries(m_eventCounter); + m_partHistos[i].h_CandidateMNBTight_PsVetoFEBFracPerEvt->scaleContentsAndErrors(scale); + m_partHistos[i].h_CandidateMNBTight_PsVetoFEBFracPerEvt->SetEntries(m_eventCounter); + m_partHistos[i].h_CandidateMNBLooseFEBFracPerEvt->scaleContentsAndErrors(scale); + m_partHistos[i].h_CandidateMNBLooseFEBFracPerEvt->SetEntries(m_eventCounter); + divideHisto(m_partHistos[i].h_NoisyEventFrac,m_partHistos[i].h_NoisyEvent,m_h_LBN); + m_partHistos[i].h_NoisyEventFrac->SetEntries(m_eventCounter); + divideHisto(m_partHistos[i].h_SaturatedNoisyEventFrac,m_partHistos[i].h_SaturatedNoisyEvent,m_h_LBN); + m_partHistos[i].h_SaturatedNoisyEventFrac->SetEntries(m_eventCounter); + divideHisto(m_partHistos[i].h_MNBTightEventFrac,m_partHistos[i].h_MNBTightEvent,m_h_LBN); + m_partHistos[i].h_MNBTightEventFrac->SetEntries(m_eventCounter); + divideHisto(m_partHistos[i].h_MNBTight_PsVetoEventFrac,m_partHistos[i].h_MNBTight_PsVetoEvent,m_h_LBN); + m_partHistos[i].h_MNBTight_PsVetoEventFrac->SetEntries(m_eventCounter); + divideHisto(m_partHistos[i].h_MNBLooseEventFrac,m_partHistos[i].h_MNBLooseEvent,m_h_LBN); + m_partHistos[i].h_MNBLooseEventFrac->SetEntries(m_eventCounter); + divideHisto(m_partHistos[i].h_NoisyEventTimeVetoFrac,m_partHistos[i].h_NoisyEventTimeVeto,m_h_LBN); + m_partHistos[i].h_NoisyEventTimeVetoFrac->SetEntries(m_eventCounter); + divideHisto(m_partHistos[i].h_SaturatedNoisyEventTimeVetoFrac,m_partHistos[i].h_SaturatedNoisyEventTimeVeto,m_h_LBN); + m_partHistos[i].h_SaturatedNoisyEventTimeVetoFrac->SetEntries(m_eventCounter); + divideHisto(m_partHistos[i].h_MNBTightEventTimeVetoFrac,m_partHistos[i].h_MNBTightEventTimeVeto,m_h_LBN); + m_partHistos[i].h_MNBTightEventTimeVetoFrac->SetEntries(m_eventCounter); + divideHisto(m_partHistos[i].h_MNBTight_PsVetoEventTimeVetoFrac,m_partHistos[i].h_MNBTight_PsVetoEventTimeVeto,m_h_LBN); + m_partHistos[i].h_MNBTight_PsVetoEventTimeVetoFrac->SetEntries(m_eventCounter); + divideHisto(m_partHistos[i].h_MNBLooseEventTimeVetoFrac,m_partHistos[i].h_MNBLooseEventTimeVeto,m_h_LBN); + m_partHistos[i].h_MNBLooseEventTimeVetoFrac->SetEntries(m_eventCounter); + } + }//end if m_eventCounter>0 + } + + + return StatusCode::SUCCESS; +} +*/ + +/* +void LArNoisyROMonAlg::bookPartitionHistos(partitionHistos& partition, const std::string& name, MonGroup& group, MonGroup& groupfrac, MonGroup& groupfracbin ) +{ + std::string hName, hTitle; + std::stringstream tit; + + // declare histograms properties + // Endcaps + int FEB=25,slot=15; + double FEB_low=-0.5, FEB_up=24.5, slot_low=0.5, slot_up=15.5; + // for Barrel + if( name == "EMBA" || name == "EMBC") + { + FEB=32, slot=14; + FEB_low=-0.5, FEB_up=31.5, slot_low=0.5, slot_up=14.5; + } + + // 2D FEB maps (x : slot / y : FT) with z: fraction of events for which the FEB is noisy or mini-noisy. + hName = "MNBKnownFEB_"+name; + hTitle = "Suspicious MNB FEBs - "+name; + partition.h_MNBKnownFEB = TH2I_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + partition.h_MNBKnownFEB->GetXaxis()->SetTitle("Slot"); + partition.h_MNBKnownFEB->GetYaxis()->SetTitle("Feedthrough"); + groupfrac.regHist(partition.h_MNBKnownFEB).ignore(); + + + hName = "NoisyFEBFracPerEvt_"+name; + hTitle = "Yield of events with FEB noisy "+m_NoisyFEBDefStr+" - "+name; + partition.h_NoisyFEBFracPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + partition.h_NoisyFEBFracPerEvt->GetXaxis()->SetTitle("Slot"); + partition.h_NoisyFEBFracPerEvt->GetYaxis()->SetTitle("Feedthrough"); + groupfrac.regHist(partition.h_NoisyFEBFracPerEvt).ignore(); + + if ( m_IsOnline ) + { + hName="temp_"+hName; + partition.h_NoisyFEBPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + group.regHist(partition.h_NoisyFEBPerEvt).ignore(); + } + + hName = "MNBTightFEBFracPerEvt_"+name; + hTitle = "Yield of events with FEB MNB-Tight " + m_MNBTightFEBDefStr+ " - "+name+" (only vetoed events)"; + partition.h_MNBTightFEBFracPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + partition.h_MNBTightFEBFracPerEvt->GetXaxis()->SetTitle("Slot"); + partition.h_MNBTightFEBFracPerEvt->GetYaxis()->SetTitle("Feedthrough"); + groupfrac.regHist(partition.h_MNBTightFEBFracPerEvt).ignore(); + + if ( m_IsOnline ) + { + hName="temp_"+hName; + partition.h_MNBTightFEBPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + group.regHist(partition.h_MNBTightFEBPerEvt).ignore(); + } + + hName = "MNBTight_PsVetoFEBFracPerEvt_"+name; + hTitle = "Yield of events with FEB MNB-Tight_PsVeto " + m_MNBTight_PsVetoFEBDefStr+ " - "+name+" (only vetoed events)"; + partition.h_MNBTight_PsVetoFEBFracPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + partition.h_MNBTight_PsVetoFEBFracPerEvt->GetXaxis()->SetTitle("Slot"); + partition.h_MNBTight_PsVetoFEBFracPerEvt->GetYaxis()->SetTitle("Feedthrough"); + groupfrac.regHist(partition.h_MNBTight_PsVetoFEBFracPerEvt).ignore(); + + if ( m_IsOnline ) + { + hName="temp_"+hName; + partition.h_MNBTight_PsVetoFEBPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + group.regHist(partition.h_MNBTight_PsVetoFEBPerEvt).ignore(); + } + + hName = "MNBLooseFEBFracPerEvt_"+name; + hTitle = "Yield of events with FEB MNB-Loose " + m_MNBLooseFEBDefStr + " - "+name+" (only vetoed events)"; + partition.h_MNBLooseFEBFracPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + partition.h_MNBLooseFEBFracPerEvt->GetXaxis()->SetTitle("Slot"); + partition.h_MNBLooseFEBFracPerEvt->GetYaxis()->SetTitle("Feedthrough"); + groupfrac.regHist(partition.h_MNBLooseFEBFracPerEvt).ignore(); + + if ( m_IsOnline ) + { + hName="temp_"+hName; + partition.h_MNBLooseFEBPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + group.regHist(partition.h_MNBLooseFEBPerEvt).ignore(); + } + + hName = "CandidateMNBTightFEBFracPerEvt_"+name; + hTitle = "Yield of events with FEB MNB-Tight "+ m_MNBTightFEBDefStr+ " - "+name; + partition.h_CandidateMNBTightFEBFracPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + partition.h_CandidateMNBTightFEBFracPerEvt->GetXaxis()->SetTitle("Slot"); + partition.h_CandidateMNBTightFEBFracPerEvt->GetYaxis()->SetTitle("Feedthrough"); + groupfrac.regHist(partition.h_CandidateMNBTightFEBFracPerEvt).ignore(); + + if ( m_IsOnline ) + { + hName="temp_"+hName; + partition.h_CandidateMNBTightFEBPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + group.regHist(partition.h_CandidateMNBTightFEBPerEvt).ignore(); + } + + hName = "CandidateMNBTight_PsVetoFEBFracPerEvt_"+name; + hTitle = "Yield of events with FEB MNB-Tight_PsVeto "+ m_MNBTight_PsVetoFEBDefStr+ " - "+name; + partition.h_CandidateMNBTight_PsVetoFEBFracPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + partition.h_CandidateMNBTight_PsVetoFEBFracPerEvt->GetXaxis()->SetTitle("Slot"); + partition.h_CandidateMNBTight_PsVetoFEBFracPerEvt->GetYaxis()->SetTitle("Feedthrough"); + groupfrac.regHist(partition.h_CandidateMNBTight_PsVetoFEBFracPerEvt).ignore(); + + if ( m_IsOnline ) + { + hName="temp_"+hName; + partition.h_CandidateMNBTight_PsVetoFEBPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + group.regHist(partition.h_CandidateMNBTight_PsVetoFEBPerEvt).ignore(); + } + + hName = "CandidateMNBLooseFEBFracPerEvt_"+name; + hTitle = "Yield of events with FEB MNB-Loose " + m_MNBLooseFEBDefStr + " - "+name; + partition.h_CandidateMNBLooseFEBFracPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + partition.h_CandidateMNBLooseFEBFracPerEvt->GetXaxis()->SetTitle("Slot"); + partition.h_CandidateMNBLooseFEBFracPerEvt->GetYaxis()->SetTitle("Feedthrough"); + groupfrac.regHist(partition.h_CandidateMNBLooseFEBFracPerEvt).ignore(); + + if ( m_IsOnline ) + { + hName="temp_"+hName; + partition.h_CandidateMNBLooseFEBPerEvt = TH2F_LW::create(hName.c_str(), hTitle.c_str(), slot,slot_low,slot_up,FEB,FEB_low,FEB_up); + group.regHist(partition.h_CandidateMNBLooseFEBPerEvt).ignore(); + } + + // Fraction of events found noisy per LB - Regular Noise Burst(RNB) Standard flag + hName = "NoisyEvent_"+name; + hTitle = "Yield of events flagged as RNB-Standard - " + name; + partition.h_NoisyEventFrac = TH1F_LW::create(hName.c_str(),hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_NoisyEventFrac->GetXaxis()->SetTitle("Luminosity Block"); + groupfracbin.regHist(partition.h_NoisyEventFrac).ignore(); + // Histogram below is temporary. Normalized at the end of run to produce the above histograms + hName = "temp_NoisyEvent_"+name; + partition.h_NoisyEvent = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_NoisyEvent->GetXaxis()->SetTitle("Luminosity Block"); + + // Fraction of events found noisy per LB - RNB-Saturated flag + hName = "SaturatedNoisyEvent_"+name; + hTitle = "Yield of events flagged as RNB-Saturated - "+name; + partition.h_SaturatedNoisyEventFrac = TH1F_LW::create(hName.c_str(),hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_SaturatedNoisyEventFrac->GetXaxis()->SetTitle("Luminosity Block"); + groupfracbin.regHist(partition.h_SaturatedNoisyEventFrac).ignore(); + // Histogram below is temporary. Normalized at the end of run to produce the above histograms + hName = "temp_NoisyEvent_"+name; + partition.h_SaturatedNoisyEvent = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_SaturatedNoisyEvent->GetXaxis()->SetTitle("Luminosity Block"); + + hName = "MNBTightEvent_"+name; + hTitle = "Yield of events flagged as MNB-Tight - "+name; + partition.h_MNBTightEventFrac = TH1F_LW::create(hName.c_str(),hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBTightEventFrac->GetXaxis()->SetTitle("Luminosity Block"); + groupfracbin.regHist(partition.h_MNBTightEventFrac).ignore(); + // Histogram below is temporary. Normalized at the end of run to produce the above histograms + hName = "temp_MNBTightEvent_"+name; + partition.h_MNBTightEvent = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBTightEvent->GetXaxis()->SetTitle("Luminosity Block"); + + hName = "MNBTight_PsVetoEvent_"+name; + hTitle = "Yield of events flagged as MNB-Tight_PsVeto - "+name; + partition.h_MNBTight_PsVetoEventFrac = TH1F_LW::create(hName.c_str(),hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBTight_PsVetoEventFrac->GetXaxis()->SetTitle("Luminosity Block"); + groupfracbin.regHist(partition.h_MNBTight_PsVetoEventFrac).ignore(); + // Histogram below is temporary. Normalized at the end of run to produce the above histograms + hName = "temp_MNBTight_PsVetoEvent_"+name; + partition.h_MNBTight_PsVetoEvent = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBTight_PsVetoEvent->GetXaxis()->SetTitle("Luminosity Block"); + + hName = "MNBLooseEvent_"+name; + hTitle = "Yield of events flagged as MNB-Loose - "+name; + partition.h_MNBLooseEventFrac = TH1F_LW::create(hName.c_str(),hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBLooseEventFrac->GetXaxis()->SetTitle("Luminosity Block"); + groupfracbin.regHist(partition.h_MNBLooseEventFrac).ignore(); + // Histogram below is temporary. Normalized at the end of run to produce the above histograms + hName = "temp_MNBLooseEvent_"+name; + partition.h_MNBLooseEvent = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBLooseEvent->GetXaxis()->SetTitle("Luminosity Block"); + +// // Fraction of events found noisy per LB - Weighted flag +// hName = "NoisyWEvent_"+name; +// partition.h_NoisyWEventFrac = TH1F_LW::create(hName.c_str(), "Yield of events flagged as LArNoisyRO_StdOpt", m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); +// partition.h_NoisyWEventFrac->GetXaxis()->SetTitle("Luminosity Block"); +// groupfracbin.regHist(partition.h_NoisyWEventFrac).ignore(); +// hName = "temp_NoisyWEvent_"+name; +// partition.h_NoisyWEvent = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); +// partition.h_NoisyWEvent->GetXaxis()->SetTitle("Luminosity Block"); + + // Fraction of events found noisy per LB after time veto - Std flag + hName = "NoisyEvent_TimeVeto_"+name; + hTitle = "Yield of events flagged as RNB-Standard not vetoed by time window - "+name; + partition.h_NoisyEventTimeVetoFrac = TH1F_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_NoisyEventTimeVetoFrac->GetXaxis()->SetTitle("Luminosity Block"); + groupfracbin.regHist(partition.h_NoisyEventTimeVetoFrac).ignore(); + + hName = "temp_NoisyEvent_TimeVeto_"+name; + partition.h_NoisyEventTimeVeto = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_NoisyEventTimeVeto->GetXaxis()->SetTitle("Luminosity Block"); + + // Fraction of events found noisy per LB after time veto - Sat flag + hName = "SaturatedNoisyEvent_TimeVeto_"+name; + hTitle = "Yield of events flagged as RNB-Saturated not vetoed by time window - "+ name; + partition.h_SaturatedNoisyEventTimeVetoFrac = TH1F_LW::create(hName.c_str(),hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_SaturatedNoisyEventTimeVetoFrac->GetXaxis()->SetTitle("Luminosity Block"); + groupfracbin.regHist(partition.h_SaturatedNoisyEventTimeVetoFrac).ignore(); + + hName = "temp_SaturatedNoisyEvent_TimeVeto_"+name; + partition.h_SaturatedNoisyEventTimeVeto = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_SaturatedNoisyEventTimeVeto->GetXaxis()->SetTitle("Luminosity Block"); + + hName = "MNBTightEvent_TimeVeto_"+name; + hTitle = "Yield of events flagged as MNB-Tight not vetoed by time window - " + name; + partition.h_MNBTightEventTimeVetoFrac = TH1F_LW::create(hName.c_str(),hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBTightEventTimeVetoFrac->GetXaxis()->SetTitle("Luminosity Block"); + groupfracbin.regHist(partition.h_MNBTightEventTimeVetoFrac).ignore(); + + hName = "temp_MNBTightEvent_TimeVeto_"+name; + partition.h_MNBTightEventTimeVeto = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBTightEventTimeVeto->GetXaxis()->SetTitle("Luminosity Block"); + + hName = "MNBTight_PsVetoEvent_TimeVeto_"+name; + hTitle = "Yield of events flagged as MNB-Tight_PsVeto not vetoed by time window - " + name; + partition.h_MNBTight_PsVetoEventTimeVetoFrac = TH1F_LW::create(hName.c_str(),hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBTight_PsVetoEventTimeVetoFrac->GetXaxis()->SetTitle("Luminosity Block"); + groupfracbin.regHist(partition.h_MNBTight_PsVetoEventTimeVetoFrac).ignore(); + + hName = "temp_MNBTight_PsVetoEvent_TimeVeto_"+name; + partition.h_MNBTight_PsVetoEventTimeVeto = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBTight_PsVetoEventTimeVeto->GetXaxis()->SetTitle("Luminosity Block"); + + hName = "MNBLooseEvent_TimeVeto_"+name; + hTitle = "Yield of events flagged as MNB-Loose not vetoed by time window - " + name; + partition.h_MNBLooseEventTimeVetoFrac = TH1F_LW::create(hName.c_str(),hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBLooseEventTimeVetoFrac->GetXaxis()->SetTitle("Luminosity Block"); + groupfracbin.regHist(partition.h_MNBLooseEventTimeVetoFrac).ignore(); + + hName = "temp_MNBLooseEvent_TimeVeto_"+name; + partition.h_MNBLooseEventTimeVeto = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); + partition.h_MNBLooseEventTimeVeto->GetXaxis()->SetTitle("Luminosity Block"); + +// // Fraction of events found noisy per LB after time veto - Weighted flag +// hName = "NoisyWEvent_TimeVeto_"+name; +// partition.h_NoisyWEventTimeVetoFrac = TH1F_LW::create(hName.c_str(), "Yield of events flagged as RNB-StandardOpt not vetoed by time window", m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); +// partition.h_NoisyWEventTimeVetoFrac->GetXaxis()->SetTitle("Luminosity Block"); +// groupfracbin.regHist(partition.h_NoisyWEventTimeVetoFrac).ignore(); +// +// hName = "temp_NoisyWEvent_TimeVeto_"+name; +// partition.h_NoisyWEventTimeVeto = TH1I_LW::create(hName.c_str(), hTitle.c_str(), m_lumi_blocks+1, -0.5, (float)m_lumi_blocks+0.5); +// partition.h_NoisyWEventTimeVeto->GetXaxis()->SetTitle("Luminosity Block"); + + if ( m_doTrigger ) + { + unsigned int siz = m_EF_NoiseBurst_Triggers.size(); + hName = "NoisyEventTrigger_"+name; + hTitle = "Trigger fired for RNB flagged events - "+name; + partition.h_NoisyEventTrigger = TH1I_LW::create(hName.c_str(), hTitle.c_str(), siz+1, 0.5, siz+1.5); + LWHist::LWHistAxis* axis = partition.h_NoisyEventTrigger->GetXaxis(); + axis->SetTitle("Special trigger fired"); + for ( size_t i = 0; i < siz; i++) + { + axis->SetBinLabel(i+1,m_EF_NoiseBurst_Triggers[i].c_str()); + } + axis->SetBinLabel(siz+1,"NONE"); + group.regHist(partition.h_NoisyEventTrigger).ignore(); + + + siz = m_L1_NoiseBurst_Triggers.size(); + hName = "NoisyEventL1Term_"+name; + hTitle = "L1 term fired for RNB flagged events - "+name; + partition.h_NoisyEventTriggerL1 = TH1I_LW::create(hName.c_str(), hTitle.c_str(), siz+1, 0.5, siz+1.5); + axis = partition.h_NoisyEventTriggerL1->GetXaxis(); + axis->SetTitle("L1 term fired"); + for ( size_t i = 0; i < siz; i++) + { + axis->SetBinLabel(i+1,m_L1_NoiseBurst_Triggers[i].c_str()); + } + axis->SetBinLabel(siz+1,"NONE"); + group.regHist(partition.h_NoisyEventTriggerL1).ignore(); + } +} +*/ + +/* +void LArNoisyROMonAlg::fillTriggerHisto(partitionHistos& partition, uint8_t triggerbits, uint8_t L1triggerbits) +{ + if ( triggerbits ==0 ) + { + partition.h_NoisyEventTrigger->Fill(double(m_EF_NoiseBurst_Triggers.size()+1)); + } + else + { + for ( size_t i = 0; i < m_EF_NoiseBurst_Triggers.size(); i++) + { + if ( triggerbits & (0x1 << i) ) partition.h_NoisyEventTrigger->Fill(double(i+1)); + } + } + + if ( L1triggerbits ==0 ) + { + partition.h_NoisyEventTriggerL1->Fill(double(m_L1_NoiseBurst_Triggers.size()+1)); + } + else + { + for ( size_t i = 0; i < m_L1_NoiseBurst_Triggers.size(); i++) + { + if ( L1triggerbits & (0x1 << i) ) partition.h_NoisyEventTriggerL1->Fill(double(i+1)); + } + } + +} +*/ +