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 'GNTau': (
'GNTau_Score',
'GNTau_ScoreSigTrans'),
39 'DeepSet': (
'RNNJetScore',
'RNNJetScoreSigTrans'),
42 'RNNLLP': (
'RNNJetScore',
'RNNJetScoreSigTrans'),
45 'RNNLLP': (
'RNNJetScore',
'RNNJetScoreSigTrans'),
48 'tracktwoMVABDT': {
'RNN': (
'RNNJetScore',
'RNNJetScoreSigTrans') },
51 offline_tauid_scores = {
52 'RNN': (
'RNNJetScore',
'RNNJetScoreSigTrans'),
58 do_alternative_eTAU_monitoring =
False
61 from AthenaCommon.Logging
import logging
62 self.
logger = logging.getLogger(
'TrigTauMonAlgBuilder')
106 self.
logger.
debug(
'Using default monitoring configuration for collisions')
108 if self.
helper.flags.DQ.Environment ==
"tier0":
119 self.
logger.
info(
'Creating the Tau monitoring algorithms...')
136 @functools.cached_property
139 m = ROOT.std.map[ROOT.std.string, ROOT.float]()
144 @functools.cached_property
147 m = ROOT.std.map[ROOT.std.string, ROOT.uint64_t]()
152 @functools.lru_cache(maxsize=1000)
154 from TrigTauMonitoring.TrigTauInfo
import TrigTauInfo
164 from TrigConfigSvc.TriggerConfigAccess
import getL1MenuAccess, getHLTMenuAccess, getHLTMonitoringAccess
171 all_items = HLT_monitoring.monitoredChains(signatures=
'tauMon', monLevels=[
'shifter',
't0',
'val'])
174 from TrigTauMonitoring.ManualChains
import monitored_chains
175 self.
logger.
info(
'Could not find any monitored tau chains in the HLTMonitoring information. Will use the available items from the fallback trigger list')
176 all_items = monitored_chains
179 for trigger
in all_items:
182 if trigger
not in HLT_menu:
continue
193 if len(info.getL1TauItems()):
194 for l1_tau_item
in map(str, info.getL1TauItems()):
195 is_phase_1 =
'eTAU' in l1_tau_item
or 'jTAU' in l1_tau_item
or 'cTAU' in l1_tau_item
207 self.
logger.
info(f
'Configuring HLT single-tau monitored chains: {self.HLT_single_items}')
209 self.
logger.warning(
'Empty trigger list, disabling the single-tau monitoring')
214 self.
logger.
info(f
'Configuring HLT di-tau monitored chains: {self.HLT_ditau_items}')
216 self.
logger.warning(
'Empty trigger list, disabling the di-tau monitoring')
221 self.
logger.
info(f
'Configuring HLT Tag and Probe tau monitored chains: {self.HLT_tag_and_probe_items}')
223 self.
logger.warning(
'Empty trigger list, disabling the tag and probe monitoring')
229 self.
logger.
info(f
'Configuring HLT truth tau monitored chains: {self.HLT_truth_items}')
231 self.
logger.warning(
'Empty trigger list, disabling the truth tau monitoring')
236 self.
logger.
info(f
'Configuring L1 tau monitored items: {self.L1_items}')
238 self.
logger.warning(
'Empty trigger list, disabling the L1 tau monitoring')
243 self.
logger.
info(f
'Creating the monitoring algorithm: {name}')
244 mon_alg = self.
helper.addAlgorithm(algorithm_factory, name)
258 self.
logger.
info(
' |- Booking all histograms')
261 for p
in (
'1P',
'3P'):
265 for p
in (
'0P',
'1P',
'MP'):
273 for p
in (
'1P',
'3P'):
288 self.
logger.
info(
' |- Booking all histograms')
289 path = f
'{self.base_path}/OnlineOnlyVars'
291 for p
in (
'0P',
'1P',
'MP'):
305 self.
logger.
info(
' |- Booking all histograms')
316 self.
logger.
info(
' |- Booking all histograms')
326 self.
logger.
info(
' |- Booking all histograms')
328 for p
in (
'1P',
'3P'):
334 has_xtob_etau_rois =
'L1_eTauxRoI' in self.
helper.flags.Input.Collections
or self.
helper.flags.DQ.Environment ==
"tier0"
339 if not has_xtob_etau_rois:
340 self.
logger.
info(
' |- No L1_eTauxRoI container is available: e/cTAU BDT scores will be set to 0')
343 self.
logger.
info(
' |- Booking all histograms')
345 for p
in (
'1P',
'3P'):
354 if not has_xtob_etau_rois:
355 self.
logger.
info(
' |- No L1_eTauxRoI container is available: e/cTAU BDT scores will be set to 0')
358 self.
logger.
info(
' |- Booking all histograms')
359 path = f
'{self.base_path}/OnlineOnlyVars'
370 l1_items = [item
for item
in self.
L1_items if 'eTAU' in item
and not self.
getTriggerInfo(item).isL1TauIsolated()]
373 self.
logger.
info(
' |- Booking all histograms')
374 path = f
'{self.base_path}/L1eTAUAlt'
375 for trigger
in l1_items:
376 for p
in (
'1P',
'3P'):
382 mon_group_name = f
'{trigger}_HLT_Efficiency_{n_prong}'
383 mon_group_path = f
'{base_path}/HLT_Efficiency/{trigger}/HLT_Efficiency_{n_prong}'
384 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
386 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax, eff='HLT', high_pt=False, coarse=False):
387 pass_flag = f
'{eff}_pass'
391 pass_flag +=
'_highPt'
393 xlabel +=
' (p_{T} > p_{T}^{thr} + 20 GeV)'
394 elif coarse: sfx =
'_coarse'
396 mon_group.defineHistogram(f
'{pass_flag},{xvariable};Eff{eff}_{xvariable}{sfx}_wrt_Offline',
397 title=f
'{eff} Efficiency {trigger} {n_prong}; {xlabel}; Efficiency',
398 type=
'TEfficiency', xbins=xbins, xmin=xmin, xmax=xmax, opt=
'kAlwaysCreate')
404 defineEachStepHistograms(
'tauPt',
'p_{T} [GeV]', 60, 0.0, 300., eff)
405 defineEachStepHistograms(
'tauPt',
'p_{T} [GeV]', coarse_binning, coarse_binning[0], coarse_binning[-1], eff, coarse=
True)
406 defineEachStepHistograms(
'tauEta',
'#eta', 13, -2.6, 2.6, eff)
407 defineEachStepHistograms(
'tauPhi',
'#phi', 16, -3.2, 3.2, eff)
408 defineEachStepHistograms(
'tauEta',
'#eta', 13, -2.6, 2.6, eff, high_pt=
True)
409 defineEachStepHistograms(
'tauPhi',
'#phi', 16, -3.2, 3.2, eff, high_pt=
True)
410 defineEachStepHistograms(
'averageMu',
'#LT#mu#GT', 10, 0, 80, eff)
413 mon_group.defineTree(
'tauPt,tauEta,tauPhi,averageMu,HLT_pass;HLTEffTree',
414 treedef=
'tauPt/F:tauEta/F:tauPhi/F:averageMu/F:HLT_pass/I')
418 type_str =
'HLT' if online
else 'Offline'
419 mon_group_name = f
'{trigger}_ID_{type_str}_InputScalar_{n_prong}'
420 mon_group_path = f
'{base_path}/TauIDVars/InputScalar_{n_prong}/{trigger}/{type_str}'
421 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
423 mon_group.defineHistogram(
'centFrac', title=f
'Centrality Fraction ({n_prong}); centFrac; Events', xbins=50, xmin=-0.05, xmax=1.2, opt=
'kAlwaysCreate')
424 mon_group.defineHistogram(
'etOverPtLeadTrk', title=f
'etOverPtLeadTrk log ({n_prong}); etOverPtLeadTrk_log; Events', xbins=60, xmin=-3, xmax=3, opt=
'kAlwaysCreate')
425 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')
426 mon_group.defineHistogram(
'absipSigLeadTrk', title=f
'AbsIpSigLeadTrk ({n_prong}); absipSigLeadTrk; Events', xbins=25, xmin=0.0, xmax=20.0, opt=
'kAlwaysCreate')
427 mon_group.defineHistogram(
'sumPtTrkFrac', title=f
'SumPtTrkFrac ({n_prong}); SumPtTrkFrac; Events', xbins=50, xmin=-0.5, xmax=1.1, opt=
'kAlwaysCreate')
428 mon_group.defineHistogram(
'emPOverTrkSysP', title=f
'EMPOverTrkSysP log ({n_prong}); EMPOverTrkSysP_log; Events', xbins=50, xmin=-5, xmax=3, opt=
'kAlwaysCreate')
429 mon_group.defineHistogram(
'ptRatioEflowApprox', title=f
'ptRatioEflowApprox ({n_prong}); ptRatioEflowApprox; Events', xbins=50, xmin=0.0, xmax=2.0, opt=
'kAlwaysCreate')
430 mon_group.defineHistogram(
'mEflowApprox', title=f
'mEflowApprox log ({n_prong}); mEflowApprox_log; Events', xbins=50, xmin=0, xmax=5, opt=
'kAlwaysCreate')
431 mon_group.defineHistogram(
'ptDetectorAxis', title=f
'ptDetectorAxis log ({n_prong}); ptDetectorAxis_log; Events', xbins=50, xmin=0, xmax=5, opt=
'kAlwaysCreate')
432 if n_prong ==
'MP' or n_prong ==
'3P':
433 mon_group.defineHistogram(
'massTrkSys', title=f
'massTrkSys log ({n_prong}); massTrkSys_log; Events', xbins=50, xmin=0, xmax=3, opt=
'kAlwaysCreate')
434 mon_group.defineHistogram(
'trFlightPathSig', title=f
'trFlightPathSig ({n_prong}); trFlightPathSig; Events', xbins=100, xmin=-20, xmax=40, opt=
'kAlwaysCreate')
438 type_str =
'HLT' if online
else 'Offline'
439 mon_group_name = f
'{trigger}_ID_{type_str}_InputTrack'
440 mon_group_path = f
'{base_path}/TauIDVars/InputTrack/{trigger}/{type_str}'
441 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
443 mon_group.defineHistogram(
'n_track', title=
'Number of tracks; N_{track}; Events', xbins=15, xmin=0, xmax=15, opt=
'kAlwaysCreate')
444 mon_group.defineHistogram(
'track_pt_log', title=
'track_pt_log; track_pt_log; Events', xbins=20, xmin=2, xmax=7, opt=
'kAlwaysCreate')
445 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')
446 mon_group.defineHistogram(
'track_eta', title=
'Track #eta; #eta; Events', xbins=26, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
447 mon_group.defineHistogram(
'track_phi', title=
'Track #phi; #phi; Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
448 mon_group.defineHistogram(
'track_dEta', title=
'Track #Delta#eta; #Delta#eta; Events', xbins=100, xmin=-0.5, xmax=0.5, opt=
'kAlwaysCreate')
449 mon_group.defineHistogram(
'track_dPhi', title=
'Track #Delta#phi; #Delta#phi; Events', xbins=100, xmin=-0.5, xmax=0.5, opt=
'kAlwaysCreate')
450 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')
451 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')
452 mon_group.defineHistogram(
'track_nIBLHitsAndExp', title=
'track_nIBLHitsAndExp; track_nIBLHitsAndExp; Events', xbins=3, xmin=0, xmax=3, opt=
'kAlwaysCreate')
453 mon_group.defineHistogram(
'track_nPixelHitsPlusDeadSensors', title=
'track_nPixelHitsPlusDeadSensors; track_nPixelHitsPlusDeadSensors; Events', xbins=11, xmin=0, xmax=11, opt=
'kAlwaysCreate')
454 mon_group.defineHistogram(
'track_nSCTHitsPlusDeadSensors', title=
'track_nSCTHitsPlusDeadSensors; track_nSCTHitsPlusDeadSensors; Events', xbins=20, xmin=0, xmax=20, opt=
'kAlwaysCreate')
455 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')
456 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')
460 type_str =
'HLT' if online
else 'Offline'
461 mon_group_name = f
'{trigger}_ID_{type_str}_InputCluster'
462 mon_group_path = f
'{base_path}/TauIDVars/InputCluster/{trigger}/{type_str}'
463 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
465 mon_group.defineHistogram(
'n_cluster', title=
'Number of clusters; N_{cluster}; Events', xbins=30, xmin=0, xmax=30, opt=
'kAlwaysCreate')
466 mon_group.defineHistogram(
'cluster_et_log', title=
'cluster_et_log; cluster_et_log; Events', xbins=30, xmin=0, xmax=6, opt=
'kAlwaysCreate')
467 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')
468 mon_group.defineHistogram(
'cluster_eta', title=
'Cluster #eta; #eta; Events', xbins=26, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
469 mon_group.defineHistogram(
'cluster_phi', title=
'Cluster #phi; #phi; Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
470 mon_group.defineHistogram(
'cluster_dEta', title=
'Cluster #Delta#eta; #Delta#eta; Events', xbins=100, xmin=-0.5, xmax=0.5, opt=
'kAlwaysCreate')
471 mon_group.defineHistogram(
'cluster_dPhi', title=
'Cluster #Delta#phi; #Delta#phi; Events', xbins=100, xmin=-0.5, xmax=0.5, opt=
'kAlwaysCreate')
472 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')
473 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')
474 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')
475 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')
476 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')
481 store_all = info.getHLTTauID()
in [
'idperf',
'perf']
488 if tau_id == info.getHLTTauID()
or store_all
493 type_str =
'HLT' if online
else 'Offline'
494 mon_group_name = f
'{trigger}_{type_str}_IDScores_{n_prong}'
495 mon_group_path = f
'{base_path}/basicVars/{trigger}/{type_str}_{n_prong}'
496 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
498 for tau_id, (score, score_sig_trans)
in variables.items():
499 if tau_id
in [
'RNN',
'DeepSet',
'RNNLLP',
'GNTau']: xbins, xmax = 20, 1
500 else: xbins, xmax = 100, 5
502 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')
503 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')
507 type_str =
'HLT' if online
else 'Offline'
508 mon_group_name = f
'{trigger}_{type_str}_basicVars_{n_prong}'
509 mon_group_path = f
'{base_path}/basicVars/{trigger}/{type_str}_{n_prong}'
510 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
514 mon_group.defineHistogram(
'Pt', title=f
'{type_str} p_{{T}}; p_{{T}} [GeV]; Events', xbins=binning, opt=
'kAlwaysCreate')
515 mon_group.defineHistogram(
'Eta', title=f
'{type_str} #eta; #eta; Events', xbins=26, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
516 mon_group.defineHistogram(
'Phi', title=f
'{type_str} #phi; #phi; Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
517 mon_group.defineHistogram(
'nTrack', title=f
'{type_str} Number of tracks; N_{{track}}; Events', xbins=10, xmin=0, xmax=10, opt=
'kAlwaysCreate')
518 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')
519 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')
520 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')
521 mon_group.defineHistogram(
'nIsoTrack', title=f
'{type_str} Number of isolation tracks; N_{{track}}^{{iso}}; Events', xbins=10, xmin=0, xmax=10, opt=
'kAlwaysCreate')
522 mon_group.defineHistogram(
'averageMu', title=f
'{type_str} Average #mu; #LT#mu$GT; Events', xbins=20, xmin=0, xmax=80, opt=
'kAlwaysCreate')
523 mon_group.defineHistogram(
'TauVertexX', title=f
'{type_str} Tau Vertex X; x [mm]; Events', xbins=100, xmin=-1, xmax=1, opt=
'kAlwaysCreate')
524 mon_group.defineHistogram(
'TauVertexY', title=f
'{type_str} Tau Vertex Y; y [mm]; Events', xbins=100, xmin=-2, xmax=0, opt=
'kAlwaysCreate')
525 mon_group.defineHistogram(
'TauVertexZ', title=f
'{type_str} Tau Vertex Z; z [mm]; Events', xbins=120, xmin=-120, xmax=120, opt=
'kAlwaysCreate')
529 mon_group_name = f
'{trigger}_DiTauHLT_Efficiency'
530 mon_group_path = f
'{base_path}/DiTauHLT_Efficiency/{trigger}/DiTauHLT_Efficiency'
531 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
533 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax, eff='HLT', high_pt=False):
534 pass_flag = f
'{eff}_pass'
538 pass_flag +=
'_highPt'
540 xlabel +=
' (p_{T}^{1,2} > p_{T}^{thr 1,2} + 20 GeV)'
542 mon_group.defineHistogram(f
'{pass_flag},{xvariable};EffDiTau{eff}_{xvariable}{sfx}_wrt_Offline',
543 title=f
'DiTau {eff} Efficiency {trigger};{xlabel};Efficiency',
544 type=
'TEfficiency', xbins=xbins, xmin=xmin, xmax=xmax, opt=
'kAlwaysCreate')
548 defineEachStepHistograms(
'dR',
'#Delta R(#tau,#tau)', 20, 0, 4, eff)
549 defineEachStepHistograms(
'dEta',
'#Delta#eta(#tau,#tau)', 20, 0, 4, eff)
550 defineEachStepHistograms(
'dPhi',
'#Delta#phi(#tau,#tau)', 8, -3.2, 3.2, eff)
552 defineEachStepHistograms(
'dR',
'#Delta R(#tau,#tau)', 20, 0, 4, eff, high_pt=
True)
553 defineEachStepHistograms(
'dEta',
'#Delta#eta(#tau,#tau)', 20, 0, 4, eff, high_pt=
True)
554 defineEachStepHistograms(
'dPhi',
'#Delta#phi(#tau,#tau)', 8, -3.2, 3.2, eff, high_pt=
True)
555 defineEachStepHistograms(
'averageMu',
'#LT#mu#GT', 10, 0, 80, eff)
558 mon_group.defineTree(
'dR,dEta,dPhi,averageMu,HLT_pass;DiTauHLTEffTree',
559 treedef=
'dR/F:dEta/F:dPhi/F:averageMu/F:HLT_pass/I')
563 mon_group_name = f
'{trigger}_DiTauVars'
564 mon_group_path = f
'{base_path}/DiTauVars/{trigger}'
565 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
567 mon_group.defineHistogram(
'leadHLTEt,subleadHLTEt', type=
'TH2F', title=
'p_{T}^{lead} vs p_{T}^{sublead}; p_{T}^{lead} [GeV]; p_{T}^{sublead} [GeV]',
568 xbins=50, xmin=0, xmax=250, ybins=50, ymin=0, ymax=250, opt=
'kAlwaysCreate')
569 mon_group.defineHistogram(
'leadHLTEta,subleadHLTEta', type=
'TH2F', title=
'#eta_{lead} vs #eta_{sublead}; #eta_{lead}; #eta_{sublead}',
570 xbins=26, xmin=-2.6, xmax=2.6, ybins=26, ymin=-2.6, ymax=2.6, opt=
'kAlwaysCreate')
571 mon_group.defineHistogram(
'leadHLTPhi,subleadHLTPhi', type=
'TH2F', title=
'#phi_{lead} vs #phi_{sublead}; #phi_{lead}; #phi_{sublead}',
572 xbins=16, xmin=-3.2, xmax=3.2, ybins=16, ymin=-3.2, ymax=3.2, opt=
'kAlwaysCreate')
573 mon_group.defineHistogram(
'dR', title=
'#Delta R(#tau,#tau); #Delta R(#tau,#tau); Events', xbins=40, xmin=0, xmax=4, opt=
'kAlwaysCreate')
574 mon_group.defineHistogram(
'dEta', title=
'#Delta#eta(#tau,#tau); #Delta#eta(#tau,#tau); Events', xbins=40, xmin=0, xmax=4, opt=
'kAlwaysCreate')
575 mon_group.defineHistogram(
'dPhi', title=
'#Delta#phi(#tau,#tau); #Delta#phi(#tau,#tau); Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
577 mon_group.defineHistogram(
'Pt', title=
'p_{T}(#tau,#tau); p_{T} [GeV]; Events', xbins=50, xmin=0, xmax=250, opt=
'kAlwaysCreate')
578 mon_group.defineHistogram(
'Eta', title=
'#eta(#tau,#tau); #eta(#tau,#tau); Events', xbins=26, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
579 mon_group.defineHistogram(
'Phi', title=
'#phi(#tau,#tau); #phi(#tau,#tau); Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
580 mon_group.defineHistogram(
'M', title=
'm(#tau,#tau); m_{#tau,#tau}; Events', xbins=50, xmin=0, xmax=250, opt=
'kAlwaysCreate')
581 mon_group.defineHistogram(
'dPt', title=
'#Delta p_{T}(#tau, #tau); p_{T} [GeV]; Events', xbins=20, xmin=0, xmax=200, opt=
'kAlwaysCreate')
583 mon_group.defineTree(
'leadHLTEt,subleadHLTEt,leadHLTEta,subleadHLTEta,leadHLTPhi,subleadHLTPhi,dR,dEta,dPhi,Pt,Eta,Phi,M,dPt;DiTauVarsTree',
584 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')
588 mon_group_name = f
'{trigger}_TAndPHLT_Efficiency'
589 mon_group_path = f
'{base_path}/TAndPHLT_Efficiency/{trigger}/TAndPHLT_Efficiency'
590 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
592 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax, high_pt=False, coarse=False):
593 pass_flag =
'HLT_pass'
597 pass_flag +=
'_highPt'
599 xlabel +=
' (p_{T}^{#tau} > p_{T}^{#tau thr} + 20 GeV)'
603 mon_group.defineHistogram(f
'{pass_flag},{xvariable};EffTAndPHLT_{xvariable}{sfx}_wrt_Offline',
604 title=f
'TAndP HLT Efficiency {trigger}; {xlabel}; Efficiency',
605 type=
'TEfficiency', xbins=xbins, xmin=xmin, xmax=xmax, opt=
'kAlwaysCreate')
609 defineEachStepHistograms(
'tauPt',
'p_{T}^{#tau} [GeV]', 60, 0.0, 300)
610 defineEachStepHistograms(
'tauPt',
'p_{T}^{#tau} [GeV]', coarse_binning, coarse_binning[0], coarse_binning[-1], coarse=
True)
611 defineEachStepHistograms(
'tauEta',
'#eta_{#tau}', 13, -2.6, 2.6)
612 defineEachStepHistograms(
'tauPhi',
'#phi_{#tau}', 16, -3.2, 3.2)
613 defineEachStepHistograms(
'tauEta',
'#eta_{#tau}', 13, -2.6, 2.6, high_pt=
True)
614 defineEachStepHistograms(
'tauPhi',
'#phi_{#tau}', 16, -3.2, 3.2, high_pt=
True)
615 defineEachStepHistograms(
'dR',
'#Delta R(#tau,lep)', 20, 0, 4)
616 defineEachStepHistograms(
'dEta',
'#Delta#eta(#tau,lep)', 20, 0,4)
617 defineEachStepHistograms(
'dPhi',
'#Delta#phi(#tau,lep)', 8, -3.2, 3.2)
618 defineEachStepHistograms(
'averageMu',
'#LT#mu#GT', 10, 0, 80)
621 mon_group.defineTree(
'tauPt,tauEta,tauPhi,dR,dEta,dPhi,averageMu,HLT_pass;TAndPHLTEffTree',
622 treedef=
'tauPt/F:tauEta/F:tauPhi/F:dR/F:dEta/F:dPhi/F:averageMu/F:HLT_pass/I')
626 mon_group_name = f
'{trigger}_TAndPVars'
627 mon_group_path = f
'{base_path}/TAndPVars/{trigger}'
628 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
630 mon_group.defineHistogram(
'dR', title=
'#Delta R(#tau,lep); #Delta R(#tau,lep); Events', xbins=40, xmin=0, xmax=4, opt=
'kAlwaysCreate')
631 mon_group.defineHistogram(
'dEta', title=
'#Delta#eta(#tau,lep); #Delta#eta(#tau,lep); Events', xbins=40, xmin=0, xmax=4, opt=
'kAlwaysCreate')
632 mon_group.defineHistogram(
'dPhi', title=
'#Delta#phi(#tau,lep); #Delta#phi(#tau,lep); Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
634 mon_group.defineHistogram(
'Pt', title=
'p_{T}(#tau,lep); p_{T} [GeV]; Events', xbins=50, xmin=0, xmax=250, opt=
'kAlwaysCreate')
635 mon_group.defineHistogram(
'Eta', title=
'#eta(#tau,lep); #eta; Events', xbins=26, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
636 mon_group.defineHistogram(
'Phi', title=
'#phi(#tau,lep); #phi; Events', xbins=16, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
637 mon_group.defineHistogram(
'M', title=
'm(#tau,lep); m_{#tau,lep}; Events', xbins=50, xmin=0, xmax=250, opt=
'kAlwaysCreate')
638 mon_group.defineHistogram(
'dPt', title=
'#Delta p_{T}(#tau,lep); p_{T} [GeV]; Events', xbins=20, xmin=0, xmax=200, opt=
'kAlwaysCreate')
642 mon_group_name = f
'{trigger}_Truth_Efficiency_{n_prong}'
643 mon_group_path = f
'{base_path}/Truth_Efficiency/{trigger}/Truth_Efficiency_{n_prong}'
644 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
648 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax, high_pt=False, coarse=False):
649 pass_flag =
'HLT_pass'
653 pass_flag +=
'_highPt'
655 if info.isHLTDiTau():
656 xlabel +=
' (p_{T}^{#tau} > p_{T}^{#tau min thr} + 20 GeV)'
658 xlabel +=
' (p_{T}^{#tau} > p_{T}^{#tau thr} + 20 GeV)'
662 mon_group.defineHistogram(f
'{pass_flag},{xvariable};EffHLT_{xvariable}{sfx}_wrt_Truth',
663 title=f
'HLT Efficiency {trigger} {n_prong}; {xlabel}; Efficiency',
664 type=
'TEfficiency', xbins=xbins, xmin=xmin, xmax=xmax)
668 defineEachStepHistograms(
'pt_vis',
'p_{T, vis} [GeV]', 60, 0.0, 300)
669 if info.isHLTSingleTau()
or info.isHLTTandP(): defineEachStepHistograms(
'pt_vis',
'p_{T, vis} [GeV]', coarse_binning, coarse_binning[0], coarse_binning[-1], coarse=
True)
670 defineEachStepHistograms(
'eta_vis',
'#eta_{vis}', 13, -2.6, 2.6)
671 defineEachStepHistograms(
'phi_vis',
'#phi_{vis}', 16, -3.2, 3.2)
672 defineEachStepHistograms(
'eta_vis',
'#eta_{vis}', 13, -2.6, 2.6, high_pt=
True)
673 defineEachStepHistograms(
'phi_vis',
'#phi_{vis}', 16, -3.2, 3.2, high_pt=
True)
677 mon_group_name = f
'{trigger}_TruthVars_{n_prong}'
678 mon_group_path = f
'{base_path}/TruthVars/{trigger}/TruthVars_{n_prong}'
679 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
681 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)
682 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)
683 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)
685 mon_group.defineHistogram(
'pt_vis', title=
'p_{T, vis}; p_{T, vis}; Events', xbins=50, xmin=0, xmax=250)
686 mon_group.defineHistogram(
'eta_vis', title=
'#eta_{vis}; #eta_{vis}; Events', xbins=26, xmin=-2.6, xmax=2.6)
687 mon_group.defineHistogram(
'phi_vis', title=
'#phi_{vis}; #phi_{vis}; Events', xbins=16, xmin=-3.2, xmax=3.2)
691 mon_group_name = f
'{trigger}_L1_Efficiency_{n_prong}'
692 mon_group_path = f
'{base_path}/L1_Efficiency/{trigger}/L1_Efficiency_{n_prong}'
693 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
695 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax, high_pt=False, coarse=False):
696 pass_flag =
'L1_pass'
700 pass_flag +=
'_highPt'
702 xlabel +=
' (p_{T}^{#tau} > p_{T}^{#tau thr} + 20 GeV)'
706 mon_group.defineHistogram(f
'{pass_flag},{xvariable};EffL1_{xvariable}{sfx}_wrt_Offline',
707 title=f
'L1 Efficiency {trigger} {n_prong}; {xlabel}; Efficiency',
708 type=
'TEfficiency', xbins=xbins, xmin=xmin, xmax=xmax, opt=
'kAlwaysCreate')
712 defineEachStepHistograms(
'tauPt',
'p_{T} [GeV]', 60, 0, 300)
713 defineEachStepHistograms(
'tauPt',
'p_{T} [GeV]', coarse_binning, coarse_binning[0], coarse_binning[-1], coarse=
True)
714 defineEachStepHistograms(
'tauEta',
'#eta', 13, -2.6, 2.6)
715 defineEachStepHistograms(
'tauPhi',
'#phi', 16, -3.2, 3.2)
716 defineEachStepHistograms(
'tauEta',
'#eta', 13, -2.6, 2.6, high_pt=
True)
717 defineEachStepHistograms(
'tauPhi',
'#phi', 16, -3.2, 3.2, high_pt=
True)
718 defineEachStepHistograms(
'averageMu',
'#LT#mu#GT', 10, 0, 80)
722 mon_group_name = f
'{trigger}_L1Vars'
723 mon_group_path = f
'{base_path}/L1Vars/{trigger}'
724 mon_group = self.
helper.addGroup(mon_alg, mon_group_name, mon_group_path)
726 mon_group.defineHistogram(
'L1RoIEt,L1RoIEta', type=
'TH2F', title=
'L1 RoI E_{T} vs #eta; E_{T} [GeV]; #eta',
727 xbins=60, xmin=0, xmax=300,
728 ybins=60, ymin=-2.6, ymax=2.6, opt=
'kAlwaysCreate')
729 mon_group.defineHistogram(
'L1RoIEt,L1RoIPhi', type=
'TH2F', title=
'L1 RoI E_{T} vs #phi; E_{T} [GeV]; #phi',
730 xbins=60, xmin=0, xmax=300,
731 ybins=60, ymin=-3.2, ymax=3.2, opt=
'kAlwaysCreate')
732 mon_group.defineHistogram(
'L1RoIEta,L1RoIPhi', type=
'TH2F', title=
'L1 RoI #eta vs #phi; #eta; #phi',
733 xbins=60, xmin=-2.6, xmax=2.6,
734 ybins=60, ymin=-3.2, ymax=3.2, opt=
'kAlwaysCreate')
735 mon_group.defineHistogram(
'L1RoIEta', title=
'L1 RoI #eta; #eta; RoIs', xbins=60, xmin=-2.6, xmax=2.6, opt=
'kAlwaysCreate')
736 mon_group.defineHistogram(
'L1RoIPhi', title=
'L1 RoI #phi; #phi; RoIs', xbins=60, xmin=-3.2, xmax=3.2, opt=
'kAlwaysCreate')
737 mon_group.defineHistogram(
'L1RoIEt', title=
'L1 RoI E_{T}; E_{T} [GeV]; RoIs', xbins=60, xmin=0, xmax=300, opt=
'kAlwaysCreate')
739 if 'eTAU' in trigger:
740 mon_group.defineHistogram(
'L1eFexRoIRCore', title=
'L1 eTAU RoI rCore Isolation; rCore Isolation; RoIs', xbins=250, xmin=0, xmax=1, opt=
'kAlwaysCreate')
741 mon_group.defineHistogram(
'L1eFexRoIRHad' , title=
'L1 eTAU RoI rHad Isolation; rHad Isolation; RoIs', xbins=250, xmin=0, xmax=1, opt=
'kAlwaysCreate')
742 mon_group.defineHistogram(
'L1eFexRoIBDTScore' , title=
'L1 eTAU RoI BDT score; BDT Score; RoIs', xbins=128, xmin=512, xmax=1024, opt=
'kAlwaysCreate')
744 elif 'cTAU' in trigger:
745 mon_group.defineHistogram(
'L1eFexRoIRCore', title=
'L1 eTAU RoI rCore Isolation; eTAU rCore Isolation; RoIs', xbins=250, xmin=0, xmax=1, opt=
'kAlwaysCreate')
746 mon_group.defineHistogram(
'L1eFexRoIRHad', title=
'L1 eTAU RoI rHad Isolation; eTAU rHad Isolation; RoIs', xbins=250, xmin=0, xmax=1, opt=
'kAlwaysCreate')
747 mon_group.defineHistogram(
'L1cTauRoITopoMatch', title=
'L1Topo match between eTAU and jTAU RoI; Match; RoIs', xbins=2, xmin=0, xmax=2, opt=
'kAlwaysCreate')
748 mon_group.defineHistogram(
'L1jFexRoIIso', title=
'L1 jTAU RoI Isolation; E_{T}^{jTAU Iso} [GeV]; RoIs', xbins=25, xmin=0, xmax=50, opt=
'kAlwaysCreate')
749 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')
750 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')
751 mon_group.defineHistogram(
'L1eFexRoIBDTScore' , title=
'L1 eTAU RoI BDT score; BDT Score; RoIs', xbins=128, xmin=512, xmax=1024, opt=
'kAlwaysCreate')
753 elif 'jTAU' in trigger:
754 mon_group.defineHistogram(
'L1jFexRoIIso', title=
'L1 jTAU RoI Isolation; jTAU Isolation [GeV]; N RoI', xbins=25, xmin=0, xmax=50, opt=
'kAlwaysCreate')
759 def getList(ranges, others=[250]):
760 ret =
set(others + [500])
761 for jump, interval
in ranges.items():
762 ret.update(
range(interval[0], interval[1], jump), interval)
765 if info.isL1TauOnly():
766 thr = info.getL1TauThreshold()
768 if thr <= 8:
return getList({5:(0, 30), 50:(50, 150)})
769 elif thr <= 12:
return getList({5:(0, 30), 50:(50, 150)})
770 elif thr <= 20:
return getList({5:(5, 40), 10:(40, 70), 50:(100, 150)})
771 elif thr <= 30:
return getList({5:(15, 50), 10:(50, 70), 50:(100, 150)})
772 elif thr <= 35:
return getList({5:(20, 55), 10:(60, 80), 50:(100, 150)})
773 elif thr <= 40:
return getList({5:(25, 60), 10:(60, 80), 50:(100, 150)})
774 elif thr <= 60:
return getList({5:(45, 80), 10:(80, 100), 50:(100, 150)})
775 elif thr <= 100:
return getList({5:(85, 120), 10:(120, 140), 20:(140, 180), 50:(200, 250)})
776 else:
return getList({50:(0, 200)})
779 thr = info.getHLTTauThreshold()
782 if thr == 0:
return getList({5:(0, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
783 elif thr <= 20:
return getList({5:(15, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
784 elif thr <= 25:
return getList({5:(20, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
785 elif thr <= 30:
return getList({5:(25, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
786 elif thr <= 35:
return getList({5:(30, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
787 elif thr <= 60:
return getList({5:(55, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
788 elif thr <= 80:
return getList({5:(75, 80), 10:(80, 120), 20:(120, 160), 40:(160, 240), 60:(240, 420)}, [])
789 elif thr <= 160:
return getList({5:(155, 160), 40:(160, 240), 60:(240, 420)}, [])
790 elif thr <= 180:
return getList({5:(175, 180), 40:(180, 260), 60:(260, 380)}, [])
791 else:
return getList({5:(195, 200), 40:(200, 240), 60:(240, 420)}, [])
796 else:
return getList({5:(0, 30), 50:(50, 150)})
797 elif thr <= 20:
return getList({5:(10, 40), 10:(40, 60), 20:(60, 80)}, [150, 250])
798 elif thr <= 25:
return getList({5:(15, 40), 10:(40, 60), 20:(60, 80)}, [150, 250])
799 elif thr <= 30:
return getList({5:(20, 50), 10:(50, 60), 20:(60, 80)}, [150, 250])
800 elif thr <= 35:
return getList({5:(25, 50), 10:(50, 60), 20:(60, 80)}, [150, 250])
801 elif thr <= 60:
return getList({5:(50, 70), 10:(70, 80)}, [110, 150, 250])
802 elif thr <= 80:
return getList({5:(70, 90)}, [110, 150, 250])
803 elif thr <= 160:
return getList({5:(150, 170), 10:(170, 180), 20:(180, 200)}, [240, 300])
804 elif thr <= 180:
return getList({5:(170, 180), 10:(180, 200)}, [240, 300])
805 else:
return getList({5:(190, 200), 10:(200, 210)}, [240, 300])