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)
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 731 of file alignmentValidation.py.

00732                                                 :
00733   '''Use CANVASES_LIST_TEMPLATE as a template to create a canvases list include for the browser.
00734      Write out only those canvases which have existing filename.png plots.
00735   '''
00736   CANVASES_LIST = []
00737   for scope in CANVASES_LIST_TEMPLATE:
00738     scope_entry = []
00739     if len(scope)>2:
00740       scope_entry = [scope[0],scope[1]]
00741       for canvas_entry in scope[2:]:
00742         if isFileUnderDir("./",canvas_entry[1]):
00743           scope_entry.append(canvas_entry)
00744     CANVASES_LIST.append(scope_entry)
00745 
00746   ff = open(fname,mode="w")
00747   print >>ff, "var CANVASES_LIST = "
00748   json.dump(CANVASES_LIST,ff)
00749   ff.close()
00750 

def alignmentValidation::createCanvasToIDList (   fname = "canvas2id_list.js")
Create a canvas-to-ids list include for the browser.
   Write out only those canvases which have existing filename.png plots.

Definition at line 751 of file alignmentValidation.py.

00752                                                    :
00753   '''Create a canvas-to-ids list include for the browser.
00754      Write out only those canvases which have existing filename.png plots.
00755   '''
00756   CANVAS2ID_LIST = []
00757   for scope in CANVASES_LIST_TEMPLATE:
00758     if len(scope)>2:
00759       for canvas_entry in scope[2:]:
00760         ids = idsForFile("./",canvas_entry[1])
00761         #  scope_entry.append(canvas_entry)
00762         # uniquify:
00763         set_ids = set(ids)
00764         uids = list(set_ids)
00765         print canvas_entry, ":", len(uids), "ids"
00766         if (len(uids)>0):
00767           CANVAS2ID_LIST.append( (canvas_entry[1],uids) )
00768   #print CANVAS2ID_LIST
00769   CANVAS2ID_LIST_DICT = dict(CANVAS2ID_LIST)
00770   #print CANVAS2ID_LIST_DICT
00771   ff = open(fname,mode="w")
00772   print >>ff, "var CANVAS2ID_LIST = "
00773   json.dump(CANVAS2ID_LIST_DICT,ff)
00774   ff.close()

def alignmentValidation::createDirectoryStructure (   iteration_name)

Definition at line 293 of file alignmentValidation.py.

00294                                             :
00295   
00296   if not os.access(iteration_name,os.F_OK):
00297     os.mkdir(iteration_name)
00298 
00299   csc_basedir = iteration_name+'/'
00300   for endcap in CSC_TYPES:
00301     #print csc_basedir+endcap[0]
00302     shutil.rmtree(csc_basedir+endcap[0],True)
00303     os.mkdir(csc_basedir+endcap[0])
00304     for station in endcap[2]:
00305       #print csc_basedir+endcap[0]+'/'+station[1]
00306       os.mkdir(csc_basedir+endcap[0]+'/'+station[1])
00307       for ring in station[2]:
00308         #print csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1]
00309         os.mkdir(csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1])
00310         for chamber in range(1,ring[2]+1):
00311           schamber = "%02d" % chamber
00312           #print csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber
00313           os.mkdir(csc_basedir+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber)
00314 
00315   dt_basedir = iteration_name+'/MB/'
00316   #print dt_basedir
00317   shutil.rmtree(dt_basedir,True)
00318   os.mkdir(dt_basedir)
00319   for wheel in DT_TYPES:
00320     #print dt_basedir+wheel[0]
00321     os.mkdir(dt_basedir+wheel[0])
00322     for station in wheel[2]:
00323       #print dt_basedir+wheel[0]+'/'+station[1]
00324       os.mkdir(dt_basedir+wheel[0]+'/'+station[1])
00325       for sector in range(1,station[2]+1):
00326         ssector = "%02d" % sector
00327         #print dt_basedir+wheel[0]+'/'+station[1]+'/'+ssector
00328         os.mkdir(dt_basedir+wheel[0]+'/'+station[1]+'/'+ssector)
00329 
00330   print os.getcwd()

