コード例 #1
0
ファイル: Significance.C プロジェクト: manuelfs/babar_code
void Significance(TString tag=""){
  // Loading files
  TChain ch("ntp1");
  ch.Add("AWG82/ntuples/SP-1235-BSemiExcl-Run2-R22d-v06/*");
  ch.Add("AWG82/ntuples/SP-1235-BSemiExcl-Run4-R22d-v06/*");
  ch.Add("AWG82/ntuples/SP-1237-BSemiExcl-Run2-R22d-v06/*");
  ch.Add("AWG82/ntuples/SP-1237-BSemiExcl-Run4-R22d-v06/*");

  int entries = ch.GetEntries();
  TCut MMiss = "candPMiss>.2";
  TCut Q2 = "candQ2>4";
  TCut ee1 = "candType<3&&candEExtra<.2";
  TCut ee2 = "candType==3&&candEExtra<.15";
  TCut ee3 = "candType==4&&candEExtra<.3";
  TCut ee = (ee1||ee2||ee3);
  TCut basic = ee+MMiss+Q2;

  TString D0names[]={"K^- \\pi^+","K^-\\pi^+\\pi^0","K^-\\pi^+\\pi^+\\pi^-",
		     "K_S^0\\,\\pi^+\\pi^-","K_S^0\\,\\pi^+\\pi^-\\pi^0",
		     "K_S^0\\,K_S^0","K_S^0\\,\\pi^0","\\pi^+\\pi^-","K^+K^-"};
  TString Dplusnames[]={"K^-\\pi^+\\pi^+","K^-\\pi^+\\pi^+\\pi^0","K_S^0\\,\\pi^+",
			"K_S^0\\,\\pi^+\\pi^0","K_S^0\\,\\pi^+\\pi^+\\pi^-",
			"K^+K^-\\pi^+","K_S^0\\,K^+"};
  fstream tex;
  tex.open("mycode/tables/Significance"+tag+".txt",fstream::out);
  tex<<"\\begin{tabular}{|l|ccc||l|ccc|}"<<endl<<"\\hline"<<endl;
  tex<<"$\\mathbf{D^{(*)0}}$ & $S$ & B & $\\frac{S}{S+B}$(\\%) & ";
  tex<<"$\\mathbf{D^{(*)+}}$ & $S$ & B & $\\frac{S}{S+B}$(\\%)\\\\"<<endl;
  tex<<"\\hline \\hline"<<endl;

  double S=0,B=0;
  for(int i=1; i<10;i++){
    TString tS = "(MCType==5||MCType==6)&&candType<3&&candDType=="; tS+=i;
    TString tB = "(MCType==0||MCType>6)&&candType<3&&candDType==";tB+=i;
    TCut cutS(tS), cutB(tB);
    S = ch.GetEntries(basic+cutS);
    B = ch.GetEntries(basic+cutB);
    int puri = S/(S+B)*100;
    tex<<D0names[i-1]<<" & "<<S<<" & "<<B<<" & "<<puri<<" & ";
    if(i<8){
      tS = "(MCType==11||MCType==12)&&(candType==3||(candType==4&&candDstarType==5))&&candDType=="; 
      tB = "(MCType<7||MCType>12)&&(candType==3||(candType==4&&candDstarType==5))&&candDType==";
      tS+=i; tB+=i;
      TCut cutS(tS), cutB(tB);
      S = ch.GetEntries(basic+cutS);
      B = ch.GetEntries(basic+cutB);
      puri = S/(S+B)*100;
      tex<<Dplusnames[i-1]<<" & "<<S<<" & "<<B<<" & "<<puri<<" \\\\"<<endl;  
    } else {
      tex<<" & & & \\\\"<<endl;
    }
    cout<<"DMode "<<i<<" has S "<<S<<", S/sqrt(S+B) "<<round(S/sqrt(S+B));
    cout<<" and S/(S+B) "<<round(S/(S+B))<<endl;
  }
  tex<<"\\hline \\end{tabular}"<<endl<<endl;
}
コード例 #2
0
void KGlobalShortcutTest::testChangeShortcut()
{
    // Skip this. The above testcase hasn't changed the actions
    setupTest("testChangeShortcut");

    if (!m_daemonInstalled)
        QSKIP("kglobalaccel not installed", SkipAll);
    // Change the shortcut
    KShortcut newCutA(sequenceC);
    m_actionA->setGlobalShortcut(newCutA, KAction::ActiveShortcut, KAction::NoAutoloading);
    // Ensure that the change is active
    QCOMPARE(m_actionA->globalShortcut(), newCutA);
    // We haven't changed the default shortcut, ensure it is unchanged
    KShortcut cutA(sequenceA, sequenceB);
    QCOMPARE(m_actionA->globalShortcut(KAction::DefaultShortcut), cutA);

    // Try to set a already take shortcut
    KShortcut cutB(m_actionA->globalShortcut().primary(), QKeySequence(sequenceE));
    m_actionB->setGlobalShortcut(cutB, KAction::ActiveShortcut, KAction::NoAutoloading);
    // Ensure that no change was made to the primary active shortcut
    QVERIFY(m_actionB->globalShortcut().primary().isEmpty());
    // Ensure that the change to the secondary active shortcut was made
    QCOMPARE(m_actionB->globalShortcut().alternate(), QKeySequence(sequenceE));
    // Ensure that the default shortcut is still empty
    QVERIFY(m_actionB->globalShortcut(KAction::DefaultShortcut).isEmpty()); // unchanged

    // Only change the active shortcut
    cutB.setPrimary(sequenceD);
    m_actionB->setGlobalShortcut(cutB, KAction::ActiveShortcut, KAction::NoAutoloading);
    // Check that the change went through
    QCOMPARE(m_actionB->globalShortcut(), cutB);
    // Check that the default shortcut is not active
    QVERIFY(m_actionB->globalShortcut(KAction::DefaultShortcut).isEmpty()); // unchanged
}