const String AudioProcessor::getOutputChannelName (int index) const  { return getChannelName (busArrangement.outputBuses, index); }
Example #2
0
 virtual string getRequesterName()
 {
     return getChannelName();
 }
Example #3
0
 virtual std::string getRemoteAddress()
 {
     // local
     return getChannelName();
 }
Example #4
0
void makeDatacard(double mh, double massLow, double massHigh, double merrHigh, int ch, std::string cat, std::map<std::string, std::string> file, bool useModZ, bool doMassErr) {

    RooMsgService::instance().setSilentMode(kTRUE);
    RooMsgService::instance().setGlobalKillBelow(RooFit::WARNING) ;

    if (doMassErr && cat != "BB" && cat != "XX" && cat != "YY") {
        std::cout << "When using event-by-event mass errors, set cat = BB or XX or YY" << std::endl; 
        return;
    }

    /* Setting up the strings */
    std::string chstr = getChannelName(ch);

    stringstream mh_ss;
    mh_ss << mh;
    
    std::cout << "Creating datacard for " << mh_ss.str() << " GeV mass point, channel " << chstr << " and category " << cat << " ... " << std::endl;
   
    std::stringstream card_name_ss;
    card_name_ss << "card_";
    if      (!doMassErr) card_name_ss << "1D_";
    else                 card_name_ss << "2D_merr_";
    card_name_ss << "m" << mh_ss.str() << "_";
    card_name_ss << chstr << "_" << cat;
    std::string card_name = card_name_ss.str();

    std::string workspace = card_name+"_workspace.root";

    /* Higgs mass and dimuon mass variables */

    const char* massvarstr  = "CMS_hmumu_mass";
    const char* merrvarstr  = "CMS_hmumu_merr";
    const char* scalevarstr = "CMS_hmumu_scale";
    const char* resvarstr   = "CMS_hmumu_res";
    const char* mhvarstr    = "MH";

    RooRealVar rmh  ("MH"       , "MH"         , mh);
    RooRealVar m2mu (massvarstr , "Dimuon mass", mh  , massLow, massHigh, "GeV/c^{2}");
    RooRealVar merr (merrvarstr , "Mass Error" , 0.0 , 0.0    , merrHigh, ""         );
    RooRealVar scale(scalevarstr, "Scale unc. ", 0.0 , 0.0    , 1.0     , "GeV/c^{2}");
    RooRealVar res  (resvarstr  , "RFes. unc. ", 0.0 , 0.0    , 1.0);
    m2mu.setBins(200);   
    merr.setBins(200);   

    /* RooDataSet of the observed data */

    RooDataSet* data_obs = getDataSet(file["dat"].c_str(), false, ch, cat, massLow, massHigh, merrHigh, "data_obs", massvarstr, merrvarstr, false);
    
    /* Extract shape parameters */

    std::cout << "Extracting the signal fit parameters" << std::endl;
    std::map<std::string, double> sparams = doFit(file["ggH"],  true,   6, cat, 125.0, int(massHigh-massLow)*2, massLow,    140.0, false,  true, useModZ, false);
    std::cout << "Extracting the background fit parameters" << std::endl;
    std::map<std::string, double> bparams = doFit(file["dat"], false,  ch, cat, 125.0, int(massHigh-massLow) , massLow, massHigh, false, false, useModZ, true );

    std::string ecat = "XX";
    if (cat == "BB") ecat = "BB";
    if (cat == "YY") ecat = "YY";

    std::map<std::string, double> esparams;
    std::map<std::string, double> ebparams;
    if (doMassErr) {
        if (cat == "BB") {
            std::cout << "Extracting the signal mass error fit parameters" << std::endl;
            esparams = doEbEFit(file["ggH"], true, ch, ecat, 140, 0.006, 0.013, massLow, massHigh,  true,  true,  true);
            std::cout << "Extracting the background mass error fit parameters" << std::endl;
            ebparams = doEbEFit(file["DY"] , true, ch, ecat, 140, 0.006, 0.013, massLow, massHigh,  true,  true, false);
        }
        else {
            std::cout << "Extracting the signal mass error fit parameters" << std::endl;
            esparams = doEbEFit(file["ggH"], true, ch, ecat, 240, 0.005, 0.035, massLow, massHigh,  true,  true,  true);
            std::cout << "Extracting the background mass error fit parameters" << std::endl;
            ebparams = doEbEFit(file["DY"] , true, ch, ecat, 240, 0.005, 0.035, massLow, massHigh,  true,  true, false);
        }
    }

    /* Compute yields */

    double bkg_yield = computeYield(data_obs, massvarstr, false,  true);
    bkg_yield *= bparams["bkgsf"];
    std::cout << "Computing the expected background yield from the side-bands : " << bkg_yield << std::endl;

    RooDataSet* sig_gH_dset = getDataSet(file["ggH"], true, ch, cat, massLow, massHigh, merrHigh, "dset_gH", massvarstr, merrvarstr, false);
    RooDataSet* sig_qH_dset = getDataSet(file["qqH"], true, ch, cat, massLow, massHigh, merrHigh, "dset_qH", massvarstr, merrvarstr, false);
    RooDataSet* sig_PH_dset = getDataSet(file["WPH"], true, ch, cat, massLow, massHigh, merrHigh, "dset_PH", massvarstr, merrvarstr, false);
    RooDataSet* sig_MH_dset = getDataSet(file["WMH"], true, ch, cat, massLow, massHigh, merrHigh, "dset_MH", massvarstr, merrvarstr, false);
    RooDataSet* sig_ZH_dset = getDataSet(file["ZH" ], true, ch, cat, massLow, massHigh, merrHigh, "dset_ZH", massvarstr, merrvarstr, false);

    double sig_gH_yield  = computeYield(sig_gH_dset, massvarstr,  true, false);
    double sig_qH_yield  = computeYield(sig_qH_dset, massvarstr,  true, false);
    double sig_WH_yield  = computeYield(sig_PH_dset, massvarstr,  true, false);
           sig_WH_yield += computeYield(sig_MH_dset, massvarstr,  true, false);
    double sig_ZH_yield  = computeYield(sig_ZH_dset, massvarstr,  true, false);
    double sig_tH_yield  = 1e-5;

    delete sig_gH_dset;
    delete sig_qH_dset;
    delete sig_PH_dset;
    delete sig_MH_dset;
    delete sig_ZH_dset;

    std::cout << "Computing the ggH signal yield : " << sig_gH_yield << std::endl;
    std::cout << "Computing the qqH signal yield : " << sig_qH_yield << std::endl;
    std::cout << "Computing the  WH signal yield : " << sig_WH_yield << std::endl;
    std::cout << "Computing the  ZH signal yield : " << sig_ZH_yield << std::endl;
    std::cout << "Computing the ttH signal yield : " << sig_tH_yield << std::endl;

    std::string spdfstart = "";
    std::string bpdfstart = "";

    if   (doMassErr) spdfstart = "sig_mass_merr_";
    else             spdfstart = "sig_mass_";
    if   (doMassErr) bpdfstart = "bkg_mass_merr_";
    else             bpdfstart = "bkg_mass_";

    RooRealVar ggH_norm((spdfstart+"ggH_"+chstr+"_"+cat+"_pdf_norm").c_str(), "", sig_gH_yield);
    RooRealVar qqH_norm((spdfstart+"qqH_"+chstr+"_"+cat+"_pdf_norm").c_str(), "", sig_qH_yield);
    RooRealVar WH_norm ((spdfstart+"WH_" +chstr+"_"+cat+"_pdf_norm").c_str(), "", sig_WH_yield);
    RooRealVar ZH_norm ((spdfstart+"ZH_" +chstr+"_"+cat+"_pdf_norm").c_str(), "", sig_ZH_yield);
    RooRealVar ttH_norm((spdfstart+"ttH_"+chstr+"_"+cat+"_pdf_norm").c_str(), "", sig_tH_yield);
    RooRealVar bkg_norm((bpdfstart+""    +chstr+"_"+cat+"_pdf_norm").c_str(), "", bkg_yield   );

    ggH_norm.setConstant(kTRUE);
    WH_norm .setConstant(kTRUE);
    ZH_norm .setConstant(kTRUE);
    ggH_norm.setConstant(kTRUE);
    ttH_norm.setConstant(kTRUE);
    bkg_norm.setConstant(kTRUE);

    /* Define PDFs */

    // Background
    RooRealVar ra_mass(("bkg_mass_"+chstr+cat+"_a" ).c_str(), "", bparams["a"],  0.0, 1.0 );
    RooRealVar rb_mass(("bkg_mass_"+chstr+cat+"_b" ).c_str(), "", bparams["b"], -1.0, 10.0);

    RooRealVar rp_mass(("bkg_mass_"+chstr+cat+"_p" ).c_str(), "", bparams["p"], -2.0, 2.0 );
    RooRealVar rq_mass(("bkg_mass_"+chstr+cat+"_q" ).c_str(), "", bparams["q"], -2.0, 2.0 );
    RooRealVar rr_mass(("bkg_mass_"+chstr+cat+"_r" ).c_str(), "", bparams["r"], -2.0, 2.0 );

    RooAbsPdf* bkg_mass_pdf = NULL;
    if (useModZ) {
        RooModZPdf*    bkg_mass_mz_pdf = new RooModZPdf   (("bkg_mass_"+chstr+"_"+cat+"_pdf" ).c_str(), "", m2mu, rp_mass, rq_mass, rr_mass);
        bkg_mass_pdf = bkg_mass_mz_pdf;
    }
    else {
        RooZPhotonPdf* bkg_mass_zg_pdf = new RooZPhotonPdf(("bkg_mass_"+chstr+"_"+cat+"_pdf" ).c_str(), "", m2mu, ra_mass, rb_mass);
        bkg_mass_pdf = bkg_mass_zg_pdf;
    }
   
    // Signal
    std::stringstream meanss;
    std::stringstream sigmass;
    meanss  << "@0 - " << sparams["mean"]  << " + " << "@0*@1";
    if (!doMassErr) sigmass << sparams["sigma"]   << " * " << "(1+@0)";
    else            sigmass << "(@0*@1)" << " * " << "(1+@2)";

    RooArgList sigmalist;
    if (!doMassErr) sigmalist.add(res);
    else {
        sigmalist.add(merr);
        sigmalist.add(m2mu);
        sigmalist.add(res);
    }

    RooFormulaVar fmean_mass (("sig_mass_"+chstr+"_"+cat+"_fmean" ).c_str(), "", meanss .str().c_str(), RooArgList(rmh, scale));
    RooFormulaVar fsigma_mass(("sig_mass_"+chstr+"_"+cat+"_fsigma").c_str(), "", sigmass.str().c_str(), sigmalist);
    RooRealVar    raL_mass   (("sig_mass_"+chstr+"_"+cat+"_aL"    ).c_str(), "", sparams["aL"]);
    RooRealVar    rnL_mass   (("sig_mass_"+chstr+"_"+cat+"_nL"    ).c_str(), "", sparams["nL"]);
    RooRealVar    raR_mass   (("sig_mass_"+chstr+"_"+cat+"_aR"    ).c_str(), "", sparams["aR"]);
    RooRealVar    rnR_mass   (("sig_mass_"+chstr+"_"+cat+"_nR"    ).c_str(), "", sparams["nR"]);

    RooDoubleCB sig_mass_gH_pdf(("sig_mass_ggH_"+chstr+"_"+cat+"_pdf" ).c_str(), "", m2mu, fmean_mass, fsigma_mass, raL_mass, rnL_mass, raR_mass, rnR_mass);
    RooDoubleCB sig_mass_qH_pdf(("sig_mass_qqH_"+chstr+"_"+cat+"_pdf" ).c_str(), "", m2mu, fmean_mass, fsigma_mass, raL_mass, rnL_mass, raR_mass, rnR_mass);
    RooDoubleCB sig_mass_WH_pdf(("sig_mass_WH_" +chstr+"_"+cat+"_pdf" ).c_str(), "", m2mu, fmean_mass, fsigma_mass, raL_mass, rnL_mass, raR_mass, rnR_mass);
    RooDoubleCB sig_mass_ZH_pdf(("sig_mass_ZH_" +chstr+"_"+cat+"_pdf" ).c_str(), "", m2mu, fmean_mass, fsigma_mass, raL_mass, rnL_mass, raR_mass, rnR_mass);
    RooDoubleCB sig_mass_tH_pdf(("sig_mass_ttH_"+chstr+"_"+cat+"_pdf" ).c_str(), "", m2mu, fmean_mass, fsigma_mass, raL_mass, rnL_mass, raR_mass, rnR_mass);

    // Event-by-event mass error

    RooRealVar rm1_merr_sig (("sig_merr_"+chstr+"_"+cat+"_m1" ).c_str(), "", esparams["m1"] );
    RooRealVar rs1_merr_sig (("sig_merr_"+chstr+"_"+cat+"_s1" ).c_str(), "", esparams["s1"] );
    RooRealVar raL1_merr_sig(("sig_merr_"+chstr+"_"+cat+"_aL1").c_str(), "", esparams["aL1"]);
    RooRealVar rnL1_merr_sig(("sig_merr_"+chstr+"_"+cat+"_nL1").c_str(), "", esparams["nL1"]);
    RooRealVar raR1_merr_sig(("sig_merr_"+chstr+"_"+cat+"_aR1").c_str(), "", esparams["aR1"]);
    RooRealVar rnR1_merr_sig(("sig_merr_"+chstr+"_"+cat+"_nR1").c_str(), "", esparams["nR1"]);

    RooRealVar rm2_merr_sig (("sig_merr_"+chstr+"_"+cat+"_m2" ).c_str(), "", esparams["m2"] );
    RooRealVar rs2_merr_sig (("sig_merr_"+chstr+"_"+cat+"_s2" ).c_str(), "", esparams["s2"] );
    RooRealVar raL2_merr_sig(("sig_merr_"+chstr+"_"+cat+"_aL2").c_str(), "", esparams["aL2"]);
    RooRealVar rnL2_merr_sig(("sig_merr_"+chstr+"_"+cat+"_nL2").c_str(), "", esparams["nL2"]);
    RooRealVar raR2_merr_sig(("sig_merr_"+chstr+"_"+cat+"_aR2").c_str(), "", esparams["aR2"]);
    RooRealVar rnR2_merr_sig(("sig_merr_"+chstr+"_"+cat+"_nR2").c_str(), "", esparams["nR2"]);

    RooRealVar rm3_merr_sig (("sig_merr_"+chstr+"_"+cat+"_m3" ).c_str(), "", esparams["m3"] );
    RooRealVar rs3_merr_sig (("sig_merr_"+chstr+"_"+cat+"_s3" ).c_str(), "", esparams["s3"] );

    RooRealVar rc0_merr_sig (("sig_merr_"+chstr+"_"+cat+"_c0" ).c_str(), "", esparams["c0"] );
    RooRealVar rc1_merr_sig (("sig_merr_"+chstr+"_"+cat+"_c1" ).c_str(), "", esparams["c1"] );
    RooRealVar rc2_merr_sig (("sig_merr_"+chstr+"_"+cat+"_c2" ).c_str(), "", esparams["c2"] );

    RooRealVar rm1_merr_bkg (("bkg_merr_"+chstr+"_"+cat+"_m1" ).c_str(), "", ebparams["m1"] );
    RooRealVar rs1_merr_bkg (("bkg_merr_"+chstr+"_"+cat+"_s1" ).c_str(), "", ebparams["s1"] );
    RooRealVar raL1_merr_bkg(("bkg_merr_"+chstr+"_"+cat+"_aL1").c_str(), "", ebparams["aL1"]);
    RooRealVar rnL1_merr_bkg(("bkg_merr_"+chstr+"_"+cat+"_nL1").c_str(), "", ebparams["nL1"]);
    RooRealVar raR1_merr_bkg(("bkg_merr_"+chstr+"_"+cat+"_aR1").c_str(), "", ebparams["aR1"]);
    RooRealVar rnR1_merr_bkg(("bkg_merr_"+chstr+"_"+cat+"_nR1").c_str(), "", ebparams["nR1"]);

    RooRealVar rm2_merr_bkg (("bkg_merr_"+chstr+"_"+cat+"_m2" ).c_str(), "", ebparams["m2"] );
    RooRealVar rs2_merr_bkg (("bkg_merr_"+chstr+"_"+cat+"_s2" ).c_str(), "", ebparams["s2"] );
    RooRealVar raL2_merr_bkg(("bkg_merr_"+chstr+"_"+cat+"_aL2").c_str(), "", ebparams["aL2"]);
    RooRealVar rnL2_merr_bkg(("bkg_merr_"+chstr+"_"+cat+"_nL2").c_str(), "", ebparams["nL2"]);
    RooRealVar raR2_merr_bkg(("bkg_merr_"+chstr+"_"+cat+"_aR2").c_str(), "", ebparams["aR2"]);
    RooRealVar rnR2_merr_bkg(("bkg_merr_"+chstr+"_"+cat+"_nR2").c_str(), "", ebparams["nR2"]);

    RooRealVar rm3_merr_bkg (("bkg_merr_"+chstr+"_"+cat+"_m3" ).c_str(), "", ebparams["m3"] );
    RooRealVar rs3_merr_bkg (("bkg_merr_"+chstr+"_"+cat+"_s3" ).c_str(), "", ebparams["s3"] );

    RooRealVar rc0_merr_bkg (("bkg_merr_"+chstr+"_"+cat+"_c0" ).c_str(), "", ebparams["c0"] );
    RooRealVar rc1_merr_bkg (("bkg_merr_"+chstr+"_"+cat+"_c1" ).c_str(), "", ebparams["c1"] );
    RooRealVar rc2_merr_bkg (("bkg_merr_"+chstr+"_"+cat+"_c2" ).c_str(), "", ebparams["c2"] );

    RooDoubleCB   sig_merr_gH_pd1(("sig_merr_ggH_"+chstr+"_"+cat+"_pd1" ).c_str(), "", merr, rm1_merr_sig, rs1_merr_sig, raL1_merr_sig, rnL1_merr_sig, raR1_merr_sig, rnR1_merr_sig);
    RooDoubleCB   sig_merr_qH_pd1(("sig_merr_qqH_"+chstr+"_"+cat+"_pd1" ).c_str(), "", merr, rm1_merr_sig, rs1_merr_sig, raL1_merr_sig, rnL1_merr_sig, raR1_merr_sig, rnR1_merr_sig);
    RooDoubleCB   sig_merr_WH_pd1(("sig_merr_WH_" +chstr+"_"+cat+"_pd1" ).c_str(), "", merr, rm1_merr_sig, rs1_merr_sig, raL1_merr_sig, rnL1_merr_sig, raR1_merr_sig, rnR1_merr_sig);
    RooDoubleCB   sig_merr_ZH_pd1(("sig_merr_ZH_" +chstr+"_"+cat+"_pd1" ).c_str(), "", merr, rm1_merr_sig, rs1_merr_sig, raL1_merr_sig, rnL1_merr_sig, raR1_merr_sig, rnR1_merr_sig);
    RooDoubleCB   sig_merr_tH_pd1(("sig_merr_ttH_"+chstr+"_"+cat+"_pd1" ).c_str(), "", merr, rm1_merr_sig, rs1_merr_sig, raL1_merr_sig, rnL1_merr_sig, raR1_merr_sig, rnR1_merr_sig);

    RooDoubleCB   sig_merr_gH_pd2(("sig_merr_ggH_"+chstr+"_"+cat+"_pd2" ).c_str(), "", merr, rm2_merr_sig, rs2_merr_sig, raL2_merr_sig, rnL2_merr_sig, raR2_merr_sig, rnR2_merr_sig);
    RooDoubleCB   sig_merr_qH_pd2(("sig_merr_qqH_"+chstr+"_"+cat+"_pd2" ).c_str(), "", merr, rm2_merr_sig, rs2_merr_sig, raL2_merr_sig, rnL2_merr_sig, raR2_merr_sig, rnR2_merr_sig);
    RooDoubleCB   sig_merr_WH_pd2(("sig_merr_WH_" +chstr+"_"+cat+"_pd2" ).c_str(), "", merr, rm2_merr_sig, rs2_merr_sig, raL2_merr_sig, rnL2_merr_sig, raR2_merr_sig, rnR2_merr_sig);
    RooDoubleCB   sig_merr_ZH_pd2(("sig_merr_ZH_" +chstr+"_"+cat+"_pd2" ).c_str(), "", merr, rm2_merr_sig, rs2_merr_sig, raL2_merr_sig, rnL2_merr_sig, raR2_merr_sig, rnR2_merr_sig);
    RooDoubleCB   sig_merr_tH_pd2(("sig_merr_ttH_"+chstr+"_"+cat+"_pd2" ).c_str(), "", merr, rm2_merr_sig, rs2_merr_sig, raL2_merr_sig, rnL2_merr_sig, raR2_merr_sig, rnR2_merr_sig);

    RooGaussian   sig_merr_gH_pd3(("sig_merr_ggH_"+chstr+"_"+cat+"_pd3" ).c_str(), "", merr, rm3_merr_sig, rs3_merr_sig);
    RooGaussian   sig_merr_qH_pd3(("sig_merr_qqH_"+chstr+"_"+cat+"_pd3" ).c_str(), "", merr, rm3_merr_sig, rs3_merr_sig);
    RooGaussian   sig_merr_WH_pd3(("sig_merr_WH_" +chstr+"_"+cat+"_pd3" ).c_str(), "", merr, rm3_merr_sig, rs3_merr_sig);
    RooGaussian   sig_merr_ZH_pd3(("sig_merr_ZH_" +chstr+"_"+cat+"_pd3" ).c_str(), "", merr, rm3_merr_sig, rs3_merr_sig);
    RooGaussian   sig_merr_tH_pd3(("sig_merr_ttH_"+chstr+"_"+cat+"_pd3" ).c_str(), "", merr, rm3_merr_sig, rs3_merr_sig);

    RooAddPdf     sig_merr_gH_pda(("sig_merr_ggH_"+chstr+"_"+cat+"_pda" ).c_str(), "", RooArgList(sig_merr_gH_pd1, sig_merr_gH_pd2, sig_merr_gH_pd3), RooArgList(rc1_merr_sig, rc2_merr_sig));
    RooAddPdf     sig_merr_qH_pda(("sig_merr_qqH_"+chstr+"_"+cat+"_pda" ).c_str(), "", RooArgList(sig_merr_qH_pd1, sig_merr_qH_pd2, sig_merr_qH_pd3), RooArgList(rc1_merr_sig, rc2_merr_sig));
    RooAddPdf     sig_merr_WH_pda(("sig_merr_WH_" +chstr+"_"+cat+"_pda" ).c_str(), "", RooArgList(sig_merr_WH_pd1, sig_merr_WH_pd2, sig_merr_WH_pd3), RooArgList(rc1_merr_sig, rc2_merr_sig));
    RooAddPdf     sig_merr_ZH_pda(("sig_merr_ZH_" +chstr+"_"+cat+"_pda" ).c_str(), "", RooArgList(sig_merr_ZH_pd1, sig_merr_ZH_pd2, sig_merr_ZH_pd3), RooArgList(rc1_merr_sig, rc2_merr_sig));
    RooAddPdf     sig_merr_tH_pda(("sig_merr_ttH_"+chstr+"_"+cat+"_pda" ).c_str(), "", RooArgList(sig_merr_tH_pd1, sig_merr_tH_pd2, sig_merr_tH_pd3), RooArgList(rc1_merr_sig, rc2_merr_sig));

    RooAddPdf     sig_merr_gH_pdb(("sig_merr_ggH_"+chstr+"_"+cat+"_pdb" ).c_str(), "", RooArgList(                 sig_merr_gH_pd2, sig_merr_gH_pd3), RooArgList(rc0_merr_sig              ));
    RooAddPdf     sig_merr_qH_pdb(("sig_merr_qqH_"+chstr+"_"+cat+"_pdb" ).c_str(), "", RooArgList(                 sig_merr_gH_pd2, sig_merr_gH_pd3), RooArgList(rc0_merr_sig              ));
    RooAddPdf     sig_merr_WH_pdb(("sig_merr_WH_" +chstr+"_"+cat+"_pdb" ).c_str(), "", RooArgList(                 sig_merr_gH_pd2, sig_merr_gH_pd3), RooArgList(rc0_merr_sig              ));
    RooAddPdf     sig_merr_ZH_pdb(("sig_merr_ZH_" +chstr+"_"+cat+"_pdb" ).c_str(), "", RooArgList(                 sig_merr_gH_pd2, sig_merr_gH_pd3), RooArgList(rc0_merr_sig              ));
    RooAddPdf     sig_merr_tH_pdb(("sig_merr_ttH_"+chstr+"_"+cat+"_pdb" ).c_str(), "", RooArgList(                 sig_merr_gH_pd2, sig_merr_gH_pd3), RooArgList(rc0_merr_sig              ));

    RooDoubleCB   bkg_merr_pd1   (("bkg_merr_"    +chstr+"_"+cat+"_pd1" ).c_str(), "", merr, rm1_merr_bkg, rs1_merr_bkg, raL1_merr_bkg, rnL1_merr_bkg, raR1_merr_bkg, rnR1_merr_bkg);
    RooDoubleCB   bkg_merr_pd2   (("bkg_merr_"    +chstr+"_"+cat+"_pd2" ).c_str(), "", merr, rm2_merr_bkg, rs2_merr_bkg, raL2_merr_bkg, rnL2_merr_bkg, raR2_merr_bkg, rnR2_merr_bkg);
    RooGaussian   bkg_merr_pd3   (("bkg_merr_"    +chstr+"_"+cat+"_pd3" ).c_str(), "", merr, rm3_merr_bkg, rs3_merr_bkg);
    RooAddPdf     bkg_merr_pda   (("bkg_merr_"    +chstr+"_"+cat+"_pda" ).c_str(), "", RooArgList(bkg_merr_pd1, bkg_merr_pd2, bkg_merr_pd3), RooArgList(rc1_merr_bkg, rc2_merr_bkg));
    RooAddPdf     bkg_merr_pdb   (("bkg_merr_"    +chstr+"_"+cat+"_pdb" ).c_str(), "", RooArgList(              bkg_merr_pd2, bkg_merr_pd3), RooArgList(rc0_merr_bkg              ));

    RooAbsPdf* sig_merr_gH_abspdf;
    RooAbsPdf* sig_merr_qH_abspdf;
    RooAbsPdf* sig_merr_WH_abspdf;
    RooAbsPdf* sig_merr_ZH_abspdf;
    RooAbsPdf* sig_merr_tH_abspdf;
    RooAbsPdf* bkg_merr_abspdf;

    if      (cat == "BB") {
        sig_merr_gH_abspdf = &sig_merr_gH_pd1;
        sig_merr_qH_abspdf = &sig_merr_qH_pd1;
        sig_merr_WH_abspdf = &sig_merr_WH_pd1;
        sig_merr_ZH_abspdf = &sig_merr_ZH_pd1;
        sig_merr_tH_abspdf = &sig_merr_tH_pd1;
        bkg_merr_abspdf    = &bkg_merr_pd1;
    }
    else if (cat == "XX") {
        sig_merr_gH_abspdf = &sig_merr_gH_pda;
        sig_merr_qH_abspdf = &sig_merr_qH_pda;
        sig_merr_WH_abspdf = &sig_merr_WH_pda;
        sig_merr_ZH_abspdf = &sig_merr_ZH_pda;
        sig_merr_tH_abspdf = &sig_merr_tH_pda;
        bkg_merr_abspdf    = &bkg_merr_pda;
    }
    else {
        sig_merr_gH_abspdf = &sig_merr_gH_pdb;
        sig_merr_qH_abspdf = &sig_merr_qH_pdb;
        sig_merr_WH_abspdf = &sig_merr_WH_pdb;
        sig_merr_ZH_abspdf = &sig_merr_ZH_pdb;
        sig_merr_tH_abspdf = &sig_merr_tH_pdb;
        bkg_merr_abspdf    = &bkg_merr_pdb;
    }

    RooProdPdf sig_mass_merr_gH_pdf(("sig_mass_merr_ggH_"+chstr+"_"+cat+"_pdf" ).c_str(),  "", *sig_merr_gH_abspdf, RooFit::Conditional(sig_mass_gH_pdf , RooArgSet(m2mu)));
    RooProdPdf sig_mass_merr_qH_pdf(("sig_mass_merr_qqH_"+chstr+"_"+cat+"_pdf" ).c_str(),  "", *sig_merr_qH_abspdf, RooFit::Conditional(sig_mass_qH_pdf , RooArgSet(m2mu)));
    RooProdPdf sig_mass_merr_WH_pdf(("sig_mass_merr_WH_" +chstr+"_"+cat+"_pdf" ).c_str(),  "", *sig_merr_WH_abspdf, RooFit::Conditional(sig_mass_WH_pdf , RooArgSet(m2mu)));
    RooProdPdf sig_mass_merr_ZH_pdf(("sig_mass_merr_ZH_" +chstr+"_"+cat+"_pdf" ).c_str(),  "", *sig_merr_ZH_abspdf, RooFit::Conditional(sig_mass_ZH_pdf , RooArgSet(m2mu)));
    RooProdPdf sig_mass_merr_tH_pdf(("sig_mass_merr_ttH_"+chstr+"_"+cat+"_pdf" ).c_str(),  "", *sig_merr_tH_abspdf, RooFit::Conditional(sig_mass_tH_pdf , RooArgSet(m2mu)));

    RooProdPdf bkg_mass_merr_pdf   (("bkg_mass_merr_"    +chstr+"_"+cat+"_pdf" ).c_str(),  "", *bkg_mass_pdf      , *bkg_merr_abspdf);

    /* Creating the workspace the workspace */
    
    RooWorkspace w("w", "");

    w.import(*data_obs);
    w.import(ggH_norm);
    w.import(qqH_norm);
    w.import(WH_norm);
    w.import(ZH_norm);
    w.import(ttH_norm);
    w.import(bkg_norm);

    if (doMassErr) {        
    w.import(sig_mass_merr_gH_pdf, RooFit::RecycleConflictNodes());
    w.import(sig_mass_merr_qH_pdf, RooFit::RecycleConflictNodes());
    w.import(sig_mass_merr_WH_pdf, RooFit::RecycleConflictNodes());
    w.import(sig_mass_merr_ZH_pdf, RooFit::RecycleConflictNodes());
    w.import(sig_mass_merr_tH_pdf, RooFit::RecycleConflictNodes());
    w.import(bkg_mass_merr_pdf   , RooFit::RecycleConflictNodes());
    RooDataSet* data_pseudo = bkg_mass_merr_pdf.generate(RooArgSet(m2mu, merr), int(bkg_norm.getVal()));
    data_pseudo->SetName("data_pseudo");
    w.import(*data_pseudo);
    }
    else {
    w.import(sig_mass_gH_pdf, RooFit::RecycleConflictNodes());
    w.import(sig_mass_qH_pdf, RooFit::RecycleConflictNodes());
    w.import(sig_mass_WH_pdf, RooFit::RecycleConflictNodes());
    w.import(sig_mass_ZH_pdf, RooFit::RecycleConflictNodes());
    w.import(sig_mass_tH_pdf, RooFit::RecycleConflictNodes());
    w.import(*bkg_mass_pdf  , RooFit::RecycleConflictNodes());
    RooDataSet* data_pseudo = bkg_mass_pdf->generate(RooArgSet(m2mu), int(bkg_norm.getVal()));
    data_pseudo->SetName("data_pseudo");
    w.import(*data_pseudo);
    }
    w.writeToFile(workspace.c_str());

    /* Create the data card text file */

    std::string card = createCardTemplate(mh, ch, cat, workspace, doMassErr);
    std::ofstream ofile;
    ofile.open ((card_name +".txt").c_str());
    ofile << card;
    ofile.close();

    if (bkg_mass_pdf != NULL) delete bkg_mass_pdf;
    delete data_obs;
}
Example #5
0
void QuteWidget::createPropertiesDialog()
{
//	qDebug() << "QuteWidget::createPropertiesDialog()---Dynamic Properties:\n" << dynamicPropertyNames ();
	dialog = new QDialog(this);
	dialog->resize(300, 300);
	//  dialog->setModal(true);
	layout = new QGridLayout(dialog);
	QLabel *label = new QLabel(dialog);
	label->setText("X =");
	layout->addWidget(label, 0, 0, Qt::AlignRight|Qt::AlignVCenter);
	xSpinBox = new QSpinBox(dialog);
	xSpinBox->setMaximum(9999);
	layout->addWidget(xSpinBox, 0, 1, Qt::AlignLeft|Qt::AlignVCenter);
	label = new QLabel(dialog);
	label->setText("Y =");
	layout->addWidget(label, 0, 2, Qt::AlignRight|Qt::AlignVCenter);
	ySpinBox = new QSpinBox(dialog);
	ySpinBox->setMaximum(9999);
	layout->addWidget(ySpinBox, 0, 3, Qt::AlignLeft|Qt::AlignVCenter);
	label = new QLabel(dialog);
	label->setText(tr("Width ="));
	layout->addWidget(label, 1, 0, Qt::AlignRight|Qt::AlignVCenter);
	wSpinBox = new QSpinBox(dialog);
	wSpinBox->setMaximum(9999);
	layout->addWidget(wSpinBox, 1, 1, Qt::AlignLeft|Qt::AlignVCenter);
	label = new QLabel(dialog);
	label->setText(tr("Height ="));
	layout->addWidget(label, 1, 2, Qt::AlignRight|Qt::AlignVCenter);
	hSpinBox = new QSpinBox(dialog);
	hSpinBox->setMaximum(9999);
	layout->addWidget(hSpinBox, 1, 3, Qt::AlignLeft|Qt::AlignVCenter);
	channelLabel = new QLabel(dialog);
	channelLabel->setText(tr("Channel name ="));
	channelLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
	layout->addWidget(channelLabel, 3, 0, Qt::AlignLeft|Qt::AlignVCenter);
	nameLineEdit = new QLineEdit(dialog);
	nameLineEdit->setFocus(Qt::OtherFocusReason);
	nameLineEdit->selectAll();
	layout->addWidget(nameLineEdit, 3, 1, Qt::AlignLeft|Qt::AlignVCenter);
	if (acceptsMidi()) { // only when MIDI-enabled widgets
		label = new QLabel(dialog);
		label->setText("MIDI CC =");
		layout->addWidget(label, 14, 0, Qt::AlignRight|Qt::AlignVCenter);
		midiccSpinBox = new QSpinBox(dialog);
		midiccSpinBox->setRange(0,119);
		layout->addWidget(midiccSpinBox, 14,1, Qt::AlignLeft|Qt::AlignVCenter);
		label = new QLabel(dialog);
		label->setText("MIDI Channel =");
		layout->addWidget(label, 14, 2, Qt::AlignRight|Qt::AlignVCenter);
		midichanSpinBox = new QSpinBox(dialog);
		midichanSpinBox->setRange(0,127);
		layout->addWidget(midichanSpinBox, 14,3, Qt::AlignLeft|Qt::AlignVCenter);

		midiLearnButton = new QPushButton(tr("Midi learn"));
		layout->addWidget(midiLearnButton,14,4, Qt::AlignLeft|Qt::AlignVCenter);
	}
	acceptButton = new QPushButton(tr("Ok"));
	layout->addWidget(acceptButton, 15, 3, Qt::AlignCenter|Qt::AlignVCenter);
	applyButton = new QPushButton(tr("Apply"));
	layout->addWidget(applyButton, 15, 1, Qt::AlignCenter|Qt::AlignVCenter);
	cancelButton = new QPushButton(tr("Cancel"));
	layout->addWidget(cancelButton, 15, 2, Qt::AlignCenter|Qt::AlignVCenter);
#ifdef  USE_WIDGET_MUTEX
	widgetLock.lockForRead();
#endif
	xSpinBox->setValue(this->x());
	ySpinBox->setValue(this->y());
	wSpinBox->setValue(this->width());
	hSpinBox->setValue(this->height());
	nameLineEdit->setText(getChannelName());
	if (acceptsMidi()) {
		midiccSpinBox->setValue(this->m_midicc);
		midichanSpinBox->setValue(this->m_midichan);
	}
#ifdef  USE_WIDGET_MUTEX
	widgetLock.unlock();
#endif
}
Example #6
0
const String AudioProcessor::getInputChannelName (int index) const   { return getChannelName (inputBuses,  index); }