CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
fetchall_from_DQM.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 ################################################################################
3 # RelMon: a tool for automatic Release Comparison
4 # https://twiki.cern.ch/twiki/bin/view/CMSPublic/RelMon
5 #
6 # $Author: agimbuta $
7 # $Date: 2012/07/10 14:19:02 $
8 # $Revision: 1.2 $
9 #
10 #
11 # Danilo Piparo CERN - danilo.piparo@cern.ch
12 #
13 ################################################################################
14 
15 import subprocess as sub
16 import sys
17 from optparse import OptionParser
18 
19 parser = OptionParser(usage="usage: %prog cmssw_release [options]")
20 
21 
22 parser.add_option("-d","--data ",
23  action="store",
24  dest="data",
25  default=False,
26  help="Fetch data relvals")
27 
28 parser.add_option("-m","--mc ",
29  action="store",
30  dest="mc",
31  default=False,
32  help="Fetch Monte Carlo relvals")
33 
34 parser.add_option("--p1","--path1 ",
35  action="store",
36  dest="path1",
37  default="",
38  help="Additional path to match in relvals")
39 
40 parser.add_option("--p2","--path2 ",
41  action="store",
42  dest="path2",
43  default="",
44  help="Additional path to match in relvals")
45 
46 (options, args) = parser.parse_args()
47 
48 #if len(args)!=1:
49 # print "Specify one and only one release!"
50 # print args
51 # sys.exit(2)
52 
53 cmssw_release = args[0]
54 
55 # Specify the directory of data or MC
56 relvaldir="RelVal"
57 if options.data:
58  relvaldir+="Data"
59 
60 # Specify the directory of the release
61 releasedir=cmssw_release[:10]+"x"
62 
63 #fetch!
64 thepath=cmssw_release
65 if len(options.path1)>0:
66  thepath="%s.*%s"%(options.path1,thepath)
67 if len(options.path2)>0:
68  thepath="%s.*%s"%(thepath,options.path2)
69 command='relmon_rootfiles_spy.py ROOT/%s/%s/ -u -g -p %s'%(relvaldir,releasedir,thepath)
70 print command
71 sub.call(command.split(" "))
72 
73 # Main tree:
74 # https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/
75 
76