From f61e813d5a5fd4c9559d7833b18409131777ddbd Mon Sep 17 00:00:00 2001
From: Javier Montejo Berlingen <javier.montejo.berlingen@cern.ch>
Date: Wed, 26 Sep 2018 18:26:16 +0000
Subject: [PATCH] Updates to TriggerAPI

Former-commit-id: 46e291d06601fd2aeeb5c9f44bcd7e2731cea275
---
 Trigger/TriggerCommon/TriggerMenu/CMakeLists.txt     |  2 +-
 .../TriggerMenu/python/api/TriggerAPI.py             |  4 ++--
 .../TriggerMenu/python/api/TriggerDataAccess.py      |  4 ++++
 .../TriggerMenu/python/api/TriggerEnums.py           |  7 ++++---
 .../TriggerMenu/python/api/TriggerPeriodData.py      | 12 ++++++------
 5 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenu/CMakeLists.txt b/Trigger/TriggerCommon/TriggerMenu/CMakeLists.txt
index ceb6dc628d3..3e6a1e8098c 100644
--- a/Trigger/TriggerCommon/TriggerMenu/CMakeLists.txt
+++ b/Trigger/TriggerCommon/TriggerMenu/CMakeLists.txt
@@ -87,7 +87,7 @@ function( atlas_run_lowestunprescaled )
    # executed after the previous code. So by this time the files should be
    # in place, if they could be produced.
    install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/LowestUnprescaledLists/unprescaled/
-      DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/TriggerMenu
+      DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/TriggerMenu/api
       USE_SOURCE_PERMISSIONS
       FILES_MATCHING PATTERN "list*.py" )
 
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerAPI.py b/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerAPI.py
index 8aab3e1a96f..88f82f294e9 100644
--- a/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerAPI.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerAPI.py
@@ -10,8 +10,8 @@ from PathResolver import PathResolver
 from AthenaCommon.Logging import logging
 
 class TriggerAPI:
-    centralPickleFile = PathResolver.FindCalibFile("TriggerMenu/TriggerInfo_20180904.pickle")
-    if not centralPickleFile: centralPickleFile = PathResolver.FindCalibFile("TriggerMenu/TriggerInfo_20180725.pickle")
+    centralPickleFile = PathResolver.FindCalibFile("TriggerMenu/TriggerInfo_20180925.pickle")
+    if not centralPickleFile: centralPickleFile = PathResolver.FindCalibFile("TriggerMenu/TriggerInfo_20180904.pickle")
     if centralPickleFile: centralPickleFile = os.path.realpath(centralPickleFile)
     privatePickleFile = "TriggerInfo.pickle"
     dbQueries = {}
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerDataAccess.py b/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerDataAccess.py
index 13ae5d89df7..f8857c04a7b 100644
--- a/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerDataAccess.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerDataAccess.py
@@ -208,6 +208,7 @@ def fillHLTmap( info, hltMap_prev , lbCount, run, grlblocks):
             continue
         if run in LBexceptions.exceptions:
             if any([lbstart>=exc_start and lbstart<=exc_end for exc_start, exc_end in LBexceptions.exceptions[run]]): continue
+            if any([lbend>=exc_start and lbend<=exc_end for exc_start, exc_end in LBexceptions.exceptions[run]]): continue
 
         #print "Accepted:",(lboverlap, lbstart, lbend, grlblocks)
         lbCount += lboverlap
@@ -222,6 +223,9 @@ def fillHLTmap( info, hltMap_prev , lbCount, run, grlblocks):
                 if tmpl1ps < 1: tmpl1ps = 1e99
                 l1ps = min(l1ps, tmpl1ps)
             
+            #if hltps*l1ps!=1 and chainsHLT[hltid][0]=="HLT_mu60_0eta105_msonly": #muon primary since 2015 as standard candle to find problematic LBs
+            #    print "WARNING: Prescaled HLT_mu60_0eta105_msonly",l1ps,hltps,lbstart, lbend, grlblocks
+
             if hltps*l1ps < 1e99: efflb = lboverlap/(hltps*l1ps)
             else:                 efflb = 0
             if not chainsHLT[hltid][0] in hltMap: hltMap[chainsHLT[hltid][0]] = [l1seeds, 0, hltrerun>0]
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerEnums.py b/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerEnums.py
index 670b4cfc933..806a823f15f 100644
--- a/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerEnums.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerEnums.py
@@ -53,7 +53,7 @@ class TriggerPeriod(IntEnum):
     y2018periodBE     = 1 << 14
     y2018periodFI     = 1 << 15
     y2018lowmu        = 1 << 16
