CMS 3D CMS Logo

Functions | Variables

alignmentValidation Namespace Reference

Functions

def createCanvasesList
def createCanvasToIDList
def createDirectoryStructure
def dirToID
def doCurvaturePlotsDT
def doFitFunctionsPlotsCSC
def doFitFunctionsPlotsDT
def doIterationPlots
def doMapPlotsCSC
def doMapPlotsDT
def doSegDiffPlotsCSC
def doSegDiffPlotsDT
def idsForFile
def isFileUnderDir
 functions definitions
def saveAs

Variables

string action = "store_true"
string allOptions = "-l "
tuple c1 = ROOT.TCanvas("c1","c1",800,600)
 do drawing
list CANVASES_LIST_TEMPLATE
string comdir = "common/"
 setup output:
string default = ''
string dest = "runLabel"
 DO_CSC = False
 DO_CURVATURE = False
 DO_DIAGNOSTIC = options.diagnostic
 DO_DT = False
 DO_FIT = False
 DO_MAP = False
 DO_MEDIAN = False
 DO_SEGDIFF = False
string fname = '/'
 main script
string help = "[REQUIRED] label to use for a run"
 i1prefix = options.i1prefix
 iNprefix = options.iNprefix
list iter1_reports = []
 iter1_tfile = None
string iteration1 = "iter1"
string iterationN = "iterN"
list iterN_reports = []
 iterN_tfile = None
 outdir = options.outputDir
tuple parser = optparse.OptionParser(usage)
tuple pic_ids = createCanvasToIDList("canvas2id_list.js")
int QUICKTESTN = 10000
 SINGLE_ITERATION = False
list tfiles1_plotting = []
list tfilesN_plotting = []
string type = "string"
string usage = '%prog [options]\n'
 To parse commandline args.

Function Documentation

def alignmentValidation::createCanvasesList (   fname = "canvases_list.js")
Use CANVASES_LIST_TEMPLATE as a template to create a canvases list include for the browser.
   Write out only those canvases which have existing filename.png plots.

Definition at line 860 of file alignmentValidation.py.

00861                                                 :
00862   '''Use CANVASES_LIST_TEMPLATE as a template to create a canvases list include for the browser.
00863      Write out only those canvases which have existing filename.png plots.
00864   '''
00865   CANVASES_LIST = []
00866   for scope in CANVASES_LIST_TEMPLATE:
00867     scope_entry = []
00868     if len(scope)>2:
00869       scope_entry = [scope[0],scope[1]]
00870       for canvas_entry in scope[2:]:
00871         if isFileUnderDir("./",canvas_entry[1]):
00872           scope_entry.append(canvas_entry)
00873     CANVASES_LIST.append(scope_entry)
00874 
00875   ff = open(fname,mode="w")
00876   print >>ff, "var CANVASES_LIST = "
00877   json.dump(CANVASES_LIST,ff)
00878   ff.close()
00879 

def alignmentValidation::createCanvasToIDList (   fname = "canvas2id_list.js")
Writes out a canvas-2-ids list include for the browser.
   Write out only those canvases which have existing filename.png plots.
   Returns: list of unique IDs that have existing filename.png plots.

Definition at line 880 of file alignmentValidation.py.

00881                                                    :
00882   '''Writes out a canvas-2-ids list include for the browser.
00883      Write out only those canvases which have existing filename.png plots.
00884      Returns: list of unique IDs that have existing filename.png plots.
00885   '''
00886   CANVAS2ID_LIST = []
00887   ID_LIST = []
00888   for scope in CANVASES_LIST_TEMPLATE:
00889     if len(scope)>2:
00890       for canvas_entry in scope[2:]:
00891         ids = idsForFile("./",canvas_entry[1])
00892         #  scope_entry.append(canvas_entry)
00893         # uniquify:
00894         set_ids = set(ids)
00895         uids = list(set_ids)
00896         ID_LIST.extend(uids)
00897         print canvas_entry, ":", len(uids), "ids"
00898         if (len(uids)>0):
00899           CANVAS2ID_LIST.append( (canvas_entry[1],uids) )
00900   #print CANVAS2ID_LIST
00901   CANVAS2ID_LIST_DICT = dict(CANVAS2ID_LIST)
00902   #print CANVAS2ID_LIST_DICT
00903   ff = open(fname,mode="w")
00904   print >>ff, "var CANVAS2ID_LIST = "
00905   json.dump(CANVAS2ID_LIST_DICT,ff)
00906   ff.close()
00907   set_ids = set(ID_LIST)
00908   return list(set_ids)

def alignmentValidation::createDirectoryStructure (   iteration_name)

Definition at line 307 of file alignmentValidation.py.

00308                                             :
00309   
00310   if not os.access(iteration_name,os.F_OK):
00311     os.mkdir(iteration_name)
00312 
00313   csc_basedir = iteration_name+'/'
00314   for endcap in CSC_TYPES:
00315     #print csc_basedir+endcap[0]
00316     shutil.rmtree(csc_basedir+endcap[0],True)
00317     os.mkdir(csc_basedir+endcap[0])
00318     for station in endcap[2]:
00319       #print csc_basedir+endcap[0]+'/'+station[1]
00320       os.mkdir(csc_basedir+endcap[0]+'/'+station[1])
00321       for ring in station[2]:
00322         #print csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1]
00323         os.mkdir(csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1])
00324         for chamber in range(1,ring[2]+1):
00325           schamber = "%02d" % chamber
00326           #print csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber
00327           os.mkdir(csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber)
00328 
00329   dt_basedir = iteration_name+'/MB/'
00330   #print dt_basedir
00331   shutil.rmtree(dt_basedir,True)
00332   os.mkdir(dt_basedir)
00333   for wheel in DT_TYPES:
00334     #print dt_basedir+wheel[0]
00335     os.mkdir(dt_basedir+wheel[0])
00336     for station in wheel[2]:
00337       #print dt_basedir+wheel[0]+'/'+station[1]
00338       os.mkdir(dt_basedir+wheel[0]+'/'+station[1])
00339       for sector in range(1,station[2]+1):
00340         ssector = "%02d" % sector
00341         #print dt_basedir+wheel[0]+'/'+station[1]+'/'+ssector
00342         os.mkdir(dt_basedir+wheel[0]+'/'+station[1]+'/'+ssector)
00343 
00344   print os.getcwd()

