CMS 3D CMS Logo

runonSM_350.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 from __future__ import print_function
3 import os,string,sys,commands,time
4 
5 # template file to be used
6 MODFILE="reco_skim_cfg_mod_350.py"
7 
8 # the output file is PREFIX_date.root
9 PREFIX="SkimSM"
10 AREA="/afs/cern.ch/cms/CAF/CMSCOMM/COMM_GLOBAL/EventDisplay/RootFileTempStorageArea"
11 
12 # it produces a file every NUEVENTS events
13 NUMEVENTS="-1"
14 
15 # here starts the main
16 
17 if len(sys.argv)!=2 :
18  print("Usage = runonSM.py <type>")
19  print("where type is either \"tunnel\" or \"revproxy\" or \"playback\" ")
20  sys.exit(1)
21 
22 TYPE=sys.argv[1]
23 
24 if TYPE=="tunnel" :
25  SOURCE="cms.string('http://localhost:22100/urn:xdaq-application:lid=30')"
26  SELECTHLT= "cms.untracked.string('hltOutputDQM')"
27 elif TYPE=="revproxy":
28  SOURCE="cms.string('http://cmsdaq0.cern.ch/event-server/urn:xdaq-application:lid=30')"
29  SELECTHLT= "cms.untracked.string('hltOutputDQM')"
30 elif TYPE=="playback":
31  SOURCE="cms.string('http://localhost:50082/urn:xdaq-application:lid=29')"
32  SELECTHLT= "cms.untracked.string('hltOutputDQM')"
33 else:
34  print("wrong type value.")
35  sys.exit(1)
36 
37 while True:
38  DATE=str(int(time.time()))
39  print("Suffix:"+DATE)
40  FILENAME=PREFIX+"_"+DATE+"_cfg.py"
41  FILELOG=PREFIX+"_"+DATE+".log"
42  # read mod file
43  modfile=open(MODFILE,"r")
44  text=modfile.read()
45  modfile.close()
46  text=text.replace("SUFFIX",DATE)
47  text=text.replace("SOURCE",SOURCE)
48  text=text.replace("NUMEVENTS",NUMEVENTS)
49  text=text.replace("SELECTHLT",SELECTHLT)
50  text=text.replace("EVDISPSM_DIR",AREA)
51  newfile=open(FILENAME,"w")
52  newfile.write(text)
53  newfile.close()
54 
55  print("Created: "+FILENAME+" . Running cmsRun now and logging in "+FILELOG)
56  os.system("cmsRun "+FILENAME+" 2>&1 | tee "+FILELOG+" | grep --line-buffered -e \"Begin processing\" -e \"BeamSplash\" -e \"PhysDecl\"")
str
#define str(s)
Definition: TestProcessor.cc:48
createfilelist.int
int
Definition: createfilelist.py:10
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66