CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
runonSM_350.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_350.py"
6 
7 # the output file is PREFIX_date.root
8 PREFIX="SkimSM"
9 AREA="/afs/cern.ch/cms/CAF/CMSCOMM/COMM_GLOBAL/EventDisplay/RootFileTempStorageArea"
10 
11 # it produces a file every NUEVENTS events
12 NUMEVENTS="-1"
13 
14 # here starts the main
15 
16 if len(sys.argv)!=2 :
17  print "Usage = runonSM.py <type>"
18  print "where type is either \"tunnel\" or \"revproxy\" or \"playback\" "
19  sys.exit(1)
20 
21 TYPE=sys.argv[1]
22 
23 if TYPE=="tunnel" :
24  SOURCE="cms.string('http://localhost:22100/urn:xdaq-application:lid=30')"
25  SELECTHLT= "cms.untracked.string('hltOutputDQM')"
26 elif TYPE=="revproxy":
27  SOURCE="cms.string('http://cmsdaq0.cern.ch/event-server/urn:xdaq-application:lid=30')"
28  SELECTHLT= "cms.untracked.string('hltOutputDQM')"
29 elif TYPE=="playback":
30  SOURCE="cms.string('http://localhost:50082/urn:xdaq-application:lid=29')"
31  SELECTHLT= "cms.untracked.string('hltOutputDQM')"
32 else:
33  print "wrong type value."
34  sys.exit(1)
35 
36 while True:
37  DATE=str(int(time.time()))
38  print "Suffix:"+DATE
39  FILENAME=PREFIX+"_"+DATE+"_cfg.py"
40  FILELOG=PREFIX+"_"+DATE+".log"
41  # read mod file
42  modfile=open(MODFILE,"r")
43  text=modfile.read()
44  modfile.close()
45  text=text.replace("SUFFIX",DATE)
46  text=text.replace("SOURCE",SOURCE)
47  text=text.replace("NUMEVENTS",NUMEVENTS)
48  text=text.replace("SELECTHLT",SELECTHLT)
49  text=text.replace("EVDISPSM_DIR",AREA)
50  newfile=open(FILENAME,"w")
51  newfile.write(text)
52  newfile.close()
53 
54  print "Created: "+FILENAME+" . Running cmsRun now and logging in "+FILELOG
55  os.system("cmsRun "+FILENAME+" 2>&1 | tee "+FILELOG+" | grep --line-buffered -e \"Begin processing\" -e \"BeamSplash\" -e \"PhysDecl\"")