8 from __future__
import print_function
15 print(
" EcalCondDB - inpect EcalCondDB")
18 print(
" EcalCondDB [options] [command] [command_options]")
22 print(
"Specify short options as '-o foo', long options as '--option=foo'")
24 print(
" -c, --connect= [connectstring]")
25 print(
" specify database, default frontier://FrontierProd/CMS_COND_31X_ECAL")
27 print(
" -P, --authpath= [authenticationpath], default /afs/cern.ch/cms/DB/conddb ")
29 print(
"COMMAND OPTIONS")
31 print(
" -t, --tag= [tag,file] specify tag or xml file (histo,compare)")
33 print(
" -s, --since= [runnumber] specify since")
37 print(
" -l, --listtags list all tags and exit")
39 print(
" -m, --listiovs list iovs for a given tag")
40 print(
" Example EcalCondDB.py -t tag")
42 print(
" -d, --dump= [file] dump record to xml file")
43 print(
" Example EcalCondDB.py -d file.xml -t tag -s since")
45 print(
" -p, --plot= [file] plot record to file, extension specifies ",\
46 "format (.root,.png,.jpg,.gif,.svg)")
47 print(
" Example: EcalCondDB.py -p=plot.png -t tag -s since")
50 print(
" -q, --compare= [file]")
51 print(
" compare two tags and write histograms to file, extension",\
54 print(
" EcalCondDB -q=h.root -t tag1 -s since1 -t tag2 -s since2")
56 print(
" -g, --histo= [file] make histograms and write to file")
58 print(
" EcalCondDB -g=h.png -t tag1 -s since1 ")
62 opts, args = getopt.getopt(sys.argv[1:],
63 "c:P:t:ld:p:q:g:ms:h",
64 [
"connect=",
"authpath=",
"tag=",
"listtags",\
65 "dump=",
"plot=",
"compare=",
"histo=",
"listiovs",\
72 except getopt.GetoptError
as ex:
74 print(ex,
" , use -h or --help for help")
77 dbName =
"frontier://FrontierProd/CMS_COND_31X_ECAL" 78 authpath=
"/afs/cern.ch/cms/DB/conddb" 99 if opt
in (
"-c",
"--connect"):
102 if opt
in (
"-P",
"--authpath"):
105 if opt
in (
"-h",
"--help"):
109 if opt
in (
"-t",
"--tag"):
111 if arg.find(
".xml")>0 :
112 print(
"WARNING : plot from XML is not protected against changes")
113 print(
" in DetId or CondFormats")
115 if opt
in (
"-l",
"--listtags"):
118 if opt
in (
"-q",
"--compare"):
122 if opt
in (
"-d",
"--dump"):
126 if opt
in (
"-p",
"--plot"):
130 if opt
in (
"-g",
"--histo"):
134 if opt
in (
"-m",
"--listiovs"):
137 if opt
in (
"-s",
"--since"):
146 sys.setdlopenflags(DLFCN.RTLD_GLOBAL+DLFCN.RTLD_LAZY)
147 from pluginCondDBPyInterface
import *
151 rdbms = RDBMS(authpath)
152 db = rdbms.getReadOnlyDB(dbName)
161 print(
"Must specify tag with -t")
166 if not len(tags)
or not len (sinces):
167 print(
"Must specify tag with -t [tag] -s [since]")
173 print(
"Must give exactly two tags to compare: -t tag1 -t tag2")
175 if tags[0].
find(
'.xml')<0
and len(sinces)!=2 :
176 print(
"Must specify tag, since to compare with -t [tag1] \ 177 -s [since1] -t [tag2] -s [since2] ")
181 tags[1],db,sinces[1],outfilename)
185 print(
"Must specify tag, since, with -t [tag] \ 186 -s [runsince] (since not needed for xml)")
189 if tags[0].
find(
'.xml')<0
and not len(sinces) :
190 print(
"Must specify tag, since, with -t [tag] \ 198 print(
"Must specify tag with -t [tag]")
S & print(S &os, JobReport::InputFile const &f)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)