CMS 3D CMS Logo

alignmentValidation.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 from __future__ import print_function
4 import re,os,sys,shutil
5 import optparse
6 
7 from mutypes import *
8 
9 execfile("plotscripts.py")
10 
11 ROOT.gROOT.SetBatch(1);
12 
13 ######################################################
14 
15 ######################################################
16 # To parse commandline args
17 
18 usage='%prog [options]\n'+\
19  'This script dumps muon alignment validation plots '+\
20  '(see https://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideMuonAlignValidationPlots) '+\
21  'in web-friendly png format into a predefined directory structure '+\
22  'and also (to be implemented) does some quality checks for these plots.\n'+\
23  'Script uses output of the first and last iterations of muon alignment runs '+\
24  'that should be located in inputDir+i1 and inputDir+iN directories (see options descriptions). '+\
25  'Each of these directories should contain\ni#prefix+"_plotting.root"\ni#prefix+".root"\ni#prefix+"_report.py"\n'+\
26  'files, where # = 1 or N.\n'+\
27  'Output will be located in outputDir, which must exist. Plots from the first and last iterations '+\
28  'will be in outputDir+"iter1" and outputDir+"iterN" respectively, and plots relevant for all iterations will '+\
29  'reside in outputDir+"common/".\n'+\
30  'For a first run a --createDirSructure option must be present. If this option is present for subsequent runs '+\
31  'with the same outputDir, all previous results in "iter1", "iterN" and and "common" would be deleted!\n'+\
32  'If neither --dt or --csc is present, plots for both systems will be created.\n'+\
33  'Options must include either -a or any of the following: --map, --segdiff, --fit, --median'
34 
35 parser=optparse.OptionParser(usage)
36 
37 parser.add_option("-l", "--runLabel",
38  help="[REQUIRED] label to use for a run",
39  type="string",
40  default='',
41  dest="runLabel")
42 
43 parser.add_option("-i", "--inputDir",
44  help="[REQUIRED] input directory: should contain directories with the first and the final iterations' results",
45  type="string",
46  default='',
47  dest="inputDir")
48 
49 parser.add_option("--i1",
50  help="[REQUIRED] directory with the alignment 1st iteration's results relative to inputDir",
51  type="string",
52  default='',
53  dest="i1")
54 
55 parser.add_option("--iN",
56  help="[REQUIRED] directory with the alignment last iteration's results relative to inputDir",
57  type="string",
58  default='',
59  dest="iN")
60 
61 parser.add_option("--i1prefix",
62  help="filename prefix for the alignment 1st iteration's results. If not provided, i1prefix = i1",
63  type="string",
64  default='',
65  dest="i1prefix")
66 
67 parser.add_option("--iNprefix",
68  help="filename prefix for the alignment last iteration's results. If not provided, iNprefix = iN",
69  type="string",
70  default='',
71  dest="iNprefix")
72 
73 parser.add_option("-o", "--outputDir",
74  help="output directory: all plots will be saved with relation to outputDir. If not provided, consider outputDir = inputDir",
75  type="string",
76  default='',
77  dest="outputDir")
78 
79 parser.add_option("--createDirSructure",
80  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!",
81  action="store_true",
82  default=False,
83  dest="createDirSructure")
84 
85 parser.add_option("--dt",
86  help="If it is present, but not --csc, DT only plots will be created",
87  action="store_true",
88  default=False,
89  dest="dt")
90 
91 parser.add_option("--csc",
92  help="If this is present, but not --dt, CSC only plots will be created",
93  action="store_true",
94  default=False,
95  dest="csc")
96 
97 parser.add_option("-a","--all",
98  help="If present, all types of plots will be created",
99  action="store_true",
100  default=False,
101  dest="all")
102 
103 parser.add_option("--map",
104  help="If present, map plots will be created",
105  action="store_true",
106  default=False,
107  dest="map")
108 
109 parser.add_option("--segdiff",
110  help="If present, segdiff plots will be created",
111  action="store_true",
112  default=False,
113  dest="segdiff")
114 
115 parser.add_option("--curvature",
116  help="If present, curvature plots will be created",
117  action="store_true",
118  default=False,
119  dest="curvature")
120 
121 parser.add_option("--fit",
122  help="If present, fit functions plots will be created",
123  action="store_true",
124  default=False,
125  dest="fit")
126 
127 parser.add_option("--median",
128  help="If present, median plots will be created",
129  action="store_true",
130  default=False,
131  dest="median")
132 
133 parser.add_option("--diagnostic",
134  help="If present, will run diagnostic checks",
135  action="store_true",
136  default=False,
137  dest="diagnostic")
138 
139 parser.add_option("-v", "--verbose",
140  help="Degree of debug info verbosity",
141  type="int",
142  default=0,
143  dest="verbose")
144 
145 options,args=parser.parse_args()
146 
147 if options.runLabel=='' or options.inputDir=='' or options.i1=='' or options.iN=='':
148  print("\nOne or more of REQUIRED options is missing!\n")
149  parser.print_help()
150  # See \n"+sys.argv[0]+" --help"
151  sys.exit()
152 
153 outdir = options.outputDir
154 if outdir=='': outdir = options.inputDir
155 
156 i1prefix = options.i1prefix
157 if i1prefix=='' : i1prefix = options.i1
158 
159 iNprefix = options.iNprefix
160 if iNprefix=='' : iNprefix = options.iN
161 
162 if not os.access(outdir,os.F_OK):
163  print("\noutDir = "+outdir+"\ndoes not exist! Exiting...")
164  sys.exit()
165 
166 # If neither --dt or --csc is present, plots for both systems will be created
167 DO_DT = False
168 DO_CSC = False
169 if options.dt or not ( options.dt or options.csc):
170  DO_DT = True
171 if options.csc or not ( options.dt or options.csc):
172  DO_CSC = True
173 
174 if not (options.all or options.map or options.curvature or options.segdiff or options.fit or options.median or options.diagnostic):
175  print("\nOptions must include either -a or any of the following: --map, --segdiff, --fit, --median, --diagnostic. Exiting...")
176  sys.exit()
177 
178 SINGLE_ITERATION = False
179 if i1prefix == iNprefix: SINGLE_ITERATION = True
180 
181 DO_MAP = False
182 DO_SEGDIFF = False
183 DO_CURVATURE = False
184 DO_FIT = False
185 DO_MEDIAN = False
186 if options.map or options.all:
187  DO_MAP = True
188 if options.segdiff or options.all:
189  DO_SEGDIFF = True
190 if options.curvature or options.all:
191  DO_CURVATURE = True
192 if options.fit or options.all:
193  DO_FIT = True
194 if options.median or options.all:
195  DO_MEDIAN = True
196 
197 DO_DIAGNOSTIC = options.diagnostic
198 
199 allOptions = "-l "+options.runLabel+" -i "+options.inputDir+" --i1 "+options.i1+" --iN "+options.iN
200 if options.i1prefix !='': allOptions += " --i1prefix " + options.i1prefix
201 if options.iNprefix !='': allOptions += " --iNprefix " + options.iNprefix
202 allOptions += " -o "+options.outputDir
203 if options.createDirSructure: allOptions += " --createDirSructure"
204 if DO_DT: allOptions += " --dt"
205 if DO_CSC: allOptions += " --csc"
206 if options.all: allOptions += " -a"
207 if options.map: allOptions += " --map"
208 if options.segdiff: allOptions += " --segdiff"
209 if options.curvature: allOptions += " --curvature"
210 if options.fit: allOptions += " --fit"
211 if options.median: allOptions += " --median"
212 if options.diagnostic: allOptions += " --diagnostic"
213 print(sys.argv[0]+" "+allOptions)
214 
215 
216 QUICKTESTN=10000
217 
218 
219 
220 ######################################################
221 
222 # template for canvases list
223 CANVASES_LIST_TEMPLATE = [
224 ['Common',' ',
225  ['medians distribution','medians.png']
226 ],
227 ['DT',' ',
228  ['Wheel&Station: map of dxdz residual vs phi','map_DTvsphi_dxdz.png'],
229  ['Wheel&Station: map of dydz residual vs phi','map_DTvsphi_dydz.png'],
230  ['Wheel&Station: map of x residual vs phi','map_DTvsphi_x.png'],
231  ['Wheel&Station: map of y residual vs phi','map_DTvsphi_y.png'],
232  ['Station&Sector: map of dxdz residual vs z','map_DTvsz_dxdz.png'],
233  ['Station&Sector: map of dydz residual vs z','map_DTvsz_dydz.png'],
234  ['Station&Sector: map of x residual vs z','map_DTvsz_x.png'],
235  ['Station&Sector: map of y residual vs z','map_DTvsz_y.png'],
236  ['Station: map of dxdz residual vs z','map_DTvsz_all_dxdz.png'],
237  ['Station: map of dydz residual vs z','map_DTvsz_all_dydz.png'],
238  ['Station: map of x residual vs z','map_DTvsz_all_x.png'],
239  ['Station: map of y residual vs z','map_DTvsz_all_y.png'],
240  ['Wheel: segdiff in x residuals vs phi','segdifphi_dt13_resid.png'],
241  ['Wheel: segdiff in dxdz residuals vs phi','segdifphi_dt13_slope.png'],
242  ['Wheel: segdiff in y residuals vs phi','segdifphi_dt2_resid.png'],
243  ['Wheel: segdiff in dydz residuals vs phi','segdifphi_dt2_slope.png'],
244  ['Wheel: segdiff DT-CSC in x residuals vs phi','segdifphi_x_dt_csc_resid.png'],
245  ['Chamber: segdiff in x residuals','segdif_dt13_resid.png'],
246  ['Chamber: segdiff in dxdz residuals','segdif_dt13_slope.png'],
247  ['Chamber: segdiff in y residuals','segdif_dt2_resid.png'],
248  ['Chamber: segdiff in dydz residuals','segdif_dt2_slope.png'],
249  ['Chamber: segdiff DT-CSC in x residuals','segdif_x_dt_csc_resid.png'],
250  ['Chamber: residuals distributions','dt_bellcurves.png'],
251  ['Chamber: residuals relations to misalignments','dt_polynomials.png'],
252  ['Chamber: Delta x residuals vs. curvature','dt_curvature_deltax.png'],
253  ['Chamber: Delta dxdz residuals vs. curvature','dt_curvature_deltadxdz.png'],
254  ['Extras: Extra plots in a separate window','dt_extras.php']
255 ],
256 ['CSC',' ',
257  ['Station&Ring: map of d(rphi)/dz residual vs phi','map_CSCvsphi_dxdz.png'],
258  ['Station&Ring: map of rphi residual vs phi','map_CSCvsphi_x.png'],
259  ['Station&Chamber: map of d(rphi)/dz residual vs r','map_CSCvsr_dxdz.png'],
260  ['Station&Chamber: map of rphi residual vs r','map_CSCvsr_x.png'],
261  ['Station: map of d(rphi)/dz residual vs r','map_CSCvsr_all_dxdz.png'],
262  ['Station: map of rphi residual vs r','map_CSCvsr_all_x.png'],
263  ['Station: segdiff in rphi residuals vs phi','segdifphi_csc_resid.png'],
264  ['Station: segdiff in d(rphi)/dz residuals vs phi','segdifphi_csc_slope.png'],
265  ['Chamber: segdiff in rphi residuals','segdif_csc_resid.png'],
266  ['Chamber: segdiff in d(rphi)/dz residuals','segdif_csc_slope.png'],
267  ['Chamber: residuals distributions','csc_bellcurves.png'],
268  ['Chamber: residuals relations to misalignments','csc_polynomials.png'],
269  #['Chamber: Delta rphi residuals vs. curvature','csc_curvature_x.png'],
270  #['Chamber: Delta d(rphi)/dz residuals vs. curvature','csc_curvature_dxdz.png'],
271  ['Extras: Extra plots in a separate window','csc_extras.php']
272 ]
273 ]
274 
275 
276 ######################################################
277 # functions definitions
278 
279 
280 def isFileUnderDir(dir_name, file_name):
281  '''Recursively looks for file named file_name under dir_name directory
282  '''
283  if not DO_DT and dir_name.find("MB")>-1:
284  return False
285  if not DO_CSC and dir_name.find("ME")>-1:
286  return False
287 
288  for f in os.listdir(dir_name):
289  dirfile = os.path.join(dir_name, f)
290  if os.path.isfile(dirfile) and f==file_name:
291  return True
292  # recursively access file names in subdirectories
293  elif os.path.isdir(dirfile):
294  #print "Accessing directory:", dirfile
295  if isFileUnderDir(dirfile, file_name): return True
296  return False
297 
298 
299 # to time saving of plots
300 def saveAs(nm):
301  t1 = time.time()
302  ddt[15] += 1
303  c1.SaveAs(nm)
304  tn = time.time()
305  ddt[16] = 1./ddt[15]*((ddt[15]-1)*ddt[16] + tn-t1)
306 
307 
308 def createDirectoryStructure(iteration_name):
309 
310  if not os.access(iteration_name,os.F_OK):
311  os.mkdir(iteration_name)
312 
313  csc_basedir = iteration_name+'/'
314  for endcap in CSC_TYPES:
315  #print csc_basedir+endcap[0]
316  shutil.rmtree(csc_basedir+endcap[0],True)
317  os.mkdir(csc_basedir+endcap[0])
318  for station in endcap[2]:
319  #print csc_basedir+endcap[0]+'/'+station[1]
320  os.mkdir(csc_basedir+endcap[0]+'/'+station[1])
321  for ring in station[2]:
322  #print csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1]
323  os.mkdir(csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1])
324  for chamber in range(1,ring[2]+1):
325  schamber = "%02d" % chamber
326  #print csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber
327  os.mkdir(csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber)
328 
329  dt_basedir = iteration_name+'/MB/'
330  #print dt_basedir
331  shutil.rmtree(dt_basedir,True)
332  os.mkdir(dt_basedir)
333  for wheel in DT_TYPES:
334  #print dt_basedir+wheel[0]
335  os.mkdir(dt_basedir+wheel[0])
336  for station in wheel[2]:
337  #print dt_basedir+wheel[0]+'/'+station[1]
338  os.mkdir(dt_basedir+wheel[0]+'/'+station[1])
339  for sector in range(1,station[2]+1):
340  ssector = "%02d" % sector
341  #print dt_basedir+wheel[0]+'/'+station[1]+'/'+ssector
342  os.mkdir(dt_basedir+wheel[0]+'/'+station[1]+'/'+ssector)
343 
344  print(os.getcwd())
345 
346 ######################################################
347 
348 def doMapPlotsDT(dt_basedir, tfiles_plotting):
349  """write DT map plots
350 
351  "DTvsphi_st%dwh%s" % (station, wheelletter):
352 
353  plots "integrated" over ALL SECTORS:
354  of x, y, dxdz, dydz vs. phi (y and dydz only for stations 1-3)
355  made for all (station,wheel) combinations
356 
357  Access interface may be arranged into station(1 .. 4) vs. wheel(-2 .. +2) map.
358  It could be incorporated into a general DT chambers map (column1: wheel, column2: station,
359  columns3-16 correspond to sector #) by making station numbers in column 2 clickable.
360 
361 
362  "DTvsz_st%dsec%02d" % (station, sector)
363 
364  plots "integrated" over ALL WHEELS:
365  of x, y, dxdz, dydz vs. z (y and dydz only for stations 1-3)
366  made for all (station,sector) combinations
367 
368  Interface: may be arranged into station(1 .. 4) vs. sector(1 .. 14) map with sector range
369  (1 .. 12) for stations 1-3.
370  It could be incorporated into an EXTENDED general DT chambers map (extended by adding an
371  identifier "ALL" in column1 for wheel number).
372 
373 
374  "DTvsz_st%dsecALL" % (station)
375 
376  plots spanning in z over ALL WHEELS and "integrated" over all sectors:
377  of x, y, dxdz, dydz vs. z (y and dydz only for stations 1-3)
378  made for all stations
379 
380  Interface: may be arranged into station(1 .. 4) map
381  It could be incorporated into an EXTENDED general DT chambers map (extended by adding an
382  identifier "ALL" in column1 for wheel number)."""
383 
384 
385  for wheel in DT_TYPES:
386  if wheel[1]=="ALL": continue
387  for station in wheel[2]:
388  pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'
389  label = "DTvsphi_st%dwh%s" % (int(station[1]), wheelLetter(int(wheel[1])))
390  htitle = "wheel %+d, station %s" % (int(wheel[1]), station[1])
391  #mapplot(tfiles_plotting, label, "x", window=25., title=htitle, fitsawteeth=True,fitsine=True)
392  mapplot(tfiles_plotting, label, "x", window=10., title=htitle, fitsine=True,fitpeaks=True,peaksbins=2)
393  c1.SaveAs(pdir+'map_DTvsphi_x.png')
394  #mapplot(tfiles_plotting, label, "dxdz", window=25., title=htitle, fitsawteeth=True,fitsine=True)
395  mapplot(tfiles_plotting, label, "dxdz", window=10., title=htitle,peaksbins=2)
396  c1.SaveAs(pdir+'map_DTvsphi_dxdz.png')
397 
398  if station[1]=='4': continue
399  #mapplot(tfiles_plotting, label, "y", window=25., title=htitle, fitsawteeth=True,fitsine=True)
400  mapplot(tfiles_plotting, label, "y", window=10., title=htitle,peaksbins=2)
401  c1.SaveAs(pdir+'map_DTvsphi_y.png')
402  #mapplot(tfiles_plotting, label, "dydz", window=25., title=htitle, fitsawteeth=True,fitsine=True)
403  mapplot(tfiles_plotting, label, "dydz", window=10., title=htitle,peaksbins=2)
404  c1.SaveAs(pdir+'map_DTvsphi_dydz.png')
405 
406 
407  qcount=0
408  for wheel in DT_TYPES:
409  if wheel[1]!="ALL": continue
410  for station in wheel[2]:
411  for sector in range(1,station[2]+1):
412  if qcount>QUICKTESTN: break
413  qcount += 1
414  ssector = "%02d" % sector
415  pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'+ssector+'/'
416  label = "DTvsz_st%ssec%s" % (station[1], ssector)
417  htitle = "station %s, sector %d" % (station[1], sector)
418  mapplot(tfiles_plotting, label, "x", window=10., title=htitle, peaksbins=2)
419  c1.SaveAs(pdir+'map_DTvsz_x.png')
420  mapplot(tfiles_plotting, label, "dxdz", window=10., title=htitle, peaksbins=2)
421  c1.SaveAs(pdir+'map_DTvsz_dxdz.png')
422 
423  if station[1]=='4': continue
424  mapplot(tfiles_plotting, label, "y", window=10., title=htitle, peaksbins=2)
425  c1.SaveAs(pdir+'map_DTvsz_y.png')
426  mapplot(tfiles_plotting, label, "dydz", window=10., title=htitle, peaksbins=2)
427  c1.SaveAs(pdir+'map_DTvsz_dydz.png')
428 
429  qcount=0
430  for wheel in DT_TYPES:
431  if wheel[1]!="ALL": continue
432  for station in wheel[2]:
433  if qcount>QUICKTESTN: break
434  qcount += 1
435  pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'
436  label = "DTvsz_st%ssecALL" % (station[1])
437  htitle = "station %s" % (station[1])
438 
439  print(label, end=' ')
440  mapplot(tfiles_plotting, label, "x", window=10., title=htitle, peaksbins=2)
441  c1.SaveAs(pdir+'map_DTvsz_all_x.png')
442  mapplot(tfiles_plotting, label, "dxdz", window=10., title=htitle, peaksbins=2)
443  c1.SaveAs(pdir+'map_DTvsz_all_dxdz.png')
444 
445  if station[1]=='4': continue
446  mapplot(tfiles_plotting, label, "y", window=10., title=htitle, peaksbins=2)
447  c1.SaveAs(pdir+'map_DTvsz_all_y.png')
448  mapplot(tfiles_plotting, label, "dydz", window=10., title=htitle, peaksbins=2)
449  c1.SaveAs(pdir+'map_DTvsz_all_dydz.png')
450 
451  saveTestResultsMap(options.runLabel)
452 
453 
454 def doMapPlotsCSC(csc_basedir, tfiles_plotting):
455  """write CSC map plots
456 
457  "CSCvsphi_me%s%d%d" % (endcap, station, ring)
458 
459  plots "integrated" over ALL SECTORS:
460  of rphi, drphi/dz vs. phi
461  made for all (endcap,station,ring) combinations
462 
463  Interface: may be arranged into two station(1 .. 4) vs. R(1 .. 4) maps for both endcaps
464  with R range (1 .. 4) for stations 2-4
465  It could be incorporated into a general CSC chambers map (column1: endcap, column2: station,
466  column3: ring, columns4-40 correspond to chamber #) by making ring numbers in column 3
467  clickable.
468 
469 
470  "CSCvsr_me%s%dch%02d" % (endcap, station, chamberNumber)
471 
472  plots "integrated" over ALL RINGS:
473  of rphi, drphi/dz vs. z
474  made for all (endcap,station,chamber) combinations
475 
476  Interface: may be arranged into two station(1 .. 4) vs. chamber(1 .. 36) maps for both endcaps
477  It could be incorporated into an EXTENDED general CSC chambers map (extended by adding an
478  identifier "ALL" in column3 for ring number).
479 
480  "CSCvsr_me%s%dchALL" % (endcap, station)
481 
482  plots spanning over ALL RINGS along r and integrated over all SECTORS:
483  of rphi, drphi/dz vs. z
484  made for all (endcap,station) combinations
485 
486  Interface: may be arranged into two station(1 .. 4) maps for both endcaps
487  It could be incorporated into an EXTENDED general CSC chambers map (extended by adding an
488  identifier "ALL" in column3 for ring number)."""
489 
490  for endcap in CSC_TYPES:
491  for station in endcap[2]:
492  for ring in station[2]:
493  if ring[1]=="ALL": continue
494  pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'
495  label = "CSCvsphi_me%s%s%s" % (endcap[1], station[1], ring[1])
496  htitle = "%s%s/%s" % (endcap[0], station[1],ring[1])
497  mapplot(tfiles_plotting, label, "x", window=15., title=htitle, fitsine=True,fitpeaks=True, peaksbins=2)
498  #mapplot(tfiles_plotting, label, "x", window=15., title=htitle, fitsine=True)
499  c1.SaveAs(pdir+'map_CSCvsphi_x.png')
500  mapplot(tfiles_plotting, label, "dxdz", window=15., title=htitle, peaksbins=2)
501  c1.SaveAs(pdir+'map_CSCvsphi_dxdz.png')
502 
503  saveTestResultsMap(options.runLabel)
504 
505  qcount = 0
506  for endcap in CSC_TYPES:
507  for station in endcap[2]:
508  for ring in station[2]:
509  if ring[1]!="ALL": continue
510  for chamber in range(1,ring[2]+1):
511  if qcount>QUICKTESTN: break
512  qcount += 1
513  schamber = "%02d" % chamber
514  pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber+'/'
515  label = "CSCvsr_me%s%sch%s" % (endcap[1], station[1], schamber)
516  htitle = "%s%s/ALL/%d" % (endcap[0], station[1],chamber)
517  mapplot(tfiles_plotting, label, "x", window=15., title=htitle, peaksbins=2)
518  c1.SaveAs(pdir+'map_CSCvsr_x.png')
519  mapplot(tfiles_plotting, label, "dxdz", window=15., title=htitle, peaksbins=2)
520  c1.SaveAs(pdir+'map_CSCvsr_dxdz.png')
521 
522  qcount = 0
523  for endcap in CSC_TYPES:
524  for station in endcap[2]:
525  for ring in station[2]:
526  if ring[1]!="ALL": continue
527  if qcount>QUICKTESTN: break
528  qcount += 1
529  schamber = "%02d" % chamber
530  pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'
531  label = "CSCvsr_me%s%schALL" % (endcap[1], station[1])
532  htitle = "%s%s" % (endcap[0], station[1])
533  mapplot(tfiles_plotting, label, "x", window=10., title=htitle, peaksbins=2)
534  c1.SaveAs(pdir+'map_CSCvsr_all_x.png')
535  mapplot(tfiles_plotting, label, "dxdz", window=10., title=htitle, peaksbins=2)
536  c1.SaveAs(pdir+'map_CSCvsr_all_dxdz.png')
537 
538 
539 
540 def doCurvaturePlotsDT(dt_basedir, tfiles_plotting):
541  """write DT curvature plots
542 
543  "wheel%s_sector%s" % (wheel, sector)
544 
545  wheel in "m2", "m1", "z", "p1", "p2"
546  station 1 only!
547  sector in "01", ..., "12"
548 
549  "param" may be one of
550  "deltax" (Delta x position residuals),
551  "deltadxdz" (Delta (dx/dz) angular residuals),
552  "curverr" (Delta x * d(Delta q/pT)/d(Delta x) = Delta q/pT in the absence of misalignment) - not necessary
553 
554  made for all (wheel,station=1,sector) combinations
555 
556  Interface: could be accesses through a general DT chambers map for station=1 chambers."""
557 
558  w_dict = {'-2':'m2', '-1':'m1', '0':'z', '1':'p1', '2':'p2'}
559  qcount = 0
560  for wheel in DT_TYPES:
561  if wheel[1]=="ALL": continue
562  #station = 1
563  #station = wheel[2][0]
564  for station in wheel[2]:
565  print("curv in ", wheel[0]+'/'+station[1])
566  for sector in range(1,station[2]+1):
567  #if sector>12: break
568  if qcount>QUICKTESTN: break
569  qcount += 1
570  ssector = "%02d" % sector
571  pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'+ssector+'/'
572  label = "wheel%s_st%s_sector%s" % (w_dict[wheel[1]], station[1], ssector)
573  thetitle ="Wheel %s, station %s, sector %s" % (wheel[1], station[1], ssector)
574  curvatureplot(tfiles_plotting, label, "deltax", title=thetitle, window=10., fitline=True)
575  saveAs(pdir+'dt_curvature_deltax.png')
576  curvatureplot(tfiles_plotting, label, "deltadxdz", title=thetitle, window=10., fitline=True)
577  saveAs(pdir+'dt_curvature_deltadxdz.png')
578 
579 
580 
581 def doSegDiffPlotsDT(dt_basedir, tfiles_plotting, iter_reports):
582  """write segment-difference plots for DT
583 
584  segdiff "dt13_resid" and "dt13_slope"
585 
586  set of plots of
587  x vs qpt, x for positive, x for negative ("dt13_resid")
588  dxdz vs qpt, dxdz for positive, dxdz for negative ("dt13_slope")
589  done for MB1-MB2, MB2-MB3, and MB3-MB4 stations combinations with all possible (wheel, sector)
590 
591  Interface: could be accessed through a general DT chambers map, but only for chambers in
592  stations 2-4 (e.g., station 2 would provide MB1-MB2 plots).
593 
594  segdiff "dt2_resid" and "dt2_slope"
595 
596  set of plots of
597  y vs q/pt, y for positive, y for negative ("dt2_resid")
598  dydz vs q/pt, dydz for positive, dydz for negative ("dt2_slope")
599  done for MB1-MB2, MB2-MB3 stations combinations with all possible (wheel, sector)
600 
601  Interface: then the interface would still be a general DT map,
602  but the info only available from station 2 & 3 chambers."""
603 
604  qcount = 0
605  for iwheel in DT_TYPES:
606  if iwheel[1]=="ALL": continue
607  for istation in iwheel[2]:
608  if istation[1]=="1": continue
609  dstations = (int(istation[1])-1)*10 + int(istation[1])
610  #print dstations
611  for isector in range(1, istation[2] + 1):
612  if isector > 12: continue
613  if qcount>QUICKTESTN: break
614  qcount += 1
615  ssector = "%02d" % isector
616  pdir = dt_basedir + '/' + iwheel[0] + '/' + istation[1] + '/' + ssector + '/'
617 
618  segdiff(tfiles_plotting, "dt13_resid", dstations, wheel=int(iwheel[1]), sector=isector, window=15.)
619  c1.SaveAs(pdir + 'segdif_dt13_resid.png')
620  segdiff(tfiles_plotting, "dt13_slope", dstations, wheel=int(iwheel[1]), sector=isector, window=15.)
621  c1.SaveAs(pdir + 'segdif_dt13_slope.png')
622 
623  if istation[1] != '4':
624  segdiff(tfiles_plotting, "dt2_resid", dstations, wheel=int(iwheel[1]), sector=isector, window=15.)
625  c1.SaveAs(pdir + 'segdif_dt2_resid.png')
626  segdiff(tfiles_plotting, "dt2_slope", dstations, wheel=int(iwheel[1]), sector=isector, window=15.)
627  c1.SaveAs(pdir + 'segdif_dt2_slope.png')
628 
629  qcount = 0
630  for iwheel in DT_TYPES:
631  if iwheel[1]=="ALL": continue
632  if abs(int(iwheel[1])) != 2: continue
633  for istation in iwheel[2]:
634  if istation[1]=="3": continue
635  #print dstations
636  for isector in range(1, istation[2] + 1):
637  ssector = "%02d" % isector
638  pdir = dt_basedir + '/' + iwheel[0] + '/' + istation[1] + '/' + ssector + '/'
639  if istation[1]=="1":
640  segdiff_xalign(tfiles_plotting, "x_dt1_csc", wheel=int(iwheel[1]), sector=isector, cscstations = "12")
641  c1.SaveAs(pdir + 'segdif_x_dt_csc_resid.png')
642  if istation[1]=="2":
643  segdiff_xalign(tfiles_plotting, "x_dt2_csc", wheel=int(iwheel[1]), sector=isector, cscstations = "1")
644  c1.SaveAs(pdir + 'segdif_x_dt_csc_resid.png')
645 
646  """segdiffvsphi "dt13_resid" and "dt13_slope"
647 
648  plot for a specific wheel #:
649  x vs phi of pair ("dt13_resid")
650  dxdz vs phi of pair ("dt13_slope")
651  contains all three combinations of neighboring stations
652  made for all possible wheel values
653 
654  Interface: could be accessed by clicking on wheel number under the "wheel" column
655  in a general DT map
656 
657  segdiffvsphi "dt2_resid" and "dt2_slope"
658 
659  plot for a specific wheel #:
660  y vs phi of pair ("dt2_resid")
661  dydz vs phi of pair ("dt2_slope")
662  contains both MB1-MB2 and MB2-MB3 combinations
663  made for all possible wheel values
664 
665  Interface: could be accessed by clicking on wheel number under the "wheel" column
666  in a general DT map"""
667 
668  if len(iter_reports)==0: return
669 
670  for iwheel in DT_TYPES:
671  if iwheel[1]=="ALL": continue
672  pdir = dt_basedir + '/' + iwheel[0] + '/'
673  segdiffvsphi(tfiles_plotting, iter_reports, "dt13_resid", int(iwheel[1]), window=10.)#, excludesectors=(1,7))
674  c1.SaveAs(pdir + 'segdifphi_dt13_resid.png')
675  segdiffvsphi(tfiles_plotting, iter_reports, "dt13_slope", int(iwheel[1]), window=10.)#, excludesectors=(1,7))
676  c1.SaveAs(pdir + 'segdifphi_dt13_slope.png')
677  segdiffvsphi(tfiles_plotting, iter_reports, "dt2_resid", int(iwheel[1]), window=10.)#, excludesectors=(1,7))
678  c1.SaveAs(pdir + 'segdifphi_dt2_resid.png')
679  segdiffvsphi(tfiles_plotting, iter_reports, "dt2_slope", int(iwheel[1]), window=15.)#, excludesectors=(1,7))
680  c1.SaveAs(pdir + 'segdifphi_dt2_slope.png')
681 
682  for iwheel in DT_TYPES:
683  if iwheel[1]=="ALL": continue
684  if abs(int(iwheel[1])) != 2: continue
685  pdir = dt_basedir + '/' + iwheel[0] + '/'
686  segdiffvsphi_xalign(tfiles_plotting, int(iwheel[1]), window=10.)
687  c1.SaveAs(pdir + 'segdifphi_x_dt_csc_resid.png')
688 
689 
690 def doSegDiffPlotsCSC(csc_basedir, tfiles_plotting, iter_reports):
691  """write segment-difference plots for CSC
692 
693  segdiff "csc_resid" and "csc_slope"
694 
695  set of plots of
696  rphi vs qpt, rphi for positive, rphi for negative ("csc_resid")
697  drphidz vs qpt, drphidz for positive, drphidz for negative ("csc_slope")
698  done for ME1-ME2, ME2-ME3, and ME3-ME4 stations combinations with
699  endcap "m" or "p"
700  ring 1 or 2
701  chamber 1-18 (r1) or 1-36 (r2)
702  note: there's no ME3-ME4 plots for R2
703 
704  Interface: could be accessed through a general CSC chambers map, but only for chambers in
705  stations 2-4 (e.g., station 2 would provide ME1-ME2 plots)."""
706 
707  qcount = 0
708  for iendcap in CSC_TYPES:
709  for istation in iendcap[2]:
710  if istation[1]=="1": continue
711  dstations = (int(istation[1])-1)*10 + int(istation[1])
712  for iring in istation[2]:
713  if iring[1]=="ALL": continue
714  if istation[1]=="4" and iring[1]=="2": continue
715  for ichamber in range(1,iring[2]+1):
716  if qcount>QUICKTESTN: break
717  qcount += 1
718  schamber = "%02d" % ichamber
719  pdir = csc_basedir+'/'+iendcap[0]+'/'+istation[1]+'/'+iring[1]+'/'+schamber+'/'
720  segdiff(tfiles_plotting, "csc_resid", dstations,
721  endcap=iendcap[1], ring=int(iring[1]), chamber=ichamber, window=15.)
722  c1.SaveAs(pdir + 'segdif_csc_resid.png')
723  segdiff(tfiles_plotting, "csc_slope", dstations,
724  endcap=iendcap[1], ring=int(iring[1]), chamber=ichamber, window=15.)
725  c1.SaveAs(pdir + 'segdif_csc_slope.png')
726 
727  """segdiffvsphicsc "csc_resid" and "csc_slope"
728 
729  plot for a specific deltaME station differences:
730  rphi vs phi of pair ("csc_resid")
731  dxdz vs phi of pair ("csc_slope")
732  contains plots for two (or one for ME4-ME3) rings
733  done for ME1-ME2, ME2-ME3, and ME3-ME4 stations combinations with
734  endcap "m" or "p"
735 
736  Interface: could be accessed by clicking on ME station boxes, but only for stations 2-4
737  (e.g., station 2 would provide ME1-ME2 plots)."""
738 
739  qcount = 0
740  for iendcap in CSC_TYPES:
741  for istation in iendcap[2]:
742  if istation[1]=="1": continue
743  dstations = (int(istation[1])-1)*10 + int(istation[1])
744  if qcount>QUICKTESTN: break
745  qcount += 1
746  pdir = csc_basedir+'/'+iendcap[0]+'/'+istation[1]+'/'
747  segdiffvsphicsc(tfiles_plotting, "csc_resid", dstations, window=10., endcap=iendcap[1])
748  c1.SaveAs(pdir + 'segdifphi_csc_resid.png')
749  segdiffvsphicsc(tfiles_plotting, "csc_slope", dstations, window=10., endcap=iendcap[1])
750  c1.SaveAs(pdir + 'segdifphi_csc_slope.png')
751 
752 
753 def doFitFunctionsPlotsDT(dt_basedir, iter_tfile, iter_reports):
754  """write fit functions plots for DT
755 
756  DT bellcurves and polynomials
757 
758  set of plots of bellcurves
759  x, dxdz, x vs. dxdz (for all 4 stations)
760  y, dydz, x vs. dxdz (only for stations 1-3?)
761 
762  set of plots of polynomials -- for stations 1-3 only??
763  x vs. xpos, x vs ypos, x vs dxdz angle, x vs dydz angle
764  y vs. xpos, y vs ypos, y vs dxdz angle, y vs dydz angle
765  dxdz vs. xpos, dxdz vs ypos, dxdz vs dxdz angle, dxdz vs dydz angle
766  dydz vs. xpos, dydz vs ypos, dydz vs dxdz angle, dydz vs dydz angle
767 
768  set of plots of polynomials -- for station 4 only??
769  x vs. xpos, x vs dxdz angle
770  dxdz vs. xpos, dxdz vs dxdz angle
771 
772  made for all (wheel,station,sector) combinations
773 
774  Interface: could be accesses through a general DT chambers map."""
775 
776  qcount = 0
777  clearDDT()
778  for wheel in DT_TYPES:
779  if wheel[1]=="ALL": continue
780  for station in wheel[2]:
781  print(wheel[0]+'/'+station[1])
782  for sector in range(1,station[2]+1):
783  if qcount>QUICKTESTN: break
784  qcount += 1
785  ssector = "%02d" % sector
786  pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'+ssector+'/'
787  label = "MBwh%sst%ssec%s" % (wheelLetter(int(wheel[1])),station[1],ssector)
788  bellcurves(iter_tfile, iter_reports, label, False)
789  #c1.SaveAs(pdir+'dt_bellcurves.png')
790  saveAs(pdir+'dt_bellcurves.png')
791  polynomials(iter_tfile, iter_reports, label, False)
792  #c1.SaveAs(pdir+'dt_polynomials.png')
793  saveAs(pdir+'dt_polynomials.png')
794  #printDeltaTs()
795 
796 
797 def doFitFunctionsPlotsCSC(csc_basedir, iter_tfile, iter_reports):
798  """write fit functions plots for CSC
799 
800  CSC bellcurves and polynomials
801 
802  set of plots of bellcurves
803  rphi, drphidz, rphi vs. drphidz
804 
805  set of plots of polynomials
806  rphi vs. rphi pos, rphi vs drphidz angle
807  drphidz vs. rphi pos, drphidz vs drphidz angle
808 
809  made for all (endcap,station,ring,chamber) combinations
810 
811  Interface: could be accesses through a general CSC chambers map."""
812 
813  qcount = 0
814  clearDDT()
815  for endcap in CSC_TYPES:
816  for station in endcap[2]:
817  for ring in station[2]:
818  if ring[1]=="ALL": continue
819  print(endcap[0]+'/'+station[1]+'/'+ring[1])
820  for chamber in range(1,ring[2]+1):
821  if qcount>QUICKTESTN: break
822  qcount += 1
823  schamber = "%02d" % chamber
824  pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber+'/'
825  label = "ME%s%s%s_%s" % (endcap[1], station[1], ring[1], schamber)
826  bellcurves(iter_tfile, iter_reports, label, False)
827  #c1.SaveAs(pdir+'csc_bellcurves.png')
828  saveAs(pdir+'csc_bellcurves.png')
829  polynomials(iter_tfile, iter_reports, label, False)
830  #c1.SaveAs(pdir+'csc_polynomials.png')
831  saveAs(pdir+'csc_polynomials.png')
832  #printDeltaTs()
833 
834 
835 
836 def doIterationPlots(iteration_directory, tfiles_plotting, iter_tfile, iter_reports):
837  dt_basedir = iteration_directory+'/'+'MB'
838  csc_basedir = iteration_directory+'/'
839 
840  if DO_DT and DO_MAP:
841  doMapPlotsDT(dt_basedir, tfiles_plotting)
842  if DO_CSC and DO_MAP:
843  doMapPlotsCSC(csc_basedir, tfiles_plotting)
844 
845  if DO_DT and DO_CURVATURE:
846  doCurvaturePlotsDT(dt_basedir, tfiles_plotting)
847  #if DO_CSC and DO_CURVATURE:
848  # doCurvaturePlotsCSC(csc_basedir, tfiles_plotting)
849 
850  if DO_DT and DO_SEGDIFF:
851  doSegDiffPlotsDT(dt_basedir, tfiles_plotting, iter_reports)
852  if DO_CSC and DO_SEGDIFF:
853  doSegDiffPlotsCSC(csc_basedir, tfiles_plotting, iter_reports)
854 
855  if DO_DT and DO_FIT:
856  doFitFunctionsPlotsDT(dt_basedir, iter_tfile, iter_reports)
857  if DO_CSC and DO_FIT:
858  doFitFunctionsPlotsCSC(csc_basedir, iter_tfile, iter_reports)
859 
860 
861 def createCanvasesList(fname="canvases_list.js"):
862  '''Use CANVASES_LIST_TEMPLATE as a template to create a canvases list include for the browser.
863  Write out only those canvases which have existing filename.png plots.
864  '''
865  CANVASES_LIST = []
866  for scope in CANVASES_LIST_TEMPLATE:
867  scope_entry = []
868  if len(scope)>2:
869  scope_entry = [scope[0],scope[1]]
870  for canvas_entry in scope[2:]:
871  if isFileUnderDir("./",canvas_entry[1]):
872  scope_entry.append(canvas_entry)
873  CANVASES_LIST.append(scope_entry)
874 
875  ff = open(fname,mode="w")
876  print("var CANVASES_LIST = ", file=ff)
877  json.dump(CANVASES_LIST,ff)
878  ff.close()
879 
880 
881 def createCanvasToIDList(fname="canvas2id_list.js"):
882  '''Writes out a canvas-2-ids list include for the browser.
883  Write out only those canvases which have existing filename.png plots.
884  Returns: list of unique IDs that have existing filename.png plots.
885  '''
886  CANVAS2ID_LIST = []
887  ID_LIST = []
888  for scope in CANVASES_LIST_TEMPLATE:
889  if len(scope)>2:
890  for canvas_entry in scope[2:]:
891  ids = idsForFile("./",canvas_entry[1])
892  # scope_entry.append(canvas_entry)
893  # uniquify:
894  set_ids = set(ids)
895  uids = list(set_ids)
896  ID_LIST.extend(uids)
897  print(canvas_entry, ":", len(uids), "ids")
898  if (len(uids)>0):
899  CANVAS2ID_LIST.append( (canvas_entry[1],uids) )
900  #print CANVAS2ID_LIST
901  CANVAS2ID_LIST_DICT = dict(CANVAS2ID_LIST)
902  #print CANVAS2ID_LIST_DICT
903  ff = open(fname,mode="w")
904  print("var CANVAS2ID_LIST = ", file=ff)
905  json.dump(CANVAS2ID_LIST_DICT,ff)
906  ff.close()
907  set_ids = set(ID_LIST)
908  return list(set_ids)
909 
910 def idsForFile(dir_name, file_name):
911  '''Recursively looks for file named file_name under dir_name directory
912  and fill the list with dir names converted to IDs
913  '''
914  id_list = []
915  for f in os.listdir(dir_name):
916  dirfile = os.path.join(dir_name, f)
917  if os.path.isfile(dirfile) and f==file_name:
918  if file_name[-4:]=='.php': id_list.append(dir_name+'/'+file_name)
919  else: id_list.append(dirToID(dir_name))
920  # recursively access file names in subdirectories
921  elif os.path.isdir(dirfile):
922  #print "Accessing directory:", dirfile
923  ids = idsForFile(dirfile, file_name)
924  if (len(ids)>0):
925  id_list.extend(ids)
926  return id_list
927 
928 
929 def dirToID(d):
930  if d[-1]!='/': d += '/'
931  dtn = d.find("/MB/")
932  if dtn!=-1:
933  return d[dtn+4:-1]
934  cscn = d.find("/ME-/")
935  if cscn!=-1:
936  return 'ME-'+d[cscn+5:-1]
937  cscn = d.find("/ME+/")
938  if cscn!=-1:
939  return 'ME+'+d[cscn+5:-1]
940  return ''
941 
942 
943 ############################################################################################################
944 ############################################################################################################
945 # main script
946 
947 # open input files:
948 
949 #basedir='/disks/sdb5/home_reloc/khotilov/db/cms/alignment'
950 #iteration1 = "iteration_01"
951 #iteration3 = "iteration_03"
952 #iteration1 = "NOV4DT_PASS3noweight_TkHIP_01"
953 #iteration3 = "NOV4DT_PASS3noweight_TkHIP_05"
954 #os.chdir(options.inputDir)
955 #iteration1 = options.i1
956 #iteration3 = options.iN
957 
958 fname = options.inputDir+'/'+options.i1+'/'+i1prefix
959 tfiles1_plotting = []
960 iter1_tfile = None
961 iter1_reports = []
962 if not SINGLE_ITERATION:
963  if (DO_MAP or DO_SEGDIFF or DO_CURVATURE) and not os.access(fname+"_plotting.root",os.F_OK):
964  print("no file "+fname+"_plotting.root")
965  sys.exit()
966  if DO_FIT and not os.access(fname+".root",os.F_OK):
967  print("no file "+fname+".root")
968  sys.exit()
969  if DO_MEDIAN and not os.access(fname+"_report.py",os.F_OK):
970  print("no file "+fname+"_report.py")
971  sys.exit()
972  if DO_MAP or DO_SEGDIFF or DO_CURVATURE: tfiles1_plotting.append(ROOT.TFile(fname+"_plotting.root"))
973  if os.access(fname+".root",os.F_OK):
974  iter1_tfile = ROOT.TFile(fname+".root")
975  if os.access(fname+"_report.py",os.F_OK):
976  execfile(fname+"_report.py")
977  iter1_reports = reports
978 
979 fname = options.inputDir+'/'+options.iN+'/'+iNprefix
980 tfilesN_plotting = []
981 iterN_tfile = None
982 iterN_reports = []
983 if (DO_MAP or DO_SEGDIFF or DO_CURVATURE) and not os.access(fname+"_plotting.root",os.F_OK):
984  print("no file "+fname+"_plotting.root")
985  sys.exit()
986 if DO_FIT and not os.access(fname+".root",os.F_OK):
987  print("no file "+fname+".root")
988  sys.exit()
989 if DO_MEDIAN and not os.access(fname+"_report.py",os.F_OK):
990  print("no file "+fname+"_report.py")
991  sys.exit()
992 if DO_MAP or DO_SEGDIFF or DO_CURVATURE: tfilesN_plotting.append(ROOT.TFile(fname+"_plotting.root"))
993 if os.access(fname+".root",os.F_OK):
994  iterN_tfile = ROOT.TFile(fname+".root")
995 if os.access(fname+"_report.py",os.F_OK):
996  execfile(fname+"_report.py")
997  iterN_reports = reports
998 
999 if DO_MAP:
1000  os.chdir(options.inputDir)
1001  phiedges2c()
1002 
1003 ######################################################
1004 # setup output:
1005 
1006 # cd to outputDIr
1007 os.chdir(options.outputDir)
1008 
1009 comdir = "common/"
1010 iteration1 = "iter1"
1011 iterationN = "iterN"
1012 
1013 # create directory structure
1014 if options.createDirSructure:
1015  print("WARNING: all existing results in "+options.outputDir+" will be deleted!")
1016  if not SINGLE_ITERATION: createDirectoryStructure(iteration1)
1017  createDirectoryStructure(iterationN)
1018  if not os.access(comdir,os.F_OK):
1019  os.mkdir(comdir)
1020 
1021 ######################################################
1022 # do drawing
1023 
1024 c1 = ROOT.TCanvas("c1","c1",800,600)
1025 
1026 set_palette("blues")
1027 
1028 print("--- ITERATION 1 ---")
1029 if not SINGLE_ITERATION: doIterationPlots(iteration1, tfiles1_plotting, iter1_tfile, iter1_reports)
1030 print("--- ITERATION N ---")
1031 doIterationPlots(iterationN, tfilesN_plotting, iterN_tfile, iterN_reports)
1032 
1033 if CPP_LOADED: ROOT.cleanUpHeap()
1034 
1035 # write distributions of medians plots
1036 
1037 if DO_MEDIAN:
1038  #plotmedians(iter1_reports, iterN_reports)
1039  plotmedians(iter1_reports, iterN_reports,binsx=100, windowx=10., binsy=100, windowy=10., binsdxdz=100, windowdxdz=10., binsdydz=100, windowdydz=10.)
1040  c1.SaveAs(comdir+'medians.png')
1041 
1042 # perform diagnostic
1043 if DO_DIAGNOSTIC:
1044  #if not SINGLE_ITERATION: doTests(iter1_reports,"mu_list_1.js","dqm_report_1.js",options.runLabel)
1045  createCanvasesList("canvases_list.js")
1046  pic_ids = createCanvasToIDList("canvas2id_list.js")
1047  doTests(iterN_reports, pic_ids, "mu_list.js","dqm_report.js",options.runLabel)
def segdiffvsphi_xalign(tfiles, wheel, window=10.)
def saveTestResultsMap(run_name)
def curvatureplot(tfiles, name, param, mode="from2d", window=15., widebins=False, title="", fitgauss=False, fitconst=False, fitline=False, fitpeaks=True, reset_palette=False)
"param" may be one of "deltax" (Delta x position residuals), "deltadxdz" (Delta (dx/dz) angular resid...
def doTests(reports, pic_ids, fname_base, fname_dqm, run_name)
def clearDDT()
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def doFitFunctionsPlotsCSC(csc_basedir, iter_tfile, iter_reports)
def doMapPlotsCSC(csc_basedir, tfiles_plotting)
def segdiff_xalign(tfiles, component, args)
def createCanvasesList(fname="canvases_list.js")
def mapplot(tfiles, name, param, mode="from2d", window=10., abscissa=None, title="", widebins=False, fitsine=False, fitline=False, reset_palette=False, fitsawteeth=False, fitpeaks=False, peaksbins=1, fixfitpars={}, args)
def segdiffvsphicsc(tfiles, component, pair, window=5., args)
def doFitFunctionsPlotsDT(dt_basedir, iter_tfile, iter_reports)
def doMapPlotsDT(dt_basedir, tfiles_plotting)
def doCurvaturePlotsDT(dt_basedir, tfiles_plotting)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def createDirectoryStructure(iteration_name)
def segdiffvsphi(tfiles, reports, component, wheel, window=5., excludesectors=())
def polynomials(tfile, reports, name, twobin=True, suppressblue=False)
def isFileUnderDir(dir_name, file_name)
functions definitions
def doSegDiffPlotsCSC(csc_basedir, tfiles_plotting, iter_reports)
def bellcurves(tfile, reports, name, twobin=True, suppressblue=False)
def createCanvasToIDList(fname="canvas2id_list.js")
def segdiff(tfiles, component, pair, args)
def doSegDiffPlotsDT(dt_basedir, tfiles_plotting, iter_reports)
def idsForFile(dir_name, file_name)
def wheelLetter(wheel)
Definition: plotscripts.py:38
def doIterationPlots(iteration_directory, tfiles_plotting, iter_tfile, iter_reports)
def set_palette(name=None, ncontours=999)
Definition: plotscripts.py:227
def phiedges2c()
Definition: plotscripts.py:317
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
def plotmedians(reports1, reports2, selection=None, binsx=100, windowx=5., ceilingx=None, binsy=100, windowy=5., ceilingy=None, binsdxdz=100, windowdxdz=5., ceilingdxdz=None, binsdydz=100, windowdydz=5., ceilingdydz=None, r1text=" before", r2text=" after", which="median")