Esempio n. 1
0
void CountTerritoryDialog::setScore(int alive_b, int alive_w, int dead_b, int dead_w, int capturedBlack, int capturedWhite, int blackTerritory, int whiteTerritory, double komi){
    qreal bscorej = blackTerritory + dead_w + capturedWhite;
    qreal wscorej = whiteTerritory + dead_b + capturedBlack + komi;
    scorej = wscorej - bscorej;

    // japanese rule
    QString bj( tr("Black: %1 = %2(territories) + %3(captured)").arg(bscorej).arg(blackTerritory).arg(dead_w + capturedWhite) );
    QString wj( tr("White: %1 = %2(territories) + %3(captured) + %4(komi)").arg(wscorej).arg(whiteTerritory).arg(dead_b + capturedBlack).arg(komi) );

    QString resultj;
    if (wscorej > bscorej)
        resultj = QString(tr("W+%1")).arg(wscorej - bscorej);
    else if (bscorej > wscorej)
        resultj = QString(tr("B+%1")).arg(bscorej - wscorej);
    else
        resultj = tr("Draw");

    QString s = tr("Japanese Rule") + ":\n" + wj + "\n" + bj + "\n" + resultj + "\n\n";


    // chinese rule
    double half = (blackTerritory + alive_b + whiteTerritory + alive_w) / 2.0;
    double bscorec = blackTerritory + alive_b - komi / 2.0;
    double wscorec = whiteTerritory + alive_w + komi / 2.0;

    QString bc, wc;
    if (komi > 0){
        bc = tr("Black: %1 = %2(point) - %3(komi) / 2").arg(bscorec).arg(blackTerritory + alive_b).arg(komi);
        wc = tr("White: %1 = %2(point) + %3(komi) / 2").arg(wscorec).arg(whiteTerritory + alive_w).arg(komi);
    }
    else{
        bc = tr("Black: %1 = %2(point) + %3(komi) / 2").arg(bscorec).arg(blackTerritory + alive_b).arg(komi);
        wc = tr("White: %1 = %2(point) - %3(komi) / 2").arg(wscorec).arg(whiteTerritory + alive_w).arg(komi);
    }

    QString resultc;
    if (wscorec > bscorec)
        resultc = QString(tr("W+%1")).arg(wscorec - half);
    else if (bscorec > wscorec)
        resultc = QString(tr("B+%1")).arg(bscorec - half);
    else
        resultc = tr("Draw");

    s += tr("Chinese Rule") + ":\n" + wc + "\n" + bc + "\n" + resultc;

    m_ui->scoreTextEdit->setPlainText(s);
}
Esempio n. 2
0
void Intg(std::string histname,float xmin,float xmax)
{
  double count1=0,count2=0;
  
  double integralfull = 0;
  double integral = 0;

  TFile ww("WW.root");
  TFile wj("Wjets.root");
  TFile tt("TTbar.root");
  TFile bc("BCtoEQCD.root");
  TFile em("emEnrichQCD.root");
  TFile zj("ZeeJet.root");

  fout<<"---------ZJet--------"<<endl; 
  TH1F *hzj=(TH1F*)zj.Get(histname.c_str());

  GetInt(hzj,xmin,xmax,integralfull,integral);
  fout<<endl; 
  
  fout<<"---------QCD emEnrich--------"<<endl; 
  TH1F *hem=(TH1F*)em.Get(histname.c_str());
  GetInt(hem,xmin,xmax,integralfull,integral);
  fout<<endl; 
  GetIntg(hem,xmin,xmax,count1, count2);
  
  fout<<"---------QCD BCtoE--------"<<endl; 
  TH1F *hbc=(TH1F*)bc.Get(histname.c_str());
  GetInt(hbc,xmin,xmax,integralfull,integral);
  fout<<endl; 
  GetIntg(hbc,xmin,xmax,count1, count2);

  fout<<"---------TT bar--------"<<endl; 
  TH1F *htt=(TH1F*)tt.Get(histname.c_str());
  GetInt(htt,xmin,xmax,integralfull,integral);
  fout<<endl; 
  GetIntg(htt,xmin,xmax,count1, count2);
  
  fout<<"---------Wjets--------"<<endl; 
  TH1F *hwj=(TH1F*)wj.Get(histname.c_str());
  GetInt(hwj,xmin,xmax,integralfull,integral);
  fout<<endl; 
  GetIntg(hwj,xmin,xmax,count1, count2);
  
  fout<<"---------WW--------"<<endl; 
  TH1F *hww=(TH1F*)ww.Get(histname.c_str());
  GetInt(hww,xmin,xmax,integralfull,integral);
  fout<<endl; 
  GetIntg(hww,xmin,xmax,count1, count2);

  fout<<endl; 

  fout<<"------------Total BackGround --------"<<endl; 

  fout<<"Full Integral: "<<count1<<endl;
  //  fout<<"Surviving the cut: "<<count2<<endl;
  double eff=count2/count1;
  //  fout<<"Efficiency: "<<eff<<endl;
  //  fout<<endl;
  //  fout<<"Rejection rate: "<<1-eff<<endl;
  
  double M_S=integral/sqrt(integral+count2);
  //  fout<<"Merit of Significance: "<<M_S<<endl;

}