CMS 3D CMS Logo

Functions

hltTrgSeedMapper Namespace Reference

Functions

def findUniqueSeed

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 2 of file hltTrgSeedMapper.py.

00003                                    :
00004     '''
00005     given a hltpath and its L1SeedExpression, find the L1 bit name
00006     can return None
00007     
00008     if hltPath contains the following, skip do not parse seed.
00009     
00010     FakeHLTPATH*, HLT_Physics*, HLT_*Calibration*, HLT_HFThreashold,
00011     HLT_MiniBias*,HLT_Random*,HLTTriggerFinalPath,HLT_PixelFED*
00012 
00013     parse hltpath contains at most 2 logics x OR y, x AND y, and return left val
00014     do not consider path containing operator NOT
00015 
00016     '''
00017     if re.match('FakeHLTPATH',hltPath)!=None :
00018         return None
00019     if re.match('HLT_Physics',hltPath)!=None :
00020         return None
00021     if re.match('HLT_[aA-zZ]*Calibration',hltPath)!=None :
00022         return None
00023     if re.match('HLT_[aA-zZ]*Threshold',hltPath)!=None :
00024         return None
00025     if re.match('HLT_MiniBias',hltPath)!=None :
00026         return None
00027     if re.match('HLT_Random',hltPath)!=None :
00028         return None
00029     if re.match('HLTriggerFinalPath',hltPath)!=None :
00030         return None
00031     if re.match('HLT_[aA-zZ]*FEDSize',hltPath)!=None :
00032         return None
00033     if ExprStr.find('(')!=-1 : #we don't parse expression with ()
00034         return None
00035     sep=re.compile('(\sAND\s|\sOR\s)',re.IGNORECASE)
00036     result=re.split(sep,ExprStr)
00037     if len(result)>3:
00038         return ('',None)
00039     cleanresult=[]
00040     exptype=''
00041     notsep=re.compile('NOT\s',re.IGNORECASE)
00042     andsep=re.compile('\sAND\s',re.IGNORECASE)
00043     orsep=re.compile('\sOR\s',re.IGNORECASE)
00044 
00045     for r in result:
00046         if notsep.match(r) : #we don't know what to do with NOT
00047             return ('',None)
00048         if orsep.match(r):
00049             exptype='OR'
00050             continue
00051         if andsep.match(r):
00052             exptype='AND'
00053             continue
00054         cleanresult.append('"'+string.strip(r).replace('\"','')+'"')
00055     return (exptype,cleanresult)