Commit 9e52e7fa authored by Javier Montejo Berlingen's avatar Javier Montejo Berlingen
Browse files

Merge branch 'branchname' into 'master'

Branchname

See merge request !10
parents 3f175d81 33f209f9
......@@ -141,11 +141,13 @@ class TriggerAPI:
if (period,cls.customGRL) not in cls.dbQueries:
if TriggerPeriod.isRunNumber(period) or (isinstance(period,TriggerPeriod) and period.isBasePeriod()):
cls.dbQueries[(period,cls.customGRL)] = TriggerInfo(period,cls.customGRL,cls.release)
print("passed 1st")
else:
basePeriods = [tp for tp in TriggerPeriod.basePeriods() if tp & period]
for bp in basePeriods:
cls._loadTriggerPeriod(bp,reparse)
cls.dbQueries[(period,cls.customGRL)] = TriggerInfo.merge([cls.dbQueries[(bp,cls.customGRL)] for bp in basePeriods])
print("passed 2nd")
if reparse: cls.dbQueries[(period,cls.customGRL)].reparse()
@classmethod
......
......@@ -181,6 +181,7 @@ def fillHLTmap( info, hltMap_prev , lbCount, run, grlblocks):
lbstart, lbend = lbrange[2], lbrange[4]
if lbend ==-1: lbend = 2000
l1psname, l1prescales = getL1Prescales('TRIGGERDB', lbrange[0])
l1prescales = list(l1prescales)
l1prescales = {l1name: l1prescales[int(l1id)] for (l1name, l1id) in six.iteritems (items)}
tmpl1List.append(( lbstart, lbend,l1prescales) )
......
......@@ -5,25 +5,32 @@ __version__="$Revision: 2.0 $"
__doc__="Enumerations for trigger types and periods"
from enum import IntEnum
class TriggerType(IntEnum):
el_single = 1 << 0
el_multi = 1 << 1
mu_single = 1 << 2
mu_multi = 1 << 3
j_single = 1 << 4
j_multi = 1 << 5
bj_single = 1 << 6
bj_multi = 1 << 7
tau_single = 1 << 8
tau_multi = 1 << 9
g_single = 1 << 10
g_multi = 1 << 11
xe = 1 << 12
ht = 1 << 13
mu_bphys = 1 << 14
exotics = 1 << 15
afp = 1 << 16
from enum import IntFlag
from enum import Flag
from enum import Enum
from enum import auto
class TriggerType(IntFlag):
el_single = auto()
el_multi = auto()
mu_single = auto()
mu_multi = auto()
j_single = auto()
j_multi = auto()
bj_single = auto()
bj_multi = auto()
tau_single = auto()
tau_multi = auto()
g_single = auto()
g_multi = auto()
xe = auto()
ht = auto()
mu_bphys = auto()
exotics = auto()
afp = auto()
upc = auto()
ucc = auto()
minbias = auto()
el = el_single | el_multi
mu = mu_single | mu_multi
......@@ -32,52 +39,57 @@ class TriggerType(IntEnum):
tau = tau_single| tau_multi
g = g_single | g_multi
ALL = el | mu | j | bj | tau | g | xe | ht | mu_bphys | exotics | afp
ALL = el | mu | j | bj | tau | g | xe | ht | mu_bphys | exotics | afp | upc | ucc | minbias
UNDEFINED = 0
class TriggerPeriod(IntEnum):
y2015 = 1 << 0
y2016periodA = 1 << 1
y2016periodBD3 = 1 << 2
y2016periodD4plus = 1 << 3
y2017periodB1 = 1 << 4
y2017periodB2B4 = 1 << 5
y2017periodB5B7 = 1 << 6
y2017periodB8 = 1 << 7
y2017periodC = 1 << 8
y2017periodD1D5 = 1 << 9
y2017periodD6 = 1 << 10
y2017periodEF = 1 << 11
y2017periodGHIK = 1 << 12
y2017lowmu = 1 << 13
y2018periodBE = 1 << 14
y2018periodFI = 1 << 15
y2018lowmu = 1 << 16
y2018periodKQ = 1 << 17
runNumber = 1 << 18 #Can't get higher than this, enters the run number domain
future1p8e34 = 1 << 19
future2e34 = 1 << 20
class TriggerPeriod(IntFlag):
y2015 = auto()
y2015PbPb = auto()
y2016periodA = auto()
y2016periodBD3 = auto()
y2016periodD4plus = auto()
y2016pPb5TeV = auto()
y2016pPb8TeV = auto()
y2017periodB1 = auto()
y2017periodB2B4 = auto()
y2017periodB5B7 = auto()
y2017periodB8 = auto()
y2017periodC = auto()
y2017periodD1D5 = auto()
y2017periodD6 = auto()
y2017periodEF = auto()
y2017periodGHIK = auto()
y2017lowmu = auto()
y2017XeXe = auto()
y2018periodBE = auto()
y2018periodFI = auto()
y2018lowmu = auto()
y2018periodKQ = auto()
y2018PbPb = auto()
future1p8e34 = auto()
future2e34 = auto()
y2017periodB = y2017periodB1 | y2017periodB2B4 | y2017periodB5B7 | y2017periodB8
y2017periodD = y2017periodD1D5 | y2017periodD6
y2017periodAll = y2017periodB | y2017periodC | y2017periodD | y2017periodEF | y2017periodGHIK #low-mu period is not considered
y2018 = y2018periodBE | y2018periodFI | y2018periodKQ #low-mu period is not considered
y2017 = y2017periodAll
y2018 = y2018periodBE | y2018periodFI | y2018periodKQ #low-mu period isnot considered
y2017 = y2017periodB | y2017periodC | y2017periodD | y2017periodEF | y2017periodGHIK #low-mu period is not considered
y2017periodAll = y2017
y2016 = y2016periodA | y2016periodBD3 | y2016periodD4plus
future = future1p8e34 | future2e34
def isBasePeriod(self):
return TriggerPeriod.isRunNumber(self) or all([self & x == 0 or self & x == self for x in TriggerPeriod])
return TriggerPeriod.isRunNumber(self) or all([self&x==0 or self&x==self for x in TriggerPeriod])
@classmethod
def isRunNumber(cls, number):
try:
number = int(number)
except ValueError:
if isinstance(number, Flag):
return False
return (number==0 or (number > TriggerPeriod.runNumber and number < TriggerPeriod.runNumber*2))
if isinstance(number, int):
return True
return False
@classmethod
def basePeriods(cls):
......
......@@ -19,7 +19,6 @@ class TriggerInfo:
self.triggerChains = []
self.period = period
self.totalLB = 0
if not period: return
from .TriggerDataAccess import getHLTlist
HLTlist, totalLB = getHLTlist(period, customGRL, release)
......@@ -108,6 +107,9 @@ class TriggerLeg:
bphyspattern = re.compile('b[A-Z]')
exoticspattern = re.compile('llp|LLP|muvtx|hiptrt|LATE|NOMATCH')
afppattern = re.compile('afp|AFP')
upcpattern = re.compile('upc|UPC')
uccpattern = re.compile('ucc|UCC')
minbiaspattern = re.compile('minbias|MINBIAS|zdcpeb|ZDCPEB')
def __init__(self,legname, chainseed, chainname=None):
self.legname = legname
......@@ -154,6 +156,12 @@ class TriggerLeg:
self.legtype = TriggerType.exotics
if self.afppattern.search(token):
self.legtype = TriggerType.afp
if self.upcpattern.search(token):
self.legtype = TriggerType.upc
if self.uccpattern.search(token):
self.legtype = TriggerType.ucc
if self.minbiaspattern.search(token):
self.legtype = TriggerType.minbias
details.append(token)
for l1seed in blocks[1:]:
......@@ -161,6 +169,12 @@ class TriggerLeg:
self.legtype = TriggerType.exotics
if self.afppattern.search(l1seed):
self.legtype = TriggerType.afp
if self.upcpattern.search(l1seed):
self.legtype = TriggerType.upc
if self.uccpattern.search(l1seed):
self.legtype = TriggerType.ucc
if self.minbiaspattern.search(l1seed):
self.legtype = TriggerType.minbias
if l1seed == chainseed: continue
else:
assert self.l1seed=="", (self.l1seed, chainseed, chainname, blocks[1:])
......@@ -398,11 +412,17 @@ class TriggerChain:
mtype |= TriggerType.exotics
elif l.legtype & TriggerType.afp:
mtype = TriggerType.afp #on purpose not OR-ed
elif l.legtype & TriggerType.upc:
mtype = TriggerType.upc
elif l.legtype & TriggerType.ucc:
mtype = TriggerType.ucc
elif l.legtype & TriggerType.minbias:
mtype = TriggerType.minbias
else:
mtype |= l.legtype
l1seed= l1seed.replace("L1_","")
if mtype & TriggerType.exotics or mtype & TriggerType.afp:
if (mtype & TriggerType.exotics) or (mtype & TriggerType.afp) or (mtype & TriggerType.upc) or (mtype & TriggerType.ucc) or (mtype & TriggerType.minbias):
return mtype
for token in l1seed.split("_"):
m = self.l1pattern.match(token)
......
......@@ -105,6 +105,21 @@ class TriggerPeriodData:
'O':(361738,363400,19822),
'Q':(363664,364292,19618),
}
periodMap2015_HI_PbPb = {
'All':(286665, 287931, 0)
}
periodMap2016_5TeV_pPb = {
'All':(312649, 314199, 0)
}
periodMap2016_8TeV_pPb = {
'All':(313063, 314170, 0)
}
periodMap2017_HI_XeXe = {
'All':(338037, 338037, 0)
}
periodMap2018_HI_PbPb = {
'All':(365498, 367384, 0)
}
grlbase = "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/"
y2018grlpath = grlbase+"data18_13TeV/20181105/data18_13TeV.periodAllYear_DetStatus-v102-pro22-04_Unknown_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.xml"
......@@ -113,24 +128,40 @@ class TriggerPeriodData:
y2015grlpath = grlbase+"data15_13TeV/20170619/data15_13TeV.periodAllYear_DetStatus-v89-pro21-02_Unknown_PHYS_StandardGRL_All_Good_25ns.xml"
y2017lowmugrlpath = grlbase+"data17_13TeV/20180117/data17_13TeV.periodN_DetStatus-v98-pro21-16_Unknown_PHYS_StandardGRL_All_Good_25ns_ignore_GLOBAL_LOWMU.xml"
y2018lowmugrlpath = grlbase+"data18_13TeV/20180830/data18_13TeV.periodG4J_MERGED_PHYS_StandardGRL_All_Good_25ns_ignore_GLOBAL_LOWMU.xml"
y2015_HI_PbPb_path = grlbase+"data15_hi/20190708/data15_hi.periodAllYear_DetStatus-v105-pro22-13_Unknown_PHYS_HeavyIonP_All_Good_tolerable_L1CALmisconfigSatBCID.xml"
y2016_5TeV_pPb_path = grlbase+"data16_hip/20190708/data16_hip5TeV.periodAllYear_DetStatus-v105-pro22-13_Unknown_PHYS_HeavyIonP_All_Good.xml"
y2016_8TeV_pPb_path = grlbase+"data16_hip/20190708/data16_hip8TeV.periodAllYear_DetStatus-v105-pro22-13_Unknown_PHYS_HeavyIonP_All_Good.xml"
y2017_HI_XeXe_path = grlbase+"data17_hi/20190706/data17_hi.periodAllYear_DetStatus-v105-pro22-13_Unknown_PHYS_StandardGRL_All_Good.xml"
y2018_HI_PbPb_path = grlbase+"data18_hi/20190731/data18_hi.periodAllYear_DetStatus-v106-pro22-14_Unknown_PHYS_HeavyIonP_All_Good.xml"
def __init__(self, period, customGRL=None):
self.grl = {}
if customGRL:
self.loadGRL(customGRL)
elif TriggerPeriod.isRunNumber(period): #run number assume 2018
self.loadGRL(self.y2018grlpath)
elif period & TriggerPeriod.y2015:
elif period & TriggerPeriod.y2015:
self.loadGRL(self.y2015grlpath)
elif period & TriggerPeriod.y2016:
elif period & TriggerPeriod.y2016:
self.loadGRL(self.y2016grlpath)
elif period & TriggerPeriod.y2017lowmu:
elif period & TriggerPeriod.y2017lowmu:
self.loadGRL(self.y2017lowmugrlpath)
elif period & TriggerPeriod.y2017:
elif period & TriggerPeriod.y2017:
self.loadGRL(self.y2017grlpath)
elif period & TriggerPeriod.y2018lowmu:
elif period & TriggerPeriod.y2018lowmu:
self.loadGRL(self.y2018lowmugrlpath)
elif period & TriggerPeriod.y2018:
elif period & TriggerPeriod.y2018:
self.loadGRL(self.y2018grlpath)
elif period & TriggerPeriod.y2015PbPb:
self.loadGRL(self.y2015_HI_PbPb_path)
elif period & TriggerPeriod.y2016pPb5TeV:
self.loadGRL(self.y2016_5TeV_pPb_path)
elif period & TriggerPeriod.y2016pPb8TeV:
self.loadGRL(self.y2016_8TeV_pPb_path)
elif period & TriggerPeriod.y2017XeXe:
self.loadGRL(self.y2017_HI_XeXe_path)
elif period & TriggerPeriod.y2018PbPb:
self.loadGRL(self.y2018_HI_PbPb_path)
self.skimPeriod(period)
def loadGRL(self, grlpath):
......@@ -213,6 +244,16 @@ class TriggerPeriodData:
ranges.append( self.periodMap2018['N'] )
ranges.append( self.periodMap2018['O'] )
ranges.append( self.periodMap2018['Q'] )
if period & TriggerPeriod.y2015PbPb :
ranges.append( self.periodMap2015_HI_PbPb['All'])
if period & TriggerPeriod.y2016pPb5TeV :
ranges.append( self.periodMap2016_5TeV_pPb['All'])
if period & TriggerPeriod.y2016pPb8TeV :
ranges.append( self.periodMap2016_8TeV_pPb['All'])
if period & TriggerPeriod.y2017XeXe :
ranges.append( self.periodMap2017_HI_XeXe['All'])
if period & TriggerPeriod.y2018PbPb :
ranges.append( self.periodMap2018_HI_PbPb['All'])
for run in list(self.grl.keys()):
if not any([run >= x[0] and run <= x[1] for x in ranges]): self.grl.pop(run)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment