Esempio n. 1
0
int main(int argc, char** argv) {

    string ModelConf, FileOut;

    try {

        // get the name of the current directory
        char dir[255];
        getcwd(dir,255);
        
        // set filenames
        options_description desc("Allowed (positional) options");
        string inputFile(dir), outputFile(dir);
        inputFile += "/tests/StandardModel.conf";
        outputFile += "/tests/LEP2test.root";
        desc.add_options()
            ("modconf", value<string>()->default_value(inputFile), 
                "model config filename (1st)")
            ("rootfile", value<string>()->default_value(outputFile), 
                "output root filename (2nd)")
            ("help", "help message")
            ;
        positional_options_description pd;
        pd.add("modconf", 1);
        pd.add("rootfile", 1);
        variables_map vm;
        store(command_line_parser(argc, argv).options(desc).positional(pd).run(), vm);
        notify(vm);
        if (vm.count("help")) {
            cout << desc << endl;
            return EXIT_SUCCESS;
        }
        ModelConf = vm["modconf"].as<string > ();
        FileOut = vm["rootfile"].as<string>();
        cout << "# set " << ModelConf << " for the model config file" << endl;
        cout << "# set " << FileOut << " for the output file" << endl;
        
        // read parameters
        InputParser myInputParser;
        std::vector<ModelParameter> ModPars;
        std::vector<Observable> Obs;
        std::vector<Observable2D> Obs2D;
        std::vector<CorrelatedGaussianObservables> CGO;
        std::vector<ModelParaVsObs> ParaObs;
        std::map<string, double> DP;
        cout << "# Model: " 
             << myInputParser.ReadParameters(ModelConf, ModPars, Obs, Obs2D, CGO, ParaObs)
             << endl;
        for (std::vector<ModelParameter>::iterator it = ModPars.begin(); it < ModPars.end(); it++)
            DP[it->name] = it->ave;
        if (!myInputParser.getMyModel()->Init(DP)) {
            cout << "parameter(s) missing in model initialization" << endl;
            exit(EXIT_FAILURE);
        }
        
        //////////////////////////////////////////////////////////////////////

        // TEST for inputs
        //cout << "Mz = " << myInputParser.getMyModel()->getMz() << endl;
        
        ZFitterWrapper* ZF = new ZFitterWrapper(*myInputParser.getMyModel());
        ZF->FlagInfo();
        
        // TESTs
        //ZF->printIntermediateResults();
        //ZF->printInputs();
        //ZF->printConstants();
        
        ZFMw* myZFMw = new ZFMw(*ZF);
        cout << "Mw = " << myZFMw->computeThValue() << " " << endl << endl;
        
        //////////////////////////////////////////////////////////////////////        
        // Differential cross sections

        const double cos_theta[11] = {-1.0, -0.8, -0.6, -0.4, -0.2, 0.0,  
                                      0.2, 0.4, 0.6, 0.8, 1.0};
        ZFDsigmaQuarksLEP2* myZFDsigmaQuarks[11];
        ZFDsigmaMuLEP2* myZFDsigmaMu[11];
        ZFDsigmaTauLEP2* myZFDsigmaTau[11];
        cout << "sqrt{s} cos(theta) dsigma(q)/dcos_theta dsigma(mu)/dcos_theta dsigma(tau)/dcos_theta"
             << endl;
        for (int i=0; i<11; i++) {
            myZFDsigmaQuarks[i] = new ZFDsigmaQuarksLEP2(*ZF,200.0,cos_theta[i]);
            myZFDsigmaMu[i] = new ZFDsigmaMuLEP2(*ZF,200.0,cos_theta[i]);
            myZFDsigmaTau[i] = new ZFDsigmaTauLEP2(*ZF,200.0,cos_theta[i]);        
            cout << " 200.0  " << setw(6) <<  cos_theta[i]
                 << setw(20) << myZFDsigmaQuarks[i]->computeThValue() 
                 << setw(20) << myZFDsigmaMu[i]->computeThValue() 
                 << setw(20) << myZFDsigmaTau[i]->computeThValue()
                 << endl;
        }
        cout << endl;
        
        //////////////////////////////////////////////////////////////////////

        // LEP2 CM energies
        const double sqrt_s[12] = {130.0, 136.0, 161.0, 172.0, 183.0, 189.0, 
                                   192.0, 196.0, 200.0, 202.0, 205.0, 207.0};
        // LEP2 CM energies for heavy flavors
        const double sqrt_s_HF[10] = {133.0, 167.0, 183.0, 189.0, 192.0, 
                                      196.0, 200.0, 202.0, 205.0, 207.0};
        
        ZFsigmaQuarksLEP2* myZFsigmaQuarks[12];
        ZFsigmaMuLEP2* myZFsigmaMu[12];
        ZFsigmaTauLEP2* myZFsigmaTau[12];
        ZFAFBmuLEP2* myZFAFBmu[12];
        ZFAFBtauLEP2* myZFAFBtau[12];
        cout << "sqrt{s} sigma(q) sigma(mu) sigma(tau) A_FB(mu) A_FB(tau)"
             << endl;
        for (int i=0; i<12; i++) {
            myZFsigmaQuarks[i] = new ZFsigmaQuarksLEP2(*ZF,sqrt_s[i]);
            myZFsigmaMu[i] = new ZFsigmaMuLEP2(*ZF,sqrt_s[i]);
            myZFsigmaTau[i] = new ZFsigmaTauLEP2(*ZF,sqrt_s[i]);
            myZFAFBmu[i] = new ZFAFBmuLEP2(*ZF,sqrt_s[i]);
            myZFAFBtau[i] = new ZFAFBtauLEP2(*ZF,sqrt_s[i]);
            cout << setw(6) << sqrt_s[i]
                 << setw(10) << myZFsigmaQuarks[i]->computeThValue() 
                 << setw(10) << myZFsigmaMu[i]->computeThValue() 
                 << setw(10) << myZFsigmaTau[i]->computeThValue()
                 << setw(10) << myZFAFBmu[i]->computeThValue() 
                 << setw(10) << myZFAFBtau[i]->computeThValue()
                 << endl;
            //ZF->CutInfo();// TEST
        }
        cout << endl;

        //////////////////////////////////////////////////////////////////////
       
        const int INTF_NEW = 2;
        ZF->setFlag("INTF",INTF_NEW); // with ISR/FSR interference contribution
        cout << "Flag update: INTF=2" << endl << endl;
        
        ZFRbottomLEP2* myZFRbottom[10];
        ZFAFBbottomLEP2* myZFAFBbottom[10];
        ZFRcharmLEP2* myZFRcharm[10];
        ZFAFBcharmLEP2* myZFAFBcharm[10];        
        cout << "sqrt{s}    R_b     A_FB(b)     R_c     A_FB(c)" << endl;
        for (int i=0; i<10; i++) {
           myZFRbottom[i] = new ZFRbottomLEP2(*ZF,sqrt_s_HF[i]);
           myZFAFBbottom[i] = new ZFAFBbottomLEP2(*ZF,sqrt_s_HF[i]);
           myZFRcharm[i] = new ZFRcharmLEP2(*ZF,sqrt_s_HF[i]);
           myZFAFBcharm[i] = new ZFAFBcharmLEP2(*ZF,sqrt_s_HF[i]);
           cout << setw(6) << sqrt_s_HF[i]
                << setw(10) << myZFRbottom[i]->computeThValue() 
                << setw(10) << myZFAFBbottom[i]->computeThValue() 
                << setw(10) << myZFRcharm[i]->computeThValue() 
                << setw(10) << myZFAFBcharm[i]->computeThValue()
                << endl;
        }
        cout << endl;
        
        //////////////////////////////////////////////////////////////////////        
        cout << "Test finished" << endl;
        return EXIT_SUCCESS;
    } catch (const runtime_error& e) {
        cerr << e.what() << endl;
        return EXIT_FAILURE;
    }
}
Esempio n. 2
0
/* Test function */
void test_ZFitterClass(ZFitterWrapper& ZF) {

    /* Outputs */
    double XS[12];
    double DXS[12];
    double AFB[12];
    double TAUPOL;
    double TAUAFB;
    double XSPL[12];
    double XSMI[12];
    double C1U, C1D, C2U, C2D; 

    int indexFermion;

    /* sqrt(s) = Mz */
    double sqrt_s = ZF.getModel().getMz();
    
    /* print input parameters */
    cout << endl << "##### call ZFitter::printInputs() #####" << endl << endl;
    ZF.printInputs();
    //cout << "  Note: DAL5H is calculated in calcCommonBlocks(), "
    //     << "if ALEM=0 or 3. " << endl;

    cout << "##### Pseudo-observables #####" << endl << endl;
    printPO(ZF);
    cout << endl;

    /* print constants defined in ZFITTER */
    cout << endl << "##### call ZFitter::printConstants() #####" << endl << endl;
    ZF.printConstants();
    
    /* print intermediate results */
    cout << "##### call ZFitter::printIntermediateResults() #####"
              << endl << endl;
    ZF.printIntermediateResults();

    /* Atomic Parity Violation */
    cout << "##### call ZFitter::calcAPV() #####" << endl << endl;
    ZF.calcAPV(&C1U, &C1D, &C2U, &C2D);
    cout << "  C1U = " << C1U << " "
         << "  C1D = " << C1D << " "
         << "  C2U = " << C2U << " "
         << "  C2D = " << C2D << endl << endl;

    cout << "##### call ZFitter::calcXS_AFB() #####" << endl << endl;
    cout << "  sqrt(s) = " << sqrt_s << endl << endl;
    cout << "  Channel, Cross sections, FB asymmetries" << endl;
    for (indexFermion=0; indexFermion<11; indexFermion++) {
        ZF.calcXS_AFB(indexFermion, sqrt_s,
                      &XS[indexFermion], &AFB[indexFermion]);
        cout << setw(9) << ZF.convertINDF(indexFermion)
             << "  " << XS[indexFermion] << "  ";
        if (indexFermion!=0&&indexFermion!=10) cout << AFB[indexFermion];
        cout << endl;
    }
    cout << endl;

    cout << "##### call ZFitter::calcXS() #####" << endl << endl;
    cout << "  sqrt(s) = " << sqrt_s << endl << endl;
    cout << "  Channel, Cross sections" << endl;
    for (indexFermion=0; indexFermion<11; indexFermion++) {
        /* get the total and partial decay widths */
        double Gamma_Z = ZF.Gamma_Z();
        double Gamma_e = ZF.Gamma_f(1);
        double Gamma_f = Gamma_e;
        if (indexFermion!=11) Gamma_f = ZF.Gamma_f(indexFermion);
        ZF.calcXS(indexFermion, sqrt_s, Gamma_Z, Gamma_e, Gamma_f,
                  &XS[indexFermion]);
        cout << setw(9) << ZF.convertINDF(indexFermion)
             << "  " << XS[indexFermion]
             << endl;
    }
    cout << endl;

    cout << "##### call ZFitter::calcXS_AFB_2() #####" << endl << endl;
    cout << "  sqrt(s) = " << sqrt_s << endl << endl;
    cout << "  Channel, Cross sections, FB asymmetries" << endl;
    for (indexFermion=0; indexFermion<11; indexFermion++) {
        /* get the total width */
        double Gamma_Z = ZF.Gamma_Z();
        /* get the effective vector and axial-vector couplings */
        double GAE = sqrt(ZF.rhoZ_f(1).real())*0.5;
        double GVE = ZF.gZ_f(1).real()*GAE;
        double GVF, GAF;
        if (indexFermion<11) {
            GAF = sqrt(ZF.rhoZ_f(indexFermion).real())*0.5;
            GVF = ZF.gZ_f(indexFermion).real()*GAF;
        } else {
            GAF = GAE;
            GVF = ZF.gZ_f(1).real()*GAF;
        }
        cout << setw(9) << ZF.convertINDF(indexFermion) << "  ";
        if (indexFermion!=0&&indexFermion!=10) {
            ZF.calcXS_AFB_2(indexFermion, sqrt_s, Gamma_Z, 0,
                            GVE, GAE, GVF, GAF,
                            &XS[indexFermion], &AFB[indexFermion]);
            cout << XS[indexFermion] << "  " << AFB[indexFermion];
        }
        cout << endl;
    }
    cout << endl;

    cout << "##### call ZFitter::calcXS_AFB_3() #####" << endl << endl;
    cout << "  sqrt(s) = " << sqrt_s << endl << endl;
    cout << "  Channel, Cross sections, FB asymmetries" << endl;
    for (indexFermion=0; indexFermion<11; indexFermion++) {
        /* get the total width */
        double Gamma_Z = ZF.Gamma_Z();
        /* get the effective vector and axial-vector couplings */
        double GVF, GAF;
        if (indexFermion<11) {
            GAF = sqrt(ZF.rhoZ_f(indexFermion).real())*0.5;
            GVF = ZF.gZ_f(indexFermion).real()*GAF;
        } else {
            GAF = sqrt(ZF.rhoZ_f(1).real())*0.5;
            GVF = ZF.gZ_f(1).real()*GAF;
        }
        cout << setw(9) << ZF.convertINDF(indexFermion) << "  ";
        double GVF2 = GVF*GVF;
        double GAF2 = GAF*GAF;
        if (indexFermion==1||indexFermion==2||indexFermion==3||indexFermion==11) {
            ZF.calcXS_AFB_3(indexFermion, sqrt_s, Gamma_Z, 0, GVF2, GAF2,
                            &XS[indexFermion], &AFB[indexFermion]);
            cout << XS[indexFermion] << "  " << AFB[indexFermion];
        }
        cout << endl;
    }
    cout << endl;

   cout << "##### call ZFitter::calcXS_AFB_4() #####" << endl << endl;
    cout << "  sqrt(s) = " << sqrt_s << endl << endl;
    cout << "  Channel, Cross sections, FB asymmetries" << endl;
    for (indexFermion=0; indexFermion<11; indexFermion++) {
        /* get the total width */
        double Gamma_Z = ZF.Gamma_Z();
        /* get the effective vector and axial-vector couplings */
        double GAE = sqrt(ZF.rhoZ_f(1).real())*0.5;
        double GVE = ZF.gZ_f(1).real()*GAE;
        double GVF, GAF;
        if (indexFermion<11) {
            GAF = sqrt(ZF.rhoZ_f(indexFermion).real())*0.5;
            GVF = ZF.gZ_f(indexFermion).real()*GAF;
        } else {
            GAF = GAE;
            GVF = ZF.gZ_f(1).real()*GAF;
        }
        double PFOUR = GVE*GAE*GVF*GAF;
        double PVAE2 = GVE*GVE + GAE*GAE;
        double PVAF2 = GVF*GVF + GAF*GAF;
        cout << setw(9) << ZF.convertINDF(indexFermion) << "  ";
        if (indexFermion==1||indexFermion==2||indexFermion==3) {
            ZF.calcXS_AFB_4(indexFermion, sqrt_s, Gamma_Z, PFOUR, PVAE2, PVAF2,
                            &XS[indexFermion], &AFB[indexFermion]);
            cout << XS[indexFermion] << "  " << AFB[indexFermion];
        }
        cout << endl;
    }
    cout << endl;

    cout << "##### call ZFitter::calcTauPol() #####" << endl
              << endl;
    cout << "  sqrt(s) = " << sqrt_s << endl << endl;
    cout << "  Channel, Tau polarization, Tau polarization asymmetry"
              << endl;
    ZF.calcTauPol(sqrt_s, &TAUPOL, &TAUAFB);
    cout << setw(9) << ZF.convertINDF(3) << "  "
              << TAUPOL << "  " << TAUAFB << endl
              << endl;

    cout << "##### call ZFitter::calcTauPol_2() #####" << endl
              << endl;
    cout << "  sqrt(s) = " << sqrt_s << endl << endl;
    cout << "  Channel, Tau polarization, Tau polarization asymmetry"
              << endl;
    /* get the total width */
    double Gamma_Z = ZF.Gamma_Z();
    /* get the effective vector and axial-vector couplings */
    double GAE = sqrt(ZF.rhoZ_f(1).real())*0.5;
    double GVE = ZF.gZ_f(1).real() * GAE;
    double GAF = sqrt(ZF.rhoZ_f(3).real())*0.5;
    double GVF = ZF.gZ_f(3).real() * GAF;
    ZF.calcTauPol_2(sqrt_s, Gamma_Z, 0, GVE, GAE, GVF, GAF, &TAUPOL, &TAUAFB);
    cout << setw(9) << ZF.convertINDF(3) << "  "
              << TAUPOL << "  " << TAUAFB << endl
              << endl;

    cout << "##### call ZFitter::calcALR() #####" << endl << endl;
    cout << "  sqrt(s) = " << sqrt_s << endl << endl;
    cout << "  Channel, Left-right asymmetries " << endl;
    double POL = 0.63;
    double ALRI;
    for (indexFermion=0; indexFermion<10; indexFermion++) {
        ZF.calcALR(indexFermion, sqrt_s, POL,
                   &XSPL[indexFermion], &XSMI[indexFermion]);
        ALRI = (XSMI[indexFermion] - XSPL[indexFermion])
                / (XSMI[indexFermion] + XSPL[indexFermion]) / POL;
        cout << setw(9) << ZF.convertINDF(indexFermion) << "  ";
        if (indexFermion!=8) cout << ALRI;
        cout << endl;
    }
    cout << endl;

    cout << "##### call ZFitter::calcDXS() "
              << "with the flag ISPP=2 #####" << endl << endl;
    ZF.setFlag("ISPP", 2); // default: 2
    cout << "  sqrt(s) = " << sqrt_s << endl << endl;
    cout << "  Channel, Differential cross sections" << endl;
    for (indexFermion = 0; indexFermion < 11; indexFermion++) {
        cout << setw(9) << ZF.convertINDF(indexFermion) << "  ";
        for (int i=0; i<=6; i++) {
            double CSA = -1.0 + 2.0/6.0*(double)i; // cos(theta)
            ZF.calcDXS(indexFermion, sqrt_s, CSA, &DXS[indexFermion]);
            cout << setw(9) << DXS[indexFermion] << "  ";
        }
        cout << endl;
    }
    cout << endl;
    
    /* Outputs from ZFITTER subroutines (for tests) */
    //
    //cout << "##### call ZFitter::info(0) #####"
    //          << endl << endl;
    //cout << " ------------- Flag info ---------------" << endl;
    //ZF.FlagInfo(); // output flag info
    //
    //cout << endl << "##### call ZFitter::info(1) #####"
    //          << endl << endl;
    //cout << " ------------------------ Cut info --------------------------";
    //ZF.CutInfo(); // print cut info

}