3 import re,os,sys,shutil
8 execfile(
"plotscripts.py")
10 ROOT.gROOT.SetBatch(1);
17 usage=
'%prog [options]\n'+\
18 'This script dumps muon alignment validation plots '+\
19 '(see https://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideMuonAlignValidationPlots) '+\
20 'in web-friendly png format into a predefined directory structure '+\
21 'and also (to be implemented) does some quality checks for these plots.\n'+\
22 'Script uses output of the first and last iterations of muon alignment runs '+\
23 'that should be located in inputDir+i1 and inputDir+iN directories (see options descriptions). '+\
24 'Each of these directories should contain\ni#prefix+"_plotting.root"\ni#prefix+".root"\ni#prefix+"_report.py"\n'+\
25 'files, where # = 1 or N.\n'+\
26 'Output will be located in outputDir, which must exist. Plots from the first and last iterations '+\
27 'will be in outputDir+"iter1" and outputDir+"iterN" respectively, and plots relevant for all iterations will '+\
28 'reside in outputDir+"common/".\n'+\
29 'For a first run a --createDirSructure option must be present. If this option is present for subsequent runs '+\
30 'with the same outputDir, all previous results in "iter1", "iterN" and and "common" would be deleted!\n'+\
31 'If neither --dt or --csc is present, plots for both systems will be created.\n'+\
32 'Options must include either -a or any of the following: --map, --segdiff, --fit, --median'
34 parser=optparse.OptionParser(usage)
36 parser.add_option(
"-l",
"--runLabel",
37 help=
"[REQUIRED] label to use for a run",
42 parser.add_option(
"-i",
"--inputDir",
43 help=
"[REQUIRED] input directory: should contain directories with the first and the final iterations' results",
48 parser.add_option(
"--i1",
49 help=
"[REQUIRED] directory with the alignment 1st iteration's results relative to inputDir",
54 parser.add_option(
"--iN",
55 help=
"[REQUIRED] directory with the alignment last iteration's results relative to inputDir",
60 parser.add_option(
"--i1prefix",
61 help=
"filename prefix for the alignment 1st iteration's results. If not provided, i1prefix = i1",
66 parser.add_option(
"--iNprefix",
67 help=
"filename prefix for the alignment last iteration's results. If not provided, iNprefix = iN",
72 parser.add_option(
"-o",
"--outputDir",
73 help=
"output directory: all plots will be saved with relation to outputDir. If not provided, consider outputDir = inputDir",
78 parser.add_option(
"--createDirSructure",
79 help=
"If present, new directory structure for storing plots will be first created for each iteration at outputDir+i1 and outputDir+iN. WARNING: this will delete any existing results!",
82 dest=
"createDirSructure")
84 parser.add_option(
"--dt",
85 help=
"If it is present, but not --csc, DT only plots will be created",
90 parser.add_option(
"--csc",
91 help=
"If this is present, but not --dt, CSC only plots will be created",
96 parser.add_option(
"-a",
"--all",
97 help=
"If present, all types of plots will be created",
102 parser.add_option(
"--map",
103 help=
"If present, map plots will be created",
108 parser.add_option(
"--segdiff",
109 help=
"If present, segdiff plots will be created",
114 parser.add_option(
"--curvature",
115 help=
"If present, curvature plots will be created",
120 parser.add_option(
"--fit",
121 help=
"If present, fit functions plots will be created",
126 parser.add_option(
"--median",
127 help=
"If present, median plots will be created",
132 parser.add_option(
"--diagnostic",
133 help=
"If present, will run diagnostic checks",
138 parser.add_option(
"-v",
"--verbose",
139 help=
"Degree of debug info verbosity",
144 options,args=parser.parse_args()
146 if options.runLabel==
'' or options.inputDir==
'' or options.i1==
'' or options.iN==
'':
147 print "\nOne or more of REQUIRED options is missing!\n"
152 outdir = options.outputDir
153 if outdir==
'': outdir = options.inputDir
155 i1prefix = options.i1prefix
156 if i1prefix==
'' : i1prefix = options.i1
158 iNprefix = options.iNprefix
159 if iNprefix==
'' : iNprefix = options.iN
161 if not os.access(outdir,os.F_OK):
162 print "\noutDir = "+outdir+
"\ndoes not exist! Exiting..."
168 if options.dt
or not ( options.dt
or options.csc):
170 if options.csc
or not ( options.dt
or options.csc):
173 if not (options.all
or options.map
or options.curvature
or options.segdiff
or options.fit
or options.median
or options.diagnostic):
174 print "\nOptions must include either -a or any of the following: --map, --segdiff, --fit, --median, --diagnostic. Exiting..."
177 SINGLE_ITERATION =
False
178 if i1prefix == iNprefix: SINGLE_ITERATION =
True
185 if options.map
or options.all:
187 if options.segdiff
or options.all:
189 if options.curvature
or options.all:
191 if options.fit
or options.all:
193 if options.median
or options.all:
196 DO_DIAGNOSTIC = options.diagnostic
198 allOptions =
"-l "+options.runLabel+
" -i "+options.inputDir+
" --i1 "+options.i1+
" --iN "+options.iN
199 if options.i1prefix !=
'': allOptions +=
" --i1prefix " + options.i1prefix
200 if options.iNprefix !=
'': allOptions +=
" --iNprefix " + options.iNprefix
201 allOptions +=
" -o "+options.outputDir
202 if options.createDirSructure: allOptions +=
" --createDirSructure"
203 if DO_DT: allOptions +=
" --dt"
204 if DO_CSC: allOptions +=
" --csc"
205 if options.all: allOptions +=
" -a"
206 if options.map: allOptions +=
" --map"
207 if options.segdiff: allOptions +=
" --segdiff"
208 if options.curvature: allOptions +=
" --curvature"
209 if options.fit: allOptions +=
" --fit"
210 if options.median: allOptions +=
" --median"
211 if options.diagnostic: allOptions +=
" --diagnostic"
212 print sys.argv[0]+
" "+allOptions
222 CANVASES_LIST_TEMPLATE = [
224 [
'medians distribution',
'medians.png']
227 [
'Wheel&Station: map of dxdz residual vs phi',
'map_DTvsphi_dxdz.png'],
228 [
'Wheel&Station: map of dydz residual vs phi',
'map_DTvsphi_dydz.png'],
229 [
'Wheel&Station: map of x residual vs phi',
'map_DTvsphi_x.png'],
230 [
'Wheel&Station: map of y residual vs phi',
'map_DTvsphi_y.png'],
231 [
'Station&Sector: map of dxdz residual vs z',
'map_DTvsz_dxdz.png'],
232 [
'Station&Sector: map of dydz residual vs z',
'map_DTvsz_dydz.png'],
233 [
'Station&Sector: map of x residual vs z',
'map_DTvsz_x.png'],
234 [
'Station&Sector: map of y residual vs z',
'map_DTvsz_y.png'],
235 [
'Wheel: segdiff in x residuals vs phi',
'segdifphi_dt13_resid.png'],
236 [
'Wheel: segdiff in dxdz residuals vs phi',
'segdifphi_dt13_slope.png'],
237 [
'Wheel: segdiff in y residuals vs phi',
'segdifphi_dt2_resid.png'],
238 [
'Wheel: segdiff in dydz residuals vs phi',
'segdifphi_dt2_slope.png'],
239 [
'Chamber: segdiff in x residuals',
'segdif_dt13_resid.png'],
240 [
'Chamber: segdiff in dxdz residuals',
'segdif_dt13_slope.png'],
241 [
'Chamber: segdiff in y residuals',
'segdif_dt2_resid.png'],
242 [
'Chamber: segdiff in dydz residuals',
'segdif_dt2_slope.png'],
243 [
'Chamber: residuals distributions',
'dt_bellcurves.png'],
244 [
'Chamber: residuals relations to misalignments',
'dt_polynomials.png'],
245 [
'Chamber: Delta x residuals vs. curvature',
'dt_curvature_deltax.png'],
246 [
'Chamber: Delta dxdz residuals vs. curvature',
'dt_curvature_deltadxdz.png']
249 [
'Station&Ring: map of d(rphi)/dz residual vs phi',
'map_CSCvsphi_dxdz.png'],
250 [
'Station&Ring: map of rphi residual vs phi',
'map_CSCvsphi_x.png'],
251 [
'Station&Chamber: map of d(rphi)/dz residual vs r',
'map_CSCvsr_dxdz.png'],
252 [
'Station&Chamber: map of rphi residual vs r',
'map_CSCvsr_x.png'],
253 [
'Chamber: segdiff in rphi residuals',
'segdif_csc_resid.png'],
254 [
'Chamber: segdiff in d(rphi)/dz residuals',
'segdif_csc_slope.png'],
255 [
'Chamber: residuals distributions',
'csc_bellcurves.png'],
256 [
'Chamber: residuals relations to misalignments',
'csc_polynomials.png']
266 '''Recursively looks for file named file_name under dir_name directory
268 if not DO_DT
and dir_name.find(
"MB")>-1:
270 if not DO_CSC
and dir_name.find(
"ME")>-1:
273 for f
in os.listdir(dir_name):
274 dirfile = os.path.join(dir_name, f)
275 if os.path.isfile(dirfile)
and f==file_name:
278 elif os.path.isdir(dirfile):
290 ddt[16] = 1./ddt[15]*((ddt[15]-1)*ddt[16] + tn-t1)
295 if not os.access(iteration_name,os.F_OK):
296 os.mkdir(iteration_name)
298 csc_basedir = iteration_name+
'/'
299 for endcap
in CSC_TYPES:
301 shutil.rmtree(csc_basedir+endcap[0],
True)
302 os.mkdir(csc_basedir+endcap[0])
303 for station
in endcap[2]:
305 os.mkdir(csc_basedir+endcap[0]+
'/'+station[1])
306 for ring
in station[2]:
308 os.mkdir(csc_basedir+endcap[0]+
'/'+station[1]+
'/'+ring[1])
309 for chamber
in range(1,ring[2]+1):
310 schamber =
"%02d" % chamber
312 os.mkdir(csc_basedir+endcap[0]+
'/'+station[1]+
'/'+ring[1]+
'/'+schamber)
314 dt_basedir = iteration_name+
'/MB/'
316 shutil.rmtree(dt_basedir,
True)
318 for wheel
in DT_TYPES:
320 os.mkdir(dt_basedir+wheel[0])
321 for station
in wheel[2]:
323 os.mkdir(dt_basedir+wheel[0]+
'/'+station[1])
324 for sector
in range(1,station[2]+1):
325 ssector =
"%02d" % sector
327 os.mkdir(dt_basedir+wheel[0]+
'/'+station[1]+
'/'+ssector)
334 """write DT map plots
336 "DTvsphi_st%dwh%s" % (station, wheelletter):
338 plots "integrated" over ALL SECTORS:
339 of x, y, dxdz, dydz vs. phi (y and dydz only for stations 1-3)
340 made for all (station,wheel) combinations
342 Access interface may be arranged into station(1 .. 4) vs. wheel(-2 .. +2) map.
343 It could be incorporated into a general DT chambers map (column1: wheel, column2: station,
344 columns3-16 correspond to sector #) by making station numbers in column 2 clickable.
347 "DTvsz_st%dsec%02d" % (station, sector)
349 plots "integrated" over ALL WHEELS:
350 of x, y, dxdz, dydz vs. z (y and dydz only for stations 1-3)
351 made for all (station,sector) combinations
353 Interface: may be arranged into station(1 .. 4) vs. sector(1 .. 14) map with sector range
354 (1 .. 12) for stations 1-3.
355 It could be incorporated into an EXTENDED general DT chambers map (extended by adding an
356 identifier "ALL" in column1 for wheel number)."""
358 for wheel
in DT_TYPES:
359 if wheel[1]==
"ALL":
continue
360 for station
in wheel[2]:
361 pdir = dt_basedir+
'/'+wheel[0]+
'/'+station[1]+
'/'
362 label =
"DTvsphi_st%dwh%s" % (int(station[1]),
wheelLetter(int(wheel[1])))
363 htitle =
"wheel %+d, station %s" % (int(wheel[1]), station[1])
364 mapplot(tfiles_plotting, label,
"x", window=15., title=htitle, fitsawteeth=
True,fitsine=
True)
365 c1.SaveAs(pdir+
'map_DTvsphi_x.png')
367 mapplot(tfiles_plotting, label,
"dxdz", window=15., title=htitle)
368 c1.SaveAs(pdir+
'map_DTvsphi_dxdz.png')
370 if station[1]==
'4':
continue
372 mapplot(tfiles_plotting, label,
"y", window=15., title=htitle)
373 c1.SaveAs(pdir+
'map_DTvsphi_y.png')
375 mapplot(tfiles_plotting, label,
"dydz", window=15., title=htitle)
376 c1.SaveAs(pdir+
'map_DTvsphi_dydz.png')
379 for wheel
in DT_TYPES:
380 if wheel[1]!=
"ALL":
continue
381 for station
in wheel[2]:
382 for sector
in range(1,station[2]+1):
383 if qcount>QUICKTESTN:
break
385 ssector =
"%02d" % sector
386 pdir = dt_basedir+
'/'+wheel[0]+
'/'+station[1]+
'/'+ssector+
'/'
387 label =
"DTvsz_st%ssec%s" % (station[1], ssector)
388 htitle =
"station %s, sector %d" % (station[1], sector)
389 mapplot(tfiles_plotting, label,
"x", window=15., title=htitle)
390 c1.SaveAs(pdir+
'map_DTvsz_x.png')
391 mapplot(tfiles_plotting, label,
"dxdz", window=15., title=htitle)
392 c1.SaveAs(pdir+
'map_DTvsz_dxdz.png')
394 if station[1]==
'4':
continue
395 mapplot(tfiles_plotting, label,
"y", window=15., title=htitle)
396 c1.SaveAs(pdir+
'map_DTvsz_y.png')
397 mapplot(tfiles_plotting, label,
"dydz", window=15., title=htitle)
398 c1.SaveAs(pdir+
'map_DTvsz_dydz.png')
404 """write CSC map plots
406 "CSCvsphi_me%s%d%d" % (endcap, station, ring)
408 plots "integrated" over ALL SECTORS:
409 of rphi, drphi/dz vs. phi
410 made for all (endcap,station,ring) combinations
412 Interface: may be arranged into two station(1 .. 4) vs. R(1 .. 4) maps for both endcaps
413 with R range (1 .. 4) for stations 2-4
414 It could be incorporated into a general CSC chambers map (column1: endcap, column2: station,
415 column3: ring, columns4-40 correspond to chamber #) by making ring numbers in column 3
419 "CSCvsr_me%s%dch%02d" % (endcap, station, chamberNumber)
421 plots "integrated" over ALL RINGS:
422 of rphi, drphi/dz vs. z
423 made for all (endcap,station,chamber) combinations
425 Interface: may be arranged into two station(1 .. 4) vs. chamber(1 .. 36) maps for both endcaps
426 It could be incorporated into an EXTENDED general CSC chambers map (extended by adding an
427 identifier "ALL" in column3 for ring number)."""
429 for endcap
in CSC_TYPES:
430 for station
in endcap[2]:
431 for ring
in station[2]:
432 if ring[1]==
"ALL":
continue
433 pdir = csc_basedir+
'/'+endcap[0]+
'/'+station[1]+
'/'+ring[1]+
'/'
434 label =
"CSCvsphi_me%s%s%s" % (endcap[1], station[1], ring[1])
435 htitle =
"%s%s/%s" % (endcap[0], station[1],ring[1])
436 mapplot(tfiles_plotting, label,
"x", window=15., title=htitle, fitsine=
True)
437 c1.SaveAs(pdir+
'map_CSCvsphi_x.png')
438 mapplot(tfiles_plotting, label,
"dxdz", window=15., title=htitle)
439 c1.SaveAs(pdir+
'map_CSCvsphi_dxdz.png')
444 for endcap
in CSC_TYPES:
445 for station
in endcap[2]:
446 for ring
in station[2]:
447 if ring[1]!=
"ALL":
continue
448 for chamber
in range(1,ring[2]+1):
449 if qcount>QUICKTESTN:
break
451 schamber =
"%02d" % chamber
452 pdir = csc_basedir+
'/'+endcap[0]+
'/'+station[1]+
'/'+ring[1]+
'/'+schamber+
'/'
453 label =
"CSCvsr_me%s%sch%s" % (endcap[1], station[1], schamber)
454 htitle =
"%s%s/ALL/%d" % (endcap[0], station[1],chamber)
455 mapplot(tfiles_plotting, label,
"x", window=15., title=htitle)
456 c1.SaveAs(pdir+
'map_CSCvsr_x.png')
457 mapplot(tfiles_plotting, label,
"dxdz", window=15., title=htitle)
458 c1.SaveAs(pdir+
'map_CSCvsr_dxdz.png')
462 """write DT curvature plots
464 "wheel%s_sector%s" % (wheel, sector)
466 wheel in "m2", "m1", "z", "p1", "p2"
468 sector in "01", ..., "12"
470 "param" may be one of
471 "deltax" (Delta x position residuals),
472 "deltadxdz" (Delta (dx/dz) angular residuals),
473 "curverr" (Delta x * d(Delta q/pT)/d(Delta x) = Delta q/pT in the absence of misalignment) - not necessary
475 made for all (wheel,station=1,sector) combinations
477 Interface: could be accesses through a general DT chambers map for station=1 chambers."""
479 w_dict = {
'-2':
'm2',
'-1':
'm1',
'0':
'z',
'1':
'p1',
'2':
'p2'}
481 for wheel
in DT_TYPES:
482 if wheel[1]==
"ALL":
continue
484 station = wheel[2][0]
485 print wheel[0]+
'/'+station[1]
486 for sector
in range(1,station[2]+1):
488 if qcount>QUICKTESTN:
break
490 ssector =
"%02d" % sector
491 pdir = dt_basedir+
'/'+wheel[0]+
'/'+station[1]+
'/'+ssector+
'/'
492 label =
"wheel%s_sector%s" % (w_dict[wheel[1]], ssector)
493 thetitle =
"Wheel %s, sector %s" % (wheel[1], ssector)
494 curvatureplot(tfiles_plotting, label,
"deltax", title=thetitle, window=15., fitline=
True)
495 saveAs(pdir+
'dt_curvature_deltax.png')
496 curvatureplot(tfiles_plotting, label,
"deltadxdz", title=thetitle, window=15., fitline=
True)
497 saveAs(pdir+
'dt_curvature_deltadxdz.png')
501 """write segment-difference plots for DT
503 segdiff "dt13_resid" and "dt13_slope"
506 x vs qpt, x for positive, x for negative ("dt13_resid")
507 dxdz vs qpt, dxdz for positive, dxdz for negative ("dt13_slope")
508 done for MB1-MB2, MB2-MB3, and MB3-MB4 stations combinations with all possible (wheel, sector)
510 Interface: could be accessed through a general DT chambers map, but only for chambers in
511 stations 2-4 (e.g., station 2 would provide MB1-MB2 plots).
513 segdiff "dt2_resid" and "dt2_slope"
516 y vs q/pt, y for positive, y for negative ("dt2_resid")
517 dydz vs q/pt, dydz for positive, dydz for negative ("dt2_slope")
518 done for MB1-MB2, MB2-MB3 stations combinations with all possible (wheel, sector)
520 Interface: then the interface would still be a general DT map,
521 but the info only available from station 2 & 3 chambers."""
524 for iwheel
in DT_TYPES:
525 if iwheel[1]==
"ALL":
continue
526 for istation
in iwheel[2]:
527 if istation[1]==
"1":
continue
528 dstations = (int(istation[1])-1)*10 + int(istation[1])
530 for isector
in range(1, istation[2] + 1):
531 if isector > 12:
continue
532 if qcount>QUICKTESTN:
break
534 ssector =
"%02d" % isector
535 pdir = dt_basedir +
'/' + iwheel[0] +
'/' + istation[1] +
'/' + ssector +
'/'
537 segdiff(tfiles_plotting,
"dt13_resid", dstations, wheel=int(iwheel[1]), sector=isector, window=10.)
538 c1.SaveAs(pdir +
'segdif_dt13_resid.png')
539 segdiff(tfiles_plotting,
"dt13_slope", dstations, wheel=int(iwheel[1]), sector=isector, window=10.)
540 c1.SaveAs(pdir +
'segdif_dt13_slope.png')
542 if istation[1] ==
'4':
continue
543 segdiff(tfiles_plotting,
"dt2_resid", dstations, wheel=int(iwheel[1]), sector=isector, window=10.)
544 c1.SaveAs(pdir +
'segdif_dt2_resid.png')
545 segdiff(tfiles_plotting,
"dt2_slope", dstations, wheel=int(iwheel[1]), sector=isector, window=10.)
546 c1.SaveAs(pdir +
'segdif_dt2_slope.png')
548 """segdiffvsphi "dt13_resid" and "dt13_slope"
550 plot for a specific wheel #:
551 x vs phi of pair ("dt13_resid")
552 dxdz vs phi of pair ("dt13_slope")
553 contains all three combinations of neighboring stations
554 made for all possible wheel values
556 Interface: could be accessed by clicking on wheel number under the "wheel" column
559 segdiffvsphi "dt2_resid" and "dt2_slope"
561 plot for a specific wheel #:
562 y vs phi of pair ("dt2_resid")
563 dydz vs phi of pair ("dt2_slope")
564 contains both MB1-MB2 and MB2-MB3 combinations
565 made for all possible wheel values
567 Interface: could be accessed by clicking on wheel number under the "wheel" column
568 in a general DT map"""
570 if len(iter_reports)==0:
return
572 for iwheel
in DT_TYPES:
573 if iwheel[1]==
"ALL":
continue
574 pdir = dt_basedir +
'/' + iwheel[0] +
'/'
575 segdiffvsphi(tfiles_plotting, iter_reports,
"dt13_resid", int(iwheel[1]), window=15., excludesectors=(1,7))
576 c1.SaveAs(pdir +
'segdifphi_dt13_resid.png')
577 segdiffvsphi(tfiles_plotting, iter_reports,
"dt13_slope", int(iwheel[1]), window=15., excludesectors=(1,7))
578 c1.SaveAs(pdir +
'segdifphi_dt13_slope.png')
579 segdiffvsphi(tfiles_plotting, iter_reports,
"dt2_resid", int(iwheel[1]), window=15., excludesectors=(1,7))
580 c1.SaveAs(pdir +
'segdifphi_dt2_resid.png')
581 segdiffvsphi(tfiles_plotting, iter_reports,
"dt2_slope", int(iwheel[1]), window=15., excludesectors=(1,7))
582 c1.SaveAs(pdir +
'segdifphi_dt2_slope.png')
586 """write segment-difference plots for CSC
588 segdiff "csc_resid" and "csc_slope"
591 rphi vs qpt, rphi for positive, rphi for negative ("csc_resid")
592 drphidz vs qpt, drphidz for positive, drphidz for negative ("csc_slope")
593 done for ME1-ME2, ME2-ME3, and ME3-ME4 stations combinations with
596 chamber 1-18 (r1) or 1-36 (r2)
597 note: there's no ME3-ME4 plots for R2
599 Interface: could be accessed through a general CSC chambers map, but only for chambers in
600 stations 2-4 (e.g., station 2 would provide ME1-ME2 plots)."""
603 for iendcap
in CSC_TYPES:
604 for istation
in iendcap[2]:
605 if istation[1]==
"1":
continue
606 dstations = (int(istation[1])-1)*10 + int(istation[1])
607 for iring
in istation[2]:
608 if iring[1]==
"ALL":
continue
609 if istation[1]==
"4" and iring[1]==
"2":
continue
610 for ichamber
in range(1,iring[2]+1):
611 if qcount>QUICKTESTN:
break
613 schamber =
"%02d" % ichamber
614 pdir = csc_basedir+
'/'+iendcap[0]+
'/'+istation[1]+
'/'+iring[1]+
'/'+schamber+
'/'
615 segdiff(tfiles_plotting,
"csc_resid", dstations,
616 endcap=iendcap[1], ring=int(iring[1]), chamber=ichamber, window=10.)
617 c1.SaveAs(pdir +
'segdif_csc_resid.png')
618 segdiff(tfiles_plotting,
"csc_slope", dstations,
619 endcap=iendcap[1], ring=int(iring[1]), chamber=ichamber, window=10.)
620 c1.SaveAs(pdir +
'segdif_csc_slope.png')
624 """write fit functions plots for DT
626 DT bellcurves and polynomials
628 set of plots of bellcurves
629 x, dxdz, x vs. dxdz (for all 4 stations)
630 y, dydz, x vs. dxdz (only for stations 1-3?)
632 set of plots of polynomials -- for stations 1-3 only??
633 x vs. xpos, x vs ypos, x vs dxdz angle, x vs dydz angle
634 y vs. xpos, y vs ypos, y vs dxdz angle, y vs dydz angle
635 dxdz vs. xpos, dxdz vs ypos, dxdz vs dxdz angle, dxdz vs dydz angle
636 dydz vs. xpos, dydz vs ypos, dydz vs dxdz angle, dydz vs dydz angle
638 set of plots of polynomials -- for station 4 only??
639 x vs. xpos, x vs dxdz angle
640 dxdz vs. xpos, dxdz vs dxdz angle
642 made for all (wheel,station,sector) combinations
644 Interface: could be accesses through a general DT chambers map."""
648 for wheel
in DT_TYPES:
649 if wheel[1]==
"ALL":
continue
650 for station
in wheel[2]:
651 print wheel[0]+
'/'+station[1]
652 for sector
in range(1,station[2]+1):
653 if qcount>QUICKTESTN:
break
655 ssector =
"%02d" % sector
656 pdir = dt_basedir+
'/'+wheel[0]+
'/'+station[1]+
'/'+ssector+
'/'
657 label =
"MBwh%sst%ssec%s" % (
wheelLetter(int(wheel[1])),station[1],ssector)
658 bellcurves(iter_tfile, iter_reports, label,
False)
660 saveAs(pdir+
'dt_bellcurves.png')
661 polynomials(iter_tfile, iter_reports, label,
False)
663 saveAs(pdir+
'dt_polynomials.png')
668 """write fit functions plots for CSC
670 CSC bellcurves and polynomials
672 set of plots of bellcurves
673 rphi, drphidz, rphi vs. drphidz
675 set of plots of polynomials
676 rphi vs. rphi pos, rphi vs drphidz angle
677 drphidz vs. rphi pos, drphidz vs drphidz angle
679 made for all (endcap,station,ring,chamber) combinations
681 Interface: could be accesses through a general CSC chambers map."""
685 for endcap
in CSC_TYPES:
686 for station
in endcap[2]:
687 for ring
in station[2]:
688 if ring[1]==
"ALL":
continue
689 print endcap[0]+
'/'+station[1]+
'/'+ring[1]
690 for chamber
in range(1,ring[2]+1):
691 if qcount>QUICKTESTN:
break
693 schamber =
"%02d" % chamber
694 pdir = csc_basedir+
'/'+endcap[0]+
'/'+station[1]+
'/'+ring[1]+
'/'+schamber+
'/'
695 label =
"ME%s%s%s_%s" % (endcap[1], station[1], ring[1], schamber)
696 bellcurves(iter_tfile, iter_reports, label,
False)
698 saveAs(pdir+
'csc_bellcurves.png')
699 polynomials(iter_tfile, iter_reports, label,
False)
701 saveAs(pdir+
'csc_polynomials.png')
707 dt_basedir = iteration_directory+
'/'+
'MB'
708 csc_basedir = iteration_directory+
'/'
712 if DO_CSC
and DO_MAP:
715 if DO_DT
and DO_CURVATURE:
720 if DO_DT
and DO_SEGDIFF:
722 if DO_CSC
and DO_SEGDIFF:
727 if DO_CSC
and DO_FIT:
732 '''Use CANVASES_LIST_TEMPLATE as a template to create a canvases list include for the browser.
733 Write out only those canvases which have existing filename.png plots.
736 for scope
in CANVASES_LIST_TEMPLATE:
739 scope_entry = [scope[0],scope[1]]
740 for canvas_entry
in scope[2:]:
742 scope_entry.append(canvas_entry)
743 CANVASES_LIST.append(scope_entry)
745 ff = open(fname,mode=
"w")
746 print >>ff,
"var CANVASES_LIST = "
747 json.dump(CANVASES_LIST,ff)
752 '''Create a canvas-to-ids list include for the browser.
753 Write out only those canvases which have existing filename.png plots.
756 for scope
in CANVASES_LIST_TEMPLATE:
758 for canvas_entry
in scope[2:]:
764 print canvas_entry,
":", len(uids),
"ids"
766 CANVAS2ID_LIST.append( (canvas_entry[1],uids) )
768 CANVAS2ID_LIST_DICT =
dict(CANVAS2ID_LIST)
770 ff = open(fname,mode=
"w")
771 print >>ff,
"var CANVAS2ID_LIST = "
772 json.dump(CANVAS2ID_LIST_DICT,ff)
776 '''Recursively looks for file named file_name under dir_name directory
777 and fill the list with dir names converted to IDs
780 for f
in os.listdir(dir_name):
781 dirfile = os.path.join(dir_name, f)
782 if os.path.isfile(dirfile)
and f==file_name:
783 id_list.append(
dirToID(dir_name))
785 elif os.path.isdir(dirfile):
794 if d[-1]!=
'/': d +=
'/'
798 cscn = d.find(
"/ME-/")
800 return 'ME-'+d[cscn+4:-1]
801 cscn = d.find(
"/ME+/")
803 return 'ME+'+d[cscn+4:-1]
822 fname = options.inputDir+
'/'+options.i1+
'/'+i1prefix
823 tfiles1_plotting = []
826 if not SINGLE_ITERATION:
827 if (DO_MAP
or DO_SEGDIFF
or DO_CURVATURE)
and not os.access(fname+
"_plotting.root",os.F_OK):
828 print "no file "+fname+
"_plotting.root"
830 if DO_FIT
and not os.access(fname+
".root",os.F_OK):
831 print "no file "+fname+
".root"
833 if DO_MEDIAN
and not os.access(fname+
"_report.py",os.F_OK):
834 print "no file "+fname+
"_report.py"
836 if DO_MAP
or DO_SEGDIFF
or DO_CURVATURE: tfiles1_plotting.append(ROOT.TFile(fname+
"_plotting.root"))
837 if os.access(fname+
".root",os.F_OK):
838 iter1_tfile = ROOT.TFile(fname+
".root")
839 if os.access(fname+
"_report.py",os.F_OK):
840 execfile(fname+
"_report.py")
841 iter1_reports = reports
843 fname = options.inputDir+
'/'+options.iN+
'/'+iNprefix
844 tfilesN_plotting = []
847 if (DO_MAP
or DO_SEGDIFF
or DO_CURVATURE)
and not os.access(fname+
"_plotting.root",os.F_OK):
848 print "no file "+fname+
"_plotting.root"
850 if DO_FIT
and not os.access(fname+
".root",os.F_OK):
851 print "no file "+fname+
".root"
853 if DO_MEDIAN
and not os.access(fname+
"_report.py",os.F_OK):
854 print "no file "+fname+
"_report.py"
856 if DO_MAP
or DO_SEGDIFF
or DO_CURVATURE: tfilesN_plotting.append(ROOT.TFile(fname+
"_plotting.root"))
857 if os.access(fname+
".root",os.F_OK):
858 iterN_tfile = ROOT.TFile(fname+
".root")
859 if os.access(fname+
"_report.py",os.F_OK):
860 execfile(fname+
"_report.py")
861 iterN_reports = reports
864 os.chdir(options.inputDir)
871 os.chdir(options.outputDir)
878 if options.createDirSructure:
879 print "WARNING: all existing results in "+options.outputDir+
" will be deleted!"
882 if not os.access(comdir,os.F_OK):
888 c1 = ROOT.TCanvas(
"c1",
"c1",800,600)
892 if not SINGLE_ITERATION:
doIterationPlots(iteration1, tfiles1_plotting, iter1_tfile, iter1_reports)
895 if CPP_LOADED: ROOT.cleanUpHeap()
901 c1.SaveAs(comdir+
'medians.png')
906 doTests(iterN_reports,
"mu_list.js",
"dqm_report.js",options.runLabel)
def isFileUnderDir
functions definitions
def doFitFunctionsPlotsDT
def createDirectoryStructure
def doFitFunctionsPlotsCSC
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run