//Renata Kopecna #include "ReferencePlots.hh" #include #include "ScriptHelpers.hh" #include #include #include #include #include #include #include #include #include #include const int oneSigma_RGB[3] = {34,136,51}; const int twoSigma_RGB[3] = {170,170,0}; const int threeSigma_RGB[3] = {238,22,136}; const int moreSigma_RGB[3] = {204,51,17}; //TODO: make it into a texfile instead of a cout! const std::vector Davids = { valErr(+0.572,0.005),//valErr(+0.321,0.004), valErr(-0.002,0.007), valErr(-0.246,0.008), valErr(-0.003,0.008), valErr(-0.002,0.005),//valErr(-0.003,0.006), valErr(-0.001,0.008), valErr(-0.063,0.008), valErr(-0.084,0.007) }; const std::vector Belles = { valErr(+0.604,0.015),//valErr(+0.297,0.011), valErr(-0.018,0.017), valErr(-0.255,0.010), valErr(0.0,0.0), valErr(0.0,0.0), valErr(0.0,0.0), valErr(-0.037,0.018), valErr(-0.041,0.016) }; const std::vector BaBars = { valErr(+0.556,0.009),//valErr(+0.333,0.007), valErr(+0.011,0.011), valErr(-0.237,0.007), valErr(0.0,0.0), valErr(0.0,0.0), valErr(0.0,0.0), valErr(-0.058,0.015), valErr(-0.095,0.014) }; const std::vector B0s = { valErr(+0.572,0.008),//valErr(+0.321,0.006), valErr(-0.013,0.010), valErr(-0.250,0.006), valErr(0.0,0.0), valErr(0.0,0.0), valErr(0.0,0.0), valErr(-0.048,0.007), valErr(-0.084,0.006) }; std::vectorgetSigma(std::vector vec_a, std::vector vec_b){ if (vec_a.size() != vec_b.size()){ spdlog::error("Two valErr vectors have different lenghts! Abort."); assert(0); } std::vectorsigs; for_indexed(auto a: vec_a){ sigs.push_back(sigmaAway(a,vec_b[i])); } return sigs; } std::vectorgetSigmaColor(std::vectorvec_sigma){ std::vector tmp; for(auto sigma: vec_sigma){ if (fabs(sigma) < 1.0) tmp.push_back(oneSigma_RGB); else if (fabs(sigma) < 2.0) tmp.push_back(twoSigma_RGB); else if (fabs(sigma) < 3.0) tmp.push_back(threeSigma_RGB); else tmp.push_back(moreSigma_RGB); } return tmp; } std::string getSigmaColor_str(double sigma){ if (fabs(sigma) < 1.0) return "\\cellcolor{oneSigma}"; else if (fabs(sigma) < 2.0) return "\\cellcolor{twoSigmas}"; else if (fabs(sigma) < 3.0) return"\\cellcolor{threeSigmas}"; else return "\\cellcolor{moreSigmas}"; } std::vectorgetSigmaColor_strVec(std::vectorvec_sigma){ std::vector tmp; for(auto sigma: vec_sigma) tmp.push_back(getSigmaColor_str(sigma)); return tmp; } double getCorrectedError(std::string name, double err, int jobID){ //For now, no bins, cause it is used anyhow only for reference //TODO basic_params tmpParams; //This is dumb, but no time tmpParams.jobID = jobID; std::string fileName = get_ToyPullPlot_folder(tmpParams)+"pullResults.root"; spdlog::info("Opening " + fileName); TFile* file = new TFile(fileName.c_str(), "READ"); if (!file->GetListOfKeys()->Contains(name.c_str())){ spdlog::critical("Wrong tree name " + name + "! Abort."); assert(0); } //Get the tree and set the branches to active TTree* tree = (TTree*)file->Get(name.c_str()); tree->SetBranchStatus("*",1); //Activate all branches double width = DEFAULT_TREE_ERR; double mean = DEFAULT_TREE_VAL; tree->SetBranchAddress("width", &width); tree->SetBranchAddress("mean", &mean); tree->GetEntry(0); file->Close(); //get_param_valueError_from_rootfile() return err*width; } int plotComparisonFull(){ spdlog::debug("Starting with printing the values for RefChan measurement in a nice table."); double fractionOfStats = 1.0; basic_params params_Fit= basic_params(); params_Fit.Run = 12; params_Fit.nBins = 1; params_Fit.reference =true; std::string fitFile = final_result_name(true, false, params_Fit, true, 1, params_Fit.Run, false, fractionOfStats, false, -1); std::vector myValues; spdlog::debug("Filling my values into a vector"); for (auto obs: ANG_OBS){ //The easiest rounding in c++ double err = get_param_error_from_rootfile(fitFile, obs, 1,0); //The easiest rounding in c++ err = round(getCorrectedError(obs,err,649)*1000.0)/1000.0; //TODO double val = round(get_param_value_from_rootfile(fitFile, obs, 1,0)*1000.0)/1000.0; myValues.push_back(valErr(val,err)); } std::vectorcol_Davids = getSigmaColor_strVec(getSigma(myValues,Davids)); std::vectorcol_Belles = getSigmaColor_strVec(getSigma(myValues,Belles)); std::vectorcol_BaBars = getSigmaColor_strVec(getSigma(myValues,BaBars)); std::vectorcol_B0s = getSigmaColor_strVec( getSigma(myValues,B0s)); std::cout << "\\begin{table}[]" << std::endl; std::cout << "\\begin{tabular}{llllll}" << std::endl; std::cout << " & this fit & \\lhcb \\Bu & Belle (\\Bu) & BaBar (\\Bu + \\Bd) & \\lhcb \\Bd \\\\\\hline" << std::endl; for_indexed(auto myVal: myValues){ std::cout << std::setprecision(3) << "$" << ANG_OBS_TLaTeX[i] << "$"; std::cout << " & " << myVal.val << "$\\pm$" < myValues; spdlog::debug("Filling my values into a vector"); for (auto obs: ANG_OBS){ double err = get_param_error_from_rootfile(fitFile, obs, 1,0); //The easiest rounding in c++ err = round(getCorrectedError(obs,err,649)*1000.0)/1000.0; //TODO double val = round(get_param_value_from_rootfile(fitFile, obs, 1,0)*1000.0)/1000.0; myValues.push_back(valErr(val,err)); } std::vectorsig_Davids = getSigma(myValues,Davids); std::vectorsig_Belles = getSigma(myValues,Belles); std::vectorsig_BaBars = getSigma(myValues,BaBars); std::vectorsig_B0s = getSigma(myValues,B0s); std::cout << "\\begin{table}[]" << std::endl; std::cout << "\\begin{tabular}{l|llll}" << std::endl; std::cout << " & \\lhcb \\Bu & Belle (\\Bu) & BaBar (\\Bu + \\Bd) & \\lhcb \\Bd \\\\\\hline" << std::endl; //for_indexed(auto myVal: myValues){ //TODO remove: yields warning in compilation due to unused 'myVals' for(UInt_t i = 0; i < sig_Davids.size(); i++){ std::cout << std::setprecision(2) << "$" << ANG_OBS_TLaTeX[i] << "$"; std::cout << " & " << sig_Davids[i]; std::cout << " & " << sig_Belles[i]; std::cout << " & " << sig_BaBars[i]; std::cout << " & " << sig_B0s[i]; std::cout << "\\\\" << std::endl; } std::cout << " \\end{tabular}" << std::endl; std::cout << " \\end{table}" << std::endl; return 0; }