ATLAS Offline Software
runTriggerAPIExample.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4 
5 from TriggerMenuMT.TriggerAPI.TriggerAPI import TriggerAPI
6 from TriggerMenuMT.TriggerAPI.TriggerEnums import TriggerPeriod, TriggerType
7 
8 # List of lowest-unprescaled for a given type and period
9 # Loading periods is slow the first time and can take up to minutes,
10 # the information is cached and pickled and takes seconds for subsequent calls
11 # See TriggerEnums for all possibilities of types and periods
12 for triggerType in TriggerType:
13  print("\n------------- TriggerType:",triggerType)
14  for triggerPeriod in TriggerPeriod:
15  unprescaled = TriggerAPI.getLowestUnprescaled(triggerPeriod, triggerType)
16  print("- TriggerPeriod:",triggerPeriod)
17  print(unprescaled)
18 
19 # Further options:
20 # - ask for specific runs and/or specific patterns
21 print("Pattern match :",TriggerAPI.getLowestUnprescaled(337833, TriggerType.mu_bphys, matchPattern="bJpsi|bUpsi"))
22 # - combined items, example bjet + ht, bjet + met
23 # bj = bj_single | bj_multi
24 print("Bjet combined items:",TriggerAPI.getLowestUnprescaled(337833, TriggerType.bj, TriggerType.xe | TriggerType.ht))
25 # - combined items, example electron + anything
26 print("Ele combined items:",TriggerAPI.getLowestUnprescaled(337833, TriggerType.el, TriggerType.ALL))
27 # - lowest unprescaled in at least one period.
28 # Allows to get items that were accidentally prescaled in some period or changed over time
29 # E.g. no multi b-jet trigger is unprescaled over the full 2017
30 print("Lowest in at least one period:",TriggerAPI.getLowestUnprescaledAnyPeriod(TriggerPeriod.y2017periodAll, TriggerType.bj_multi))
31 # - retrieve items above a certain live fraction instead of unprescaled
32 # HLT_j225_gsc420_boffperf_split is unprescaled
33 # HLT_j225_gsc400_boffperf_split recorded >95% of the available luminosity
34 print("Lowest j225_gsc with 100% data:",TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2017periodB, TriggerType.j_single, matchPattern="j225_gsc"))
35 print("Lowest j225_gsc with 95% data:",TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2017periodB, TriggerType.j_single, matchPattern="j225_gsc", livefraction=0.95))
36 
37 # - combined items with more than 2 types:
38 print("Muon+jet+met items:",TriggerAPI.getLowestUnprescaled(337833, TriggerType.mu, [TriggerType.j, TriggerType.xe]))
39 # - items that are expected to be lowest-unprescaled at higher luminosities
40 print("Single muon lowest-unprescaled 2.0e34 items:",TriggerAPI.getLowestUnprescaled(TriggerPeriod.future2e34, TriggerType.mu_single))
41 # - can also retrieve all unprescaled items, including higher thresholds
42 print("Single muon unprescaled 2.0e34 items:" ,TriggerAPI.getUnprescaled(TriggerPeriod.future2e34, TriggerType.mu_single))
43 
44 # Set a custom GRL, affects *ALL* calls after it has been set
45 print("Multi-bjet in periods GHIK (default GRL)", TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2017periodGHIK, TriggerType.bj_multi))
46 TriggerAPI.setCustomGRL("/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data17_13TeV/20171130/data17_13TeV.periodAllYear_DetStatus-v97-pro21-13_Unknown_PHYS_StandardGRL_All_Good_25ns_BjetHLT_Normal2017.xml")
47 #print("Multi-bjet in periods GHIK (Bjet GRL) ", TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2017periodGHIK, TriggerType.bj_multi))
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28