-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCMSSW_setup_tracker_maps.py
More file actions
executable file
·74 lines (56 loc) · 2.47 KB
/
CMSSW_setup_tracker_maps.py
File metadata and controls
executable file
·74 lines (56 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Work with CMSSW up to release 11_0_1
# Might work with further releases up to when the TkMap_script_phase1.py is replaced
# with TkMaps_from_eos.py
# Has to be added to the VMCMS066 home of the cctrack user
#!/usr/bin/env python3
import argparse
import subprocess
import os
import re
CMSSW_RELEASE = "CMSSW_11_0_1"
PATH = "/home/cctrack/" + CMSSW_RELEASE + "/src/DQM/SiStripMonitorClient/scripts"
CERT = "/data/proxy/"
PROXY = "/tmp/x509up_trackermaps_proxy"
def parse_arguments():
parser = argparse.ArgumentParser(description='Run Tracker Maps Script')
parser.add_argument('run_type',
help='run type')
parser.add_argument('min', type=int,
help='minimum run number')
parser.add_argument('max', type=int,
help='maximum run number')
args = parser.parse_args()
return args
def check_CMSSW():
if os.path.isdir("/home/cctrack/" + CMSSW_RELEASE):
return
list_of_commands = [
"/cvmfs/cms.cern.ch/cmsset_default.sh",
"cmsrel " + CMSSW_RELEASE,
"cd /home/cctrack/" + CMSSW_RELEASE + "/src",
"cmsenv",
"git cms-init",
"git cms-addpkg DQM/SiStripMonitorClient",
"scram b",
]
process = subprocess.Popen(['/bin/csh', '-c'," && ".join(list_of_commands)], stdout=subprocess.PIPE).stdout
print(process.read().decode())
def main():
args = parse_arguments()
# Ensure the user cannot use symbols that can be interpreted by csh
pattern = re.compile("[a-zA-Z]+$")
if not pattern.match(str(args.run_type)):
print(str(args.run_type) + ": Wrong Run Type")
return
check_CMSSW()
tracker_maps_command = "python " + PATH + "/TkMap_script_phase1.py " + str(args.run_type) + " " + str(args.min) + " " + str(args.max)
list_of_commands = [
"voms-proxy-init --cert " + CERT + "usercert.pem" + " -k " + CERT + "userkey.pem" + " -out " + PROXY,
"cp " + PROXY + " /eos/project-t/tkdqmdoc/private/proxy.cert",
"cd /home/cctrack/" + CMSSW_RELEASE + "/src",
"cmsenv",
tracker_maps_command,
]
process = subprocess.Popen(['/bin/csh', '-c'," && ".join(list_of_commands)], stdout=subprocess.PIPE).stdout
print(process.read().decode())
main()