def alignmentValidation::dirToID (   d)

Definition at line 793 of file alignmentValidation.py.

00794               :
00795   if d[-1]!='/': d += '/'
00796   dtn = d.find("/MB/")
00797   if dtn!=-1:
00798     return d[dtn+4:-1]
00799   cscn = d.find("/ME-/")
00800   if cscn!=-1:
00801     return 'ME-'+d[cscn+4:-1]
00802   cscn = d.find("/ME+/")
00803   if cscn!=-1:
00804     return 'ME+'+d[cscn+4:-1]
00805   return ''
00806 

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 461 of file alignmentValidation.py.

00462                                                    :
00463   """write DT curvature plots
00464 
00465   "wheel%s_sector%s" % (wheel, sector)
00466 
00467   wheel in "m2", "m1", "z", "p1", "p2"
00468   station 1 only!
00469   sector in "01", ..., "12"
00470 
00471   "param" may be one of 
00472     "deltax" (Delta x position residuals),
00473     "deltadxdz" (Delta (dx/dz) angular residuals),
00474     "curverr" (Delta x * d(Delta q/pT)/d(Delta x) = Delta q/pT in the absence of misalignment) - not necessary
00475 
00476   made for all (wheel,station=1,sector) combinations
00477 
00478   Interface: could be accesses through a general DT chambers map for station=1 chambers."""
00479   
00480   w_dict = {'-2':'m2', '-1':'m1', '0':'z', '1':'p1', '2':'p2'}
00481   qcount = 0
00482   for wheel in DT_TYPES:
00483     if wheel[1]=="ALL": continue
00484     #station = 1
00485     station = wheel[2][0]
00486     print wheel[0]+'/'+station[1]
00487     for sector in range(1,station[2]+1):
00488       if sector>12: break
00489       if qcount>QUICKTESTN: break
00490       qcount += 1
00491       ssector = "%02d" % sector
00492       pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'+ssector+'/'
00493       label = "wheel%s_sector%s" % (w_dict[wheel[1]], ssector)
00494       thetitle ="Wheel %s, sector %s" % (wheel[1], ssector)
00495       curvatureplot(tfiles_plotting, label, "deltax", title=thetitle, window=15., fitline=True)
00496       saveAs(pdir+'dt_curvature_deltax.png')
00497       curvatureplot(tfiles_plotting, label, "deltadxdz", title=thetitle, window=15., fitline=True)
00498       saveAs(pdir+'dt_curvature_deltadxdz.png')
00499 

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 667 of file alignmentValidation.py.

00668                                                                  :
00669   """write fit functions plots for CSC
00670 
00671  CSC bellcurves and polynomials
00672 
00673   set of plots of bellcurves
00674     rphi, drphidz, rphi vs. drphidz
00675 
00676   set of plots of polynomials
00677     rphi vs. rphi pos,    rphi vs drphidz angle
00678     drphidz vs. rphi pos, drphidz vs drphidz angle
00679 
00680   made for all (endcap,station,ring,chamber) combinations
00681 
00682   Interface: could be accesses through a general CSC chambers map."""
00683 
00684   qcount = 0
00685   clearDDT()
00686   for endcap in CSC_TYPES:
00687     for station in endcap[2]:
00688       for ring in station[2]:
00689         if ring[1]=="ALL": continue
00690         print endcap[0]+'/'+station[1]+'/'+ring[1]
00691         for chamber in range(1,ring[2]+1):
00692           if qcount>QUICKTESTN: break
00693           qcount += 1
00694           schamber = "%02d" % chamber
00695           pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber+'/'
00696           label = "ME%s%s%s_%s" % (endcap[1], station[1], ring[1], schamber)
00697           bellcurves(iter_tfile, iter_reports, label, False)
00698           #c1.SaveAs(pdir+'csc_bellcurves.png')
00699           saveAs(pdir+'csc_bellcurves.png')
00700           polynomials(iter_tfile, iter_reports, label, False)
00701           #c1.SaveAs(pdir+'csc_polynomials.png')
00702           saveAs(pdir+'csc_polynomials.png')
00703   #printDeltaTs()
00704 
00705 

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 623 of file alignmentValidation.py.

