Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
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()        
Ejemplo n.º 3
0
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()
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
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()
Ejemplo n.º 7
0
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()
Ejemplo n.º 8
0
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()
Ejemplo n.º 9
0
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()
Ejemplo n.º 10
0
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()
Ejemplo n.º 11
0
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 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)