CMS 3D CMS Logo

Functions
hltTrgSeedMapper Namespace Reference

Functions

def findUniqueSeed (hltPath, ExprStr)
 

Function Documentation

def hltTrgSeedMapper.findUniqueSeed (   hltPath,
  ExprStr 
)
given a hltpath and its L1SeedExpression, find the L1 bit name
can return None

if hltPath contains the following, skip do not parse seed.

FakeHLTPATH*, HLT_Physics*, HLT_*Calibration*, HLT_HFThreashold,
HLT_MiniBias*,HLT_Random*,HLTTriggerFinalPath,HLT_PixelFED*

parse hltpath contains at most 2 logics x OR y, x AND y, and return left val
do not consider path containing operator NOT

Definition at line 3 of file hltTrgSeedMapper.py.

References edm.print(), and python.rootplot.root2matplotlib.replace().

Referenced by lumiCalcAPI.effectiveLumiForIds(), and lumiCalcAPI.hltpathsForRange().

3 def findUniqueSeed(hltPath,ExprStr):
4  '''
5  given a hltpath and its L1SeedExpression, find the L1 bit name
6  can return None
7 
8  if hltPath contains the following, skip do not parse seed.
9 
10  FakeHLTPATH*, HLT_Physics*, HLT_*Calibration*, HLT_HFThreashold,
11  HLT_MiniBias*,HLT_Random*,HLTTriggerFinalPath,HLT_PixelFED*
12 
13  parse hltpath contains at most 2 logics x OR y, x AND y, and return left val
14  do not consider path containing operator NOT
15 
16  '''
17  if re.match('FakeHLTPATH',hltPath)!=None :
18  return None
19  if re.match('HLT_Physics',hltPath)!=None :
20  return None
21  if re.match('HLT_[aA-zZ]*Calibration',hltPath)!=None :
22  return None
23  if re.match('HLT_[aA-zZ]*Threshold',hltPath)!=None :
24  return None
25  if re.match('HLT_MiniBias',hltPath)!=None :
26  return None
27  if re.match('HLT_Random',hltPath)!=None :
28  return None
29  if re.match('HLTriggerFinalPath',hltPath)!=None :
30  return None
31  if re.match('HLT_[aA-zZ]*FEDSize',hltPath)!=None :
32  return None
33  if ExprStr.find('(')!=-1 : #we don't parse expression with ()
34  return None
35  sep=re.compile('(\sAND\s|\sOR\s)',re.IGNORECASE)
36  result=re.split(sep,ExprStr)
37  if len(result)>3:
38  return ('',None)
39  cleanresult=[]
40  exptype=''
41  notsep=re.compile('NOT\s',re.IGNORECASE)
42  andsep=re.compile('\sAND\s',re.IGNORECASE)
43  orsep=re.compile('\sOR\s',re.IGNORECASE)
44 
45  for r in result:
46  if notsep.match(r) : #we don't know what to do with NOT
47  return ('',None)
48  if orsep.match(r):
49  exptype='OR'
50  continue
51  if andsep.match(r):
52  exptype='AND'
53  continue
54  cleanresult.append('"'+string.strip(r).replace('\"','')+'"')
55  return (exptype,cleanresult)
56 
def replace(string, replacements)
def findUniqueSeed(hltPath, ExprStr)