8 from __future__
import print_function
9 from __future__
import absolute_import
16 print(
" EcalCondDB - inpect EcalCondDB")
19 print(
" EcalCondDB [options] [command] [command_options]")
23 print(
"Specify short options as '-o foo', long options as '--option=foo'")
25 print(
" -c, --connect= [connectstring]")
26 print(
" specify database, default frontier://FrontierProd/CMS_COND_31X_ECAL")
28 print(
" -P, --authpath= [authenticationpath], default /afs/cern.ch/cms/DB/conddb ")
30 print(
"COMMAND OPTIONS")
32 print(
" -t, --tag= [tag,file] specify tag or xml file (histo,compare)")
34 print(
" -s, --since= [runnumber] specify since")
38 print(
" -l, --listtags list all tags and exit")
40 print(
" -m, --listiovs list iovs for a given tag")
41 print(
" Example EcalCondDB.py -t tag")
43 print(
" -d, --dump= [file] dump record to xml file")
44 print(
" Example EcalCondDB.py -d file.xml -t tag -s since")
46 print(
" -p, --plot= [file] plot record to file, extension specifies ",\
47 "format (.root,.png,.jpg,.gif,.svg)")
48 print(
" Example: EcalCondDB.py -p=plot.png -t tag -s since")
51 print(
" -q, --compare= [file]")
52 print(
" compare two tags and write histograms to file, extension",\
55 print(
" EcalCondDB -q=h.root -t tag1 -s since1 -t tag2 -s since2")
57 print(
" -g, --histo= [file] make histograms and write to file")
59 print(
" EcalCondDB -g=h.png -t tag1 -s since1 ")
63 opts, args = getopt.getopt(sys.argv[1:],
64 "c:P:t:ld:p:q:g:ms:h",
65 [
"connect=",
"authpath=",
"tag=",
"listtags",\
66 "dump=",
"plot=",
"compare=",
"histo=",
"listiovs",\
73 except getopt.GetoptError
as ex:
75 print(ex,
" , use -h or --help for help")
78 dbName =
"frontier://FrontierProd/CMS_COND_31X_ECAL" 79 authpath=
"/afs/cern.ch/cms/DB/conddb" 100 if opt
in (
"-c",
"--connect"):
103 if opt
in (
"-P",
"--authpath"):
106 if opt
in (
"-h",
"--help"):
110 if opt
in (
"-t",
"--tag"):
112 if arg.find(
".xml")>0 :
113 print(
"WARNING : plot from XML is not protected against changes")
114 print(
" in DetId or CondFormats")
116 if opt
in (
"-l",
"--listtags"):
119 if opt
in (
"-q",
"--compare"):
123 if opt
in (
"-d",
"--dump"):
127 if opt
in (
"-p",
"--plot"):
131 if opt
in (
"-g",
"--histo"):
135 if opt
in (
"-m",
"--listiovs"):
138 if opt
in (
"-s",
"--since"):
147 sys.setdlopenflags(DLFCN.RTLD_GLOBAL+DLFCN.RTLD_LAZY)
148 from pluginCondDBPyInterface
import *
152 rdbms = RDBMS(authpath)
153 db = rdbms.getReadOnlyDB(dbName)
155 from .
import EcalCondTools
162 print(
"Must specify tag with -t")
167 if not len(tags)
or not len (sinces):
168 print(
"Must specify tag with -t [tag] -s [since]")
174 print(
"Must give exactly two tags to compare: -t tag1 -t tag2")
176 if tags[0].
find(
'.xml')<0
and len(sinces)!=2 :
177 print(
"Must specify tag, since to compare with -t [tag1] \ 178 -s [since1] -t [tag2] -s [since2] ")
182 tags[1],db,sinces[1],outfilename)
186 print(
"Must specify tag, since, with -t [tag] \ 187 -s [runsince] (since not needed for xml)")
190 if tags[0].
find(
'.xml')<0
and not len(sinces) :
191 print(
"Must specify tag, since, with -t [tag] \ 199 print(
"Must specify tag with -t [tag]")
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)