CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DPGAnalysis/Skims/python/runonSM.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import os,string,sys,commands,time
00003 
00004 # template file to be used
00005 MODFILE="reco_skim_cfg_mod.py"
00006 
00007 # the output file is PREFIX_date.root
00008 PREFIX="SkimSM"
00009 
00010 # it produces a file every NUEVENTS events
00011 NUMEVENTS="-1"
00012 
00013 # here starts the main
00014 
00015 if len(sys.argv)!=2 :
00016     print "Usage = runonSM.py <type>"
00017     print "where type is either \"tunnel\" or \"revproxy\" or \"playback\" "
00018     sys.exit(1)
00019 
00020 TYPE=sys.argv[1]
00021 
00022 if TYPE=="tunnel" :
00023     SOURCE="cms.string('https://localhost:22100/urn:xdaq-application:lid=30')"
00024     SELECTHLT= "cms.untracked.string('hltOutputDQM')"
00025 elif TYPE=="revproxy":
00026     SOURCE="cms.string('https://cmsdaq0.cern.ch/event-server/urn:xdaq-application:lid=30')"
00027     SELECTHLT= "cms.untracked.string('hltOutputDQM')"
00028 elif TYPE=="playback":
00029     SOURCE="cms.string('https://localhost:50082/urn:xdaq-application:lid=29')"
00030     SELECTHLT= "cms.untracked.string('hltOutputDQM')"
00031 else:
00032     print "wrong type value."
00033     sys.exit(1)
00034     
00035 while True:
00036     DATE=str(int(time.time()))
00037     print "Suffix:"+DATE
00038     FILENAME=PREFIX+"_"+DATE+"_cfg.py"
00039     FILELOG=PREFIX+"_"+DATE+".log"
00040     # read mod file
00041     modfile=open(MODFILE,"r")
00042     text=modfile.read()
00043     modfile.close()
00044     text=text.replace("SUFFIX",DATE)
00045     text=text.replace("SOURCE",SOURCE)
00046     text=text.replace("NUMEVENTS",NUMEVENTS)
00047     text=text.replace("SELECTHLT",SELECTHLT)
00048     newfile=open(FILENAME,"w")
00049     newfile.write(text)
00050     newfile.close()
00051                  
00052     print "Created: "+FILENAME+" . Running cmsRun now and logging in "+FILELOG
00053     os.system("cmsRun "+FILENAME+" 2>&1 | tee "+FILELOG+" | grep  --line-buffered -e \"Begin processing\" -e \"BeamSplash\" -e \"PhysDecl\"")