def alignmentValidation::dirToID (   d)

Definition at line 928 of file alignmentValidation.py.

00929               :
00930   if d[-1]!='/': d += '/'
00931   dtn = d.find("/MB/")
00932   if dtn!=-1:
00933     return d[dtn+4:-1]
00934   cscn = d.find("/ME-/")
00935   if cscn!=-1:
00936     return 'ME-'+d[cscn+5:-1]
00937   cscn = d.find("/ME+/")
00938   if cscn!=-1:
00939     return 'ME+'+d[cscn+5:-1]
00940   return ''
00941 

def alignmentValidation::doCurvaturePlotsDT (   dt_basedir,
  tfiles_plotting 
)
write DT curvature plots

"wheel%s_sector%s" % (wheel, sector)

wheel in "m2", "m1", "z", "p1", "p2"
station 1 only!
sector in "01", ..., "12"

"param" may be one of 
  "deltax" (Delta x position residuals),
  "deltadxdz" (Delta (dx/dz) angular residuals),
  "curverr" (Delta x * d(Delta q/pT)/d(Delta x) = Delta q/pT in the absence of misalignment) - not necessary

made for all (wheel,station=1,sector) combinations

Interface: could be accesses through a general DT chambers map for station=1 chambers.

Definition at line 539 of file alignmentValidation.py.

00540                                                    :
00541   """write DT curvature plots
00542 
00543   "wheel%s_sector%s" % (wheel, sector)
00544 
00545   wheel in "m2", "m1", "z", "p1", "p2"
00546   station 1 only!
00547   sector in "01", ..., "12"
00548 
00549   "param" may be one of 
00550     "deltax" (Delta x position residuals),
00551     "deltadxdz" (Delta (dx/dz) angular residuals),
00552     "curverr" (Delta x * d(Delta q/pT)/d(Delta x) = Delta q/pT in the absence of misalignment) - not necessary
00553 
00554   made for all (wheel,station=1,sector) combinations
00555 
00556   Interface: could be accesses through a general DT chambers map for station=1 chambers."""
00557   
00558   w_dict = {'-2':'m2', '-1':'m1', '0':'z', '1':'p1', '2':'p2'}
00559   qcount = 0
00560   for wheel in DT_TYPES:
00561     if wheel[1]=="ALL": continue
00562     #station = 1
00563     #station = wheel[2][0]
00564     for station in wheel[2]:
00565       print "curv in ", wheel[0]+'/'+station[1]
00566       for sector in range(1,station[2]+1):
00567         #if sector>12: break
00568         if qcount>QUICKTESTN: break
00569         qcount += 1
00570         ssector = "%02d" % sector
00571         pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'+ssector+'/'
00572         label = "wheel%s_st%s_sector%s" % (w_dict[wheel[1]], station[1], ssector)
00573         thetitle ="Wheel %s, station %s, sector %s" % (wheel[1], station[1], ssector)
00574         curvatureplot(tfiles_plotting, label, "deltax", title=thetitle, window=10., fitline=True)
00575         saveAs(pdir+'dt_curvature_deltax.png')
00576         curvatureplot(tfiles_plotting, label, "deltadxdz", title=thetitle, window=10., fitline=True)
00577         saveAs(pdir+'dt_curvature_deltadxdz.png')
00578 
00579 

def alignmentValidation::doFitFunctionsPlotsCSC (   csc_basedir,
  iter_tfile,
  iter_reports 
)
write fit functions plots for CSC

 CSC bellcurves and polynomials

set of plots of bellcurves
  rphi, drphidz, rphi vs. drphidz

set of plots of polynomials
  rphi vs. rphi pos,    rphi vs drphidz angle
  drphidz vs. rphi pos, drphidz vs drphidz angle

made for all (endcap,station,ring,chamber) combinations

Interface: could be accesses through a general CSC chambers map.

Definition at line 796 of file alignmentValidation.py.

00797                                                                  :
00798   """write fit functions plots for CSC
00799 
00800  CSC bellcurves and polynomials
00801 
00802   set of plots of bellcurves
00803     rphi, drphidz, rphi vs. drphidz
00804 
00805   set of plots of polynomials
00806     rphi vs. rphi pos,    rphi vs drphidz angle
00807     drphidz vs. rphi pos, drphidz vs drphidz angle
00808 
00809   made for all (endcap,station,ring,chamber) combinations
00810 
00811   Interface: could be accesses through a general CSC chambers map."""
00812 
00813   qcount = 0
00814   clearDDT()
00815   for endcap in CSC_TYPES:
00816     for station in endcap[2]:
00817       for ring in station[2]:
00818         if ring[1]=="ALL": continue
00819         print endcap[0]+'/'+station[1]+'/'+ring[1]
00820         for chamber in range(1,ring[2]+1):
00821           if qcount>QUICKTESTN: break
00822           qcount += 1
00823           schamber = "%02d" % chamber
00824           pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber+'/'
00825           label = "ME%s%s%s_%s" % (endcap[1], station[1], ring[1], schamber)
00826           bellcurves(iter_tfile, iter_reports, label, False)
00827           #c1.SaveAs(pdir+'csc_bellcurves.png')
00828           saveAs(pdir+'csc_bellcurves.png')
00829           polynomials(iter_tfile, iter_reports, label, False)
00830           #c1.SaveAs(pdir+'csc_polynomials.png')
00831           saveAs(pdir+'csc_polynomials.png')
00832   #printDeltaTs()
00833 
00834 

def alignmentValidation::doFitFunctionsPlotsDT (   dt_basedir,
  iter_tfile,
  iter_reports 
)
write fit functions plots for DT

 DT bellcurves and polynomials

set of plots of bellcurves
  x, dxdz, x vs. dxdz (for all 4 stations)
  y, dydz, x vs. dxdz (only for stations 1-3?)

