void plot(const char *fname="protocol.root") { TFile *inFile = TFile::Open(fname); const int kNCh = 32; TTree *tree = (TTree*) inFile->Get("tree"); TCanvas *c1 = new TCanvas("c1","c1"); //Declaration of leaves types Char_t version[3]; Char_t location[11]; Char_t comment[25]; Int_t iChip; Float_t fAC; Float_t fDC; Int_t iV770; Int_t iV450; Int_t iV620; Int_t iRef; Int_t iSync; Int_t iJtag; Int_t iMem; Int_t iClk; Int_t iPlot; Int_t iDFT; Int_t iPed; Float_t fPed[32]; Float_t fPed2[32]; // Set branch addresses. tree->SetBranchAddress("version",version); tree->SetBranchAddress("location",location); tree->SetBranchAddress("comment",comment); tree->SetBranchAddress("iChip",&iChip); tree->SetBranchAddress("fAC",&fAC); tree->SetBranchAddress("fDC",&fDC); tree->SetBranchAddress("iV770",&iV770); tree->SetBranchAddress("iV450",&iV450); tree->SetBranchAddress("iV620",&iV620); tree->SetBranchAddress("iRef",&iRef); tree->SetBranchAddress("iSync",&iSync); tree->SetBranchAddress("iJtag",&iJtag); tree->SetBranchAddress("iMem",&iMem); tree->SetBranchAddress("iClk",&iClk); tree->SetBranchAddress("iPlot",&iPlot); tree->SetBranchAddress("iDFT",&iDFT); tree->SetBranchAddress("iPed",&iPed); tree->SetBranchAddress("fPed",fPed); tree->SetBranchAddress("fPed2",fPed2); Long64_t nentries = tree->GetEntries(); cout << " nentries = " << nentries << endl; int nbins = 40; float minClk = 95; float maxClk = 135; const int kNC = 2; // nCurrenHist const char *curText[] = {"AC", "DC"}; float curMin[kNC] = {0.3, 0.1}; float curMax[kNC] = {0.7, 0.5}; const int kNV = 4; // nVoltHist const char *voltText[] = {"V750", "V450", "V750 - V450", "V750 - V600"}; float voltMin[kNV] = {750.5, 450.5, 280.5, 130.5}; float voltMax[kNV] = {790.5, 490.5, 320.5, 170.5}; TH1F *hV3_Clk = new TH1F("hV3_Clk", "Ring Oscillator", nbins, minClk, maxClk); TH1F *hV4_Clk = new TH1F("hV4_Clk", "Ring Oscillator", nbins, minClk, maxClk); TH1F *hV3C[kNV]; TH1F *hV4C[kNV]; TH1F *hV3[kNV]; TH1F *hV4[kNV]; char id[50], title[50]; for (int iC=0; iCGetEntry(i); TString s(version); if ( s.Contains("V3") ) { if ( (fAC>0 && fAC<1) && (fDC>0 && fDC<1) ) { hV3C[0]->Fill( fAC ); hV3C[1]->Fill( fDC ); } if ( (iV770>100 && iV770<1000) && (iV450>100 && iV450<1000) && (iV620>100 && iV620<1000) ) { hV3[0]->Fill( iV770 ); hV3[1]->Fill( iV450 ); hV3[2]->Fill( iV770 - iV450); hV3[3]->Fill( iV770 - iV620); } if (iClk>50) hV3_Clk->Fill( iClk ); } else if ( s.Contains("V4") ) { if ( (fAC>0 && fAC<1) && (fDC>0 && fDC<1) ) { hV4C[0]->Fill( fAC ); hV4C[1]->Fill( fDC ); } if ( (iV770>100 && iV770<1000) && (iV450>100 && iV450<1000) && (iV620>100 && iV620<1000) ) { hV4[0]->Fill( iV770 ); hV4[1]->Fill( iV450 ); hV4[2]->Fill( iV770 - iV450); hV4[3]->Fill( iV770 - iV620); } if (iClk>50) hV4_Clk->Fill( iClk ); } } c1->cd(1); // c1->SetLogy(1); // first the clock plots hV3_Clk->SetLineColor(2); hV4_Clk->SetLineColor(4); gStyle->SetOptStat(0); hV3_Clk->Draw(); hV4_Clk->Draw("SAME"); char rmsinfo[20]; TLegend* legend = new TLegend(0.6,0.6,0.9,0.9); legend->SetHeader("SAMPA - Clk"); sprintf(rmsinfo,"V3 : #mu = %3.2f, #sigma = %3.2f", hV3_Clk->GetMean(), hV3_Clk->GetRMS() ); legend->AddEntry(hV3_Clk,rmsinfo,"l"); sprintf(rmsinfo,"V4 : #mu = %3.2f, #sigma = %3.2f", hV4_Clk->GetMean(), hV4_Clk->GetRMS() ); legend->AddEntry(hV4_Clk,rmsinfo,"l"); legend->Draw(); c1->Modified(); c1->SaveAs("V34_Clk.pdf"); // Next the current plots TLegend* legendC[kNC]; for (int iC=0; iCcd(1); // c1->SetLogy(1); hV3C[iC]->SetLineColor(2); hV4C[iC]->SetLineColor(4); if ( hV4C[iC]->GetMaximum() > hV4C[iC]->GetMaximum() ) { hV4C[iC]->Draw(); hV3C[iC]->Draw("SAME"); } else { hV3C[iC]->Draw(); hV4C[iC]->Draw("SAME"); } legendC[iC] = new TLegend(0.6,0.6,0.9,0.9); legendC[iC]->SetHeader("SAMPA - Currents"); sprintf(rmsinfo,"V3 : #mu = %3.2f, #sigma = %3.2f", hV3C[iC]->GetMean(), hV3C[iC]->GetRMS() ); legendC[iC]->AddEntry(hV3C[iC],rmsinfo,"l"); sprintf(rmsinfo,"V4 : #mu = %3.2f, #sigma = %3.2f", hV4C[iC]->GetMean(), hV4C[iC]->GetRMS() ); legendC[iC]->AddEntry(hV4C[iC],rmsinfo,"l"); legendC[iC]->Draw(); c1->Modified(); sprintf(title, "V34_current%d.pdf", iC); c1->SaveAs(title); } // Next the voltage plots TLegend* legendV[kNV]; for (int iV=0; iVcd(1); // c1->SetLogy(1); hV3[iV]->SetLineColor(2); hV4[iV]->SetLineColor(4); hV3[iV]->Draw(); hV4[iV]->Draw("SAME"); legendV[iV] = new TLegend(0.6,0.6,0.9,0.9); legendV[iV]->SetHeader("SAMPA - Bandgap"); sprintf(rmsinfo,"V3 : #mu = %3.2f, #sigma = %3.2f", hV3[iV]->GetMean(), hV3[iV]->GetRMS() ); legendV[iV]->AddEntry(hV3[iV],rmsinfo,"l"); sprintf(rmsinfo,"V4 : #mu = %3.2f, #sigma = %3.2f", hV4[iV]->GetMean(), hV4[iV]->GetRMS() ); legendV[iV]->AddEntry(hV4[iV],rmsinfo,"l"); legendV[iV]->Draw(); c1->Modified(); sprintf(title, "V34_voltage%d.pdf", iV); c1->SaveAs(title); } }