00624                                                                :
00625   """write fit functions plots for DT
00626 
00627  DT bellcurves and polynomials
00628 
00629   set of plots of bellcurves
00630     x, dxdz, x vs. dxdz (for all 4 stations)
00631     y, dydz, x vs. dxdz (only for stations 1-3?)
00632 
00633   set of plots of polynomials -- for stations 1-3 only??
00634     x vs. xpos,    x vs ypos,    x vs dxdz angle,    x vs dydz angle
00635     y vs. xpos,    y vs ypos,    y vs dxdz angle,    y vs dydz angle
00636     dxdz vs. xpos, dxdz vs ypos, dxdz vs dxdz angle, dxdz vs dydz angle
00637     dydz vs. xpos, dydz vs ypos, dydz vs dxdz angle, dydz vs dydz angle
00638 
00639   set of plots of polynomials -- for station 4 only??
00640     x vs. xpos,    x vs dxdz angle
00641     dxdz vs. xpos, dxdz vs dxdz angle
00642 
00643   made for all (wheel,station,sector) combinations
00644 
00645   Interface: could be accesses through a general DT chambers map."""
00646 
00647   qcount = 0
00648   clearDDT()
00649   for wheel in DT_TYPES:
00650     if wheel[1]=="ALL": continue
00651     for station in wheel[2]:
00652       print wheel[0]+'/'+station[1]
00653       for sector in range(1,station[2]+1):
00654         if qcount>QUICKTESTN: break
00655         qcount += 1
00656         ssector = "%02d" % sector
00657         pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'+ssector+'/'
00658         label = "MBwh%sst%ssec%s" % (wheelLetter(int(wheel[1])),station[1],ssector)
00659         bellcurves(iter_tfile, iter_reports, label, False)
00660         #c1.SaveAs(pdir+'dt_bellcurves.png')
00661         saveAs(pdir+'dt_bellcurves.png')
00662         polynomials(iter_tfile, iter_reports, label, False)
00663         #c1.SaveAs(pdir+'dt_polynomials.png')
00664         saveAs(pdir+'dt_polynomials.png')
00665   #printDeltaTs()
00666 

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

Definition at line 706 of file alignmentValidation.py.

00707                                                                                     :
00708   dt_basedir = iteration_directory+'/'+'MB'
00709   csc_basedir = iteration_directory+'/'
00710 
00711   if DO_DT and DO_MAP:
00712     doMapPlotsDT(dt_basedir, tfiles_plotting)
00713   if DO_CSC and DO_MAP:
00714     doMapPlotsCSC(csc_basedir, tfiles_plotting)
00715 
00716   if DO_DT and DO_CURVATURE:
00717     doCurvaturePlotsDT(dt_basedir, tfiles_plotting)
00718   #if DO_CSC and DO_CURVATURE:
00719   #  doCurvaturePlotsCSC(csc_basedir, tfiles_plotting)
00720 
00721   if DO_DT and DO_SEGDIFF:
00722     doSegDiffPlotsDT(dt_basedir, tfiles_plotting, iter_reports)
00723   if DO_CSC and DO_SEGDIFF:
00724     doSegDiffPlotsCSC(csc_basedir, tfiles_plotting, iter_reports)
00725 
00726   if DO_DT and DO_FIT:
00727     doFitFunctionsPlotsDT(dt_basedir, iter_tfile, iter_reports)
00728   if DO_CSC and DO_FIT:
00729     doFitFunctionsPlotsCSC(csc_basedir, iter_tfile, iter_reports)
00730 

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).

Definition at line 403 of file alignmentValidation.py.

