void drawSourceCorrelations() { setTDRStyle(); // Autogenerate list of sources from UncertaintySources.txt with this macro: // grep '\[' CondFormats/JetMETObjects/data/Winter14_V5_DATA_UncertaintySources_AK5PFchs.txt | sed 's/\]/"\);/' | sed 's/\[/s.push_back\("/' // The ones that are included in Total (kData) are listed in JetDefs.hpp, // with bit-name mapping found in drawJetCorrectionUncertainty.cpp // 8 TeV Winter14_V5 sources vector<string> s; s.push_back("AbsoluteStat"); s.push_back("AbsoluteScale"); s.push_back("AbsoluteFlavMap"); s.push_back("AbsoluteMPFBias"); //s.push_back("HighPtExtra"); // 8 TeV GR s.push_back("Fragmentation"); // new patched 8 TeV s.push_back("SinglePionECAL"); s.push_back("SinglePionHCAL"); s.push_back("FlavorQCD"); //s.push_back("TimeEta"); //s.push_back("TimePt"); s.push_back("RelativeJEREC1"); s.push_back("RelativeJEREC2"); s.push_back("RelativeJERHF"); s.push_back("RelativePtBB"); s.push_back("RelativePtEC1"); s.push_back("RelativePtEC2"); s.push_back("RelativePtHF"); s.push_back("RelativeFSR"); s.push_back("RelativeStatEC2"); s.push_back("RelativeStatHF"); s.push_back("PileUpDataMC"); s.push_back("PileUpPtRef"); s.push_back("PileUpPtBB"); s.push_back("PileUpPtEC1"); s.push_back("PileUpPtEC2"); s.push_back("PileUpPtHF"); //s.push_back("PileUpMuZero"); //s.push_back("PileUpEnvelope"); //s.push_back("SubTotalPileUp"); //s.push_back("SubTotalRelative"); //s.push_back("SubTotalPt"); //s.push_back("SubTotalScale"); //s.push_back("SubTotalMC"); //s.push_back("Total"); //s.push_back("TotalNoFlavor"); //s.push_back("TotalNoTime"); //s.push_back("TotalNoFlavorNoTime"); //s.push_back("FlavorZJet"); //s.push_back("FlavorPhotonJet"); //s.push_back("FlavorPureGluon"); //s.push_back("FlavorPureQuark"); //s.push_back("FlavorPureCharm"); //s.push_back("FlavorPureBottom"); //s.push_back("TimeRunA"); //s.push_back("TimeRunB"); //s.push_back("TimeRunC"); //s.push_back("TimeRunD"); //s.push_back("CorrelationGroupMPFInSitu"); //s.push_back("CorrelationGroupIntercalibration"); //s.push_back("CorrelationGroupbJES"); //s.push_back("CorrelationGroupFlavor"); //s.push_back("CorrelationGroupUncorrelated"); // 7 TeV JEC11_V12 sources /* vector<string> s; s.push_back("Absolute"); s.push_back("HighPtExtra"); s.push_back("SinglePion"); s.push_back("Flavor"); //s.push_back("Time"); s.push_back("RelativeJEREC1"); s.push_back("RelativeJEREC2"); s.push_back("RelativeJERHF"); s.push_back("RelativeFSR"); s.push_back("RelativeStatEC2"); s.push_back("RelativeStatHF"); s.push_back("PileUpDataMC"); s.push_back("PileUpOOT"); s.push_back("PileUpPt"); s.push_back("PileUpBias"); s.push_back("PileUpJetRate"); //s.push_back("SubTotalPileUp"); //s.push_back("SubTotalRelative"); //s.push_back("SubTotalPt"); //s.push_back("SubTotalDataMC"); //s.push_back("Total"); */ // define this bit to test that quadratic sum equals total string sref = "Total"; double etabins[] = {0,1.3,2.5,3.0,4.7}; const int neta = sizeof(etabins)/sizeof(etabins[0])-1; double ptbins[] = {10, 12, 15, 18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 362, 430, 507, 592, 686, 790, 905, 1032, 1172, 1327, 1497, 1684, 1890, //1999}; 2000, 2238, 2500}; // pT=2504 observed limit with 20/fb at 8 TeV //, 2787, 3103, 3450}; const int npt = sizeof(ptbins)/sizeof(ptbins[0])-1; const int netapt = neta*npt; double etaptbins[netapt+1]; for (int ieta = 0; ieta != neta; ++ieta) { for (int ipt = 0; ipt != npt; ++ipt) { double x = pow(2500/10,ieta)*(ptbins[ipt]); etaptbins[ieta*npt+ipt] = x; } // for npt } // for ieta etaptbins[netapt] = pow(2500/10,neta)*10; TH2D *h2 = new TH2D("h2",";p_{T} (GeV);p_{T} (GeV)", npt, ptbins, npt, ptbins); TH2D *h2x = new TH2D("h2x",";250^{i_{#eta}}p_{T} (GeV)" ";250^{i_{#eta}}p_{T} (GeV)", netapt, etaptbins, netapt, etaptbins); const double zmin = -0.4;//-0.25; // Set empty cells to white (below lower limit of zmin+eps) for (int i = 1; i != h2x->GetNbinsX()+1; ++i) { for (int j = 1; j != h2x->GetNbinsY()+1; ++j) { h2x->SetBinContent(i, j, zmin); } } // Create uncertainty sources vector<JetCorrectionUncertainty*> uncs(s.size()); for (unsigned int k = 0; k != s.size(); ++k) { // GT 8 TeV //const char *sf = "CondFormats/JetMETObjects/data/" ////"Winter14_V5_DATA_UncertaintySources_AK7PF.txt"; // 8 TeV //"Winter14_V5_DATA_UncertaintySources_AK5PFchs.txt"; // 8 TeV // New patched 8 TeV (fixed fragmentation source sign) const char *sf = "../txt/" "Winter14_V8M_DATA_UncertaintySources_AK5PFchs.txt"; // 8 TeV // Older 7 TeV //const char *sf = "../../CondFormats/JetMETObjects/data/" //"JEC11_V12_AK7PF_UncertaintySources.txt"; // 7 TeV const char *src = s[k].c_str(); JetCorrectorParameters *p = new JetCorrectorParameters(sf, src); JetCorrectionUncertainty *unc = new JetCorrectionUncertainty(*p); uncs[k] = unc; } // Correlation plot between (eta,pT) pairs for (int ii = 0; ii != neta; ++ii) { for (int jj = 0; jj != neta; ++jj) { double eta1 = etabins[ii]; double eta2 = etabins[jj]; for (int i = 1; i != h2->GetNbinsX()+1; ++i) { for (int j = 1; j != h2->GetNbinsY()+1; ++j) { double pt1 = h2->GetXaxis()->GetBinCenter(i); double pt2 = h2->GetYaxis()->GetBinCenter(j); // Calculate correlation according to Sec. 8 Eq.(46) in JEC paper v3 double sumski2(0), sumskj2(0), sumskiskj(0); for (unsigned int k = 0; k != s.size(); ++k) { JetCorrectionUncertainty *unc = uncs[k]; assert(unc); unc->setJetPt(pt1); unc->setJetEta(eta1); double ski = unc->getUncertainty(true); unc->setJetPt(pt2); unc->setJetEta(eta2); double skj = unc->getUncertainty(true); sumski2 += ski*ski; sumskj2 += skj*skj; sumskiskj += ski*skj; } double si = sqrt(sumski2); double sj = sqrt(sumskj2); double rhoij = sumskiskj / (si*sj); if (pt1*cosh(eta1)<4000 && pt2*cosh(eta2)<4000) { // |eta|<1.3 if (ii==0 && jj==0) { if (!(pt1<400 && pt2>900)) // white background for legend h2->SetBinContent(i, j, rhoij); else h2->SetBinContent(i, j, zmin); } // all etas if (!(ii==jj && pt1<150 && pt2>600)) // white background for labels h2x->SetBinContent(ii*npt+i, jj*npt+j, rhoij); else h2x->SetBinContent(i, j, zmin); } } // for j } // for i } // for jj } // for ii // Sigle eta bin { TH1D *h1 = new TH1D("h1",";p_{T} (GeV);p_{T} (GeV)",npt,ptbins); h1->SetMinimum(ptbins[0]); h1->SetMaximum(ptbins[npt]); //h1->GetXaxis()->SetMoreLogLabels(); h1->GetXaxis()->SetNoExponent(); //h1->GetYaxis()->SetMoreLogLabels(); h1->GetYaxis()->SetNoExponent(); TCanvas *c1 = tdrCanvas("c1",h1,2,0,kSquare); // 8 TeV //TCanvas *c1 = tdrCanvas("c1",h1,1,0,kSquare); // 7 TeV gPad->SetLogx(); gPad->SetLogy(); gStyle->SetPalette(1); gStyle->SetOptStat(0); h2->Draw("COLZ SAME"); //h2->GetZaxis()->SetRangeUser(0,1-1e-4); h2->GetZaxis()->SetRangeUser(zmin+1e-4,1-1e-4); gPad->SetRightMargin(0.12); gPad->SetLeftMargin(0.17); gPad->RedrawAxis(); gPad->Update(); TLine *l = new TLine(); l->DrawLine(10,10,2500,2500); l->SetLineStyle(kDashed); l->DrawLine(1000,10,1000,1000); l->DrawLine(1000,1000,2500,1000); l->DrawLine(200,10,200,200); l->DrawLine(200,200,2500,200); l->DrawLine(40,10,40,40); l->DrawLine(40,40,2500,40); TLatex *tex = new TLatex(); tex->SetNDC(); tex->SetTextSize(0.045); tex->DrawLatex(0.20,0.87,"Anti-k_{T} R=0.5, PF+CHS"); //tex->DrawLatex(0.20,0.80,"TotalNoTime"); tex->DrawLatex(0.20,0.80,"Total excl. time"); tex->SetTextFont(42); tex->SetTextSize(0.05); tex->DrawLatex(0.10,0.09,"10"); c1->SaveAs("pdf/drawSourceCorrelations_8TeV_Eta13.pdf"); //c1->SaveAs("pdf/drawSourceCorrelations_7TeV.pdf"); } // Multiple eta bins { TH1D *h1x = new TH1D("h1x",";250^{i#eta} #times p_{T} (GeV)" ";250^{i#eta} #times p_{T} (GeV)", netapt,etaptbins); h1x->SetMinimum(etaptbins[0]); h1x->SetMaximum(etaptbins[netapt]); //h1x->GetXaxis()->SetMoreLogLabels(); //h1x->GetXaxis()->SetNoExponent(); //h1x->GetYaxis()->SetMoreLogLabels(); //h1x->GetYaxis()->SetNoExponent(); TCanvas *c1x = tdrCanvas("c1x",h1x,2,0,kSquare); // 8 TeV cross-eta gPad->SetLogx(); gPad->SetLogy(); gStyle->SetPalette(1); gStyle->SetOptStat(0); h2x->Draw("COLZ SAME"); //h2x->GetZaxis()->SetRangeUser(0,1-1e-4); h2x->GetZaxis()->SetRangeUser(zmin+1e-4,1-1e-4); gPad->SetBottomMargin(0.15); h1x->GetXaxis()->SetTitleOffset(1.2); gPad->SetRightMargin(0.12); gPad->SetLeftMargin(0.17); gPad->RedrawAxis(); gPad->Update(); TLine *l = new TLine(); l->DrawLine(10,10,2500*pow(250,3),2500*pow(250,3)); l->SetLineStyle(kDashed); l->DrawLine(1000,10,1000,1000); l->DrawLine(1000,1000,2500*pow(250,3),1000); l->DrawLine(200,10,200,200); l->DrawLine(200,200,2500*pow(250,3),200); l->DrawLine(40,10,40,40); l->DrawLine(40,40,2500*pow(250,3),40); TLatex *tex = new TLatex(); tex->SetNDC(); tex->SetTextSize(0.045); tex->DrawLatex(0.20,0.88,"Anti-k_{T} R=0.5, PF+CHS");//, TotalNoTime"); //tex->DrawLatex(0.20,0.80,"TotalNoTime"); tex->DrawLatex(0.71,0.88,"HF"); tex->DrawLatex(0.530,0.69,"EC2"); tex->DrawLatex(0.355,0.50,"EC1"); tex->DrawLatex(0.190,0.30,"BB"); tex->SetTextFont(42); tex->SetTextSize(0.05); tex->DrawLatex(0.10,0.09,"10"); c1x->SaveAs("pdf/drawSourceCorrelations_8TeV.pdf"); } }
int runPFSortedJets(std::string fileName) { // Create file on which histogram(s) can be saved. TFile *inFile = new TFile(fileName.c_str(), "READ"); THStack* partFracs = new THStack("particlestacks", ""); // Read histograms. vector<TProfile*> fractionProfiles; for (int idx = 0; idx != 16; ++idx){ std::stringstream tmpString(""); tmpString << "a" << idx; // a = all, g = gluonjets, q = quarkjets, lq = low pt quarks, hq = high pt quarks fractionProfiles.push_back( (TProfile*) inFile->Get( tmpString.str().c_str()) ); } cout << fractionProfiles.size(); vector<TH1D*> fractionHists; for (int idx = 0; idx != 16; ++idx){ fractionHists.push_back( fractionProfiles[idx]->ProjectionX("","") ); } vector<TH1D*> PFfracs; PFfracs.push_back( (TH1D*) fractionHists[0]->Clone("chf") ); PFfracs[0]->Add( fractionHists[1] ); PFfracs[0]->Add( fractionHists[3] ); PFfracs[0]->Add( fractionHists[4] ); PFfracs[0]->Add( fractionHists[7] ); PFfracs[0]->Add( fractionHists[8] ); PFfracs[0]->Add( fractionHists[13] ); PFfracs.push_back( (TH1D*) fractionHists[2]->Clone("phf") ); PFfracs[1]->Add( fractionHists[11] ); PFfracs.push_back( (TH1D*) fractionHists[5]->Clone("nhf") ); PFfracs[2]->Add( fractionHists[6] ); PFfracs[2]->Add( fractionHists[9] ); PFfracs[2]->Add( fractionHists[10] ); PFfracs[2]->Add( fractionHists[12] ); PFfracs.push_back( (TH1D*) fractionHists[14]->Clone("elf+muf") ); PFfracs.push_back( (TH1D*) fractionHists[15]->Clone("others") ); PFfracs[0]->SetFillColor(kRed); PFfracs[1]->SetFillColor(kBlue); PFfracs[2]->SetFillColor(kGreen); PFfracs[3]->SetFillColor(kYellow); PFfracs[4]->SetFillColor(kCyan); for (unsigned i = 0; i != PFfracs.size(); ++i){ partFracs->Add( PFfracs[i] ); } TCanvas *canv = tdrCanvas("c1",fractionHists[0],12,0,1);//new TCanvas("c1","c1",600,600); stackModify(fractionHists[0]); partFracs->SetHistogram( fractionHists[0] ); partFracs->GetHistogram()->SetMaximum(1.01); partFracs->GetHistogram()->SetMinimum(-0.01); //partFracs->SetFillStyle(4000); TLegend *leg = tdrLeg(0.83,0.1,0.98,0.93); leg->AddEntry( PFfracs[4], "rest", "f" ); leg->AddEntry( PFfracs[3], "elf+muf", "f" ); leg->AddEntry( PFfracs[2], "nhf", "f" ); leg->AddEntry( PFfracs[1], "phf", "f" ); leg->AddEntry( PFfracs[0], "chf", "f" ); leg->SetTextSize(0.045); TLatex latex; latex.SetNDC(); latex.SetTextAngle(0); latex.SetTextColor(kBlack); latex.SetTextFont(42); latex.SetTextAlign(31); latex.SetTextSize(0.6*0.07); partFracs->Draw("same"); latex.DrawLatex(0.77,0.85,"Pythia 6 Z2*"); //fixOverlay(); //canv->Print("efracs.pdf"); // Done. return 0; }
// Determine sensitivity to tracker dynamic inefficiency // by studying ratio of jet responses in Runs G and F (and BCD / F, E / F) void drawAvsB() { setTDRStyle(); string epocha = "BCD";//"BCD";//"H";//"F";//"BCD";//"F";//"E";//"BCD";//"F"; string epochb = "GH";//"G";//"BCD";//"G";//"E";//"E";//"F";//"G"; // Add the rest as well string epocha2 = "";//"EF"; string epochb2 = "";//"G"; string type = "data"; vector<string> methods; methods.push_back("mpfchs1"); methods.push_back("ptchs"); bool nozjptb = false; bool nogjmpf = false; bool nogjptb = true; bool mjvsjes = false; vector<string> samples; samples.push_back("zeejet"); samples.push_back("zmmjet"); samples.push_back("gamjet"); //samples.push_back("multijet"); cout << "draw"<<epocha<<"vs"<<epochb<<endl; const char *ct = type.c_str(); const char *pa = epocha.c_str(); const char *pb = epochb.c_str(); const char *pa2 = epocha2.c_str(); const char *pb2 = epochb2.c_str(); TFile *fg = new TFile(Form("rootfiles/jecdata%s.root",pb),"READ"); assert(fg && !fg->IsZombie()); TFile *ff = new TFile(Form("rootfiles/jecdata%s.root",pa),"READ"); assert(ff && !ff->IsZombie()); TFile *fg2(0), *ff2(0); if (epochb2!="") fg2 = new TFile(Form("rootfiles/jecdata%s.root",pb2),"READ"); if (epocha2!="") ff2 = new TFile(Form("rootfiles/jecdata%s.root",pa2),"READ"); TH1D *h = new TH1D("h", Form(";p_{T,ref} (GeV);%s ratio (%s / %s)", (type=="ratio" ? "Data/MC" : type=="data" ? "Data/data" : "MC/MC"), (epocha + (epocha2!="" ? "+"+epocha2 : "")).c_str(), (epochb + (epochb2!="" ? "+"+epochb2 : "")).c_str()), 3470,30,3500); h->SetMinimum(0.90); h->SetMaximum(1.15); h->GetXaxis()->SetMoreLogLabels(); h->GetXaxis()->SetNoExponent(); if (epocha=="F" && epochb=="G") lumi_13TeV = "Run2016F+G, 3.1+7.1 fb^{-1}"; if (epocha=="BCD" && epochb=="G") lumi_13TeV = "Run2016BCD+H, 12.9+8.8 fb^{-1}"; if (epocha=="BCD" && epochb=="G") lumi_13TeV = "Run2016BCD+FearlyGH, 12.9+16.8 fb^{-1}"; if (epocha=="BCD" && epochb=="F") lumi_13TeV = "Run2016BCD+F, 13+3.1 fb^{-1}"; if (epocha=="BCD" && epochb=="E") lumi_13TeV = "Run2016BCD+E, 13+4.0 fb^{-1}"; if (epocha=="E" && epochb=="F") lumi_13TeV = "Run2016E+F, 4.0+3.1 fb^{-1}"; if (epocha=="F" && epochb=="E") lumi_13TeV = "Run2016E+F, 4.0+3.1 fb^{-1}"; if ((epocha=="BCDEF" && epochb=="GH") || (epocha=="BCD" && epocha2=="EF" && epochb=="H" && epochb2=="G")) lumi_13TeV = "Run2016BCDEF+GH, 19.7+16.8 fb^{-1}"; if (epocha=="EF" && epochb=="BCD") lumi_13TeV = "Run2016BCD+EF, 12.9+6.8 fb^{-1}"; if (epocha=="H" && epochb=="G") lumi_13TeV = "Run2016G+H, 8.0+8.8 fb^{-1}"; if ((epocha=="BCD" && epocha2=="EF" && epochb=="G" && epochb2=="H")) lumi_13TeV = "Run2016BCDFearly+FlateGH, 19.7+16.8 fb^{-1}"; if ((epocha=="BCD" && epocha2=="" && ((epochb=="GH" && epochb2=="") || (epochb=="G" && epochb2=="H")))) lumi_13TeV = "Run2016BCD+FlateGH, 12.9+16.8 fb^{-1}"; if ((epocha=="EF" && epocha2=="" && ((epochb=="GH" && epochb2=="") || (epochb=="G" && epochb2=="H")))) lumi_13TeV = "Run2016EF+FlateGH, 6.8+16.8 fb^{-1}"; if ((epocha=="EF" && epocha2=="" && epochb=="G" && epochb2=="H")) lumi_13TeV = "Run2016EFearly+FlateGH, 6.8+16.8 fb^{-1}"; TCanvas *c1 = tdrCanvas("c1",h,4,11,true); c1->SetLogx(); TLatex *tex = new TLatex(); tex->SetNDC(); tex->SetTextSize(0.045); TMultiGraph *mg = new TMultiGraph(); string s = "draw"+epocha+(epocha2!="" ? "p" + epocha2 : "") +"vs"+epochb+(epochb2!="" ? "p" + epochb2 : ""); TGraphErrors *gmjb(0), *gmpf(0); for (unsigned int im = 0; im != methods.size(); ++im) { const char *cm = methods[im].c_str(); tex->DrawLatex(0.20,0.75-0.06*im,cm); s += "_" + methods[im]; for (unsigned int is = 0; is != samples.size(); ++is) { const char *cs = samples[is].c_str(); TGraphErrors *gg = (TGraphErrors*)fg->Get(Form("%s/eta00-13/%s_%s_a30",ct,cm,cs)); cout << cm << " " << cs << endl << flush; assert(gg); if (fg2) { TGraphErrors *gg2 = (TGraphErrors*)fg2->Get(Form("%s/eta00-13/%s_%s_a30",ct,cm,cs)); assert(gg2); gg = addGraph(gg,gg2); } TGraphErrors *gf = (TGraphErrors*)ff->Get(Form("%s/eta00-13/%s_%s_a30",ct,cm,cs)); assert(gf); if (ff2) { TGraphErrors *gf2 = (TGraphErrors*)ff2->Get(Form("%s/eta00-13/%s_%s_a30",ct,cm,cs)); assert(gf2); gf = addGraph(gf,gf2); } if (!(gf->GetN()==gg->GetN())) { // Remove highest pT point is that is the offender (BCD vs GH) if (gg->GetN()>gf->GetN() && fabs(gg->GetX()[gg->GetN()-1]/gf->GetX()[gf->GetN()-1]-1)>0.1 && fabs(gg->GetX()[gg->GetN()-2]/gf->GetX()[gf->GetN()-1]-1)<0.1) { cout << "Remove point B(N-1)" << endl; gg->RemovePoint(gg->GetN()-1); } else { cout << "sample " << samples[is] << " method " << methods[im] << " gf->N: " << gf->GetN() << " gg->N: " << gg->GetN() << endl; cout << " x_gf(N-1)=" << gf->GetX()[gf->GetN()-1] << " x_gg(N-1)=" << gg->GetX()[gg->GetN()-1] << " x_gg(N-2)=" << gg->GetX()[gg->GetN()-2] << endl; } assert(gf->GetN()==gg->GetN()); } TGraphErrors *g = (TGraphErrors*)gg->Clone(Form("ge_%s_%s",cm,cs)); for (int i = 0; i != g->GetN(); ++i) { double yg = gg->GetY()[i]; double yf = gf->GetY()[i]; g->SetPoint(i, gg->GetX()[i], yf / yg); double ex = gg->GetEX()[i]; double eg = gg->GetEY()[i]; double ef = gf->GetEY()[i]; g->SetPointError(i, ex, yf/yg*sqrt(pow(eg/yg,2)+pow(ef/yf,2))); } //g->Draw(is==0 ? "AP" : "SAMEP"); g->SetLineWidth(1+is); g->Draw("SAMEPZ"); if (samples[is]=="gamjet" && methods[im]=="mpfchs1" && nogjmpf) { tex->SetTextColor(kBlue); tex->DrawLatex(0.20,0.63,"#gamma+jet MPF excl. from fit"); tex->SetTextColor(kBlack); } else if (samples[is]=="gamjet" && methods[im]=="ptchs" && nogjptb) { tex->SetTextColor(kBlue); tex->DrawLatex(0.20,0.63,"#gamma+jet p_{T}^{bal} excl. from fit"); tex->SetTextColor(kBlack); } else if ((samples[is]=="zmmjet" || samples[is]=="zeejet") && methods[im]=="ptchs" && nozjptb) { tex->SetTextColor(kRed); tex->DrawLatex(0.20,0.63,"Z+jet p_{T}^{bal} excl. from fit"); tex->SetTextColor(kBlack); } else if (samples[is]=="multijet") { g->SetMarkerColor(kGray+1); g->SetLineColor(kGray+1); if (methods[im]=="ptchs") gmjb = g; if (methods[im]=="mpfchs1") gmpf = g; } else mg->Add(g); } // for is } // for im if (nogjmpf) s += "_nogjmpf"; if (nogjptb) s += "_nogptb"; if (nozjptb) s += "_nozptb"; if (mjvsjes) { s += "_mjvsjes"; tex->SetTextColor(kBlack); tex->DrawLatex(0.20,0.58,"Multijet vs JES fit"); } TF1 *fjes = new TF1("fjes",jesFit,30,2200,2); fjes->SetParameters(0.99,0.05); mg->Fit(fjes,"RN"); fjes->SetLineColor(kBlack); fjes->SetLineStyle(kDashed); fjes->SetLineWidth(2); fjes->SetRange(10.,3500.); fjes->Draw("SAME"); //TF1 *ft = new TF1("ft","1-[0]-[1]*pow(x,[2]) + ([3]+[4]*log(x))/x",30,2200); //ft->SetParameters(0,0.05,-0.5,1,0.1); //ft->FixParameter(3,0); // Logarithmic sigmoid //TF1 *ft = new TF1("ft","[0]+(1-[0])/(1. + exp(-(log(x)-log(abs([1])))" // "/(log(abs([2])+abs([1]))-log(abs([1])))))", 30,2200); //ft->SetParameters(0.98, 150, 50); TF1 *ft = new TF1("ft","[0]+(1-[0])/(1. + exp(-(log(x)-[1])/[2]))",30,2200); //ft->SetParameters(0.98,log(145),log(190)-log(145)); //ft->SetParameters(0.982,4.967,0.271); //ft->SetParameters(0.976,5.040,0.370); // ENDCAP //ft->SetParameters(0.985,5.0,0.3); ft->SetParameters(0.985,5.025,0.3); //ft->FixParameter(1,5.03); // semi-weighted average of BCD and EF //ft->FixParameter(2,0.395); // combined fit to BCD+EF / G+H // ( 12.9*5.055+6.8*5.000)/(12.9+6.8) ft->FixParameter(1,5.036); // semi-weighted average of BCD/GH and EF/GH // ( 12.9*0.344 + 6.8*0.455)/(12.9+6.8) ft->FixParameter(2,0.391); // combined fit to BCD+EF / GH // Log-sigmoid + powerlaw //TF1 *ft = new TF1("ft","[0]+(1-[0])/(1. + exp(-(log(x)-[1])/[2]))" // "*(1-[3]*pow(x,[4]))",30,2200); //ft->SetParameters(0.982,4.967,0.271,0.1,-0.2); // Double powerlaw //TF1 *ft = new TF1("ft","[4]-[0]*pow(x,[1])-[2]*pow(x,[3])",30,2200); //ft->SetParameters(0.05,-0.15,0.01,-0.3,1); mg->Fit(ft,"RN"); ft->SetLineColor(kBlue); ft->SetLineWidth(2); ft->SetRange(10.,3500.); ft->Draw("SAME"); // Map multijet with response ratio if (gmpf) { // we have multijet available TGraphErrors *gmpf2 = (TGraphErrors*)gmpf->Clone("gmpf2"); gmpf2->SetMarkerColor(kBlack);//kGray+1); gmpf2->SetLineColor(kBlack);//kGray+1); for (int i = 0; i != gmpf->GetN(); ++i) { if (mjvsjes) { gmpf2->SetPoint(i, 0.4*gmpf->GetX()[i], fjes->Eval(gmpf->GetX()[i])/gmpf->GetY()[i]); gmpf2->SetPointError(i, 0.4*gmpf->GetEX()[i], gmpf->GetEY()[i]); } else { gmpf2->SetPoint(i, 0.4*gmpf->GetX()[i], ft->Eval(gmpf->GetX()[i])/gmpf->GetY()[i]); gmpf2->SetPointError(i, 0.4*gmpf->GetEX()[i], gmpf->GetEY()[i]); } } gmpf2->Draw("SAMEPz"); } // multijet tex->SetTextColor(kBlue); tex->DrawLatex(0.50,0.85,Form("#chi^{2} / NDF = %1.1f / %d", ft->GetChisquare(), ft->GetNDF())); tex->SetTextColor(kBlack); tex->SetTextSize(0.040); tex->DrawLatex(0.50,0.80,Form("(#chi^{2} / NDF = %1.1f / %d)", fjes->GetChisquare(), fjes->GetNDF())); tex->SetTextColor(kBlue-9); tex->SetTextSize(0.030); tex->DrawLatex(0.20,0.25,ft->GetExpFormula()); tex->DrawLatex(0.20,0.20, Form("p_{0}=%1.3f#pm%1.3f" ", p_{1}=%1.3f#pm%1.3f" ", p_{2}=%1.3f#pm%1.3f", ft->GetParameter(0),ft->GetParError(0), ft->GetParameter(1),ft->GetParError(1), ft->GetParameter(2),ft->GetParError(2))); if (ft->GetNpar()>3) tex->DrawLatex(0.20,0.17, Form("p_{3}=%1.3f#pm%1.3f" ", p_{4}=%1.3f#pm%1.3f", ft->GetParameter(3),ft->GetParError(3), ft->GetParameter(4),ft->GetParError(4))); c1->SaveAs(Form("pdf/%s.pdf",s.c_str())); for (int i = 0; i != ft->GetNpar(); ++i) { cout << Form("%s%1.4g",i==0 ? "{" : ", ",ft->GetParameter(i)); } cout << "}" << endl; }