Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:06:47

0001 #!/usr/bin/env python3
0002 from __future__ import print_function
0003 import os,string,sys,time
0004 
0005 # template file to be used
0006 MODFILE="reco_skim_cfg_mod.py"
0007 
0008 # the output file is PREFIX_date.root
0009 PREFIX="SkimSM"
0010 
0011 # it produces a file every NUEVENTS events
0012 NUMEVENTS="-1"
0013 
0014 # here starts the main
0015 
0016 if len(sys.argv)!=2 :
0017     print("Usage = runonSM.py <type>")
0018     print("where type is either \"tunnel\" or \"revproxy\" or \"playback\" ")
0019     sys.exit(1)
0020 
0021 TYPE=sys.argv[1]
0022 
0023 if TYPE=="tunnel" :
0024     SOURCE="cms.string('http://localhost:22100/urn:xdaq-application:lid=30')"
0025     SELECTHLT= "cms.untracked.string('hltOutputDQM')"
0026 elif TYPE=="revproxy":
0027     SOURCE="cms.string('http://cmsdaq0.cern.ch/event-server/urn:xdaq-application:lid=30')"
0028     SELECTHLT= "cms.untracked.string('hltOutputDQM')"
0029 elif TYPE=="playback":
0030     SOURCE="cms.string('http://localhost:50082/urn:xdaq-application:lid=29')"
0031     SELECTHLT= "cms.untracked.string('hltOutputDQM')"
0032 else:
0033     print("wrong type value.")
0034     sys.exit(1)
0035     
0036 while True:
0037     DATE=str(int(time.time()))
0038     print("Suffix:"+DATE)
0039     FILENAME=PREFIX+"_"+DATE+"_cfg.py"
0040     FILELOG=PREFIX+"_"+DATE+".log"
0041     # read mod file
0042     modfile=open(MODFILE,"r")
0043     text=modfile.read()
0044     modfile.close()
0045     text=text.replace("SUFFIX",DATE)
0046     text=text.replace("SOURCE",SOURCE)
0047     text=text.replace("NUMEVENTS",NUMEVENTS)
0048     text=text.replace("SELECTHLT",SELECTHLT)
0049     newfile=open(FILENAME,"w")
0050     newfile.write(text)
0051     newfile.close()
0052                  
0053     print("Created: "+FILENAME+" . Running cmsRun now and logging in "+FILELOG)
0054     os.system("cmsRun "+FILENAME+" 2>&1 | tee "+FILELOG+" | grep  --line-buffered -e \"Begin processing\" -e \"BeamSplash\" -e \"PhysDecl\"")