00404                                                :
00405   """write CSC map plots
00406 
00407  "CSCvsphi_me%s%d%d" % (endcap, station, ring)
00408 
00409   plots "integrated" over ALL SECTORS:
00410   of rphi, drphi/dz vs. phi
00411   made for all (endcap,station,ring) combinations
00412 
00413   Interface: may be arranged into two station(1 .. 4) vs. R(1 .. 4) maps for both endcaps
00414   with R range (1 .. 4) for stations 2-4
00415  It could be incorporated into a general CSC chambers map (column1: endcap, column2: station,
00416   column3: ring, columns4-40 correspond to chamber #) by making ring numbers in column 3
00417   clickable.
00418 
00419 
00420  "CSCvsr_me%s%dch%02d" % (endcap, station, chamberNumber)
00421 
00422   plots "integrated" over ALL RINGS:
00423   of rphi, drphi/dz vs. z
00424   made for all (endcap,station,chamber) combinations
00425 
00426   Interface: may be arranged into two station(1 .. 4) vs. chamber(1 .. 36) maps for both endcaps
00427   It could be incorporated into an EXTENDED general CSC chambers map (extended by adding an
00428   identifier "ALL" in column3 for ring number)."""
00429 
00430   for endcap in CSC_TYPES:
00431     for station in endcap[2]:
00432       for ring in station[2]:
00433         if ring[1]=="ALL": continue
00434         pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'
00435         label = "CSCvsphi_me%s%s%s" % (endcap[1], station[1], ring[1])
00436         htitle = "%s%s/%s" % (endcap[0], station[1],ring[1])
00437         mapplot(tfiles_plotting, label, "x", window=15., title=htitle, fitsine=True)
00438         c1.SaveAs(pdir+'map_CSCvsphi_x.png')
00439         mapplot(tfiles_plotting, label, "dxdz", window=15., title=htitle)
00440         c1.SaveAs(pdir+'map_CSCvsphi_dxdz.png')
00441 
00442   saveTestResultsMap(options.runLabel)
00443 
00444   qcount = 0
00445   for endcap in CSC_TYPES:
00446     for station in endcap[2]:
00447       for ring in station[2]:
00448         if ring[1]!="ALL": continue
00449         for chamber in range(1,ring[2]+1):
00450           if qcount>QUICKTESTN: break
00451           qcount += 1
00452           schamber = "%02d" % chamber
00453           pdir = csc_basedir+'/'+endcap[0]+'/'+station[1]+'/'+ring[1]+'/'+schamber+'/'
00454           label = "CSCvsr_me%s%sch%s" % (endcap[1], station[1], schamber)
00455           htitle = "%s%s/ALL/%d" % (endcap[0], station[1],chamber)
00456           mapplot(tfiles_plotting, label, "x", window=15., title=htitle)
00457           c1.SaveAs(pdir+'map_CSCvsr_x.png')
00458           mapplot(tfiles_plotting, label, "dxdz", window=15., title=htitle)
00459           c1.SaveAs(pdir+'map_CSCvsr_dxdz.png')
00460 

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).

Definition at line 333 of file alignmentValidation.py.

