From f1780e0c06ef6876ece356f307a1ab4d64efada5 Mon Sep 17 00:00:00 2001 From: Pavol Strizenec <pavol.strizenec@cern.ch> Date: Wed, 14 Aug 2019 14:51:38 +0000 Subject: [PATCH] LArMonitoring fix flake8 + new algos --- .../LArMonitoring/python/GlobalVariables.py | 227 ++++++++ .../python/LArAffectedRegionsAlg.py | 413 ++++++++++++++ .../python/LArCollisionTimeMonAlg.py | 285 ++++++++++ .../LArMonitoring/python/LArMonConfigFlags.py | 4 +- .../share/LArAffectedRegionsAlg_jobOptions.py | 317 +++++++++++ .../LArCollisionTimeMonAlg_jobOptions.py | 189 +++++++ .../LArMonitoring/share/LArReco_fromraw.py | 259 +++++++++ .../src/LArAffectedRegionsAlg.cxx | 509 ++++++++++++++++++ .../LArMonitoring/src/LArAffectedRegionsAlg.h | 68 +++ .../src/LArCollisionTimeMonAlg.cxx | 155 ++++++ .../src/LArCollisionTimeMonAlg.h | 69 +++ .../src/components/LArMonTools_entries.cxx | 10 + 12 files changed, 2502 insertions(+), 3 deletions(-) create mode 100644 LArCalorimeter/LArMonitoring/python/GlobalVariables.py create mode 100644 LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py create mode 100644 LArCalorimeter/LArMonitoring/python/LArCollisionTimeMonAlg.py create mode 100644 LArCalorimeter/LArMonitoring/share/LArAffectedRegionsAlg_jobOptions.py create mode 100644 LArCalorimeter/LArMonitoring/share/LArCollisionTimeMonAlg_jobOptions.py create mode 100644 LArCalorimeter/LArMonitoring/share/LArReco_fromraw.py create mode 100644 LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.cxx create mode 100644 LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.h create mode 100755 LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.cxx create mode 100755 LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.h create mode 100755 LArCalorimeter/LArMonitoring/src/components/LArMonTools_entries.cxx diff --git a/LArCalorimeter/LArMonitoring/python/GlobalVariables.py b/LArCalorimeter/LArMonitoring/python/GlobalVariables.py new file mode 100644 index 00000000000..93ba9492925 --- /dev/null +++ b/LArCalorimeter/LArMonitoring/python/GlobalVariables.py @@ -0,0 +1,227 @@ + +import os, sys +import ROOT +from ROOT import TMath + +#Lumi block ranges +LB_Bins=3000 +LB_Min=0 +LB_Max=LB_Bins+LB_Min + + +#bunch crossing id ranges +BCID_Bins=3564 +BCID_Min=0.5 +BCID_Max=BCID_Min+BCID_Bins + +#LArCollisionTime (A-C) ranges +colTime_Nbins=101 +colTime_min=-50.5 +colTime_max=50.5 +avgColTime_Nbins=320 +avgColTime_min=-40 +avgColTime_max=40 + +#FEB ranges +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]} +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]} + +#Feb N channels +FEB_N_channels=128 + +#total number of FEB +N_FEB=1524 +N_FEB_Parttions_Max=500 + +#ROD ranges +ROD_Crates={"EMBA":[1,4],"EMBC":[1,4],"EMECA":[1,3],"EMECC":[1,3],"HECA":[1],"HECC":[1],"FCalA":[1],"FCalC":[1]} +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 +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]} + +#number of cells +TotalNcell=182468 + +#Samples +Sample_N_Min=0 +Sample_N_Max=32 + +#Cell time (in ns) +Cell_Time_Min=-200 +Cell_Time_Max=200 + +#Energies ranges +Emin=-20000.0 +Emax=20000.0 + +#Difference Energies +DEmin=-512 +DEmax=512 + +#Qfactor range +Qmin=0 +Qmax=6553 + +#Differences Q factor +DQmin=-3000 +DQmax=1000 + +#Time ranges (ps) +Tmin=-80000 +Tmax=80000 + +#Diff Time ranges (ps) +DTmin=-800 +DTmax=800 + +#Online Vs offline computations Energies ranges +OnlineOffline=[0,4096,65536,524288,4194304] + +#triggerWord +TTriggerTypeMax=256 + +#Cell threshold ADC counts +MaxCellThresholdADC=1900 + +#Corruption errors +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"] + +#Collision time range +CollTimeRange=[-50,50] + +#LAr streams +Streams=["express_express","physics_CosmicCalo","physics_Zerobias","physics_Main",] + +#Gains +Ginas=["Low Gain","Medium Gain","High Gain"] + + +#HV eta-phi bins (used by LArAffectedRegions, bin values copied from there). NOTE: EMEC bins are provided as a list of bin boundaries (variable bin size), all other partitions are in format [Nbins,x_low,x_high] +#barrel +HVeta_EMB = {"EMBAPS":[8, 0.,1.6],"EMBA":[7,0.,1.4]} +HVphi_EMB = {"EMBAPS":[32,-TMath.Pi(),TMath.Pi()],"EMBA":[128,-TMath.Pi(),TMath.Pi()]} +for end in ["PS",""]: + bins=HVeta_EMB["EMBA"+end] + HVeta_EMB["EMBC"+end]=[bins[0],-1*(bins[2]+0.01),-1*(bins[1]+0.01)] + HVphi_EMB["EMBC"+end]=HVphi_EMB["EMBA"+end] +#endcap +emecbinsA=[1.375,1.50,1.6,1.8,2.0,2.1,2.3,2.5,2.8,3.2] +emecbinsC=[-1*(bi+0.01) for bi in reversed(emecbinsA)] +phibinsPS=64 +phibins=256 +HVeta_EMEC = {"EMECAPS":emecbinsA,"EMECA":emecbinsA,"EMECCPS":emecbinsC,"EMECC":emecbinsC} +HVphi_EMEC={} +HVphi_EMEC["EMECAPS"]=[-TMath.Pi()+ x*2*TMath.Pi()/phibinsPS for x in xrange(phibinsPS+1)] +HVphi_EMEC["EMECA"]=[-TMath.Pi()+ x*2*TMath.Pi()/phibins for x in xrange(phibins+1)] +HVphi_EMEC["EMECCPS"]=HVphi_EMEC["EMECAPS"] +HVphi_EMEC["EMECC"]=HVphi_EMEC["EMECA"] +#hec-fcal +HVeta_HECFcal = {"HECA":[1,1.5, 3.2],"FCalA":[1, 2.9, 4.9]} #same for all layers +HVphi_HECFcal = {"HECA":[32,-TMath.Pi(),TMath.Pi()],"FCalA":[16, -3.2, 3.2]} #same for all layers +for par in ["HEC","FCal"]: + bins=HVeta_HECFcal[par+"A"] + HVeta_HECFcal[par+"C"]=[bins[0],-1*(bins[2]+0.01),-1*(bins[1]+0.01)] + HVphi_HECFcal[par+"C"]=HVphi_HECFcal[par+"A"] + + +#Creation of the dictionnary +Cell_Variables={} +NBins={} +Partitions=["EMB","EMEC","HEC","FCal"] +Sides=["A","C"] +Variables=["etaRange","phiRange","etaNbin", "phiNbin","etasize","etaCellSize","etaMin"] +Layers=["0","1","2","3"] +for Variable in Variables : + Cell_Variables[Variable]={} + for Partition in Partitions : + Cell_Variables[Variable][Partition]={} + for Side in Sides : + Cell_Variables[Variable][Partition][Side]={} + for Layer in Layers: + Cell_Variables[Variable][Partition][Side][Layer]=list() + +#Number of Bins in phi +Cell_Variables["phiNbin"]["EMB"]["A"]= {"0":64,"1":256,"2":256,"3":256} +Cell_Variables["phiNbin"]["EMB"]["C"]= Cell_Variables["phiNbin"]["EMB"]["A"] + +Cell_Variables["phiNbin"]["EMEC"]["A"]= {"0":64,"1":64,"2":256,"3":256} +Cell_Variables["phiNbin"]["EMEC"]["C"]= Cell_Variables["phiNbin"]["EMEC"]["A"] + +Cell_Variables["phiNbin"]["HEC"]["A"]= {"0":64,"1":64,"2":64,"3":64} +Cell_Variables["phiNbin"]["HEC"]["C"]= Cell_Variables["phiNbin"]["HEC"]["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 + +Cell_Variables["etaNbin"]["EMB"]["A"]= {"0":[0,61],"1":[0,1,446,450],"2":[0,56,57],"3":[0,27]} +Cell_Variables["etaMin" ]["EMB"]["A"]= {"0":0.0,"1":0.0,"2":0.0,"3":0.0} +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]} + +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]} +Cell_Variables["etaMin" ]["EMEC"]["A"]= {"0":1.5,"1":1.375,"2":1.375,"3":1.5} +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]} + +Cell_Variables["etaNbin"]["HEC"]["A"]= {"0":[0,10,14],"1":[0,10,13],"2":[0,9,12],"3":[0,8,12]} +Cell_Variables["etaMin" ]["HEC"]["A"]= {"0":1.5,"1":1.5,"2":1.6,"3":1.7} +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]} + + +################### +#Filling Phi ranges +for Layer in Layers : + for Part in Partitions: + if Part=="FCal": #and Layer=="3": we'll leave fcal empty for now + continue + + Cell_Variables["phiRange"][Part]["A"][Layer]=[-TMath.Pi()+ x*2*TMath.Pi()/Cell_Variables["phiNbin"][Part]["A"][Layer] for x in xrange(Cell_Variables["phiNbin"][Part]["A"][Layer]+1)] + Cell_Variables["phiRange"][Part]["C"]=Cell_Variables["phiRange"][Part]["A"] + +################### +#Filling Eta range + +for Part in Partitions: + for Lay in Layers: + + Ranges=Cell_Variables["etaNbin"][Part]["A"][Lay] + Sizes=Cell_Variables["etaCellSize"][Part]["A"][Lay] + if not len(Ranges)-len(Sizes)==1 : + print("Bad list of ranges and size please check") + exit(1) + etamin=Cell_Variables["etaMin"][Part]["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)] + + Cell_Variables["etaRange"][Part]["A"][Lay]=currange + #The C side is just the symmeteric of the A side + Cell_Variables["etaRange"][Part]["C"][Lay] =map(lambda x: x*-1,Cell_Variables["etaRange"][Part]["A"][Lay])[::-1] + +print len(currange) + + +if __name__ =="__main__": + + print "########## N bins in Phi" + print Cell_Variables["phiNbin"] + print "########## Phi range" + print Cell_Variables["phiRange"] + + print "########## N bins in eta" + print Cell_Variables["etaNbin"] + print "########## Eta range" + print Cell_Variables["etaRange"] + + nbinA=len(Cell_Variables["etaRange"]["EMB"]["A"]["1"]) + nbinC=len(Cell_Variables["etaRange"]["EMB"]["C"]["1"]) + print nbinA,nbinC + for bin in xrange(nbinA): + print bin + print Cell_Variables["etaRange"]["EMB"]["A"]["1"][bin], Cell_Variables["etaRange"]["EMB"]["C"]["1"][bin],Cell_Variables["etaRange"]["EMB"]["A"]["1"][bin]+Cell_Variables["etaRange"]["EMB"]["C"]["1"][nbinA-bin-1] + + diff --git a/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py b/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py new file mode 100644 index 00000000000..c33704c156d --- /dev/null +++ b/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py @@ -0,0 +1,413 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +'''@file ExampleLArMonitorAlgorithm.py +@author C. D. Burton +@author P. Onyisi +@date 2018-01-11 +@brief Example python configuration for the Run III AthenaMonitoring package +''' + +def LArAffectedRegionsConfig(inputFlags): + '''Function to configures some algorithms in the monitoring system.''' + + ### STEP 1 ### + # Define one top-level monitoring algorithm. The new configuration + # framework uses a component accumulator. + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + result = ComponentAccumulator() + + # The following class will make a sequence, configure algorithms, and link + # them to GenericMonitoringTools + from AthenaMonitoring import AthMonitorCfgHelper + helper = AthMonitorCfgHelper(inputFlags,'LArAffectedRegionsCfg') + + + ### STEP 2 ### + # Adding an algorithm to the helper. Just pass the type to the + # helper. Then, the helper will instantiate an instance and set up the + # base class configuration following the inputFlags. The returned object + # is the algorithm. + from LArMonitoring.LArMonitoringConf import LArAffectedRegionsAlg + larAffectedRegAlg = helper.addAlgorithm(LArAffectedRegionsAlg,'larAffectedRegAlg') + + #define the group names here, as you'll use them multiple times + affectedRegGroupName="LArAffectedRegionsMonGroup" + + + ### STEP 3 ### + # Edit properties of a algorithm + larAffectedRegAlg.AffectedRegionsGroupName=affectedRegGroupName + larAffectedRegAlg.IsOnline = isOnline #assuming isOnline is defined in upper level JO + + ### STEP 4 ### + # Add some tools. N.B. Do not use your own trigger decion tool. Use the + # standard one that is included with AthMonitorAlgorithm. + + # # First, add a tool that's set up by a different configuration function. + # # In this case, CaloNoiseToolCfg returns its own component accumulator, + # # which must be merged with the one from this function. + # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg + # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags) + # result.merge(caloNoiseAcc) + # exampleMonAlg.CaloNoiseTool = caloNoiseTool + + # # Then, add a tool that doesn't have its own configuration function. In + # # this example, no accumulator is returned, so no merge is necessary. + # from MyDomainPackage.MyDomainPackageConf import MyDomainTool + # exampleMonAlg.MyDomainTool = MyDomainTool() + + + + # Add a generic monitoring tool (a "group" in old language). The returned + # object here is the standard GenericMonitoringTool. + #for each group, then add two histograms + + from LArMonitoring import GlobalVariables #to define the ranges + larAffReg_hist_path='AffectedRegions/' #histogram path + + #EMBPS + group_name_ending="EMBPS" + larAffectedRegAlg.EMBPSname=group_name_ending + affectedRegGroupEMBPS = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupEMBPS.defineHistogram('etaPOS,phi;LArAffectedRegionsEMBAPS', + title='HV Affected Regions - EMBA - Presampler;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMB["EMBAPS"][0],xmin=GlobalVariables.HVeta_EMB["EMBAPS"][1],xmax=GlobalVariables.HVeta_EMB["EMBAPS"][2], + ybins=GlobalVariables.HVphi_EMB["EMBAPS"][0],ymin=GlobalVariables.HVphi_EMB["EMBAPS"][1],ymax=GlobalVariables.HVphi_EMB["EMBAPS"][2] + ) + affectedRegGroupEMBPS.defineHistogram('etaNEG,phi;LArAffectedRegionsEMBCPS', + title='HV Affected Regions - EMBC - Presampler;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMB["EMBCPS"][0],xmin=GlobalVariables.HVeta_EMB["EMBCPS"][1],xmax=GlobalVariables.HVeta_EMB["EMBCPS"][2], + ybins=GlobalVariables.HVphi_EMB["EMBCPS"][0],ymin=GlobalVariables.HVphi_EMB["EMBCPS"][1],ymax=GlobalVariables.HVphi_EMB["EMBCPS"][2] + + ) + + #EMB + group_name_ending="EMB" + larAffectedRegAlg.EMBname=group_name_ending + affectedRegGroupEMB = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupEMB.defineHistogram('etaPOS,phi;LArAffectedRegionsEMBA', + title='HV Affected Regions - EMBA - Samplings 1-3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMB["EMBA"][0],xmin=GlobalVariables.HVeta_EMB["EMBA"][1],xmax=GlobalVariables.HVeta_EMB["EMBA"][2], + ybins=GlobalVariables.HVphi_EMB["EMBA"][0],ymin=GlobalVariables.HVphi_EMB["EMBA"][1],ymax=GlobalVariables.HVphi_EMB["EMBA"][2] + + ) + affectedRegGroupEMB.defineHistogram('etaNEG,phi;LArAffectedRegionsEMBC', + title='HV Affected Regions - EMBC - Samplings 1-3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMB["EMBC"][0],xmin=GlobalVariables.HVeta_EMB["EMBC"][1],xmax=GlobalVariables.HVeta_EMB["EMBC"][2], + ybins=GlobalVariables.HVphi_EMB["EMBC"][0],ymin=GlobalVariables.HVphi_EMB["EMBC"][1],ymax=GlobalVariables.HVphi_EMB["EMBC"][2] + ) + + + #EMECPS + group_name_ending="EMECPS" + larAffectedRegAlg.EMECPSname=group_name_ending + affectedRegGroupEMECPS = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupEMECPS.defineHistogram('etaPOS,phi;LArAffectedRegionsEMECAPS', + title='HV Affected Regions - EMECA - Presampler;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMEC["EMECAPS"], + ybins=GlobalVariables.HVphi_EMEC["EMECAPS"] + ) + affectedRegGroupEMECPS.defineHistogram('etaNEG,phi;LArAffectedRegionsEMECCPS', + title='HV Affected Regions - EMECC - Presampler;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMEC["EMECCPS"], + ybins=GlobalVariables.HVphi_EMEC["EMECCPS"] + ) + + + #EMEC + group_name_ending="EMEC" + larAffectedRegAlg.EMECname=group_name_ending + affectedRegGroupEMEC = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupEMEC.defineHistogram('etaPOS,phi;LArAffectedRegionsEMECA', + title='HV Affected Regions - EMECA - Samplings 1-3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMEC["EMECA"], + ybins=GlobalVariables.HVphi_EMEC["EMECA"] + ) + affectedRegGroupEMEC.defineHistogram('etaNEG,phi;LArAffectedRegionsEMECC', + title='HV Affected Regions - EMECC - Samplings 1-3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMEC["EMECC"], + ybins=GlobalVariables.HVphi_EMEC["EMECC"] + ) + + + #HEC0 + group_name_ending="HEC0" + larAffectedRegAlg.HEC0name=group_name_ending + affectedRegGroupHEC0 = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupHEC0.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA0', + title='HV Affected Regions - HECA - Layer 1;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECA"][0],xmin=GlobalVariables.HVeta_HECFcal["HECA"][1],xmax=GlobalVariables.HVeta_HECFcal["HECA"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECA"][0],ymin=GlobalVariables.HVphi_HECFcal["HECA"][1],ymax=GlobalVariables.HVphi_HECFcal["HECA"][2] + ) + affectedRegGroupHEC0.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC0', + title='HV Affected Regions - HECC - Layer 1;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECC"][0],xmin=GlobalVariables.HVeta_HECFcal["HECC"][1],xmax=GlobalVariables.HVeta_HECFcal["HECC"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECC"][0],ymin=GlobalVariables.HVphi_HECFcal["HECC"][1],ymax=GlobalVariables.HVphi_HECFcal["HECC"][2] + ) + + #HEC1 + group_name_ending="HEC1" + larAffectedRegAlg.HEC1name=group_name_ending + affectedRegGroupHEC1 = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupHEC1.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA1', + title='HV Affected Regions - HECA - Layer 2;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECA"][0],xmin=GlobalVariables.HVeta_HECFcal["HECA"][1],xmax=GlobalVariables.HVeta_HECFcal["HECA"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECA"][0],ymin=GlobalVariables.HVphi_HECFcal["HECA"][1],ymax=GlobalVariables.HVphi_HECFcal["HECA"][2] + ) + affectedRegGroupHEC1.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC1', + title='HV Affected Regions - HECC - Layer 2;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECC"][0],xmin=GlobalVariables.HVeta_HECFcal["HECC"][1],xmax=GlobalVariables.HVeta_HECFcal["HECC"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECC"][0],ymin=GlobalVariables.HVphi_HECFcal["HECC"][1],ymax=GlobalVariables.HVphi_HECFcal["HECC"][2] + ) + + #HEC2 + group_name_ending="HEC2" + larAffectedRegAlg.HEC2name=group_name_ending + affectedRegGroupHEC2 = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupHEC2.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA2', + title='HV Affected Regions - HECA - Layer 3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECA"][0],xmin=GlobalVariables.HVeta_HECFcal["HECA"][1],xmax=GlobalVariables.HVeta_HECFcal["HECA"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECA"][0],ymin=GlobalVariables.HVphi_HECFcal["HECA"][1],ymax=GlobalVariables.HVphi_HECFcal["HECA"][2] + ) + affectedRegGroupHEC2.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC2', + title='HV Affected Regions - HECC - Layer 3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECC"][0],xmin=GlobalVariables.HVeta_HECFcal["HECC"][1],xmax=GlobalVariables.HVeta_HECFcal["HECC"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECC"][0],ymin=GlobalVariables.HVphi_HECFcal["HECC"][1],ymax=GlobalVariables.HVphi_HECFcal["HECC"][2] + ) + + #HEC3 + group_name_ending="HEC3" + larAffectedRegAlg.HEC3name=group_name_ending + affectedRegGroupHEC3 = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupHEC3.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA3', + title='HV Affected Regions - HECA - Layer 4;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECA"][0],xmin=GlobalVariables.HVeta_HECFcal["HECA"][1],xmax=GlobalVariables.HVeta_HECFcal["HECA"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECA"][0],ymin=GlobalVariables.HVphi_HECFcal["HECA"][1],ymax=GlobalVariables.HVphi_HECFcal["HECA"][2] + ) + affectedRegGroupHEC3.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC3', + title='HV Affected Regions - HECC - Layer 4;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECC"][0],xmin=GlobalVariables.HVeta_HECFcal["HECC"][1],xmax=GlobalVariables.HVeta_HECFcal["HECC"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECC"][0],ymin=GlobalVariables.HVphi_HECFcal["HECC"][1],ymax=GlobalVariables.HVphi_HECFcal["HECC"][2] + ) + + #FCAL0 + group_name_ending="FCAL0" + larAffectedRegAlg.FCAL0name=group_name_ending + affectedRegGroupFCAL0 = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupFCAL0.defineHistogram('etaPOS,phi;LArAffectedRegionsFCALA0', + title='HV Affected Regions - FCALA - Layer 1;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalA"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalA"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalA"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalA"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalA"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalA"][2] + ) + affectedRegGroupFCAL0.defineHistogram('etaNEG,phi;LArAffectedRegionsFCALC0', + title='HV Affected Regions - FCALC - Layer 1;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalC"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalC"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalC"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalC"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalC"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalC"][2] + ) + + #FCAL1 + group_name_ending="FCAL1" + larAffectedRegAlg.FCAL1name=group_name_ending + affectedRegGroupFCAL1 = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupFCAL1.defineHistogram('etaPOS,phi;LArAffectedRegionsFCALA1', + title='HV Affected Regions - FCALA - Layer 2;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalA"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalA"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalA"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalA"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalA"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalA"][2] + ) + affectedRegGroupFCAL1.defineHistogram('etaNEG,phi;LArAffectedRegionsFCALC1', + title='HV Affected Regions - FCALC - Layer 2;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalC"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalC"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalC"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalC"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalC"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalC"][2] + + ) + + #FCAL2 + group_name_ending="FCAL2" + larAffectedRegAlg.FCAL2name=group_name_ending + affectedRegGroupFCAL2 = helper.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' + ) + + affectedRegGroupFCAL2.defineHistogram('etaPOS,phi;LArAffectedRegionsFCALA2', + title='HV Affected Regions - FCALA - Layer 3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalA"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalA"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalA"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalA"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalA"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalA"][2] + ) + affectedRegGroupFCAL2.defineHistogram('etaNEG,phi;LArAffectedRegionsFCALC2', + title='HV Affected Regions - FCALC - Layer 3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalC"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalC"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalC"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalC"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalC"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalC"][2] + ) + + # pass #end of isOnline + + + + ### STEP 6 ### + # Finalize. The return value should be a tuple of the ComponentAccumulator + # and the sequence containing the created algorithms. If we haven't called + # any configuration other than the AthMonitorCfgHelper here, then we can + # just return directly (and not create "result" above) + + return helper.result() + + # # Otherwise, merge with result object and return + # acc, seq = helper.result() + # result.merge(acc) + # return result, seq + + +if __name__=='__main__': + + isOnline=False + + # Setup the Run III behavior + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = 1 + + # Setup logs + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG,INFO + log.setLevel(INFO) + + # 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 + ConfigFlags.Output.HISTFileName = 'LArAffectedRegionsOutput.root' + 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) + larAffectedRegionsAcc = LArAffectedRegionsConfig(ConfigFlags) + + cfg.merge(larAffectedRegionsAcc) + 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 new file mode 100644 index 00000000000..014ecf2b8e2 --- /dev/null +++ b/LArCalorimeter/LArMonitoring/python/LArCollisionTimeMonAlg.py @@ -0,0 +1,285 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +'''@file ExampleLArMonitorAlgorithm.py +@author C. D. Burton +@author P. Onyisi +@date 2018-01-11 +@brief Example python configuration for the Run III AthenaMonitoring package +''' + +def LArCollisionTimeMonConfig(inputFlags): + '''Function to configures some algorithms in the monitoring system.''' + + ### STEP 1 ### + # Define one top-level monitoring algorithm. The new configuration + # framework uses a component accumulator. + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + result = ComponentAccumulator() + + # The following class will make a sequence, configure algorithms, and link + # them to GenericMonitoringTools + from AthenaMonitoring import AthMonitorCfgHelper + helper = AthMonitorCfgHelper(inputFlags,'LArCollisionTimeMonCfg') + + + ### STEP 2 ### + # Adding an algorithm to the helper. Just pass the type to the + # helper. Then, the helper will instantiate an instance and set up the + # base class configuration following the inputFlags. The returned object + # is the algorithm. + from LArMonitoring.LArMonitoringConf import LArCollisionTimeMonAlg + larCollTimeMonAlg = helper.addAlgorithm(LArCollisionTimeMonAlg,'larCollTimeMonAlg') + + #define the group names here, as you'll use them multiple times + collTimeGroupName="LArCollisionTimeMonGroup" + + + + ### STEP 3 ### + # Edit properties of a algorithm + collTimeGroupName="LArCollisionTimeGroup" + larCollTimeMonAlg.CollTimeGroupName=collTimeGroupName + + + ### STEP 4 ### + # Add some tools. N.B. Do not use your own trigger decion tool. Use the + # standard one that is included with AthMonitorAlgorithm. + + # # First, add a tool that's set up by a different configuration function. + # # In this case, CaloNoiseToolCfg returns its own component accumulator, + # # which must be merged with the one from this function. + # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg + # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags) + # result.merge(caloNoiseAcc) + # exampleMonAlg.CaloNoiseTool = caloNoiseTool + + # # Then, add a tool that doesn't have its own configuration function. In + # # this example, no accumulator is returned, so no merge is necessary. + # from MyDomainPackage.MyDomainPackageConf import MyDomainTool + # exampleMonAlg.MyDomainTool = MyDomainTool() + + from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool + larCollTimeMonAlg.BunchCrossingTool = BunchCrossingTool() + + + # Add a generic monitoring tool (a "group" in old language). The returned + # object here is the standard GenericMonitoringTool. + collTimeGroup = helper.addGroup( + larCollTimeMonAlg, + collTimeGroupName, + '/LAr/' + ) + + + ### STEP 5 ### + # Configure histograms + + from LArMonitoring import GlobalVariables #to define the ranges + larColTime_hist_path='CollisionTime/' + + collTimeGroup.defineHistogram('ecTimeDiff;LArCollTime', + title='LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.colTime_Nbins,xmin=GlobalVariables.colTime_min,xmax=GlobalVariables.colTime_max) + + collTimeGroup.defineHistogram('ecTimeAvg;LArCollAvgTime', + title='LArCollisionAverageTime - avg time of ECC and ECA;(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.avgColTime_Nbins,xmin=GlobalVariables.avgColTime_min,xmax=GlobalVariables.avgColTime_max) + + + collTimeGroup.defineHistogram('ecTimeDiff;LArCollTimeLumiBlock', #this one is the same as LArCollTime, but it's reset once per LB (FUNCTIONALITY TO BE ADDED!) + title='LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.colTime_Nbins,xmin=GlobalVariables.colTime_min,xmax=GlobalVariables.colTime_max, + opt='kLBNHistoryDepth=1') + + + collTimeGroup.defineHistogram('lumi_block_timeWindow;LArCollTimeLumiBlockTimeCut', + title='Events with abs(<t_{C}> - <t_{A}>) < 10ns as a function of LB;Luminosity Block Number;Number of events per LB', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max) + + + collTimeGroup.defineHistogram('lumi_block_singleBeam_timeWindow;LArCollTimeLumiBlockSingleBeamTimeCut', + title='Events with 20 ns < abs(<t_{C}> - <t_{A}>) < 30ns as a function of LB;Luminosity Block Number;Number of events per LB', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max) + + + collTimeGroup.defineHistogram('lumi_block,ecTimeDiff;LArCollTime_vs_LB', + title='LArCollisionTime Vs Luminosity Block - difference of avg time of ECC and ECA as a function of luminosity block;Luminosity Block Number;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max, + ybins=GlobalVariables.colTime_Nbins,ymin=GlobalVariables.colTime_min,ymax=GlobalVariables.colTime_max) + + + collTimeGroup.defineHistogram('bunch_crossing_id,ecTimeDiff;LArCollTime_vs_BCID', + title='LArCollisionTime Vs BCID - difference of avg time of ECC and ECA as a function of BCID;Bunch Crossing Number;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.BCID_Bins,xmin=GlobalVariables.BCID_Min,xmax=GlobalVariables.BCID_Max, + ybins=GlobalVariables.colTime_Nbins,ymin=GlobalVariables.colTime_min,ymax=GlobalVariables.colTime_max) + + collTimeGroup.defineHistogram('lumi_block,ecTimeAvg;LArCollAvgTime_vs_LB', + title='LArCollisionAvgTime Vs Luminosity Block - avg time of ECC and ECA as a function of luminosity block;Luminosity Block Number;(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max, + ybins=GlobalVariables.avgColTime_Nbins,ymin=GlobalVariables.avgColTime_min,ymax=GlobalVariables.avgColTime_max) + + collTimeGroup.defineHistogram('bunch_crossing_id,ecTimeAvg;LArCollAvgTime_vs_BCID', + title='LArCollisionAvgTime Vs BCID - avg time of ECC and ECA as a function of BCID;Bunch Crossing Number;(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.BCID_Bins,xmin=GlobalVariables.BCID_Min,xmax=GlobalVariables.BCID_Max, + ybins=GlobalVariables.avgColTime_Nbins,ymin=GlobalVariables.avgColTime_min,ymax=GlobalVariables.avgColTime_max) + + #in train monitoring, only done offline + + if not 'isOnline' in dir(): #DO WE NEED THIS IF HERE? + isOnline=False + pass + + if isOnline: + + collTimeGroupName_intrain=collTimeGroupName+"_intrain" + collTimeGroup_intrain = helper_collTime.addGroup( + larCollTimeMonAlg, + collTimeGroupName_intrain, + "/LAr/" + ) + 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_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_tit+';<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.colTime_Nbins,xmin=GlobalVariables.colTime_min,xmax=GlobalVariables.colTime_max) + + + collTimeGroup_intrain.defineHistogram('ecTimeAvg;LArCollAvgTime'+intrain_name, + title='LArCollisionAverageTime - avg time of ECC and ECA'+intrain_tit+';(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.avgColTime_Nbins,xmin=GlobalVariables.avgColTime_min,xmax=GlobalVariables.avgColTime_max) + + + collTimeGroup_intrain.defineHistogram('ecTimeDiff;LArCollTimeLumiBlock'+intrain_name, #this one is the same as LArCollTime, but it's reset once per LB (FUNCTIONALITY TO BE ADDED!) + title='LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> (ns)'+intrain_tit+';Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.colTime_Nbins,xmin=GlobalVariables.colTime_min,xmax=GlobalVariables.colTime_max) + + + collTimeGroup_intrain.defineHistogram('(lumi_block_timeWindow);LArCollTimeLumiBlockTimeCut'+intrain_name, + 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=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.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_tit+';Luminosity Block Number;Number of events per LB', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max) + + + 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_tit+';<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max, + ybins=GlobalVariables.colTime_Nbins,ymin=GlobalVariables.colTime_min,ymax=GlobalVariables.colTime_max) + + + 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_tit+';Bunch Crossing Number;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.BCID_Bins,xmin=GlobalVariables.BCID_Min,xmax=GlobalVariables.BCID_Max, + ybins=GlobalVariables.colTime_Nbins,ymin=GlobalVariables.colTime_min,ymax=GlobalVariables.colTime_max) + + 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_tit+';Luminosity Block Number;(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max, + ybins=GlobalVariables.avgColTime_Nbins,ymin=GlobalVariables.avgColTime_min,ymax=GlobalVariables.avgColTime_max) + + 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_tit+';Bunch Crossing Number;(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.BCID_Bins,xmin=GlobalVariables.BCID_Min,xmax=GlobalVariables.BCID_Max, + ybins=GlobalVariables.avgColTime_Nbins,ymin=GlobalVariables.avgColTime_min,ymax=GlobalVariables.avgColTime_max) + + pass #end of if isOnline + + + ### STEP 6 ### + # Finalize. The return value should be a tuple of the ComponentAccumulator + # and the sequence containing the created algorithms. If we haven't called + # any configuration other than the AthMonitorCfgHelper here, then we can + # just return directly (and not create "result" above) + return helper.result() + + # # Otherwise, merge with result object and return + # acc, seq = helper.result() + # result.merge(acc) + # return result, seq + + +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 DEBUG,INFO + log.setLevel(INFO) + + # 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 + ConfigFlags.Output.HISTFileName = 'LArCollisionTimeMonOutput.root' + 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)) + +# larCollTimeMonitorAcc,larCollTimeMonitorAlg = LArCollisionTimeMonConfig(ConfigFlags) + + larCollTimeMonitorAcc = LArCollisionTimeMonConfig(ConfigFlags) + + cfg.merge(larCollTimeMonitorAcc) + Nevents=10 + cfg.run(Nevents) #use cfg.run() to run on all events diff --git a/LArCalorimeter/LArMonitoring/python/LArMonConfigFlags.py b/LArCalorimeter/LArMonitoring/python/LArMonConfigFlags.py index 95ec76c63ef..9274c81ad8b 100644 --- a/LArCalorimeter/LArMonitoring/python/LArMonConfigFlags.py +++ b/LArCalorimeter/LArMonitoring/python/LArMonConfigFlags.py @@ -12,9 +12,7 @@ __author__ = "P. Strizenec" __version__= "$Revision: 0.1 $" -__doc__ = "LArMonConfigFlags" - -__all__ = [ "LArMonConfigFlags" ] +__doc__ = "create LArMonConfigFlags" from AthenaConfiguration.AthConfigFlags import AthConfigFlags diff --git a/LArCalorimeter/LArMonitoring/share/LArAffectedRegionsAlg_jobOptions.py b/LArCalorimeter/LArMonitoring/share/LArAffectedRegionsAlg_jobOptions.py new file mode 100644 index 00000000000..918668f984c --- /dev/null +++ b/LArCalorimeter/LArMonitoring/share/LArAffectedRegionsAlg_jobOptions.py @@ -0,0 +1,317 @@ + +#AthMonitorCfgHelperOld must be imported in upper level JO + + +#define the group names here, as you'll use them multiple times +affectedRegGroupName="LArAffectedRegionsMonGroup" + + +#here are the helpers +helper_affectedReg = AthMonitorCfgHelperOld(DQMonFlags, affectedRegGroupName) + +#then the algorithms +#from AthenaMonitoring.AthenaMonitoringConf import ExampleMonitorAlgorithm +from LArMonitoring.LArMonitoringConf import LArAffectedRegionsAlg +larAffectedRegAlg = helper_affectedReg.addAlgorithm(LArAffectedRegionsAlg,'larAffectedRegAlg') +larAffectedRegAlg.AffectedRegionsGroupName=affectedRegGroupName +larAffectedRegAlg.IsOnline = isOnline + +#if you have to add a tool to the algorithm, put it here + + +#now the groups and histograms +from LArMonitoring import GlobalVariables #to define the ranges + +larAffReg_hist_path='AffectedRegions/' #histogram path + +#EMBPS +group_name_ending="EMBPS" +larAffectedRegAlg.EMBPSname=group_name_ending +affectedRegGroupEMBPS = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupEMBPS.defineHistogram('etaPOS,phi;LArAffectedRegionsEMBAPS', + title='HV Affected Regions - EMBA - Presampler;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMB["EMBAPS"][0],xmin=GlobalVariables.HVeta_EMB["EMBAPS"][1],xmax=GlobalVariables.HVeta_EMB["EMBAPS"][2], + ybins=GlobalVariables.HVphi_EMB["EMBAPS"][0],ymin=GlobalVariables.HVphi_EMB["EMBAPS"][1],ymax=GlobalVariables.HVphi_EMB["EMBAPS"][2] +) +affectedRegGroupEMBPS.defineHistogram('etaNEG,phi;LArAffectedRegionsEMBCPS', + title='HV Affected Regions - EMBC - Presampler;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMB["EMBCPS"][0],xmin=GlobalVariables.HVeta_EMB["EMBCPS"][1],xmax=GlobalVariables.HVeta_EMB["EMBCPS"][2], + ybins=GlobalVariables.HVphi_EMB["EMBCPS"][0],ymin=GlobalVariables.HVphi_EMB["EMBCPS"][1],ymax=GlobalVariables.HVphi_EMB["EMBCPS"][2] +) + + +#EMB +group_name_ending="EMB" +larAffectedRegAlg.EMBname=group_name_ending +affectedRegGroupEMB = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupEMB.defineHistogram('etaPOS,phi;LArAffectedRegionsEMBA', + title='HV Affected Regions - EMBA - Samplings 1-3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMB["EMBA"][0],xmin=GlobalVariables.HVeta_EMB["EMBA"][1],xmax=GlobalVariables.HVeta_EMB["EMBA"][2], + ybins=GlobalVariables.HVphi_EMB["EMBA"][0],ymin=GlobalVariables.HVphi_EMB["EMBA"][1],ymax=GlobalVariables.HVphi_EMB["EMBA"][2] +) +affectedRegGroupEMB.defineHistogram('etaNEG,phi;LArAffectedRegionsEMBC', + title='HV Affected Regions - EMBC - Samplings 1-3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMB["EMBC"][0],xmin=GlobalVariables.HVeta_EMB["EMBC"][1],xmax=GlobalVariables.HVeta_EMB["EMBC"][2], + ybins=GlobalVariables.HVphi_EMB["EMBC"][0],ymin=GlobalVariables.HVphi_EMB["EMBC"][1],ymax=GlobalVariables.HVphi_EMB["EMBC"][2] +) + + +#EMECPS +group_name_ending="EMECPS" +larAffectedRegAlg.EMECPSname=group_name_ending +affectedRegGroupEMECPS = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupEMECPS.defineHistogram('etaPOS,phi;LArAffectedRegionsEMECAPS', + title='HV Affected Regions - EMECA - Presampler;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMEC["EMECAPS"], + ybins=GlobalVariables.HVphi_EMEC["EMECAPS"] +) +affectedRegGroupEMECPS.defineHistogram('etaNEG,phi;LArAffectedRegionsEMECCPS', + title='HV Affected Regions - EMECC - Presampler;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMEC["EMECCPS"], + ybins=GlobalVariables.HVphi_EMEC["EMECCPS"] +) + + +#EMEC +group_name_ending="EMEC" +larAffectedRegAlg.EMECname=group_name_ending +affectedRegGroupEMEC = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupEMEC.defineHistogram('etaPOS,phi;LArAffectedRegionsEMECA', + title='HV Affected Regions - EMECA - Samplings 1-3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMEC["EMECA"], + ybins=GlobalVariables.HVphi_EMEC["EMECA"] +) +affectedRegGroupEMEC.defineHistogram('etaNEG,phi;LArAffectedRegionsEMECC', + title='HV Affected Regions - EMECC - Samplings 1-3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_EMEC["EMECC"], + ybins=GlobalVariables.HVphi_EMEC["EMECC"] +) + +#HEC0 +group_name_ending="HEC0" +larAffectedRegAlg.HEC0name=group_name_ending +affectedRegGroupHEC0 = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupHEC0.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA0', + title='HV Affected Regions - HECA - Layer 1;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECA"][0],xmin=GlobalVariables.HVeta_HECFcal["HECA"][1],xmax=GlobalVariables.HVeta_HECFcal["HECA"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECA"][0],ymin=GlobalVariables.HVphi_HECFcal["HECA"][1],ymax=GlobalVariables.HVphi_HECFcal["HECA"][2] +) +affectedRegGroupHEC0.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC0', + title='HV Affected Regions - HECC - Layer 1;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECC"][0],xmin=GlobalVariables.HVeta_HECFcal["HECC"][1],xmax=GlobalVariables.HVeta_HECFcal["HECC"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECC"][0],ymin=GlobalVariables.HVphi_HECFcal["HECC"][1],ymax=GlobalVariables.HVphi_HECFcal["HECC"][2] +) + +#HEC1 +group_name_ending="HEC1" +larAffectedRegAlg.HEC1name=group_name_ending +affectedRegGroupHEC1 = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupHEC1.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA1', + title='HV Affected Regions - HECA - Layer 2;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECA"][0],xmin=GlobalVariables.HVeta_HECFcal["HECA"][1],xmax=GlobalVariables.HVeta_HECFcal["HECA"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECA"][0],ymin=GlobalVariables.HVphi_HECFcal["HECA"][1],ymax=GlobalVariables.HVphi_HECFcal["HECA"][2] +) +affectedRegGroupHEC1.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC1', + title='HV Affected Regions - HECC - Layer 2;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECC"][0],xmin=GlobalVariables.HVeta_HECFcal["HECC"][1],xmax=GlobalVariables.HVeta_HECFcal["HECC"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECC"][0],ymin=GlobalVariables.HVphi_HECFcal["HECC"][1],ymax=GlobalVariables.HVphi_HECFcal["HECC"][2] +) + +#HEC2 +group_name_ending="HEC2" +larAffectedRegAlg.HEC2name=group_name_ending +affectedRegGroupHEC2 = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupHEC2.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA2', + title='HV Affected Regions - HECA - Layer 3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECA"][0],xmin=GlobalVariables.HVeta_HECFcal["HECA"][1],xmax=GlobalVariables.HVeta_HECFcal["HECA"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECA"][0],ymin=GlobalVariables.HVphi_HECFcal["HECA"][1],ymax=GlobalVariables.HVphi_HECFcal["HECA"][2] +) +affectedRegGroupHEC2.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC2', + title='HV Affected Regions - HECC - Layer 3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECC"][0],xmin=GlobalVariables.HVeta_HECFcal["HECC"][1],xmax=GlobalVariables.HVeta_HECFcal["HECC"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECC"][0],ymin=GlobalVariables.HVphi_HECFcal["HECC"][1],ymax=GlobalVariables.HVphi_HECFcal["HECC"][2] +) + +#HEC3 +group_name_ending="HEC3" +larAffectedRegAlg.HEC3name=group_name_ending +affectedRegGroupHEC3 = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupHEC3.defineHistogram('etaPOS,phi;LArAffectedRegionsHECA3', + title='HV Affected Regions - HECA - Layer 4;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECA"][0],xmin=GlobalVariables.HVeta_HECFcal["HECA"][1],xmax=GlobalVariables.HVeta_HECFcal["HECA"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECA"][0],ymin=GlobalVariables.HVphi_HECFcal["HECA"][1],ymax=GlobalVariables.HVphi_HECFcal["HECA"][2] +) +affectedRegGroupHEC3.defineHistogram('etaNEG,phi;LArAffectedRegionsHECC3', + title='HV Affected Regions - HECC - Layer 4;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["HECC"][0],xmin=GlobalVariables.HVeta_HECFcal["HECC"][1],xmax=GlobalVariables.HVeta_HECFcal["HECC"][2], + ybins=GlobalVariables.HVphi_HECFcal["HECC"][0],ymin=GlobalVariables.HVphi_HECFcal["HECC"][1],ymax=GlobalVariables.HVphi_HECFcal["HECC"][2] +) + +#FCAL0 +group_name_ending="FCAL0" +larAffectedRegAlg.FCAL0name=group_name_ending +affectedRegGroupFCAL0 = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupFCAL0.defineHistogram('etaPOS,phi;LArAffectedRegionsFCALA0', + title='HV Affected Regions - FCALA - Layer 1;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalA"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalA"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalA"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalA"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalA"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalA"][2] +) +affectedRegGroupFCAL0.defineHistogram('etaNEG,phi;LArAffectedRegionsFCALC0', + title='HV Affected Regions - FCALC - Layer 1;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalC"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalC"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalC"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalC"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalC"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalC"][2] +) + +#FCAL1 +group_name_ending="FCAL1" +larAffectedRegAlg.FCAL1name=group_name_ending +affectedRegGroupFCAL1 = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupFCAL1.defineHistogram('etaPOS,phi;LArAffectedRegionsFCALA1', + title='HV Affected Regions - FCALA - Layer 2;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalA"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalA"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalA"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalA"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalA"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalA"][2] +) +affectedRegGroupFCAL1.defineHistogram('etaNEG,phi;LArAffectedRegionsFCALC1', + title='HV Affected Regions - FCALC - Layer 2;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalC"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalC"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalC"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalC"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalC"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalC"][2] +) + +#FCAL2 +group_name_ending="FCAL2" +larAffectedRegAlg.FCAL2name=group_name_ending +affectedRegGroupFCAL2 = helper_affectedReg.addGroup( + larAffectedRegAlg, + affectedRegGroupName+group_name_ending, + '/LAr/' +) + +affectedRegGroupFCAL2.defineHistogram('etaPOS,phi;LArAffectedRegionsFCALA2', + title='HV Affected Regions - FCALA - Layer 3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalA"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalA"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalA"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalA"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalA"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalA"][2] +) +affectedRegGroupFCAL2.defineHistogram('etaNEG,phi;LArAffectedRegionsFCALC2', + title='HV Affected Regions - FCALC - Layer 3;#eta;#phi', + type='TH2F', + path=larAffReg_hist_path, + weight='problem', + xbins=GlobalVariables.HVeta_HECFcal["FCalC"][0],xmin=GlobalVariables.HVeta_HECFcal["FCalC"][1],xmax=GlobalVariables.HVeta_HECFcal["FCalC"][2], + ybins=GlobalVariables.HVphi_HECFcal["FCalC"][0],ymin=GlobalVariables.HVphi_HECFcal["FCalC"][1],ymax=GlobalVariables.HVphi_HECFcal["FCalC"][2] +) + +#and finally add all to topSequence +topSequence += helper_affectedReg.result() diff --git a/LArCalorimeter/LArMonitoring/share/LArCollisionTimeMonAlg_jobOptions.py b/LArCalorimeter/LArMonitoring/share/LArCollisionTimeMonAlg_jobOptions.py new file mode 100644 index 00000000000..7fec5f819de --- /dev/null +++ b/LArCalorimeter/LArMonitoring/share/LArCollisionTimeMonAlg_jobOptions.py @@ -0,0 +1,189 @@ + +#AthMonitorCfgHelperOld must be imported in upper level JO + + +#define the group names here, as you'll use them multiple times +collTimeGroupName="LArCollisionTimeMonGroup" + + +#here are the helpers +helper_collTime = AthMonitorCfgHelperOld(DQMonFlags, collTimeGroupName) + +#then the algorithms +#from AthenaMonitoring.AthenaMonitoringConf import ExampleMonitorAlgorithm +from LArMonitoring.LArMonitoringConf import LArCollisionTimeMonAlg +larCollTimeMonAlg = helper_collTime.addAlgorithm(LArCollisionTimeMonAlg, "larCollTimeMonAlg") +larCollTimeMonAlg.CollTimeGroupName=collTimeGroupName +larCollTimeMonAlg.IsOnline = isOnline + + +#add a tool +from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool +larCollTimeMonAlg.BunchCrossingTool = BunchCrossingTool() + +#now the groups +collTimeGroup = helper_collTime.addGroup( + larCollTimeMonAlg, + collTimeGroupName, + "/LAr/" + ) + +#define the histograms +from LArMonitoring import GlobalVariables #to define the ranges +larColTime_hist_path='CollisionTime/' + +collTimeGroup.defineHistogram('ecTimeDiff;LArCollTime', + title='LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.colTime_Nbins,xmin=GlobalVariables.colTime_min,xmax=GlobalVariables.colTime_max) + +collTimeGroup.defineHistogram('ecTimeAvg;LArCollAvgTime', + title='LArCollisionAverageTime - avg time of ECC and ECA;(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.avgColTime_Nbins,xmin=GlobalVariables.avgColTime_min,xmax=GlobalVariables.avgColTime_max) + + +collTimeGroup.defineHistogram('ecTimeDiff;LArCollTimeLumiBlock', #this one is the same as LArCollTime, but it's reset once per LB (FUNCTIONALITY TO BE ADDED!) + title='LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.colTime_Nbins,xmin=GlobalVariables.colTime_min,xmax=GlobalVariables.colTime_max, + opt='kLBNHistoryDepth=1') + + +collTimeGroup.defineHistogram('lumi_block_timeWindow;LArCollTimeLumiBlockTimeCut', + title='Events with abs(<t_{C}> - <t_{A}>) < 10ns as a function of LB;Luminosity Block Number;Number of events per LB', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max) + + +collTimeGroup.defineHistogram('lumi_block_singleBeam_timeWindow;LArCollTimeLumiBlockSingleBeamTimeCut', + title='Events with 20 ns < abs(<t_{C}> - <t_{A}>) < 30ns as a function of LB;Luminosity Block Number;Number of events per LB', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max) + + +collTimeGroup.defineHistogram('lumi_block,ecTimeDiff;LArCollTime_vs_LB', + title='LArCollisionTime Vs Luminosity Block - difference of avg time of ECC and ECA as a function of luminosity block;Luminosity Block Number;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max, + ybins=GlobalVariables.colTime_Nbins,ymin=GlobalVariables.colTime_min,ymax=GlobalVariables.colTime_max) + + +collTimeGroup.defineHistogram('bunch_crossing_id,ecTimeDiff;LArCollTime_vs_BCID', + title='LArCollisionTime Vs BCID - difference of avg time of ECC and ECA as a function of BCID;Bunch Crossing Number;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.BCID_Bins,xmin=GlobalVariables.BCID_Min,xmax=GlobalVariables.BCID_Max, + ybins=GlobalVariables.colTime_Nbins,ymin=GlobalVariables.colTime_min,ymax=GlobalVariables.colTime_max) + +collTimeGroup.defineHistogram('lumi_block,ecTimeAvg;LArCollAvgTime_vs_LB', + title='LArCollisionAvgTime Vs Luminosity Block - avg time of ECC and ECA as a function of luminosity block;Luminosity Block Number;(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max, + ybins=GlobalVariables.avgColTime_Nbins,ymin=GlobalVariables.avgColTime_min,ymax=GlobalVariables.avgColTime_max) + +collTimeGroup.defineHistogram('bunch_crossing_id,ecTimeAvg;LArCollAvgTime_vs_BCID', + title='LArCollisionAvgTime Vs BCID - avg time of ECC and ECA as a function of BCID;Bunch Crossing Number;(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.BCID_Bins,xmin=GlobalVariables.BCID_Min,xmax=GlobalVariables.BCID_Max, + ybins=GlobalVariables.avgColTime_Nbins,ymin=GlobalVariables.avgColTime_min,ymax=GlobalVariables.avgColTime_max) + +#in train monitoring, only done offline +if isOnline: + + collTimeGroupName_intrain=collTimeGroupName+"_intrain" + collTimeGroup_intrain = helper_collTime.addGroup( + larCollTimeMonAlg, + collTimeGroupName_intrain, + "/LAr/" + ) + 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_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_tit+';<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.colTime_Nbins,xmin=GlobalVariables.colTime_min,xmax=GlobalVariables.colTime_max) + + + collTimeGroup_intrain.defineHistogram('ecTimeAvg;LArCollAvgTime'+intrain_name, + title='LArCollisionAverageTime - avg time of ECC and ECA'+intrain_tit+';(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.avgColTime_Nbins,xmin=GlobalVariables.avgColTime_min,xmax=GlobalVariables.avgColTime_max) + + + collTimeGroup_intrain.defineHistogram('ecTimeDiff;LArCollTimeLumiBlock'+intrain_name, #this one is the same as LArCollTime, but it's reset once per LB (FUNCTIONALITY TO BE ADDED!) + title='LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> (ns)'+intrain_tit+';Number of events (weighted by energy/GeV) per ns', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.colTime_Nbins,xmin=GlobalVariables.colTime_min,xmax=GlobalVariables.colTime_max) + + + collTimeGroup_intrain.defineHistogram('(lumi_block_timeWindow);LArCollTimeLumiBlockTimeCut'+intrain_name, + 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=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.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_tit+';Luminosity Block Number;Number of events per LB', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max) + + + 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_tit+';<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max, + ybins=GlobalVariables.colTime_Nbins,ymin=GlobalVariables.colTime_min,ymax=GlobalVariables.colTime_max) + + + 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_tit+';Bunch Crossing Number;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.BCID_Bins,xmin=GlobalVariables.BCID_Min,xmax=GlobalVariables.BCID_Max, + ybins=GlobalVariables.colTime_Nbins,ymin=GlobalVariables.colTime_min,ymax=GlobalVariables.colTime_max) + + 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_tit+';Luminosity Block Number;(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.LB_Bins,xmin=GlobalVariables.LB_Min,xmax=GlobalVariables.LB_Max, + ybins=GlobalVariables.avgColTime_Nbins,ymin=GlobalVariables.avgColTime_min,ymax=GlobalVariables.avgColTime_max) + + 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_tit+';Bunch Crossing Number;(<t_{C}> + <t_{A}>) / 2 (ns);Number of events (weighted by energy/GeV)', + type='TH2F', + path=larColTime_hist_path, + weight='weight', + xbins=GlobalVariables.BCID_Bins,xmin=GlobalVariables.BCID_Min,xmax=GlobalVariables.BCID_Max, + ybins=GlobalVariables.avgColTime_Nbins,ymin=GlobalVariables.avgColTime_min,ymax=GlobalVariables.avgColTime_max) + + pass #end of if isOnline + + +#and finally add all to topSequence +topSequence += helper_collTime.result() diff --git a/LArCalorimeter/LArMonitoring/share/LArReco_fromraw.py b/LArCalorimeter/LArMonitoring/share/LArReco_fromraw.py new file mode 100644 index 00000000000..8ddbe521f34 --- /dev/null +++ b/LArCalorimeter/LArMonitoring/share/LArReco_fromraw.py @@ -0,0 +1,259 @@ +if not 'skipEvents' in dir(): + skipEvents=0 + +if not 'maxEvents' in dir(): + maxEvents=10 + +if not 'outputFile' in dir(): + outputFile="HIST.root" + +if not 'isOnline' in dir(): + isOnline=False + pass + + +from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc) +from AthenaCommon.AlgSequence import AlgSequence +topSequence = AlgSequence() + +#############################################################33 +#include("LArConditionsCommon/LArMinimalSetup.py") + +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +from AthenaCommon.GlobalFlags import globalflags +globalflags.DetGeo.set_Value_and_Lock('atlas') +#globalflags.Luminosity.set_Value_and_Lock('zero') +globalflags.InputFormat.set_Value_and_Lock('bytestream') +globalflags.DataSource.set_Value_and_Lock('data') +#globalflags.DatabaseInstance.set_Value_and_Lock('CONDBR2') +# Not sure that this is correct +athenaCommonFlags.BSRDOInput.set_Value_and_Lock(["/eos/atlas/atlascerngroupdisk/proj-sit/tct/rec_input/q431/data16_13TeV.00297447.physics_Main.daq.RAW._lb0555._SFO-1._0001.data"]) + +from RecExConfig.RecFlags import rec +from RecExConfig.RecAlgsFlags import recAlgs +from RecExConfig.AutoConfiguration import GetProjectName,ConfigureTriggerStream +from RecExConfig.AutoConfiguration import GetProjectName,ConfigureGeo +rec.projectName=GetProjectName() + +ConfigureGeo() + +rec.doExpressProcessing.set_Value_and_Lock(True) + +rec.doWriteESD.set_Value_and_Lock(True) +rec.doWriteAOD.set_Value_and_Lock(False) + +rec.doPerfMon.set_Value_and_Lock(False) +rec.doDPD.set_Value_and_Lock(False) + +rec.doTile.set_Value_and_Lock(True) + +rec.doTrigger.set_Value_and_Lock(True) + +# switch off failint L1Topo stuff +from TriggerJobOpts.TriggerFlags import TriggerFlags +TriggerFlags.writeL1TopoValData.set_Value_and_Lock(False) + +ConfigureTriggerStream() + + +from AthenaCommon.JobProperties import jobproperties +defaultGeoVersion="ATLAS-R2-2015-02-00-00" +jobproperties.Global.DetDescrVersion = defaultGeoVersion + +from AthenaCommon.DetFlags import DetFlags +DetFlags.Calo_setOn() +DetFlags.ID_setOff() +DetFlags.Muon_setOff() +DetFlags.Truth_setOff() +DetFlags.LVL1_setOn() +DetFlags.digitize.all_setOff() +DetFlags.Print() + + +from AtlasGeoModel import SetGeometryVersion +from AtlasGeoModel import GeoModelInit +from AtlasGeoModel import SetupRecoGeometry + +#svcMgr.GeoModelSvc.AtlasVersion=globalflags.DetDescrVersion() + +from LArConditionsCommon.LArCondFlags import larCondFlags +larCondFlags.LoadElecCalib.set_Value_and_Lock(True) + +#Get identifier mapping +include( "LArConditionsCommon/LArIdMap_comm_jobOptions.py" ) +include( "LArIdCnv/LArIdCnv_joboptions.py" ) + +# Event selector +#import AthenaPoolCnvSvc.ReadAthenaPool +from ByteStreamCnvSvc import ReadByteStream +############################################################### + + +from LArConditionsCommon.LArCondFlags import larCondFlags +include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py") + +print "Resolving 'CURRENT' express conditions tag ..." +sys.path.append('/afs/cern.ch/user/a/atlcond/utils/python/') +from AtlCoolBKLib import resolveAlias +resolver=resolveAlias() +currentGlobalES=resolver.getCurrentES().replace("*","ST") +print "Found ",currentGlobalES +svcMgr.IOVDbSvc.GlobalTag=currentGlobalES +#"COMCOND-BLKP-005-05" + +#Specify the input file(s) +svcMgr.ByteStreamInputSvc.FullFileName=athenaCommonFlags.BSRDOInput() + +svcMgr.EventSelector.SkipEvents=skipEvents + +theApp.EvtMax=maxEvents + +# Specify the object you want to read from ByteStream +theByteStreamAddressProviderSvc = svcMgr.ByteStreamAddressProviderSvc +theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/FREE"] +theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"] +theByteStreamAddressProviderSvc.TypeNames += ["LArRawChannelContainer/LArRawChannels_fB"] +theByteStreamAddressProviderSvc.TypeNames += ["TileRawChannelContainer/TileRawChannelCnt"] +theByteStreamAddressProviderSvc.TypeNames += ["TileRawChannelContainer/MuRcvRawChCnt"] +theByteStreamAddressProviderSvc.TypeNames += ["TileDigitsContainer/MuRcvDigitsCnt"] +theByteStreamAddressProviderSvc.TypeNames += ["ROIB::RoIBResult/RoIBResult"] + + +from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg +topSequence+=xAODMaker__EventInfoCnvAlg() + +include("LArROD/LArFebErrorSummaryMaker_jobOptions.py") +febSummaryMaker.CheckAllFEB=False + +from LArROD.LArRODFlags import larRODFlags +larRODFlags.readDigits=True +larRODFlags.keepDSPRaw = True +from CaloRec.CaloCellFlags import jobproperties; +jobproperties.CaloCellFlags.doDeadCellCorr.set_Value_and_Lock(True) +jobproperties.CaloCellFlags.doLArDeadOTXCorr.set_Value_and_Lock(False) + +include("TileConditions/TileConditions_jobOptions.py") + +from CaloRec.CaloCellGetter import CaloCellGetter +CaloCellGetter() + +from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter +CaloClusterTopoGetter() + +from CaloRec.CaloClusterSWCmbGetter import CaloClusterSWCmbGetter +CaloClusterSWCmbGetter() + +from LArCellRec.LArNoisyROSummaryGetter import LArNoisyROSummaryGetter +LArNoisyROSummaryGetter() +#topSequence.LArNoisyROAlg.OutputLevel=DEBUG +#topSequence.LArNoisyROAlg.Tool.OutputLevel=DEBUG +topSequence.LArNoisyROAlg.Tool.MNBLooseCut=5 +topSequence.LArNoisyROAlg.Tool.MNBTightCut=17 + +include("LArCellRec/LArTimeVetoAlg_jobOptions.py") +include("LArCellRec/LArCollisionTime_jobOptions.py") + +#################### +from TriggerJobOpts.TriggerFlags import TriggerFlags as tf +tf.readBS.set_Value_and_Lock(True) +tf.doLVL1.set_Value_and_Lock(False) +tf.doLVL2.set_Value_and_Lock(False) +tf.doEF.set_Value_and_Lock(False) +tf.doL1Topo.set_Value_and_Lock(False) +tf.readLVL1Calo.set_Value_and_Lock(True) +tf.enableMonitoring.set_Value_and_Lock(False) +tf.doID.set_Value_and_Lock(False) +tf.doMuon.set_Value_and_Lock(False) +tf.doBcm.set_Value_and_Lock(False) +tf.doTrt.set_Value_and_Lock(False) +tf.configForStartup="HLTonline" +tf.configForStartup.lock() + +include("TrigTier0/BStoESD_Tier0_HLTConfig_jobOptions.py") + +#This tool is apparently instanciated by TrkDetElementSurface/ DetElementSurfaceCnv_p1.h +from TrkEventCnvTools import TrkEventCnvToolsConf +EventCnvSuperTool = TrkEventCnvToolsConf.Trk__EventCnvSuperTool('EventCnvSuperTool') +EventCnvSuperTool.DoMuons = False +EventCnvSuperTool.DoID = False +ToolSvc += EventCnvSuperTool + +# --- BunchCrossing Tool configuration --- +from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool +theBCTool = BunchCrossingTool() +ToolSvc += theBCTool + +from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault +theCaloNoiseTool = CaloNoiseToolDefault() +ToolSvc+=theCaloNoiseTool +#from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool +#theLArBadChannelTool=LArBadChanTool() +#ToolSvc+=theLArBadChannelTool + + +# variable for testing on ESD +try: + LArNoisyROMonForceTrigger +except NameError: + LArNoisyROMonForceTrigger = False + +from LArCellRec.LArNoisyROFlags import larNoisyROFlags + +############### +# Monitoring should go here +from AthenaMonitoring.DQMonFlags import DQMonFlags + + + +theApp.HistogramPersistency = "ROOT" +from GaudiSvc.GaudiSvcConf import THistSvc +svcMgr += THistSvc() + +# Not sure, if this is needed: (Margherita: it looks like it's needed, and the code does not work if this is placed below, moved here) +svcMgr.THistSvc.Output += ["CombinedMonitoring DATAFILE='"+outputFile+"' OPT='RECREATE'"] + + + +from AthenaMonitoring import AthMonitorCfgHelperOld + +include("LArMonitoring/LArAffectedRegionsAlg_jobOptions.py") +include("LArMonitoring/LArCollisionTimeMonAlg_jobOptions.py") + +from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr +svcMgr += AthenaEventLoopMgr() +svcMgr.AthenaEventLoopMgr.EventPrintoutInterval = 100 + + +theAuditorSvc = svcMgr.AuditorSvc +theAuditorSvc.Auditors += [ "ChronoAuditor"] + +#svcMgr.ChronoStatSvc.ChronoDestinationCout = True + +svcMgr.ChronoStatSvc.PrintUserTime = True +svcMgr.ChronoStatSvc.PrintSystemTime = True +svcMgr.ChronoStatSvc.PrintEllapsedTime = True +#svcMgr.ChronoStatSvc.NumberOfSkippedEventsForMemStat = 1 + +#svcMgr.ChronoStatSvc.AsciiStatsOutputFile = "chronoStats.ascii" + +#svcMgr.AthenaPoolCnvSvc.UseDetailChronoStat = True + +theApp.AuditAlgorithms = True + +#Hack to load the right dict to write vector< vector < X > > to TTRee +#import AthenaPython.PyAthena as PyAthena +#PyAthena.load_library('AtlasSTLAddReflexDict') + + +#svcMgr.ToolSvc.OutputLevel=DEBUG + +svcMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" +svcMgr.MessageSvc.defaultLimit = 9999999 # all messages +svcMgr.MessageSvc.useColors = False +#svcMgr.MessageSvc.defaultLimit=1000000 +#svcMgr.MessageSvc.OutputLevel=DEBUG + +#svcMgr.StoreGateSvc.Dump=True + +#svcMgr.ToolSvc.LArCellHVCorrDefault.OutputLevel=WARNING + diff --git a/LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.cxx b/LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.cxx new file mode 100644 index 00000000000..6c069bc71e4 --- /dev/null +++ b/LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.cxx @@ -0,0 +1,509 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: LArAffectedRegionsAlg.cxx +// PACKAGE: LArMonTools +// +// AUTHOR: Margherita Spalla (migrated from algorithm by Jessica Leveque) +// +// Class for monitoring : Map of Affected Regions +// built from "Affected Region" metadata, stored in ESDs. +// ******************************************************************** + +#include "LArAffectedRegionsAlg.h" +#include "CaloConditions/CaloAffectedRegionInfoVec.h" + +#include "TMath.h" +#include <vector> + + + + +using namespace std; + + +/*---------------------------------------------------------*/ +LArAffectedRegionsAlg::LArAffectedRegionsAlg(const std::string& name,ISvcLocator* pSvcLocator ) + : AthMonitorAlgorithm(name,pSvcLocator) +{} + +/*---------------------------------------------------------*/ +LArAffectedRegionsAlg::~LArAffectedRegionsAlg() +{} + +/*---------------------------------------------------------*/ +StatusCode +LArAffectedRegionsAlg::initialize() +{ + ATH_MSG_INFO( "Initialize LArAffectedRegionsAlg" ); + + ATH_CHECK( m_affKey.initialize() ); + + return AthMonitorAlgorithm::initialize(); +} + + +/*---------------------------------------------------------*/ +StatusCode +LArAffectedRegionsAlg::fillHistograms( const EventContext& ctx ) const +{ + using namespace Monitored; + + ATH_MSG_DEBUG( "in fillHists()" ); + + if(ctx.evt() > 0) { //only run on first event (it has ctx.evt()=0) + ATH_MSG_DEBUG( "won't run on: evt()="<<ctx.evt()<<">1"); + return StatusCode::SUCCESS; + } + + //monitored variables + auto problem = Monitored::Scalar<int>("problem",0); + auto phi = Monitored::Scalar<float>("phi",0.0); + auto etaPOS = Monitored::Scalar<float>("etaPOS",0.0); + auto etaNEG = Monitored::Scalar<float>("etaNEG",0.0); + float eta; //this we will need later + + + //do nothing if online + if(m_IsOnline) return StatusCode::SUCCESS; + + // Retrieve CaloAffected Regions + SG::ReadCondHandle<CaloAffectedRegionInfoVec> affHdl{m_affKey, ctx}; + const CaloAffectedRegionInfoVec* affRegVec=*affHdl; + if (!affRegVec) { + ATH_MSG_WARNING( " Cannot find LArAffectedRegion in DetectorStore " ); + return StatusCode::SUCCESS; + } + + /////////////////////// + // Problem Types // + /////////////////////// + // 0: Missing FEB // + // 1: Non nominal HV // + // 2: Dead HV // + /////////////////////// + + std::vector<CaloAffectedRegionInfo>::const_iterator reg1 = affRegVec->begin(); + std::vector<CaloAffectedRegionInfo>::const_iterator reg2 = affRegVec->end(); + for (;reg1 != reg2; ++reg1) { + const CaloAffectedRegionInfo* region = &(*reg1); + problem=region->get_problem(); + if (problem == 0) continue; + int layermin=region->get_layer_min(); + int layermax=region->get_layer_max(); + float phimin=region->get_phi_min(); + float phimax=region->get_phi_max(); + float etamin=region->get_eta_min(); + float etamax=region->get_eta_max(); + + ATH_MSG_DEBUG( " Print list of affected regions:" ); + ATH_MSG_DEBUG( region << " " + << region->get_eta_min() << " " << region->get_eta_max() << " " + << region->get_phi_min() << " " << region->get_phi_max() << " " + << region->get_layer_min() << " " << region->get_layer_max() << " " << region->get_problem() ); + ///////////////////////////////// + // Build Affected Regions maps // + ///////////////////////////////// + // CaloSample + ///////////////////////////////// + // PreSamplerB=0, EMB1=1, EMB2=2, EMB3=3 // LAr barrel + // PreSamplerE=4, EME1=5, EME2=6, EME3=7 // LAr EM endcap + // HEC0=8, HEC1=9, HEC2=10, HEC3=11 // Hadronic end cap cal. + // TileBar0=12, TileBar1=13, TileBar2=14 // Tile barrel + // TileGap1=15, TileGap2=16, TileGap3=17 // Tile gap (ITC & scint) + // TileExt0=18, TileExt1=19, TileExt2=20 // Tile extended barrel + // FCAL0=21, FCAL1=22, FCAL2=23 // Forward EM endcap + ///////////////////////////////// + + + // EM Barrel - PS + if(layermin==0){ + //now get the proper eta-phi + eta = etamin+0.01; + while(eta<etamax){ + // phimin < phimax + if(phimin<=phimax){ + phi = phimin+0.01; + while(phi<phimax){ + if(eta>=0){ + etaPOS=eta; + fill(m_MonGroupName+m_embpsName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMBAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(m_MonGroupName+m_embpsName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMBCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/32); + if(fabs(phi)<1.e-4) phi=0.; + } + // phimin > phimax + }else{ + phi = phimin+0.01; + while(phi<TMath::Pi()){ + if(eta>=0){ + etaPOS=eta; + fill(m_MonGroupName+m_embpsName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMBAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(m_MonGroupName+m_embpsName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMBCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/32); + if(fabs(phi)<1.e-4) phi=0.; + } + phi = -TMath::Pi(); + while(phi<phimax){ + if(eta>=0){ + etaPOS=eta; + fill(m_MonGroupName+m_embpsName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMBAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(m_MonGroupName+m_embpsName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMBCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/32); + if(fabs(phi)<1.e-4) phi=0.; + } + } + eta+=0.2; + } + } + + // EM Barrel - Other Layers + if(layermin==1){ + //now get the proper eta-phi + eta = etamin; + while(eta < etamax){ + // phimin < phimax + if(phimin<=phimax){ + phi = phimin+0.01; + while(phi<phimax){ + if(eta >=0){ + etaPOS=eta; + fill(m_MonGroupName+m_embName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMBA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta <0){ + etaNEG=eta; + fill(m_MonGroupName+m_embName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMBC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/128); + if(fabs(phi)<1.e-4) phi=0.; + } + // phimin > phimax: go over Pi + }else{ + phi = phimin+0.01; + while(phi<TMath::Pi()){ + if(eta >=0){ + etaPOS=eta; + fill(m_MonGroupName+m_embName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMBA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta <0){ + etaNEG=eta; + fill(m_MonGroupName+m_embName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMBC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/128); + if(fabs(phi)<1.e-4) phi=0.; + } + phi = -TMath::Pi(); + while(phi<phimax){ + if(eta >=0){ + etaPOS=eta; + fill(m_MonGroupName+m_embName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMBA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta <0){ + etaNEG=eta; + fill(m_MonGroupName+m_embName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMBC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/128); + if(fabs(phi)<1.e-4) phi=0.; + } + } + eta+=0.2; + } + } + + // EM endcap - PS + if(layermin==4){ + //now get the proper eta-phi + eta = etamin; + while(eta<etamax){ + // phimin < phimax + if(phimin<=phimax){ + phi = phimin; + while(phi<phimax){ + if(eta>=0){ + etaPOS=eta; + fill(m_MonGroupName+m_emecpsName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMECAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(m_MonGroupName+m_emecpsName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMECCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/64); + if(fabs(phi)<1.e-4) phi=0.; + } + // phimin > phimax + }else{ + phi = phimin+0.01; + while(phi<TMath::Pi()){ + if(eta>=0){ + etaPOS=eta; + fill(m_MonGroupName+m_emecpsName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMECAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(m_MonGroupName+m_emecpsName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMECCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/64); + if(fabs(phi)<1.e-4) phi=0.; + } + phi = -TMath::Pi(); + while(phi<phimax){ + if(eta>=0){ + etaPOS=eta; + fill(m_MonGroupName+m_emecpsName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMECAPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(m_MonGroupName+m_emecpsName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMECCPS " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/64); + if(fabs(phi)<1.e-4) phi=0.; + } + } + if(fabs(eta)<2.5)eta+=0.2; + if(fabs(eta)>=2.5)eta+=0.3; + } + } + + // EM Endcap - Other Layers + if(layermin==5){ + //now get the proper eta-phi + eta = etamin+0.01; + while(eta<etamax){ + // phimin < phimax + if(phimin<=phimax){ + phi = phimin+0.01; + while(phi<phimax){ + if(eta>=0){ + etaPOS=eta; + fill(m_MonGroupName+m_emecName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMECA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(m_MonGroupName+m_emecName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMECC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/256); + if(fabs(phi)<1.e-4) phi=0.; + } + // phimin > phimax + }else{ + phi = phimin+0.01; + while(phi<TMath::Pi()){ + if(eta>=0){ + etaPOS=eta; + fill(m_MonGroupName+m_emecName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMECA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(m_MonGroupName+m_emecName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMECC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/256); + if(fabs(phi)<1.e-4) phi=0.; + } + phi = -TMath::Pi()+0.01; + while(phi<phimax){ + if(eta>=0){ + etaPOS=eta; + fill(m_MonGroupName+m_emecName,etaPOS,phi,problem); + ATH_MSG_DEBUG( "EMECA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(m_MonGroupName+m_emecName,etaNEG,phi,problem); + ATH_MSG_DEBUG( "EMECC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/256); + if(fabs(phi)<1.e-4) phi=0.; + } + } + if(fabs(eta)>=2.8) eta+=0.4; + else if(fabs(eta)>=2.5)eta+=0.3; + else eta+=0.2; + } + } + + // HEC + if(layermin>=8 && layermin<=11){ + //set the group to fill(only depends on layer) + std::string hec_layer_name=m_MonGroupName; + switch(layermin-8) { + case 0: + hec_layer_name=hec_layer_name+m_hec0Name; + break; + case 1: + hec_layer_name=hec_layer_name+m_hec1Name; + break; + case 2: + hec_layer_name=hec_layer_name+m_hec2Name; + break; + default: //this can only be ==3, because of previous if statement + hec_layer_name=hec_layer_name+m_hec3Name; + break; + } + + //now get the proper eta-phi + eta = etamin; + // phimin < phimax + if(phimin<=phimax){ + phi = phimin+0.01; + while(phi<phimax){ + if(eta>=0){ + etaPOS=eta; + fill(hec_layer_name,etaPOS,phi,problem); + ATH_MSG_DEBUG( "HECA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(hec_layer_name,etaNEG,phi,problem); + ATH_MSG_DEBUG( "HECC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/32); + if(fabs(phi)<1.e-4) phi=0.; + } + // phimin < phimax + }else{ + phi = phimin+0.01; + while(phi<TMath::Pi()){ + if(eta>=0){ + etaPOS=eta; + fill(hec_layer_name,etaPOS,phi,problem); + ATH_MSG_DEBUG( "HECA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(hec_layer_name,etaNEG,phi,problem); + ATH_MSG_DEBUG( "HECC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/32); + if(fabs(phi)<1.e-4) phi=0.; + } + phi = -TMath::Pi(); + while(phi<phimax){ + if(eta>=0){ + etaPOS=eta; + fill(hec_layer_name,etaPOS,phi,problem); + ATH_MSG_DEBUG( "HECA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(hec_layer_name,etaNEG,phi,problem); + ATH_MSG_DEBUG( "HECC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/32); + if(fabs(phi)<1.e-4) phi=0.; + } + } + } + + // FCAL + if(layermin>=21 && layermin<=23){ + //set the group to fill(only depends on layer) + std::string fcal_layer_name=m_MonGroupName; + switch(layermin-21) { + case 0: + fcal_layer_name=fcal_layer_name+m_fcal0Name; + break; + case 1: + fcal_layer_name=fcal_layer_name+m_fcal1Name; + break; + default: //this can only be ==2, because of previous if statement + fcal_layer_name=fcal_layer_name+m_fcal2Name; + break; + } + + //now get the proper eta-phi + eta = etamin; + // phimin < phimax + if(phimin<=phimax){ + phi = phimin+0.1; + while(phi<phimax){ + if(eta>=0){ + etaPOS=eta; + fill(fcal_layer_name,etaPOS,phi,problem); + ATH_MSG_DEBUG( "FCALA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(fcal_layer_name,etaNEG,phi,problem); + ATH_MSG_DEBUG( "FCALC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/16); + if(fabs(phi)<1.e-4) phi=0.; + } + // phimin > phimax + }else{ + phi = phimin+0.1; + while(phi<TMath::Pi()){ + if(eta>=0){ + etaPOS=eta; + fill(fcal_layer_name,etaPOS,phi,problem); + ATH_MSG_DEBUG( "FCALA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(fcal_layer_name,etaNEG,phi,problem); + ATH_MSG_DEBUG( "FCALC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/16); + if(fabs(phi)<1.e-4) phi=0.; + } + phi = -TMath::Pi()+0.1; + while(phi<phimax){ + if(eta>=0){ + etaPOS=eta; + fill(fcal_layer_name,etaPOS,phi,problem); + ATH_MSG_DEBUG( "FCALA " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + if(eta<0){ + etaNEG=eta; + fill(fcal_layer_name,etaNEG,phi,problem); + ATH_MSG_DEBUG( "FCALC " << eta << " " << phi << " " << problem << " " << layermin << " " << layermax << " " << region ); + } + phi+=(2*TMath::Pi()/16); + if(fabs(phi)<1.e-4) phi=0.; + } + } + } + } // End Calo Affected Regions + + return StatusCode::SUCCESS; +} + + + diff --git a/LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.h b/LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.h new file mode 100644 index 00000000000..3fab19e56bf --- /dev/null +++ b/LArCalorimeter/LArMonitoring/src/LArAffectedRegionsAlg.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @class LArAffectedRegionsAlg + * @author Margherita Spalla <mspalla@cern.ch> (updated from LArAffectedRegions by Jessica Leveque <jleveque@in2p3.fr>) + * + */ + +#ifndef LARAFFECTEDREGIONSALG_H +#define LARAFFECTEDREGIONSALG_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoring/Monitored.h" + +#include "StoreGate/ReadCondHandleKey.h" +#include "CaloConditions/CaloAffectedRegionInfoVec.h" + +#include <string> + + + + +class LArAffectedRegionsAlg: public AthMonitorAlgorithm +{ + public: + LArAffectedRegionsAlg(const std::string& name,ISvcLocator* pSvcLocator ); + + /** @brief Default destructor */ + virtual ~LArAffectedRegionsAlg(); + + /** @brief Overwrite dummy method from AlgTool */ + virtual StatusCode initialize() override; + + + /** Called each event */ + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + + private: + + //affected regions handle + SG::ReadCondHandleKey<CaloAffectedRegionInfoVec> m_affKey {this,"LArAffectedRegionKey", "LArAffectedRegionInfo", "SG key for affected regions cond object"}; + + // Properties + //MonGroup(s) name + Gaudi::Property<std::string> m_MonGroupName {this,"AffectedRegionsGroupName","LArAffectedRegionsMonGroup"}; + Gaudi::Property<std::string> m_embpsName {this,"EMBPSname","EMBPS"}; + Gaudi::Property<std::string> m_embName {this,"EMBname","EMB"}; + Gaudi::Property<std::string> m_emecpsName {this,"EMECPSname","EMECPS"}; + Gaudi::Property<std::string> m_emecName {this,"EMECname","EMEC"}; + Gaudi::Property<std::string> m_hec0Name {this,"HEC0name","HEC0"}; + Gaudi::Property<std::string> m_hec1Name {this,"HEC1name","HEC1"}; + Gaudi::Property<std::string> m_hec2Name {this,"HEC2name","HEC2"}; + Gaudi::Property<std::string> m_hec3Name {this,"HEC3name","HEC3"}; + Gaudi::Property<std::string> m_fcal0Name {this,"FCAL0name","FCAL0"}; + Gaudi::Property<std::string> m_fcal1Name {this,"FCAL1name","FCAL1"}; + Gaudi::Property<std::string> m_fcal2Name {this,"FCAL2name","FCAL2"}; + + //Other properties + Gaudi::Property<bool> m_IsOnline {this,"IsOnline",false}; + Gaudi::Property<float> m_delta_phi {this,"PhiGranularity",0.01}; + Gaudi::Property<float> m_delta_eta {this,"EtaGranularity",0.01}; + +}; + +#endif + diff --git a/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.cxx b/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.cxx new file mode 100755 index 00000000000..f306b4d439c --- /dev/null +++ b/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.cxx @@ -0,0 +1,155 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: LArCollisionTimeMonAlg.cxx +// PACKAGE: LArMonitoring +// +// AUTHOR: Margherita Spalla (migrated from LArCollisionTimeMonTool by Vikas Bansal) +// +// Class for monitoring : EC timing from LArCollisionTime Container + +// +// ******************************************************************** + + + +#include "LArCollisionTimeMonAlg.h" + + +#include "TrigAnalysisInterfaces/IBunchCrossingTool.h" + + +using namespace std; + + + + +/*---------------------------------------------------------*/ +LArCollisionTimeMonAlg::LArCollisionTimeMonAlg( const std::string& name, ISvcLocator* pSvcLocator ) + : AthMonitorAlgorithm(name,pSvcLocator) + ,m_timeCut(5.0) + ,m_minCells(2) + ,m_eWeighted(true) + ,m_LArCollisionTimeKey("LArCollisionTime") + ,m_bunchCrossingTool("BunchCrossingTool") +{ + declareProperty( "Key" , m_LArCollisionTimeKey); + declareProperty( "BunchCrossingTool" , m_bunchCrossingTool); +} + +/*---------------------------------------------------------*/ +LArCollisionTimeMonAlg::~LArCollisionTimeMonAlg() +{} + +/*---------------------------------------------------------*/ +StatusCode +LArCollisionTimeMonAlg::initialize() { + + //init handlers + ATH_CHECK( m_LArCollisionTimeKey.initialize() ); + + return AthMonitorAlgorithm::initialize(); +} + +/*---------------------------------------------------------*/ +/* +TO BE MOVED IN PYTHON + MonGroup generalGroupShift( this, "/LAr/"+m_histPath+"/", run, ATTRIB_MANAGED); + MonGroup generalGroupLB( this, "/LAr/"+m_histPath+"/", run, ATTRIB_X_VS_LB, "", "merge"); + +*/ + +/*---------------------------------------------------------*/ +StatusCode +LArCollisionTimeMonAlg::fillHistograms( const EventContext& ctx ) const +{ + using namespace Monitored; + + ATH_MSG_DEBUG( "in fillHists()" ); + + //monitored variables + auto ecTimeDiff = Monitored::Scalar<float>("ecTimeDiff",0.0); + auto ecTimeAvg = Monitored::Scalar<float>("ecTimeAvg",0.0); + auto lumi_block = Monitored::Scalar<unsigned int>("lumi_block",0); + auto lumi_block_timeWindow = Monitored::Scalar<float>("lumi_block_timeWindow",0); + auto lumi_block_singleBeam_timeWindow = Monitored::Scalar<float>("lumi_block_singleBeam_timeWindow",0); + auto bunch_crossing_id = Monitored::Scalar<unsigned int>("bunch_crossing_id",0); + auto weight = Monitored::Scalar<float>("weight",1.); + + // --- retrieve event information --- + auto event_info = GetEventInfo(ctx); + + // bunch crossing ID: + bunch_crossing_id = event_info->bcid(); + + // luminosity block number + lumi_block = event_info->lumiBlock(); + + + 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 = 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_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(); + ecTimeAvg = (larTime->timeC() + larTime->timeA()) / 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 + + //set the weight if needed + if (m_eWeighted) weight = (larTime->energyA()+larTime->energyC())*1e-3; + + //fill your group + 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); + + //check singleBeam-timeWindow + lumi_block_singleBeam_timeWindow=lumi_block; + if ( fabs(ecTimeDiff) > 20 && fabs(ecTimeDiff) < 30 ) 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..."); + 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); + + //check singleBeam-timeWindow + if ( fabs(ecTimeDiff) > 20 && fabs(ecTimeDiff) < 30 ) 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?" ); + } + } + } + + return StatusCode::SUCCESS; +} + + + diff --git a/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.h b/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.h new file mode 100755 index 00000000000..6457c0c203f --- /dev/null +++ b/LArCalorimeter/LArMonitoring/src/LArCollisionTimeMonAlg.h @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @class LArCollisionTimeMonAlg + * @author Margherita Spalla <margherita.spalla@cern.ch> (migrated from LArCollisionTimeMonTool by Vikas Bansal <Vikas@uvic.ca>) + * + */ + +#ifndef LAR_COLLISION_TIME_MON_TOOL_H +#define LAR_COLLISION_TIME_MON_TOOL_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoring/Monitored.h" + +#include "StoreGate/ReadHandleKey.h" +#include "LArRecEvent/LArCollisionTime.h" + + +#include <string> +#include <vector> + + +namespace Trig { +class IBunchCrossingTool; +} + + +class LArCollisionTimeMonAlg: public AthMonitorAlgorithm +{ + public: + LArCollisionTimeMonAlg( const std::string& name, ISvcLocator* pSvcLocator ); + + /** @brief Default destructor */ + virtual ~LArCollisionTimeMonAlg(); + + /** @brief Overwrite dummy method from AlgTool */ + virtual StatusCode initialize() override; + + + /** Called each event */ + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + + + + private: + + //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<bool> m_IsOnline {this,"IsOnline",false}; + Gaudi::Property<float> m_timeCut {this,"timeDiffCut",5.0}; + Gaudi::Property<int> m_minCells {this,"nCells",2}; + Gaudi::Property<bool> m_eWeighted {this,"eWeighted",true}; + + //containers' handles + SG::ReadHandleKey<LArCollisionTime> m_LArCollisionTimeKey; + + //tools handles + ToolHandle<Trig::IBunchCrossingTool> m_bunchCrossingTool; + +}; + +#endif diff --git a/LArCalorimeter/LArMonitoring/src/components/LArMonTools_entries.cxx b/LArCalorimeter/LArMonitoring/src/components/LArMonTools_entries.cxx new file mode 100755 index 00000000000..b22ad075a9f --- /dev/null +++ b/LArCalorimeter/LArMonitoring/src/components/LArMonTools_entries.cxx @@ -0,0 +1,10 @@ +#include "../LArCollisionTimeMonAlg.h" +#include "../LArAffectedRegionsAlg.h" + + +DECLARE_COMPONENT(LArCollisionTimeMonAlg) +DECLARE_COMPONENT(LArAffectedRegionsAlg) + + + + -- GitLab