3 from AthenaConfiguration.ComponentFactory
import CompFactory
4 from AthenaMonitoring.DQConfigFlags
import DQDataType
20 do_tag_and_probe =
True
26 do_total_efficiency =
False
28 require_offline_taus =
True
31 do_duplicate_var_plots_without_offline_taus =
True
38 'DeepSet': (
'RNNJetScore',
'RNNJetScoreSigTrans'),
41 'RNNLLP': (
'RNNJetScore',
'RNNJetScoreSigTrans'),
44 'RNNLLP': (
'RNNJetScore',
'RNNJetScoreSigTrans'),
47 'tracktwoMVABDT': {
'RNN': (
'RNNJetScore',
'RNNJetScoreSigTrans') },
50 offline_tauid_scores = {
51 'RNN': (
'RNNJetScore',
'RNNJetScoreSigTrans'),
57 do_alternative_eTAU_monitoring =
False
60 from AthenaCommon.Logging
import logging
61 self.
logger = logging.getLogger(
'TrigTauMonAlgBuilder')
105 self.
logger.
debug(
'Using default monitoring configuration for collisions')
107 if self.
helper.flags.DQ.Environment ==
"tier0":
118 self.
logger.
info(
'Creating the Tau monitoring algorithms...')
135 @functools.cached_property
138 m = ROOT.std.map[ROOT.std.string, ROOT.float]()
143 @functools.cached_property
146 m = ROOT.std.map[ROOT.std.string, ROOT.uint64_t]()
151 @functools.lru_cache(maxsize=1000)
153 from TrigTauMonitoring.TrigTauInfo
import TrigTauInfo
163 from TrigConfigSvc.TriggerConfigAccess
import getL1MenuAccess, getHLTMenuAccess, getHLTMonitoringAccess
170 all_items = HLT_monitoring.monitoredChains(signatures=
'tauMon', monLevels=[
'shifter',
't0',
'val'])
173 from TrigTauMonitoring.ManualChains
import monitored_chains
174 self.
logger.
info(
'Could not find any monitored tau chains in the HLTMonitoring information. Will use the available items from the fallback trigger list')
175 all_items = monitored_chains
178 for trigger
in all_items:
181 if trigger
not in HLT_menu:
continue
192 if len(info.getL1TauItems()):
193 for l1_tau_item
in map(str, info.getL1TauItems()):
194 is_phase_1 =
'eTAU' in l1_tau_item
or 'jTAU' in l1_tau_item
or 'cTAU' in l1_tau_item
206 self.
logger.
info(f
'Configuring HLT single-tau monitored chains: {self.HLT_single_items}')
208 self.
logger.warning(
'Empty trigger list, disabling the single-tau monitoring')
213 self.
logger.
info(f
'Configuring HLT di-tau monitored chains: {self.HLT_ditau_items}')
215 self.
logger.warning(
'Empty trigger list, disabling the di-tau monitoring')
220 self.
logger.
info(f
'Configuring HLT Tag and Probe tau monitored chains: {self.HLT_tag_and_probe_items}')
222 self.
logger.warning(
'Empty trigger list, disabling the tag and probe monitoring')
228 self.
logger.
info(f
'Configuring HLT truth tau monitored chains: {self.HLT_truth_items}')
230 self.
logger.warning(
'Empty trigger list, disabling the truth tau monitoring')
235 self.
logger.
info(f
'Configuring L1 tau monitored items: {self.L1_items}')
237 self.
logger.warning(
'Empty trigger list, disabling the L1 tau monitoring')
242 self.
logger.
info(f
'Creating the monitoring algorithm: {name}')
243 mon_alg = self.
helper.addAlgorithm(algorithm_factory, name)
257 self.
logger.
info(
' |- Booking all histograms')
260 for p
in (
'1P',
'3P'):
264 for p
in (
'0P',
'1P',
'MP'):
272 for p
in (
'1P',
'3P'):
287 self.
logger.
info(
' |- Booking all histograms')
288 path = f
'{self.base_path}/OnlineOnlyVars'
290 for p
in (
'0P',
'1P',
'MP'):
304 self.
logger.
info(
' |- Booking all histograms')
315 self.
logger.
info(
' |- Booking all histograms')
325 self.
logger.
info(
' |- Booking all histograms')
327 for p
in (
'1P',
'3P'):
333 has_xtob_etau_rois =
'L1_eTauxRoI' in self.
helper.flags.Input.Collections
or self.
helper.flags.DQ.Environment ==
"tier0"
338 if not has_xtob_etau_rois:
339 self.
logger.
info(
' |- No L1_eTauxRoI container is available: e/cTAU BDT scores will be set to 0')
342 self.
logger.
info(
' |- Booking all histograms')
344 for p
in (
'1P',
'3P'):
353 if not has_xtob_etau_rois:
354 self.
logger.
info(
' |- No L1_eTauxRoI container is available: e/cTAU BDT scores will be set to 0')
357 self.
logger.
info(
' |- Booking all histograms')
358 path = f
'{self.base_path}/OnlineOnlyVars'
369 l1_items = [item
for item
in self.
L1_items if 'eTAU' in item
and not self.
getTriggerInfo(item).isL1TauIsolated()]
372 self.
logger.
info(
' |- Booking all histograms')
373 path = f
'{self.base_path}/L1eTAUAlt'
374 for trigger
in l1_items:
375 for p
in (
'1P',
'3P'):
381 mon_group_name = f
'{trigger}_HLT_Efficiency_{n_prong}'
382 mon_group_path = f
'{base_path}/HLT_Efficiency/{trigger}/HLT_Efficiency_{n_prong}'
383 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
385 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax, eff='HLT', high_pt=False, coarse=False):
386 pass_flag = f
'{eff}_pass'
390 pass_flag +=
'_highPt'
392 xlabel +=
' (p_{T} > p_{T}^{thr} + 20 GeV)'
393 elif coarse: sfx =
'_coarse'
395 mon_group.defineHistogram(f
'{pass_flag},{xvariable};Eff{eff}_{xvariable}{sfx}_wrt_Offline',
396 title=f
'{eff} Efficiency {trigger} {n_prong}; {xlabel}; Efficiency',
397 type=
'TEfficiency', xbins=xbins, xmin=xmin, xmax=xmax, opt=
'kAlwaysCreate')
403 defineEachStepHistograms(
'tauPt',
'p_{T} [GeV]', 60, 0.0, 300., eff)
404 defineEachStepHistograms(
'tauPt',
'p_{T} [GeV]', coarse_binning, coarse_binning[0], coarse_binning[-1], eff, coarse=
True)
405 defineEachStepHistograms(
'tauEta',
'#eta', 13, -2.6, 2.6, eff)
406 defineEachStepHistograms(
'tauPhi',
'#phi', 16, -3.2, 3.2, eff)
407 defineEachStepHistograms(
'tauEta',
'#eta', 13, -2.6, 2.6, eff, high_pt=
True)
408 defineEachStepHistograms(
'tauPhi',
'#phi', 16, -3.2, 3.2, eff, high_pt=
True)
409 defineEachStepHistograms(
'averageMu',
'#LT#mu#GT', 10, 0, 80, eff)
412 mon_group.defineTree(
'tauPt,tauEta,tauPhi,averageMu,HLT_pass;HLTEffTree',
413 treedef=
'tauPt/F:tauEta/F:tauPhi/F:averageMu/F:HLT_pass/I')
417 type_str =
'HLT' if online
else 'Offline'
418 mon_group_name = f
'{trigger}_ID_{type_str}_InputScalar_{n_prong}'
419 mon_group_path = f
'{base_path}/TauIDVars/InputScalar_{n_prong}/{trigger}/{type_str}'
420 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
422 mon_group.defineHistogram(
'centFrac', title=f
'Centrality Fraction ({n_prong}); centFrac; Events', xbins=50, xmin=-0.05, xmax=1.2, opt=
'kAlwaysCreate')
423 mon_group.defineHistogram(
'etOverPtLeadTrk', title=f
'etOverPtLeadTrk log ({n_prong}); etOverPtLeadTrk_log; Events', xbins=60, xmin=-3, xmax=3, opt=
'kAlwaysCreate')
424 mon_group.defineHistogram(
'dRmax', title=f
'max dR of associated tracks ({n_prong}); dRmax; Events', xbins=50, xmin=-0.1, xmax=0.3, opt=
'kAlwaysCreate')
425 mon_group.defineHistogram(
'absipSigLeadTrk', title=f
'AbsIpSigLeadTrk ({n_prong}); absipSigLeadTrk; Events', xbins=25, xmin=0.0, xmax=20.0, opt=
'kAlwaysCreate')
426 mon_group.defineHistogram(
'sumPtTrkFrac', title=f
'SumPtTrkFrac ({n_prong}); SumPtTrkFrac; Events', xbins=50, xmin=-0.5, xmax=1.1, opt=
'kAlwaysCreate')
427 mon_group.defineHistogram(
'emPOverTrkSysP', title=f
'EMPOverTrkSysP log ({n_prong}); EMPOverTrkSysP_log; Events', xbins=50, xmin=-5, xmax=3, opt=
'kAlwaysCreate')
428 mon_group.defineHistogram(
'ptRatioEflowApprox', title=f
'ptRatioEflowApprox ({n_prong}); ptRatioEflowApprox; Events', xbins=50, xmin=0.0, xmax=2.0, opt=
'kAlwaysCreate')
429 mon_group.defineHistogram(
'mEflowApprox', title=f
'mEflowApprox log ({n_prong}); mEflowApprox_log; Events', xbins=50, xmin=0, xmax=5, opt=
'kAlwaysCreate')
430 mon_group.defineHistogram(
'ptDetectorAxis', title=f
'ptDetectorAxis log ({n_prong}); ptDetectorAxis_log; Events', xbins=50, xmin=0, xmax=5, opt=
'kAlwaysCreate')
431 if n_prong ==
'MP' or n_prong ==
'3P':
432 mon_group.defineHistogram(
'massTrkSys', title=f
'massTrkSys log ({n_prong}); massTrkSys_log; Events', xbins=50, xmin=0, xmax=3, opt=
'kAlwaysCreate')
433 mon_group.defineHistogram(
'trFlightPathSig', title=f
'trFlightPathSig ({n_prong}); trFlightPathSig; Events', xbins=100, xmin=-20, xmax=40, opt=
'kAlwaysCreate')
437 type_str =
'HLT' if online
else 'Offline'
438 mon_group_name = f
'{trigger}_ID_{type_str}_InputTrack'
439 mon_group_path = f
'{base_path}/TauIDVars/InputTrack/{trigger}/{type_str}'
440 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
442 mon_group.defineHistogram(
'n_track', title=
'Number of tracks; N_{track}; Events', xbins=15, xmin=0, xmax=15, opt=
'kAlwaysCreate')
443 mon_group.defineHistogram(
'track_pt_log', title=
'track_pt_log; track_pt_log; Events', xbins=20, xmin=2, xmax=7, opt=
'kAlwaysCreate')
444 mon_group.defineHistogram(
'track_pt_jetseed_log', title=
'track_pt_jetseed_log; track_pt_jetseed_log; Events', xbins=50, xmin=2, xmax=7, opt=
'kAlwaysCreate')
445 mon_group.defineHistogram(
'track_eta', title=
'Track #eta; #eta; Events', xbins=26, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
446 mon_group.defineHistogram(
'track_phi', title=
'Track #phi; #phi; Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
447 mon_group.defineHistogram(
'track_dEta', title=
'Track #Delta#eta; #Delta#eta; Events', xbins=100, xmin=-0.5, xmax=0.5, opt=
'kAlwaysCreate')
448 mon_group.defineHistogram(
'track_dPhi', title=
'Track #Delta#phi; #Delta#phi; Events', xbins=100, xmin=-0.5, xmax=0.5, opt=
'kAlwaysCreate')
449 mon_group.defineHistogram(
'track_d0_abs_log', title=
'track_d0_abs_log; track_d0_abs_log; Events', xbins=50, xmin=-7, xmax=2, opt=
'kAlwaysCreate')
450 mon_group.defineHistogram(
'track_z0sinthetaTJVA_abs_log', title=
'track_z0sinthetaTJVA_abs_log; track_z0sinthetaTJVA_abs_log; Events', xbins=50, xmin=-10, xmax=4, opt=
'kAlwaysCreate')
451 mon_group.defineHistogram(
'track_nIBLHitsAndExp', title=
'track_nIBLHitsAndExp; track_nIBLHitsAndExp; Events', xbins=3, xmin=0, xmax=3, opt=
'kAlwaysCreate')
452 mon_group.defineHistogram(
'track_nPixelHitsPlusDeadSensors', title=
'track_nPixelHitsPlusDeadSensors; track_nPixelHitsPlusDeadSensors; Events', xbins=11, xmin=0, xmax=11, opt=
'kAlwaysCreate')
453 mon_group.defineHistogram(
'track_nSCTHitsPlusDeadSensors', title=
'track_nSCTHitsPlusDeadSensors; track_nSCTHitsPlusDeadSensors; Events', xbins=20, xmin=0, xmax=20, opt=
'kAlwaysCreate')
454 mon_group.defineHistogram(
'track_eta,track_phi', type=
'TH2F', title=
'Track #eta vs #phi; #eta; #phi', xbins=26, xmin=-2.6, xmax=2.6, ybins=16, ymin=-3.2, ymax=3.2, opt=
'kAlwaysCreate')
455 mon_group.defineHistogram(
'track_dEta,track_dPhi', type=
'TH2F', title=
'Track #Delta#eta vs #Delta#phi; #Delta#eta; #Delta#phi', xbins=100, xmin=-0.5, xmax=0.5, ybins=100, ymin=-0.5, ymax=0.5, opt=
'kAlwaysCreate')
459 type_str =
'HLT' if online
else 'Offline'
460 mon_group_name = f
'{trigger}_ID_{type_str}_InputCluster'
461 mon_group_path = f
'{base_path}/TauIDVars/InputCluster/{trigger}/{type_str}'
462 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
464 mon_group.defineHistogram(
'n_cluster', title=
'Number of clusters; N_{cluster}; Events', xbins=30, xmin=0, xmax=30, opt=
'kAlwaysCreate')
465 mon_group.defineHistogram(
'cluster_et_log', title=
'cluster_et_log; cluster_et_log; Events', xbins=30, xmin=0, xmax=6, opt=
'kAlwaysCreate')
466 mon_group.defineHistogram(
'cluster_pt_jetseed_log', title=
'cluster_pt_jetseed_log; cluster_pt_jetseed_log; Events', xbins=50, xmin=2, xmax=7, opt=
'kAlwaysCreate')
467 mon_group.defineHistogram(
'cluster_eta', title=
'Cluster #eta; #eta; Events', xbins=26, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
468 mon_group.defineHistogram(
'cluster_phi', title=
'Cluster #phi; #phi; Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
469 mon_group.defineHistogram(
'cluster_dEta', title=
'Cluster #Delta#eta; #Delta#eta; Events', xbins=100, xmin=-0.5, xmax=0.5, opt=
'kAlwaysCreate')
470 mon_group.defineHistogram(
'cluster_dPhi', title=
'Cluster #Delta#phi; #Delta#phi; Events', xbins=100, xmin=-0.5, xmax=0.5, opt=
'kAlwaysCreate')
471 mon_group.defineHistogram(
'cluster_SECOND_R_log10', title=
'cluster_SECOND_R_log10; cluster_SECOND_R_log10; Events', xbins=50, xmin=-3, xmax=7, opt=
'kAlwaysCreate')
472 mon_group.defineHistogram(
'cluster_SECOND_LAMBDA_log10', title=
'cluster_SECOND_LAMBDA_log10; cluster_SECOND_LAMBDA_log10; Events', xbins=50, xmin=-3, xmax=7, opt=
'kAlwaysCreate')
473 mon_group.defineHistogram(
'cluster_CENTER_LAMBDA_log10', title=
'cluster_CENTER_LAMBDA_log10; cluster_CENTER_LAMBDA_log10; Events', xbins=50, xmin=-2, xmax=5, opt=
'kAlwaysCreate')
474 mon_group.defineHistogram(
'cluster_eta,cluster_phi', type=
'TH2F', title=
'Cluster #eta vs #phi; #eta; #phi', xbins=26, xmin=-2.6, xmax=2.6, ybins=16, ymin=-3.2, ymax=3.2, opt=
'kAlwaysCreate')
475 mon_group.defineHistogram(
'cluster_dEta,cluster_dPhi', type=
'TH2F', title=
'Cluster #Delta#eta vs #Delta#phi; #Delta#eta; #Delta#phi', xbins=100, xmin=-0.5, xmax=0.5, ybins=100, ymin=-0.5, ymax=0.5, opt=
'kAlwaysCreate')
480 store_all = info.getHLTTauID()
in [
'idperf',
'perf']
487 if tau_id == info.getHLTTauID()
or store_all
492 type_str =
'HLT' if online
else 'Offline'
493 mon_group_name = f
'{trigger}_{type_str}_IDScores_{n_prong}'
494 mon_group_path = f
'{base_path}/basicVars/{trigger}/{type_str}_{n_prong}'
495 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
497 for tau_id, (score, score_sig_trans)
in variables.items():
498 if tau_id
in [
'RNN',
'DeepSet',
'RNNLLP']: xbins, xmax = 20, 1
499 else: xbins, xmax = 100, 5
501 mon_group.defineHistogram(f
'{tau_id}_TauIDScore', title=f
'{type_str} {tau_id} TauID score; TauID score; Events', xbins=xbins, xmin=0, xmax=xmax, opt=
'kAlwaysCreate')
502 mon_group.defineHistogram(f
'{tau_id}_TauIDScoreSigTrans', title=f
'{type_str} {tau_id} TauID score sig. transformed; TauID score sig. transformed; Events', xbins=xbins, xmin=0, xmax=xmax, opt=
'kAlwaysCreate')
506 type_str =
'HLT' if online
else 'Offline'
507 mon_group_name = f
'{trigger}_{type_str}_basicVars_{n_prong}'
508 mon_group_path = f
'{base_path}/basicVars/{trigger}/{type_str}_{n_prong}'
509 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
513 mon_group.defineHistogram(
'Pt', title=f
'{type_str} p_{{T}}; p_{{T}} [GeV]; Events', xbins=binning, opt=
'kAlwaysCreate')
514 mon_group.defineHistogram(
'Eta', title=f
'{type_str} #eta; #eta; Events', xbins=26, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
515 mon_group.defineHistogram(
'Phi', title=f
'{type_str} #phi; #phi; Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
516 mon_group.defineHistogram(
'nTrack', title=f
'{type_str} Number of tracks; N_{{track}}; Events', xbins=10, xmin=0, xmax=10, opt=
'kAlwaysCreate')
517 mon_group.defineHistogram(
'Eta,Phi', type=
'TH2F', title=f
'{type_str} #eta vs #phi; #eta; #phi', xbins=26, xmin=-2.6, xmax=2.6, ybins=16, ymin=-3.2, ymax=3.2, opt=
'kAlwaysCreate')
518 mon_group.defineHistogram(
'Pt,Phi', type=
'TH2F', title=f
'{type_str} p_{{T}} vs #phi; p_{{T}} [GeV]; #phi', xbins=binning, ybins=16, ymin=-3.2, ymax=3.2, opt=
'kAlwaysCreate')
519 mon_group.defineHistogram(
'Pt,Eta', type=
'TH2F', title=f
'{type_str} p_{{T}} vs #eta; p_{{T}} [GeV]; #eta', xbins=binning, ybins=26, ymin=-2.6, ymax=2.6, opt=
'kAlwaysCreate')
520 mon_group.defineHistogram(
'nIsoTrack', title=f
'{type_str} Number of isolation tracks; N_{{track}}^{{iso}}; Events', xbins=10, xmin=0, xmax=10, opt=
'kAlwaysCreate')
521 mon_group.defineHistogram(
'averageMu', title=f
'{type_str} Average #mu; #LT#mu$GT; Events', xbins=20, xmin=0, xmax=80, opt=
'kAlwaysCreate')
522 mon_group.defineHistogram(
'TauVertexX', title=f
'{type_str} Tau Vertex X; x [mm]; Events', xbins=100, xmin=-1, xmax=1, opt=
'kAlwaysCreate')
523 mon_group.defineHistogram(
'TauVertexY', title=f
'{type_str} Tau Vertex Y; y [mm]; Events', xbins=100, xmin=-2, xmax=0, opt=
'kAlwaysCreate')
524 mon_group.defineHistogram(
'TauVertexZ', title=f
'{type_str} Tau Vertex Z; z [mm]; Events', xbins=120, xmin=-120, xmax=120, opt=
'kAlwaysCreate')
528 mon_group_name = f
'{trigger}_DiTauHLT_Efficiency'
529 mon_group_path = f
'{base_path}/DiTauHLT_Efficiency/{trigger}/DiTauHLT_Efficiency'
530 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
532 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax, eff='HLT', high_pt=False):
533 pass_flag = f
'{eff}_pass'
537 pass_flag +=
'_highPt'
539 xlabel +=
' (p_{T}^{1,2} > p_{T}^{thr 1,2} + 20 GeV)'
541 mon_group.defineHistogram(f
'{pass_flag},{xvariable};EffDiTau{eff}_{xvariable}{sfx}_wrt_Offline',
542 title=f
'DiTau {eff} Efficiency {trigger};{xlabel};Efficiency',
543 type=
'TEfficiency', xbins=xbins, xmin=xmin, xmax=xmax, opt=
'kAlwaysCreate')
547 defineEachStepHistograms(
'dR',
'#Delta R(#tau,#tau)', 20, 0, 4, eff)
548 defineEachStepHistograms(
'dEta',
'#Delta#eta(#tau,#tau)', 20, 0, 4, eff)
549 defineEachStepHistograms(
'dPhi',
'#Delta#phi(#tau,#tau)', 8, -3.2, 3.2, eff)
551 defineEachStepHistograms(
'dR',
'#Delta R(#tau,#tau)', 20, 0, 4, eff, high_pt=
True)
552 defineEachStepHistograms(
'dEta',
'#Delta#eta(#tau,#tau)', 20, 0, 4, eff, high_pt=
True)
553 defineEachStepHistograms(
'dPhi',
'#Delta#phi(#tau,#tau)', 8, -3.2, 3.2, eff, high_pt=
True)
554 defineEachStepHistograms(
'averageMu',
'#LT#mu#GT', 10, 0, 80, eff)
557 mon_group.defineTree(
'dR,dEta,dPhi,averageMu,HLT_pass;DiTauHLTEffTree',
558 treedef=
'dR/F:dEta/F:dPhi/F:averageMu/F:HLT_pass/I')
562 mon_group_name = f
'{trigger}_DiTauVars'
563 mon_group_path = f
'{base_path}/DiTauVars/{trigger}'
564 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
566 mon_group.defineHistogram(
'leadHLTEt,subleadHLTEt', type=
'TH2F', title=
'p_{T}^{lead} vs p_{T}^{sublead}; p_{T}^{lead} [GeV]; p_{T}^{sublead} [GeV]',
567 xbins=50, xmin=0, xmax=250, ybins=50, ymin=0, ymax=250, opt=
'kAlwaysCreate')
568 mon_group.defineHistogram(
'leadHLTEta,subleadHLTEta', type=
'TH2F', title=
'#eta_{lead} vs #eta_{sublead}; #eta_{lead}; #eta_{sublead}',
569 xbins=26, xmin=-2.6, xmax=2.6, ybins=26, ymin=-2.6, ymax=2.6, opt=
'kAlwaysCreate')
570 mon_group.defineHistogram(
'leadHLTPhi,subleadHLTPhi', type=
'TH2F', title=
'#phi_{lead} vs #phi_{sublead}; #phi_{lead}; #phi{sublead}',
571 xbins=16, xmin=-3.2, xmax=3.2, ybins=16, ymin=-3.2, ymax=3.2, opt=
'kAlwaysCreate')
572 mon_group.defineHistogram(
'dR', title=
'#Delta R(#tau,#tau); #Delta R(#tau,#tau); Events', xbins=40, xmin=0, xmax=4, opt=
'kAlwaysCreate')
573 mon_group.defineHistogram(
'dEta', title=
'#Delta#eta(#tau,#tau); #Delta#eta(#tau,#tau); Events', xbins=40, xmin=0, xmax=4, opt=
'kAlwaysCreate')
574 mon_group.defineHistogram(
'dPhi', title=
'#Delta#phi(#tau,#tau); #Delta#phi(#tau,#tau); Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
576 mon_group.defineHistogram(
'Pt', title=
'p_{T}(#tau,#tau); p_{T} [GeV]; Events', xbins=50, xmin=0, xmax=250, opt=
'kAlwaysCreate')
577 mon_group.defineHistogram(
'Eta', title=
'#eta(#tau,#tau); #eta(#tau,#tau); Events', xbins=26, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
578 mon_group.defineHistogram(
'Phi', title=
'#phi(#tau,#tau); #phi(#tau,#tau); Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
579 mon_group.defineHistogram(
'M', title=
'm(#tau,#tau); m_{#tau,#tau}; Events', xbins=50, xmin=0, xmax=250, opt=
'kAlwaysCreate')
580 mon_group.defineHistogram(
'dPt', title=
'#Delta p_{T}(#tau, #tau); p_{T} [GeV]; Events', xbins=20, xmin=0, xmax=200, opt=
'kAlwaysCreate')
582 mon_group.defineTree(
'leadHLTEt,subleadHLTEt,leadHLTEta,subleadHLTEta,leadHLTPhi,subleadHLTPhi,dR,dEta,dPhi,Pt,Eta,Phi,M,dPt;DiTauVarsTree',
583 treedef=
'leadHLTEt/F:subleadHLTEt/F:leadHLTEta/F:subleadHLTEta/F:leadHLTPhi/F:subleadHLTPhi/F:dR/F:dEta/F:dPhi/F:Pt/F:Eta/F:Phi/F:M/F:dPt/F')
587 mon_group_name = f
'{trigger}_TAndPHLT_Efficiency'
588 mon_group_path = f
'{base_path}/TAndPHLT_Efficiency/{trigger}/TAndPHLT_Efficiency'
589 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
591 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax, high_pt=False, coarse=False):
592 pass_flag =
'HLT_pass'
596 pass_flag +=
'_highPt'
598 xlabel +=
' (p_{T}^{#tau} > p_{T}^{#tau thr} + 20 GeV)'
602 mon_group.defineHistogram(f
'{pass_flag},{xvariable};EffTAndPHLT_{xvariable}{sfx}_wrt_Offline',
603 title=f
'TAndP HLT Efficiency {trigger}; {xlabel}; Efficiency',
604 type=
'TEfficiency', xbins=xbins, xmin=xmin, xmax=xmax, opt=
'kAlwaysCreate')
608 defineEachStepHistograms(
'tauPt',
'p_{T}^{#tau} [GeV]', 60, 0.0, 300)
609 defineEachStepHistograms(
'tauPt',
'p_{T}^{#tau} [GeV]', coarse_binning, coarse_binning[0], coarse_binning[-1], coarse=
True)
610 defineEachStepHistograms(
'tauEta',
'#eta_{#tau}', 13, -2.6, 2.6)
611 defineEachStepHistograms(
'tauPhi',
'#phi_{#tau}', 16, -3.2, 3.2)
612 defineEachStepHistograms(
'tauEta',
'#eta_{#tau}', 13, -2.6, 2.6, high_pt=
True)
613 defineEachStepHistograms(
'tauPhi',
'#phi_{#tau}', 16, -3.2, 3.2, high_pt=
True)
614 defineEachStepHistograms(
'dR',
'#Delta R(#tau,lep)', 20, 0, 4)
615 defineEachStepHistograms(
'dEta',
'#Delta#eta(#tau,lep)', 20, 0,4)
616 defineEachStepHistograms(
'dPhi',
'#Delta#phi(#tau,lep)', 8, -3.2, 3.2)
617 defineEachStepHistograms(
'averageMu',
'#LT#mu#GT', 10, 0, 80)
620 mon_group.defineTree(
'tauPt,tauEta,tauPhi,dR,dEta,dPhi,averageMu,HLT_pass;TAndPHLTEffTree',
621 treedef=
'tauPt/F:tauEta/F:tauPhi/F:dR/F:dEta/F:dPhi/F:averageMu/F:HLT_pass/I')
625 mon_group_name = f
'{trigger}_TAndPVars'
626 mon_group_path = f
'{base_path}/TAndPVars/{trigger}'
627 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
629 mon_group.defineHistogram(
'dR', title=
'#Delta R(#tau,lep); #Delta R(#tau,lep); Events', xbins=40, xmin=0, xmax=4, opt=
'kAlwaysCreate')
630 mon_group.defineHistogram(
'dEta', title=
'#Delta#eta(#tau,lep); #Delta#eta(#tau,lep); Events', xbins=40, xmin=0, xmax=4, opt=
'kAlwaysCreate')
631 mon_group.defineHistogram(
'dPhi', title=
'#Delta#phi(#tau,lep); #Delta#phi(#tau,lep); Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
633 mon_group.defineHistogram(
'Pt', title=
'p_{T}(#tau,lep); p_{T} [GeV]; Events', xbins=50, xmin=0, xmax=250, opt=
'kAlwaysCreate')
634 mon_group.defineHistogram(
'Eta', title=
'#eta(#tau,lep); #eta; Events', xbins=26, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
635 mon_group.defineHistogram(
'Phi', title=
'#phi(#tau,lep); #phi; Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
636 mon_group.defineHistogram(
'M', title=
'm(#tau,lep); m_{#tau,lep}; Events', xbins=50, xmin=0, xmax=250, opt=
'kAlwaysCreate')
637 mon_group.defineHistogram(
'dPt', title=
'#Delta p_{T}(#tau,lep); p_{T} [GeV]; Events', xbins=20, xmin=0, xmax=200, opt=
'kAlwaysCreate')
641 mon_group_name = f
'{trigger}_Truth_Efficiency_{n_prong}'
642 mon_group_path = f
'{base_path}/Truth_Efficiency/{trigger}/Truth_Efficiency_{n_prong}'
643 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
647 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax, high_pt=False, coarse=False):
648 pass_flag =
'HLT_pass'
652 pass_flag +=
'_highPt'
654 if info.isHLTDiTau():
655 xlabel +=
' (p_{T}^{#tau} > p_{T}^{#tau min thr} + 20 GeV)'
657 xlabel +=
' (p_{T}^{#tau} > p_{T}^{#tau thr} + 20 GeV)'
661 mon_group.defineHistogram(f
'{pass_flag},{xvariable};EffHLT_{xvariable}{sfx}_wrt_Truth',
662 title=f
'HLT Efficiency {trigger} {n_prong}; {xlabel}; Efficiency',
663 type=
'TEfficiency', xbins=xbins, xmin=xmin, xmax=xmax)
667 defineEachStepHistograms(
'pt_vis',
'p_{T, vis} [GeV]', 60, 0.0, 300)
668 if info.isHLTSingleTau()
or info.isHLTTandP(): defineEachStepHistograms(
'pt_vis',
'p_{T, vis} [GeV]', coarse_binning, coarse_binning[0], coarse_binning[-1], coarse=
True)
669 defineEachStepHistograms(
'eta_vis',
'#eta_{vis}', 13, -2.6, 2.6)
670 defineEachStepHistograms(
'phi_vis',
'#phi_{vis}', 16, -3.2, 3.2)
671 defineEachStepHistograms(
'eta_vis',
'#eta_{vis}', 13, -2.6, 2.6, high_pt=
True)
672 defineEachStepHistograms(
'phi_vis',
'#phi_{vis}', 16, -3.2, 3.2, high_pt=
True)
676 mon_group_name = f
'{trigger}_TruthVars_{n_prong}'
677 mon_group_path = f
'{base_path}/TruthVars/{trigger}/TruthVars_{n_prong}'
678 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
680 mon_group.defineHistogram(
'pt_vis,PtRatio', title=
'p_{T} ratio vs p_{T, vis}; p_{T, vis} [GeV]; (p_{T}^{reco} - p_{T, vis}^{truth})/p_{T, vis}^{truth}', type=
'TProfile', xbins=21, xmin=20, xmax=250)
681 mon_group.defineHistogram(
'eta_vis,PtRatio', title=
'p_{T} ratio vs #eta_{vis}; #eta_{vis}; (p_{T}^{reco} - p_{T, vis}^{truth})/p_{T, vis}^{truth}', type=
'TProfile', xbins=21, xmin=-3, xmax=3)
682 mon_group.defineHistogram(
'phi_vis,PtRatio', title=
'p_{T} ratio vs #phi_{vis}; #phi_{vis}; (p_{T}^{reco} - p_{T, vis}^{truth})/p_{T, vis}^{truth}', type=
'TProfile', xbins=21, xmin=-3, xmax=3)
684 mon_group.defineHistogram(
'pt_vis', title=
'p_{T, vis}; p_{T, vis}; Events', xbins=50, xmin=0, xmax=250)
685 mon_group.defineHistogram(
'eta_vis', title=
'#eta_{vis}; #eta_{vis}; Events', xbins=26, xmin=-2.6, xmax=2.6)
686 mon_group.defineHistogram(
'phi_vis', title=
'#phi_{vis}; #phi_{vis}; Events', xbins=16, xmin=-3.2, xmax=3.2)
690 mon_group_name = f
'{trigger}_L1_Efficiency_{n_prong}'
691 mon_group_path = f
'{base_path}/L1_Efficiency/{trigger}/L1_Efficiency_{n_prong}'
692 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
694 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax, high_pt=False, coarse=False):
695 pass_flag =
'L1_pass'
699 pass_flag +=
'_highPt'
701 xlabel +=
' (p_{T}^{#tau} > p_{T}^{#tau thr} + 20 GeV)'
705 mon_group.defineHistogram(f
'{pass_flag},{xvariable};EffL1_{xvariable}{sfx}_wrt_Offline',
706 title=f
'L1 Efficiency {trigger} {n_prong}; {xlabel}; Efficiency',
707 type=
'TEfficiency', xbins=xbins, xmin=xmin, xmax=xmax, opt=
'kAlwaysCreate')
711 defineEachStepHistograms(
'tauPt',
'p_{T} [GeV]', 60, 0, 300)
712 defineEachStepHistograms(
'tauPt',
'p_{T} [GeV]', coarse_binning, coarse_binning[0], coarse_binning[-1], coarse=
True)
713 defineEachStepHistograms(
'tauEta',
'#eta', 13, -2.6, 2.6)
714 defineEachStepHistograms(
'tauPhi',
'#phi', 16, -3.2, 3.2)
715 defineEachStepHistograms(
'tauEta',
'#eta', 13, -2.6, 2.6, high_pt=
True)
716 defineEachStepHistograms(
'tauPhi',
'#phi', 16, -3.2, 3.2, high_pt=
True)
717 defineEachStepHistograms(
'averageMu',
'#LT#mu#GT', 10, 0, 80)
721 mon_group_name = f
'{trigger}_L1Vars'
722 mon_group_path = f
'{base_path}/L1Vars/{trigger}'
723 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
725 mon_group.defineHistogram(
'L1RoIEt,L1RoIEta', type=
'TH2F', title=
'L1 RoI E_{T} vs #eta; E_{T} [GeV]; #eta',
726 xbins=60, xmin=0, xmax=300,
727 ybins=60, ymin=-2.6, ymax=2.6, opt=
'kAlwaysCreate')
728 mon_group.defineHistogram(
'L1RoIEt,L1RoIPhi', type=
'TH2F', title=
'L1 RoI E_{T} vs #phi; E_{T} [GeV]; #phi',
729 xbins=60, xmin=0, xmax=300,
730 ybins=60, ymin=-3.2, ymax=3.2, opt=
'kAlwaysCreate')
731 mon_group.defineHistogram(
'L1RoIEta,L1RoIPhi', type=
'TH2F', title=
'L1 RoI #eta vs #phi; #eta; #phi',
732 xbins=60, xmin=-2.6, xmax=2.6,
733 ybins=60, ymin=-3.2, ymax=3.2, opt=
'kAlwaysCreate')
734 mon_group.defineHistogram(
'L1RoIEta', title=
'L1 RoI #eta; #eta; RoIs', xbins=60, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
735 mon_group.defineHistogram(
'L1RoIPhi', title=
'L1 RoI #phi; #phi; RoIs', xbins=60, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
736 mon_group.defineHistogram(
'L1RoIEt', title=
'L1 RoI E_{T}; E_{T} [GeV]; RoIs', xbins=60, xmin=0, xmax=300, opt=
'kAlwaysCreate')
738 if 'eTAU' in trigger:
739 mon_group.defineHistogram(
'L1eFexRoIRCore', title=
'L1 eTAU RoI rCore Isolation; rCore Isolation; RoIs', xbins=250, xmin=0, xmax=1, opt=
'kAlwaysCreate')
740 mon_group.defineHistogram(
'L1eFexRoIRHad' , title=
'L1 eTAU RoI rHad Isolation; rHad Isolation; RoIs', xbins=250, xmin=0, xmax=1, opt=
'kAlwaysCreate')
741 mon_group.defineHistogram(
'L1eFexRoIBDTScore' , title=
'L1 eTAU RoI BDT score; BDT Score; RoIs', xbins=128, xmin=512, xmax=1024, opt=
'kAlwaysCreate')
743 elif 'cTAU' in trigger:
744 mon_group.defineHistogram(
'L1eFexRoIRCore', title=
'L1 eTAU RoI rCore Isolation; eTAU rCore Isolation; RoIs', xbins=250, xmin=0, xmax=1, opt=
'kAlwaysCreate')
745 mon_group.defineHistogram(
'L1eFexRoIRHad', title=
'L1 eTAU RoI rHad Isolation; eTAU rHad Isolation; RoIs', xbins=250, xmin=0, xmax=1, opt=
'kAlwaysCreate')
746 mon_group.defineHistogram(
'L1cTauRoITopoMatch', title=
'L1Topo match between eTAU and jTAU RoI; Match; RoIs', xbins=2, xmin=0, xmax=2, opt=
'kAlwaysCreate')
747 mon_group.defineHistogram(
'L1jFexRoIIso', title=
'L1 jTAU RoI Isolation; E_{T}^{jTAU Iso} [GeV]; RoIs', xbins=25, xmin=0, xmax=50, opt=
'kAlwaysCreate')
748 mon_group.defineHistogram(
'L1cTauMatchedRoIIso', title=
'L1 cTAU Isolation score; E_{T}^{jTAU Iso}/E_{T}^{eTAU}; RoIs', xbins=50, xmin=0, xmax=5, opt=
'kAlwaysCreate')
749 mon_group.defineHistogram(
'L1RoIcTauMatchedEtRatio', title=
'Et ratio between matched eTAU and jTAU RoIs; E_{T}^{jTAU}/E_{T}^{eTAU}; RoIs', xbins=40, xmin=0, xmax=4, opt=
'kAlwaysCreate')
750 mon_group.defineHistogram(
'L1eFexRoIBDTScore' , title=
'L1 eTAU RoI BDT score; BDT Score; RoIs', xbins=128, xmin=512, xmax=1024, opt=
'kAlwaysCreate')
752 elif 'jTAU' in trigger:
753 mon_group.defineHistogram(
'L1jFexRoIIso', title=
'L1 jTAU RoI Isolation; jTAU Isolation [GeV]; N RoI', xbins=25, xmin=0, xmax=50, opt=
'kAlwaysCreate')
756 mon_group.defineHistogram(
'L1RoIEMIsol', title=
'L1 Legacy RoI EM Isol; E_{T}^{EM Iso} [GeV]; RoIs', xbins=16, xmin=-2, xmax=30, opt=
'kAlwaysCreate')
757 mon_group.defineHistogram(
'L1RoIHadCore', title=
'L1 Legacy RoI Had Core; E_{T}^{Had} [GeV]; RoIs', xbins=16, xmin=-2, xmax=30, opt=
'kAlwaysCreate')
758 mon_group.defineHistogram(
'L1RoIHadIsol', title=
'L1 Legacy RoI Had Isol; E_{T}^{Had Iso} [GeV]; RoIs', xbins=16, xmin=-2, xmax=30, opt=
'kAlwaysCreate')
759 mon_group.defineHistogram(
'L1RoITauClus', title=
'L1 Legacy RoI E_{T}; E_{T} [GeV]; RoIs', xbins=260, xmin=0, xmax=130, opt=
'kAlwaysCreate')
760 mon_group.defineHistogram(
'L1RoITauClus,L1RoIEMIsol', type=
'TH2F', title=
'L1 RoI E_{T} vs EM Isol; E_{T} [GeV]; E_{T}^{EM Iso} [GeV]',
761 xbins=140, xmin=10, xmax=80, ybins=42, ymin=-1, ymax=20, opt=
'kAlwaysCreate')
767 def getList(ranges, others=[250]):
768 ret =
set(others + [500])
769 for jump, interval
in ranges.items():
770 ret.update(
range(interval[0], interval[1], jump), interval)
773 if info.isL1TauOnly():
774 thr = info.getL1TauThreshold()
776 if thr <= 8:
return getList({5:(0, 30), 50:(50, 150)})
777 elif thr <= 12:
return getList({5:(0, 30), 50:(50, 150)})
778 elif thr <= 20:
return getList({5:(5, 40), 10:(40, 70), 50:(100, 150)})
779 elif thr <= 30:
return getList({5:(15, 50), 10:(50, 70), 50:(100, 150)})
780 elif thr <= 35:
return getList({5:(20, 55), 10:(60, 80), 50:(100, 150)})
781 elif thr <= 40:
return getList({5:(25, 60), 10:(60, 80), 50:(100, 150)})
782 elif thr <= 60:
return getList({5:(45, 80), 10:(80, 100), 50:(100, 150)})
783 elif thr <= 100:
return getList({5:(85, 120), 10:(120, 140), 20:(140, 180), 50:(200, 250)})
784 else:
return getList({50:(0, 200)})
787 thr = info.getHLTTauThreshold()
790 if thr == 0:
return getList({5:(0, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
791 elif thr <= 20:
return getList({5:(15, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
792 elif thr <= 25:
return getList({5:(20, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
793 elif thr <= 30:
return getList({5:(25, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
794 elif thr <= 35:
return getList({5:(30, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
795 elif thr <= 60:
return getList({5:(55, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
796 elif thr <= 80:
return getList({5:(75, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
797 elif thr <= 160:
return getList({5:(155, 160), 40:(160, 240), 60:(240, 420)}, [])
798 elif thr <= 180:
return getList({5:(175, 180), 40:(180, 260), 60:(260, 380)}, [])
799 else:
return getList({5:(195, 200), 40:(200, 240), 60:(240, 420)}, [])
804 else:
return getList({5:(0, 30), 50:(50, 150)})
805 elif thr <= 20:
return getList({5:(10, 40), 10:(40, 60), 20:(60, 80)}, [150, 250])
806 elif thr <= 25:
return getList({5:(15, 40), 10:(40, 60), 20:(60, 80)}, [150, 250])
807 elif thr <= 30:
return getList({5:(20, 50), 10:(50, 60), 20:(60, 80)}, [150, 250])
808 elif thr <= 35:
return getList({5:(25, 50), 10:(50, 60), 20:(60, 80)}, [150, 250])
809 elif thr <= 60:
return getList({5:(50, 70), 10:(70, 80)}, [110, 150, 250])
810 elif thr <= 80:
return getList({5:(70, 90)}, [110, 150, 250])
811 elif thr <= 160:
return getList({5:(150, 170), 10:(170, 180), 20:(180, 200)}, [240, 300])
812 elif thr <= 180:
return getList({5:(170, 180), 10:(180, 200)}, [240, 300])
813 else:
return getList({5:(190, 200), 10:(200, 210)}, [240, 300])