00334                                              :
00335   """write DT map plots
00336 
00337  "DTvsphi_st%dwh%s" % (station, wheelletter):
00338 
00339   plots "integrated" over ALL SECTORS:
00340   of x, y, dxdz, dydz vs. phi (y and dydz only for stations 1-3)
00341   made for all (station,wheel) combinations
00342 
00343   Access interface may be arranged into station(1 .. 4) vs. wheel(-2 .. +2) map.
00344   It could be incorporated into a general DT chambers map (column1: wheel, column2: station,
00345   columns3-16 correspond to sector #) by making station numbers in column 2 clickable.
00346   
00347 
00348  "DTvsz_st%dsec%02d" % (station, sector)
00349 
00350   plots "integrated" over ALL WHEELS:
00351   of x, y, dxdz, dydz vs. z (y and dydz only for stations 1-3)
00352   made for all (station,sector) combinations
00353 
00354   Interface: may be arranged into station(1 .. 4) vs. sector(1 .. 14) map with sector range
00355   (1 .. 12) for stations 1-3.
00356   It could be incorporated into an EXTENDED general DT chambers map (extended by adding an
00357   identifier "ALL" in column1 for wheel number)."""
00358 
00359   for wheel in DT_TYPES:
00360     if wheel[1]=="ALL": continue
00361     for station in wheel[2]:
00362       pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'
00363       label = "DTvsphi_st%dwh%s" % (int(station[1]), wheelLetter(int(wheel[1])))
00364       htitle = "wheel %+d, station %s" % (int(wheel[1]), station[1])
00365       mapplot(tfiles_plotting, label, "x", window=15., title=htitle, fitsawteeth=True,fitsine=True)
00366       c1.SaveAs(pdir+'map_DTvsphi_x.png')
00367       #mapplot(tfiles_plotting, label, "dxdz", window=15., title=htitle, fitsawteeth=True,fitsine=True)
00368       mapplot(tfiles_plotting, label, "dxdz", window=15., title=htitle)
00369       c1.SaveAs(pdir+'map_DTvsphi_dxdz.png')
00370 
00371       if station[1]=='4': continue
00372       #mapplot(tfiles_plotting, label, "y", window=15., title=htitle, fitsawteeth=True,fitsine=True)
00373       mapplot(tfiles_plotting, label, "y", window=15., title=htitle)
00374       c1.SaveAs(pdir+'map_DTvsphi_y.png')
00375       #mapplot(tfiles_plotting, label, "dydz", window=15., title=htitle, fitsawteeth=True,fitsine=True)
00376       mapplot(tfiles_plotting, label, "dydz", window=15., title=htitle)
00377       c1.SaveAs(pdir+'map_DTvsphi_dydz.png')
00378 
00379   qcount=0
00380   for wheel in DT_TYPES:
00381     if wheel[1]!="ALL": continue
00382     for station in wheel[2]:
00383       for sector in range(1,station[2]+1):
00384         if qcount>QUICKTESTN: break
00385         qcount += 1
00386         ssector = "%02d" % sector
00387         pdir = dt_basedir+'/'+wheel[0]+'/'+station[1]+'/'+ssector+'/'
00388         label = "DTvsz_st%ssec%s" % (station[1], ssector)
00389         htitle = "station %s, sector %d" % (station[1], sector)
00390         mapplot(tfiles_plotting, label, "x", window=15., title=htitle)
00391         c1.SaveAs(pdir+'map_DTvsz_x.png')
00392         mapplot(tfiles_plotting, label, "dxdz", window=15., title=htitle)
00393         c1.SaveAs(pdir+'map_DTvsz_dxdz.png')
00394         
00395         if station[1]=='4': continue
00396         mapplot(tfiles_plotting, label, "y", window=15., title=htitle)
00397         c1.SaveAs(pdir+'map_DTvsz_y.png')
00398         mapplot(tfiles_plotting, label, "dydz", window=15., title=htitle)
00399         c1.SaveAs(pdir+'map_DTvsz_dydz.png')
00400   
00401   saveTestResultsMap(options.runLabel)
00402 

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 585 of file alignmentValidation.py.

00586                                                                  :
00587   """write segment-difference plots for CSC
00588  
00589  segdiff "csc_resid" and "csc_slope"
00590 
00591   set of plots of
00592   rphi vs qpt, rphi for positive, rphi for negative ("csc_resid")
00593   drphidz vs qpt, drphidz for positive, drphidz for negative ("csc_slope")
00594   done for ME1-ME2, ME2-ME3, and ME3-ME4 stations combinations with
00595     endcap "m" or "p" 
00596     ring 1 or 2
00597     chamber 1-18 (r1) or 1-36 (r2)
00598   note: there's no ME3-ME4 plots for R2
00599   
00600   Interface: could be accessed through a general CSC chambers map, but only for chambers in
00601   stations 2-4 (e.g., station 2 would provide ME1-ME2 plots)."""
00602 
00603   qcount = 0
00604   for iendcap in CSC_TYPES:
00605     for istation in iendcap[2]:
00606       if istation[1]=="1": continue
00607       dstations = (int(istation[1])-1)*10 + int(istation[1])
00608       for iring in istation[2]:
00609         if iring[1]=="ALL": continue
00610         if istation[1]=="4" and iring[1]=="2": continue
00611         for ichamber in range(1,iring[2]+1):
00612           if qcount>QUICKTESTN: break
00613           qcount += 1
00614           schamber = "%02d" % ichamber
00615           pdir = csc_basedir+'/'+iendcap[0]+'/'+istation[1]+'/'+iring[1]+'/'+schamber+'/'
00616           segdiff(tfiles_plotting, "csc_resid", dstations, 
00617                   endcap=iendcap[1], ring=int(iring[1]), chamber=ichamber, window=10.)
00618           c1.SaveAs(pdir + 'segdif_csc_resid.png')
00619           segdiff(tfiles_plotting, "csc_slope", dstations, 
00620                   endcap=iendcap[1], ring=int(iring[1]), chamber=ichamber, window=10.)
00621           c1.SaveAs(pdir + 'segdif_csc_slope.png')
00622 

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 500 of file alignmentValidation.py.

