class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.NameSingle='GainMap' self.Name='CMSPixel_QualificationGroup_Fulltest_Chips_Chip_%s_TestResult'%self.NameSingle self.Attributes['TestedObjectType'] = 'CMSPixel_Module' def PopulateResultData(self): ROOT.gPad.SetLogy(0) ROOT.gStyle.SetOptStat(0) # initialize module map self.ModuleMap = ModuleMap(Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) # fill plot for i in self.ParentObject.ResultData['SubTestResults']['Chips'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData['SubTestResults']['Chips'].ResultData['SubTestResults'][i] histo = ChipTestResultObject.ResultData['SubTestResults']['PHCalibrationGainMap'].ResultData['Plot']['ROOTObject'] if not histo: print 'cannot get NoiseMap histo for chip ',ChipTestResultObject.Attributes['ChipNo'] continue chipNo = ChipTestResultObject.Attributes['ChipNo'] for col in range(self.nCols): for row in range(self.nRows): result = histo.GetBinContent(col + 1, row + 1) self.ModuleMap.UpdatePlot(chipNo, col, row, result) # draw module map if self.ModuleMap: self.ResultData['Plot']['ROOTObject'] = self.ModuleMap.GetHistogram() self.ModuleMap.Draw(self.Canvas) # save canvas self.ResultData['Plot']['Format'] = 'png' self.Title = 'Gain Map' self.SaveCanvas()
class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.Name='CMSPixel_QualificationGroup_Fulltest_VcalThreshold_TestResult' self.NameSingle='VcalThreshold' self.Attributes['TestedObjectType'] = 'CMSPixel_Module' self.Title = 'Vcal Threshold' def PopulateResultData(self): ROOT.gStyle.SetOptStat(0) self.ResultData['Plot']['ROOTObject'] = None # initialize module map self.ModuleMap = ModuleMap(Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) # loop over all chips ValueList = [] for i in self.ParentObject.ResultData['SubTestResults']['Chips'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData['SubTestResults']['Chips'].ResultData['SubTestResults'][i] histo = ChipTestResultObject.ResultData['SubTestResults']['VcalThresholdUntrimmed'].ResultData['Plot']['ROOTObject'] if not histo: print 'cannot get VcalThresholdUntrimmed histo for chip ',ChipTestResultObject.Attributes['ChipNo'] continue for col in range(self.nCols): for row in range(self.nRows): Value = histo.GetBinContent(col + 1, row + 1) ValueList.append(Value) self.ModuleMap.UpdatePlot(ChipTestResultObject.Attributes['ChipNo'], col, row, Value) # draw module map if self.ModuleMap: self.ResultData['Plot']['ROOTObject'] = self.ModuleMap.GetHistogram() self.ModuleMap.Draw(self.Canvas) # get minimum and maximum threshold if self.ResultData['Plot']['ROOTObject']: mThresholdMin = 0. mThresholdMax = 255. if self.ResultData['Plot']['ROOTObject'].GetMaximum() < mThresholdMax: mThresholdMax = self.ResultData['Plot']['ROOTObject'].GetMaximum() if self.ResultData['Plot']['ROOTObject'].GetMinimum() > mThresholdMin: mThresholdMin = self.ResultData['Plot']['ROOTObject'].GetMinimum() if len(ValueList) > 0: SortedValueList = sorted(ValueList) LowerIndex = int(math.floor(len(SortedValueList)*0.05)) UpperIndex = int(math.floor(len(SortedValueList)*0.95)) LowerValueList = SortedValueList[0:LowerIndex-1] UpperValueList = SortedValueList[UpperIndex:] if SortedValueList[LowerIndex] > 5.*sum(LowerValueList)/float(len(LowerValueList)): mThresholdMin = SortedValueList[LowerIndex]*0.1 if SortedValueList[UpperIndex]*5. < sum(UpperValueList)/float(len(UpperValueList)): mThresholdMax = SortedValueList[UpperIndex]*1.1 # save canvas self.ResultData['Plot']['Format'] = 'png' self.ResultData['Plot']['Caption'] = 'Vcal Threshold' self.SaveCanvas()
class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.NameSingle = 'ThresholdOverview' self.Name = 'CMSPixel_QualificationGroup_XRayHRQualification_%s_TestResult' % self.NameSingle self.Attributes['TestedObjectType'] = 'CMSPixel_Module' def PopulateResultData(self): ROOT.gPad.SetLogy(0) ROOT.gStyle.SetOptStat(0) # initialize module map self.ModuleMap = ModuleMap( Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) Directory = self.ParentObject.Attributes['SCurvePaths'][ 'HRSCurves_{Rate}'.format(Rate=self.Attributes['Rate'])] for i in self.ParentObject.ResultData['SubTestResults'][ 'Chips'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData[ 'SubTestResults']['Chips'].ResultData['SubTestResults'][i] ChipNo = ChipTestResultObject.Attributes['ChipNo'] SCurveFileName = Directory + '/' + self.ParentObject.ParentObject.HistoDict.get( 'HighRate', 'SCurveFileName').format(ChipNo=ChipNo) SCurveFile = open(SCurveFileName, "r") if not SCurveFile: raise Exception('Cannot find SCurveFile "%s"' % SCurveFileName) else: Line = SCurveFile.readline() Line = SCurveFile.readline() for column in range(self.nCols): #Columns for row in range(self.nRows): #Rows Line = SCurveFile.readline() if Line: LineArray = Line.strip().split() Threshold = float(LineArray[0]) if 0 < Threshold < 10000: self.ModuleMap.UpdatePlot( ChipNo, column, row, Threshold) SCurveFile.close() # draw module map if self.ModuleMap: self.ModuleMap.SetContour(100) self.ResultData['Plot'][ 'ROOTObject'] = self.ModuleMap.GetHistogram() if self.isPROC: self.ModuleMap.SetRangeUser(1200, 5000) else: self.ModuleMap.SetRangeUser(1200, 2800) self.ModuleMap.Draw(Canvas=self.Canvas, TitleZ="electrons") # save canvas self.ResultData['Plot']['Format'] = 'png' self.Title = 'Threshold {Rate}'.format(Rate=self.Attributes['Rate']) self.SaveCanvas()
class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.Name = 'CMSPixel_QualificationGroup_Reception_Chips_Chip_BumpBondingMap_TestResult' self.NameSingle = 'BumpBondingMap' self.Attributes['TestedObjectType'] = 'CMSPixel_Module' def PopulateResultData(self): ROOT.gStyle.SetOptStat(0) # initialize module map self.ModuleMap = ModuleMap( Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) # fill plot for i in self.ParentObject.ResultData['SubTestResults'][ 'Chips'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData[ 'SubTestResults']['Chips'].ResultData['SubTestResults'][i] histo = ChipTestResultObject.ResultData['SubTestResults'][ 'BumpBondingProblems'].ResultData['Plot']['ROOTObject'] if not histo: print 'cannot get BumpBondingProblems histo for chip ', ChipTestResultObject.Attributes[ 'ChipNo'] continue chipNo = ChipTestResultObject.Attributes['ChipNo'] for col in range(self.nCols): for row in range(self.nRows): result = histo.GetBinContent(col + 1, row + 1) self.ModuleMap.UpdatePlot(chipNo, col, row, result) # draw module map if self.ModuleMap: self.ResultData['Plot'][ 'ROOTObject'] = self.ModuleMap.GetHistogram() self.ModuleMap.Draw(self.Canvas) # save canvas self.ResultData['Plot']['Format'] = 'png' self.Title = 'Bump Bonding Thrmap' self.SaveCanvas() def UpdatePlot(self, chipNo, col, row, value): result = value if chipNo < 8: tmpCol = 8 * self.nCols - 1 - chipNo * self.nCols - col tmpRow = 2 * self.nRows - 1 - row else: tmpCol = (chipNo % 8 * self.nCols + col) tmpRow = row # Get the data from the chip sub test result bump bonding if result and self.verbose: print chipNo, col, row, '--->', tmpCol, tmpRow, result # self.ResultData['Plot']['ROOTObject'].SetBinContent(tmpCol + 1, tmpRow + 1, result) self.ResultData['Plot']['ROOTObject'].Fill(tmpCol, tmpRow, result)
class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.Name = 'CMSPixel_QualificationGroup_XRayHRQualification_HotPixelOverview_TestResult' self.NameSingle = 'HotPixelOverview' self.Attributes['TestedObjectType'] = 'CMSPixel_Module' def PopulateResultData(self): ROOT.gPad.SetLogy(0) ROOT.gStyle.SetOptStat(0) # initialize module map self.ModuleMap = ModuleMap( Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) for i in self.ParentObject.ResultData['SubTestResults'][ 'Chips'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData[ 'SubTestResults']['Chips'].ResultData['SubTestResults'][i] histo = ChipTestResultObject.ResultData['SubTestResults'][ 'HotPixelMap_{Rate}'.format(Rate=self.Attributes['Rate'] )].ResultData['Plot']['ROOTObject'] chipNo = ChipTestResultObject.Attributes['ChipNo'] if histo: for col in range(self.nCols): for row in range(self.nRows): result = histo.GetBinContent(col + 1, row + 1) self.ModuleMap.UpdatePlot(chipNo, col, row, result) # draw module map if self.ModuleMap: self.ResultData['Plot'][ 'ROOTObject'] = self.ModuleMap.GetHistogram() self.ModuleMap.Draw(self.Canvas) # save canvas self.ResultData['Plot']['Format'] = 'png' self.Title = 'Masked Hot Pixels {Rate}'.format( Rate=self.Attributes['Rate']) self.SaveCanvas() def UpdatePlot(self, chipNo, col, row, value): result = value if chipNo < 8: tmpCol = 8 * self.nCols - 1 - chipNo * self.nCols - col tmpRow = 2 * self.nRows - 1 - row else: tmpCol = (chipNo % 8 * self.nCols + col) tmpRow = row # Get the data from the chip sub test result hitmap if result and self.verbose: print chipNo, col, row, '--->', tmpCol, tmpRow, result self.ResultData['Plot']['ROOTObject'].Fill(tmpCol, tmpRow, result)
class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.Name='CMSPixel_QualificationGroup_XRayHRQualification_HitOverview_TestResult' self.NameSingle='HitOverview' self.Attributes['TestedObjectType'] = 'CMSPixel_Module' def PopulateResultData(self): ROOT.gStyle.SetOptStat(0) self.Canvas.Clear() # initialize module map self.ModuleMap = ModuleMap(Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) try: Rate = self.Attributes['Rate'] except: Rate = '' # copy ROC data to module data for i in self.ParentObject.ResultData['SubTestResults']['Chips'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData['SubTestResults']['Chips'].ResultData['SubTestResults'][i] histo = ChipTestResultObject.ResultData['SubTestResults']['HitMap_{Rate}'.format(Rate=Rate) if Rate else 'HitMap'].ResultData['Plot']['ROOTObject'] chipNo = ChipTestResultObject.Attributes['ChipNo'] for col in range(self.nCols): for row in range(self.nRows): result = histo.GetBinContent(col + 1, row + 1) self.ModuleMap.UpdatePlot(chipNo, col, row, result) # draw module map if self.ModuleMap: self.ResultData['Plot']['ROOTObject'] = self.ModuleMap.GetHistogram() self.ModuleMap.SetContour(100) self.ResultData['Plot']['ROOTObject'].GetZaxis().SetRangeUser(0, self.ResultData['Plot']['ROOTObject'].GetMaximum()) try: XProjection = self.ResultData['Plot']['ROOTObject'].ProjectionX('hproj_{Rate}_{id}'.format(Rate=Rate, id=self.GetUniqueID()), 50, 50) XProjectionList = [] for col in range(XProjection.GetXaxis().GetFirst(), XProjection.GetXaxis().GetLast()+1): XProjectionList.append(XProjection.GetBinContent(col)) XProjectionList.sort() Median = XProjectionList[int(len(XProjectionList)/2)] if self.ResultData['Plot']['ROOTObject'].GetMaximum() > Median*3: self.ResultData['Plot']['ROOTObject'].GetZaxis().SetRangeUser(0, Median*3) except: pass self.ModuleMap.Draw(Canvas=self.Canvas, TitleZ="# hits") # save canvas self.ResultData['Plot']['Format'] = 'png' self.Title = 'Hit Map {Rate}'.format(Rate=Rate) self.SaveCanvas()
class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.Name = 'CMSPixel_QualificationGroup_XRayHRQualification_EfficiencyOverview_TestResult' self.NameSingle = 'EfficiencyOverview' self.Attributes['TestedObjectType'] = 'CMSPixel_Module' def PopulateResultData(self): ROOT.gPad.SetLogy(0) ROOT.gStyle.SetOptStat(0) # initialize module map self.ModuleMap = ModuleMap( Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) for i in self.ParentObject.ResultData['SubTestResults'][ 'Chips'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData[ 'SubTestResults']['Chips'].ResultData['SubTestResults'][i] histo = ChipTestResultObject.ResultData['SubTestResults'][ 'EfficiencyMap_{Rate}'.format( Rate=self.Attributes['Rate'] )].ResultData['Plot']['ROOTObject'] chipNo = ChipTestResultObject.Attributes['ChipNo'] if histo: for col in range(self.nCols): for row in range(self.nRows): result = histo.GetBinContent(col + 1, row + 1) self.ModuleMap.UpdatePlot(chipNo, col, row, result) # draw module map if self.ModuleMap: self.ResultData['Plot'][ 'ROOTObject'] = self.ModuleMap.GetHistogram() Ntrig = self.ParentObject.Attributes['Ntrig'][ 'HREfficiency_{Rate}'.format(Rate=self.Attributes['Rate'])] self.ModuleMap.SetRangeUser(0, Ntrig) self.ModuleMap.Draw(self.Canvas) # save canvas self.ResultData['Plot']['Format'] = 'png' self.Title = 'HR Efficiency Map {Rate}'.format( Rate=self.Attributes['Rate']) self.SaveCanvas()
class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.Name = 'CMSPixel_QualificationGroup_XRayHRQualification_BumpBondingProblems_TestResult' self.NameSingle = 'BumpBondingProblems' self.Attributes['TestedObjectType'] = 'CMSPixel_Module' self.ResultData['KeyValueDictPairs'] = {} def PopulateResultData(self): ROOT.gPad.SetLogx(0) ROOT.gPad.SetLogy(0) ROOT.gStyle.SetOptStat(0) # initialize module map self.ModuleMap = ModuleMap( Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) # copy ROC data to module data for i in self.ParentObject.ResultData['SubTestResults'][ 'Chips'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData[ 'SubTestResults']['Chips'].ResultData['SubTestResults'][i] histo = ChipTestResultObject.ResultData['SubTestResults'][ 'BumpBondingDefects_{Rate}'.format( Rate=self.Attributes['Rate'] )].ResultData['Plot']['ROOTObject'] chipNo = ChipTestResultObject.Attributes['ChipNo'] for col in range(self.nCols): for row in range(self.nRows): result = histo.GetBinContent(col + 1, row + 1) self.ModuleMap.UpdatePlot(chipNo, col, row, result) # draw module map if self.ModuleMap: self.ResultData['Plot'][ 'ROOTObject'] = self.ModuleMap.GetHistogram() self.ModuleMap.Draw(self.Canvas) # save canvas self.ResultData['Plot']['Format'] = 'png' self.Title = 'Bump Bonding Defects {Rate}'.format( Rate=self.Attributes['Rate']) self.SaveCanvas()
class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.NameSingle='HotPixelRetrimming' self.Name='CMSPixel_QualificationGroup_XRayHRQualification_%s_TestResult'%self.NameSingle self.Attributes['TestedObjectType'] = 'CMSPixel_Module' def PopulateResultData(self): ROOT.gPad.SetLogy(0) ROOT.gStyle.SetOptStat(0) # initialize module map self.ModuleMap = ModuleMap(Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) DisplayOptionsShow = True for i in self.ParentObject.ResultData['SubTestResults']['Chips'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData['SubTestResults']['Chips'].ResultData['SubTestResults'][i] histo = ChipTestResultObject.ResultData['SubTestResults']['HotPixelRetrimming_{Rate}'.format(Rate=self.Attributes['Rate'])].ResultData['Plot']['ROOTObject'] chipNo = ChipTestResultObject.Attributes['ChipNo'] if histo: for col in range(self.nCols): for row in range(self.nRows): result = histo.GetBinContent(col + 1, row + 1) self.ModuleMap.UpdatePlot(chipNo, col, row, result) DisplayOptionsShow = DisplayOptionsShow and (ChipTestResultObject.ResultData['SubTestResults']['HotPixelRetrimming_{Rate}'.format(Rate=self.Attributes['Rate'])].DisplayOptions['Show'] if ChipTestResultObject.ResultData['SubTestResults']['HotPixelRetrimming_{Rate}'.format(Rate=self.Attributes['Rate'])].DisplayOptions.has_key('Show') else True) self.DisplayOptions['Show'] = DisplayOptionsShow # draw module map if self.ModuleMap: self.ResultData['Plot']['ROOTObject'] = self.ModuleMap.GetHistogram() self.ModuleMap.Draw(Canvas=self.Canvas, TitleZ="Δ trimbit") # save canvas self.ResultData['Plot']['Format'] = 'png' self.Title = 'Retrimmed Hot Pixels {Rate}'.format(Rate=self.Attributes['Rate']) self.SaveCanvas()
class ProductionOverview( AbstractClasses.GeneralProductionOverview.GeneralProductionOverview): def CustomInit(self): self.Name = 'CMSPixel_ProductionOverview_BBCorners' self.NameSingle = 'BBCorners' self.Title = 'Pixel Defects (Bump+Dead)' self.DisplayOptions = { 'Width': 5, } self.SubPages = [] self.nROCs = 16 self.nCols = 52 self.nRows = 80 self.marginX = 10 self.marginY = 10 self.IncludeSorttable = True self.IncludeGrades = ['A', 'B'] self.SavePlotFile = True self.Canvas.SetCanvasSize(1784, 412) self.Canvas.Update() # taken from M. Donega. pickmodule.py def isBorder(self, x, y): if (x < self.marginX) or (x > self.nCols - self.marginX) or ( y < self.marginY) or (y > self.nRows - self.marginY): return True return False def isCorner(self, x, y): # print x, y, self.marginX, self.marginY if ((x < self.marginX) and (y < self.marginY)) or ( (x < self.marginX) and (y > self.nRows - self.marginY)) or ( (x > self.nCols - self.marginX) and (y < self.marginY)) or ((x > self.nCols - self.marginX) and (y > self.nRows - self.marginY)): return True return False # Corners definition: # # C D | C D | C D | C D | C D | C D | C D | C D # A B | A B | A B | A B | A B | A B | A B | A B # - - | - - | - - | - - | - - | - - | - - | - - # C D | C D | C D | C D | C D | C D | C D | C D # A B | A B | A B | A B | A B | A B | A B | A B # def isCornerA(self, x, y): # print x, y, self.marginX, self.marginY if ((x < self.marginX) and (y < self.marginY)): return True return False # def isCornerB(self, x, y): # print x, y, self.marginX, self.marginY if ((x > self.nCols - self.marginX) and (y < self.marginY)): return True return False # def isCornerC(self, x, y): # print x, y, self.marginX, self.marginY if ((x < self.marginX) and (y > self.nRows - self.marginY)): return True return False # def isCornerD(self, x, y): # print x, y, self.marginX, self.marginY if ((x > self.nCols - self.marginX) and (y > self.nRows - self.marginY)): return True return False def GenerateOverview(self): TableData = [] Rows = self.FetchData() ModuleIDsList = [] for RowTuple in Rows: if not RowTuple['ModuleID'] in ModuleIDsList: ModuleIDsList.append(RowTuple['ModuleID']) ModuleIDsList.sort(reverse=True) TableData.append([ { 'Class': 'Header', 'Value': 'Module' }, { 'Class': 'Header', 'Value': 'Grade' }, { 'Class': 'Header', 'Value': 'I_leak ratio' }, { 'Class': 'Header', 'Value': 'Total' }, { 'Class': 'Header', 'Value': 'Bump' }, { 'Class': 'Header', 'Value': 'Dead' }, { 'Class': 'Header', 'Value': 'WorstROC' }, { 'Class': 'Header', 'Value': 'Map' }, ]) try: IgnoreModules = [ x.strip() for x in self.TestResultEnvironmentObject. Configuration['IgnoreInSelectionList'].split(',') ] print "ignore modules:", IgnoreModules except: IgnoreModules = [] # n defects -> category = floor(n/10) defectCategories = [] nCategories = 20 for i in range(nCategories): defectCategories.append([]) nMod = 0 for ModuleID in ModuleIDsList: matchRows = [ x for x in Rows if x['ModuleID'] == ModuleID and x['TestType'] == self.Attributes['Test'] ] FinalGrade = self.GetFinalGrade(ModuleID, Rows) if FinalGrade == 'B': FinalGradeFormatted = "<span style='color:#f70;font-weight:bold;'>%s</span>" % FinalGrade elif FinalGrade == 'C': FinalGradeFormatted = "<span style='color:red;font-weight:bold;'>%s</span>" % FinalGrade elif FinalGrade == 'None': FinalGradeFormatted = "<span style='color:#777;font-weight:bold;'>%s</span>" % FinalGrade else: FinalGradeFormatted = FinalGrade if FinalGrade in self.IncludeGrades and ModuleID not in IgnoreModules: if len(matchRows) == 1: RowTuple = matchRows[0] countBBTotal = 0 countDeadTotal = 0 countBBROC = [0] * self.nROCs countDeadROC = [0] * self.nROCs # initialize module map self.DefectsMap = ModuleMap(Name=self.GetUniqueID(), nChips=self.nROCs, StartChip=0) # add threshold defects pixels for iRoc in range(self.nROCs): Path = '/'.join([ self.GlobalOverviewPath, RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], "Chips", "Chip%d" % iRoc, "VcalThresholdTrimmedMap", 'VcalThresholdTrimmedMap.root' ]) RootFiles = glob.glob(Path) PixelMapROOTObject = self.GetHistFromROOTFile( RootFiles, "VcalThresholdTrimmedMap") for x in range(PixelMapROOTObject.GetNbinsX()): for y in range(PixelMapROOTObject.GetNbinsY()): BinContent = PixelMapROOTObject.GetBinContent( 1 + x, 1 + y) if BinContent < 25 or BinContent > 45: self.DefectsMap.UpdatePlot(iRoc, x, y, 0.5) # add bump defects pixels for iRoc in range(self.nROCs): Path = '/'.join([ self.GlobalOverviewPath, RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], "Chips", "Chip%d" % iRoc, "BumpBondingMap", 'BumpBondingMap.root' ]) RootFiles = glob.glob(Path) PixelMapROOTObject = self.GetHistFromROOTFile( RootFiles, "BumpBondingMap") for x in range(PixelMapROOTObject.GetNbinsX()): for y in range(PixelMapROOTObject.GetNbinsY()): BinContent = PixelMapROOTObject.GetBinContent( 1 + x, 1 + y) if BinContent > 0: self.DefectsMap.UpdatePlot(iRoc, x, y, 1) countBBTotal += 1 countBBROC[iRoc] += 1 # add dead pixels for iRoc in range(self.nROCs): Path = '/'.join([ self.GlobalOverviewPath, RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], "Chips", "Chip%d" % iRoc, "PixelMap", 'PixelMap.root' ]) RootFiles = glob.glob(Path) PixelMapROOTObject = self.GetHistFromROOTFile( RootFiles, "PixelMap") for x in range(PixelMapROOTObject.GetNbinsX()): for y in range(PixelMapROOTObject.GetNbinsY()): BinContent = PixelMapROOTObject.GetBinContent( 1 + x, 1 + y) if BinContent < 1: self.DefectsMap.UpdatePlot( iRoc, x, y, 0.123) countDeadTotal += 1 countDeadROC[iRoc] += 1 # combine maps, 0.12 means blue self.DefectsMap.Map2D.GetZaxis().SetRangeUser(0.0, 1.0) self.DefectsMap.Map2D.SetStats(ROOT.kFALSE) self.Canvas.Clear() self.DefectsMap.Draw(self.Canvas) saveAsFileName = self.GlobalOverviewPath + '/' + self.Attributes[ 'BasePath'] + 'defects_map_%s.png' % ModuleID self.Canvas.SaveAs(saveAsFileName) imgFile = self.GetStorageKey( ) + '/defects_map_%s.png' % ModuleID # '/'.join(['..','..',RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], "BumpBondingMap", 'BumpBondingMap.png']) imgHTMLData = ( "<a href='%s'><img src='%s' alt='Bump Bonding defects map' width=600></a>" % (imgFile, imgFile)) maxRocDefects = [ countDeadROC[i] + countBBROC[i] for i in range(self.nROCs) ] if max(maxRocDefects) < 42: MaxROC = "%d" % max(maxRocDefects) elif max(maxRocDefects) < 167: MaxROC = "<span style='color:#f70;font-weight:bold;'>%d</span>" % max( maxRocDefects) else: MaxROC = "<span style='color:red;font-weight:bold;'>%d</span>" % max( maxRocDefects) totalDefects = countBBTotal + countDeadTotal defectCategory = int(totalDefects / 10) if defectCategory > len(defectCategories) - 1: defectCategory = len(defectCategories) - 1 defectCategories[defectCategory].append(ModuleID) # LEAKAGE CURRENT RATIO try: lcRationNumber = float( self.GetJSONValue([ RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], 'IVCurve', 'KeyValueDictPairs.json', 'CurrentRatio150V', 'Value' ])) lcRatio = ( "%1.2f" % lcRationNumber) if lcRationNumber > 0 else 'N/A' except: lcRatio = 'N/A' TableData.append([ "<b>%s</b>" % ModuleID, FinalGradeFormatted, lcRatio, "%d" % totalDefects, "%d" % countBBTotal, "%d" % countDeadTotal, MaxROC, imgHTMLData ]) elif len(matchRows) < 1: TableData.append([ "<b>%s</b>" % ModuleID, FinalGradeFormatted, 'N/A', '', '', '', '', '-' ]) else: TableData.append([ "<b>%s</b>" % ModuleID, FinalGradeFormatted, '?', '', '', '', '', '-' ]) print "multiple rows found!:", matchRows nMod += 1 RowLimit = 500 HTMLInfo = "" HTMLInfo += "<b>colors:</b> red = missing bump, blue = dead pixel, green = trimmed threshold<br>" #HTMLInfo += "<b>definitions:</b> corners are pixels with col less or equal than " + "%d"%self.marginX + " pix and row less or equal than " + "%d"%self.marginY + " pix away from edge. Borders include pixels with col less or equal than " + "%d"%self.marginX + " pix or row less or equal than " + "%d"%self.marginY + " pix away from edge, thus include corners.<br>" HTMLInfo += "<b>test:</b> " + self.Attributes['Test'] + "<br>" HTMLInfo += "<b>grades:</b> %s<br>" % (', '.join(self.IncludeGrades)) HTMLInfo += "<b>ignored modules:</b> %s<br>" % ( ', '.join(IgnoreModules)) HTMLInfo += "<b>features:</b> click on table header to sort table<br>" HTML = HTMLInfo + self.Table(TableData, RowLimit, TableClass='sortable', TableStyle='text-align:center;') TableData = [] # second table TableData.append([ { 'Class': 'Header', 'Value': '# defects' }, { 'Class': 'Header', 'Value': '# cumulative' }, { 'Class': 'Header', 'Value': '# modules' }, { 'Class': 'Header', 'Value': 'ModuleIDs' }, ]) catDefects = 0 nModulesCumulative = 0 for moduleIDs in defectCategories: catDefects += 10 nModulesInCategory = len(moduleIDs) nModulesCumulative += nModulesInCategory categoryName = "<%d" % catDefects if catDefects < nCategories * 10 else ">=%d" % ( catDefects - 10) TableData.append([ categoryName, "%d" % nModulesCumulative, "%d" % nModulesInCategory, ", ".join(moduleIDs) ]) HTML += "<br><h4>List of modules less than n defects</h4>" HTML += "<b>ignored modules:</b> %s<br>" % (', '.join(IgnoreModules)) HTML += "<br>" + self.Table( TableData, RowLimit, TableClass='', TableStyle='') return self.Boxed(HTML)
class ProductionOverview(AbstractClasses.GeneralProductionOverview.GeneralProductionOverview): def CustomInit(self): self.NameSingle='ThresholdDefectsOverlay' self.Name='CMSPixel_ProductionOverview_%s'%self.NameSingle self.Title = 'Threshold Defect Overlay, Test: %s Grade: %s'%(self.Attributes['Test'], self.Attributes['Grade']) self.DisplayOptions = { 'Width': 2.7, } self.SubPages = [] self.SavePlotFile = True self.Canvas.SetCanvasSize(1330, 430) self.Canvas.Update() def GenerateOverview(self): Rows = self.FetchData() ModuleIDsList = self.GetModuleIDsList(Rows) # initialize module map self.ModuleMap = ModuleMap(Name=self.GetUniqueID(), nChips=16, StartChip=0) NModules = 0 trimThr = float(self.TestResultEnvironmentObject.GradingParameters['trimThr']) tthrTol = float(self.TestResultEnvironmentObject.GradingParameters['tthrTol']) pixelThrMin = int(trimThr) - int(tthrTol) pixelThrMax = int(trimThr) + int(tthrTol) for RowTuple in Rows: if RowTuple['ModuleID'] in ModuleIDsList: ModuleID = RowTuple['ModuleID'] TestType = RowTuple['TestType'] if TestType == self.Attributes['Test'] and (RowTuple['Grade'] == self.Attributes['Grade'] or self.Attributes['Grade'] == 'All'): for Chip in range(0,16): Path = '/'.join([self.GlobalOverviewPath, RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], 'Chips' ,'Chip%s'%Chip, 'VcalThresholdTrimmedMap', '*.root']) RootFiles = glob.glob(Path) if self.Verbose: print "glob:", Path print "looking in .root files:", RootFiles ROOTObject = self.GetHistFromROOTFile(RootFiles, "VcalThresholdTrimmedMap") if ROOTObject: if ROOTObject.GetEntries() > 0: for x in range(ROOTObject.GetNbinsX()): for y in range(ROOTObject.GetNbinsY()): BinContent = ROOTObject.GetBinContent(1 + x, 1 + y) if BinContent < pixelThrMin or BinContent > pixelThrMax: self.ModuleMap.UpdatePlot(Chip, x, y, 1) ROOTObject.Delete() else: self.ProblematicModulesList.append(ModuleID) if self.Verbose: print " Threshold map not found for module '%s' Chip '%d'"%(ModuleID, Chip) NModules += 1 self.CloseFileHandles() # draw module map if self.ModuleMap: self.ModuleMap.Draw(self.Canvas) self.ModuleMap.DrawCaption({'Test': self.Attributes['Test'], 'NModules': NModules, 'Grades': self.Attributes['Grade']}) self.SaveCanvas('png') HTML = self.Image(self.Attributes['ImageFile']) + self.BoxFooter("Number of modules: %d"%NModules) AbstractClasses.GeneralProductionOverview.GeneralProductionOverview.GenerateOverview(self) self.DisplayErrorsList() return self.Boxed(HTML)
class ProductionOverview( AbstractClasses.GeneralProductionOverview.GeneralProductionOverview): def CustomInit(self): self.NameSingle = 'DeadPixelClusters' self.Name = 'CMSPixel_ProductionOverview_%s' % self.NameSingle self.Title = 'Dead Pixel Clusters, Test: %s' % ( self.Attributes['Test']) self.DisplayOptions = { 'Width': 2.7, } self.SubPages = [] self.SavePlotFile = True self.Canvas.SetCanvasSize(1330, 430) self.Canvas.Update() def GenerateOverview(self): Rows = self.FetchData() ModuleIDsList = self.GetModuleIDsList(Rows) # initialize module map self.ModuleMap = ModuleMap(Name=self.GetUniqueID(), nChips=16, StartChip=0) NModules = 0 for RowTuple in Rows: if RowTuple['ModuleID'] in ModuleIDsList: ModuleID = RowTuple['ModuleID'] TestType = RowTuple['TestType'] if TestType == self.Attributes['Test']: nClusteredPixelsPerModule = 0 for Chip in range(0, 16): Path = '/'.join([ self.GlobalOverviewPath, RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], 'Chips', 'Chip%s' % Chip, 'PixelMap', '*.root' ]) RootFiles = glob.glob(Path) ROOTObject = self.GetHistFromROOTFile( RootFiles, "PixelMap") if ROOTObject: for x in range(1, ROOTObject.GetNbinsX() + 1): for y in range(1, ROOTObject.GetNbinsY() + 1): BinContent = ROOTObject.GetBinContent(x, y) if BinContent < 1: Clustered = False if (x > 1 and ROOTObject.GetBinContent( x - 1, y) < 1): Clustered = True if (x < 52 and ROOTObject.GetBinContent( x + 1, y) < 1): Clustered = True if (y > 1 and ROOTObject.GetBinContent( x, y - 1) < 1): Clustered = True if (y < 80 and ROOTObject.GetBinContent( x, y + 1) < 1): Clustered = True if Clustered: #print "C",Chip," ",x,y self.ModuleMap.UpdatePlot( Chip, x, y, 1) nClusteredPixelsPerModule += 1 ROOTObject.Delete() else: self.ProblematicModulesList.append(ModuleID) if self.Verbose: print " Dead Pixel map not found for module '%s' Chip '%d'" % ( ModuleID, Chip) Value = self.GetJSONValue([ RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], 'IVCurve', 'KeyValueDictPairs.json', 'CurrentAtVoltage150V', 'Value' ]) try: Value = float(Value) except: Value = None print "%s: %d, %f" % (ModuleID, nClusteredPixelsPerModule, Value if Value else 0.0) NModules += 1 self.CloseFileHandles() # draw module map if self.ModuleMap: ROOT.gStyle.SetOptStat(0) self.ModuleMap.Draw(self.Canvas) self.ModuleMap.DrawCaption({ 'Test': self.Attributes['Test'], 'NModules': NModules }) self.SaveCanvas('png') HTML = self.Image(self.Attributes['ImageFile']) + self.BoxFooter( "Number of modules: %d" % NModules) AbstractClasses.GeneralProductionOverview.GeneralProductionOverview.GenerateOverview( self) self.DisplayErrorsList() return self.Boxed(HTML)
class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.Name = 'CMSPixel_QualificationGroup_Reception_Chips_Chip_BumpBondingMap_TestResult' self.NameSingle = 'BumpBondingMap' self.Attributes['TestedObjectType'] = 'CMSPixel_Module' def PopulateResultData(self): ROOT.gStyle.SetOptStat(0) # initialize module map self.ModuleMap = ModuleMap( Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) # fill plot SpecialBumpBondingTestNamesROC = [] for i in self.ParentObject.ResultData['SubTestResults'][ 'Chips'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData[ 'SubTestResults']['Chips'].ResultData['SubTestResults'][i] # take the same bb map that has been used in the grading SpecialBumpBondingTestName = ChipTestResultObject.ResultData[ 'SubTestResults']['Grading'].ResultData['HiddenData'][ 'SpecialBumpBondingTestName'] if SpecialBumpBondingTestName == 'BB4': histo = ChipTestResultObject.ResultData['SubTestResults'][ 'BB4'].ResultData['Plot']['ROOTObject'] self.ResultData['HiddenData'][ 'SpecialBumpBondingTestName'] = 'BB4' elif SpecialBumpBondingTestName == 'BB2': histo = ChipTestResultObject.ResultData['SubTestResults'][ 'BB2Map'].ResultData['Plot']['ROOTObject'] self.ResultData['HiddenData'][ 'SpecialBumpBondingTestName'] = 'BB2' else: histo = ChipTestResultObject.ResultData['SubTestResults'][ 'BumpBondingMap'].ResultData['Plot']['ROOTObject'] SpecialBumpBondingTestNamesROC.append(SpecialBumpBondingTestName) if not histo: print 'cannot get BumpBondingProblems histo for chip ', ChipTestResultObject.Attributes[ 'ChipNo'] continue chipNo = ChipTestResultObject.Attributes['ChipNo'] for col in range(self.nCols): for row in range(self.nRows): result = histo.GetBinContent(col + 1, row + 1) self.ModuleMap.UpdatePlot(chipNo, col, row, result) UniqueBBTestNames = list(set(SpecialBumpBondingTestNamesROC)) if len(UniqueBBTestNames) == 1: self.ResultData['HiddenData'][ 'SpecialBumpBondingTestName'] = UniqueBBTestNames[0] elif len(UniqueBBTestNames) > 1: self.ResultData['HiddenData'][ 'SpecialBumpBondingTestName'] = '/'.join(UniqueBBTestNames) else: self.ResultData['HiddenData']['SpecialBumpBondingTestName'] = '' # draw module map if self.ModuleMap: self.ResultData['Plot'][ 'ROOTObject'] = self.ModuleMap.GetHistogram() self.ModuleMap.Draw(self.Canvas) # save canvas self.ResultData['Plot']['Format'] = 'png' self.Title = 'Bump Bonding Defects Map %s' % ( "(" + self.ResultData['HiddenData']['SpecialBumpBondingTestName'] + ")" if len(self.ResultData['HiddenData'] ['SpecialBumpBondingTestName']) > 0 else "") self.SaveCanvas()
class TestResult(AbstractClasses.GeneralTestResult.GeneralTestResult): def CustomInit(self): self.Name = 'CMSPixel_QualificationGroup_XrayCalibrationSpectrum_HitmapOverview_TestResult' self.NameSingle = 'HitmapOverview' self.Attributes['TestedObjectType'] = 'CMSPixel_Module' def PopulateResultData(self): ROOT.gPad.SetLogy(0) ROOT.gStyle.SetOptStat(0) # initialize module map self.ModuleMap = ModuleMap( Name=self.GetUniqueID(), nChips=self.ParentObject.Attributes['NumberOfChips'], StartChip=self.ParentObject.Attributes['StartChip']) for i in self.ParentObject.ResultData['SubTestResults'][ 'Chips_Xray'].ResultData['SubTestResults']: ChipTestResultObject = self.ParentObject.ResultData[ 'SubTestResults']['Chips_Xray'].ResultData['SubTestResults'][i] chipNo = ChipTestResultObject.Attributes['ChipNo'] SubTestKey = 'Xray_HitMap_{Method}_{Target}_Chip{Chip}'.format( Method=self.Attributes['Method'], Target=self.Attributes['Target'], Chip=chipNo) histo = ChipTestResultObject.ResultData['SubTestResults'][ SubTestKey].ResultData['Plot']['ROOTObject'] for col in range(self.nCols): for row in range(self.nRows): result = histo.GetBinContent(col + 1, row + 1) self.ModuleMap.UpdatePlot(chipNo, col, row, result) # draw module map if self.ModuleMap: self.ResultData['Plot'][ 'ROOTObject'] = self.ModuleMap.GetHistogram() self.ModuleMap.SetContour(100) self.ResultData['Plot']['ROOTObject'].GetZaxis().SetRangeUser( 0, self.ResultData['Plot']['ROOTObject'].GetMaximum()) try: XProjection = self.ResultData['Plot'][ 'ROOTObject'].ProjectionX( 'hproj_{Target}_{id}'.format( Target=self.Attributes['Target'], id=self.GetUniqueID()), 50, 50) XProjectionList = [] for col in range(XProjection.GetXaxis().GetFirst(), XProjection.GetXaxis().GetLast() + 1): XProjectionList.append(XProjection.GetBinContent(col)) XProjectionList.sort() Median = XProjectionList[int(len(XProjectionList) / 2)] if Median < 1: XProjectionList = [] for col in range(self.nCols): XProjectionList.append(self.ResultData['Plot'] ['ROOTObject'].GetBinContent( 7 * self.nCols + col, int(self.nRows * 1.5))) XProjectionList.sort() Median = XProjectionList[int(len(XProjectionList) / 2)] if self.ResultData['Plot']['ROOTObject'].GetMaximum( ) > Median * 3: self.ResultData['Plot']['ROOTObject'].GetZaxis( ).SetRangeUser(0, Median * 3) except: pass self.ModuleMap.Draw(Canvas=self.Canvas, TitleZ="# hits") # save canvas self.ResultData['Plot']['Format'] = 'png' self.Title = 'Hit Map {Target}'.format( Target=self.Attributes['Target']) self.SaveCanvas() def UpdatePlot(self, chipNo, col, row, value): result = value if chipNo < 8: tmpCol = 8 * self.nCols - 1 - chipNo * self.nCols - col tmpRow = 2 * self.nRows - 1 - row else: tmpCol = (chipNo % 8 * self.nCols + col) tmpRow = row # Get the data from the chip sub test result hitmap if result and self.verbose: print chipNo, col, row, '--->', tmpCol, tmpRow, result self.ResultData['Plot']['ROOTObject'].Fill(tmpCol, tmpRow, result)