def test_enforceMergeTypesTest(self): with self.assertRaises(AssertionError): defineHistogram('var,pass', type='TEfficiency', merge='weightedAverage') with self.assertRaises(AssertionError): defineHistogram('var,pass', type='TTree', merge='weightedAverage')
def test_invalidAlias(self): from AthenaCommon.AthenaCommonFlags import athenaCommonFlags athenaCommonFlags.isOnline = True check = defineHistogram('var;myhist(', path='EXPERT') self.assertIs(check, '') check = defineHistogram('var;myhist', path='EXPERT') self.assertNotEqual(check, '') athenaCommonFlags.isOnline = False check = defineHistogram('var;my/hist') self.assertIs(check, '') check = defineHistogram('var;myhist(') self.assertNotEqual(check, '')
def test_2D_labelsXY(self): check = defineHistogram('varX,varY', 'TH2F', xlabels=["bin0", "bin1"], ylabels=["bin0", "bin1", "bin2"]) true = '{"alias": "varY_vs_varX", "allvars": ["varX", "varY"], "convention": "", "merge": "", "path": "", "title": "varX,varY", "treeDef": "", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": ["bin0", "bin1"], "xmax": 1, "xmin": 0, "xvar": "varX", "yarray": [], "ybins": 3, "ylabels": ["bin0", "bin1", "bin2"], "ymax": 0.0, "ymin": 0.0, "yvar": "varY", "zbins": 0.0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "Sumw2": false, "kLBNHistoryDepth": 0, "kAddBinsDynamically": false, "kRebinAxes": false, "kCanRebin": false, "kVec": false, "kVecUO": false, "kCumulative": false}' self.assertEqual(json.loads(check), json.loads(true))
def test_enforceType(self): from AthenaCommon.AthenaCommonFlags import athenaCommonFlags athenaCommonFlags.isOnline = True check = defineHistogram('var,pass', 'TEfficiency') self.assertIs(check, '') check = defineTree('var,pass', treedef='var/F:pass/I') self.assertIs(check, '') athenaCommonFlags.isOnline = False
def __init__(self, name): super(TrigMultiTrkComboHypoToolMonitoring, self).__init__(name) self.Histograms = [ defineHistogram('totCharge', type='TH1F', path='EXPERT', title="Total Charge of tracks", xbins=21, xmin=-10, xmax=10), defineHistogram('CutCounter', type='TH1F', path='EXPERT', title="mass of track pairs; m_{#mu#mu} [GeV]", xbins=5, xmin=-0.5, xmax=4.5), defineHistogram( 'FitChi2', type='TH1F', path='EXPERT', title="chi2 fit of N tracks; fit chi2 of N selected tracks", xbins=100, xmin=0, xmax=100), defineHistogram( 'VertexMass', type='TH1F', path='EXPERT', title="Number of tracks selected; N selected tracks", xbins=100, xmin=0, xmax=20), defineHistogram( 'trackPts', type='TH1F', path='EXPERT', title= "pair mass of N tracks; pair mass of N selected tracks [GeV]", xbins=100, xmin=0, xmax=20) ]
def CTPUnpackingMonitoring(maxItems, maxChains): tool = GenericMonitoringTool('CTPUnpackingMonitoring') tool.HistPath = "HLTFramework/L1Decoder" tool.Histograms = [ defineHistogram('TAVItems', path='EXPERT', type='TH1F', title='Number of active L1 TAV items;N Items;N Events', xbins=maxItems, xmin=0, xmax=maxItems), defineHistogram('Chains', path='EXPERT', type='TH1F', title='Number of activated Chains;N Chains;N Events', xbins=maxChains, xmin=0, xmax=maxChains) ] return tool
def test_merge(self): check = defineHistogram('var', 'TH1F', 'EXPERT', 'title', '', 10, 0.0, 10.0, merge='weightedAverage') true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "weightedAverage", "path": "EXPERT", "title": "title", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "Sumw2": false, "kLBNHistoryDepth": 0, "kAddBinsDynamically": false, "kRebinAxes": false, "kCanRebin": false, "kVec": false, "kVecUO": false, "kCumulative": false}' self.assertEqual(json.loads(check), json.loads(true))
def __init__(self, name='ROBDataProviderSvc'): super(HltROBDataProviderSvc, self).__init__(name) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool,defineHistogram self.MonTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/'+name) self.MonTool.Histograms = [ defineHistogram('TIME_ROBReserveData', path='EXPERT', type='TH1F', title='Time to reserve ROBs for later retrieval;time [mu s]', xbins=100, xmin=0, xmax=1000), defineHistogram('NUMBER_ROBReserveData', path='EXPERT', type='TH1F', title='Number of reserved ROBs for later retrieval;number', xbins=100, xmin=0, xmax=500), defineHistogram('TIME_ROBRequest', path='EXPERT', type='TH1F', title='Time for ROB retrievals;time [mu s]', xbins=400, xmin=0, xmax=200000), defineHistogram('NUMBER_ROBRequest', path='EXPERT', type='TH1F', title='Number of retrieved ROBs;number', xbins=100, xmin=0, xmax=1000), defineHistogram('TIME_CollectAllROBs', path='EXPERT', type='TH1F', title='Time for retrieving complete event data;time [mu s]', xbins=400, xmin=0, xmax=200000), defineHistogram('NUMBER_CollectAllROBs', path='EXPERT', type='TH1F', title='Number of received ROBs for collect call;number', xbins=100, xmin=0, xmax=2500) ] return
def test_3D(self): check = defineHistogram('varX,varY,varZ', 'TProfile2D', xbins=10, xmin=0.0, xmax=10.0, ybins=40, ymin=0.0, ymax=20.0, zmin=-1.0, zmax=1.0) true = '{"alias": "varZ_vs_varY_vs_varX", "allvars": ["varX", "varY", "varZ"], "convention": "", "merge": "", "path": "", "title": "varX,varY,varZ", "treeDef": "", "type": "TProfile2D", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "varX", "yarray": [], "ybins": 40, "ylabels": [], "ymax": 20.0, "ymin": 0.0, "yvar": "varY", "zbins": 0.0, "zlabels": [], "zmax": 1.0, "zmin": -1.0, "zvar": "varZ", "Sumw2": false, "kLBNHistoryDepth": 0, "kAddBinsDynamically": false, "kRebinAxes": false, "kCanRebin": false, "kVec": false, "kVecUO": false, "kCumulative": false}' self.assertEqual(json.loads(check), json.loads(true))
def RoIsUnpackingMonitoring(prefix, maxCount, maxEta=3.): tool = GenericMonitoringTool(prefix + 'RoIsUnpackingMonitoring') tool.HistPath = "HLTFramework/L1Decoder/RoIs" + prefix tool.Histograms = [ defineHistogram('count', path='EXPERT', type='TH1F', title='Number of RoIs;N RoIs;N Events', xbins=maxCount, xmin=0, xmax=maxCount), defineHistogram('eta', path='EXPERT', type='TH1F', title='Eta distribution;eta;N RoIs', xbins=60, xmin=-maxEta, xmax=maxEta), defineHistogram('phi', path='EXPERT', type='TH1F', title='Phi distribution;phi;N RoIs', xbins=64, xmin=-math.pi, xmax=math.pi), defineHistogram('eta, phi', path='EXPERT', type='TH2F', title='RoIs map;eta;phi', xbins=30, xmin=-maxEta, xmax=maxEta, ybins=32, ymin=-math.pi, ymax=math.pi) ] return tool
def TrigTopoEgammaElectronCfg(name='topoEgammaBuilder_TrigElectrons'): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram monTool = GenericMonitoringTool("MonTool_topoEgammaBuilder") monTool.Histograms = [ defineHistogram('EldeltaEta',type='TH1F', title='#Delta#eta', path='EXPERT',xbins=80, xmin=-0.01,xmax=0.01), defineHistogram('EldeltaPhi',type='TH1F', title='#Delta#phi', path='EXPERT',xbins=80, xmin=-0.01, xmax=0.01), defineHistogram('EleT', type='TH1F', title='p#_{T} [GeV]', path='EXPERT',xbins=80, xmin=0., xmax=100)] mlog = logging.getLogger("TrigElectronFactories") mlog.info('Starting configuration') TrigTopoEgammaElectron = AlgFactory( egammaAlgsConf.topoEgammaBuilder, name = name, SuperElectronRecCollectionName = TrigEgammaKeys.SuperElectronRecCollectionName, SuperPhotonRecCollectionName = TrigEgammaKeys.SuperPhotonRecCollectionName, ElectronOutputName = TrigEgammaKeys.outputElectronKey, PhotonOutputName = TrigEgammaKeys.outputPhotonKey, AmbiguityTool = EGammaAmbiguityTool, EMClusterTool = TrigEMClusterTool, EMShowerTool=TrigEMShowerBuilder, egammaTools = FcnWrapper(TrigEgammaDecorationTools), doAdd = False, doPhotons = False, doElectrons = True, #MonTool = monTool ) return TrigTopoEgammaElectron()
def _IncTool(name, cand, threshold, sel): from TrigMultiVarHypo.TrigMultiVarHypoConf import TrigL2CaloRingerHypoToolMT tool = TrigL2CaloRingerHypoToolMT(name) tool.AcceptAll = False tool.MonTool = "" tool.EtCut = (float(threshold) - 3.) * GeV # monitoring part from TriggerJobOpts.TriggerFlags import TriggerFlags if (('Validation' in TriggerFlags.enableMonitoring()) or ('Online' in TriggerFlags.enableMonitoring()) or (athenaCommonFlags.isOnline)): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram monTool = GenericMonitoringTool('MonTool' + name) monTool.Histograms = [ defineHistogram("TIME_total", path='EXPERT', title="Total Time;time[ms]", xbins=50, xmin=0, xmax=5, type='TH1F'), defineHistogram("TIME_preproc", path='EXPERT', title="Total Time;time[ms]", xbins=50, xmin=0, xmax=5, type='TH1F'), defineHistogram("TIME_propagate", path='EXPERT', title="Total Time;time[ms]", xbins=50, xmin=0, xmax=5, type='TH1F'), defineHistogram('Eta', type='TH1F', path='EXPERT', title="#eta of Clusters; #eta; number of RoIs", xbins=50, xmin=-2.5, xmax=2.5), defineHistogram('Phi', type='TH1F', path='EXPERT', title="#phi of Clusters; #phi; number of RoIs", xbins=64, xmin=-3.2, xmax=3.2), defineHistogram( 'Et', type='TH1F', path='EXPERT', title="E_{T} of Clusters; E_{T} [MeV]; number of RoIs", xbins=60, xmin=0, xmax=5e4), defineHistogram( 'RnnOut', type='TH1F', path='EXPERT', title="Neural Network output; NN output; number of RoIs", xbins=100, xmin=-10, xmax=10), ] monTool.HistPath = 'L2CaloHypo_Ringer/' + monTool.name() tool.MonTool = monTool if sel == 'nocut': tool.AcceptAll = True elif sel == "etcut": tool.EtCut = (float(threshold) - 3.) * GeV elif sel in _possibleSel.keys(): # real selection pconstants, pthresholds = _GetPath(cand, sel) tool.ConstantsCalibPath = pconstants tool.ThresholdsCalibPath = pthresholds return tool
def _IncTool(name, threshold, sel): log.debug('TrigEgammaPrecisionElectronHypoTool _IncTool("' + name + '", threshold = ' + str(threshold) + ', sel = ' + str(sel)) from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoToolInc tool = TrigEgammaPrecisionElectronHypoToolInc(name) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram monTool = GenericMonitoringTool("MonTool_" + name) monTool.Histograms = [ defineHistogram( 'dEta', type='TH1F', path='EXPERT', title= "PrecisionElectron Hypo #Delta#eta_{EF L1}; #Delta#eta_{EF L1}", xbins=80, xmin=-0.01, xmax=0.01), defineHistogram( 'dPhi', type='TH1F', path='EXPERT', title= "PrecisionElectron Hypo #Delta#phi_{EF L1}; #Delta#phi_{EF L1}", xbins=80, xmin=-0.01, xmax=0.01), defineHistogram( 'Et_em', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]", xbins=50, xmin=-2000, xmax=100000), defineHistogram('Eta', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo entries per Eta;Eta", xbins=100, xmin=-2.5, xmax=2.5), defineHistogram('Phi', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo entries per Phi;Phi", xbins=128, xmin=-3.2, xmax=3.2), defineHistogram( 'EtaBin', type='TH1I', path='EXPERT', title="PrecisionElectron Hypo entries per Eta bin;Eta bin no.", xbins=11, xmin=-0.5, xmax=10.5), defineHistogram('LikelihoodRatio', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo LH", xbins=100, xmin=-5, xmax=5), defineHistogram('mu', type='TH1F', path='EXPERT', title="Average interaction per crossing", xbins=100, xmin=0, xmax=100) ] cuts = [ 'Input', '#Delta #eta EF-L1', '#Delta #phi EF-L1', 'eta', 'E_{T}^{EM}' ] monTool.Histograms += [ defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="PrecisionElectron Hypo Passed Cuts;Cut", xbins=13, xmin=-1.5, xmax=12.5, opt="kCumulative", xlabels=cuts) ] monTool.HistPath = 'PrecisionElectronHypo/' + tool.name() tool.MonTool = monTool tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] def same(val): return [val] * (len(tool.EtaBins) - 1) tool.ETthr = same(float(threshold)) tool.dETACLUSTERthr = 0.1 tool.dPHICLUSTERthr = 0.1 tool.ElectronLHSelector = TrigElectronSelectors(sel) #tool.ET2thr = same( 90.0*GeV ) if sel == 'nocut': tool.AcceptAll = True tool.ETthr = same(float(threshold) * GeV) tool.dETACLUSTERthr = 9999. tool.dPHICLUSTERthr = 9999. elif sel == "etcut": tool.ETthr = same((float(threshold) - 3) * GeV) # No other cuts applied tool.dETACLUSTERthr = 9999. tool.dPHICLUSTERthr = 9999. return tool
def __init__(self, name="TrigMissingETHypoMonitoringToolBase"): super(TrigMissingETHypoMonitoringToolBase, self).__init__(name) self.Histograms = [] self.hEx_log = defineHistogram( 'Hypo_MEx_log', type='TH1F', path='EXPERT', title="Missing E_{x};sgn(ME_{x}) log_{10}(ME_{x}/GeV)", xbins=41, xmin=-5.075, xmax=5.075) self.hEy_log = defineHistogram( 'Hypo_MEy_log', type='TH1F', path='EXPERT', title="Missing E_{y};sgn(ME_{y}) log_{10}(ME_{y}/GeV)", xbins=41, xmin=-5.075, xmax=5.075) self.hEz_log = defineHistogram( 'Hypo_MEz_log', type='TH1F', path='EXPERT', title="Missing E_{z};sgn(ME_{z}) log_{10}(ME_{z}/GeV)", xbins=41, xmin=-5.075, xmax=5.075) self.hMET_log = defineHistogram( 'Hypo_MET_log', type='TH1F', path='EXPERT', title="|Missing E_{T}|;log_{10}(ME_{T}/GeV)", xbins=35, xmin=-1.875, xmax=5.375) self.hSumEt_log = defineHistogram( 'Hypo_SumEt_log', type='TH1F', path='EXPERT', title="Sum |E_{T}|;log_{10}(SumE_{T}/GeV)", xbins=35, xmin=-1.875, xmax=5.125) self.hEx_lin = defineHistogram('Hypo_MEx_lin', type='TH1F', path='EXPERT', title="Missing E_{x};ME_{x} (GeV)", xbins=199, xmin=-298.5, xmax=298.5) self.hEy_lin = defineHistogram('Hypo_MEy_lin', type='TH1F', path='EXPERT', title="Missing E_{y};ME_{y} (GeV)", xbins=199, xmin=-298.5, xmax=298.5) self.hEz_lin = defineHistogram('Hypo_MEz_lin', type='TH1F', path='EXPERT', title="Missing E_{z};ME_{z} (GeV)", xbins=199, xmin=-298.5, xmax=298.5) self.hMET_lin = defineHistogram('Hypo_MET_lin', type='TH1F', path='EXPERT', title="|Missing E_{T}|;ME_{T} (GeV)", xbins=105, xmin=-13.5, xmax=301.5) self.hSumEt_lin = defineHistogram('Hypo_SumEt_lin', type='TH1F', path='EXPERT', title="Sum |E_{T}|;SumE_{T} (GeV)", xbins=155, xmin=-27., xmax=2000.) self.hMETPhi = defineHistogram('Hypo_MET_phi', type='TH1F', path='EXPERT', title="MET #phi;#phi (rad)", xbins=32, xmin=-3.1416, xmax=3.1416) self.hXS = defineHistogram('Hypo_XS', type='TH1F', path='EXPERT', title="EF Significance; (XS/GeV^{1/2})", xbins=40, xmin=-0.025, xmax=20.025) self.hXS2 = defineHistogram('Hypo_XS2', type='TH1F', path='EXPERT', title="EF Significance 2; (XS2/GeV^{1/2})", xbins=40, xmin=-0.025, xmax=20.025)
def _IncTool(name, threshold, sel): from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionCaloHypoToolInc tool = TrigEgammaPrecisionCaloHypoToolInc(name) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram monTool = GenericMonitoringTool("MonTool_" + name) monTool.Histograms = [ defineHistogram( 'dEta', type='TH1F', path='EXPERT', title="PrecisionCalo Hypo #Delta#eta_{L2 L1}; #Delta#eta_{L2 L1}", xbins=80, xmin=-0.01, xmax=0.01), defineHistogram( 'dPhi', type='TH1F', path='EXPERT', title="PrecisionCalo Hypo #Delta#phi_{L2 L1}; #Delta#phi_{L2 L1}", xbins=80, xmin=-0.01, xmax=0.01), defineHistogram( 'Et_em', type='TH1F', path='EXPERT', title="PrecisionCalo Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]", xbins=50, xmin=-2000, xmax=100000), defineHistogram('Eta', type='TH1F', path='EXPERT', title="PrecisionCalo Hypo entries per Eta;Eta", xbins=100, xmin=-2.5, xmax=2.5), defineHistogram('Phi', type='TH1F', path='EXPERT', title="PrecisionCalo Hypo entries per Phi;Phi", xbins=128, xmin=-3.2, xmax=3.2), defineHistogram( 'EtaBin', type='TH1I', path='EXPERT', title="PrecisionCalo Hypo entries per Eta bin;Eta bin no.", xbins=11, xmin=-0.5, xmax=10.5) ] cuts = [ 'Input', '#Delta #eta L2-L1', '#Delta #phi L2-L1', 'eta', 'E_{T}^{EM}' ] monTool.Histograms += [ defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="PrecisionCalo Hypo Passed Cuts;Cut", xbins=13, xmin=-1.5, xmax=12.5, opt="kCumulative", xlabels=cuts) ] monTool.HistPath = 'PrecisionCaloHypo/' + tool.name() tool.MonTool = monTool tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] def same(val): return [val] * (len(tool.EtaBins) - 1) tool.ETthr = same(float(threshold)) tool.dETACLUSTERthr = 0.1 tool.dPHICLUSTERthr = 0.1 tool.ET2thr = same(90.0 * GeV) if sel == 'nocut': tool.AcceptAll = True tool.ETthr = same(float(threshold) * GeV) tool.dETACLUSTERthr = 9999. tool.dPHICLUSTERthr = 9999. elif sel == "etcut": tool.ETthr = same((float(threshold) - 3) * GeV) # No other cuts applied tool.dETACLUSTERthr = 9999. tool.dPHICLUSTERthr = 9999. etaBinsLen = len(tool.EtaBins) - 1 for prop in "ETthr ET2thr".split(): propLen = len(getattr(tool, prop)) assert propLen == etaBinsLen, "In " + name + " " + prop + " has length " + str( propLen ) + " which is different from EtaBins which has length " + str( etaBinsLen) #assert _l( EtaBins, tool.ETthr, tool.HADETthr, tool.CARCOREthr, tool.CARCOREthr ) , "All list properties should have equal length ( as EtaBins )" #print tool return tool
def test_offlineNamingConvention(self): check = defineHistogram('var', path='EXPERT', convention='OFFLINE:lowStat') true = '{"alias": "var", "allvars": ["var"], "convention": "OFFLINE:lowStat", "merge": "", "path": "EXPERT", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0.0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "Sumw2": false, "kLBNHistoryDepth": 0, "kAddBinsDynamically": false, "kRebinAxes": false, "kCanRebin": false, "kVec": false, "kVecUO": false, "kCumulative": false}' self.assertEqual(json.loads(check), json.loads(true))
def test_badAlias(self): check = defineHistogram('var;alias;more') self.assertFalse(check)
# Setup Views # ---------------------------------------------------------------- from AthenaCommon.AlgSequence import AthSequencer if TriggerFlags.doCalo: if (True): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram from TrigT2CaloCommon.TrigT2CaloCommonConfig import TrigCaloDataAccessSvc #, TestCaloDataAccess import math mon = GenericMonitoringTool("CaloDataAccessSvcMon") mon.Histograms += [ defineHistogram("TIME_locking_LAr_RoI", path="EXPERT", title="Time spent in unlocking the LAr collection", xbins=100, xmin=0, xmax=100), defineHistogram("roiROBs_LAr", path="EXPERT", title="Number of ROBs unpacked in RoI requests", xbins=20, xmin=0, xmax=20), defineHistogram("TIME_locking_LAr_FullDet", path="EXPERT", title="Time spent in unlocking the LAr collection", xbins=100, xmin=0, xmax=100), defineHistogram("roiEta_LAr,roiPhi_LAr",
def _IncTool(name, threshold, sel): log.debug('TrigEgammaPrecisionPhotonHypoTool _IncTool("' + name + '", threshold = ' + str(threshold) + ', sel = ' + str(sel)) from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionPhotonHypoToolInc tool = TrigEgammaPrecisionPhotonHypoToolInc(name) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram monTool = GenericMonitoringTool("MonTool_" + name) monTool.Histograms = [ defineHistogram( 'dEta', type='TH1F', path='EXPERT', title="PrecisionPhoton Hypo #Delta#eta_{EF L1}; #Delta#eta_{EF L1}", xbins=80, xmin=-0.01, xmax=0.01), defineHistogram( 'dPhi', type='TH1F', path='EXPERT', title="PrecisionPhoton Hypo #Delta#phi_{EF L1}; #Delta#phi_{EF L1}", xbins=80, xmin=-0.01, xmax=0.01), defineHistogram( 'Et_em', type='TH1F', path='EXPERT', title="PrecisionPhoton Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]", xbins=50, xmin=-2000, xmax=100000), defineHistogram('Eta', type='TH1F', path='EXPERT', title="PrecisionPhoton Hypo entries per Eta;Eta", xbins=100, xmin=-2.5, xmax=2.5), defineHistogram('Phi', type='TH1F', path='EXPERT', title="PrecisionPhoton Hypo entries per Phi;Phi", xbins=128, xmin=-3.2, xmax=3.2), defineHistogram( 'EtaBin', type='TH1I', path='EXPERT', title="PrecisionPhoton Hypo entries per Eta bin;Eta bin no.", xbins=11, xmin=-0.5, xmax=10.5) ] cuts = [ 'Input', '#Delta #eta EF-L1', '#Delta #phi EF-L1', 'eta', 'E_{T}^{EM}' ] monTool.Histograms += [ defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="PrecisionPhoton Hypo Passed Cuts;Cut", xbins=13, xmin=-1.5, xmax=12.5, opt="kCumulative", xlabels=cuts) ] monTool.HistPath = 'PrecisionPhotonHypo/' + tool.name() tool.MonTool = monTool tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] def same(val): return [val] * (len(tool.EtaBins) - 1) tool.ETthr = same(float(threshold)) tool.dETACLUSTERthr = 0.1 tool.dPHICLUSTERthr = 0.1 # configure the selector tool corresponding the selection set by sel tool.PhotonIsEMSelector = TrigPhotonSelectors(sel) return tool
def test_1D_array(self): check = defineHistogram('var', xbins=[0, 1, 2, 4, 8]) true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [0, 1, 2, 4, 8], "xbins": 4, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0.0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "Sumw2": false, "kLBNHistoryDepth": 0, "kAddBinsDynamically": false, "kRebinAxes": false, "kCanRebin": false, "kVec": false, "kVecUO": false, "kCumulative": false}' self.assertEqual(json.loads(check), json.loads(true))
def _IncTool(name, cand, threshold, sel): possibleSel = L2CaloCutMaps( threshold ).MapsHADETthr.keys() from AthenaConfiguration.ComponentFactory import CompFactory tool = CompFactory.TrigEgammaFastCaloHypoToolInc( name ) tool.AcceptAll = False tool.UseRinger = False if 'Validation' in TriggerFlags.enableMonitoring() or 'Online' in TriggerFlags.enableMonitoring(): monTool = GenericMonitoringTool("MonTool_"+name) monTool.defineHistogram('dEta', type='TH1F', path='EXPERT', title="L2Calo Hypo #Delta#eta_{L2 L1}; #Delta#eta_{L2 L1}", xbins=80, xmin=-0.01, xmax=0.01) monTool.defineHistogram('dPhi', type='TH1F', path='EXPERT', title="L2Calo Hypo #Delta#phi_{L2 L1}; #Delta#phi_{L2 L1}", xbins=80, xmin=-0.01, xmax=0.01) monTool.defineHistogram('Et_em', type='TH1F', path='EXPERT', title="L2Calo Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]", xbins=50, xmin=-2000, xmax=100000) monTool.defineHistogram('Eta', type='TH1F', path='EXPERT', title="L2Calo Hypo entries per Eta;Eta", xbins=100, xmin=-2.5, xmax=2.5) monTool.defineHistogram('Phi', type='TH1F', path='EXPERT', title="L2Calo Hypo entries per Phi;Phi", xbins=128, xmin=-3.2, xmax=3.2) cuts=['Input','has one TrigEMCluster', '#Delta #eta L2-L1', '#Delta #phi L2-L1','eta','rCore', 'eRatio','E_{T}^{EM}', 'E_{T}^{Had}','f_{1}','Weta2','Wstot','F3'] monTool.defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="L2Calo Hypo Passed Cuts;Cut", xbins=13, xmin=-1.5, xmax=12.5, opt="kCumulative", xlabels=cuts) if 'Validation' in TriggerFlags.enableMonitoring(): monTool.defineHistogram('Et_had', type='TH1F', path='EXPERT', title="L2Calo Hypo E_{T}^{had} in first layer;E_{T}^{had} [MeV]", xbins=50, xmin=-2000, xmax=100000) monTool.defineHistogram('Rcore', type='TH1F', path='EXPERT', title="L2Calo Hypo R_{core};E^{3x3}/E^{3x7} in sampling 2", xbins=48, xmin=-0.1, xmax=1.1) monTool.defineHistogram('Eratio', type='TH1F', path='EXPERT', title="L2Calo Hypo E_{ratio};E^{max1}-E^{max2}/E^{max1}+E^{max2} in sampling 1 (excl.crack)", xbins=64, xmin=-0.1, xmax=1.5) monTool.defineHistogram('EtaBin', type='TH1I', path='EXPERT', title="L2Calo Hypo entries per Eta bin;Eta bin no.", xbins=11, xmin=-0.5, xmax=10.5) monTool.defineHistogram('F1', type='TH1F', path='EXPERT', title="L2Calo Hypo f_{1};f_{1}", xbins=34, xmin=-0.5, xmax=1.2) monTool.defineHistogram('Weta2', type='TH1F', path='EXPERT', title="L2Calo Hypo Weta2; E Width in sampling 2", xbins=96, xmin=-0.1, xmax=0.61) monTool.defineHistogram('Wstot', type='TH1F', path='EXPERT', title="L2Calo Hypo Wstot; E Width in sampling 1", xbins=48, xmin=-0.1, xmax=11.) monTool.defineHistogram('F3', type='TH1F', path='EXPERT', title="L2Calo Hypo F3; E3/(E0+E1+E2+E3)", xbins=96, xmin=-0.1, xmax=1.1) monTool.HistPath = 'L2CaloHypo/'+tool.getName() tool.MonTool = monTool tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] def same( val ): return [val]*( len( tool.EtaBins ) - 1 ) tool.ETthr = same( float(threshold) ) tool.dETACLUSTERthr = 0.1 tool.dPHICLUSTERthr = 0.1 tool.F1thr = same( 0.005 ) tool.ET2thr = same( 90.0*GeV ) tool.HADET2thr = same( 999.0 ) tool.HADETthr = same( 0.058 ) tool.WETA2thr = same( 99999. ) tool.WSTOTthr = same( 99999. ) tool.F3thr = same( 99999. ) tool.CARCOREthr = same( -9999. ) tool.CAERATIOthr = same( -9999. ) if sel == 'nocut' or 'idperf' in name: tool.AcceptAll = True tool.UseRinger = False tool.ETthr = same( float( threshold )*GeV ) tool.dETACLUSTERthr = 9999. tool.dPHICLUSTERthr = 9999. tool.F1thr = same( 0.0 ) tool.HADETthr = same( 9999. ) tool.CARCOREthr = same( -9999. ) tool.CAERATIOthr = same( -9999. ) elif sel == "etcut": # stcut is part of the name, it can as well be etcut1step (test chains) tool.UseRinger = False tool.ETthr = same( ( float( threshold ) - 3 )*GeV ) # No other cuts applied tool.dETACLUSTERthr = 9999. tool.dPHICLUSTERthr = 9999. tool.F1thr = same( 0.0 ) tool.HADETthr = same( 9999. ) tool.CARCOREthr = same( -9999. ) tool.CAERATIOthr = same( -9999. ) elif sel in possibleSel and "noringer" in name: # real selection tool.UseRinger = False tool.ETthr = same( ( float( threshold ) - 3 )*GeV ) tool.HADETthr = L2CaloCutMaps( threshold ).MapsHADETthr[sel] tool.CARCOREthr = L2CaloCutMaps( threshold ).MapsCARCOREthr[sel] tool.CAERATIOthr = L2CaloCutMaps( threshold ).MapsCAERATIOthr[sel] elif sel in possibleSel and cand=="g": # real selection tool.UseRinger = False tool.ETthr = same( ( float( threshold ) - 3 )*GeV ) tool.HADETthr = L2CaloCutMaps( threshold ).MapsHADETthr[sel] tool.CARCOREthr = L2CaloCutMaps( threshold ).MapsCARCOREthr[sel] tool.CAERATIOthr = L2CaloCutMaps( threshold ).MapsCAERATIOthr[sel] elif sel in _possibleSel.keys() and not "noringer" in name and cand=="e": tool.UseRinger = True pconstants, pthresholds = _GetPath( cand, sel ) tool.ConstantsCalibPath = pconstants tool.ThresholdsCalibPath = pthresholds tool.MonTool = "" tool.EtCut = (float(threshold)-3.)*GeV # monitoring part if (('Validation' in TriggerFlags.enableMonitoring()) or ('Online' in TriggerFlags.enableMonitoring()) or (athenaCommonFlags.isOnline)): monTool = GenericMonitoringTool('MonTool'+name) monTool.Histograms = [ defineHistogram( "TIME_total", path='EXPERT',title="Total Time;time[ms]",xbins=50, xmin=0,xmax=5,type='TH1F'), defineHistogram( "TIME_preproc", path='EXPERT',title="Total Time;time[ms]",xbins=50, xmin=0,xmax=5,type='TH1F'), defineHistogram( "TIME_propagate",path='EXPERT', title="Total Time;time[ms]",xbins=50, xmin=0,xmax=5,type='TH1F'), defineHistogram('Eta', type='TH1F', path='EXPERT',title="#eta of Clusters; #eta; number of RoIs", xbins=50,xmin=-2.5,xmax=2.5), defineHistogram('Phi',type='TH1F', path='EXPERT',title="#phi of Clusters; #phi; number of RoIs", xbins=64,xmin=-3.2,xmax=3.2), defineHistogram('Et',type='TH1F', path='EXPERT',title="E_{T} of Clusters; E_{T} [MeV]; number of RoIs", xbins=60,xmin=0,xmax=5e4), defineHistogram('RnnOut',type='TH1F', path='EXPERT',title="Neural Network output; NN output; number of RoIs", xbins=100,xmin=-10,xmax=10), ] monTool.HistPath='L2CaloHypo_Ringer/'+monTool.name() tool.MonTool=monTool etaBinsLen = len( tool.EtaBins ) - 1 for prop in "ETthr HADETthr CARCOREthr CARCOREthr F1thr F3thr WSTOTthr WETA2thr HADETthr HADETthr ET2thr".split(): propLen = len( getattr( tool, prop ) ) assert propLen == etaBinsLen , "In " + name + " " + prop + " has length " + str( propLen ) + " which is different from EtaBins which has length " + str( etaBinsLen ) return tool
def __init__(self, name): super(TrigMultiTrkComboHypoMonitoring, self).__init__(name) if 'L2' in name: self.Histograms = [ defineHistogram('nTrk', type='TH1F', path='EXPERT', title="number of tracks in input views", xbins=100, xmin=0, xmax=100), defineHistogram('nAcceptedTrk', type='TH1F', path='EXPERT', title="number of selected input tracks", xbins=100, xmin=0, xmax=100), defineHistogram('acceptance', type='TH1F', path='EXPERT', title="filter acceptance", xbins=2, xmin=0, xmax=2), defineHistogram('TIME_all', type='TH1F', path='EXPERT', title='execution time; [microseconds]', xbins=100, xmin=0, xmax=1000), ] elif 'EF' in name: self.Histograms = [ defineHistogram('nTrk', type='TH1F', path='EXPERT', title="number of tracks in input views", xbins=100, xmin=0, xmax=100), defineHistogram('nAcceptedTrk', type='TH1F', path='EXPERT', title="number of selected input tracks", xbins=100, xmin=0, xmax=100), defineHistogram( 'nCombination', type='TH1F', path='EXPERT', title= "number of track combinations before mass preselection", xbins=100, xmin=0, xmax=100), defineHistogram('nCombinationBeforeFit', type='TH1F', path='EXPERT', title="number of inputs to the vertex fitter", xbins=100, xmin=0, xmax=100), defineHistogram('nBPhysObject', type='TH1F', path='EXPERT', title="number of fitted BPhysObjects", xbins=100, xmin=0, xmax=100), defineHistogram( 'trkMassBeforeFit', type='TH1F', path='EXPERT', title="mass of track combinations BEFORE fit [GeV]", xbins=200, xmin=0, xmax=100), defineHistogram( 'bphysChi2', type='TH1F', path='EXPERT', title="chi2 fit of N tracks; fit chi2 of N selected tracks", xbins=100, xmin=0, xmax=100), defineHistogram( 'bphysFitMass', type='TH1F', path='EXPERT', title= "fit mass of N tracks; fit mass of N selected tracks [GeV]", xbins=100, xmin=0, xmax=20), defineHistogram( 'bphysMass', type='TH1F', path='EXPERT', title="mass of N tracks; mass of N selected tracks [GeV]", xbins=100, xmin=0, xmax=20), defineHistogram('bphysCharge', type='TH1F', path='EXPERT', title="total charge of N tracks", xbins=20, xmin=-10, xmax=10), defineHistogram('TIME_all', type='TH1F', path='EXPERT', title='execution time; [microseconds]', xbins=100, xmin=0, xmax=1000), ]
def test_enforcePath(self): from AthenaCommon.AthenaCommonFlags import athenaCommonFlags athenaCommonFlags.isOnline = True with self.assertRaises(AssertionError): defineHistogram('var', 'TH1F') athenaCommonFlags.isOnline = False