set of plots of polynomials -- for stations 1-3 only??
  x vs. xpos,    x vs ypos,    x vs dxdz angle,    x vs dydz angle
  y vs. xpos,    y vs ypos,    y vs dxdz angle,    y vs dydz angle
  dxdz vs. xpos, dxdz vs ypos, dxdz vs dxdz angle, dxdz vs dydz angle
  dydz vs. xpos, dydz vs ypos, dydz vs dxdz angle, dydz vs dydz angle

set of plots of polynomials -- for station 4 only??
  x vs. xpos,    x vs dxdz angle
  dxdz vs. xpos, dxdz vs dxdz angle

made for all (wheel,station,sector) combinations

Interface: could be accesses through a general DT chambers map.

Definition at line 752 of file alignmentValidation.py.

00753                                                                :
00754   """write fit functions plots for DT
00755 
00756  DT bellcurves and polynomials
00757 
00758   set of plots of bellcurves
00759     x, dxdz, x vs. dxdz (for all 4 stations)
00760     y, dydz, x vs. dxdz (only for stations 1-3?)
00761 
00762   set of plots of polynomials -- for stations 1-3 only??
00763     x vs. xpos,    x vs ypos,    x vs dxdz angle,    x vs dydz angle
00764     y vs. xpos,    y vs ypos,    y vs dxdz angle,    y vs dydz angle
00765     dxdz vs. xpos, dxdz vs ypos, dxdz vs dxdz angle, dxdz vs dydz angle
00766     dydz vs. xpos, dydz vs ypos, dydz vs dxdz angle, dydz vs dydz angle
00767 
00768   set of plots of polynomials -- for station 4 only??
00769     x vs. xpos,    x vs dxdz angle
00770     dxdz vs. xpos, dxdz vs dxdz angle
00771 
00772   made for all (wheel,station,sector) combinations
00773 
00774   Interface: could be accesses through a general DT chambers map."""
00775 
00776   qcount = 0
00777   clearDDT()
00778   for wheel in DT_TYPES:
00779     if wheel[1]=="ALL": continue
00780     for station in wheel[2]:
00781       print wheel[0]+'/'+station[1]
00782       for sector in range(1,station[2]+1):
00783         if qcount>QUICKTESTN: break
00784         qcount += 1
00785         ssector = "%02d" % sector
00786         pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'+ssector+'/'
00787         label = "MBwh%sst%ssec%s" % (wheelLetter(int(wheel[1])),station[1],ssector)
00788         bellcurves(iter_tfile, iter_reports, label, False)
00789         #c1.SaveAs(pdir+'dt_bellcurves.png')
00790         saveAs(pdir+'dt_bellcurves.png')
00791         polynomials(iter_tfile, iter_reports, label, False)
00792         #c1.SaveAs(pdir+'dt_polynomials.png')
00793         saveAs(pdir+'dt_polynomials.png')
00794   #printDeltaTs()
00795 

def alignmentValidation::doIterationPlots (   iteration_directory,
  tfiles_plotting,
  iter_tfile,
  iter_reports 
)

Definition at line 835 of file alignmentValidation.py.

00836                                                                                     :
00837   dt_basedir = iteration_directory+'/'+'MB'
00838   csc_basedir = iteration_directory+'/'
00839 
00840   if DO_DT and DO_MAP:
00841     doMapPlotsDT(dt_basedir, tfiles_plotting)
00842   if DO_CSC and DO_MAP:
00843     doMapPlotsCSC(csc_basedir, tfiles_plotting)
00844 
00845   if DO_DT and DO_CURVATURE:
00846     doCurvaturePlotsDT(dt_basedir, tfiles_plotting)
00847   #if DO_CSC and DO_CURVATURE:
00848   #  doCurvaturePlotsCSC(csc_basedir, tfiles_plotting)
00849 
00850   if DO_DT and DO_SEGDIFF:
00851     doSegDiffPlotsDT(dt_basedir, tfiles_plotting, iter_reports)
00852   if DO_CSC and DO_SEGDIFF:
00853     doSegDiffPlotsCSC(csc_basedir, tfiles_plotting, iter_reports)
00854 
00855   if DO_DT and DO_FIT:
00856     doFitFunctionsPlotsDT(dt_basedir, iter_tfile, iter_reports)
00857   if DO_CSC and DO_FIT:
00858     doFitFunctionsPlotsCSC(csc_basedir, iter_tfile, iter_reports)
00859 

def alignmentValidation::doMapPlotsCSC (   csc_basedir,
  tfiles_plotting 
)
write CSC map plots

 "CSCvsphi_me%s%d%d" % (endcap, station, ring)

plots "integrated" over ALL SECTORS:
of rphi, drphi/dz vs. phi
made for all (endcap,station,ring) combinations