-    #y2018periodK      = 1 << 17
+    y2018periodKL     = 1 << 17
 
     runNumber         = 1 << 18 #Can't get higher than this, enters the run number domain
     future1p8e34      = 1 << 19 
@@ -62,7 +62,7 @@ class TriggerPeriod(IntEnum):
     y2017periodB      = y2017periodB1   | y2017periodB2B4 | y2017periodB5B7 | y2017periodB8
     y2017periodD      = y2017periodD1D5 | y2017periodD6
     y2017periodAll    = y2017periodB    | y2017periodC    | y2017periodD    | y2017periodEF | y2017periodGHIK #low-mu period is not considered 
-    y2018             = y2018periodBE   | y2018periodFI   #low-mu period is not considered 
+    y2018             = y2018periodBE   | y2018periodFI   | y2018periodKL  #low-mu period is not considered 
     y2017             = y2017periodAll
     y2016             = y2016periodA    | y2016periodBD3  | y2016periodD4plus
     future            = future1p8e34    | future2e34
@@ -91,8 +91,9 @@ class LBexceptions:
        301932: [(233, 234)], #Accidentaly moved to MuScan prescales
        302831: [(4  , 10 )], #toroid off keys 
        336506: [(212, 260)], #Regular muscan but the defect is not in sync with the switch of keys
-       352448: [(104, 104)], #First LB of emittance scan
        341294: [(137, 156)], #Standby keys
+       355650: [(117, 117)], #Last LB of emittance scan
+       357283: [(117, 117)], #Last LB of emittance scan
        }
 
 class TriggerRenaming:
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerPeriodData.py b/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerPeriodData.py
index cb968109658..8a132eac71d 100644
--- a/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerPeriodData.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerPeriodData.py
@@ -95,14 +95,14 @@ class TriggerPeriodData:
         'G4':(354396,354396,11098),
         'G5':(354476,354494,8.73 ),
 
-        'H':(354826,355224,43.4 ),
         'I':(355261,355273,17318),
         'J':(355331,355468,18781),
-        #'K':(355529,355650,19341), still open
+        'K':(355529,356259,19958),
+        'L':(357050,359171,19935),
     }
     
     grlbase = "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/"
-    y2018grlpath = grlbase+"data18_13TeV/20180702/data18_13TeV.periodAllYear_DetStatus-v100-pro22-02_Unknown_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.xml"
+    y2018grlpath = grlbase+"data18_13TeV/20180906/data18_13TeV.periodAllYear_DetStatus-v102-pro22-03_Unknown_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.xml"
     y2017grlpath = grlbase+"data17_13TeV/20180619/data17_13TeV.periodAllYear_DetStatus-v99-pro22-01_Unknown_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.xml"
     y2016grlpath = grlbase+"data16_13TeV/20180129/data16_13TeV.periodAllYear_DetStatus-v89-pro21-01_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.xml"
     y2015grlpath = grlbase+"data15_13TeV/20170619/data15_13TeV.periodAllYear_DetStatus-v89-pro21-02_Unknown_PHYS_StandardGRL_All_Good_25ns.xml"
@@ -197,13 +197,13 @@ class TriggerPeriodData:
                 ranges.append( self.periodMap2018['G1'] )
                 ranges.append( self.periodMap2018['G2'] )
                 ranges.append( self.periodMap2018['G3'] )
-                ranges.append( self.periodMap2018['H'] )
                 ranges.append( self.periodMap2018['I'] )
             if period & TriggerPeriod.y2018lowmu       :
                 ranges.append( self.periodMap2018['G4'] )
                 ranges.append( self.periodMap2018['J'] )
-            #if period & TriggerPeriod.y2018periodK    :
-            #    ranges.append( self.periodMap2018['K'] )
+            if period & TriggerPeriod.y2018periodKL   :
+                ranges.append( self.periodMap2018['K'] )
+                ranges.append( self.periodMap2018['L'] )
             for run in self.grl.keys()[:]:
                 if not any([run >= x[0] and run <= x[1] for x in ranges]): self.grl.pop(run)
 
-- 
GitLab