00501                                                                :
00502   """write segment-difference plots for DT
00503 
00504  segdiff "dt13_resid" and "dt13_slope"
00505 
00506   set of plots of
00507   x vs qpt, x for positive, x for negative ("dt13_resid")
00508   dxdz vs qpt, dxdz for positive, dxdz for negative ("dt13_slope")
00509   done for MB1-MB2, MB2-MB3, and MB3-MB4 stations combinations with all possible (wheel, sector)
00510 
00511   Interface: could be accessed through a general DT chambers map, but only for chambers in
00512   stations 2-4 (e.g., station 2 would provide MB1-MB2 plots).
00513 
00514  segdiff "dt2_resid" and "dt2_slope"
00515 
00516   set of plots of
00517   y vs q/pt, y for positive, y for negative ("dt2_resid")
00518   dydz vs q/pt, dydz for positive, dydz for negative ("dt2_slope")
00519   done for MB1-MB2, MB2-MB3 stations combinations with all possible (wheel, sector)
00520 
00521   Interface: then the interface would still be a general DT map,
00522   but the info only available from station 2 & 3 chambers."""
00523 
00524   qcount = 0
00525   for iwheel in DT_TYPES:
00526     if iwheel[1]=="ALL": continue
00527     for istation in iwheel[2]:
00528       if istation[1]=="1": continue
00529       dstations = (int(istation[1])-1)*10 + int(istation[1])
00530       #print dstations
00531       for isector in range(1, istation[2] + 1):
00532         if isector > 12: continue
00533         if qcount>QUICKTESTN: break
00534         qcount += 1
00535         ssector = "%02d" % isector
00536         pdir = dt_basedir + '/' + iwheel[0] + '/' + istation[1] + '/' + ssector + '/'
00537         
00538         segdiff(tfiles_plotting, "dt13_resid", dstations, wheel=int(iwheel[1]), sector=isector, window=10.)
00539         c1.SaveAs(pdir + 'segdif_dt13_resid.png')
00540         segdiff(tfiles_plotting, "dt13_slope", dstations, wheel=int(iwheel[1]), sector=isector, window=10.)
00541         c1.SaveAs(pdir + 'segdif_dt13_slope.png')
00542         
00543         if istation[1] == '4': continue
00544         segdiff(tfiles_plotting, "dt2_resid", dstations, wheel=int(iwheel[1]), sector=isector, window=10.)
00545         c1.SaveAs(pdir + 'segdif_dt2_resid.png')
00546         segdiff(tfiles_plotting, "dt2_slope", dstations, wheel=int(iwheel[1]), sector=isector, window=10.)
00547         c1.SaveAs(pdir + 'segdif_dt2_slope.png')
00548 
00549   """segdiffvsphi "dt13_resid" and "dt13_slope"
00550 
00551   plot for a specific wheel #:
00552   x vs phi of pair ("dt13_resid")
00553   dxdz vs phi of pair ("dt13_slope")
00554   contains all three combinations of neighboring stations
00555   made for all possible wheel values
00556 
00557   Interface: could be accessed by clicking on wheel number under the "wheel" column
00558   in a general DT map
00559 
00560  segdiffvsphi "dt2_resid" and "dt2_slope"
00561 
00562   plot for a specific wheel #:
00563   y vs phi of pair ("dt2_resid")
00564   dydz vs phi of pair ("dt2_slope")
00565   contains both MB1-MB2 and MB2-MB3 combinations
00566   made for all possible wheel values
00567 
00568   Interface: could be accessed by clicking on wheel number under the "wheel" column
00569   in a general DT map"""
00570 
00571   if len(iter_reports)==0: return
00572   
00573   for iwheel in DT_TYPES:
00574     if iwheel[1]=="ALL": continue
00575     pdir = dt_basedir + '/' + iwheel[0] + '/'
00576     segdiffvsphi(tfiles_plotting, iter_reports, "dt13_resid", int(iwheel[1]), window=15., excludesectors=(1,7))
00577     c1.SaveAs(pdir + 'segdifphi_dt13_resid.png')
00578     segdiffvsphi(tfiles_plotting, iter_reports, "dt13_slope", int(iwheel[1]), window=15., excludesectors=(1,7))
00579     c1.SaveAs(pdir + 'segdifphi_dt13_slope.png')
00580     segdiffvsphi(tfiles_plotting, iter_reports, "dt2_resid", int(iwheel[1]), window=15., excludesectors=(1,7))
00581     c1.SaveAs(pdir + 'segdifphi_dt2_resid.png')
00582     segdiffvsphi(tfiles_plotting, iter_reports, "dt2_slope", int(iwheel[1]), window=15., excludesectors=(1,7))
00583     c1.SaveAs(pdir + 'segdifphi_dt2_slope.png')
00584 

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 775 of file alignmentValidation.py.