Interface: may be arranged into two station(1 .. 4) vs. R(1 .. 4) maps for both endcaps
with R range (1 .. 4) for stations 2-4
 It could be incorporated into a general CSC chambers map (column1: endcap, column2: station,
column3: ring, columns4-40 correspond to chamber #) by making ring numbers in column 3
clickable.


 "CSCvsr_me%s%dch%02d" % (endcap, station, chamberNumber)

plots "integrated" over ALL RINGS:
of rphi, drphi/dz vs. z
made for all (endcap,station,chamber) combinations

Interface: may be arranged into two station(1 .. 4) vs. chamber(1 .. 36) maps for both endcaps
It could be incorporated into an EXTENDED general CSC chambers map (extended by adding an
identifier "ALL" in column3 for ring number).

 "CSCvsr_me%s%dchALL" % (endcap, station)

plots spanning over ALL RINGS along r and integrated over all SECTORS:
of rphi, drphi/dz vs. z
made for all (endcap,station) combinations

Interface: may be arranged into two station(1 .. 4) maps for both endcaps
It could be incorporated into an EXTENDED general CSC chambers map (extended by adding an
identifier "ALL" in column3 for ring number).

Definition at line 453 of file alignmentValidation.py.

00454                                                :
00455   """write CSC map plots
00456 
00457  "CSCvsphi_me%s%d%d" % (endcap, station, ring)
00458 
00459   plots "integrated" over ALL SECTORS:
00460   of rphi, drphi/dz vs. phi
00461   made for all (endcap,station,ring) combinations
00462 
00463   Interface: may be arranged into two station(1 .. 4) vs. R(1 .. 4) maps for both endcaps
00464   with R range (1 .. 4) for stations 2-4
00465  It could be incorporated into a general CSC chambers map (column1: endcap, column2: station,
00466   column3: ring, columns4-40 correspond to chamber #) by making ring numbers in column 3
00467   clickable.
00468 
00469 
00470  "CSCvsr_me%s%dch%02d" % (endcap, station, chamberNumber)
00471 
00472   plots "integrated" over ALL RINGS:
00473   of rphi, drphi/dz vs. z
00474   made for all (endcap,station,chamber) combinations
00475 
00476   Interface: may be arranged into two station(1 .. 4) vs. chamber(1 .. 36) maps for both endcaps
00477   It could be incorporated into an EXTENDED general CSC chambers map (extended by adding an
00478   identifier "ALL" in column3 for ring number).
00479   
00480  "CSCvsr_me%s%dchALL" % (endcap, station)
00481 
00482   plots spanning over ALL RINGS along r and integrated over all SECTORS:
00483   of rphi, drphi/dz vs. z
00484   made for all (endcap,station) combinations
00485 
00486   Interface: may be arranged into two station(1 .. 4) maps for both endcaps
00487   It could be incorporated into an EXTENDED general CSC chambers map (extended by adding an
00488   identifier "ALL" in column3 for ring number)."""
00489 
00490   for endcap in CSC_TYPES:
00491     for station in endcap[2]:
00492       for ring in station[2]:
00493         if ring[1]=="ALL": continue
00494         pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'
00495         label = "CSCvsphi_me%s%s%s" % (endcap[1], station[1], ring[1])
00496         htitle = "%s%s/%s" % (endcap[0], station[1],ring[1])
00497         mapplot(tfiles_plotting, label, "x", window=15., title=htitle, fitsine=True,fitpeaks=True, peaksbins=2)
00498         #mapplot(tfiles_plotting, label, "x", window=15., title=htitle, fitsine=True)
00499         c1.SaveAs(pdir+'map_CSCvsphi_x.png')
00500         mapplot(tfiles_plotting, label, "dxdz", window=15., title=htitle, peaksbins=2)
00501         c1.SaveAs(pdir+'map_CSCvsphi_dxdz.png')
00502 
00503   saveTestResultsMap(options.runLabel)
00504 
00505   qcount = 0
00506   for endcap in CSC_TYPES:
00507     for station in endcap[2]:
00508       for ring in station[2]:
00509         if ring[1]!="ALL": continue
00510         for chamber in range(1,ring[2]+1):
00511           if qcount>QUICKTESTN: break
00512           qcount += 1
00513           schamber = "%02d" % chamber
00514           pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber+'/'
00515           label = "CSCvsr_me%s%sch%s" % (endcap[1], station[1], schamber)
00516           htitle = "%s%s/ALL/%d" % (endcap[0], station[1],chamber)
00517           mapplot(tfiles_plotting, label, "x", window=15., title=htitle, peaksbins=2)
00518           c1.SaveAs(pdir+'map_CSCvsr_x.png')
00519           mapplot(tfiles_plotting, label, "dxdz", window=15., title=htitle, peaksbins=2)
00520           c1.SaveAs(pdir+'map_CSCvsr_dxdz.png')
00521 
00522   qcount = 0
00523   for endcap in CSC_TYPES:
00524     for station in endcap[2]:
00525       for ring in station[2]:
00526         if ring[1]!="ALL": continue
00527         if qcount>QUICKTESTN: break
00528         qcount += 1
00529         schamber = "%02d" % chamber
00530         pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'
00531         label = "CSCvsr_me%s%schALL" % (endcap[1], station[1])
00532         htitle = "%s%s" % (endcap[0], station[1])
00533         mapplot(tfiles_plotting, label, "x", window=10., title=htitle, peaksbins=2)
00534         c1.SaveAs(pdir+'map_CSCvsr_all_x.png')
00535         mapplot(tfiles_plotting, label, "dxdz", window=10., title=htitle, peaksbins=2)
00536         c1.SaveAs(pdir+'map_CSCvsr_all_dxdz.png')
00537 
00538 

def alignmentValidation::doMapPlotsDT (   dt_basedir,
  tfiles_plotting 
)
write DT map plots

 "DTvsphi_st%dwh%s" % (station, wheelletter):

plots "integrated" over ALL SECTORS:
of x, y, dxdz, dydz vs. phi (y and dydz only for stations 1-3)
made for all (station,wheel) combinations

Access interface may be arranged into station(1 .. 4) vs. wheel(-2 .. +2) map.
It could be incorporated into a general DT chambers map (column1: wheel, column2: station,
columns3-16 correspond to sector #) by making station numbers in column 2 clickable.


 "DTvsz_st%dsec%02d" % (station, sector)

plots "integrated" over ALL WHEELS:
of x, y, dxdz, dydz vs. z (y and dydz only for stations 1-3)
made for all (station,sector) combinations

Interface: may be arranged into station(1 .. 4) vs. sector(1 .. 14) map with sector range
(1 .. 12) for stations 1-3.
It could be incorporated into an EXTENDED general DT chambers map (extended by adding an
identifier "ALL" in column1 for wheel number).


 "DTvsz_st%dsecALL" % (station)

plots spanning in z over ALL WHEELS and "integrated" over all sectors:
of x, y, dxdz, dydz vs. z (y and dydz only for stations 1-3)
made for all stations

Interface: may be arranged into station(1 .. 4) map 
It could be incorporated into an EXTENDED general DT chambers map (extended by adding an
identifier "ALL" in column1 for wheel number).

Definition at line 347 of file alignmentValidation.py.

00348                                              :
00349   """write DT map plots
00350 
00351  "DTvsphi_st%dwh%s" % (station, wheelletter):
00352 
00353   plots "integrated" over ALL SECTORS:
00354   of x, y, dxdz, dydz vs. phi (y and dydz only for stations 1-3)
00355   made for all (station,wheel) combinations
00356 
00357   Access interface may be arranged into station(1 .. 4) vs. wheel(-2 .. +2) map.
00358   It could be incorporated into a general DT chambers map (column1: wheel, column2: station,
00359   columns3-16 correspond to sector #) by making station numbers in column 2 clickable.
00360   
00361 
00362  "DTvsz_st%dsec%02d" % (station, sector)
00363 
00364   plots "integrated" over ALL WHEELS:
00365   of x, y, dxdz, dydz vs. z (y and dydz only for stations 1-3)
00366   made for all (station,sector) combinations
00367 
00368   Interface: may be arranged into station(1 .. 4) vs. sector(1 .. 14) map with sector range
00369   (1 .. 12) for stations 1-3.
00370   It could be incorporated into an EXTENDED general DT chambers map (extended by adding an
00371   identifier "ALL" in column1 for wheel number).
00372 
00373 
00374  "DTvsz_st%dsecALL" % (station)
00375 
00376   plots spanning in z over ALL WHEELS and "integrated" over all sectors:
00377   of x, y, dxdz, dydz vs. z (y and dydz only for stations 1-3)
00378   made for all stations
00379 
00380   Interface: may be arranged into station(1 .. 4) map 
00381   It could be incorporated into an EXTENDED general DT chambers map (extended by adding an
00382   identifier "ALL" in column1 for wheel number)."""
00383   
00384   
00385   for wheel in DT_TYPES:
00386     if wheel[1]=="ALL": continue
00387     for station in wheel[2]:
00388       pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'
00389       label = "DTvsphi_st%dwh%s" % (int(station[1]), wheelLetter(int(wheel[1])))
00390       htitle = "wheel %+d, station %s" % (int(wheel[1]), station[1])
00391       #mapplot(tfiles_plotting, label, "x", window=25., title=htitle, fitsawteeth=True,fitsine=True)
00392       mapplot(tfiles_plotting, label, "x", window=10., title=htitle, fitsine=True,fitpeaks=True,peaksbins=2)
00393       c1.SaveAs(pdir+'map_DTvsphi_x.png')
00394       #mapplot(tfiles_plotting, label, "dxdz", window=25., title=htitle, fitsawteeth=True,fitsine=True)
00395       mapplot(tfiles_plotting, label, "dxdz", window=10., title=htitle,peaksbins=2)
00396       c1.SaveAs(pdir+'map_DTvsphi_dxdz.png')
00397 
00398       if station[1]=='4': continue
00399       #mapplot(tfiles_plotting, label, "y", window=25., title=htitle, fitsawteeth=True,fitsine=True)
00400       mapplot(tfiles_plotting, label, "y", window=10., title=htitle,peaksbins=2)
00401       c1.SaveAs(pdir+'map_DTvsphi_y.png')
00402       #mapplot(tfiles_plotting, label, "dydz", window=25., title=htitle, fitsawteeth=True,fitsine=True)
00403       mapplot(tfiles_plotting, label, "dydz", window=10., title=htitle,peaksbins=2)
00404       c1.SaveAs(pdir+'map_DTvsphi_dydz.png')
00405 
00406   
00407   qcount=0
00408   for wheel in DT_TYPES:
00409     if wheel[1]!="ALL": continue
00410     for station in wheel[2]:
00411       for sector in range(1,station[2]+1):
00412         if qcount>QUICKTESTN: break
00413         qcount += 1
00414         ssector = "%02d" % sector
00415         pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'+ssector+'/'
00416         label = "DTvsz_st%ssec%s" % (station[1], ssector)
00417         htitle = "station %s, sector %d" % (station[1], sector)
00418         mapplot(tfiles_plotting, label, "x", window=10., title=htitle, peaksbins=2)
00419         c1.SaveAs(pdir+'map_DTvsz_x.png')
00420         mapplot(tfiles_plotting, label, "dxdz", window=10., title=htitle, peaksbins=2)
00421         c1.SaveAs(pdir+'map_DTvsz_dxdz.png')
00422         
00423         if station[1]=='4': continue
00424         mapplot(tfiles_plotting, label, "y", window=10., title=htitle, peaksbins=2)
00425         c1.SaveAs(pdir+'map_DTvsz_y.png')
00426         mapplot(tfiles_plotting, label, "dydz", window=10., title=htitle, peaksbins=2)
00427         c1.SaveAs(pdir+'map_DTvsz_dydz.png')
00428   
00429   qcount=0
00430   for wheel in DT_TYPES:
00431     if wheel[1]!="ALL": continue
00432     for station in wheel[2]:
00433       if qcount>QUICKTESTN: break
00434       qcount += 1
00435       pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'
00436       label = "DTvsz_st%ssecALL" % (station[1])
00437       htitle = "station %s" % (station[1])
00438       
00439       print label, 
00440       mapplot(tfiles_plotting, label, "x", window=10., title=htitle, peaksbins=2)
00441       c1.SaveAs(pdir+'map_DTvsz_all_x.png')
00442       mapplot(tfiles_plotting, label, "dxdz", window=10., title=htitle, peaksbins=2)
00443       c1.SaveAs(pdir+'map_DTvsz_all_dxdz.png')
00444       
00445       if station[1]=='4': continue
00446       mapplot(tfiles_plotting, label, "y", window=10., title=htitle, peaksbins=2)
00447       c1.SaveAs(pdir+'map_DTvsz_all_y.png')
00448       mapplot(tfiles_plotting, label, "dydz", window=10., title=htitle, peaksbins=2)
00449       c1.SaveAs(pdir+'map_DTvsz_all_dydz.png')
00450 
00451   saveTestResultsMap(options.runLabel)
00452 

def alignmentValidation::doSegDiffPlotsCSC (   csc_basedir,
  tfiles_plotting,
  iter_reports 
)
write segment-difference plots for CSC
 
 segdiff "csc_resid" and "csc_slope"

set of plots of
rphi vs qpt, rphi for positive, rphi for negative ("csc_resid")
drphidz vs qpt, drphidz for positive, drphidz for negative ("csc_slope")
done for ME1-ME2, ME2-ME3, and ME3-ME4 stations combinations with
  endcap "m" or "p" 
  ring 1 or 2
  chamber 1-18 (r1) or 1-36 (r2)
note: there's no ME3-ME4 plots for R2

Interface: could be accessed through a general CSC chambers map, but only for chambers in
stations 2-4 (e.g., station 2 would provide ME1-ME2 plots).

Definition at line 689 of file alignmentValidation.py.

00690                                                                  :
00691   """write segment-difference plots for CSC
00692  
00693  segdiff "csc_resid" and "csc_slope"
00694 
00695   set of plots of
00696   rphi vs qpt, rphi for positive, rphi for negative ("csc_resid")
00697   drphidz vs qpt, drphidz for positive, drphidz for negative ("csc_slope")
00698   done for ME1-ME2, ME2-ME3, and ME3-ME4 stations combinations with
00699     endcap "m" or "p" 
00700     ring 1 or 2
00701     chamber 1-18 (r1) or 1-36 (r2)
00702   note: there's no ME3-ME4 plots for R2
00703   
00704   Interface: could be accessed through a general CSC chambers map, but only for chambers in
00705   stations 2-4 (e.g., station 2 would provide ME1-ME2 plots)."""
00706 
00707   qcount = 0
00708   for iendcap in CSC_TYPES:
00709     for istation in iendcap[2]:
00710       if istation[1]=="1": continue
00711       dstations = (int(istation[1])-1)*10 + int(istation[1])
00712       for iring in istation[2]:
00713         if iring[1]=="ALL": continue
00714         if istation[1]=="4" and iring[1]=="2": continue
00715         for ichamber in range(1,iring[2]+1):
00716           if qcount>QUICKTESTN: break
00717           qcount += 1
00718           schamber = "%02d" % ichamber
00719           pdir = csc_basedir+'/'+iendcap[0]+'/'+istation[1]+'/'+iring[1]+'/'+schamber+'/'
00720           segdiff(tfiles_plotting, "csc_resid", dstations, 
00721                   endcap=iendcap[1], ring=int(iring[1]), chamber=ichamber, window=15.)
00722           c1.SaveAs(pdir + 'segdif_csc_resid.png')
00723           segdiff(tfiles_plotting, "csc_slope", dstations, 
00724                   endcap=iendcap[1], ring=int(iring[1]), chamber=ichamber, window=15.)
00725           c1.SaveAs(pdir + 'segdif_csc_slope.png')
00726 
00727   """segdiffvsphicsc "csc_resid" and "csc_slope"
00728 
00729   plot for a specific deltaME station differences:
00730   rphi vs phi of pair ("csc_resid")
00731   dxdz vs phi of pair ("csc_slope")
00732   contains plots for two (or one for ME4-ME3) rings
00733   done for ME1-ME2, ME2-ME3, and ME3-ME4 stations combinations with
00734     endcap "m" or "p" 
00735   
00736   Interface: could be accessed by clicking on ME station boxes, but only for stations 2-4 
00737   (e.g., station 2 would provide ME1-ME2 plots)."""
00738 
00739   qcount = 0
00740   for iendcap in CSC_TYPES:
00741     for istation in iendcap[2]:
00742       if istation[1]=="1": continue
00743       dstations = (int(istation[1])-1)*10 + int(istation[1])
00744       if qcount>QUICKTESTN: break
00745       qcount += 1
00746       pdir = csc_basedir+'/'+iendcap[0]+'/'+istation[1]+'/'
00747       segdiffvsphicsc(tfiles_plotting, "csc_resid", dstations, window=10., endcap=iendcap[1])
00748       c1.SaveAs(pdir + 'segdifphi_csc_resid.png')
00749       segdiffvsphicsc(tfiles_plotting, "csc_slope", dstations, window=10., endcap=iendcap[1])
00750       c1.SaveAs(pdir + 'segdifphi_csc_slope.png')
00751 

def alignmentValidation::doSegDiffPlotsDT (   dt_basedir,
  tfiles_plotting,
  iter_reports 
)
write segment-difference plots for DT

 segdiff "dt13_resid" and "dt13_slope"

set of plots of
x vs qpt, x for positive, x for negative ("dt13_resid")
dxdz vs qpt, dxdz for positive, dxdz for negative ("dt13_slope")
done for MB1-MB2, MB2-MB3, and MB3-MB4 stations combinations with all possible (wheel, sector)

Interface: could be accessed through a general DT chambers map, but only for chambers in
stations 2-4 (e.g., station 2 would provide MB1-MB2 plots).

 segdiff "dt2_resid" and "dt2_slope"

set of plots of
y vs q/pt, y for positive, y for negative ("dt2_resid")
dydz vs q/pt, dydz for positive, dydz for negative ("dt2_slope")
done for MB1-MB2, MB2-MB3 stations combinations with all possible (wheel, sector)

Interface: then the interface would still be a general DT map,
but the info only available from station 2 & 3 chambers.

Definition at line 580 of file alignmentValidation.py.

00581                                                                :
00582   """write segment-difference plots for DT
00583 
00584  segdiff "dt13_resid" and "dt13_slope"
00585 
00586   set of plots of
00587   x vs qpt, x for positive, x for negative ("dt13_resid")
00588   dxdz vs qpt, dxdz for positive, dxdz for negative ("dt13_slope")
00589   done for MB1-MB2, MB2-MB3, and MB3-MB4 stations combinations with all possible (wheel, sector)
00590 
00591   Interface: could be accessed through a general DT chambers map, but only for chambers in
00592   stations 2-4 (e.g., station 2 would provide MB1-MB2 plots).
00593 
00594  segdiff "dt2_resid" and "dt2_slope"
00595 
00596   set of plots of
00597   y vs q/pt, y for positive, y for negative ("dt2_resid")
00598   dydz vs q/pt, dydz for positive, dydz for negative ("dt2_slope")
00599   done for MB1-MB2, MB2-MB3 stations combinations with all possible (wheel, sector)
00600 
00601   Interface: then the interface would still be a general DT map,
00602   but the info only available from station 2 & 3 chambers."""
00603 
00604   qcount = 0
00605   for iwheel in DT_TYPES:
00606     if iwheel[1]=="ALL": continue
00607     for istation in iwheel[2]:
00608       if istation[1]=="1": continue
00609       dstations = (int(istation[1])-1)*10 + int(istation[1])
00610       #print dstations
00611       for isector in range(1, istation[2] + 1):
00612         if isector > 12: continue
00613         if qcount>QUICKTESTN: break
00614         qcount += 1
00615         ssector = "%02d" % isector
00616         pdir = dt_basedir + '/' + iwheel[0] + '/' + istation[1] + '/' + ssector + '/'
00617         
00618         segdiff(tfiles_plotting, "dt13_resid", dstations, wheel=int(iwheel[1]), sector=isector, window=15.)
00619         c1.SaveAs(pdir + 'segdif_dt13_resid.png')
00620         segdiff(tfiles_plotting, "dt13_slope", dstations, wheel=int(iwheel[1]), sector=isector, window=15.)
00621         c1.SaveAs(pdir + 'segdif_dt13_slope.png')
00622         
00623         if istation[1] != '4':
00624           segdiff(tfiles_plotting, "dt2_resid", dstations, wheel=int(iwheel[1]), sector=isector, window=15.)
00625           c1.SaveAs(pdir + 'segdif_dt2_resid.png')
00626           segdiff(tfiles_plotting, "dt2_slope", dstations, wheel=int(iwheel[1]), sector=isector, window=15.)
00627           c1.SaveAs(pdir + 'segdif_dt2_slope.png')
00628         
00629   qcount = 0
00630   for iwheel in DT_TYPES:
00631     if iwheel[1]=="ALL": continue
00632     if abs(int(iwheel[1])) != 2: continue
00633     for istation in iwheel[2]:
00634       if istation[1]=="3": continue
00635       #print dstations
00636       for isector in range(1, istation[2] + 1):
00637         ssector = "%02d" % isector
00638         pdir = dt_basedir + '/' + iwheel[0] + '/' + istation[1] + '/' + ssector + '/'
00639         if istation[1]=="1":
00640           segdiff_xalign(tfiles_plotting, "x_dt1_csc", wheel=int(iwheel[1]), sector=isector, cscstations = "12")
00641           c1.SaveAs(pdir + 'segdif_x_dt_csc_resid.png')
00642         if istation[1]=="2":
00643           segdiff_xalign(tfiles_plotting, "x_dt2_csc", wheel=int(iwheel[1]), sector=isector, cscstations = "1")
00644           c1.SaveAs(pdir + 'segdif_x_dt_csc_resid.png')
00645 
00646   """segdiffvsphi "dt13_resid" and "dt13_slope"
00647 
00648   plot for a specific wheel #:
00649   x vs phi of pair ("dt13_resid")
00650   dxdz vs phi of pair ("dt13_slope")
00651   contains all three combinations of neighboring stations
00652   made for all possible wheel values
00653 
00654   Interface: could be accessed by clicking on wheel number under the "wheel" column
00655   in a general DT map
00656 
00657  segdiffvsphi "dt2_resid" and "dt2_slope"
00658 
00659   plot for a specific wheel #:
00660   y vs phi of pair ("dt2_resid")
00661   dydz vs phi of pair ("dt2_slope")
00662   contains both MB1-MB2 and MB2-MB3 combinations
00663   made for all possible wheel values
00664 
00665   Interface: could be accessed by clicking on wheel number under the "wheel" column
00666   in a general DT map"""
00667 
00668   if len(iter_reports)==0: return
00669   
00670   for iwheel in DT_TYPES:
00671     if iwheel[1]=="ALL": continue
00672     pdir = dt_basedir + '/' + iwheel[0] + '/'
00673     segdiffvsphi(tfiles_plotting, iter_reports, "dt13_resid", int(iwheel[1]), window=10.)#, excludesectors=(1,7))
00674     c1.SaveAs(pdir + 'segdifphi_dt13_resid.png')
00675     segdiffvsphi(tfiles_plotting, iter_reports, "dt13_slope", int(iwheel[1]), window=10.)#, excludesectors=(1,7))
00676     c1.SaveAs(pdir + 'segdifphi_dt13_slope.png')
00677     segdiffvsphi(tfiles_plotting, iter_reports, "dt2_resid", int(iwheel[1]), window=10.)#, excludesectors=(1,7))
00678     c1.SaveAs(pdir + 'segdifphi_dt2_resid.png')
00679     segdiffvsphi(tfiles_plotting, iter_reports, "dt2_slope", int(iwheel[1]), window=15.)#, excludesectors=(1,7))
00680     c1.SaveAs(pdir + 'segdifphi_dt2_slope.png')
00681 
00682   for iwheel in DT_TYPES:
00683     if iwheel[1]=="ALL": continue
00684     if abs(int(iwheel[1])) != 2: continue
00685     pdir = dt_basedir + '/' + iwheel[0] + '/'
00686     segdiffvsphi_xalign(tfiles_plotting, int(iwheel[1]), window=10.)
00687     c1.SaveAs(pdir + 'segdifphi_x_dt_csc_resid.png')
00688 

def alignmentValidation::idsForFile (   dir_name,
  file_name 
)
Recursively looks for file named file_name under dir_name directory
and fill the list with dir names converted to IDs 

Definition at line 909 of file alignmentValidation.py.

00910                                    :
00911   '''Recursively looks for file named file_name under dir_name directory
00912   and fill the list with dir names converted to IDs 
00913   '''
00914   id_list = []
00915   for f in os.listdir(dir_name):
00916     dirfile = os.path.join(dir_name, f)
00917     if os.path.isfile(dirfile) and f==file_name:
00918       if file_name[-4:]=='.php': id_list.append(dir_name+'/'+file_name)
00919       else:    id_list.append(dirToID(dir_name))
00920     # recursively access file names in subdirectories
00921     elif os.path.isdir(dirfile):
00922       #print "Accessing directory:", dirfile
00923       ids = idsForFile(dirfile, file_name)
00924       if (len(ids)>0): 
00925         id_list.extend(ids)
00926   return id_list
00927 

def alignmentValidation::isFileUnderDir (   dir_name,
  file_name 
)

functions definitions

Recursively looks for file named file_name under dir_name directory

Definition at line 279 of file alignmentValidation.py.

00280                                        :
00281   '''Recursively looks for file named file_name under dir_name directory
00282   '''
00283   if not DO_DT and dir_name.find("MB")>-1:
00284     return False
00285   if not DO_CSC and dir_name.find("ME")>-1:
00286     return False
00287   
00288   for f in os.listdir(dir_name):
00289     dirfile = os.path.join(dir_name, f)
00290     if os.path.isfile(dirfile) and f==file_name:
00291       return True
00292     # recursively access file names in subdirectories
00293     elif os.path.isdir(dirfile):
00294       #print "Accessing directory:", dirfile
00295       if isFileUnderDir(dirfile, file_name): return True
00296   return False
00297 
00298 
# to time saving of plots
def alignmentValidation::saveAs (   nm)

Definition at line 299 of file alignmentValidation.py.

00299               : 
00300   t1 = time.time()
00301   ddt[15] += 1
00302   c1.SaveAs(nm)
00303   tn = time.time()
00304   ddt[16] = 1./ddt[15]*((ddt[15]-1)*ddt[16] + tn-t1)
00305 
00306 

Variable Documentation

string alignmentValidation::action = "store_true"

Definition at line 80 of file alignmentValidation.py.

Definition at line 198 of file alignmentValidation.py.

tuple alignmentValidation::c1 = ROOT.TCanvas("c1","c1",800,600)

do drawing

Definition at line 1023 of file alignmentValidation.py.

Referenced by reco::CompositeCandidate::addDaughter(), reco::NamedCompositeCandidate::addDaughter(), DimuonStatistics::analyze(), GlbMuQualityCutsAnalysis::analyze(), reco::CompositeCandidate::applyRoles(), reco::NamedCompositeCandidate::applyRoles(), TwoBodyDecayModel::cartesianSecondaryMomenta(), condbon::cdbon_write(), CandCombinerBase< OutputCollection, CandPtr >::combine(), HICTrajectoryCorrector::correct(), TwoBodyDecayDerivatives::dqsdm(), TwoBodyDecayDerivatives::dqsdphi(), TwoBodyDecayDerivatives::dqsdpx(), TwoBodyDecayDerivatives::dqsdpy(), TwoBodyDecayDerivatives::dqsdpz(), TwoBodyDecayDerivatives::dqsdtheta(), EcalBarrelRecHitsMaker::EcalBarrelRecHitsMaker(), EcalEndcapRecHitsMaker::EcalEndcapRecHitsMaker(), DTNoiseComputation::endJob(), HOCalibAnalyzer::endJob(), DTCreateSummaryHistos::endJob(), DTAlbertoBenvenutiTask::endJob(), SiStripQualityDQM::fillGrandSummaryMEs(), SiStripBaseCondObjDQM::fillSummaryMEs(), SiStripApvGainsDQM::fillSummaryMEs(), SiStripLorentzAngleDQM::fillSummaryMEs(), SiStripQualityDQM::fillSummaryMEs(), SiStripPedestalsDQM::fillSummaryMEs(), hitfit::Chisq_Constrainer::fit(), DTSegmentUpdator::Fit4Var(), SiStripCablingDQM::getActiveDetIds(), GridInterpolator3DException::GridInterpolator3DException(), MonitorElementsDb::htmlOutput(), PFDisplacedVertexHelper::identifyVertex(), CSCWireGeometry::intersection(), CSCLayerGeometry::intersectionOfTwoLines(), PFDisplacedVertexHelper::lambdaCP(), RadialStripTopology::localError(), main(), SiStripRecHitMatcher::match(), GSRecHitMatcher::match(), GlobalTrackerMuonAlignment::misalignMuon(), GlobalTrackerMuonAlignment::misalignMuonL(), SiPixelHistoricInfoReader::plot(), PFAlgoTestBenchElectrons::processBlock(), DimuonMCMatcher::produce(), CSCTFPtMethods::Pt3Stn(), DTConfigDBProducer::readDTCCBConfig(), PFSCEnergyCalibration::SCCorrEtEtaBarrel(), LinearEquation3< T >::solution(), align::toMatrix(), VVIObj::VVIObj(), CSCWireGeometry::wireEnds(), and GlobalTrackerMuonAlignment::writeGlPosRcd().

Definition at line 222 of file alignmentValidation.py.

string alignmentValidation::comdir = "common/"

setup output:

Definition at line 1008 of file alignmentValidation.py.

Definition at line 39 of file alignmentValidation.py.

string alignmentValidation::dest = "runLabel"

Definition at line 40 of file alignmentValidation.py.

Definition at line 167 of file alignmentValidation.py.

Definition at line 182 of file alignmentValidation.py.

alignmentValidation::DO_DIAGNOSTIC = options.diagnostic

Definition at line 196 of file alignmentValidation.py.

Definition at line 166 of file alignmentValidation.py.

Definition at line 183 of file alignmentValidation.py.

Definition at line 180 of file alignmentValidation.py.

Definition at line 184 of file alignmentValidation.py.

Definition at line 181 of file alignmentValidation.py.

string alignmentValidation::help = "[REQUIRED] label to use for a run"

Definition at line 37 of file alignmentValidation.py.

alignmentValidation::i1prefix = options.i1prefix

Definition at line 155 of file alignmentValidation.py.

alignmentValidation::iNprefix = options.iNprefix

Definition at line 158 of file alignmentValidation.py.

Definition at line 960 of file alignmentValidation.py.

Definition at line 959 of file alignmentValidation.py.

Definition at line 1009 of file alignmentValidation.py.

Definition at line 1010 of file alignmentValidation.py.

Definition at line 981 of file alignmentValidation.py.

Definition at line 980 of file alignmentValidation.py.

alignmentValidation::outdir = options.outputDir

Definition at line 152 of file alignmentValidation.py.

tuple alignmentValidation::parser = optparse.OptionParser(usage)

Definition at line 34 of file alignmentValidation.py.

tuple alignmentValidation::pic_ids = createCanvasToIDList("canvas2id_list.js")

Definition at line 1045 of file alignmentValidation.py.

Definition at line 215 of file alignmentValidation.py.

Definition at line 177 of file alignmentValidation.py.

Definition at line 958 of file alignmentValidation.py.

Definition at line 979 of file alignmentValidation.py.

string alignmentValidation::type = "string"

Definition at line 38 of file alignmentValidation.py.

string alignmentValidation::usage = '%prog [options]\n'

To parse commandline args.

Definition at line 17 of file alignmentValidation.py.