Go to the documentation of this file.00001 import re
00002 def findUniqueSeed(hltPath,ExprStr):
00003 '''
00004 given a hltpath and its L1SeedExpression, find the L1 bit name
00005 can return None
00006
00007 if hltPath contains the following, skip do not parse seed.
00008
00009 FakeHLTPATH*, HLT_Physics*, HLT_*Calibration*, HLT_HFThreashold,
00010 HLT_MiniBias*,HLT_Random*,HLTTriggerFinalPath,HLT_PixelFED*
00011
00012 parse hltpath contains at most 2 logics x OR y, x AND y, and return left val
00013 do not consider path containing operator NOT
00014
00015 '''
00016 if re.match('FakeHLTPATH',hltPath)!=None :
00017 return None
00018 if re.match('HLT_Physics',hltPath)!=None :
00019 return None
00020 if re.match('HLT_[aA-zZ]*Calibration',hltPath)!=None :
00021 return None
00022 if re.match('HLT_[aA-zZ]*Threshold',hltPath)!=None :
00023 return None
00024 if re.match('HLT_MiniBias',hltPath)!=None :
00025 return None
00026 if re.match('HLT_Random',hltPath)!=None :
00027 return None
00028 if re.match('HLTTriggerFinalPath',hltPath)!=None :
00029 return None
00030 if re.match('HLT_[aA-zZ]*FEDSize',hltPath)!=None :
00031 return None
00032 if ExprStr.find('(')!=-1 :
00033 return None
00034 sep=re.compile('\sAND\s|\sOR\s')
00035 result=re.split(sep,ExprStr)
00036 if len(result)>2:
00037 return None
00038 for r in result:
00039 if r.find('NOT ')!=-1 :
00040 return None
00041
00042 return result[0]
00043
00044 if __name__=='__main__':
00045 print findUniqueSeed("HLT_ForwardBSC","36 OR 37")
00046 print findUniqueSeed("HLT_HcalNZS_8E29","L1_SingleEG1 OR L1_SingleEG2 OR L1_SingleEG5 OR L1_SingleEG8 OR L1_SingleEG10")
00047 print findUniqueSeed("HLT_ZeroBiasPixel_SingleTrack","L1_ZeroBias")
00048