00776                                    :
00777   '''Recursively looks for file named file_name under dir_name directory
00778   and fill the list with dir names converted to IDs 
00779   '''
00780   id_list = []
00781   for f in os.listdir(dir_name):
00782     dirfile = os.path.join(dir_name, f)
00783     if os.path.isfile(dirfile) and f==file_name:
00784       id_list.append(dirToID(dir_name))
00785     # recursively access file names in subdirectories
00786     elif os.path.isdir(dirfile):
00787       #print "Accessing directory:", dirfile
00788       ids = idsForFile(dirfile, file_name)
00789       if (len(ids)>0): 
00790         id_list.extend(ids)
00791   return id_list
00792 

def alignmentValidation::isFileUnderDir (   dir_name,
  file_name 
)

functions definitions

Recursively looks for file named file_name under dir_name directory

Definition at line 265 of file alignmentValidation.py.

00266                                        :
00267   '''Recursively looks for file named file_name under dir_name directory
00268   '''
00269   if not DO_DT and dir_name.find("MB")>-1:
00270     return False
00271   if not DO_CSC and dir_name.find("ME")>-1:
00272     return False
00273   
00274   for f in os.listdir(dir_name):
00275     dirfile = os.path.join(dir_name, f)
00276     if os.path.isfile(dirfile) and f==file_name:
00277       return True
00278     # recursively access file names in subdirectories
00279     elif os.path.isdir(dirfile):
00280       #print "Accessing directory:", dirfile
00281       if isFileUnderDir(dirfile, file_name): return True
00282   return False
00283 
00284 
# to time saving of plots
def alignmentValidation::saveAs (   nm)

Definition at line 285 of file alignmentValidation.py.

00285               : 
00286   t1 = time.time()
00287   ddt[15] += 1
00288   c1.SaveAs(nm)
00289   tn = time.time()
00290   ddt[16] = 1./ddt[15]*((ddt[15]-1)*ddt[16] + tn-t1)
00291 
00292 

Variable Documentation

string alignmentValidation::action = "store_true"

Definition at line 198 of file alignmentValidation.py.

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

do drawing

Definition at line 888 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(), 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 873 of file alignmentValidation.py.

Definition at line 39 of file alignmentValidation.py.

string alignmentValidation::dest = "runLabel"

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"
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 825 of file alignmentValidation.py.

Definition at line 824 of file alignmentValidation.py.

Definition at line 874 of file alignmentValidation.py.

Definition at line 875 of file alignmentValidation.py.

Definition at line 846 of file alignmentValidation.py.

Definition at line 845 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.

Definition at line 215 of file alignmentValidation.py.

Definition at line 177 of file alignmentValidation.py.

Definition at line 823 of file alignmentValidation.py.

Definition at line 844 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.