CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
runonSMtunnel.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import os,string,sys,commands,time
3 
4 # template file to be used
5 MODFILE="reco_skim_cfg_mod.py"
6 
7 # the output file is PREFIX_date.root
8 PREFIX="SkimSM"
9 
10 # it produces a file every NUEVENTS events
11 NUMEVENTS="-1"
12 
13 while True:
14  DATE=str(int(time.time()))
15  print "Suffix:"+DATE
16  FILENAME=PREFIX+"_"+DATE+"_cfg.py"
17  FILELOG=PREFIX+"_"+DATE+".log"
18  COMMAND="sed 's/SUFFIX/"+DATE+"/;s/NUMEVENTS/"+NUMEVENTS+"/' "+MODFILE+" > "+FILENAME
19  os.system(COMMAND)
20  print "Created: "+FILENAME+" . Running cmsRun now and logging in "+FILELOG
21  os.system("cmsRun "+FILENAME+" 2>&1 | tee "+FILELOG+" | grep --line-buffered -e \"Begin processing\" -e \"BeamSplash\"")