void report(const char *fname="protocol.root") { TFile *inFile = TFile::Open(fname); const int kNCh = 32; const int kNQR = 26; const int kNVRef = 6; const int kNACurr = 5; const int kNSync = 8; TTree *tree = (TTree*) inFile->Get("tree"); TCanvas *c1 = new TCanvas("c1","c1"); //Declaration of leaves types Char_t filename[200]; Char_t datetime[100]; Char_t cQR[kNQR]; Int_t iChip; Int_t iSta; Float_t fVRef[kNVRef]; Float_t fVCurr[kNACurr]; Float_t fACurr[kNACurr]; Float_t fGain20mV[32]; Float_t fGain30mV[32]; Float_t fRT20mV[32]; Float_t fRT30mV[32]; Float_t fPed20mV[32]; Float_t fPed30mV[32]; Float_t fRms20mV[32]; Float_t fRms30mV[32]; Float_t fPedAna20mV[32]; Float_t fPedAna30mV[32]; Float_t fRmsAna20mV[32]; Float_t fRmsAna30mV[32]; Float_t fX20mVeven; Float_t fX20mVodd; Float_t fX30mVeven; Float_t fX30mVodd; Int_t iSync[kNSync]; Int_t iDFT; Int_t iJtag; Int_t iMem; Float_t fClk; Int_t i2cErr; Int_t iRCode; // Set branch addresses. tree->SetBranchAddress("filename",filename); tree->SetBranchAddress("datetime",datetime); tree->SetBranchAddress("cQR",&cQR); tree->SetBranchAddress("iChip",&iChip); tree->SetBranchAddress("fV",fV); tree->SetBranchAddress("fA",fA); tree->SetBranchAddress("fGain20mV",fGain20mV); tree->SetBranchAddress("fGain30mV",fGain30mV); tree->SetBranchAddress("fRT20mV",fRT20mV); tree->SetBranchAddress("fRT30mV",fRT30mV); tree->SetBranchAddress("fPed20mV",fPed20mV); tree->SetBranchAddress("fPed30mV",fPed30mV); tree->SetBranchAddress("fRms20mV",fRms20mV); tree->SetBranchAddress("fRms30mV",fRms30mV); tree->SetBranchAddress("fX20mVeven",&fX20mVeven); tree->SetBranchAddress("fX20mVodd",&fX20mVodd); tree->SetBranchAddress("fX30mVeven",&fX30mVeven); tree->SetBranchAddress("fX30mVodd",&fX30mVodd); tree->SetBranchAddress("iSync",iSync); tree->SetBranchAddress("iDFT",&iDFT); tree->SetBranchAddress("iJtag",&iJtag); tree->SetBranchAddress("iMem",&iMem); tree->SetBranchAddress("fClk",&fClk); tree->SetBranchAddress("i2cErr",&i2cErr); tree->SetBranchAddress("iRCode",&iRCode); Long64_t nentries = tree->GetEntries(); cout << " nentries = " << nentries << endl; CONTINUE HERE // We check all the possible errors int RefErrCode = 0x1; int SyncErrCode = 0x2; int JtagErrCode = 0x4; int MemErrCode = 0x8; int PlotErrCode = 0x10; int DFTErrCode = 0x20; int PedErrCode = 0x40; // const char *ErrCodeStr[] = { "Ref", "Sync", "Jtag", "Mem", "Plot", "DFT", "Ped" }; const char *ErrCodeStr[] = { "Ref", "Sync", "Jtag", "Mem", "TP", "DFT", "Ped" }; const int kMaxErrBits = 7; const int kMaxErrVal = 0x7F; int nbins = kMaxErrVal + 1; TH1F *hV3ErrCode = new TH1F("hV3ErrCode", "V3 Error Code", nbins, -0.5, kMaxErrVal + 0.5); TH1F *hV4ErrCode = new TH1F("hV4ErrCode", "V4 Error Code", nbins, -0.5, kMaxErrVal + 0.5); TH1F *hV3ErrCodeOperable = new TH1F("hV3ErrCodeOperable", "V3 Error Code - Operable", nbins, -0.5, kMaxErrVal + 0.5); TH1F *hV4ErrCodeOperable = new TH1F("hV4ErrCodeOperable", "V4 Error Code - Operable", nbins, -0.5, kMaxErrVal + 0.5); const int kMaxNErr = 7; const int kErrMargin = 1; // you have to have more than 1 test be OK to be considered at all Operable... nbins = kMaxNErr + 1; TH1F *hV3NErr = new TH1F("hV3NErr", "V3 NError", nbins, -0.5, kMaxNErr + 0.5); TH1F *hV4NErr = new TH1F("hV4NErr", "V4 NError", nbins, -0.5, kMaxNErr + 0.5); Long64_t nbytes = 0; int ichan = 0; for (Long64_t i=0; iGetEntry(i); int iErrVal = 0; int nErr = 0; if (iRef != 1) { iErrVal |= RefErrCode; nErr++; } if (iSync != 1) { iErrVal |= SyncErrCode; nErr++; } if (iJtag != 1) { iErrVal |= JtagErrCode; nErr++; } if (iMem != 1) { iErrVal |= MemErrCode; nErr++; } if (iPlot != 1) { iErrVal |= PlotErrCode; nErr++; } // not sure if plot info consistently filled in... if (iDFT != 1) { iErrVal |= DFTErrCode; nErr++; } if (iPed != 1) { iErrVal |= PedErrCode; nErr++; } TString s(version); if ( s.Contains("V3") ) { hV3ErrCode->Fill( iErrVal ); hV3NErr->Fill( nErr ); if (nErr < (kMaxNErr-kErrMargin) ) { hV3ErrCodeOperable->Fill( iErrVal ); } } else if ( s.Contains("V4") ) { hV4ErrCode->Fill( iErrVal ); hV4NErr->Fill( nErr ); if (nErr < (kMaxNErr-kErrMargin) ) { hV4ErrCodeOperable->Fill( iErrVal ); } } } c1->cd(1); // c1->SetLogy(1); // first the NErr plots hV3NErr->SetLineColor(2); hV4NErr->SetLineColor(4); gStyle->SetOptStat(0); hV4NErr->Draw(); hV3NErr->Draw("SAME"); char rmsinfo[20]; TLegend* legend = new TLegend(0.6,0.6,0.9,0.9); legend->SetHeader("SAMPA - NErr"); sprintf(rmsinfo,"V3 : #mu = %3.2f, #sigma = %3.2f", hV3NErr->GetMean(), hV3NErr->GetRMS() ); legend->AddEntry(hV3NErr,rmsinfo,"l"); sprintf(rmsinfo,"V4 : #mu = %3.2f, #sigma = %3.2f", hV4NErr->GetMean(), hV4NErr->GetRMS() ); legend->AddEntry(hV4NErr,rmsinfo,"l"); legend->Draw(); c1->Modified(); c1->SaveAs("V34_NErr.pdf"); // Next the ErrCode plots hV3ErrCodeOperable->SetLineColor(2); hV4ErrCodeOperable->SetLineColor(4); hV4ErrCodeOperable->Draw(); hV3ErrCodeOperable->Draw("SAME"); TLegend* legendC = new TLegend(0.6,0.6,0.9,0.9); legendC->SetHeader("SAMPA - Err CodeOperable"); legendC->AddEntry(hV3ErrCodeOperable,"V3","l"); legendC->AddEntry(hV4ErrCodeOperable,"V4","l"); legendC->Draw(); c1->Modified(); c1->SaveAs("V34_ErrCodeOperable.pdf"); // actually loop over histos and print out info also int code = 0; cout << endl << " V3 info : Number of Errors " << endl; int nOK_V3 = hV3NErr->GetBinContent(1); int nInOperable_V3 = hV3ErrCode->GetEntries() - hV3ErrCodeOperable->GetEntries(); int nFail_V3 = 0; int nErrTot_V3_Exp = 0; for (int ib=1; ib<(hV3NErr->GetNbinsX()-kErrMargin); ib++) { if (hV3NErr->GetBinContent(ib) > 0) { printf("NErr %1.0f counts %3.0f\n", hV3NErr->GetBinCenter(ib), hV3NErr->GetBinContent(ib)); if (ib>1) { nFail_V3 += TMath::Nint(hV3NErr->GetBinContent(ib)); nErrTot_V3_Exp += TMath::Nint(hV3NErr->GetBinCenter(ib) * hV3NErr->GetBinContent(ib)); } } } printf("NErr >= %d counts %d\n", kMaxNErr - kErrMargin, nInOperable_V3); printf("\n nOk %d\n nInOperable %d\n nFail %d\n", nOK_V3, nInOperable_V3, nFail_V3); int nTot_V3 = nOK_V3 + nInOperable_V3 + nFail_V3; if(nTot_V3 > 0) { float yield_V3 = nOK_V3 / (1.0*nTot_V3); printf("nTot = %d => Yield = %4.2f\n", nTot_V3, yield_V3); } int iErrCounts_V3[kMaxErrBits+1] = {0}; cout << " V3 fail info : for the " << nFail_V3 << " chips with issues " << endl; for (int ib=1; ib<=hV3ErrCodeOperable->GetNbinsX(); ib++) { if (hV3ErrCodeOperable->GetBinContent(ib) > 0) { code = TMath::Nint(hV3ErrCodeOperable->GetBinCenter(ib)); if (code > 0) { // printf("ErrCodeOperable %02x counts %3.0f : ", code, hV3ErrCodeOperable->GetBinContent(ib)); printf("%3.0f chips with errors", hV3ErrCodeOperable->GetBinContent(ib)); for (int ic=0; ic 0 ) { // bit set iErrCounts_V3[ic] += TMath::Nint(hV3ErrCodeOperable->GetBinContent(ib)); cout << " " << ErrCodeStr[ic]; } } printf("\n"); } } } // counts for each type of error cout << endl << " V3 error occurence from each test " << endl; int nErrTot_V3 = 0; for (int ic=0; ic for a total of %d errors (expected %d) in %d chips\n", nErrTot_V3, nErrTot_V3_Exp, nFail_V3); //// V4 //// cout << endl << " V4 info : Number of Errors " << endl; int nOK_V4 = hV4NErr->GetBinContent(1); int nInOperable_V4 = hV4ErrCode->GetEntries() - hV4ErrCodeOperable->GetEntries(); int nFail_V4 = 0; int nErrTot_V4_Exp = 0; for (int ib=1; ib<(hV4NErr->GetNbinsX()-kErrMargin); ib++) { if (hV4NErr->GetBinContent(ib) > 0) { printf("NErr %1.0f counts %3.0f\n", hV4NErr->GetBinCenter(ib), hV4NErr->GetBinContent(ib)); if (ib>1) { nFail_V4 += TMath::Nint(hV4NErr->GetBinContent(ib)); nErrTot_V4_Exp += TMath::Nint(hV4NErr->GetBinCenter(ib) * hV4NErr->GetBinContent(ib)); } } } printf("NErr >= %d counts %d\n", kMaxNErr - kErrMargin, nInOperable_V4); printf("\n nOk %d\n nInOperable %d\n nFail %d\n", nOK_V4, nInOperable_V4, nFail_V4); int nTot_V4 = nOK_V4 + nInOperable_V4 + nFail_V4; if(nTot_V4 > 0) { float yield_V4 = nOK_V4 / (1.0*nTot_V4); printf("nTot = %d => Yield = %4.2f\n", nTot_V4, yield_V4); } int iErrCounts_V4[kMaxErrBits+1] = {0}; cout << " V4 fail info : different ErrCodeOperable (hex) values" << endl; for (int ib=1; ib<=hV4ErrCodeOperable->GetNbinsX(); ib++) { if (hV4ErrCodeOperable->GetBinContent(ib) > 0) { code = TMath::Nint(hV4ErrCodeOperable->GetBinCenter(ib)); if (code > 0) { //printf("ErrCodeOperable %02x counts %3.0f : ", code, hV4ErrCodeOperable->GetBinContent(ib)); printf("%3.0f chips with errors", hV4ErrCodeOperable->GetBinContent(ib)); for (int ic=0; ic 0 ) { // bit set iErrCounts_V4[ic] += TMath::Nint(hV4ErrCodeOperable->GetBinContent(ib)); cout << " " << ErrCodeStr[ic]; } } printf("\n"); } } } // counts for each type of error cout << endl << " V4 error occurence from each test " << endl; int nErrTot_V4 = 0; for (int ic=0; ic for a total of %d errors (expected %d) in %d chips\n", nErrTot_V4, nErrTot_V4_Exp, nFail_V4); // and we're done.. }