CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/Validation/Performance/scripts/cmsRelValCmd.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #Parsing the $CMSSW_RELEASE_BASE/src/Configuration/PyReleaseValidation/data/cmsDriver_highstats_htl.txt file
00003 #to look for necessary cmsdriver extra options
00004 
00005 import os, re
00006 
00007 #Assuming high statistics RelVal cmsDriver command file to be named:
00008 cmsDriverCmd="cmsDriver_highstats_hlt.txt"
00009 #And to be found at:
00010 cmsDriverCmdPath=os.environ["CMSSW_RELEASE_BASE"]+"/src/Configuration/PyReleaseValidation/data"
00011 
00012 def get_cmsDriverOptions():
00013     '''Function returns a string with the cmsDriver.py options relevant to the performance suite used in file cmsDriver_highstats_hlt.txt  in package Configuration/PyReleaseValidation/data\n'''
00014     filename=os.path.join(cmsDriverCmdPath,cmsDriverCmd)
00015     cmsDriverOptions=""
00016     if os.path.exists(filename):
00017         file=open(filename,"r")
00018         TTbar=re.compile("TTbar")
00019         STARTUP=re.compile("STARTUP")
00020         GENSIM=re.compile("GEN,SIM")
00021         option=re.compile("^--")
00022         for line in file.readlines():
00023             #Always pick the TTbar with IDEAL geometry line to pick up the "standard" options:
00024             if TTbar.search(line) and STARTUP.search(line) and GENSIM.search(line):
00025                 tokens=line.split()
00026                 #print line
00027                 #print tokens
00028                 for token in tokens:
00029                     found = option.search(token)
00030                     #Here we can filter out the options we don't care about:
00031                     #--relval
00032                     #--datatier
00033                     if found and not (found.string == "--relval" or found.string == "--datatier"): 
00034                         cmsDriverOptions=cmsDriverOptions+found.string+" "+tokens[tokens.index(found.string)+1]+" "
00035         return cmsDriverOptions
00036     else:
00037         print "Could not find file %s!\n"%filename
00038         return NULL