Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-26 02:34:21

0001 #!/usr/bin/env python
0002 
0003 import sys, os, urllib
0004 
0005 
0006 base_url = "https://cmsweb.cern.ch/dqm/offline/start"
0007 
0008 # maps from type to subdirectory
0009 
0010 
0011 knownDatasets = {
0012     "photonJet" : { "dqmdir" : "Photon Summary" },
0013     
0014     "zee" : { "dqmdir" : "Zee Preselection", },
0015 
0016     "wen" : { "dqmdir" : "Wenu Preselection" },
0017 } 
0018 
0019 #----------------------------------------------------------------------
0020 
0021 def fixDataSetTier(dataset):
0022     """ makes sure that the data tier of the given data set is
0023     GEN-SIM-RECO (which is what seems to be used in DQM).
0024 
0025     Also supports datasets without any data tier.
0026     """
0027 
0028     if dataset.startswith('/'):
0029         dataset = dataset[1:]
0030 
0031     if dataset.endswith('/'):
0032         dataset = dataset[:-1]
0033     
0034     parts = dataset.split("/")
0035 
0036     if len(parts) < 2 or len(parts) > 3:
0037         raise Exception("expected at two or three parts (found " + str(len(parts)) + ") separated by '/' for dataset '" + dataset +"'")
0038 
0039     if len(parts) == 2:
0040         # data tier missing
0041         parts.append("GEN-SIM-RECO")
0042     else:
0043         # replace the last part
0044         parts[-1] = "GEN-SIM-RECO"
0045 
0046     return "/" + "/".join(parts)
0047 
0048 
0049 #----------------------------------------------------------------------
0050 # main
0051 #----------------------------------------------------------------------
0052 from optparse import OptionParser
0053 
0054 parser = OptionParser("""
0055 
0056   usage: %prog [options] reference_dataset [ new_dataset ]
0057 
0058 
0059   If only one dataset is given, links to the corresponding relval
0060   plots in the offline DQM are printed.
0061 
0062   If two datasets are given, links to overlay plots are printed.
0063 
0064   Note that the datasets used in DQM seem to have the data tier
0065   (third part) GEN-SIM-RECO. This program will replace any
0066   existing data tier by this value. You may also specify
0067   a dataset without data tier (e.g. /RelValWE/CMSSW_3_8_0-START38_V7-v1 )
0068   and this program will append the required data tier.
0069 
0070 """)
0071 
0072 (options, ARGV) = parser.parse_args()
0073 
0074 if len(ARGV) < 1 or len(ARGV) > 2:
0075     parser.print_help()
0076     sys.exit(1)
0077 
0078 
0079 ref_dataset = fixDataSetTier(ARGV.pop(0))
0080 
0081 if len(ARGV) > 0:
0082     new_dataset = fixDataSetTier(ARGV.pop(0))
0083 else:
0084     new_dataset = None
0085 
0086 # example from another validation report:
0087 # https://cmsweb.cern.ch/dqm/offline/start?workspace=HLT;root=HLT/HLTJETMET/ValidationReport;size=L;runnr=0;dataset=/RelValTTbar/CMSSW_3_8_0-MC_38Y_V7-v1/GEN-SIM-RECO;referenceshow=all;referencepos=overlay;referenceobj1=other::/RelValTTbar/CMSSW_3_8_0_pre8-MC_38Y_V6-v1/GEN-SIM-RECO
0088 
0089 # there seems not to be a standard URL encoding scheme used here...
0090 
0091 for analysisType in knownDatasets.keys():
0092 
0093     dqmdir = knownDatasets[analysisType]['dqmdir']
0094 
0095     parameters = {
0096         "workspace":      "HLT",
0097         "root":           "HLT/HLTEgammaValidation/" + dqmdir,
0098         "size":           "L",
0099         "runnr":          0,
0100         "dataset":        ref_dataset,
0101         "referenceshow":  "all",
0102         "referencepos":   "overlay",
0103         }
0104 
0105     if new_dataset != None:
0106         parameters["referenceobj1"] = "other::" + new_dataset
0107 
0108 
0109     print("analysis: " + analysisType)
0110     print()
0111     print("          " + base_url + "?" + ";".join([ x + "=" + urllib.quote(str(parameters[x])) for x in parameters.keys() ]))
0112 
0113     print()
0114     print()
0115