#ifndef WAFERANALYSIS_H #define WAFERANALYSIS_H //Main class to analyze the data from STControl for a wafer. //This class reads the chip files and does the analyzed to the .root and the .cfg files. //New scans have to be implemented here. //The WaferAnalyzes class uses one WaferData object that holds the analyzed data and the file name of each chip. //The WaferAnalyzes class uses one WaferCuts object to apply cuts to the data. //The WaferAnalyzes class uses one WaferPlots object to plot the data. //pohl@physik.uni-bonn.de //Jan. 2012 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /// #include /// #include /// #include "DataContainer/PixDBData.h" #include "PixConfDBInterface/PixConfDBInterface.h" #include "PixConfDBInterface/RootDB.h" #include "PixController/PixScan.h" #include "GeneralDBfunctions.h" #include "WaferBasis.h" #include "WaferData.h" #include "WaferSettings.h" #include "WaferCuts.h" #include "WaferPlots.h" #include "WaferXML.h" #define __MAXCOL 80 #define __MAXROW 336 using namespace PixLib; class WaferAnalysis: public WaferBasis { public: WaferAnalysis(); void openAndAnalyzeChipFile(unsigned int pChipIndex); //opens the scan file and the config file of the chip with index pChipIndex, starts analyze and determines chip status void analyzeFileGroup(); //analyzes all files found via _waferData.openFileGroup() and analyzes each via openAndAnalyzeScanFile() void createWaferResults(); //plots one histogram for all results filled with the according chip results void createWaferMap(); //creates the wafer map void startPostProcessing(unsigned int pChipIndex); //analyzes that is done at the end on the result values are called here (e.g. refits, comparisons) void refreshResultCuts(int pChipIndex = -1); //reloads the cut file and applies the cuts to all results void setPlotOutput(bool pToggle = true); //plot output is created if pToogle = true; _generatePlots is set void exportResultsToXML(); //creates an XML file to export selected results to the IBL data base void setErrorOutput(bool pToggle = true); //set to see errors output, standard setting: on void setWarningOutput(bool pToggle = true); //set to see warnings output, standard setting: on void setInfoOutput(bool pToggle = true); //set to see infos output, standard setting: off void setDebugOutput(bool pToggle = true); //set to see debug output, standard setting: off WaferCuts _waferCuts; //class holding the cut parameters and providing cut functions WaferData _waferData; //class holding all result data and providing data analyzes functions WaferSettings _waferSettings; //class holding all settings private: void openAndAnalyzeConfigFile(unsigned int pChipIndex); //opens the config file with the index pChipIndex and starts analyzes void openAndAnalyzeScanFile(unsigned int pChipIndex); //opens one scan file of the chip with the index pChipIndex and starts analyzes void analyzeScan(unsigned int pChipIndex, std::string pSname); //for the actual chip: determines which scan is pSname and calls the according function below void analyzeThresholdScan(unsigned int pChipIndex, std::string pSTscanName); //analyzes the threshold scan data and applies the cuts void analyzeDigitalTest(unsigned int pChipIndex, std::string pSTscanName); //analyzes the digital test data and applies the cuts void analyzeAnalogTest(unsigned int pChipIndex, std::string pSTscanName); //analyzes the analog test data and applies the cuts void analyzeHitOrTest(unsigned int pChipIndex, std::string pSTscanName); //analyzes the hit or test data and applies the cuts void analyzeBufferTest(unsigned int pChipIndex, std::string pSTscanName); //analyzes the buffer test data and applies the cuts void analyzeLatancyTest(unsigned int pChipIndex, std::string pSTscanName); //analyzes the latency test data and applies the cuts void analyzeCapCalibrationScan(unsigned int pChipIndex, std::string pSTscanName); //analyzes the Icap scan data and applies the cuts void analyzePlsrDacScan(unsigned int pChipIndex, std::string pSTscanName); //analyzes the Plsr DAC scan data and applies the cuts void analyzeCrossTalkScan(unsigned int pChipIndex, std::string pSTscanName); //analyzes the cross talk scan data and applies the cuts void analyzeCheckPixelDisableScan(unsigned int pChipIndex, std::string pSTscanName); //analyzes the check pixel disable scan data and applies the cuts void analyzeInjectionDelayScan(unsigned int pChipIndex, std::string pSTscanName); //analyzes the injection delay scan data and applies the cuts void analyzeRXdelayScan(unsigned int pChipIndex, std::string pSTscanName); //analyzes the RX delay scan data and applies the cuts void analyzeGlobalRegisterTest(unsigned int pChipIndex, std::string pSTscanName, std::string pData); //analyzes the global register test data and applies the cuts, also compares the read serial number with the expected void analyzePixelRegisterTest(unsigned int pChipIndex, std::string pSTscanName, std::string pData); //analyzes the pixel register test data and applies the cuts void analyzeSumPixelRegisterTest(unsigned int pChipIndex); //analyzes the result of all pixel register test (_tLatchError) data and applies the cuts void analyzeESLtest(unsigned int pChipIndex, std::string pSTscanName); //analyzes the event size limit test data and applies the cuts void analyzeScanChain(unsigned int pChipIndex, std::string pSTscanName, RootDB* pDataBase, fieldIterator& pPos, fieldIterator& pEnd); //analyzes the scan chain void analyzeChipSerialNumber(unsigned int pChipIndex, std::string pSTscanName, std::string pData); //analyzes the chip serial number from the read back GR values and sets the status of the result to GREEN/BLUE (right/wring) void analyzeDSCGraphAnaMeasurement(unsigned int pChipIndex, RootDB* pDB, recordIterator pi); //reads DCS values and Graph analysis values and applies cuts void analyzeServiceRecord(unsigned int pChipIndex, std::string pSTscanName, std::vector& pData); //reads the service records void analyzeLinearDACDSCscan(unsigned int pChipIndex, std::string pSTscanName, std::string tXaxis, std::string tYaxis, double pValueFactor = 1, double pSlopeFactor = 1, double pChi2ResultFactor = -1, double pBestValue = -1); void analyzeDSCvalueInScan(unsigned int pChipIndex, std::string pSTscanName, std::string pDCSname, std::string pCutName); //reads DCS values from a scan stores them and applies cuts void analyzeGlobalRegister(unsigned int pChipIndex, RootDB* pDB, recordIterator pi); //reads global register setting from cfg file and applies cuts void analyzePixControllerConfig(unsigned int pChipIndex, RootDB* pDB, recordIterator pi); //reads pix controller setting from the cfg file and applies cuts void analyzeChipCalibration(unsigned int pChipIndex, RootDB* pDB, recordIterator pi); //reads chip calibration data from cfg file and applies cuts //post processing void analyzeFailingChipParts(unsigned int pChipIndex); //analyses the failing pixels and DCs of the scans and applies cuts void analyzeShiftedVrefs(unsigned int pChipIndex); //analyses the BG values at different chip current states and extrapolates to a BG without GND shift, also corrects the tunable Vrefs by the GND shift, applies cuts void compareResults(unsigned int pChipIndex); //compares results and sets the status accordingly (WARNING can override results stati) void calculateResult(unsigned int pChipIndex); //corrects the threshold scan results according to the calculated PlsrDAC and capacitance correction bool runAborted(unsigned int pChipIndex); //return true if the run got aborted, aborted run triggers for not all IDDX values available void applyChipCut(unsigned int pChipIndex, std::string pCutName, std::string pResultName); //applies the Chip cuts (#analog failed pixel, VDDA1,...) by using the WaferCuts class void applyTotalColumnsCut(unsigned int pChipIndex); //takes the total pixels fail data and adds failing columns where the total number is above the cut value TotalFailPixel unsigned int calculateChipSN(unsigned int tWaferSN, unsigned int tChipNr); //function to calculate the Chip serial number from the wafer SN and the chip Nr. See FE-I4B manual on last page. std::string _gname, _mname; //helper functions unsigned int getNbitSet(unsigned long pValue); //counts the numbers of bit set, first published: Peter Wegner in CACM 3 (1960), 322 void getBitSet(unsigned long pValue, std::vector& rPositions); //returns the positions of set bits (=1) bool extractPixRegTestData(std::string pLine, unsigned long& rWriteNumber, unsigned long& rReadNumber, unsigned int& rActualDC, unsigned int& rActualWordNumber); //extracts the data write/read back data from the pixel register test bool calculatePixPosition(unsigned int pWordNumber, unsigned int pPosition, unsigned int pDC, unsigned int& rCol, unsigned int& rRow);//calculates the pixel position for a given data word position, bit in data word position and double column //class objects WaferPlots _waferPlots; //class providing functions to plot and store the analyzed data WaferXML _waferXML; //class providing functions to store the analyzed data into an XML file std::map > > _tLatchError; //temporary object to store the failing pixels in the pix reg tests, [latch name][col][role bool _generatePlots; //generates Plot output for the scans if trff }; #endif // WAFERANALYSIS_H