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