//______________________________________________________________________________ void Fit(TH1* h, Double_t* outPos, Double_t* outFWHM) { // Perform fit. Char_t tmp[256]; // delete old function TF1* func = new TF1(tmp, "pol1+gaus(2)"); func->SetLineColor(2); // estimate peak position Double_t fPi0Pos = h->GetBinCenter(h->GetMaximumBin()); // configure fitting function func->SetRange(fPi0Pos - 0.8, fPi0Pos + 0.8); func->SetLineColor(2); func->SetParameters( 0.1, 0.1, h->GetMaximum(), 0, 0.1); Int_t fitres = h->Fit(func, "RB0Q"); // get position and FWHM fPi0Pos = func->GetParameter(3); *outPos = fPi0Pos; *outFWHM = 2.35*func->GetParameter(4); // indicator line TLine* line = new TLine(); line->SetX1(fPi0Pos); line->SetX2(fPi0Pos); line->SetY1(0); line->SetY2(h->GetMaximum()); // draw h->GetXaxis()->SetRangeUser(-3, 3); h->Draw(); func->Draw("same"); line->Draw("same"); }
void quickPlotCtauVsVrrs () { setTDRStyle(); c1 = new TCanvas("c1","c1",200,10,700,500); const Int_t n = 10; Double_t x[n] = {0.375, 1.125, 2, 3.15, 4.65, 6.65, 9.5, 13.95, 22.6, 34.25}; Double_t y[n] = {1.466, 1.549, 1.545, 1.543, 1.541, 1.542, 1.547, 1.544, 1.539, 1.540}; Double_t exl[n] = {0.375, 0.375, 0.5, 0.65, 0.85, 1.15, 1.7, 2.75, 5.9, 5.75}; Double_t exh[n] = {0.375, 0.375, 0.5, 0.65, 0.85, 1.15, 1.7, 2.75, 5.9, 5.75}; Double_t eyl[n] = {.003,.003,.003,.003,.003,.003,.003,.003,.003,.003}; Double_t eyh[n] = {.003,.003,.003,.003,.003,.003,.003,.003,.003,.003}; gr = new TGraphAsymmErrors(n,x,y,exl,exh,eyl,eyh); gr->SetTitle(""); gr->SetMarkerColor(4); gr->SetMarkerStyle(21); gr->Draw("ALP"); gr->GetXaxis()->SetTitle("r(V^{0}) [cm]"); gr->GetYaxis()->SetTitle("#tau_{truth} [ps]"); TLine *l = new TLine(0,1.537,42,1.537); l->Draw(); l->SetLineColor(2); c1->SaveAs("Lb_vrrs_bins.pdf"); }
void raaTheoryOpen_pt(const char* inputDir = "../macro_raa/outRoot", // the place where the input root files, with the histograms are bool bSavePlots = true, bool bDoBRaa = true ) { // set the style gSystem->mkdir(Form("./figs/png"), kTRUE); gSystem->mkdir(Form("./figs/pdf"), kTRUE); setTDRStyle(); // read CMS graphs TFile *pgRaaCms_pt = new TFile(Form("%s/makeRaa_pt.root",inputDir)); // ##################### HIGH PT ############################ TGraphErrors *pgCms = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsi"); TGraphErrors *pgCmsP = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiP"); TGraphErrors *pgCmsSyst = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiSyst"); pgCmsSyst->SetFillColorAlpha(kOrange-9,0.5); pgCms->SetName("gNonPrJpsi"); TBox *lumi = (TBox*)pgRaaCms_pt->Get("lumi"); lumi->SetFillColor(kGray+1); lumi->SetFillStyle(1001); lumi->SetX1(28.5); lumi->SetX2(30); // ##################### LOW PT ############################ TGraphErrors *pgCms_lowpt = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsi_pt365y1624"); TGraphErrors *pgCmsP_lowpt = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiP_pt365y1624"); TGraphErrors *pgCmsSyst_lowpt = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiSyst_pt365y1624"); pgCmsSyst_lowpt->SetFillColorAlpha(kViolet-9,0.5); pgCms_lowpt->SetName("gNonPrJpsi_pt365y1624"); //-------------------------------------------------------------------- // *********** Theory curves with filled area TGraph *pgRaaB_rapp = new TGraph(2*raaB_rapp_vspt_numpoints); pgRaaB_rapp->SetName("pgRaaB_rapp"); for (int i=0; i<raaB_rapp_vspt_numpoints; i++) { pgRaaB_rapp->SetPoint(i,raaB_rapp_pt[i],raaB_rapp_vspt_yhigh[i]); pgRaaB_rapp->SetPoint(raaB_rapp_vspt_numpoints+i, raaB_rapp_pt[raaB_rapp_vspt_numpoints-i-1],raaB_rapp_vspt_ylow[raaB_rapp_vspt_numpoints-i-1]); } TGraph *pgRaaB_whdg = new TGraph(2*raaB_whdg_vspt_numpoints); pgRaaB_whdg->SetName("pgRaaB_whdg"); for (int i=0; i<raaB_whdg_vspt_numpoints; i++) { pgRaaB_whdg->SetPoint(i,raaB_whdg_pt[i],raaB_whdg_vspt_yhigh[i]); pgRaaB_whdg->SetPoint(raaB_whdg_vspt_numpoints+i, raaB_whdg_pt[raaB_whdg_vspt_numpoints-i-1],raaB_whdg_vspt_ylow[raaB_whdg_vspt_numpoints-i-1]); } TGraph *pgRaaNPJpsi_vitev = new TGraph(2*raaNPJpsi_vitev_vspt_numpoints); pgRaaNPJpsi_vitev->SetName("pgRaaNPJpsi_vitev"); for (int i=0; i<raaNPJpsi_vitev_vspt_numpoints; i++) { pgRaaNPJpsi_vitev->SetPoint(i,raaNPJpsi_vitev_pt[i],raaNPJpsi_vitev_vspt_yhigh[i]); pgRaaNPJpsi_vitev->SetPoint(raaNPJpsi_vitev_vspt_numpoints+i, raaNPJpsi_vitev_pt[raaNPJpsi_vitev_vspt_numpoints-i-1],raaNPJpsi_vitev_vspt_ylow[raaNPJpsi_vitev_vspt_numpoints-i-1]); } TGraph *pgRaaNPJpsi_vitev_noDissoc = new TGraph(2*raaNPJpsi_vitev_vspt_noDissoc_numpoints); pgRaaNPJpsi_vitev_noDissoc->SetName("pgRaaNPJpsi_vitev_noDissoc"); for (int i=0; i<raaNPJpsi_vitev_vspt_noDissoc_numpoints; i++) { pgRaaNPJpsi_vitev_noDissoc->SetPoint(i,raaNPJpsi_vitev_noDissoc_pt[i],raaNPJpsi_vitev_vspt_noDissoc_yhigh[i]); pgRaaNPJpsi_vitev_noDissoc->SetPoint(raaNPJpsi_vitev_vspt_noDissoc_numpoints+i, raaNPJpsi_vitev_noDissoc_pt[raaNPJpsi_vitev_vspt_noDissoc_numpoints-i-1],raaNPJpsi_vitev_vspt_noDissoc_ylow[raaNPJpsi_vitev_vspt_noDissoc_numpoints-i-1]); } // *********** Theory curves with line TGraph *pgRaaNPJpsi_mcatshq = new TGraph(raaNPJpsi_mcatshq_vspt_numpoints,raaNPJpsi_mcatshq_pt,raaNPJpsi_mcatshq_vspt); pgRaaNPJpsi_mcatshq->SetName("pgRaaNPJpsi_mcatshq"); TGraph *pgRaaNPJpsi_mcatshq_rad = new TGraph(raaNPJpsi_mcatshq_rad_vspt_numpoints,raaNPJpsi_mcatshq_rad_pt,raaNPJpsi_mcatshq_rad_vspt); pgRaaNPJpsi_mcatshq_rad->SetName("pgRaaNPJpsi_mcatshq_rad"); TGraph *pgRaaNPJpsi_bamps = new TGraph(raaNPJpsi_bamps_vspt_numpoints,raaNPJpsi_bamps_pt,raaNPJpsi_bamps_vspt_yval); pgRaaNPJpsi_bamps->SetName("pgRaaNPJpsi_bamps"); // Style for filled graphs pgRaaB_rapp->SetFillColor(kRed-7); pgRaaB_rapp->SetFillStyle(1001); pgRaaB_whdg->SetFillColor(kOrange); pgRaaB_whdg->SetFillStyle(1001); pgRaaNPJpsi_vitev->SetFillColor(kAzure+1); pgRaaNPJpsi_vitev->SetFillStyle(1001); pgRaaNPJpsi_vitev_noDissoc->SetFillColor(kAzure-9); pgRaaNPJpsi_vitev_noDissoc->SetFillStyle(1001); // Style for line graphs pgRaaNPJpsi_mcatshq->SetLineColor(kTeal+4); pgRaaNPJpsi_mcatshq_rad->SetLineColor(kTeal+3); pgRaaNPJpsi_bamps->SetLineColor(kRed+1); // pgRaaNPJpsi_mcatshq->SetLineStyle(3); // pgRaaNPJpsi_mcatshq_rad->SetLineStyle(3); // pgRaaNPJpsi_bamps->SetLineStyle(3); pgRaaNPJpsi_mcatshq->SetLineWidth(4); pgRaaNPJpsi_mcatshq_rad->SetLineWidth(4); pgRaaNPJpsi_bamps->SetLineWidth(3); //--------------------------------------------------------- TLine *line = new TLine(0.,1,30,1); line->SetLineStyle(1); line->SetLineWidth(1); TCanvas *pc = new TCanvas("pc","pc"); TF1 *f4 = new TF1("f4","1",0,30); f4->SetLineWidth(1); f4->GetXaxis()->SetTitle("p_{T} (GeV/c)"); f4->GetYaxis()->SetTitle("R_{AA}"); f4->GetYaxis()->SetRangeUser(0.0,1.5); f4->GetXaxis()->CenterTitle(kTRUE); f4->Draw(); lumi->Draw(); pc->Update(); pgCmsSyst->Draw("2"); // for drawing x-axis if(bDoBRaa) { pgRaaB_whdg->Draw("f"); } pgRaaNPJpsi_vitev->Draw("f"); pgRaaNPJpsi_vitev_noDissoc->Draw("f"); if(bDoBRaa) { pgRaaB_rapp->Draw("f"); } pgRaaNPJpsi_mcatshq->Draw("l"); pgRaaNPJpsi_mcatshq_rad->Draw("l"); pgRaaNPJpsi_bamps->Draw("l"); pgCmsSyst->Draw("2"); pgCmsP->Draw("P"); pgCms->Draw("P"); pgCmsSyst_lowpt->Draw("2"); pgCmsP_lowpt->Draw("P"); pgCms_lowpt->Draw("P"); // additional info CMS_lumi(pc,12003000,0); TLegend *leg_cent = new TLegend(0.59,0.50,0.89,0.64,NULL,"brNDC"); // TLegend *leg_cent = new TLegend(0.29,0.81,0.83,0.89,NULL,"brNDC"); // at top center leg_cent->SetMargin(0.17); leg_cent->SetBorderSize(0); leg_cent->SetTextFont(132); leg_cent->SetTextSize(0.03); leg_cent->SetLineColor(1); leg_cent->SetLineStyle(1); leg_cent->SetLineWidth(1); leg_cent->SetFillColor(19); leg_cent->SetFillStyle(0); TLegendEntry *entry_cent; entry_cent=leg_cent->AddEntry("raab","Nonprompt J/#psi",""); entry_cent->SetTextFont(132); entry_cent->SetTextSize(ltxSetTextSize3); entry_cent=leg_cent->AddEntry("gNonPrJpsi_pt365y1624", "1.6 < |y| < 2.4","p"); // entry_cent->SetTextColor(kViolet+2); entry_cent->SetTextFont(42); entry_cent->SetTextSize(entrySize); entry_cent=leg_cent->AddEntry("gNonPrJpsi", "|y| < 2.4","p"); // entry_cent->SetTextColor(kOrange+2); entry_cent->SetTextFont(42); entry_cent->SetTextSize(entrySize); TLegend *leg_theory_cent = new TLegend(0.285,0.681,0.83,0.881,NULL,"brNDC"); // TLegend *leg_theory_cent = new TLegend(0.29,0.61,0.83,0.81,NULL,"brNDC"); leg_theory_cent->SetMargin(0.1); leg_theory_cent->SetBorderSize(0); leg_theory_cent->SetTextFont(62); leg_theory_cent->SetTextSize(0.027); leg_theory_cent->SetLineColor(1); leg_theory_cent->SetLineStyle(1); leg_theory_cent->SetLineWidth(1); leg_theory_cent->SetFillColor(10); leg_theory_cent->SetFillStyle(1001); TLegendEntry *entry_theory_cent; entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_mcatshq_rad","MC@sHQ+EPOS+rad+LPM: standard (0-100%, |y| < 1)","l"); entry_theory_cent->SetTextFont(42); entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_mcatshq","MC@sHQ+EPOS: standard (0-100%, |y| < 1)","l"); entry_theory_cent->SetTextFont(42); entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_bamps","BAMPS: b=5 fm (|y| < 2.4)","l"); entry_theory_cent->SetTextFont(42); entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_vitev","Vitev: Rad E loss+CNM+Dissoc (0-10%, y~0)","f"); entry_theory_cent->SetTextFont(42); entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_vitev_noDissoc","Vitev: Rad E loss+CNM (0-10%, y~0)","f"); entry_theory_cent->SetTextFont(42); if(bDoBRaa) { entry_theory_cent=leg_theory_cent->AddEntry("pgRaaB_rapp","He,Fries,Rapp: HF transport (0-90%, y~0)","f"); entry_theory_cent->SetTextFont(42); entry_theory_cent=leg_theory_cent->AddEntry("pgRaaB_whdg","WHDG: Rad+Coll E loss (0-80%, y~0)","f"); entry_theory_cent->SetTextFont(42); } TLatex *lat = new TLatex(); lat->SetNDC(); lat->SetTextFont(42); lat->SetTextSize(ltxSetTextSize2); lat->DrawLatex(0.2,0.17,"Cent. 0-100%"); line->Draw(); leg_cent->Draw(); leg_theory_cent->Draw(); gPad->RedrawAxis(); if(bSavePlots) { pc->SaveAs(Form("figs/pdf/raaTheoryOpen_pt_withB%d.pdf",bDoBRaa)); pc->SaveAs(Form("figs/png/raaTheoryOpen_pt_withB%d.png",bDoBRaa)); } }
void draw_MA(int selection = 1, int choice = 0, bool poster = false, double normalised = false) { // choice = 0 Track Range // choice = 1 CosTheta // choice = 2 Phi // selection = 1 Christoph selection // selection = 2 Xiao selection const double BASELINE_POT = 2.300468e+20; double MA_POT = 2.000320e+20; // Ma selection I if (selection == 2) MA_POT = 2.252332e+20; // Ma selection II const double NOMINAL_POT = 2.2e20; // changed to 2.2e20 from 6.6e20 // Define colours...but I am not using them... const Color_t kTotalMCColor = kRed; const Color_t kTotalMCErrorBandColor = kRed-10; const Color_t kNueSignalColor = kViolet-6; const Color_t kNCBackgroundColor = kBlue; const Color_t kBeamNueBackgroundColor = kMagenta; const Color_t kNumuBackgroundColor = kGreen+2; const Color_t kNormalHierarchyColor = kBlue; const Color_t kInvertedHierarchyColor = kRed; const Style_t k90PercentConfidenceStyle = kSolid; const Style_t k68PercentConfidenceStyle = 7; ///< Dashed // for Selection I TFile* file = new TFile("./histograms_MA_trkrange_costheta_phi.root"); // for Selection II TFile* fileOriginal = new TFile("./MCOriginalnew.root"); TFile* fileM_A = new TFile("./MCM_Anew.root"); TH1F *histoPmu, *histoPmu_MA; if (selection == 1) { if (choice == 0) { file->GetObject("Track RangeMC Prodgenie BNB Nu Cosmic", histoPmu); file->GetObject("Track RangeMC Prodgenie BNB Nu Cosmic M_A", histoPmu_MA); } else if (choice == 1) { file->GetObject("cos#theta-AngleMC Prodgenie BNB Nu Cosmic", histoPmu); file->GetObject("cos#theta-AngleMC Prodgenie BNB Nu Cosmic M_A", histoPmu_MA); } else if (choice == 2) { file->GetObject("#phi-AngleMC Prodgenie BNB Nu Cosmic", histoPmu); file->GetObject("#phi-AngleMC Prodgenie BNB Nu Cosmic M_A", histoPmu_MA); } else cout << "Not a valid choice." << endl; } else if (selection == 2) { if (choice == 0) { fileOriginal->GetObject("SelectedFinalTrackLengthAll", histoPmu); fileM_A->GetObject("SelectedFinalTrackLengthAllWeighted", histoPmu_MA); } else if (choice == 1) { fileOriginal->GetObject("SelectedFinalTrackCorrectedCosZAll", histoPmu); fileM_A->GetObject("SelectedFinalTrackCorrectedCosZAllWeighted", histoPmu_MA); } else if (choice == 2) { fileOriginal->GetObject("SelectedFinalTrackCorrectedPhiAll", histoPmu); fileM_A->GetObject("SelectedFinalTrackCorrectedPhiAllWeighted", histoPmu_MA); } else cout << "Not a valid choice." << endl; } else cout << "Not a valid choice." << endl; cout << "histoPmu integral: " << histoPmu->Integral() << endl; cout << "histoPmu_MA integral: " << histoPmu_MA->Integral() << endl; histoPmu->Sumw2(); // just to be sure histoPmu_MA->Sumw2(); // just to be sure // POt scaling histoPmu->Scale(NOMINAL_POT/BASELINE_POT); histoPmu_MA->Scale(NOMINAL_POT/MA_POT); double histoPmu_Int = histoPmu->Integral(); double histoPmu_MA_Int = histoPmu_MA->Integral(); if (normalised) { histoPmu->Scale(1./histoPmu_Int); histoPmu_MA->Scale(1./histoPmu_MA_Int); } // Calculate integrals and print differences cout << "Integral histoPmu: " << histoPmu->Integral() << endl; cout << "Integral histoPmu_MA: " << histoPmu_MA->Integral() << endl; cout << "Difference w.r.t. histoPmu (%):" << endl; cout << "histoPmu_MA: " << (histoPmu_MA->Integral()-histoPmu->Integral())/(histoPmu->Integral())*100. << endl; cout << endl << endl << "Difference w.r.t. histoPmu (%) -- bin by bin -- MA" << endl; for (int i = 0; i < histoPmu->GetNbinsX(); i++) { cout << "Bin: " << i << " " << (histoPmu_MA->GetBinContent(i)-histoPmu->GetBinContent(i))/(histoPmu->GetBinContent(i))*100. << endl; } // Define the Canvas TCanvas *c; if (!poster) c = new TCanvas("c", "canvas", 800, 800); if (poster && choice == 0) c = new TCanvas("c", "canvas", 0,45,1164,907); if (poster && choice == 1) c = new TCanvas("c", "canvas", 0,45,800,907); //c->SetFillStyle(4000); // Transparent //c->SetFrameFillStyle(4000); // Transparent // Upper plot will be in pad1 TPad *pad1 = new TPad("pad1", "pad1", 0, 0.25, 1, 1.0); //pad1->SetFillStyle(4000); // Transparent //pad1->SetFrameFillStyle(4000); // Transparent pad1->SetBottomMargin(0); // Upper and lower plot are joined pad1->SetRightMargin(0.05); pad1->SetGridx(); // Vertical grid pad1->Draw(); // Draw the upper pad: pad1 pad1->cd(); // pad1 becomes the current pad histoPmu_MA->SetMinimum(0.0001); // Otherwise 0 label overlaps histoPmu->SetMinimum(0.0001); // Otherwise 0 label overlaps histoPmu_MA->SetStats(0); // No statistics on upper plot histoPmu->SetStats(0); // No statistics on upper plot // Define plots range based on the quantity plotted if (choice == 0) histoPmu_MA->GetXaxis()->SetRangeUser(0., 700.); if (choice == 1 && selection == 1) histoPmu_MA->GetXaxis()->SetRangeUser(0., 1.); if (choice == 1 && selection == 2) histoPmu_MA->GetXaxis()->SetRangeUser(0., 1.); if (choice == 2 && selection == 1) histoPmu_MA->GetXaxis()->SetRangeUser(-TMath::Pi(), TMath::Pi()); if (choice == 2 && selection == 2) histoPmu_MA->GetXaxis()->SetRangeUser(-3., 3.); if (choice == 1 && selection == 1) histoPmu_MA->GetYaxis()->SetRangeUser(0.0001, 4500.); if (choice == 1 && selection == 2) histoPmu_MA->GetYaxis()->SetRangeUser(0.0001, 5000.); if (choice == 2 && selection == 1) histoPmu_MA->GetYaxis()->SetRangeUser(240, 650.); if (choice == 2 && selection == 2) histoPmu_MA->GetYaxis()->SetRangeUser(300, 1500.); // Draw! histoPmu_MA->Draw("E2"); // Draw error bars only TH1F * test2 = (TH1F*)histoPmu_MA->Clone("test2"); test2->SetLineColor(kGreen+2); test2->Draw("same histo"); // Draw the histo line now histoPmu->Draw("same E2"); // Draw error bars only TH1F * test = (TH1F*)histoPmu->Clone("test"); test->Draw("same histo"); test->SetLineColor(kTotalMCColor); // Draw the histo line now // Change titles histoPmu_MA->GetYaxis()->SetTitle("Selected Events"); histoPmu_MA->SetTitle(""); if (choice == 1 && selection == 1) histoPmu_MA->GetXaxis()->SetTitle("cos#theta"); if (choice == 2 && selection == 1) histoPmu_MA->GetXaxis()->SetTitle("#phi angle [rad]"); if (choice == 0 && selection == 2) histoPmu_MA->GetXaxis()->SetTitle("Track Length [cm]"); if (choice == 1 && selection == 2) histoPmu_MA->GetXaxis()->SetTitle("cos#theta"); if (choice == 2 && selection == 2) histoPmu_MA->GetXaxis()->SetTitle("#phi angle [rad]"); uBooNESimulation_2(); // Simulation tag, this is defined in /nashome/m/mdeltutt/rootlogon.C // TLatex double x = 0.84;//0.839599,0.52 double y = 0.52; double size = 25; int color = 1; int font = 43; int align = 32; TLatex *latex; if(selection == 1) latex = new TLatex(x, y, "#splitline{All events passing}{Selection I}"); if(selection == 2) latex = new TLatex(x, y, "#splitline{All events passing}{Selection II}"); latex->SetNDC(); latex->SetTextSize(size); latex->SetTextColor(color); latex->SetTextFont(font); latex->SetTextAlign(align); latex->Draw(); // Do not draw the Y axis label on the upper plot and redraw a small // axis instead, in order to avoid the first label (0) to be clipped. (THIS SHOULDN'T BE NECESSARY NOW) //histoPmu->GetYaxis()->SetLabelSize(0.); //TGaxis *axis = new TGaxis( -5, 20, -5, 220, 20,220,510,""); //axis->SetLabelFont(43); // Absolute font size in pixel (precision 3) //axis->SetLabelSize(15); //axis->Draw(); // Legend for the upper plot leg = new TLegend(0.5964912,0.6266667,0.8922306,0.8348387,NULL,"brNDC");//0.65,0.6,.85,0.87); leg->SetTextFont(42); leg->SetBorderSize(0); //leg->SetFillStyle(0); // Transparent //leg->SetHeader(""); leg->AddEntry(histoPmu, "M_{A}^{CCQE} = 0.99 GeV"); leg->AddEntry(histoPmu_MA, "M_{A}^{CCQE} = 1.35 GeV"); leg->Draw(); // LOWER plot will be in pad c->cd(); // Go back to the main canvas before defining pad2 TPad *pad2 = new TPad("pad2", "pad2", 0, 0.005, 1, 0.25); //pad2->SetFrameFillStyle(4000); // Transparent //pad2->SetFillStyle(4000); // Transparent pad2->SetTopMargin(0); pad2->SetBottomMargin(0.3); // Leave some space for the X axis title if (poster) pad2->SetBottomMargin(0.4); // Leave some space for the X axis title pad2->SetRightMargin(0.05); pad2->SetGridx(); // vertical grid pad2->Draw(); pad2->cd(); // pad2 becomes the current pad // Define the first ratio plot TH1F *ratio_MA = (TH1F*)histoPmu_MA->Clone("ratio_MA"); ratio_MA->SetMinimum(0.4); // Define Y .. ratio_MA->SetMaximum(2.1); // .. range ratio_MA->Sumw2(); ratio_MA->SetStats(0); // No statistics on lower plot ratio_MA->Divide(histoPmu); ratio_MA->SetLineWidth(2); ratio_MA->SetLineColor(kGreen+2); if (choice == 0) ratio_MA->GetXaxis()->SetRangeUser(0., 700.); if (choice == 1) ratio_MA->GetXaxis()->SetRangeUser(0., 1.); if (choice == 2 && selection == 1) ratio_MA->GetXaxis()->SetRangeUser(-TMath::Pi(), TMath::Pi()); if (choice == 2 && selection == 2) ratio_MA->GetXaxis()->SetRangeUser(-3., 3.); // Draw! ratio_MA->Draw("E2"); // Draw error bars only TH1F * test4 = (TH1F*)ratio_MA->Clone("test4"); test4->SetLineColor(kGreen+2); test4->Draw("same histo"); // Draw the histo line now //********************** // // Settings // //********************** // h1 settings histoPmu->SetLineColor(kRed); histoPmu->SetLineWidth(2); histoPmu->SetFillColor(kTotalMCErrorBandColor); // h2 settings histoPmu_MA->SetLineColor(kGreen+2); histoPmu_MA->SetLineWidth(2); histoPmu_MA->SetFillColor(29); histoPmu_MA->GetYaxis()->CenterTitle(); histoPmu_MA->GetYaxis()->SetTitleSize(35); histoPmu_MA->GetYaxis()->SetTitleFont(43); histoPmu_MA->GetYaxis()->SetTitleOffset(1.14); // Ratio plot (ratio_MA) settings ratio_MA->SetTitle(""); // Remove the ratio title ratio_MA->SetFillColor(29); // Y axis ratio plot settings ratio_MA->GetYaxis()->SetTitle("Ratio"); ratio_MA->GetYaxis()->CenterTitle(); ratio_MA->GetYaxis()->SetNdivisions(505); ratio_MA->GetYaxis()->SetTitleSize(35); ratio_MA->GetYaxis()->SetTitleFont(43); ratio_MA->GetYaxis()->SetTitleOffset(.75); ratio_MA->GetYaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3) ratio_MA->GetYaxis()->SetLabelSize(15); // X axis ratio plot settings ratio_MA->GetXaxis()->CenterTitle(); ratio_MA->GetXaxis()->SetTitleSize(35); ratio_MA->GetXaxis()->SetTitleFont(43); ratio_MA->GetXaxis()->SetTitleOffset(3.0); ratio_MA->GetXaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3) ratio_MA->GetXaxis()->SetLabelSize(20); // Draw line at 1 in ratio plot TLine *line; if (choice == 0 && selection == 1) line = new TLine(0,1,726,1); if (choice == 0 && selection == 2) line = new TLine(0,1,700,1); if (choice == 1) line = new TLine(0,1,1,1); if (choice == 2) line = new TLine(-TMath::Pi(),1,TMath::Pi(),1); if (choice == 2 && selection == 2) line = new TLine(-TMath::Pi(),1,TMath::Pi(),1); line->SetLineColor(kBlack); line->SetLineStyle(9); // dashed line->Draw(); }
void tree() { // // This macro displays the Tree data structures //Author: Rene Brun TCanvas* c1 = new TCanvas("c1","Tree Data Structure",200,10,750,940); c1->Range(0,-0.1,1,1.15); gBenchmark->Start("tree"); Int_t branchcolor = 26; Int_t leafcolor = 30; Int_t basketcolor = 42; Int_t offsetcolor = 43; TPaveLabel* title = new TPaveLabel(.3,1.05,.8,1.13,c1->GetTitle()); title->SetFillColor(16); title->Draw(); TPaveText* treePave = new TPaveText(.01,.75,.15,1.00); treePave->SetFillColor(18); treePave->SetTextAlign(12); TText *tnt = treePave->AddText("Tree"); tnt->SetTextAlign(22); tnt->SetTextSize(0.030); treePave->AddText("fScanField"); treePave->AddText("fMaxEventLoop"); treePave->AddText("fMaxVirtualSize"); treePave->AddText("fEntries"); treePave->AddText("fDimension"); treePave->AddText("fSelectedRows"); treePave->Draw(); TPavesText* farm = new TPavesText(.01,1.02,.15,1.1,9,"tr"); TText *tfarm = farm->AddText("CHAIN"); tfarm->SetTextSize(0.024); farm->AddText("Collection"); farm->AddText("of Trees"); farm->Draw(); TLine* llink = new TLine(.15,.92,.80,.92); llink->SetLineWidth(2); llink->SetLineColor(1); llink->Draw(); llink->DrawLine(.21,.87,.21,.275); llink->DrawLine(.23,.87,.23,.375); llink->DrawLine(.25,.87,.25,.775); llink->DrawLine(.41,.25,.41,-.025); llink->DrawLine(.43,.25,.43,.075); llink->DrawLine(.45,.25,.45,.175); TPaveLabel* branch0 = new TPaveLabel(.20,.87,.35,.97,"Branch 0"); branch0->SetTextSize(0.35); branch0->SetFillColor(branchcolor); branch0->Draw(); TPaveLabel* branch1 = new TPaveLabel(.40,.87,.55,.97,"Branch 1"); branch1->SetTextSize(0.35); branch1->SetFillColor(branchcolor); branch1->Draw(); TPaveLabel* branch2 = new TPaveLabel(.60,.87,.75,.97,"Branch 2"); branch2->SetTextSize(0.35); branch2->SetFillColor(branchcolor); branch2->Draw(); TPaveLabel* branch3 = new TPaveLabel(.80,.87,.95,.97,"Branch 3"); branch3->SetTextSize(0.35); branch3->SetFillColor(branchcolor); branch3->Draw(); TPaveLabel* leaf0 = new TPaveLabel(.4,.75,.5,.8,"Leaf 0"); leaf0->SetFillColor(leafcolor); leaf0->Draw(); TPaveLabel* leaf1 = new TPaveLabel(.6,.75,.7,.8,"Leaf 1"); leaf1->SetFillColor(leafcolor); leaf1->Draw(); TPaveLabel* leaf2 = new TPaveLabel(.8,.75,.9,.8,"Leaf 2"); leaf2->SetFillColor(leafcolor); leaf2->Draw(); TPaveText* firstevent = new TPaveText(.4,.35,.9,.4); firstevent->AddText("First event of each basket"); firstevent->AddText("Array of fMaxBaskets Integers"); firstevent->SetFillColor(basketcolor); firstevent->Draw(); TPaveLabel* basket0 = new TPaveLabel(.4,.25,.5,.3,"Basket 0"); basket0->SetFillColor(basketcolor); basket0->Draw(); TPaveLabel* basket1 = new TPaveLabel(.6,.25,.7,.3,"Basket 1"); basket1->SetFillColor(basketcolor); basket1->Draw(); TPaveLabel* basket2 = new TPaveLabel(.8,.25,.9,.3,"Basket 2"); basket2->SetFillColor(basketcolor); basket2->Draw(); TPaveText* offset = new TPaveText(.55,.15,.9,.2); offset->AddText("Offset of events in fBuffer"); offset->AddText("Array of fEventOffsetLen Integers"); offset->AddText("(if variable length structure)"); offset->SetFillColor(offsetcolor); offset->Draw(); TPaveText* buffer = new TPaveText(.55,.05,.9,.1); buffer->AddText("Basket buffer"); buffer->AddText("Array of fBasketSize chars"); buffer->SetFillColor(offsetcolor); buffer->Draw(); TPaveText* zipbuffer = new TPaveText(.55,-.05,.75,.0); zipbuffer->AddText("Basket compressed buffer"); zipbuffer->AddText("(if compression)"); zipbuffer->SetFillColor(offsetcolor); zipbuffer->Draw(); TArrow* ar1 = new TArrow(); ar1->SetLineWidth(2); ar1->SetLineColor(1); ar1->SetFillStyle(1001); ar1->SetFillColor(1); ar1->DrawArrow(.21,.275,.39,.275,0.015,"|>"); ar1->DrawArrow(.23,.375,.39,.375,0.015,"|>"); ar1->DrawArrow(.25,.775,.39,.775,0.015,"|>"); ar1->DrawArrow(.50,.775,.59,.775,0.015,"|>"); ar1->DrawArrow(.70,.775,.79,.775,0.015,"|>"); ar1->DrawArrow(.50,.275,.59,.275,0.015,"|>"); ar1->DrawArrow(.70,.275,.79,.275,0.015,"|>"); ar1->DrawArrow(.45,.175,.54,.175,0.015,"|>"); ar1->DrawArrow(.43,.075,.54,.075,0.015,"|>"); ar1->DrawArrow(.41,-.025,.54,-.025,0.015,"|>"); TLine* ldot = new TLine(.95,.92,.99,.92); ldot->SetLineStyle(3); ldot->Draw(); ldot->DrawLine(.9,.775,.99,.775); ldot->DrawLine(.9,.275,.99,.275); ldot->DrawLine(.55,.05,.55,0); ldot->DrawLine(.9,.05,.75,0); TText* pname = new TText(.46,.21,"fEventOffset"); pname->SetTextFont(72); pname->SetTextSize(0.018); pname->Draw(); pname->DrawText(.44,.11,"fBuffer"); pname->DrawText(.42,.01,"fZipBuffer"); pname->DrawText(.26,.81,"fLeaves = TObjArray of TLeaf"); pname->DrawText(.24,.40,"fBasketEvent"); pname->DrawText(.22,.31,"fBaskets = TObjArray of TBasket"); pname->DrawText(.20,1.0,"fBranches = TObjArray of TBranch"); TPaveText* ntleaf = new TPaveText(0.30,.42,.62,.7); ntleaf->SetTextSize(0.014); ntleaf->SetFillColor(leafcolor); ntleaf->SetTextAlign(12); ntleaf->AddText("fLen: number of fixed elements"); ntleaf->AddText("fLenType: number of bytes of data type"); ntleaf->AddText("fOffset: relative to Leaf0-fAddress"); ntleaf->AddText("fNbytesIO: number of bytes used for I/O"); ntleaf->AddText("fIsPointer: True if pointer"); ntleaf->AddText("fIsRange: True if leaf has a range"); ntleaf->AddText("fIsUnsigned: True if unsigned"); ntleaf->AddText("*fLeafCount: points to Leaf counter"); ntleaf->AddText(" "); ntleaf->AddLine(0,0,0,0); ntleaf->AddText("fName = Leaf name"); ntleaf->AddText("fTitle = Leaf type (see Type codes)"); ntleaf->Draw(); TPaveText* type = new TPaveText(.65,.42,.95,.7); type->SetTextAlign(12); type->SetFillColor(leafcolor); type->AddText(" "); type->AddText("C : a character string"); type->AddText("B : an 8 bit signed integer"); type->AddText("b : an 8 bit unsigned integer"); type->AddText("S : a 16 bit signed short integer"); type->AddText("s : a 16 bit unsigned short integer"); type->AddText("I : a 32 bit signed integer"); type->AddText("i : a 32 bit unsigned integer"); type->AddText("F : a 32 bit floating point"); type->AddText("D : a 64 bit floating point"); type->AddText("TXXXX : a class name TXXXX"); type->Draw(); TPaveLabel* typecode = new TPaveLabel(.7,.68,.9,.72,"fType codes"); typecode->SetFillColor(leafcolor); typecode->Draw(); ldot->DrawLine(.4,.75,.30,.7); ldot->DrawLine(.5,.75,.62,.7); TPaveText* ntbasket = new TPaveText(0.02,-0.07,0.35,.25); ntbasket->SetFillColor(basketcolor); ntbasket->SetTextSize(0.014); ntbasket->SetTextAlign(12); ntbasket->AddText("fNbytes: Size of compressed Basket"); ntbasket->AddText("fObjLen: Size of uncompressed Basket"); ntbasket->AddText("fDatime: Date/Time when written to store"); ntbasket->AddText("fKeylen: Number of bytes for the key"); ntbasket->AddText("fCycle : Cycle number"); ntbasket->AddText("fSeekKey: Pointer to Basket on file"); ntbasket->AddText("fSeekPdir: Pointer to directory on file"); ntbasket->AddText("fClassName: 'TBasket'"); ntbasket->AddText("fName: Branch name"); ntbasket->AddText("fTitle: TreePave name"); ntbasket->AddText(" "); ntbasket->AddLine(0,0,0,0); ntbasket->AddText("fNevBuf: Number of events in Basket"); ntbasket->AddText("fLast: pointer to last used byte in Basket"); ntbasket->Draw(); ldot->DrawLine(.4,.3,0.02,0.25); ldot->DrawLine(.5,.25,0.35,-.07); ldot->DrawLine(.5,.3,0.35,0.25); TPaveText* ntbranch = new TPaveText(0.02,0.40,0.18,0.68); ntbranch->SetFillColor(branchcolor); ntbranch->SetTextSize(0.015); ntbranch->SetTextAlign(12); ntbranch->AddText("fBasketSize"); ntbranch->AddText("fEventOffsetLen"); ntbranch->AddText("fMaxBaskets"); ntbranch->AddText("fEntries"); ntbranch->AddText("fAddress of Leaf0"); ntbranch->AddText(" "); ntbranch->AddLine(0,0,0,0); ntbranch->AddText("fName: Branchname"); ntbranch->AddText("fTitle: leaflist"); ntbranch->Draw(); ldot->DrawLine(.2,.97,.02,.68); ldot->DrawLine(.35,.97,.18,.68); ldot->DrawLine(.35,.87,.18,.40); TPavesText* basketstore = new TPavesText(.8,-0.088,0.952,-0.0035,7,"tr"); basketstore->SetFillColor(28); basketstore->AddText("Baskets"); basketstore->AddText("Stores"); basketstore->Draw(); c1->Update(); gBenchmark->Show("treePave"); }
void chicent_sys_ratio() { gROOT->Reset(); gROOT->SetStyle("MyStyle"); // gROOT->LoadMacro("v2pt_12cen_MyDef.C"); // gROOT->LoadMacro("MyDef.C"); gStyle->SetTextFont(43); gStyle->SetLabelFont(43,"x"); gStyle->SetLabelFont(43,"y"); gStyle->SetLabelFont(43,"z"); gStyle->SetTitleFont(43,"x"); gStyle->SetTitleFont(43,"y"); gStyle->SetTitleFont(43,"z"); gStyle->SetEndErrorSize(0); double textsize = 19; //int mcol[8]={kRed,kMagenta,kBlue,kCyan,kGreen,kYellow,kOrange,kGray}; int mcol[8]={kRed,kOrange+1,kBlue,kGreen+1,kCyan,kYellow,kOrange,kGray}; int mcol2[4]={6,2,4,8}; //int msty[8][2]={{20,20},{25,24},{22,22},{28,26},{29,30},{33,27},{34,28},{20,24}}; int msty[8][2]={{20,20},{21,24},{22,29},{23,30},{24,30},{25,27},{28,28},{30,24}}; //float msiz[8]={1.11,0.9,1.2,1.24,1.5,1,1,1}; float msiz[8]={1.11,1.0,1.5,1.2,1.2,1.2,1.2,1.6}; float msiz2[4]={1.5,1.5,1.5,1.5}; // // arrays // const int Mfiles=50; int ndp[Mfiles]; char *cfn[Mfiles]; char *cft[Mfiles]; const int Mpoints=40; double xa[Mfiles][Mpoints],xe[Mfiles][Mpoints]; double ya[Mfiles][Mpoints],ye[Mfiles][Mpoints]; double nAxa[Mfiles][Mpoints],nAxe[Mfiles][Mpoints]; double nAya[Mfiles][Mpoints],nAye[Mfiles][Mpoints]; double nBxa[Mfiles][Mpoints],nBxe[Mfiles][Mpoints]; double nBya[Mfiles][Mpoints],nBye[Mfiles][Mpoints]; double nARxa[Mfiles][Mpoints],nARxe[Mfiles][Mpoints]; double nARya[Mfiles][Mpoints],nARye[Mfiles][Mpoints]; double nBRxa[Mfiles][Mpoints],nBRxe[Mfiles][Mpoints]; double nBRya[Mfiles][Mpoints],nBRye[Mfiles][Mpoints]; double aexl[Mfiles][Mpoints],aexh[Mfiles][Mpoints]; double aeyl[Mfiles][Mpoints],aeyh[Mfiles][Mpoints]; double ra[Mfiles][Mpoints],re[Mfiles][Mpoints]; const int Mpads=14; char *htit[Mpads]; char *atit[Mpads][3]; double ptit[Mpads][2]; double hxmin[Mpads],hxmax[Mpads]; double hymin[Mpads],hymax[Mpads]; double lxmin[Mpads],lxmax[Mpads]; double lymin[Mpads],lymax[Mpads]; // // Data input // char *cjob="v2pt_12cen_4x3"; int i=-1; // histogram parameter htit[0]="(a) #chi_{422}"; htit[1]="(b) #chi_{523}"; htit[2]="(c) #chi_{6222}"; htit[3]="(d) #chi_{633}"; htit[4]="(e) #chi_{7223}"; htit[5]="25-30%"; htit[6]="30-35%"; htit[7]="35-40%"; htit[8]="40-50%"; htit[9]="50-60%"; htit[10]="60-70%"; htit[11]="70-80%"; for (int ip=0;ip<Mpads;ip++) { hxmin[ip]=0.0001; hxmax[ip]=62.8; hymin[ip]=-0.3; hymax[ip]=6.99; lxmin[ip]=0.24; lxmax[ip]=0.88; lymin[ip]=0.65; lymax[ip]=0.94; ptit[ip][0]=3.0; ptit[ip][1]=-1.;// position legends atit[ip][0]="Centrality (%)"; atit[ip][1]="#chi"; } // // Read data and create vector files // double sysXYZ[5]={6,7,8,8,9}; //double sysXYZ[5]={9,9,13,13,15}; //double sysXYZ[5]={8,9,20,20,20}; double sysEach[5]={0.0002, 0.0002, 0.0002, 0.0003, 0.0002}; double tmp; const int nw=5; const int npt=14; const int npt_oli=8; ifstream inEP; inEP.open("./data_vncent5020_integral.txt"); for(int i=0; i<nw; i++){ for(int j=0; j<npt; j++){ inEP>>xa[i][j]; inEP>>ya[i][j]; inEP>>ye[i][j]; xe[i][j]=0.0; } } inEP.close(); ifstream inEP; inEP.open("./data_vncent5020_integral_vzA.txt"); for(int i=0; i<nw; i++){ for(int j=0; j<npt; j++){ inEP>>nAxa[i][j]; inEP>>nAya[i][j]; inEP>>nAye[i][j]; nAxe[i][j]=0.0; nARxa[i][j]=nAxa[i][j]; nARxe[i][j]=nAxe[i][j]; nARye[i][j]=nAya[i][j]/ya[i][j]*sqrt(ye[i][j]*ye[i][j]/ya[i][j]/ya[i][j] + nAye[i][j]*nAye[i][j]/nAya[i][j]/nAya[i][j] - 2.0*ye[i][j]*ye[i][j]/ya[i][j]/nAya[i][j] ); nARya[i][j]=nAya[i][j]/ya[i][j]; } } inEP.close(); ifstream inEP; inEP.open("./data_vncent5020_integral_vzB.txt"); for(int i=0; i<nw; i++){ for(int j=0; j<npt; j++){ inEP>>nBxa[i][j]; inEP>>nBya[i][j]; inEP>>nBye[i][j]; nBxe[i][j]=0.0; nBRxa[i][j]=nBxa[i][j]; nBRxe[i][j]=nBxe[i][j]; nBRye[i][j]=nBya[i][j]/ya[i][j]*sqrt(ye[i][j]*ye[i][j]/ya[i][j]/ya[i][j] + nBye[i][j]*nBye[i][j]/nBya[i][j]/nBya[i][j] - 1.7*nBye[i][j]*nBye[i][j]/ya[i][j]/nBya[i][j] ); nBRya[i][j]=nBya[i][j]/ya[i][j]; cout<<"ratio A: "<<nARya[i][j]<<", Aerr = "<<nARye[i][j]<<", ratio B="<<nBRya[i][j]<<", Berr = "<<nBRye[i][j]<<endl; } } inEP.close(); TCanvas *can=new TCanvas("can","can",10,10,1050*0.8*1.3,800*0.3*1.3 * 1.5); can->Divide(5,2,0,0); //sticks the pads with no space inbetween TH1D *h1[nw]; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); if(iw==4) gPad->SetRightMargin(0.02); //gPad->SetLogy(); char ch1[8]; sprintf(ch1,"h1_%d",iw); h1[iw] = new TH1D(ch1,"",500,hxmin[iw],hxmax[iw]); h1[iw]->SetMinimum(hymin[iw]); h1[iw]->SetMaximum(hymax[iw]); h1[iw]->SetXTitle(atit[iw][0]); h1[iw]->SetYTitle(atit[iw][1]); h1[iw]->GetXaxis()->CenterTitle(1); h1[iw]->GetYaxis()->CenterTitle(1); // futz with the axes h1[iw]->GetYaxis()->SetNdivisions(606); h1[iw]->GetXaxis()->SetNdivisions(606); h1[iw]->GetYaxis()->SetTitleSize(textsize); h1[iw]->GetYaxis()->SetTitleOffset(1.8); h1[iw]->GetYaxis()->SetLabelSize(textsize); h1[iw]->GetXaxis()->SetTitleSize(textsize); h1[iw]->GetXaxis()->SetTitleOffset(1.3); h1[iw]->GetXaxis()->SetLabelSize(textsize); // h1[iw]->GetXaxis()->SetLabelOffset(1.2); h1[iw]->Draw(); } // // Draw! // cout << "Now Draw!" << endl; TGraphErrors *ge, *geB, *ge2; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); // if (iw==3) { tex=new TLatex(11,0.0100,"CMS Preliminary"); tex->SetTextSize(textsize*1.0); //tex->Draw(); } if (iw==0) { tex=new TLatex(5,0.00015,"Hydro. at #sqrt{s_{NN}}=2.76TeV"); tex->SetTextSize(textsize*0.85); //tex->Draw(); tex=new TLatex(7,0.00033,"|#eta|<2.4"); tex->SetTextSize(textsize*1.0); //tex->Draw(); tex=new TLatex(7,0.00012,"0.3<p_{T}<3.0 GeV/c"); tex->SetTextSize(textsize*1.0); //tex->Draw(); } //if (iw < 4) tex=new TLatex(ptit[iw][0]+2,0.27,htit[iw]); tex=new TLatex(ptit[iw][0],ptit[iw][1],htit[iw]); if ( iw == 0) tex->SetTextSize(textsize); else if (iw == 8) tex->SetTextSize(textsize); else tex->SetTextSize(textsize); tex->Draw(); // // Read data // TLegend *leg = new TLegend(lxmin[iw]*0.3,lymin[iw]*1.05,lxmax[iw]*1.15,lymax[iw]*1.02); leg->SetFillStyle(0); leg->SetFillColor(0); leg->SetTextSize(textsize); for (int im=0;im<1;im++) { int j=im*5+iw; int col=2; //if (ndp[j]==0) continue; ge=new TGraphErrors(10,&nAxa[j][0],&nAya[j][0],&nAxe[j][0],&nAye[j][0]); ///drawSysBoxValue(ge,16,1.6, ye5sys[j]); //drawSysBox(ge,16,2., sysXYZ[j]); ge->SetTitle(""); ge->SetMarkerStyle(24); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); //ge->Draw("pe"); leg->AddEntry(ge,"Tight","pl"); } for (int im=0;im<1;im++) { int j=im*5+iw; int col=4; //if (ndp[j]==0) continue; geB=new TGraphErrors(10,&nBxa[j][0],&nBya[j][0],&nBxe[j][0],&nBye[j][0]); ///drawSysBoxValue(ge,16,1.6, ye5sys[j]); //drawSysBox(ge,16,2., sysXYZ[j]); geB->SetTitle(""); geB->SetMarkerStyle(25); // ge->SetMarkerStyle(msty[im]); geB->SetMarkerSize(msiz[im]); geB->SetMarkerColor(col); geB->SetLineWidth(1.2); geB->SetLineColor(col); //ge->Draw("pe"); leg->AddEntry(geB,"Loose","pl"); } for (int im=0;im<1;im++) { int j=im*5+iw; int col=1; //if (ndp[j]==0) continue; ge2=new TGraphErrors(10,&xa[j][0],&ya[j][0],&xe[j][0],&ye[j][0]); ///drawSysBoxValue(ge2,16,1.6, yesys[j]); //drawSysBox(ge2,16,2., sysXYZ[j]); ge2->SetTitle(""); ge2->SetMarkerStyle(20); // ge2->SetMarkerStyle(msty[im]); ge2->SetMarkerSize(msiz[im]); ge2->SetMarkerColor(col); ge2->SetLineWidth(1.2); ge2->SetLineColor(col); //ge2->Draw("pe"); leg->AddEntry(ge2,"Default","pl"); } ge2->Draw("pe"); ge->Draw("pe"); geB->Draw("pe"); if (iw==2) leg->Draw(); } //start new TH1D *h2[nw]; for (int iw=0;iw<nw;iw++) { can->cd(iw+1+5); if(iw==4) gPad->SetRightMargin(0.02); //gPad->SetLogy(); char ch2[8]; sprintf(ch2,"h2_%d",iw); h2[iw] = new TH1D(ch2,"",500,hxmin[iw],hxmax[iw]); h2[iw]->SetMinimum(0.5); h2[iw]->SetMaximum(1.5); h2[iw]->SetXTitle(atit[iw][0]); h2[iw]->SetYTitle(atit[iw][1]); h2[iw]->GetXaxis()->CenterTitle(1); h2[iw]->GetYaxis()->CenterTitle(1); h2[iw]->GetYaxis()->SetNdivisions(606); h2[iw]->GetXaxis()->SetNdivisions(606); h2[iw]->GetYaxis()->SetTitleSize(textsize); h2[iw]->GetYaxis()->SetTitleOffset(1.8); h2[iw]->GetYaxis()->SetLabelSize(textsize); h2[iw]->GetXaxis()->SetTitleSize(textsize); h2[iw]->GetXaxis()->SetTitleOffset(1.3); h2[iw]->GetXaxis()->SetLabelSize(textsize); h2[iw]->Draw(); } for (int iw=0;iw<nw;iw++) { can->cd(iw+5+1); // if (iw==3+5) { tex=new TLatex(11,0.0100,"CMS Preliminary"); tex->SetTextSize(textsize*1.0); //tex->Draw(); } if (iw==0+5) { tex=new TLatex(5,0.00015,"Hydro. at #sqrt{s_{NN}}=2.76TeV"); tex->SetTextSize(textsize*0.85); //tex->Draw(); tex=new TLatex(7,0.00033,"|#eta|<2.4"); tex->SetTextSize(textsize*1.0); //tex->Draw(); tex=new TLatex(7,0.00012,"0.3<p_{T}<3.0 GeV/c"); tex->SetTextSize(textsize*1.0); //tex->Draw(); } //if (iw < 4) tex=new TLatex(ptit[iw][0]+2,0.27,htit[iw]); //tex=new TLatex(10,0.9,htit[iw]); tex=new TLatex(10,0.9,"CMS"); if ( iw == 0) tex->SetTextSize(textsize); else if (iw == 8) tex->SetTextSize(textsize); else tex->SetTextSize(textsize); //tex->Draw(); // // Read data // TLegend *leg2 = new TLegend(lxmin[iw]*0.3,lymin[iw]*1.16,lxmax[iw]*1.15,lymax[iw]*1.02); leg2->SetFillStyle(0); leg2->SetFillColor(0); leg2->SetTextSize(textsize); for (int im=0;im<1;im++) { int j=im*5+iw; int col=2; //if (ndp[j]==0) continue; ge=new TGraphErrors(10,&nARxa[j][0],&nARya[j][0],&nARxe[j][0],&nARye[j][0]); ///drawSysBoxValue(ge,16,1.6, ye5sys[j]); //drawSysBox(ge,16,2., sysXYZ[j]); ge->SetTitle(""); ge->SetMarkerStyle(24); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); //ge->Draw("pe"); leg2->AddEntry(ge,"Tight/Default","pl"); } for (int im=0;im<1;im++) { int j=im*5+iw; int col=4; //if (ndp[j]==0) continue; geB=new TGraphErrors(10,&nBRxa[j][0],&nBRya[j][0],&nBRxe[j][0],&nBRye[j][0]); ///drawSysBoxValue(ge,16,1.6, ye5sys[j]); //drawSysBox(ge,16,2., sysXYZ[j]); geB->SetTitle(""); geB->SetMarkerStyle(25); // ge->SetMarkerStyle(msty[im]); geB->SetMarkerSize(msiz[im]); geB->SetMarkerColor(col); geB->SetLineWidth(1.2); geB->SetLineColor(col); //ge->Draw("pe"); leg2->AddEntry(geB,"Loose/Default","pl"); } ge->Draw("pe"); geB->Draw("pe"); if (iw==2) leg2->Draw(); TLine *lines = new TLine(0,1,60,1); lines->SetLineStyle(2); lines->SetLineWidth(1); lines->Draw(); if(iw==0||iw==0){ TF1 *fitFun = new TF1("fitFun","pol4", 0, 60); fitFun->SetLineColor(4); geB->Fit("fitFun","R+"); fitFun->Draw("same"); cout<<fitFun->Eval(2.5)<<", "<<fitFun->Eval(7.5)<<", "<<fitFun->Eval(45)<<", "<<fitFun->Eval(55)<<endl; } else { TF1 *fitFun = new TF1("fitFun","pol0", 0, 60); fitFun->SetLineColor(4); geB->Fit("fitFun","R+"); fitFun->Draw("same"); cout<<fitFun->Eval(2.5)<<", "<<fitFun->Eval(7.5)<<", "<<fitFun->Eval(45)<<", "<<fitFun->Eval(55)<<endl; } double chi2 = fitFun->GetChisquare(); double ndf = fitFun->GetNDF(); TLatex *tex = new TLatex(10.06,0.6,Form("#chi^{2}/ndf = %2.1f", chi2/ndf)); //tex->SetNDC(); //tex->SetTextFont(42); tex->SetTextColor(2); tex->SetTextSize(16); //tex->SetLineWidth(2); tex->Draw("same"); //TLatex *text = new TLatex(); //text->DrawTextNDC(10.12, 1.14, "D0 Preliminary"); /* double p0 = fitFun->GetParameter(0); double p0Err = fitFun->GetParError(0); TLine *linesErrP = new TLine(0,p0+p0Err,60,p0+p0Err); linesErrP->SetLineStyle(2); linesErrP->SetLineWidth(1); linesErrP->SetLineColor(2); linesErrP->Draw(); TLine *linesErrM = new TLine(0,p0-p0Err,60,p0-p0Err); linesErrM->SetLineStyle(2); linesErrM->SetLineWidth(1); linesErrM->SetLineColor(2); linesErrM->Draw(); */ } //end new can->cd(); TLatex * tex = new TLatex(0.06,0.97,"CMS"); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.034); tex->SetLineWidth(2); tex->Draw(); TLatex * tex = new TLatex(0.108,0.97,"Preliminary"); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.044); tex->SetLineWidth(2); //tex->Draw(); TLatex * tex = new TLatex(0.24,0.970,"0.3<p_{T}<3.0 GeV/c |#eta|<0.8"); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.044); tex->SetLineWidth(2); tex->Draw(); cout << "end of process" << endl; can->cd(); can->Print("./figures/plot_chicent_trkSys_ratio.png"); can->Print("./figures/plot_chicent_trkSys_ratio.pdf"); }
TCanvas *drawRatioPlot(TH1D *prediction, TH1D *sr, TH1D *data, TString xTitle, TString filename, double ecaloCut){ gStyle -> SetPadLeftMargin(0.20); data->SetMarkerStyle(20); data->SetMarkerColor(kGreen); data->SetLineColor(kGreen); TCanvas *c = new TCanvas("c"+filename,"c",0,0,500,500); float y = 0.3; TPad *pad1 = new TPad("pad1", "Control Plots 1", 0.01, y, 0.99, 0.99); TPad *padRatio = new TPad("rp1", "Ratio1", 0.01, 0.01, 0.99, y-0.01); pad1->SetNumber(100); pad1->SetTicks(0,1); cout<<"number pad1 = "<<pad1->GetNumber()<<endl; cout<<"number padRatio = "<<padRatio->GetNumber()<<endl; TH1D *ratio = 0; //ratio = (TH1D*) sr->Clone(); //ratio->Divide(prediction); ratio = (TH1D*) prediction->Clone(); ratio->Divide(data); for(int i=1; i<=ratio->GetNbinsX();i++){ if(ratio->GetBinContent(i) != 0){ cout<<"N in CR in "<<i<<". bin ="<<prediction->GetBinContent(i)<<endl; cout<<"N in SR in "<<i<<". bin ="<<sr->GetBinContent(i)<<endl; cout<<"Rel. difference in "<<i<<". bin ="<<(1./ratio->GetBinContent(i)-1.)*100<<"%"<<endl; } else if(sr->GetBinContent(i) == 0 && prediction->GetBinContent(i) !=0) cout<<"Scaling Factor in "<<i<<". bin <"<<prediction->GetBinContent(i)/1.15<<" +/- "<<ratio->GetBinError(i)<<endl; else if(sr->GetBinContent(i) != 0 && prediction->GetBinContent(i) ==0) cout<<"Scaling Factor in "<<i<<". bin <"<<(sr->GetEntries()/prediction->GetEntries())/sr->GetBinContent(i)<<" +/- "<<ratio->GetBinError(i)<<endl; } ratio->GetYaxis()->SetTitle("#frac{CR (MC)}{CR (data)}"); ratio->SetTitle(""); ratio->SetLabelSize(0.1,"X"); ratio->SetLabelSize(0.1,"Y"); ratio->SetTitleOffset(0.5,"Y"); ratio->SetTitleSize(0.15,"Y"); padRatio->cd(); //ratio->GetYaxis()->SetRangeUser(0,2); ratio->Draw("e"); // Draw line at one! float xmin = ratio->GetXaxis()->GetXmin(); float xmax = ratio->GetXaxis()->GetXmax(); TLine *line = new TLine(xmin,1,xmax,1); line->SetLineWidth(2); line->Draw("same"); padRatio->Modified(); TLegend *leg = new TLegend(0.5,0.7,0.9,0.9); leg->AddEntry(sr,"SR (MC)","l"); leg->AddEntry(prediction,"lepton CR (MC)","pel"); pad1->cd(); pad1->SetLogy(); // pad1->SetLogx(); sr->SetLineColor(kRed); sr->SetMarkerColor(kRed); sr->SetMarkerStyle(20); sr->SetTitle(""); prediction->SetMarkerStyle(20); prediction->SetTitle(""); prediction->GetXaxis()->SetTitle(xTitle); sr->GetXaxis()->SetTitle(xTitle); prediction->SetTitleSize(0.07,"X"); prediction->GetXaxis()->SetTitleOffset(0.7); sr->SetTitleSize(0.07,"X"); sr->GetXaxis()->SetTitleOffset(0.7); double maximum = 0; double minimum = 1000000; if(sr->GetMinimum()!=0 && sr->GetMinimum()<minimum){ minimum=sr->GetMinimum()*0.5; } if(prediction->GetMinimum()!=0 && prediction->GetMinimum()<minimum){ minimum=prediction->GetMinimum()*0.5; } if(data->GetMinimum()!=0 && data->GetMinimum()<minimum){ minimum=data->GetMinimum()*0.5; } if(sr->GetMaximum()>maximum){ maximum=sr->GetMaximum()*2.5; } if(prediction->GetMaximum()>maximum){ maximum=prediction->GetMaximum()*2.5; } if(data->GetMaximum()>maximum){ maximum=data->GetMaximum()*2.5; } prediction->GetYaxis()->SetRangeUser(minimum,maximum); ratio->GetYaxis()->SetRangeUser(0,2); prediction->Draw("e"); sr->Draw("e same"); leg->AddEntry(data,"lepton CR (data)","pel"); data->Draw("e same"); leg->Draw("same"); TLatex* info1 = new TLatex(); info1->SetTextFont(132); info1-> SetNDC(); info1->SetTextSize(0.06); info1->DrawLatex(0.55,0.62,Form("E_{calo}<%.0fGeV",ecaloCut)); // Draw both pads to canvas c->cd(); pad1->Draw(); padRatio->SetGridy(); padRatio->Draw(); c->SaveAs(filename); return c; }
void scan_contours(TString infile = "test.root") { gROOT->LoadMacro("CMS_lumi.C"); cmsText = "CMS Phase II Simulation"; writeExtraText = false; // if extra text // extraText = "Preliminary"; // default extra text is "Preliminary" lumi_14TeV = ""; // lumi_14TeV = "300 fb^{-1}, PU = 50"; // default is "3000 fb^{-1}" lumi_14TeV = "3000 fb^{-1}, PU = 140"; // default is "3000 fb^{-1}" TCanvas* c1 = new TCanvas("c1","c1",800,600); TFile* f = new TFile(infile); // TH2F* h_base = new TH2F("h_base","", 11, -50, 1050, 11, -50, 1050); TH2F* h_base = new TH2F("h_base",";m_{#tilde{#chi}_{1}^{#pm}} = m_{#tilde{#chi}_{2}^{0}} (GeV); m_{#tilde{#chi}_{1}^{0}} (GeV)", 90, 100, 1000, 100, 0, 1000); h_base->GetXaxis()->SetNdivisions(8,5,0); h_base->GetYaxis()->SetNdivisions(8,5,0); h_base->Draw(); // double contours[1] = {1.0}; // TH2F * contour_12p5 = (TH2F*) h_disc12p5->Clone("contour_12p5"); // contour_12p5->SetContour(1,contours); // contour_12p5->SetLineWidth(3); // contour_12p5->SetLineColor(kBlue); // contour_12p5->Smooth(1,"k3a"); // TH2F * contour_25 = (TH2F*) h_disc25->Clone("contour_25"); // contour_25->SetContour(1,contours); // contour_25->SetLineWidth(3); // contour_25->SetLineColor(kRed); // contour_25->Smooth(1,"k3a"); double contours_disc[1] = {5.0}; // double contours_exc[1] = {2.0}; double contours_exc[1] = {1.0}; TH2F * disc_contour_12p5 = (TH2F*) h_signif12p5_all->Clone("disc_contour_12p5"); disc_contour_12p5->SetContour(1,contours_disc); disc_contour_12p5->SetLineWidth(3); disc_contour_12p5->SetLineStyle(3); disc_contour_12p5->SetLineColor(kBlue); disc_contour_12p5->Smooth(1,"k3a"); // disc_contour_12p5->Smooth(1,"k5a"); trim_diagonal(disc_contour_12p5); TH2F * disc_contour_25 = (TH2F*) h_signif25_all->Clone("disc_contour_25"); disc_contour_25->SetContour(1,contours_disc); disc_contour_25->SetLineWidth(3); disc_contour_25->SetLineColor(kBlue); disc_contour_25->Smooth(1,"k3a"); //disc_contour_25->Smooth(1,"k5a"); trim_diagonal(disc_contour_25); TH2F * exc_contour_12p5 = (TH2F*) h_rinv12p5_all->Clone("exc_contour_12p5"); //TH2F * exc_contour_12p5 = (TH2F*) h_signif12p5_all->Clone("exc_contour_12p5"); exc_contour_12p5->SetContour(1,contours_exc); exc_contour_12p5->SetLineWidth(3); exc_contour_12p5->SetLineStyle(3); exc_contour_12p5->SetLineColor(kRed); exc_contour_12p5->Smooth(1,"k3a"); //exc_contour_12p5->Smooth(1,"k5a"); trim_diagonal(exc_contour_12p5); TH2F * exc_contour_25 = (TH2F*) h_rinv25_all->Clone("exc_contour_25"); // TH2F * exc_contour_25 = (TH2F*) h_signif25_all->Clone("exc_contour_25"); exc_contour_25->SetContour(1,contours_exc); exc_contour_25->SetLineWidth(3); exc_contour_25->SetLineColor(kRed); exc_contour_25->Smooth(1,"k3a"); //exc_contour_25->Smooth(1,"k5a"); trim_diagonal(exc_contour_25); TLine* diag = new TLine(125.,0.,675.,550.); // TLine* diag = new TLine(125.,0.,1000.,875.); diag->SetLineWidth(3); diag->SetLineStyle(2); diag->SetLineColor(kBlack); disc_contour_12p5->Draw("cont3 same"); disc_contour_25->Draw("cont3 same"); exc_contour_12p5->Draw("cont3 same"); exc_contour_25->Draw("cont3 same"); TFile* fold = new TFile("limits_wh.root"); observed->SetLineColor(kGreen+2); observed->Draw("same"); diag->Draw("same"); // TLegend* leg = new TLegend(0.19,0.68,0.54,0.92); //TLegend* leg = new TLegend(0.19,0.68,0.54,0.85); TLegend* leg = new TLegend(0.19,0.61,0.54,0.85); leg->SetFillColor(0); leg->SetTextSize(0.035); leg->AddEntry(observed,"2012 Observed 95% CL Exclusion ","l"); leg->AddEntry(exc_contour_12p5,"3000fb^{-1} 95% CL Exclusion, 12.5% syst","l"); leg->AddEntry(exc_contour_25,"3000fb^{-1} 95% CL Exclusion, 25% syst","l"); leg->AddEntry(disc_contour_12p5,"3000fb^{-1} 5#sigma Discovery, 12.5% syst","l"); leg->AddEntry(disc_contour_25,"3000fb^{-1} 5#sigma Discovery, 25% syst","l"); // leg->AddEntry(exc_contour_12p5,"300fb^{-1} 95% CL Exclusion, 12.5% syst","l"); // leg->AddEntry(exc_contour_25,"300fb^{-1} 95% CL Exclusion, 25% syst","l"); // leg->AddEntry(disc_contour_12p5,"300fb^{-1} 5#sigma Discovery, 12.5% syst","l"); // leg->AddEntry(disc_contour_25,"300fb^{-1} 5#sigma Discovery, 25% syst","l"); leg->Draw("same"); CMS_lumi( c1, iPeriod, iPos ); gPad->SetRightMargin(0.05); gPad->Modified(); }
//___________________________________________________________________________________ void CalibMwpcNaI(const Int_t ii, const Int_t opt, TH1D &*h1, TH2D &*h2, TGraphErrors &*grMean, TGraphErrors &*grSigma) { // General style // gROOT->ProcessLine(".x Style_Default_2.C"); // gROOT->SetStyle("Default_2"); // gROOT->ForceStyle(); // TGraphErrors *grMean, *grSigma; TCanvas *cnv; TH1D *h1; TH2D *h2; TLine *lZ = new TLine(-300.,0.,300.,0.); lZ->SetLineColor(kBlue); lZ->SetLineWidth(2.); TLine *lTheta = new TLine(0.,0.,180.,0.); lTheta->SetLineColor(kBlue); lTheta->SetLineWidth(2.); TLine *lPhi = new TLine(0.,0.,360.,0.); lPhi->SetLineColor(kBlue); lPhi->SetLineWidth(2.); // TString i; stringstream ss; ss << ii; ss >> i; // switch (opt) { case 1: // dPhi Mwpc-NaI cnv = new TCanvas("dPhi"+i); h1 = (TH1D*)gDirectory->Get("GeomCalib_DphiMwpc"+i+"NaI"); h1->Draw(); h1->Fit("gaus","","",-1.8,1.8); // hDphi->Fit("gaus"); // dPhi(Z) cnv = new TCanvas("dPhi_VS_Z"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiMwpc"+i+"NaI_v_Z0Mwpc"+i+"NaI"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-10.,10.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("dPhi_Sigma_vs_Z"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma_{#Delta#varphi}, degrees"); h1->SetTitle("dPhi(Z), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("dPhi_Mean_vs_Z"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("dPhi(Z), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); break; case 2: // dX cnv = new TCanvas("dX"+i); h1 = (TH1D*)gDirectory->Get("GeomCalib_DxMwpc"+i+"NaI"); h1->Draw(); h1->Fit("gaus","","",-20.,20.); // dX(Z) cnv = new TCanvas("dX_VS_Z"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DxMwpc"+i+"NaI_v_Z0Mwpc"+i+"NaI"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("dX_Sigma_vs_Z"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma_{#DeltaX}, mm"); h1->SetTitle("dX(Z), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("dX_Mean_vs_Z"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dX(Z), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 3: // dY cnv = new TCanvas("dY"+i); h1 = (TH1D*)gDirectory->Get("GeomCalib_DyMwpc"+i+"NaI"); h1->Draw(); h1->Fit("gaus","","",-60.,60.); // dY(Z) cnv = new TCanvas("dY_VS_Z"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DyMwpc"+i+"NaI_v_Z0Mwpc"+i+"NaI"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-70.,70.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("dY_Sigma_vs_Z"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,40.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma_{#DeltaY}, mm"); h1->SetTitle("dY(Z), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("dY_Mean_vs_Z"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dY(Z), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 4: // dZ cnv = new TCanvas("dZ"+i); h1 = (TH1D*)gDirectory->Get("GeomCalib_DzMwpc"+i+"NaI"); h1->Draw(); h1->Fit("gaus","","",-10.,10.); // dZ(Z) cnv = new TCanvas("dZ_VS_Z"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DzMwpc"+i+"NaI_v_Z0Mwpc"+i+"NaI"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("dZ_Sigma_vs_Z"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma_{#DeltaZ}, mm"); h1->SetTitle("dZ(Z), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("dZ_Mean_vs_Z"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dZ(Z), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); // dZ(Theta) cnv = new TCanvas("dZ_VS_Theta"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DzMwpc"+i+"NaI_v_ThetaTracksMwpc"+i+"NaI"); h2->Draw("color"); lTheta->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("dZ_Sigma_vs_Theta"+i); h1 = (TH1D*)cnv->DrawFrame(0.,0.,180.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dZ(#theta), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("dZ_Mean_vs_Theta"+i); h1 = (TH1D*)cnv->DrawFrame(0.,-30.,180.,30.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dZ(#theta), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); break; case 5: // dPhi tracks cnv = new TCanvas("dPhiTracks"+i); h1 = (TH1D*)gDirectory->Get("GeomCalib_DPhiTracksMwpc"+i+"NaI"); h1->Draw(); h1->Fit("gaus","","",-5.,5.); // dPhi tracks (Theta) cnv = new TCanvas("dPhiTracks_v_Theta"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DPhiTracksMwpc"+i+"NaI_v_ThetaTracksMwpc"+i+"NaI"); h2->Draw("color"); lTheta->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("Sigma_dPhiTracks_v_Theta"+i); h1 = (TH1D*)cnv->DrawFrame(0.,0.,180.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("Standard deviation of #Delta#Phi as a function of #theta, MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("Mean_dPhi_vs_Theta"+i); h1 = (TH1D*)cnv->DrawFrame(0.,-30.,180.,30.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("#Delta#Phi(#theta), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 6: // dTheta tracks cnv = new TCanvas("dTetTracks"+i); h1 = (TH1D*)gDirectory->Get("GeomCalib_DTetTracksMwpc"+i+"NaI"); h1->Draw(); h1->Fit("gaus","","",-3.,3.); // dTheta tracks (Theta) cnv = new TCanvas("dTetTracks_v_Theta"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DTetTracksMwpc"+i+"NaI_v_ThetaTracksMwpc"+i+"NaI"); h2->Draw("color"); lTheta->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("Sigma_dThetaTracks_v_Theta"+i); h1 = (TH1D*)cnv->DrawFrame(0.,0.,180.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("Standard deviation of #Delta#theta as a function #theta, MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("Mean_dTheta_vs_Theta"+i); h1 = (TH1D*)cnv->DrawFrame(0.,-30.,180.,30.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("#Delta#theta(#theta), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 7: // dPsi tracks cnv = new TCanvas("dPsiTracks"+i); h1 = (TH1D*)gDirectory->Get("GeomCalib_DPsiTracksMwpc"+i+"NaI"); h1->Draw(); break; case 8: // dZ vs Zinter cnv = new TCanvas("Dz_vs_Zinter"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DzInterMwpc"+i+"NaI_v_ZinterMwpc"+i+"NaI"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("Sigma_dZ_vs_Zinter"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("Dz(Zinter), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("Mean_dZ_vs_Zinter"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("Dz(Zinter), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol1","","",-280.,280.); grMean->Draw("P"); break; case 9: // dX vs Zinter cnv = new TCanvas("Dx_vs_Zinter"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DxInterMwpc"+i+"NaI_v_ZinterMwpc"+i+"NaI"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-40.,40.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDx_vs_Zinter"+i); h1 = (TH1D*)cnv->DrawFrame(-400.,0.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dX(Zinter), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDx_vs_Zinter"+i); h1 = (TH1D*)cnv->DrawFrame(-400.,-10.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dX(Zinter), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 10: // dY vs Zinter cnv = new TCanvas("Dy_vs_Zinter"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DyInterMwpc"+i+"NaI_v_ZinterMwpc"+i+"NaI"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-10.,10.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDy_vs_Zinter"+i); h1 = (TH1D*)cnv->DrawFrame(-400.,0.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dY(Zinter), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDy_vs_Zinter"+i); h1 = (TH1D*)cnv->DrawFrame(-400.,-10.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dY(Zinter), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 11: // dZ vs PhiInter cnv = new TCanvas("Dz_vs_PhiInter"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DzInterMwpc"+i+"NaI_v_PhiInterMwpc"+i+"NaI"); h2->Draw("color"); lPhi->Draw("same"); // SliceH2(h2,"y",20,-40.,40.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDz_vs_PhiInter"+i); h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,40.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dZ(PhiInter), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDz_vs_PhiInter"+i); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dZ(PhiInter), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); break; case 12: // dX vs PhiInter cnv = new TCanvas("Dx_vs_PhiInter"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DxInterMwpc"+i+"NaI_v_PhiInterMwpc"+i+"NaI"); h2->Draw("color"); lPhi->Draw("same"); // SliceH2(h2,"y",20,-40.,40.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDx_vs_PhiInter"+i); h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dX(PhiInter), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDx_vs_PhiInter"+i); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dX(PhiInter), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 13: // dY vs PhiInter cnv = new TCanvas("Dy_vs_PhiInter"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DyInterMwpc"+i+"NaI_v_PhiInterMwpc"+i+"NaI"); h2->Draw("color"); lPhi->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDy_vs_PhiInter"+i); h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dY(PhiInter), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDy_vs_PhiInter"+i); h1 = (TH1D*)cnv->DrawFrame(0.,-20.,360.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dY(PhiInter), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 14: // dPhi vs PhiInter cnv = new TCanvas("Dphi_vs_PhiInter"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiInterMwpc"+i+"NaI_v_PhiInterMwpc"+i+"NaI"); h2->Draw("color"); lPhi->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDphi_vs_PhiInter"+i); h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("dPhi(PhiInter), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDphi_vs_PhiInter"+i); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("dPhi(PhiInter), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); break; case 15: // dPhi vs Zinter cnv = new TCanvas("Dphi_vs_Zinter"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiInterMwpc"+i+"NaI_v_ZinterMwpc"+i+"NaI"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDphi_vs_Zinter"+i); h1 = (TH1D*)cnv->DrawFrame(-400.,0.,400.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("dPhi(Zinter), MWPC-"+i); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDphi_vs_Zinter"+i); h1 = (TH1D*)cnv->DrawFrame(-400.,-10.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("dPhi(Zinter), MWPC-"+i); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); break; default: for (Int_t j=1; j<=20; ++j) CalibMwpcNaI(i,j,0,0,0,0); } }
//___________________________________________________________________________________ void CalibEI(const Int_t ii, const Int_t opt) { // i - # of the MWPC // opt - option to plot TGraphErrors *grMean, *grSigma; TCanvas *cnv; TH1D *h1; TH2D *h2; TH3D *h3; TLine *lZ = new TLine(-300.,0.,300.,0.); lZ->SetLineColor(kBlue); lZ->SetLineWidth(2.); TLine *lPhi = new TLine(0.,0.,360.,0.); lPhi->SetLineColor(kBlue); lPhi->SetLineWidth(2.); // TString i; stringstream ss; ss << ii; ss >> i; // switch (opt) { case 1: // dPhiEI cnv = new TCanvas("cEI"+i); h1 = (TH1D*)gDirectory->Get("GeomCalib_DphiEI"+i); h1->Draw(); h1->Fit("gaus","","",-.6,.6); // hEI->Fit("gaus"); break; case 2: // dPhiEI(Z) cnv = new TCanvas("cEIZ"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_ZInters"+i); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-1.,1.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("cEIZ_Sigma"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("dPhiEI(Z)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("cEIZ_Mean"+i); h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("dPhiEI(Z)"); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); break; case 3: // dPhiEI(Phi) cnv = new TCanvas("cEIPhi"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_PhiEI"+i); h2->Draw("color"); lPhi->Draw("same"); // SliceH2(h2,"y",20,-1.,1.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("cEIPhi_Sigma"+i); h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("dPhiEI(Phi)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("cEIPhi_Mean"+i); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("dPhiEI(Phi)"); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); break; case 23: cnv = new TCanvas("cEIPhi_v_Phi_v_Z"+i); h3 = (TH3D*)gDirectory->Get("dPhiEI_PhiEI_Zinters_"+i); TF2 *f2 = new TF2("f1", "[0]+x*[1]+y*[2]",0.,360.,-250,250.); h3->Fit(f2); h3->Draw("same"); break; case 4: // dPhiEI(CGW) cnv = new TCanvas("cEIPhi_v_CGW"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_CGclW"+i); h2->Draw("color"); lPhi->Draw("same"); break; case 5: // dPhiEI(CGI) cnv = new TCanvas("cEIPhi_v_CGI"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_CGclI"+i); h2->Draw("color"); lPhi->Draw("same"); break; case 6: // dPhiEI(CGE) cnv = new TCanvas("cEIPhi_v_CGE"+i); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_CGclE"+i); h2->Draw("color"); lPhi->Draw("same"); break; default: for (Int_t j=1; j<=6; ++j) CalibEI(i,j); } }
//___________________________________________________________________________________ void CalibMwpc(const Int_t opt, TH1D &*h1, TH2D &*h2, TGraphErrors &*grMean, TGraphErrors &*grSigma) { // General style // gROOT->ProcessLine(".x Style_Default_2.C"); // gROOT->SetStyle("Default_2"); // gROOT->ForceStyle(); // TCanvas *cnv; TLine *lZ = new TLine(-300.,0.,300.,0.); lZ->SetLineColor(kBlue); lZ->SetLineWidth(2.); TLine *lTheta = new TLine(0.,0.,180.,0.); lTheta->SetLineColor(kBlue); lTheta->SetLineWidth(2.); TLine *lPhi = new TLine(0.,0.,360.,0.); lPhi->SetLineColor(kBlue); lPhi->SetLineWidth(2.); // switch (opt) { case 1: // dPhi MWPC1 - MWPC0 cnv = new TCanvas("dPhi"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DphiMwpc21"); h1->Draw(); h1->Fit("gaus","","",-1.,1.); // dPhi(Z) cnv = new TCanvas("dPhi_VS_Z"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiMwpc21_v_Z0Mwpc21"); h2->Draw("color"); lZ->Draw("same"); break; case 2: // dX cnv = new TCanvas("dX"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DxMwpc21"); h1->Draw(); h1->Fit("gaus","","",-2.,2.); // dX(Z) cnv = new TCanvas("dX_VS_Z"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DxMwpc21_v_Z0Mwpc21"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-5.,5.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDx_vs_Z"); h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,5.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dX(Z)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDx_vs_Z"); h1 = (TH1D*)cnv->DrawFrame(-300.,-3.,300.,3.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dX(Z)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 3: // dY cnv = new TCanvas("dY"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DyMwpc21"); h1->Draw(); h1->Fit("gaus","","",-10.,10.); // dY(Z) cnv = new TCanvas("dY_VS_Z"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DyMwpc21_v_Z0Mwpc21"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-10.,10.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDy_vs_Z"); h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,15.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dY(Z)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDy_vs_Z"); h1 = (TH1D*)cnv->DrawFrame(-300.,-5.,300.,5.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dY(Z)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 4: // dZ cnv = new TCanvas("dZ"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DzMwpc21"); h1->Draw(); h1->Fit("gaus","","",-3.,3.); // dZ(Z) cnv = new TCanvas("dZ_VS_Z"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DzMwpc21_v_Z0Mwpc21"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-5.,5.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDz_vs_Z"); h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,5.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dZ(Z)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDz_vs_Z"); h1 = (TH1D*)cnv->DrawFrame(-300.,-3.,300.,3.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dZ(Z)"); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); // dZ(Theta) cnv = new TCanvas("dZ_VS_Theta"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DzMwpc21_v_ThetaTracks"); h2->Draw("color"); lTheta->Draw("same"); // SliceH2(h2,"y",20,-10.,10.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDz_vs_Theta"); h1 = (TH1D*)cnv->DrawFrame(0.,0.,180.,5.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dZ(Theta)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDz_vs_Theta"); h1 = (TH1D*)cnv->DrawFrame(0.,-3.,180.,3.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("Theta, degrees"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dZ(Theta)"); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); break; case 5: // dPhi tracks cnv = new TCanvas("dPhiTracks"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DPhiTracks"); h1->Draw(); h1->Fit("gaus","","",-10.,10.); // dPhi tracks (Theta) cnv = new TCanvas("dPhiTracks_v_Theta"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DPhiTracks_v_ThetaTracks"); h2->Draw("color"); lTheta->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDphiTracks_v_Theta"); h1 = (TH1D*)cnv->DrawFrame(0.,0.,180.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("Standard deviation of #Delta#Phi as a function #theta"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDphiTracks_v_Theta"); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,180.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("#Delta#Phi(#theta)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 6: // dTheta tracks cnv = new TCanvas("dTetTracks"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DTetTracks"); h1->Draw(); h1->Fit("gaus","","",-7.,7.); // dTheta tracks (Theta) cnv = new TCanvas("dTetTracks_v_Theta"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DTetTracks_v_ThetaTracks"); h2->Draw("color"); lTheta->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDthetaTracks_v_Theta"); h1 = (TH1D*)cnv->DrawFrame(0.,0.,180.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("Standard deviation of #Delta#theta as a function of #theta"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDthetaTracks_v_Theta"); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,180.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("#Delta#theta(#theta)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 66: // dTheta2 tracks2 cnv = new TCanvas("dTetTracks2"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DTetTracks2"); h1->Draw(); h1->Fit("gaus","","",-7.,7.); // dTheta tracks (Theta) cnv = new TCanvas("dTetTracks2_v_Theta2"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DTetTracks2_v_ThetaTracks2"); h2->Draw("color"); lTheta->Draw("same"); // SliceH2(h2,"y",20,-50.,50.,TMath::Sqrt(2.),grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDthetaTracks2_v_Theta2"); h1 = (TH1D*)cnv->DrawFrame(0.,0.,180.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("Standard deviation of #Delta#theta as a function of #theta"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDthetaTracks2_v_Theta2"); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,180.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#theta, degrees"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("#Delta#theta(#theta)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 7: // dPsi tracks cnv = new TCanvas("dPsiTracks"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DPsiTracks"); h1->Draw(); break; case 8: // dZ vs Zinter cnv = new TCanvas("DzInterMwpc1"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DzInterMwpc1"); h1->Draw(); h1->Fit("gaus","","",-3.,3.); // cnv = new TCanvas("Dz_vs_Zinter"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DzInterMwpc1_v_ZinterMwpc1"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-10.,10.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDz_vs_Zinter"); h1 = (TH1D*)cnv->DrawFrame(-400.,0.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dZ(Zinter)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDz_vs_Zinter"); h1 = (TH1D*)cnv->DrawFrame(-400.,-10.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dZ(Zinter)"); grMean->SetMarkerStyle(20); grMean->Fit("pol1"); grMean->Draw("P"); break; case 9: // dX vs Zinter cnv = new TCanvas("DxInterMwpc1"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DxInterMwpc1"); h1->Draw(); h1->Fit("gaus","","",-2.5,2.5); // cnv = new TCanvas("Dx_vs_Zinter"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DxInterMwpc1_v_ZinterMwpc1"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-10.,10.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDx_vs_Zinter"); h1 = (TH1D*)cnv->DrawFrame(-400.,0.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dX(Zinter)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDx_vs_Zinter"); h1 = (TH1D*)cnv->DrawFrame(-400.,-10.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dX(Zinter)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 10: // dY vs Zinter cnv = new TCanvas("DyInterMwpc1"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DyInterMwpc1"); h1->Draw(); h1->Fit("gaus","","",-.2,.2); // cnv = new TCanvas("Dy_vs_Zinter"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DyInterMwpc1_v_ZinterMwpc1"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-5.,5.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDy_vs_Zinter"); h1 = (TH1D*)cnv->DrawFrame(-400.,0.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dY(Zinter)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDy_vs_Zinter"); h1 = (TH1D*)cnv->DrawFrame(-400.,-10.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dY(Zinter)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 11: // dZ vs PhiInter cnv = new TCanvas("Dz_vs_PhiInter"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DzInterMwpc1_v_PhiInterMwpc1"); h2->Draw("color"); lPhi->Draw("same"); // SliceH2(h2,"y",20,-5.,5.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDz_vs_PhiInter"); h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dZ(PhiInter)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDz_vs_PhiInter"); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dZ(PhiInter)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 12: // dX vs PhiInter cnv = new TCanvas("Dx_vs_PhiInter"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DxInterMwpc1_v_PhiInterMwpc1"); h2->Draw("color"); lPhi->Draw("same"); // SliceH2(h2,"y",20,-10.,10.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDx_vs_PhiInter"); h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dX(PhiInter)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDx_vs_PhiInter"); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dX(PhiInter)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 13: // dY vs PhiInter cnv = new TCanvas("Dy_vs_PhiInter"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DyInterMwpc1_v_PhiInterMwpc1"); h2->Draw("color"); lPhi->Draw("same"); // SliceH2(h2,"y",20,-5.,5.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDy_vs_PhiInter"); h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("#sigma, mm"); h1->SetTitle("dY(PhiInter)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDy_vs_PhiInter"); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("Mean, mm"); h1->SetTitle("dY(PhiInter)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 14: // dPhi vs PhiInter cnv = new TCanvas("dPhiInter"); h1 = (TH1D*)gDirectory->Get("GeomCalib_DphiInterMwpc1"); h1->Draw(); h1->Fit("gaus","","",-1.,1.); // cnv = new TCanvas("Dphi_vs_PhiInter"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiInterMwpc1_v_PhiInterMwpc1"); h2->Draw("color"); lPhi->Draw("same"); // SliceH2(h2,"y",20,-5.,5.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDphi_vs_PhiInter"); h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("dPhi(PhiInter)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDphi_vs_PhiInter"); h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("#varphi, degrees"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("dPhi(PhiInter)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; case 15: // dPhi vs Zinter cnv = new TCanvas("Dphi_vs_Zinter"); h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiInterMwpc1_v_ZinterMwpc1"); h2->Draw("color"); lZ->Draw("same"); // SliceH2(h2,"y",20,-5.,5.,1.,grMean,grSigma); // Sigma cnv = new TCanvas("SigmaDphi_vs_Zinter"); h1 = (TH1D*)cnv->DrawFrame(-400.,0.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("#sigma, degrees"); h1->SetTitle("dPhi(Zinter)"); grSigma->SetMarkerStyle(20); grSigma->Draw("P"); // Mean cnv = new TCanvas("MeanDphi_vs_Zinter"); h1 = (TH1D*)cnv->DrawFrame(-400.,-10.,400.,10.); cnv->GetFrame()->SetFillColor(0); cnv->GetFrame()->SetBorderSize(0); h1->SetXTitle("z, mm"); h1->SetYTitle("Mean, degrees"); h1->SetTitle("dPhi(Zinter)"); grMean->SetMarkerStyle(20); grMean->Fit("pol0"); grMean->Draw("P"); break; default: // Plot all for (Int_t i=1; i<=20; ++i) CalibMwpc(i,0,0,0,0); } }
void plotRBDphi( double dphiCut=3.026, // double dphiCut=2.094, double dphiCut2 = 3.026, TString infname = "data.root", TString pythia = "pythia.root", TString mix = "mix.root", bool useWeight = true, bool drawXLabel = false, bool drawLeg = true) { useWeight = 0; int threshold1 = 80; int threshold2 = 120; gStyle->SetErrorX(0); TString cut1=Form("abs(eta1) < 2 && abs(eta2) < 2 && et1>%d&&et2>50",threshold1); TString cut2=Form("abs(eta1) < 2 && abs(eta2) < 2 && et1>%d&&et2>50",threshold2); cout <<cut1.Data()<<endl; cout <<cut2.Data()<<endl; TString trigcut = ""; TString cstring = ""; // open the data file TFile *inf = new TFile(infname.Data()); TTree *nt =(TTree*)inf->FindObjectAny("nt"); // open the pythia (MC) file TFile *infPythia = new TFile(pythia.Data()); TTree *ntPythia = (TTree*) infPythia->FindObjectAny("nt"); // open the datamix file TFile *infMix = new TFile(mix.Data()); TTree *ntMix =(TTree*)infMix->FindObjectAny("nt"); // open output TFile *outfile = new TFile("output.root","recreate"); TNtuple *ntOut = new TNtuple("ntOut","","npart"); nt->SetAlias("et1","pt1"); nt->SetAlias("et2","pt2"); ntMix->SetAlias("et1","pt1"); ntMix->SetAlias("et2","pt2"); ntPythia->SetAlias("et1","pt1"); ntPythia->SetAlias("et2","pt2"); // ntMix->SetAlias("pt1","et1"); // ntMix->SetAlias("pt2","et2"); // ntPythia->SetAlias("pt1","et1"); // ntPythia->SetAlias("pt2","et2"); ntPythia->SetAlias("weight","1"); ntMix->SetAlias("weight","1"); const int nBin = 6; double m[nBin+1] = {-1.5,-0.5,3.5,7.5,11.5,20.5,40.5}; double npart[nBin] = {2,358.623,232.909,97.9521}; double npart2[nBin] = {2,358.623,232.909,97.9521}; double npartValue[40]; npartValue[0] = 393.633; npartValue[1] = 368.819; npartValue[2] = 343.073; npartValue[3] = 317.625; npartValue[4] = 292.932; npartValue[5] = 271.917; npartValue[6] = 249.851; npartValue[7] = 230.72; npartValue[8] = 212.465; npartValue[9] = 194.752; npartValue[10] = 178.571; npartValue[11] = 163.23; npartValue[12] = 149.187; npartValue[13] = 136.011; npartValue[14] = 123.414; npartValue[15] = 111.7; npartValue[16] = 100.831; npartValue[17] = 90.7831; npartValue[18] = 80.9823; npartValue[19] = 72.6236; npartValue[20] = 64.1508; npartValue[21] = 56.6284; npartValue[22] = 49.9984; npartValue[23] = 43.3034; npartValue[24] = 37.8437; npartValue[25] = 32.6659; npartValue[26] = 27.83; npartValue[27] = 23.7892; npartValue[28] = 20.1745; npartValue[29] = 16.8453; npartValue[30] = 14.0322; npartValue[31] = 11.602; npartValue[32] = 9.52528; npartValue[33] = 7.6984; npartValue[34] = 6.446; npartValue[35] = 4.96683; npartValue[36] = 4.23649; npartValue[37] = 3.50147; npartValue[38] = 3.16107; npartValue[39] = 2.7877; TH1D *hTmp = new TH1D("hTmp","",100,-10,400); TH1D *h = new TH1D("h","",nBin,m); TH1D *hCut = new TH1D("hCut","",nBin,m); TH1D *h2 = new TH1D("h2","",nBin,m); TH1D *h2Cut = new TH1D("h2Cut","",nBin,m); TH1D *hStat = new TH1D("hStat","",nBin,m); TH1D *hNpartSum = new TH1D("hNpartSum","",nBin,m); TH1D *hStat2 = new TH1D("hStat2","",nBin,m); TH1D *hNpartSum2 = new TH1D("hNpartSum2","",nBin,m); Float_t bin=0; Float_t et1=0; nt->SetBranchAddress("bin",&bin); nt->SetBranchAddress("pt1",&et1); for (int i=0;i<nt->GetEntries();i++) { nt->GetEntry(i); if (et1<threshold1) continue; if (et1>threshold2) { hNpartSum2->Fill(bin,npartValue[(int)bin]); hStat2->Fill(bin); if (et1>threshold1) { hNpartSum->Fill(bin,npartValue[(int)bin]); hStat->Fill(bin); } } } hNpartSum->Divide(hStat); hNpartSum2->Divide(hStat2); for (int i=1;i<nBin;i++) { cout <<hNpartSum->GetBinContent(i+1)<<endl; npart[i]=hNpartSum->GetBinContent(i+1); cout <<hNpartSum2->GetBinContent(i+1)<<endl; npart2[i]=hNpartSum2->GetBinContent(i+1); } nt->Draw("bin>>h",Form("abs(dphi)>%f&&%s",dphiCut,cut1.Data())); nt->Draw("bin>>hCut",Form("%s",cut1.Data())); TGraphAsymmErrors *g = calcEff(hCut,h,npart); g->SetMarkerSize(1.25); cout <<cut2.Data()<<endl; nt->Draw("bin>>h2",Form("abs(dphi)>%f&&%s",dphiCut2,cut2.Data())); nt->Draw("bin>>h2Cut",Form("%s",cut2.Data())); TGraphAsymmErrors *g2 = calcEff(h2Cut,h2,npart2); g2->SetMarkerSize(1.25); ntPythia->Draw("bin>>h",Form("abs(dphi)>%f&&%s",dphiCut2,cut2.Data())); ntPythia->Draw("bin>>hCut",Form("%s",cut2.Data())); TGraphAsymmErrors *gPythia = calcEffpythia(hCut,h,npart); gPythia->SetMarkerSize(1.7); if(useWeight){ ntMix->Draw("bin>>h",Form("weight*(abs(dphi)>%f&&%s)",dphiCut2,cut2.Data())); ntMix->Draw("bin>>hCut",Form("weight*(%s)",cut2.Data())); }else{ ntMix->Draw("bin>>h",Form("(abs(dphi)>%f&&%s)",dphiCut2,cut2.Data())); ntMix->Draw("bin>>hCut",Form("(%s)",cut2.Data())); } TGraphAsymmErrors *gMix = calcEff(hCut,h,npart); gMix->SetMarkerSize(1.25); TCanvas *c = new TCanvas("c","",500,500); // hTmp->SetMaximum(g->GetY()[0]*2.2); hTmp->SetMaximum(0.85); hTmp->SetMinimum(0.); hTmp->SetXTitle("N_{part}"); hTmp->SetYTitle(Form("R_{B}(#Delta#phi_{12} > %.3f)",dphiCut)); hTmp->GetXaxis()->CenterTitle(); hTmp->GetYaxis()->CenterTitle(); // hTmp->GetYaxis()->SetTitleOffset(1.2); // hTmp->GetYaxis()->SetTitleSize(0.055); hTmp->Draw(); double errorbar = 0.02; /* for(int i = 0; i < g->GetN(); ++i){ double *x = g->GetX(); double *y = g->GetY(); // DrawTick(y[i],0.18*y[i],0.18*y[i],x[i],0.012,8.1,16); } g->Draw("p same"); g2->SetMarkerStyle(4); */ for(int i = 0; i < g2->GetN(); ++i){ double *x = g2->GetX(); double *y = g2->GetY(); double err = 1.5*(0.0001129*x[i]); err = sqrt(err * err + 0.012*0.012); cout <<err/y[i]<<" "<<1.5*(0.0001129*x[i])/y[i]<<" "<<0.012/y[i]<<endl; double tickSize = 0.012; if (err<tickSize) tickSize=err; DrawTick(y[i],err,err,x[i],tickSize,8.1,dataColor); } gPythia->SetMarkerColor(4); gPythia->SetLineColor(4); gPythia->SetMarkerStyle(29); gMix->SetMarkerColor(4); gMix->SetLineColor(4); gMix->SetMarkerStyle(25); // gMix->Draw("p same"); gPythia->Draw("p same"); g2->SetLineColor(dataColor); g2->SetMarkerColor(dataColor); g2->Draw("p same"); TLine* pline = new TLine(0,gPythia->GetY()[0],400,gPythia->GetY()[0]); pline->SetLineColor(4); pline->SetLineStyle(4); pline->Draw(); if(drawLeg){ TLegend *t3=new TLegend(0.5,0.77,0.9,0.93); t3->AddEntry(g2,"PbPb #sqrt{s}_{_{NN}}=2.76 TeV","p"); // t3->AddEntry(gPythia,"PYTHIA","p"); // t3->AddEntry(gMix,"PYTHIA+DATA","p"); // t3->AddEntry(g,"2011","p"); // t3->AddEntry(gMix,"2010","p"); t3->AddEntry(gPythia,"pp #sqrt{s}=2.76 TeV","p"); t3->SetFillColor(0); t3->SetBorderSize(0); t3->SetFillStyle(0); t3->SetTextFont(63); t3->SetTextSize(15); t3->Draw(); } TLatex *cms = new TLatex(0.20,0.88,"CMS Preliminary"); cms->SetNDC(); cms->SetTextFont(63); cms->SetTextSize(18); cms->Draw(); TLatex tsel; tsel.SetNDC(); tsel.SetTextFont(63); tsel.SetTextSize(15); tsel.DrawLatex(0.25,0.35,"p_{T,1} > 120 GeV/c"); tsel.DrawLatex(0.25,0.275,"p_{T,2} > 30 GeV/c"); // tsel.DrawLatex(0.25,0.20,"#Delta#phi_{12} > #frac{2}{3}#pi rad"); TLatex *lumi = new TLatex(0.20,0.81,"#intL dt = 6.7 #mub^{-1}"); lumi->SetNDC(); lumi->SetTextFont(63); lumi->SetTextSize(15); lumi->Draw(); /* TF1 *f = new TF1("f","0.5+[0]*x"); gMix->Fit("f"); */ TCanvas *c2 = new TCanvas("c2","",500,500); TGraphAsymmErrors *gRatio = divideGraph(g2,gMix); gRatio->Draw("ap"); gRatio->Fit("pol1"); //gRatio->Fit("pol0"); c->Print(Form("fig/RB_dphi_%d_vs_Npart.eps",(int)(1000*dphiCut))); c->Print(Form("fig/RB_dphi_%d_vs_Npart.C",(int)(1000*dphiCut))); c->Print(Form("fig/RB_dphi_%d_vs_Npart.gif",(int)(1000*dphiCut))); c->Print(Form("fig/RB_dphi_%d_vs_Npart.pdf",(int)(1000*dphiCut))); }
void AnalyzeData(char *DataFile = "drs4_peds_5buffers.dat", Int_t nevt, Int_t startEv = 1, char *PedFile, Int_t DrawExtraGraphs = 0) { // Redefine DOMINO Depth in ADC counts const Float_t DominoDepthADC = pow(2, DOMINO_DEPTH); // open file FILE *fdata = OpenDataFile(DataFile); struct channel_struct *p; struct channel_struct *dep; // create histograms // create list of histograms for channels and distribution TList *DistChList = new TList(); TH1F *distch; // histo with distribution of cell-charge, for each channel TList *DistChSubList = new TList(); TH1F *distchsub; // histo with distribution of cell-charge, pedestals subtracted, for each channel TList *DistCh0SubList = new TList(); TH1F *distch0sub; // histo with distribution of cell-charge, pedestals subtracted, // channel 0 subtracted for each channel TList *grPedList = new TList(); TGraphErrors *grPed; // for each channel, pedestal value and RMS for each cell is plotted TList *hCellList = new TList(); TH1F *hCell; // charge distribution for each cell (DOMINO_NCELL x DOMINO_NCH histos) TList *hCellSubList = new TList(); TH1F *hCellSub; // charge distribution for each cell (DOMINO_NCELL x DOMINO_NCH histos), pedestal subtracted TList *hRMSList = new TList(); TH1F *hRMSdist; // histo with RMS distribution (statistical RMS of distribution) TList *hRMSFitList = new TList(); TH1F *hRMSFitdist; // histo with RMS distribution (RMS of Gaussian fit) TList *grDataList = new TList(); TGraphErrors *grData; // charge-cell and RMS for each cell is plotted TList *grDataSubList = new TList(); TGraphErrors *grDataSub; // pedestal subtracted charge-cell and RMS for each cell is plotted for (int h = 0; h < DOMINO_NCH; h++) { // TString title = "Data Dist channel"; title += h; distch = new TH1F(title, title, DominoDepthADC, 0., DominoDepthADC); DistChList->Add(distch); // TString title = "Data Dist Ped Sub channel"; title += h; distchsub = new TH1F(title, title, DominoDepthADC, -DominoDepthADC/2, DominoDepthADC/2); DistChSubList->Add(distchsub); // TString title = "Data Dist Ped Ch0 Sub channel"; title += h; distch0sub = new TH1F(title, title, DominoDepthADC, -DominoDepthADC/2, DominoDepthADC/2); DistCh0SubList->Add(distch0sub); // TString title = "Pedestal ch"; title += h; grPed = new TGraphErrors(DOMINO_NCELL); grPed->SetTitle(title); grPedList->Add(grPed); // TString title = "Data ch"; title += h; grData = new TGraphErrors(DOMINO_NCELL); grData->SetTitle(title); grDataList->Add(grData); // // Mean data and RMS for each channel and cell TString title = "Data PedSubtracted ch"; title += h; grDataSub = new TGraphErrors(DOMINO_NCELL); grDataSub->SetTitle(title); grDataSubList->Add(grDataSub); // for (int ch = 0; ch < DOMINO_NCELL; ch++) { // data distribution histos TString title = "Data ch"; title += h; title += " cell"; title += ch; hCell = new TH1F(title, title, DominoDepthADC, 0., DominoDepthADC); hCellList->Add(hCell); // data (ped subtracted) distribution histos TString title = "Data PedSub ch"; title += h; title += " cell "; title += ch; hCellSub = new TH1F(title, title, 2 * DominoDepthADC, -1 * DominoDepthADC, DominoDepthADC); hCellSubList->Add(hCellSub); } // Data-RMS distribution histos TString title = "RMSDist channel"; title += h; hRMSdist = new TH1F(title, title, 100, 0, 20.); hRMSList->Add(hRMSdist); // Data-RMS (calculated through a fit) distribution histos TString title = "RMSFitDist channel"; title += h; hRMSFitdist = new TH1F(title, title, 100, 0, 20.); hRMSFitList->Add(hRMSFitdist); } //-------------- // // calculate or read pedestals from file grPedList = OpenPedestals(PedFile); // return; // // ====== Read data file and subtract the pedestals // // Count number of events in data file int nevtDataMax = 0; while (!feof(fdata)) { fread((void *) &event_data, 1, sizeof(event_data), fdata); nevtDataMax++; } printf("nevtDataMax: %d\n", nevtDataMax); if (nevt > (nevtDataMax - startEv) || nevt == 0) nevt = nevtDataMax - startEv; cout << endl << "==>> Processing " << nevt << " events from file " << DataFile << endl; rewind(fdata); Int_t ievt = 1; // go to first event (startEv) while (ievt < startEv) { fread((void *) &event_data, 1, sizeof(event_data), fdata); if (feof(fdata)) break; ievt++; } // filling ievt = 1; Int_t flagEnd = 0; Double_t chtmp; Double_t PedVal, itmp, Ch0Val; // loop on events cout << endl << " --- read DATA file:" << fdata << endl; while (ievt <= nevt && !flagEnd) { fread((void *) &event_data, 1, sizeof(event_data), fdata); if (feof(fdata)) flagEnd = 1; if (ievt % (nevt / 10 + 1) == 0) cout << "*" << endl; p = (struct channel_struct *) &event_data.ch[0]; // read bunch of data dep = (struct channel_struct *) &event_data.ch[1]; // read bunch of data TGraphErrors *grCh0 = new TGraphErrors(DOMINO_NCELL); // loop on channels for (int h = 0; h < DOMINO_NCH; h++) { // loop on cells distch = (TH1F *) DistChList->At(h); distchsub = (TH1F *) DistChSubList->At(h); grPed = (TGraphErrors *) grPedList->At(h); distch0sub = (TH1F *) DistCh0SubList->At(h); if(h==0) { for(i = 0; i < DOMINO_NCELL;i++) { grPed->GetPoint(i, itmp, PedVal); chtmp = (Double_t)(p->data[i]); chtmp = chtmp - PedVal; grCh0->SetPoint(i,itmp, chtmp); } } for (int i = 0; i < DOMINO_NCELL; i++) { // Read pedestal value for this cell grPed->GetPoint(i, itmp, PedVal); grCh0->GetPoint(i, itmp, Ch0Val); // cout << itmp << ", " << PedVal << endl; // Read calibration correction for this cell // CalFact = //charge distribution for each cell, pedestal subtracted chtmp = (Double_t)(p->data[i]); // data value // cout << "tcell, tcell, depth: " << chtmp << "," << p->data[i] << "," << deptmp << endl; distch->Fill(chtmp); // Check data value: must be within DOMINO Depth // if(chtmp > DominoDepthADC) // cout << " === WARNING!!! Channel " << h << " Cell " << i << " has value " << chtmp << endl; // cout << "Charge: " << p->data[i] << endl; ((TH1 *) hCellList->At(h * DOMINO_NCELL + i))->Fill(chtmp); // Now the pedestal is subtracted chtmp = chtmp - PedVal; distchsub->Fill(chtmp); ((TH1 *) hCellSubList->At(h * DOMINO_NCELL + i))->Fill(chtmp); chtmp = chtmp - Ch0Val; distch0sub->Fill(chtmp); } p++; // next channel } ievt++; // next event } cout << endl; // now mean and RMS for each cell are computed and save in histos and graphs cout << " --- filling data histos and grphs " << endl; TF1 *fgauss = new TF1("fgauss", Gauss, -10., 10., 3); fgauss->SetParLimits(0, 0.1, 10000.); fgauss->SetParLimits(1, 0., 4096.); fgauss->SetParLimits(2, 0.1, 20.); Float_t mean, rms, meansub, rmssub; for (int h = 0; h < DOMINO_NCH; h++) { // for (int h=5; h<6; h++){ cout << " Channel:" << h << endl; hRMSdist = (TH1F *) hRMSList->At(h); hRMSFitdist = (TH1F *) hRMSFitList->At(h); grData = (TGraphErrors *) grDataList->At(h); grDataSub = (TGraphErrors *) grDataSubList->At(h); for (int ch = 0; ch < DOMINO_NCELL; ch++) { // data distribution histos // cout << "cell:" << ch << " index:" << h*DOMINO_NCELL+ch << " Mean,RMS:"<<hCell->GetMean()<< "," << hCell->GetRMS()<<endl; hCell = (TH1F *) hCellList->At(h * DOMINO_NCELL + ch); mean = hCell->GetMean(); rms = hCell->GetRMS(); hCellSub = (TH1F *) hCellSubList->At(h * DOMINO_NCELL + ch); meansub = hCellSub->GetMean(); rmssub = hCellSub->GetRMS(); fgauss->SetParameter(0, (Double_t) nevt / 4.); fgauss->SetParameter(1, mean); fgauss->SetParameter(2, rms); // hCell->Fit("fgauss","QN0"); grData->SetPoint(ch, ch, mean); grData->SetPointError(ch, 0, rms); grDataSub->SetPoint(ch, ch, meansub); // grDataSub->SetPointError(ch,0.5,rmssub); grDataSub->SetPointError(ch, 0.5, 2.1); hRMSdist->Fill(rms); hRMSFitdist->Fill(fgauss->GetParameter(2)); // cout << "cell:" << ch << " index:" << h*DOMINO_NCELL+ch << " Mean,RMS:"<< mean << "," << rms<<endl; } } Double_t x, y, chtmp, x1, x2, y1, y2; /*TList *grCellCalibList = OpenCalibFile("CalibrationData1000events.root"); TGraphErrors *grCellCalib; TGraphErrors *grDataSubCalib = new TGraphErrors(DOMINO_NCELL); grDataSubCalib->SetTitle("Data after calibration correction"); grDataSub = (TGraphErrors *) grDataSubList->At(anaChannel); for(ch = 0; ch < DOMINO_NCELL; ch++) { grCellCalib = ((TGraphErrors *) grCellCalibList->At(ch)); grCellCalib->Fit("pol3", "Q"); TF1 *pol3fit = ((TF1 *) grCellCalib->GetFunction("pol3")); grDataSub->GetPoint(ch, x, y); chtmp = y - (Double_t)(pol3fit->Eval(y/3.25)); grDataSubCalib->SetPoint(ch, x, chtmp); } TCanvas *cGrTest = new TCanvas("grTest", "test per vedere i dati", 1000,1000); grDataSubCalib->Draw("APEL");*/ TString Title = "Charge Distribution per channel"; gStyle->SetOptFit(111); TCanvas *cdistch = new TCanvas("cdistch", Title, 1000, 1000); cdistch->Divide(3, 3); for (int i = 0; i < DOMINO_NCH; i++) { cdistch->cd(i + 1); TH1 *dhist = (TH1 *) DistChList->At(i); dhist->DrawCopy(); dhist->SetLineWidth(1); dhist->Fit("gaus", "Q"); dhist->GetFunction("gaus")->SetLineColor(4); dhist->GetFunction("gaus")->SetLineWidth(2); } TString Title = "Charge Distribution Pedestals Subtracted per channel"; TCanvas *cdistchsub = new TCanvas("cdistchsub", Title, 1000, 1000); cdistchsub->Divide(3, 3); for (int i = 0; i < DOMINO_NCH; i++) { cdistchsub->cd(i + 1); TH1 *dsubhist = (TH1 *) DistChSubList->At(i); dsubhist->DrawCopy(); dsubhist->SetLineWidth(1); dsubhist->Fit("gaus", "Q"); dsubhist->GetFunction("gaus")->SetLineColor(4); dsubhist->GetFunction("gaus")->SetLineWidth(2); } TString Title = "Charge Distribution Pedestals and Ch0 Subtracted per channel"; TCanvas *cdistch0sub = new TCanvas("cdistch0sub", Title, 1000, 1000); cdistch0sub->Divide(3, 3); for (int i = 0; i < DOMINO_NCH; i++) { cdistch0sub->cd(i + 1); TH1 *dch0subhist = (TH1 *) DistCh0SubList->At(i); dch0subhist->DrawCopy(); dch0subhist->SetLineWidth(1); dch0subhist->Fit("gaus", "Q"); dch0subhist->GetFunction("gaus")->SetLineColor(4); dch0subhist->GetFunction("gaus")->SetLineWidth(2); } TCanvas *cDataSubTest = new TCanvas("cDataSubTest", "Data after pedestal subtraction", 1000, 1000); cDataSubTest->Divide(1,8); for (h = 0; h< DOMINO_NCH; h++) { grDataSub = (TGraphErrors *) grDataSubList->At(h); cDataSubTest->cd(h+1); grDataSub->GetYaxis()->SetLabelSize(0.06); grDataSub->GetXaxis()->SetLabelSize(0.06); grDataSub->Draw("APE"); } TCanvas *cDataSubTestCh5 = new TCanvas("cDataSubTestCh5", "Data after pedestal subtraction Ch5", 1200, 800); grDataSub = (TGraphErrors *) grDataSubList->At(anaChannel); grDataSub->GetYaxis()->SetLabelSize(0.06); grDataSub->GetYaxis()->SetTitle("ADC Counts"); grDataSub->GetXaxis()->SetTitle("Cell"); grDataSub->GetXaxis()->SetLabelSize(0.06); TLine *refval = new TLine(0,350,1024,350); refval->SetLineWidth(3); refval->SetLineStyle(2); refval->SetLineColor(2); TLine *i1 = new TLine(121,-50,121,800); i1->SetLineStyle(2); TLine *i2 = new TLine(291,-50,291,800); i2->SetLineStyle(2); TLine *i3 = new TLine(461,-50,461,800); i3->SetLineStyle(2); TLine *i4 = new TLine(632,-50,632,800); i4->SetLineStyle(2); TLine *i5 = new TLine(803,-50,803,800); i5->SetLineStyle(2); TLine *i6 = new TLine(975,-50,975,800); i6->SetLineStyle(2); TLine *ireal1 = new TLine(121+20,600,121+20,800); ireal1->SetLineWidth(3); ireal1->SetLineColor(4); TLine *ireal2 = new TLine(291-20,600,291-20,800); ireal2->SetLineWidth(3); ireal2->SetLineColor(4); TLine *ireal3 = new TLine(461+20,600,461+20,800); ireal3->SetLineWidth(3); ireal3->SetLineColor(4); TLine *ireal4 = new TLine(632-20,600,632-20,800); ireal4->SetLineWidth(3); ireal4->SetLineColor(4); TLine *ireal5 = new TLine(803+20,600,803+20,800); ireal5->SetLineWidth(3); ireal5->SetLineColor(4); TLine *ireal6 = new TLine(975-20,600,975-20,800); ireal6->SetLineWidth(3); ireal6->SetLineColor(4); grDataSub->Draw("APE"); refval->Draw("SAME"); i1->Draw("SAME"); i2->Draw("SAME"); i3->Draw("SAME"); i4->Draw("SAME"); i5->Draw("SAME"); i6->Draw("SAME"); ireal1->Draw("SAME"); ireal2->Draw("SAME"); ireal3->Draw("SAME"); ireal4->Draw("SAME"); ireal5->Draw("SAME"); ireal6->Draw("SAME"); TCanvas *cDataTest = new TCanvas("cDataTest", "Raw Data", 1000,1000); cDataTest->Divide(1,8); for(h = 0; h < DOMINO_NCH; h++) { cDataTest->cd(h+1); grData = (TGraphErrors *) grDataList->At(h); grData->SetMarkerStyle(20); grData->SetMarkerSize(0.5); grData->Draw("APE"); } // save root file with graph containing channel 5 data after pedestals subtraction. /* cout << "test" << endl; TString OutFile = DataSubFile; TFile *f = new TFile(OutFile,"RECREATE"); int h = anaChannel; TString key="DataSubGraph"; key += h; ((TGraphErrors*)grDataSubList->At(h))->Write(key); f->Close(); cout << " ---- Write data on file " << endl; */ // =======================================================// // =====================Matteo's Code=====================// // =======================================================// /* Int_t cht, incCht, decCht, xflag, nPeriods, iMax, iMin; Double_t xdiff, incDiff, decDiff, incDiffTemp, decDiffTemp, incXDiff, decXDiff; Double_t fitMax, fitMin, fitPeriod, chisquare; Double_t DominoXval[DOMINO_NCELL]; Double_t DominoYval[DOMINO_NCELL]; Double_t FitXval[DOMINO_NCELL]; Double_t FitYval[DOMINO_NCELL]; // opens grDataSub.root TString FileName = DataSubFile; TGraphErrors *grDataSub; int h = anaChannel; TFile *f = new TFile(FileName); TString key = "DataSubGraph"; key += h; grDataSub = (TGraphErrors *) f->Get(key); f->Close(); // Create a new graph with channel 5 data TGraphErrors *grDataSubAnaCh; int h = anaChannel; grDataSubAnaCh = (TGraphErrors *) grDataSubList->At(h); TGraphErrors *grDataSubFix = grDataSubAnaCh->Clone(); TGraphErrors *grRes = new TGraphErrors(DOMINO_NCELL); TList *grResPeriodList = new TList(); Double_t xtemp, ytemp, DominoMax, DominoMin; for (int ch = 0; ch < DOMINO_NCELL; ch++){ // get domino-output point and save in array grDataSubAnaCh->GetPoint(ch, DominoXval[ch], DominoYval[ch]); } // find the domino point with max y-value iMax = 0; for(int ch = 0; ch < DOMINO_NCELL; ch++) { if(DominoYval[ch] > DominoYval[iMax]) { DominoMax = DominoYval[ch]; iMax = ch; } } cout << "DominoMax e': " << DominoMax << endl; // find the domino point with min y-value iMin = 0; for (int ch = 0; ch < DOMINO_NCELL; ch++) { if(DominoYval[ch] < DominoYval[iMin]) { DominoMin = DominoYval[ch]; iMin = ch; } } cout << "DominoMin e': " << DominoMin << endl; // remove points from the graph that will be used for fit for (int ch = 0; ch < DOMINO_NCELL; ch++){ grDataSubFix->GetPoint(ch, xtemp, ytemp); if(ytemp > 0.8*DominoMax || ytemp < 0.2*DominoMin) grDataSubFix->RemovePoint(ch); } TF1 *fsin = new TF1("fsin", sigSin, 0., 1024., 4); fsin->SetParameters(600., DOMINO_NCELL / 4., 150., 150.); fsin->SetParNames("amplitude", "Period", "Phase", "DC-Offset"); grDataSubFix->Fit("fsin"); TF1 *fsinFit = grDataSubFix->GetFunction("fsin"); fsinFit->SetParNames("amplitude", "Period", "Phase", "DC-Offset"); chisquare = grDataSub->Chisquare(fsinFit); cout << "il chi quadro della funzione di fit e' : " << chisquare << endl; for (int ch = 0; ch < DOMINO_NCELL; ch++) { // get Fit-value and save in array FitXval[ch] = DominoXval[ch]; FitYval[ch] = fsinFit->Eval(FitXval[ch]); } fitPeriod = fsinFit->GetParameter("Period"); cout << "il periodo della funzione e': " << fitPeriod << endl; nPeriods = (Int_t) (DOMINO_NCELL/fitPeriod); cout << "il numero di periodi della funzione e': " << nPeriods << endl; fitMax = fsinFit->GetMaximum(); cout << "il massimo della funzione e': " << fitMax << endl; fitMin = fsinFit->GetMinimum(); cout << "il minimo della funzione e': " << fitMin << endl; // computes the y difference between the ch-domino point and the i-fit point // and stops when the difference changes sign // // first and last points are not included in the cicle // // if the fit point y-value is bigger or smaller than the fit function max*0.8 or min*0.2 // the point is removed for (int ch = 1; ch < DOMINO_NCELL - 1; ch++) { if(FitYval[ch] > 0.8*fitMax || FitYval[ch] < 0.2*fitMin) { grRes->RemovePoint(ch); continue; } incDiff = DominoYval[ch] - FitYval[ch]; incDiffTemp = DominoYval[ch] - FitYval[ch + 1]; decDiff = DominoYval[ch] - FitYval[ch]; decDiffTemp = DominoYval[ch] - FitYval[ch - 1]; if(abs(incDiffTemp) < abs(incDiff) || (sign(incDiff) != sign(incDiffTemp) && abs(decDiffTemp) > abs(decDiff))) { for (int i = ch; i < DOMINO_NCELL; i++, incDiff = incDiffTemp) { incDiffTemp = DominoYval[ch] - FitYval[i]; if (sign(incDiff) != sign(incDiffTemp)) { if(abs(incDiffTemp) < abs(incDiff)) incCht = i; else incCht = i - 1; break; } } xflag = 1; } else if(abs(decDiffTemp) < abs(decDiff) || (sign(decDiff) != sign(decDiffTemp) && abs(incDiffTemp) > abs(incDiff))) { for (int j = ch; j >= 0 ; j--, decDiff = decDiffTemp) { decDiffTemp = DominoYval[ch] - FitYval[j]; if (sign(decDiff) != sign(decDiffTemp)) { if(abs(decDiffTemp) < abs(decDiff)) decCht = j; else decCht = j + 1; break; } } xflag = -1; } if(xflag == 1) xdiff = FitXval[incCht] - DominoXval[ch]; else xdiff = FitXval[decCht] - DominoXval[ch]; grRes->SetPoint(ch, (Double_t) ch, xdiff); } cout << "Draw Time Residuals" << endl; TString Title = "Time Residuals"; TCanvas *timeres = new TCanvas("timeres", Title, 1200, 780); grRes->SetMarkerStyle(20); grRes->SetMarkerSize(0.3); grRes->GetYaxis()->SetLabelSize(0.12); grRes->GetXaxis()->SetLabelSize(0.12); grRes->Draw("APE"); // The previous graph is now split in N graphs, where N is the number of fit periods // this will be needed to set the function phase // // iMax = 0; // // for(ch = 0; ch < fitPeriod - 1; ch++) { // if(FitYval[ch] > FitYval[iMax]) iMax = ch; // } cout << "il primo massimo ha l'indice : " << iMax << endl; for (i = 0; i < nPeriods; i++) { TGraphErrors *grResPeriod = new TGraphErrors((Int_t) fitPeriod); grResPeriodList->Add(grResPeriod); for(ch = i*fitPeriod + 1; ch < fitPeriod + (i*fitPeriod); ch++) { if(FitYval[ch] > 0.8*fitMax || FitYval[ch] < 0.2*fitMin) { grResPeriod->RemovePoint(ch); continue; } incDiff = DominoYval[ch] - FitYval[ch]; incDiffTemp = DominoYval[ch] - FitYval[ch + 1]; decDiff = DominoYval[ch] - FitYval[ch]; decDiffTemp = DominoYval[ch] - FitYval[ch - 1]; if(abs(incDiffTemp) < abs(incDiff) || (sign(incDiff) != sign(incDiffTemp) && abs(decDiffTemp) > abs(decDiff))) { for (int k = ch; k < k*fitPeriod + fitPeriod; k++, incDiff = incDiffTemp) { incDiffTemp = DominoYval[ch] - FitYval[k]; if (sign(incDiff) != sign(incDiffTemp)) { if(abs(incDiffTemp) < abs(incDiff)) incCht = k; else incCht = k - 1; break; } } xflag = 1; } else if(abs(decDiffTemp) < abs(decDiff) || (sign(decDiff) != sign(decDiffTemp) && abs(incDiffTemp) > abs(incDiff))) { for (int j = ch; j > i*fitPeriod; j--, decDiff = decDiffTemp) { decDiffTemp = DominoYval[ch] - FitYval[j]; if (sign(decDiff) != sign(decDiffTemp)) { if(abs(decDiffTemp) < abs(decDiff)) decCht = j; else decCht = j + 1; break; } } xflag = -1; } if(xflag == 1) xdiff = FitXval[incCht] - DominoXval[ch]; else xdiff = FitXval[decCht] - DominoXval[ch]; grResPeriod->SetPoint(ch - i*fitPeriod, (Double_t) (ch - i*fitPeriod), xdiff); } } TCanvas *timeresperiod = new TCanvas("timeresperiod", "Time Residuals Period", 1200, 780); for(i = 0; i < nPeriods; i++) { grResPeriod = ((TGraphErrors *) grResPeriodList->At(i)); grResPeriod->SetMarkerStyle(20); grResPeriod->SetMarkerSize(0.3); grResPeriod->GetYaxis()->SetLabelSize(0.12); grResPeriod->GetXaxis()->SetLabelSize(0.12); grResPeriod->Draw("APEsame"); } cout << "Draw Data - Pedestals Subtracted" << endl; TString Title = "Average Charge - Pedestal subtracted"; TCanvas *csubdata = new TCanvas("csubdata", Title, 1200, 780); grDataSubAnaCh->SetMarkerStyle(20); grDataSubAnaCh->SetMarkerSize(0.3); grDataSubAnaCh->GetYaxis()->SetLabelSize(0.12); grDataSubAnaCh->GetXaxis()->SetLabelSize(0.12); grDataSubAnaCh->Draw("APE"); fsinFit->Draw("same"); */ // draw extra graphs if (DrawExtraGraphs == 1) { cout << " ----- DRAW Results ------" << endl; //================ DRAW Results ================== TCanvas *c = new TCanvas("ctmp", "test", 800, 800); c->Divide(3, 3); for (int pad = 1; pad < 10; pad++) { c->cd(pad); ((TH1 *) hCellList->At(pad * 512 + 219))->DrawCopy(); hCellSub = (TH1F *) hCellSubList->At(pad * 512 + 219); hCellSub->SetLineColor(2); hCellSub->DrawCopy("same"); } cout << "Draw RMS distributions" << endl; TString Title = "RMS distributions per channel"; TCanvas *c4 = new TCanvas("c4", Title, 700, 700); c4->Divide(3, 3); for (int i = 0; i < DOMINO_NCH; i++) { c4->cd(i + 2); hRMSdist = (TH1F *) hRMSList->At(i); hRMSFitdist = (TH1F *) hRMSFitList->At(i); hRMSFitdist->SetLineColor(2); hRMSFitdist->DrawCopy(); hRMSdist->DrawCopy("same"); } TList *grDataCh0SubList = new TList(); TGraphErrors *grDataCh0Sub; for(h = 0; h< DOMINO_NCELL; h++) { grDataCh0Sub = new TGraphErrors(DOMINO_NCELL); grDataCh0SubList->Add(grDataCh0Sub); } TGraphErrors *grDataSubCh0 = (TGraphErrors *) grDataSubList->At(6); for(h = 0; h < DOMINO_NCH; h++) { grDataSub = (TGraphErrors *) grDataSubList->At(h); grDataCh0Sub = (TGraphErrors *) grDataCh0SubList->At(h); for(ch = 0; ch < DOMINO_NCELL; ch++) { grDataSubCh0->GetPoint(ch, x1, y1); grDataSub->GetPoint(ch, x2, y2); grDataCh0Sub->SetPoint(ch, x1 , y2 - y1); } } TCanvas *cDataCH0Sub = new TCanvas("cDataCH0Sub","cDataCH0Sub", 1000,1000); cDataCH0Sub->Divide(1,8); for(h = 0; h < DOMINO_NCH; h++) { cDataCH0Sub->cd(h+1); grDataCh0Sub = (TGraphErrors *) grDataCh0SubList->At(h); grDataCh0Sub->GetYaxis()->SetLabelSize(0.12); grDataCh0Sub->GetXaxis()->SetLabelSize(0.12); grDataCh0Sub->Draw("APEL"); } cout << "Draw Data - Pedestals Subtracted" << endl; TString Title = "Average Charge - Pedestal subtracted"; TCanvas *csubdata = new TCanvas("csubdata", Title, 1000, 1000); csubdata->Divide(3,3); for(h = 0; h < DOMINO_NCH; h++) { csubdata->cd(h+1); TString title = "DataSub channel "; title += h; TH1F *hCellDataSub = new TH1F(title, title, 100, -20, 20); grDataSub = (TGraphErrors *) grDataSubList->At(h); for(ch = 0; ch < DOMINO_NCELL; ch++) { grDataSub->GetPoint(ch, x, y); hCellDataSub->Fill(y); } hCellDataSub->Fit("gaus", "Q"); hCellDataSub->GetXaxis()->SetTitle("ADC Counts"); hCellDataSub->GetFunction("gaus")->SetLineColor(4); hCellDataSub->DrawCopy(); } cout << "breakpoint" << endl; TCanvas *csubdata2 = new TCanvas("csubdata2", "DataSub for every channel", 1000, 1000); TString title = "DataSub every channel "; TH1F *hCellChDataSubTot = new TH1F(title, title, 100, -20, 20); for(h = 0; h < DOMINO_NCH; h++) { grDataSub = (TGraphErrors *) grDataSubList->At(h); for(ch = 0; ch < DOMINO_NCELL; ch++) { grDataSub->GetPoint(ch, x, y); hCellChDataSubTot->Fill(y); } hCellChDataSubTot->Fit("gaus", "Q"); hCellChDataSubTot->GetXaxis()->SetTitle("ADC Counts"); hCellChDataSubTot->GetFunction("gaus")->SetLineColor(4); hCellChDataSubTot->Draw(); } cout << "Draw Pedestals" << endl; TString Title = "Pedestals"; TCanvas *c2 = new TCanvas("c2", Title, 1050, 780); c2->SetBorderMode(0); c2->SetBorderSize(0.); c2->Divide(1, 8); // gStyle->SetCanvasBorderMode(0.); // gStyle->SetCanvasBorderSize(0.); Double_t x, y; for (int h = 0; h < DOMINO_NCH; h++) { c2->cd(h + 1); grPed = ((TGraphErrors *) grPedList->At(h)); grPed->SetMarkerStyle(20); grPed->SetMarkerSize(0.5); grPed->GetYaxis()->SetLabelSize(0.12); grPed->GetXaxis()->SetLabelSize(0.12); // cout << " err:" << grPed->GetErrorY(102) << " " ; // cout << x << "--" << y << endl; grPed->Draw("APE"); } cout << "Draw Data - Average charge" << endl; TString Title = "Average_Charge"; TCanvas *cdata = new TCanvas("cdata", Title, 1050, 780); cdata->Divide(1, 8); Double_t x, y; for (int h = 0; h < DOMINO_NCH; h++) { cdata->cd(h + 1); grData = ((TGraphErrors *) grDataList->At(h)); grData->SetMarkerStyle(20); grData->SetMarkerSize(0.3); grData->GetYaxis()->SetLabelSize(0.12); grData->GetXaxis()->SetLabelSize(0.12); grData->GetPoint(10, x, y); // cout << x << "-" << y << endl; grData->Draw("APE"); } cout << "Draw Data - Pedestals Subtracted" << endl; TString Title = "Average Charge - Pedestal subtracted"; TCanvas *csubdata = new TCanvas("csubdata", Title, 1200, 780); csubdata->Divide(1, 8); TF1 *fsin = new TF1("fsin", sigSin, 0., 1024., 4); TH1D *resDist = new TH1D("resDist", "Residuals Signal", 100, -100., 100.); cout << "Draw Data - Pedestals Subtracted" << endl; TString Title = "Residuals"; TCanvas *residuals = new TCanvas("residuals", Title, 1200, 780); resDist->DrawCopy(); } fclose(fdata); hCellList->Delete(); hCellSubList->Delete(); hRMSList->Delete(); hRMSFitList->Delete(); }
void DrawbbcWidthCutEff(){ gStyle->SetOptStat(kFALSE); const int nwidth = 10; const int nfrac = 28; const int nwidth_coa=4; const int nw = 4; const int color[10]={5,1,2,4,7,3,4,2,1}; const int marker[10]={20,33,21,29,24,27,25,30,20,33}; const float bbct_width[nwidth] = {0.1,0.2,0.3,0.4,0.5,0.7,0.8,0.9,1.0,1.2}; const float bbct_width_coa[nwidth_coa] = {0.1,0.3,0.5,1.0}; const int widthbin[nwidth_coa] = {0,2,4,8}; const float bbct_frac[nfrac] = {0.,0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.82,0.84,0.86,0.88,0.9,0.92,0.94,0.96,0.98,1.0}; const TString weight[nw] = {"no weight, center = mean","weighted, center= mean","weighted centre = max","Darren module(Used in analysis)"}; TFile *f = TFile::Open("output_testfull.root"); vector<vector<TH2F*> > hcentbbct0sigmasouth; vector<vector<TH2F*> > hcentbbct0sigmanorth; vector<vector<TH2F*> > hcentbbcmixt0sigmasouth; vector<vector<TH2F*> > hcentbbcmixt0sigmanorth; TH1D* hbbct0sigmasouth[nw][nwidth]; TH1D* hbbct0sigmanorth[nw][nwidth]; TH1D* hbbcmixt0sigmasouth[nw][nwidth]; TH1D* hbbcmixt0sigmanorth[nw][nwidth]; float cuteffsouth[nw][nwidth][nfrac]; float mixcuteffsouth[nw][nwidth][nfrac]; float cuteffnorth[nw][nwidth][nfrac]; float mixcuteffnorth[nw][nwidth][nfrac]; hcentbbct0sigmasouth.resize(nw, std::vector<TH2F*>(nwidth)); hcentbbct0sigmanorth.resize(nw, std::vector<TH2F*>(nwidth)); hcentbbcmixt0sigmasouth.resize(nw, std::vector<TH2F*>(nwidth)); hcentbbcmixt0sigmanorth.resize(nw, std::vector<TH2F*>(nwidth)); int centmin = 48; //bbcs > 24, 0-5% int centmax = -1; for(int iw=0; iw<nw; iw++){ for(int iwidth = 0;iwidth<nwidth; iwidth++){ hcentbbct0sigmasouth[iw][iwidth] = (TH2F*)f->Get(Form("hcentbbct0fracsouth_%d_%d",iwidth,iw)); hcentbbct0sigmanorth[iw][iwidth] = (TH2F*)f->Get(Form("hcentbbct0fracnorth_%d_%d",iwidth,iw)); hcentbbcmixt0sigmasouth[iw][iwidth] = (TH2F*)f->Get(Form("hcentbbcmixt0fracsouth_%d_%d",iwidth,iw)); hcentbbcmixt0sigmanorth[iw][iwidth] = (TH2F*)f->Get(Form("hcentbbcmixt0fracnorth_%d_%d",iwidth,iw)); hbbct0sigmasouth[iw][iwidth] = (hcentbbct0sigmasouth[iw][iwidth]->ProjectionY(Form("hbbct0fracsouth_%d_%d",iwidth,iw),centmin,centmax)); hbbcmixt0sigmasouth[iw][iwidth] = (hcentbbcmixt0sigmasouth[iw][iwidth]->ProjectionY(Form("hbbcmixt0fracsouth_%d_%d",iwidth,iw),centmin,centmax)); hbbct0sigmasouth[iw][iwidth]->Scale(1./hbbct0sigmasouth[iw][iwidth]->Integral()); hbbcmixt0sigmasouth[iw][iwidth]->Scale(1./hbbcmixt0sigmasouth[iw][iwidth]->Integral()); } for(int iwidth = 0;iwidth<nwidth; iwidth++){ for(int ifrac = 0;ifrac<nfrac; ifrac++){ int xbinmin = hcentbbct0sigmasouth[iw][iwidth]->GetYaxis()->FindBin(bbct_frac[ifrac]+0.005); int xbinmax = hcentbbct0sigmasouth[iw][iwidth]->GetYaxis()->FindBin(-1); cuteffsouth[iw][iwidth][ifrac] = 1.0*hcentbbct0sigmasouth[iw][iwidth]->Integral(centmin,centmax,xbinmin,xbinmax)/hcentbbct0sigmasouth[iw][iwidth]->Integral(centmin,centmax,0,-1); cuteffnorth[iw][iwidth][ifrac] = 1.0*hcentbbct0sigmanorth[iw][iwidth]->Integral(centmin,centmax,xbinmin,xbinmax)/hcentbbct0sigmanorth[iw][iwidth]->Integral(centmin,centmax,0,-1); mixcuteffsouth[iw][iwidth][ifrac] = 1.0*hcentbbcmixt0sigmasouth[iw][iwidth]->Integral(centmin,centmax,xbinmin,xbinmax)/hcentbbcmixt0sigmasouth[iw][iwidth]->Integral(centmin,centmax,0,-1); mixcuteffnorth[iw][iwidth][ifrac] = 1.0*hcentbbcmixt0sigmanorth[iw][iwidth]->Integral(centmin,centmax,xbinmin,xbinmax)/hcentbbcmixt0sigmanorth[iw][iwidth]->Integral(centmin,centmax,0,-1); } } } TGraph *grsouth[nw][nwidth]; TGraph *grsouthmix[nw][nwidth]; for(int iw=1; iw<nw; iw++){ for(int iwidth = 0;iwidth<nwidth; iwidth++){ grsouth[iw][iwidth] = new TGraph(nfrac,bbct_frac,cuteffsouth[iw][iwidth]); grsouthmix[iw][iwidth] = new TGraph(nfrac,bbct_frac,mixcuteffsouth[iw][iwidth]); } } TCanvas *c1 = new TCanvas(); c1->SetLogy(); TLegend *leg = new TLegend(0.15,0.35,0.25,0.65); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextSize(0.04); int xw = 2; SetTitle(*grsouth[xw][0],"fraction threshold for cut","Cut/No Cut",""); SetYRange(*grsouth[xw][0],1e-7,1.6); SetXRange(*grsouth[xw][0],-0.2,1.); grsouth[xw][0]->Draw("AP"); leg->AddEntry(grsouth[xw][widthbin[0]],Form("pAl Run432420, bbcS > 24"),""); for(int iwidth = 0;iwidth<nwidth_coa; iwidth++){ leg->AddEntry(grsouth[xw][widthbin[iwidth]],Form("width = %.1f",bbct_width_coa[iwidth]),"p"); leg->AddEntry(grsouthmix[xw][widthbin[iwidth]],Form("mixed, width = %.1f",bbct_width_coa[iwidth]),"p"); SetStyle(*grsouth[xw][widthbin[iwidth]],1.2,color[iwidth],marker[iwidth],0,0); SetStyle(*grsouthmix[xw][widthbin[iwidth]],1.2,color[iwidth],marker[iwidth+nwidth_coa],0,0); grsouth[xw][widthbin[iwidth]]->Draw("Psame"); grsouthmix[xw][widthbin[iwidth]]->Draw("Psame"); } leg->Draw("same"); //c1->Print("bbctRMSCutEff_north.png"); c1->Print(Form("bbctWidthCutEff_iw%d_log.png",xw)); TCanvas *c2 = new TCanvas(); // c2->SetLogy(); TLegend *leg = new TLegend(0.15,0.65,0.25,0.88); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextSize(0.04); int xw = 2; SetTitle(*grsouth[xw][0],"fraction threshold for cut","Cut/No Cut",""); SetYRange(*grsouth[xw][0],1e-7,1.6); SetXRange(*grsouth[xw][0],-0.2,1.); grsouth[xw][0]->Draw("AP"); leg->AddEntry(grsouth[xw][widthbin[0]],Form("pAl Run432420, bbcS > 24"),""); for(int iwidth = 0;iwidth<nwidth_coa; iwidth++){ leg->AddEntry(grsouth[xw][widthbin[iwidth]],Form("width = %.1f",bbct_width_coa[iwidth]),"p"); leg->AddEntry(grsouthmix[xw][widthbin[iwidth]],Form("mixed, width = %.1f",bbct_width_coa[iwidth]),"p"); SetStyle(*grsouth[xw][widthbin[iwidth]],1.2,color[iwidth],marker[iwidth],0,0); SetStyle(*grsouthmix[xw][widthbin[iwidth]],1.2,color[iwidth],marker[iwidth+nwidth_coa],0,0); grsouth[xw][widthbin[iwidth]]->Draw("Psame"); grsouthmix[xw][widthbin[iwidth]]->Draw("Psame"); } leg->Draw("same"); //c2->Print("bbctRMSCutEff_north.png"); c2->Print(Form("bbctWidthCutEff_iw%d.png",xw)); TLine *l = new TLine(bbct_frac[22],0,bbct_frac[22],1.); l->SetLineStyle(2); TCanvas *c3 = new TCanvas(); c3->cd(); c3->SetLogy(); TLegend *leg = new TLegend(0.15,0.65,0.25,0.88); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextSize(0.04); SetTitle(*hbbct0sigmasouth[0][4],"Frac in bbct0 south","# of Event(normalized)",""); SetYRange(*hbbct0sigmasouth[0][4],1e-7,1.2); SetXRange(*hbbct0sigmasouth[0][4],-0.2,1.1); hbbct0sigmasouth[0][4]->Draw("P"); leg->AddEntry(hbbct0sigmasouth[0][4],Form("pAl Run432420, bbcS > 24"),""); for(int iw = 0;iw<nw; iw++){ leg->AddEntry(hbbct0sigmasouth[iw][4],Form("width = %.1f,%s,after cut=%.1f%%",bbct_width[4],weight[iw].Data(),cuteffsouth[iw][4][22]*100),"p"); SetStyle(*hbbct0sigmasouth[iw][4],1.2,color[iw],marker[iw],0,0); if(iw!=0) hbbct0sigmasouth[iw][4]->Draw("Psame"); } leg->Draw("same"); l->Draw(); c3->Print(Form("bbctWidthAllw.png")); TCanvas *c4 = new TCanvas(); c4->cd(); c4->SetLogy(); TLegend *leg = new TLegend(0.15,0.65,0.25,0.88); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextSize(0.04); SetTitle(*hbbcmixt0sigmasouth[0][4],"Frac in bbct0 south","# of Event(normalized)",""); SetYRange(*hbbcmixt0sigmasouth[0][4],1e-7,1.2); SetXRange(*hbbcmixt0sigmasouth[0][4],-0.2,1.1); hbbcmixt0sigmasouth[0][4]->Draw("P"); for(int iw = 0;iw<nw-1; iw++){ leg->AddEntry(hbbcmixt0sigmasouth[iw][4],Form("width = %.1f,%s, after cut=%.1f%%",bbct_width[4],weight[iw].Data(),mixcuteffsouth[iw][4][22]*100),"p"); SetStyle(*hbbcmixt0sigmasouth[iw][4],1.2,color[iw],marker[iw],0,0); if(iw!=0) hbbcmixt0sigmasouth[iw][4]->Draw("Psame"); } leg->Draw("same"); l->Draw(); c4->Print(Form("bbcmixtWidthAllw.png")); }
void trigTurnOnVsPt() { gStyle->SetOptStat(kFALSE); int whichFile=0; vector <string > plotlistBase; vector <string > plotlistBaseSel; vector <string > plotlistRun; vector <string > plotnames; vector <float > ymaxlist; vector <TFile* > filelist; vector <string > filenames; vector <string > titlename; //Initialize your TH1F's from your file.... //Note that these next 6 lines are not road-tested. /* filelist.push_back(TFile::Open("data2012_MultiJet_BQuad50_SQuad60_Di20_TriggerMap_6jets20GeV_2p4pb_jun19.root")); filenames.push_back("Quad50_Quad60_Di20_jun19"); titlename.push_back("Quad60_Di20 (base Quad50) efficiency"); ymaxlist.push_back(1.1); TFile fnew1("TriggerPlots_BQuad50_SQuad60_Di20.root", "recreate"); filelist.push_back(TFile::Open("data2012_MultiJet_BQuad70_SQuad80_TriggerMap_6jets20GeV_2p4pb_jun19.root")); filenames.push_back("BQuad70_SQuad80_jun19"); ymaxlist.push_back(1.1); titlename.push_back("Quad80 (base Quad70) efficiency"); TFile fnew1("TriggerPlots_BQuad70_SQuad80.root", "recreate"); */ /*filelist.push_back(TFile::Open("data2012_MultiJet_BSix35_SSix45_TriggerMap_6jets20GeV_2p4pb_jun19.root")); filenames.push_back("BSix35_SSix45_jun19"); titlename.push_back("Six45 (base Six35) efficiency"); ymaxlist.push_back(1.1); TFile fnew1("TriggerPlots_BSix35_SSix45.root", "recreate"); */ filelist.push_back(TFile::Open("trigstudy/nobjetreq/jetht2base/runBCD.root")); // filelist.push_back(TFile::Open("trigstudy/runsABCD.root")); // filelist.push_back(TFile::Open("data2012_MultiJet_BMu40_SQuad60_Di20_TriggerMap_6jets20GeV_jun29.root")); // filenames.push_back("BMu40_SQuad60_Di20_2012ABCD"); // filenames.push_back("BMu40_SQuad60_Di20_2012Dfulljethtnojec"); // filenames.push_back("BHT200_SQuad60_Di20_2012Cjetht"); // titlename.push_back("Quad60_Di20 (base HT200) efficiency"); // filenames.push_back("BQuad4550_SQuad60_Di20_2012D"); //titlename.push_back("Quad60_Di20 (base Quadjet45_50) efficiency"); // filenames.push_back("BEle27_WP80_SQuad60_Di20_Electron2012Cv2"); // titlename.push_back("Quad60_Di20 (base Ele27_WP80) efficiency"); filenames.push_back("BMu40HT200_SQuad60_Di20_2012BCD"); titlename.push_back("Quad60_Di20 (base Mu40HT200) efficiency"); // titlename.push_back("Quad60_Di20 (base Mu40) efficiency"); ymaxlist.push_back(1.1); TFile fnew1("TriggerPlots_BMu40_SQuad60_Di20.root", "recreate"); /* filelist.push_back(TFile::Open("data2012_MultiJet_BMu40_SQuad50_TriggerMap_6jets20GeV_jul3_RUNg194270_eq4jet.root")); filenames.push_back("BMu40_SQuad50_Jul3_RUNg194270_eq4jet"); titlename.push_back("Quad50 (base Mu40) efficiency (4 jets > 20 Gev)"); ymaxlist.push_back(1.1); TFile fnew1("TriggerPlots_BMu40_SQuad50_RUNg194270_eq4jet.root", "recreate"); */ /* filelist.push_back(TFile::Open("data2012_MultiJet_BMu40_SSix45_TriggerMap_6jets20GeV_jul3.root")); filenames.push_back("BMu40_SSix45"); titlename.push_back("Six45 (base Mu40) efficiency (6 jets > 20 Gev)"); ymaxlist.push_back(1.1); TFile fnew1("TriggerPlots_BMu40_SSix45t.root", "recreate"); */ /* filelist.push_back(TFile::Open("data2012_MultiJet_BMu40_SQuad80_TriggerMap_6jets20GeV_jul3_eq4jet.root")); filenames.push_back("BMu40_SQuad80_new"); titlename.push_back("SQuad80 (base Mu40) efficiency (4 jets > 20 Gev)"); ymaxlist.push_back(1.1); TFile fnew1("TriggerPlots_BMu40_SQuad80.root", "recreate"); */ /* filelist.push_back(TFile::Open("data2012_MultiJet_BMu40_SHT750_TriggerMap_6jets45GeV_jul8_geq6jet.root")); filenames.push_back("BMu40_SHT750"); titlename.push_back("SHT750 (base Mu40) efficiency (6 jets > 45 Gev)"); ymaxlist.push_back(1.1); TFile fnew1("TriggerPlots_BMu40_SHT750_jetpt45.root", "recreate"); */ /*filelist.push_back(TFile::Open("data2012_MultiJet_BHT650_SHT750_TriggerMap_6jets45GeV_jul8_geq6jet.root")); filenames.push_back("BHT650_SHT750"); titlename.push_back("SHT750 (base HT650) efficiency (6 jets > 45 Gev)"); ymaxlist.push_back(1.1); TFile fnew1("TriggerPlots_BHT650_SHT750_jetpt45.root", "recreate"); */ /* filelist.push_back(TFile::Open("data2012_MultiJet_BMu_Quad60_Di20_Run2012AC_TriggerMap_6jets45GeV_oct16_geq6jet.root")); filenames.push_back("Quad50_Quad60_Di20_5fb"); titlename.push_back("Quad60_Di20 (base Mu) efficiency"); ymaxlist.push_back(1.1); TFile fnew1("TriggerPlots_BMu_SQuad60_Di20jetpt45.root", "recreate"); */ /*filelist.push_back(TFile::Open("data2012_MultiJet_BMu_Quad60_Di20_Run2012B_TriggerMap_Nov9_geq6jet.root")); filenames.push_back("Mu_Quad60_Di20_5fb"); titlename.push_back("Quad60_Di20 (base Mu dataset) efficiency"); ymaxlist.push_back(1.1); TFile fnew1("TriggerPlots_BMuData_SQuad60_Di20jetpt45.root", "recreate"); */ plotlistBase.push_back("Jet0_Base"); plotlistBase.push_back("Jet1_Base"); plotlistBase.push_back("Jet2_Base"); plotlistBase.push_back("Jet3_Base"); plotlistBase.push_back("Jet4_Base"); plotlistBase.push_back("Jet5_Base"); plotlistBase.push_back("HT_Base"); plotlistBaseSel.push_back("Jet0_BaseSel"); plotlistBaseSel.push_back("Jet1_BaseSel"); plotlistBaseSel.push_back("Jet2_BaseSel"); plotlistBaseSel.push_back("Jet3_BaseSel"); plotlistBaseSel.push_back("Jet4_BaseSel"); plotlistBaseSel.push_back("Jet5_BaseSel"); plotlistBaseSel.push_back("HT_BaseSel"); plotlistRun.push_back("RunNumber_Base"); plotlistRun.push_back("RunNumber_BaseSel"); plotlistRun.push_back("RunNumber_Sel"); plotnames.push_back("Jet1.pdf"); plotnames.push_back("Jet2.pdf"); plotnames.push_back("Jet3.pdf"); plotnames.push_back("Jet4.pdf"); plotnames.push_back("Jet5.pdf"); plotnames.push_back("Jet6.pdf"); plotnames.push_back("HTJetp45.pdf"); //For the Lumi Studies make the reference histogram int Runs[200]={190645, 190704, 190705, 190738, 191043, 191046, 191056, 191057, 191062, 191090, 191201, 191202, 191226, 191247, 191248, 191264, 191271, 191276, 191277, 191367, 191411, 191695, 191697, 191718, 191720, 191721, 191726, 191810, 191830, 191833, 191834, 191837, 191856, 191859, 193093, 193112, 193116, 193123, 193124, 193207, 193334, 193336, 193541, 193556, 193557, 193575, 193621, 193834, 193835, 193836, 193998, 193999, 194027, 194050, 194051, 194052, 194075, 194076, 194108, 194115, 194117, 194119, 194120, 194150, 194151, 194153, 194199, 194210, 194223, 194224, 194225, 194270, 194303, 194304, 194305, 194314, 194315, 194317, 194424, 194428, 194429, 194439, 194455, 194464, 194479, 194480, 194533, 194619, 194643, 194644, 194691, 194699, 194702, 194704, 194711, 194712, 194735, 194778, 194789, 194790, 194825, 194896, 194897, 194912, 194914, 194915, 195014, 195015, 195016}; float Lumis[200] ={0.550795, 0.028862, 14.888, 12.836, 0.061734, 13.822, 0.263979, 3.524, 26.684, 5.348, 3.345, 7.079, 93.555, 70.327, 4.404, 11.258, 9.518, 0.93759, 53.292, 0.132846, 0.001195, 0.013044, 0.0, 16.665, 12.535, 10.467, 0.512428, 7.698, 37.752, 9.526, 29.529, 4.432, 8.63, 7.373, 0.0738, 1.887, 4.655, 0.543375, 1.04, 6.768, 8.915, 43.131, 26.571, 3.218, 5.581, 40.018, 89.651, 0.98811, 0.648552, 0.053585, 19.187, 3.61, 5.497, 110.376, 0.48922, 6.582, 4.91, 54.111, 61.654, 58.992, 2.277, 14.693, 19.262,26.671, 40.786, 6.994, 27.228, 38.922, 6.16, 42.181, 12.739, 1.428, 5.054, 4.798, 8.577, 28.127, 41.671, 1.466, 66.671, 35.988, 56.205, 7.776, 27.076, 21.853, 36.72, 81.026, 76.611, 9.916, 27.441, 33.218, 28.158, 22.555, 15.525, 40.875, 34.173, 33.839, 9.926, 18.834, 52.079, 3.538, 18.742, 8.553, 12.299, 151.942, 2.438, 4.624, 15.377, 1.2, 48.556}; TH1F* h_RunNumber_Lumi = new TH1F("RunNumber_Lumi","RunNumber_Lumi",6000,190000,196000); for (int a=0; a< sizeof(Runs) / sizeof(int); a++){ // cout << "ind " << a << " run " << Runs[a] << " lumi " << Lumis[a] << endl; h_RunNumber_Lumi->SetBinContent(Runs[a]-190000+1,Lumis[a]); } //So I use 2D plots, but it's even easier when you just load the TH1Fs, just name them htop_data and hbot_data directly //Also, you'll need to fix some things at the bottom of the script (x axis, maybe y axis, but little things) //Otherwise, I think things work out of the box (I know, I've said this before) for(int file=0; file<filelist.size(); file++){ TH1F* htop_RunN =(TH1F*) filelist[file]->Get(plotlistRun[1].c_str())->Clone(); TH1F* hbot_RunN = (TH1F*) filelist[file]->Get(plotlistRun[0].c_str())->Clone(); TH1F* hsel_RunN = (TH1F*) filelist[file]->Get(plotlistRun[2].c_str())->Clone(); fnew1.cd(); h_RunNumber_Lumi->Write(); htop_RunN->Write(); hbot_RunN->Write(); hsel_RunN->Write(); htop_RunN->Divide(h_RunNumber_Lumi); hbot_RunN->Divide(h_RunNumber_Lumi); hsel_RunN->Divide(h_RunNumber_Lumi); htop_RunN->SetName("BaseSel_Div_LumiperRun"); hbot_RunN->SetName("Base_Div_LumiperRun"); hsel_RunN->SetName("Sel_Div_LumiperRun"); htop_RunN->Write(); hbot_RunN->Write(); hsel_RunN->Write(); for(int i=0; i<(plotlistBase.size()); i++){ //TH1F* htop_datat =(TH1F*) myEffNfile_Data->Get(plotlistBaseSel[i].c_str()); //TH1F* hbot_datat = (TH1F*) myEffNfile_Data->Get(plotlistBase[i].c_str()); TH1F* htop_data =(TH1F*) filelist[file]->Get(plotlistBaseSel[i].c_str())->Clone(); TH1F* hbot_data = (TH1F*) filelist[file]->Get(plotlistBase[i].c_str())->Clone(); //TH1F* htop_data =htop_datat->Clone(); //TH1F* hbot_data =hbot_datat->Clone(); // TH1D* htop_data = htop_2ddata->ProjectionY(); // TH1D* hbot_data = hbot_2ddata->ProjectionY(); //myEffNfile_Data->Close(); std::cout << "Boom" << std::endl; if(i<2){ htop_data->GetXaxis()->SetRangeUser(50,800); hbot_data->GetXaxis()->SetRangeUser(50,800);} if(i>=2){ htop_data->GetXaxis()->SetRangeUser(50,200); hbot_data->GetXaxis()->SetRangeUser(50,200);} // htop_data->Rebin(2); // hbot_data->Rebin(2); htop_data->Draw(); hbot_data->Draw("same"); TH1F* ratio = (TH1F*) filelist[file]->Get(plotlistBaseSel[i].c_str())->Clone(); ratio->Sumw2(); ratio->Divide(hbot_data); //erf((m-m0)/sigma)+1)/2 /* TF1 * f1 = new TF1("f1","(TMath::Erf((x*[0] -[1])/[2])+1.)/2.",20.,100.); f1->SetParameter(2,1.); //ratio->Fit(f1,"R");*/ TCanvas *c1 = new TCanvas("c1","Canvas1",0,0,800,600); c1->SetLineColor(0); c1->SetFrameFillColor(0); c1->SetFillStyle(4000); c1->SetFillColor(0); c1->SetBorderMode(0); //gStyle->SetOptStat(0); c1->SetFillColor(0); c1->SetBorderSize(0); c1->SetBorderMode(0); c1->SetLeftMargin(0.15); c1->SetRightMargin(0.12); c1->SetTopMargin(0.12); c1->SetBottomMargin(0.15); /* gROOT->SetStyle("Plain"); gStyle->SetOptStat(0000); //This puts in stats box gStyle->SetTitleBorderSize(0); gStyle->SetTitleX(0.5); // X position of the title box from left gStyle->SetTitleAlign(23); gStyle->SetTitleY(.975); // Y position of the title box from bottom gStyle->SetLabelSize(0.03,"y"); gStyle->SetStatX(.9); gStyle->SetStatY(.9); gStyle->SetStatW(0.20); gStyle->SetStatFontSize(0.044); gStyle->SetStatColor(0); */ std::cout << "Boom2" << std::endl; TGraphAsymmErrors* eff0 = new TGraphAsymmErrors(); std::cout << "Boom3" << std::endl; eff0->BayesDivide(htop_data,hbot_data); TF1 * f1 = new TF1("f1","(TMath::Erf((x*[0] -[1])/[2])+1.)/2.",0.,1700.); f1->SetParameter(2,1.); if (i==2) eff0->Fit(f1,"","",50,350); if (i==3) eff0->Fit(f1,"","",50,250); if (i==5) eff0->Fit(f1,"","",50,250); if (i==6) eff0->Fit(f1,"","",600,1400); // eff0->Divide(htop_data,hbot_data); // eff0->BayesDivide(htop_data,hbot_data,"w"); //eff1 = new TGraphAsymmErrors(); //eff1->BayesDivide(htop_mc,hbot_mc,"w"); std::cout << "Boom4" << std::endl; float x=400.0; //float xmin=60; float xmin=30; if(i>=1) x = 300.0; if(i>=3) x = 250.0; if(i>=6) { x = 1300.0; xmin = 550.0; } TH1D *T_Empty = new TH1D("T_Empty", "", 1, xmin, x); T_Empty->SetMinimum(0.001); T_Empty->SetMaximum(ymaxlist[file]); T_Empty->SetStats(kTRUE); T_Empty->GetXaxis()->SetLabelOffset(0.01); T_Empty->GetYaxis()->SetLabelOffset(0.01); T_Empty->GetXaxis()->SetLabelSize(0.035); T_Empty->GetXaxis()->SetLabelFont(42); T_Empty->GetXaxis()->SetTitleSize(0.040); T_Empty->GetYaxis()->SetLabelSize(0.035); T_Empty->GetYaxis()->SetLabelFont(42); T_Empty->GetYaxis()->SetTitleSize(0.040); T_Empty->GetXaxis()->SetTitleOffset(1.29); T_Empty->GetYaxis()->SetTitleOffset(1.39); T_Empty->GetXaxis()->SetTitleColor(1); T_Empty->GetYaxis()->SetTitleColor(1); T_Empty->GetXaxis()->SetNdivisions(10505); T_Empty->GetYaxis()->SetNdivisions(515); T_Empty->GetXaxis()->SetTitleFont(42); T_Empty->GetYaxis()->SetTitleFont(42); char hNAME[99]; sprintf(hNAME, "%ith Jet P_{T} (GeV)", i+1); if (i==6) sprintf(hNAME, "HT"); T_Empty->GetXaxis()->SetTitle(hNAME); T_Empty->SetTitle(titlename[file].c_str()); T_Empty->GetYaxis()->SetTitle(titlename[file].c_str()); T_Empty->Draw("AXIS"); if(i<2){ T_Empty->GetXaxis()->SetRangeUser(50,800);} if(i>=2){ T_Empty->GetXaxis()->SetRangeUser(50,200); } eff0->SetMarkerStyle(20); eff0->SetMarkerSize(1.0); eff0->SetMarkerColor(1); eff0->SetLineWidth(2); //eff1->SetMarkerStyle(21); //eff1->SetMarkerColor(2); //eff1->SetMarkerSize(0.75); //eff1->SetLineWidth(2); eff0->Draw("e1pZ"); eff0->SetTitle(hNAME); eff0->SetName(hNAME); eff0->Write(); // ratio->Draw("E"); //eff1->Draw("e1pZsame"); TLegend *leg = new TLegend(0.2560484,0.8877119,0.7560484,0.9872881,NULL,"brNDC"); leg->SetTextFont(42); leg->SetTextSize(0.030); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillStyle(1001); leg->AddEntry(eff0,titlename[file].c_str(),""); //leg->AddEntry(eff1,"Spring10 7 TeV MC","p"); leg->SetBorderSize(0); leg->SetFillColor(0); leg->Draw(); TLatex* tex = new TLatex(); tex->SetTextColor(1); tex->SetTextSize(0.030); tex->SetLineWidth(2); tex->SetTextFont(42); // tex->DrawLatex(1000., 0.65, titlename[file].c_str()); float Offset = 200.; float y_min = 0.99; float y_max = 0.99; float x_min = xmin; float x_max = x; TLine *line = new TLine(x_min, y_min, x_max, y_max); line->SetLineColor(kRed); line->SetLineWidth(2); line->SetLineStyle(3); line->Draw("same"); TLine *line2 = new TLine(900., 0.5, 900., 1.0); line2->SetLineColor(kBlue); line2->SetLineWidth(3); line2->SetLineStyle(2); //line2->Draw("same"); f1->SetLineColor(4); //f1->Draw("same"); string suffix="_histodiv.png"; cout << "save file name " << filenames[file]+plotnames[i] << endl; string svfile = filenames[file]+plotnames[i]; c1->SaveAs(svfile.c_str()); htop_data->Delete(); hbot_data->Delete(); std::cout << "Boom4" << std::endl; } } }
void drawTrackerRZ(TPad* pad) { pad->cd(); double r = 0, z =0; TLine *l; // PXB z = 26.5; r = 4.4; l = new TLine(-z,r,+z,r); l->Draw(); r = 7.3; l = new TLine(-z,r,+z,r); l->Draw(); r = 10.2; l = new TLine(-z,r,+z,r); l->Draw(); r = -4.4; l = new TLine(-z,r,+z,r); l->Draw(); r = -7.3; l = new TLine(-z,r,+z,r); l->Draw(); r = -10.2; l = new TLine(-z,r,+z,r); l->Draw(); // PXE z = 34.5; l = new TLine(z,+6,z,+15); l->Draw(); z = 46.5; l = new TLine(z,+6,z,+15); l->Draw(); z = 34.5; l = new TLine(z,-6,z,-15); l->Draw(); z = 46.5; l = new TLine(z,-6,z,-15); l->Draw(); z = -34.5; l = new TLine(z,+6,z,+15); l->Draw(); z = -46.5; l = new TLine(z,+6,z,+15); l->Draw(); z = -34.5; l = new TLine(z,-6,z,-15); l->Draw(); z = -46.5; l = new TLine(z,-6,z,-15); l->Draw(); // TIB r = 25.5; l = new TLine(0,r,70,r); l->Draw(); r = 33.9; l = new TLine(0,r,70,r); l->Draw(); r = 41.9; l = new TLine(0,r,70,r); l->Draw(); r = 49.8; l = new TLine(0,r,70,r); l->Draw(); // TID (z-Positionen geraten aus Bild) z = 80; l = new TLine(z,20,z,50); l->Draw(); z = 90; l = new TLine(z,20,z,50); l->Draw(); z = 100; l = new TLine(z,20,z,50); l->Draw(); // TOB r = 60.8; l = new TLine(0,r,109,r); l->Draw(); r = 69.2; l = new TLine(0,r,109,r); l->Draw(); r = 78.0; l = new TLine(0,r,109,r); l->Draw(); r = 86.8; l = new TLine(0,r,109,r); l->Draw(); r = 96.5; l = new TLine(0,r,109,r); l->Draw(); r = 108; l = new TLine(0,r,109,r); l->Draw(); // TOB (wiederum alles aus Zeichnung geschaetzt) z = 124; l = new TLine(z,22,z,113.5); l->Draw(); z = 140; l = new TLine(z,22,z,113.5); l->Draw(); z = 155; l = new TLine(z,22,z,113.5); l->Draw(); z = 168; l = new TLine(z,33,z,113.5); l->Draw(); z = 186; l = new TLine(z,33,z,113.5); l->Draw(); z = 203; l = new TLine(z,33,z,113.5); l->Draw(); z = 223; l = new TLine(z,40,z,113.5); l->Draw(); z = 247; l = new TLine(z,40,z,113.5); l->Draw(); z = 272; l = new TLine(z,52,z,113.5); l->Draw(); }
void compare_aged(TString infile1 = "results_V00-00-12_PhaseII__140PU_cleaning_aged_1ab.root", TString infile2 = "results_V00-00-12_PhaseII__140PU_cleaning_1ab.root") { gROOT->LoadMacro("CMS_lumi.C"); cmsText = "CMS Phase II Simulation"; writeExtraText = false; // if extra text // extraText = "Preliminary"; // default extra text is "Preliminary" // lumi_14TeV = "300 fb^{-1}, PU = 50"; // default is "3000 fb^{-1}" lumi_14TeV = "1000 fb^{-1}, PU = 140"; // default is "3000 fb^{-1}" TCanvas* c1 = new TCanvas("c1","c1",800,600); TFile* f1 = new TFile(infile1); TFile* f2 = new TFile(infile2); TH2F* h_base = new TH2F("h_base",";m_{#tilde{#chi}_{1}^{#pm}} = m_{#tilde{#chi}_{2}^{0}} (GeV); m_{#tilde{#chi}_{1}^{0}} (GeV)", 90, 100, 1000, 100, 0, 1000); h_base->GetXaxis()->SetNdivisions(8,5,0); h_base->GetYaxis()->SetNdivisions(8,5,0); h_base->Draw(); double contours_disc[1] = {5.0}; double contours_exc[1] = {1.0}; f2->cd(); TH2F * disc_contour_12p5 = (TH2F*) h_signif12p5_all->Clone("disc_contour_12p5"); disc_contour_12p5->SetContour(1,contours_disc); disc_contour_12p5->SetLineWidth(3); disc_contour_12p5->SetLineStyle(3); disc_contour_12p5->SetLineColor(kBlue); disc_contour_12p5->Smooth(1,"k3a"); // disc_contour_12p5->Smooth(1,"k5a"); trim_diagonal(disc_contour_12p5); f2->cd(); TH2F * exc_contour_12p5 = (TH2F*) h_rinv12p5_all->Clone("exc_contour_12p5"); //TH2F * exc_contour_12p5 = (TH2F*) h_signif12p5_all->Clone("exc_contour_12p5"); exc_contour_12p5->SetContour(1,contours_exc); exc_contour_12p5->SetLineWidth(3); exc_contour_12p5->SetLineStyle(1); exc_contour_12p5->SetLineColor(kBlue); exc_contour_12p5->Smooth(1,"k3a"); //exc_contour_12p5->Smooth(1,"k5a"); trim_diagonal(exc_contour_12p5); f1->cd(); TH2F * disc_contour_12p5_aged = (TH2F*) h_signif12p5_all->Clone("disc_contour_12p5_aged"); disc_contour_12p5_aged->SetContour(1,contours_disc); disc_contour_12p5_aged->SetLineWidth(3); disc_contour_12p5_aged->SetLineStyle(3); disc_contour_12p5_aged->SetLineColor(kOrange+10); disc_contour_12p5_aged->Smooth(1,"k3a"); // disc_contour_12p5_aged->Smooth(1,"k5a"); trim_diagonal(disc_contour_12p5_aged); f1->cd(); TH2F * exc_contour_12p5_aged = (TH2F*) h_rinv12p5_all->Clone("exc_contour_12p5_aged"); //TH2F * exc_contour_12p5_aged = (TH2F*) h_signif12p5_all->Clone("exc_contour_12p5_aged"); exc_contour_12p5_aged->SetContour(1,contours_exc); exc_contour_12p5_aged->SetLineWidth(3); exc_contour_12p5_aged->SetLineStyle(1); exc_contour_12p5_aged->SetLineColor(kOrange+10); exc_contour_12p5_aged->Smooth(1,"k3a"); //exc_contour_12p5_aged->Smooth(1,"k5a"); trim_diagonal(exc_contour_12p5_aged); TLine* diag = new TLine(125.,0.,675.,550.); // TLine* diag = new TLine(125.,0.,1000.,875.); diag->SetLineWidth(3); diag->SetLineStyle(2); diag->SetLineColor(kBlack); exc_contour_12p5_aged->Draw("cont3 same"); disc_contour_12p5_aged->Draw("cont3 same"); exc_contour_12p5->Draw("cont3 same"); disc_contour_12p5->Draw("cont3 same"); diag->Draw("same"); // TLegend* leg = new TLegend(0.19,0.68,0.54,0.92); TLegend* leg = new TLegend(0.19,0.61,0.54,0.85); leg->SetFillColor(0); leg->SetTextSize(0.035); leg->AddEntry(exc_contour_12p5,"1000fb^{-1} 95% CL Exclusion","l"); leg->AddEntry(disc_contour_12p5,"1000fb^{-1} 5#sigma Discovery","l"); leg->AddEntry(exc_contour_12p5_aged,"1000fb^{-1} 95% CL Exclusion, Aged Detector","l"); leg->AddEntry(disc_contour_12p5_aged,"1000fb^{-1} 5#sigma Discovery, Aged Detector","l"); leg->Draw("same"); CMS_lumi( c1, iPeriod, iPos ); gPad->SetRightMargin(0.05); gPad->Modified(); }
void cmsRAA(int version = 6) { double mymarkersize = 1.; bool bDo2PadZoo = true; //----------------------------------------- charged hadrons double ptBins_h[27]={0}; double ptError_h[27]={0}; double raa_h[27]; double raaStat_h[27]; double raaSyst_h[27]; double ptSystXlow_h[27]; double ptSystXhigh_h[27]; // reading numbers ifstream inData_h; TString inFile("raa_h05.dat"); inData_h.open(inFile); if(inData_h.fail()) { cerr << "unable to open file raa_h05.dat for reading" << endl; exit(1); } Int_t j=0; Double_t xx_low, xx_high,raa,raa_syst, raa_stat; while(!inData_h.eof()) { inData_h >> xx_low >> xx_high >> raa >> raa_syst >> raa_stat; ptBins_h[j] = xx_low+ (xx_high-xx_low)/2; raa_h[j] = raa; raaStat_h[j] = raa_syst; raaSyst_h[j] = raa_stat; ptSystXlow_h[j] = (xx_high-xx_low)/2; ptSystXhigh_h[j]= (xx_high-xx_low)/2; // cout<<"pT"<<ptBins_h[j]<<"\t raa= "<<raa_h[j]<<"\t syst= "<<raaStat_h[j]<<"\t stat ="<<raaSyst_h[j]<<"\t x_low= "<<ptSystXlow_h[j]<<"\t high= "<<ptSystXhigh_h[j]<<endl; j++; } inData_h.close(); // done reading numebrs TGraphErrors *pgRaa_h = new TGraphErrors(27, ptBins_h, raa_h, ptError_h, raaStat_h); TGraphAsymmErrors *pgRaaSyst_h = new TGraphAsymmErrors(27, ptBins_h, raa_h, ptSystXlow_h,ptSystXhigh_h,raaSyst_h,raaSyst_h); pgRaa_h->SetName("pgRaa_h"); pgRaa_h->SetMarkerStyle(kFullCircle); pgRaa_h->SetMarkerSize(1.); //systm error pgRaaSyst_h->SetName("pgRaaSyst_h"); pgRaaSyst_h->SetFillColor(TColor::GetColor("#33ccff")); //----------------------------------------- jet RAA double ptBins_jet[] = {105,115,125,135,145,155,165,175,190,220,270}; double ptError_jet[] = {0.0, 0.0, 0.0, 0.0, 0.0,0,0,0,0,0,0}; double raa_jet[] = {0.47, 0.47, 0.46, 0.44, 0.43, 0.47, 0.52, 0.51, 0.44, 0.42, 0.58}; double raaStat_jet[] = {0.0076, 0.0098, 0.013, 0.016, 0.021, 0.028, 0.038, 0.045, 0.035, 0.039, 0.098}; double raaSyst_jet[] = {0.07, 0.07, 0.08, 0.09, 0.08, 0.08, 0.08, 0.08, 0.07, 0.07, 0.10 }; double ptSystXlow_jet[] = {5, 5, 5, 5, 5,5,5,5,10,20,30}; double ptSystXhigh_jet[] = {5, 5, 5, 5, 5,5,5,5,10,20,30}; TGraphErrors *pgRaa_jet = new TGraphErrors(11, ptBins_jet, raa_jet, ptError_jet, raaStat_jet); TGraphAsymmErrors *pgRaaSyst_jet = new TGraphAsymmErrors(11, ptBins_jet, raa_jet, ptSystXlow_jet,ptSystXhigh_jet,raaSyst_jet,raaSyst_jet); pgRaa_jet->SetName("pgRaa_jet"); pgRaa_jet->SetMarkerStyle(22); pgRaa_jet->SetMarkerSize(1.); //systm error pgRaaSyst_jet->SetName("pgRaaSyst_jet"); pgRaaSyst_jet->SetFillColor(TColor::GetColor("#00FF60")); //----------------------------------------- b-jet RAA double ptBins_bjet[5] = {85,100,120,150,210}; double ptError_bjet[5] = {0,0,0,0,0}; double raa_bjet[5] = {0.3927,0.3277,0.4598,0.4034,0.4214}; double raaStat_bjet[5] = {0.0179,0.0178,0.0374,0.0625,0.1589}; double raaSyst_bjet[5] = {0.0917,0.0923,0.1272,0.1529,0.2771}; double ptSystXlow_bjet[5] = {5,10,10,20,40}; double ptSystXhigh_bjet[5] = {5,10,10,20,40}; TGraphErrors *pgRaa_bjet = new TGraphErrors(5, ptBins_bjet, raa_bjet, ptError_bjet, raaStat_bjet); TGraphAsymmErrors *pgRaaSyst_bjet = new TGraphAsymmErrors(5, ptBins_bjet, raa_bjet, ptSystXlow_bjet,ptSystXhigh_bjet,raaSyst_bjet,raaSyst_bjet); pgRaa_bjet->SetName("pgRaa_bjet"); pgRaa_bjet->SetMarkerStyle(21); pgRaa_bjet->SetMarkerColor(kRed); pgRaa_bjet->SetMarkerSize(1.); //systm error pgRaaSyst_bjet->SetName("pgRaaSyst_bjet"); pgRaaSyst_bjet->SetFillColor(TColor::GetColor("#FFBF00")); //----------------------------------------- photon double ptBins_photon[] = {22.26, 27.30, 34.35, 44.45, 61.72}; double ptError_photon[] = {0.0, 0.0, 0.0, 0.0, 0.0}; double raa_photon[] = {1.03, 0.84, 1.37, 0.98, 0.99}; double raaStat_photon[] = {0.12 ,0.14, 0.22, 0.24, 0.31 }; double raaSyst_photon[] = {0.29, 0.27, 0.25, 0.22, 0.21}; double ptSystXlow_photon[] = {2.5, 2.5, 5, 5, 15}; double ptSystXhigh_photon[] = {2.5, 2.5, 5, 5, 15}; TGraphErrors *pgRaa_photon = new TGraphErrors(5, ptBins_photon, raa_photon, ptError_photon, raaStat_photon); TGraphAsymmErrors *pgRaaSyst_photon = new TGraphAsymmErrors(5, ptBins_photon, raa_photon, ptSystXlow_photon,ptSystXhigh_photon,raaSyst_photon,raaSyst_photon); pgRaa_photon->SetName("pgRaa_photon"); pgRaa_photon->SetMarkerStyle(23); pgRaa_photon->SetMarkerSize(1.); //systm error pgRaaSyst_photon->SetName("pgRaaSyst_photon"); pgRaaSyst_photon->SetFillColor(TColor::GetColor("#ffff00")); //----------------------------------------- Z double ptBins_z[] = {91.19}; //double ptBins_z[7] = {2.5,7.5,15,25,35,45,75}; double ptError_z[] = {0.0}; //double ptError_z[7] = {0.0}; double raa_z[] = {1.06}; double raaStat_z[] = {0.05}; double raaSyst_z[] = {0.08}; double ptSystXlow_z[] = {4}; double ptSystXhigh_z[] = {4}; //double raa_z[7] = {0.88,1.20,1.00,1.35,1.11,1.35,0.78}; //double raaStat_z[7] = {0.09,0.13,0.11,0.22,0.27,0.42,0.20}; //double raaSyst_z[7] = {0.06,0.08,0.07,0.09,0.08,0.09,0.05}; //double ptSystXlow_z[7] = {2.5,2.5,5,5,5,5,25}; //double ptSystXhigh_z[7] = {2.5,2.5,5,5,5,5,25}; TGraphErrors *pgRaa_z = new TGraphErrors(1, ptBins_z, raa_z, ptError_z, raaStat_z); TGraphAsymmErrors *pgRaaSyst_z = new TGraphAsymmErrors(1, ptBins_z, raa_z, ptSystXlow_z,ptSystXhigh_z,raaSyst_z,raaSyst_z); pgRaa_z->SetName("pgRaa_z"); pgRaa_z->SetMarkerStyle(kFullCircle); pgRaa_z->SetMarkerSize(1.); pgRaa_z->SetMarkerStyle(22); //systm error pgRaaSyst_z->SetName("pgRaaSyst_z"); pgRaaSyst_z->SetFillColor(TColor::GetColor("#ff8888")); // ----------------------------------------- W raa double ptBins_w[] = {80.38}; double ptError_w[] = {0.0}; double raa_w[] = {1.04}; double raaStat_w[] = {0.07}; double raaSyst_w[] = {0.12}; double ptSystXlow_w[] = {4}; double ptSystXhigh_w[] = {4}; TGraphErrors *pgRaa_w = new TGraphErrors(1, ptBins_w, raa_w, ptError_w, raaStat_w); TGraphAsymmErrors *pgRaaSyst_w = new TGraphAsymmErrors(1, ptBins_w, raa_w, ptSystXlow_w,ptSystXhigh_w,raaSyst_w,raaSyst_w); pgRaa_w->SetName("pgRaa_w"); pgRaa_w->SetMarkerStyle(kFullCircle); pgRaa_w->SetMarkerSize(1.); pgRaa_w->SetMarkerStyle(21); //systm error pgRaaSyst_w->SetName("pgRaaSyst_w"); pgRaaSyst_w->SetFillColor(TColor::GetColor("#ff88ff")); // ----------------------------------------- 2012 non-prompt Jpsi double ptBins_npjpsi[] = {7.31,8.97,11.32,16.52}; double ptError_npjpsi[] = {0.0,0.0,0.0,0.0}; double raa_npjpsi[] = {0.52,0.43,0.43,0.34}; double raaStat_npjpsi[] = {0.12,0.08,0.09,0.07}; double raaSyst_npjpsi[] = {0.06,0.05,0.05,0.04}; double ptSystXlow_npjpsi[] = {0.81, 0.97, 1.32, 3.52}; double ptSystXhigh_npjpsi[] = {0.69, 1.03, 1.68, 13.48}; TGraphErrors *pgRaa_npjpsi = new TGraphErrors(4, ptBins_npjpsi, raa_npjpsi, ptError_npjpsi, raaStat_npjpsi); TGraphAsymmErrors *pgRaaSyst_npjpsi = new TGraphAsymmErrors(4, ptBins_npjpsi, raa_npjpsi, ptSystXlow_npjpsi,ptSystXhigh_npjpsi,raaSyst_npjpsi,raaSyst_npjpsi); pgRaa_npjpsi->SetName("pgRaa_npjpsi"); pgRaa_npjpsi->SetMarkerStyle(29); pgRaa_npjpsi->SetMarkerSize(1.2); pgRaa_npjpsi->SetMarkerColor(kRed); //systm error pgRaaSyst_npjpsi->SetName("pgRaaSyst_npjpsi"); // pgRaaSyst_npjpsi->SetFillColor(TColor::GetColor("#ee7711")); pgRaaSyst_npjpsi->SetFillColor(TColor::GetColor("#ba8a98")); //--------------------------------------------------------- // lumi uncert. TBox *box = new TBox(0.9,0.9568966,2,1.043103); box->SetFillColor(kGray+1); box->SetFillStyle(1001); TBox *box_lin = new TBox(0.9,0.9568966,10,1.043103); box_lin->SetFillColor(kGray+1); box_lin->SetFillStyle(1001); //------------------------ single pannel: TCanvas *pc = new TCanvas("pc","pc"); TH1 *phAxis = new TH1D("phAxis",";p_{T} (m_{T}) [GeV];R_{AA}",1,0.9,300); phAxis->GetYaxis()->CenterTitle(true); phAxis->SetMinimum(0.); phAxis->SetMaximum(2.5); gPad->SetLogx(); phAxis->Draw(""); // drawing order: // A) stat boxes: pgRaaSyst_photon->Draw("2"); pgRaaSyst_npjpsi->Draw("2"); pgRaaSyst_h->Draw("2"); pgRaaSyst_z->Draw("2"); pgRaaSyst_w->Draw("2"); pgRaaSyst_bjet->Draw("2"); pgRaaSyst_jet->Draw("2"); //nominal+stat // photon pgRaa_photon->Draw("P z"); pgRaa_z->Draw("P z"); pgRaa_w->Draw("P z"); pgRaa_h->Draw("P z"); pgRaa_npjpsi->Draw("P z"); pgRaa_bjet->Draw("P z"); pgRaa_jet->Draw("P z"); TLine *line = new TLine(0.9,1,300,1); line->SetLineStyle(7); line->Draw(); //box->Draw(); // // legends and writings: TLegend *leg = new TLegend(0.05,0.87,0.39,0.95,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(62); leg->SetTextSize(0.029); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(19); leg->SetFillStyle(0); // TLegendEntry *entry=leg->AddEntry("hEtSIEIECorrected","CMS PRELIMINARY",""); // entry->SetLineWidth(1); // entry=leg->AddEntry("hEtSIEIECorrected","PbPb #sqrt{s_{NN}} = 2.76 TeV",""); // entry=leg->AddEntry("hEtSIEIECorrected","",""); // entry=leg->AddEntry("hEtSIEIECorrected","#int L dt = 7-150 #mub^{-1}",""); TLegendEntry *entry=leg->AddEntry("hEtSIEIECorrected","CMS *PRELIMINARY PbPb #sqrt{s_{NN}} = 2.76 TeV #int L dt = 7-150 #mub^{-1}",""); entry->SetLineWidth(1); // TAA // TAA only TLegend *leg_taa = new TLegend(0.15,0.5,0.5,0.55,NULL,"brNDC"); leg_taa->SetBorderSize(0); leg_taa->SetTextFont(62); leg_taa->SetTextSize(0.028); leg_taa->SetLineColor(1); leg_taa->SetLineStyle(1); leg_taa->SetLineWidth(1); leg_taa->SetFillColor(19); leg_taa->SetFillStyle(0); TLegendEntry *entry_taa= leg_taa->AddEntry("general","T_{AA} uncertainty","f"); entry_taa->SetFillColor(kGray+1); entry_taa->SetFillStyle(1001); entry_taa->SetLineColor(0); entry_taa->SetLineWidth(1); entry_taa->SetMarkerStyle(21); entry_taa->SetMarkerSize(1); // EWQ legend TLegend *leg_ewq = new TLegend(0.14,0.79,0.6,0.89,NULL,"brNDC"); leg_ewq->SetBorderSize(0); leg_ewq->SetTextFont(62); leg_ewq->SetTextSize(0.028); leg_ewq->SetLineColor(1); leg_ewq->SetLineStyle(1); leg_ewq->SetLineWidth(1); leg_ewq->SetFillColor(19); leg_ewq->SetFillStyle(0); TLegendEntry *entry_ewq=leg_ewq->AddEntry("raaz","*Z (0-100%) |y| < 2","lpf"); entry_ewq->SetFillColor(TColor::GetColor("#ff8888")); entry_ewq->SetFillStyle(1001); entry_ewq->SetLineColor(1); entry_ewq->SetLineWidth(1); entry_ewq->SetMarkerStyle(22); entry_ewq->SetMarkerSize(1.); entry_ewq=leg_ewq->AddEntry("raaw","W (0-100%) p_{T}^{#mu} > 25 GeV/c^{^{ }}, |#eta^{#mu}| < 2.1","lpf"); entry_ewq->SetFillColor(TColor::GetColor("#ff88ff")); entry_ewq->SetFillStyle(1001); entry_ewq->SetLineColor(1); entry_ewq->SetLineWidth(1); entry_ewq->SetMarkerStyle(21); entry_ewq->SetMarkerSize(1.); entry_ewq=leg_ewq->AddEntry("raaphoton","Isolated photon (0-10%) |#eta| < 1.44","lpf"); entry_ewq->SetFillColor(TColor::GetColor("#ffff00")); entry_ewq->SetFillStyle(1001); entry_ewq->SetLineColor(1); entry_ewq->SetLineWidth(1); entry_ewq->SetMarkerStyle(23); entry_ewq->SetMarkerSize(1); // b and h TLegend *leg_q = new TLegend(0.14,0.72,0.6,0.79,NULL,"brNDC"); leg_q->SetBorderSize(0); leg_q->SetTextFont(62); leg_q->SetTextSize(0.028); leg_q->SetLineColor(1); leg_q->SetLineStyle(1); leg_q->SetLineWidth(1); leg_q->SetFillColor(19); leg_q->SetFillStyle(0); TLegendEntry *entry_q=leg_q->AddEntry("raah","Charged particles (0-5%) |#eta| < 1","lpf"); entry_q->SetFillColor(TColor::GetColor("#33ccff")); entry_q->SetFillStyle(1001); entry_q->SetLineColor(1); entry_q->SetLineStyle(1); entry_q->SetLineWidth(1); entry_q->SetMarkerStyle(kFullCircle); entry_q->SetMarkerSize(1); entry_q=leg_q->AddEntry("raab","*B #rightarrow J/#psi (0-100%) |#eta| < 2.4","lpf"); entry_q->SetFillColor(TColor::GetColor("#ba8a98")); entry_q->SetFillStyle(1001); entry_q->SetLineColor(1); entry_q->SetLineStyle(1); entry_q->SetLineWidth(1); entry_q->SetMarkerStyle(29); entry_q->SetMarkerColor(kRed); entry_q->SetMarkerSize(1.2); //entry_q=leg_q->AddEntry("raabjpsi", "(via secondary J/#psi)",""); // jet legend TLegend *leg_jet = new TLegend(0.14,0.65,0.6,0.72,NULL,"brNDC"); leg_jet->SetBorderSize(0); leg_jet->SetTextFont(62); leg_jet->SetTextSize(0.028); leg_jet->SetLineColor(1); leg_jet->SetLineStyle(1); leg_jet->SetLineWidth(1); leg_jet->SetFillColor(19); leg_jet->SetFillStyle(0); TLegendEntry *entry_jet=leg_jet->AddEntry("raaq","*q/g-jet (0-5%) |#eta| < 2","lpf"); entry_jet->SetFillColor(TColor::GetColor("#00FF60")); entry_jet->SetFillStyle(1001); entry_jet->SetLineColor(1); entry_jet->SetLineStyle(1); entry_jet->SetLineWidth(1); entry_jet->SetMarkerStyle(22); entry_jet->SetMarkerSize(1); entry_jet=leg_jet->AddEntry("raaheavy","*b-jet (0-10%) |#eta| < 2","lpf"); entry_jet->SetFillColor(TColor::GetColor("#FFBF00")); entry_jet->SetFillStyle(1001); entry_jet->SetLineColor(1); entry_jet->SetLineStyle(1); entry_jet->SetLineWidth(1); entry_jet->SetMarkerStyle(21); entry_jet->SetMarkerColor(kRed); entry_jet->SetMarkerSize(1); leg->Draw(); //leg_taa->Draw(); leg_ewq->Draw(); leg_q->Draw(); leg_jet->Draw(); gPad->RedrawAxis(); // save the work // pc->SaveAs("raaZoo_cms_log.pdf"); // pc->SaveAs("raaZoo_cms_log.png"); //-------------------------------------------------------------------------------- //-------------------------- 2TPad //double sizeincrease = 1.2; TH1 *phAxis_single = new TH1D("phAxis_single",";p_{T} (m_{T}) [GeV];R_{AA}",1,0,105); phAxis_single->GetYaxis()->CenterTitle(true); //phAxis_single->GetXaxis()->CenterTitle(true); //double defaxissize = phAxis_single->GetYaxis()->GetTitleSize(); //double defaxislabel = phAxis_single->GetYaxis()->GetLabelSize(); //phAxis_single->GetYaxis()->SetTitleSize(defaxissize*sizeincrease); //phAxis_single->GetXaxis()->SetTitleSize(defaxissize*sizeincrease); //phAxis_single->GetYaxis()->SetLabelSize(defaxislabel*sizeincrease); //phAxis_single->GetXaxis()->SetLabelSize(defaxislabel*sizeincrease); //phAxis_single->GetYaxis()->SetNdivisions(310); //phAxis_single->GetXaxis()->SetNdivisions(310); //phAxis_single->GetYaxis()->SetTitleOffset(0.85); //phAxis_single->GetXaxis()->SetTitleOffset(0.85); phAxis_single->SetMinimum(0.); phAxis_single->SetMaximum(2.5); TH1 *phAxis_jet = new TH1D("phAxis_jet",";p_{T} [GeV];",1,75,300); //phAxis_jet->GetYaxis()->CenterTitle(true); //phAxis_jet->GetXaxis()->CenterTitle(true); //phAxis_jet->GetYaxis()->SetTitleSize(defaxissize*sizeincrease); //phAxis_jet->GetXaxis()->SetTitleSize(defaxissize*sizeincrease); //phAxis_jet->GetYaxis()->SetLabelSize(defaxislabel*sizeincrease); phAxis_jet->GetYaxis()->SetLabelColor(0); //phAxis_jet->GetXaxis()->SetLabelSize(defaxislabel*sizeincrease); //phAxis_jet->GetYaxis()->SetNdivisions(310); //phAxis_jet->GetXaxis()->SetNdivisions(310); //phAxis_jet->GetYaxis()->SetTitleOffset(0.85); //phAxis_jet->GetXaxis()->SetTitleOffset(0.85); phAxis_jet->SetMinimum(0.); phAxis_jet->SetMaximum(2.5); // redefine legends: // TAA only /*TLegend *leg2_taa = new TLegend(0.15,0.85,0.5,0.9,NULL,"brNDC"); leg2_taa->SetBorderSize(0); leg2_taa->SetTextFont(62); leg2_taa->SetTextSize(0.028); leg2_taa->SetLineColor(1); leg2_taa->SetLineStyle(1); leg2_taa->SetLineWidth(1); leg2_taa->SetFillColor(19); leg2_taa->SetFillStyle(0); TLegendEntry *entry2_taa= leg2_taa->AddEntry("general","T_{AA} uncertainty (0-5%)","f"); entry2_taa->SetFillColor(kGray+1); entry2_taa->SetFillStyle(1001); entry2_taa->SetLineColor(0); entry2_taa->SetLineWidth(1); entry2_taa->SetMarkerStyle(21); entry2_taa->SetMarkerSize(1);*/ TLegend *leg2 = new TLegend(0.04,0.81,0.34,0.93,NULL,"brNDC"); leg2->SetBorderSize(0); leg2->SetTextFont(62); leg2->SetTextSize(0.03); //leg2->SetLineColor(1); //leg2->SetLineStyle(1); //leg2->SetLineWidth(1); //leg2->SetFillColor(19); leg2->SetFillStyle(0); TLegendEntry *entry2=leg2->AddEntry("general","CMS *PRELIMINARY PbPb #sqrt{s_{NN}} = 2.76 TeV",""); entry2=leg2->AddEntry("general","#int L dt = 7-150 #mub^{-1}",""); // jet leg2end TLegend *leg2_jet = new TLegend(0.08,0.73,0.64,0.81,NULL,"brNDC"); leg2_jet->SetBorderSize(0); leg2_jet->SetTextFont(62); leg2_jet->SetTextSize(0.028); leg2_jet->SetLineColor(1); leg2_jet->SetLineStyle(1); leg2_jet->SetLineWidth(1); leg2_jet->SetFillColor(19); leg2_jet->SetFillStyle(0); TLegendEntry *entry2_jet=leg2_jet->AddEntry("raaq","*q/g-jet (0-5%) |#eta| < 2","lpf"); entry2_jet->SetFillColor(TColor::GetColor("#00FF60")); entry2_jet->SetFillStyle(1001); entry2_jet->SetLineColor(1); entry2_jet->SetLineStyle(1); entry2_jet->SetLineWidth(1); entry2_jet->SetMarkerStyle(22); entry2_jet->SetMarkerSize(mymarkersize); if(version > 5) { entry2_jet=leg2_jet->AddEntry("raaheavy","*b-jet (0-10%) |#eta| < 2","lpf"); entry2_jet->SetFillColor(TColor::GetColor("#FFBF00")); entry2_jet->SetFillStyle(1001); entry2_jet->SetLineColor(1); entry2_jet->SetLineStyle(1); entry2_jet->SetLineWidth(1); entry2_jet->SetMarkerStyle(21); entry2_jet->SetMarkerColor(kRed); entry2_jet->SetMarkerSize(mymarkersize); } else entry2_jet=leg2_jet->AddEntry("raaheavy","",""); // EWQ legend TLegend *leg2_ewq = new TLegend(0.14,0.81,0.7,0.93,NULL,"brNDC"); leg2_ewq->SetBorderSize(0); leg2_ewq->SetTextFont(62); leg2_ewq->SetTextSize(0.028); leg2_ewq->SetLineColor(1); leg2_ewq->SetLineStyle(1); leg2_ewq->SetLineWidth(1); leg2_ewq->SetFillColor(19); leg2_ewq->SetFillStyle(0); TLegendEntry *entry2_ewq; if(version > 1) { entry2_ewq=leg2_ewq->AddEntry("raaz","*Z (0-100%) |y| < 2","lpf"); entry2_ewq->SetFillColor(TColor::GetColor("#ff8888")); entry2_ewq->SetFillStyle(1001); entry2_ewq->SetLineColor(1); entry2_ewq->SetLineWidth(1); entry2_ewq->SetMarkerStyle(22); entry2_ewq->SetMarkerSize(mymarkersize); } else entry2_ewq=leg2_ewq->AddEntry("raaz","",""); if(version > 2) { entry2_ewq=leg2_ewq->AddEntry("raaw","W (0-100%) p_{T}^{#mu} > 25 GeV/c^{^{ }}, |#eta^{#mu}| < 2.1","lpf"); entry2_ewq->SetFillColor(TColor::GetColor("#ff88ff")); entry2_ewq->SetFillStyle(1001); entry2_ewq->SetLineColor(1); entry2_ewq->SetLineWidth(1); entry2_ewq->SetMarkerStyle(21); entry2_ewq->SetMarkerSize(mymarkersize); } else entry2_ewq=leg2_ewq->AddEntry("raaw","",""); if(version > 0) { entry2_ewq=leg2_ewq->AddEntry("raaphoton","Isolated photon (0-10%) |#eta| < 1.44","lpf"); entry2_ewq->SetFillColor(TColor::GetColor("#ffff00")); entry2_ewq->SetFillStyle(1001); entry2_ewq->SetLineColor(1); entry2_ewq->SetLineWidth(1); entry2_ewq->SetMarkerStyle(23); entry2_ewq->SetMarkerSize(mymarkersize); } else entry2_ewq=leg2_ewq->AddEntry("raaphoton","",""); // B and h TLegend *leg2_q = new TLegend(0.14,0.74,0.7,0.81,NULL,"brNDC"); leg2_q->SetBorderSize(0); leg2_q->SetTextFont(62); leg2_q->SetTextSize(0.028); leg2_q->SetLineColor(1); leg2_q->SetLineStyle(1); leg2_q->SetLineWidth(1); leg2_q->SetFillColor(19); leg2_q->SetFillStyle(0); TLegendEntry *entry2_q; if(version > 3) { entry2_q=leg2_q->AddEntry("raah","Charged particles (0-5%) |#eta| < 1","lpf"); entry2_q->SetFillColor(TColor::GetColor("#33ccff")); entry2_q->SetFillStyle(1001); entry2_q->SetLineColor(1); entry2_q->SetLineStyle(1); entry2_q->SetLineWidth(1); entry2_q->SetMarkerStyle(kFullCircle); entry2_q->SetMarkerSize(mymarkersize); } else entry2_q=leg2_q->AddEntry("raah","",""); if(version > 5) { entry2_q=leg2_q->AddEntry("raab","*B #rightarrow J/#psi (0-100%) |y| < 2.4","lpf"); // entry2_q->SetFillColor(TColor::GetColor("#ee7711")); entry2_q->SetFillColor(TColor::GetColor("#ba8a98")); entry2_q->SetFillStyle(1001); entry2_q->SetLineColor(1); entry2_q->SetLineStyle(1); entry2_q->SetLineWidth(1); entry2_q->SetMarkerStyle(29); entry2_q->SetMarkerColor(kRed); entry2_q->SetMarkerSize(mymarkersize); //entry2_q=leg2_q->AddEntry("raabjpsi", "(via secondary J/#psi)",""); } else { entry2_q=leg2_q->AddEntry("raab","",""); entry2_q=leg2_q->AddEntry("raab","",""); } if(bDo2PadZoo) { TCanvas *pc2 = new TCanvas("pc2","pc2",1200,600); TPad *p_0 = new TPad("p_0","p_0",0,0,0.50,1); p_0->Draw(); p_0->cd(); p_0->SetRightMargin(0.03); phAxis_single->Draw(""); //box_lin->Draw(); pgRaa_photon->SetMarkerSize(mymarkersize); pgRaa_z->SetMarkerSize(mymarkersize); pgRaa_h->SetMarkerSize(mymarkersize); pgRaa_w->SetMarkerSize(mymarkersize); pgRaa_npjpsi->SetMarkerSize(mymarkersize); pgRaa_bjet->SetMarkerSize(mymarkersize); pgRaa_jet->SetMarkerSize(mymarkersize); if(version > 0) pgRaaSyst_photon->Draw("2"); if(version > 1) pgRaaSyst_z->Draw("2"); if(version > 3) pgRaaSyst_h->Draw("2"); if(version > 2) pgRaaSyst_w->Draw("2"); if(version > 5) pgRaaSyst_npjpsi->Draw("2"); if(version > 0) pgRaa_photon->Draw("P z"); if(version > 1) pgRaa_z->Draw("P z"); if(version > 3) pgRaa_h->Draw("P z"); if(version > 2) pgRaa_w->Draw("P z"); if(version > 5) pgRaa_npjpsi->Draw("P z"); TLine *line_single = new TLine(0,1,105,1); line_single->SetLineStyle(7); line_single->Draw(); // legends //leg2_taa->Draw(); leg2_q->Draw(); leg2_ewq->Draw(); TLine * midborder = new TLine(99.9,0,99.9,2); midborder->SetLineStyle(1); //if(version < 5) midborder->Draw(); pc2->cd(); // midborder->Draw(); if(version > 4) { // jet pad TPad *p_1 = new TPad("p_1","p_1",0.50,0,1,1); p_1->Draw(); p_1->cd(); p_1->SetLeftMargin(0.06); p_1->SetTickx(1); p_1->SetTicky(1); if(version > 4) phAxis_jet->Draw(""); if(version > 5) pgRaaSyst_bjet->Draw("2"); if(version > 4) pgRaaSyst_jet->Draw("2"); if(version > 5) pgRaa_bjet->Draw("P z"); if(version > 4) pgRaa_jet->Draw("P z"); TLine *line_jet = new TLine(75,1,300,1); line_jet->SetLineStyle(7); line_jet->Draw(); leg2->Draw(); leg2_jet->Draw(); } p_0->cd(); gPad->RedrawAxis(); //! adds the latex "100" joining the two pads //pc2->cd(); //TPad * blankpad = new TPad("b", "b",0.48,0.07,0.52,0.11); //blankpad->SetBorderMode(0); //blankpad->Draw(); //blankpad->cd(); //TLatex * test = new TLatex( 0.102843, 0.122822, Form("100")); //test->SetTextSize(test->GetTextSize()*26.0*sizeincrease); //test->Draw("same"); //blankpad->Update(); // pc2->SaveAs(Form("raaZoo_cms_2pads_%d.pdf",version)); //pc2->SaveAs(Form("raaZoo_cms_2pads_%d.png",version)); } }
void plot() { int MPC315color = kBlack; int T725color = kRed+1; int T777color = kGreen+1; int T557color = kBlue-7; int sample0marker = 20; float sample0markersize = 1.2; int sample1marker = 21; float sample1markersize = 1.0; int sample2marker = 20; float sample2markersize = 1.0; int i; TGraphErrors * grMPC315_11 = new TGraphErrors(); int nMPC315_11 = 0; grMPC315_11->SetMarkerSize(sample0markersize); grMPC315_11->SetMarkerStyle(sample0marker); grMPC315_11->SetMarkerColor(MPC315color); grMPC315_11->SetLineColor(MPC315color); TGraphErrors * grMPC315_1 = new TGraphErrors(); int nMPC315_1 = 0; grMPC315_1->SetMarkerSize(sample1markersize); grMPC315_1->SetMarkerStyle(sample1marker); grMPC315_1->SetMarkerColor(MPC315color); grMPC315_1->SetLineColor(MPC315color); grMPC315_1->SetFillColor(MPC315color); TGraphErrors * grMPC315_10 = new TGraphErrors(); int nMPC315_10 = 0; grMPC315_10->SetMarkerSize(sample1markersize); grMPC315_10->SetMarkerStyle(sample1marker); grMPC315_10->SetMarkerColor(MPC315color); grMPC315_10->SetLineColor(MPC315color); TGraphErrors * grMPC315_2 = new TGraphErrors(); int nMPC315_2 = 0; grMPC315_2->SetMarkerSize(sample2markersize); grMPC315_2->SetMarkerStyle(sample2marker); grMPC315_2->SetMarkerColor(MPC315color); grMPC315_2->SetLineColor(MPC315color); i = 0; while (MPC315[i].irradiation!=-1.0) { if (MPC315[i].sample==11) { grMPC315_11->SetPoint(nMPC315_11, MPC315[i].impedance, -0.1+MPC315[i].delta); grMPC315_11->SetPointError(nMPC315_11, MPC315[i].error, 0.0); nMPC315_11++; } if (MPC315[i].sample==1) { grMPC315_1->SetPoint(nMPC315_1, MPC315[i].irradiation+MPC315[i].delta, MPC315[i].impedance); grMPC315_1->SetPointError(nMPC315_1, 0.0, MPC315[i].error); nMPC315_1++; } if (MPC315[i].sample==1 && MPC315[i].irradiation==0.0) { grMPC315_10->SetPoint(nMPC315_10, MPC315[i].impedance, +0.1+MPC315[i].delta); grMPC315_10->SetPointError(nMPC315_10, MPC315[i].error, 0.0); nMPC315_10++; } if (MPC315[i].sample==2) { grMPC315_2->SetPoint(nMPC315_2, MPC315[i].irradiation+MPC315[i].delta, MPC315[i].impedance); grMPC315_2->SetPointError(nMPC315_2, 0.0, MPC315[i].error); nMPC315_2++; } i++; } TGraphErrors * grT725_11 = new TGraphErrors(); int nT725_11 = 0; grT725_11->SetMarkerSize(sample0markersize); grT725_11->SetMarkerStyle(sample0marker); grT725_11->SetMarkerColor(T725color); grT725_11->SetLineColor(T725color); TGraphErrors * grT725_1 = new TGraphErrors(); int nT725_1 = 0; grT725_1->SetMarkerSize(sample1markersize); grT725_1->SetMarkerStyle(sample1marker); grT725_1->SetMarkerColor(T725color); grT725_1->SetLineColor(T725color); grT725_1->SetFillColor(T725color); TGraphErrors * grT725_10 = new TGraphErrors(); int nT725_10 = 0; grT725_10->SetMarkerSize(sample1markersize); grT725_10->SetMarkerStyle(sample1marker); grT725_10->SetMarkerColor(T725color); grT725_10->SetLineColor(T725color); TGraphErrors * grT725_2 = new TGraphErrors(); int nT725_2 = 0; grT725_2->SetMarkerSize(sample2markersize); grT725_2->SetMarkerStyle(sample2marker); grT725_2->SetMarkerColor(T725color); grT725_2->SetLineColor(T725color); i = 0; while (T725[i].irradiation!=-1.0) { if (T725[i].sample==11) { grT725_11->SetPoint(nT725_11, T725[i].impedance, 1.0-0.1+T725[i].delta); grT725_11->SetPointError(nT725_11, T725[i].error, 0.0); nT725_11++; } if (T725[i].sample==1) { grT725_1->SetPoint(nT725_1, T725[i].irradiation+T725[i].delta, T725[i].impedance); grT725_1->SetPointError(nT725_1, 0.0, T725[i].error); nT725_1++; } if (T725[i].sample==1 && T725[i].irradiation==0.0) { grT725_10->SetPoint(nT725_10, T725[i].impedance, 1.0+0.1+T725[i].delta); grT725_10->SetPointError(nT725_10, T725[i].error, 0.0); nT725_10++; } if (T725[i].sample==2) { grT725_2->SetPoint(nT725_2, T725[i].irradiation+T725[i].delta, T725[i].impedance); grT725_2->SetPointError(nT725_2, 0.0, T725[i].error); nT725_2++; } i++; } TGraphErrors * grT777_11 = new TGraphErrors(); int nT777_11 = 0; grT777_11->SetMarkerSize(sample0markersize); grT777_11->SetMarkerStyle(sample0marker); grT777_11->SetMarkerColor(T777color); grT777_11->SetLineColor(T777color); TGraphErrors * grT777_12 = new TGraphErrors(); int nT777_12 = 0; grT777_12->SetMarkerSize(sample0markersize); grT777_12->SetMarkerStyle(sample0marker); grT777_12->SetMarkerColor(T777color+2); grT777_12->SetLineColor(T777color+2); TGraphErrors * grT777_1 = new TGraphErrors(); int nT777_1 = 0; grT777_1->SetMarkerSize(sample1markersize); grT777_1->SetMarkerStyle(sample1marker); grT777_1->SetMarkerColor(T777color); grT777_1->SetLineColor(T777color); grT777_1->SetFillColor(T777color); TGraphErrors * grT777_10 = new TGraphErrors(); int nT777_10 = 0; grT777_10->SetMarkerSize(sample1markersize); grT777_10->SetMarkerStyle(sample1marker); grT777_10->SetMarkerColor(T777color); grT777_10->SetLineColor(T777color); TGraphErrors * grT777_2 = new TGraphErrors(); int nT777_2 = 0; grT777_2->SetMarkerSize(sample2markersize); grT777_2->SetMarkerStyle(sample2marker); grT777_2->SetMarkerColor(T777color); grT777_2->SetLineColor(T777color); i = 0; while (T777[i].irradiation!=-1.0) { if (T777[i].sample==11) { grT777_11->SetPoint(nT777_11, T777[i].impedance, 2.0-0.1+T777[i].delta); grT777_11->SetPointError(nT777_11, T777[i].error, 0.0); nT777_11++; } if (T777[i].sample==12) { grT777_12->SetPoint(nT777_12, T777[i].impedance, 2.0-0.1+T777[i].delta); grT777_12->SetPointError(nT777_12, T777[i].error, 0.0); nT777_12++; } if (T777[i].sample==1) { grT777_1->SetPoint(nT777_1, T777[i].irradiation+T777[i].delta, T777[i].impedance); grT777_1->SetPointError(nT777_1, 0.0, T777[i].error); nT777_1++; } if (T777[i].sample==1 && T777[i].irradiation==0.0) { grT777_10->SetPoint(nT777_10, T777[i].impedance, 2.0+0.1+T777[i].delta); grT777_10->SetPointError(nT777_10, T777[i].error, 0.0); nT777_10++; } if (T777[i].sample==2) { grT777_2->SetPoint(nT777_2, T777[i].irradiation+T777[i].delta, T777[i].impedance); grT777_2->SetPointError(nT777_2, 0.0, T777[i].error); nT777_2++; } i++; } TGraphErrors * grT557_11 = new TGraphErrors(); int nT557_11 = 0; grT557_11->SetMarkerSize(sample0markersize); grT557_11->SetMarkerStyle(sample0marker); grT557_11->SetMarkerColor(T557color); grT557_11->SetLineColor(T557color); TGraphErrors * grT557_1 = new TGraphErrors(); int nT557_1 = 0; grT557_1->SetMarkerSize(sample1markersize); grT557_1->SetMarkerStyle(sample1marker); grT557_1->SetMarkerColor(T557color); grT557_1->SetLineColor(T557color); grT557_1->SetFillColor(T557color); TGraphErrors * grT557_10 = new TGraphErrors(); int nT557_10 = 0; grT557_10->SetMarkerSize(sample1markersize); grT557_10->SetMarkerStyle(sample1marker); grT557_10->SetMarkerColor(T557color); grT557_10->SetLineColor(T557color); TGraphErrors * grT557_2 = new TGraphErrors(); int nT557_2 = 0; grT557_2->SetMarkerSize(sample2markersize); grT557_2->SetMarkerStyle(sample2marker); grT557_2->SetMarkerColor(T557color); grT557_2->SetLineColor(T557color); i = 0; while (T557[i].irradiation!=-1.0) { if (T557[i].sample==11) { grT557_11->SetPoint(nT557_11, T557[i].impedance, 3.0-0.1+T557[i].delta); grT557_11->SetPointError(nT557_11, T557[i].error, 0.0); nT557_11++; } if (T557[i].sample==1) { grT557_1->SetPoint(nT557_1, T557[i].irradiation+T557[i].delta, T557[i].impedance); grT557_1->SetPointError(nT557_1, 0.0, T557[i].error); nT557_1++; } if (T557[i].sample==1 && T557[i].irradiation==0.0) { grT557_10->SetPoint(nT557_10, T557[i].impedance, 3.0+0.1+T557[i].delta); grT557_10->SetPointError(nT557_10, T557[i].error, 0.0); nT557_10++; } if (T557[i].sample==2) { grT557_2->SetPoint(nT557_2, T557[i].irradiation+T557[i].delta, T557[i].impedance); grT557_2->SetPointError(nT557_2, 0.0, T557[i].error); nT557_2++; } i++; } double Rmax = 4.25; TCanvas * c= new TCanvas("c", "c", 700, 500); c->SetGridx(false); c->SetGridy(true); c->Clear(); TH1F * frame = c->DrawFrame(-0.5, 0.0, 3.5, Rmax); frame->GetXaxis()->SetNdivisions(505); frame->GetXaxis()->SetTickLength(0); frame->GetXaxis()->SetTitle("irradiation [MGy]"); frame->GetYaxis()->SetTitle("thermal impedance [K cm^2/W]"); grMPC315_1->Draw("P"); grMPC315_2->Draw("P"); TLatex * latex = new TLatex(-0.25, 3.60, "MPC315"); latex->Draw(); c->Print("RvsDose_MPC325.pdf"); c->Clear(); TH1F * frame = c->DrawFrame(-0.5, 0.0, 3.5, Rmax); frame->GetXaxis()->SetNdivisions(505); frame->GetXaxis()->SetTickLength(0); frame->GetXaxis()->SetTitle("irradiation [MGy]"); frame->GetYaxis()->SetTitle("thermal impedance [K cm^2/W]"); grT725_1->Draw("P"); grT725_2->Draw("P"); TLatex * latex = new TLatex(-0.25, 3.60, "T725"); latex->Draw(); c->Print("RvsDose_T725.pdf"); c->Clear(); TH1F * frame = c->DrawFrame(-0.5, 0.0, 3.5, Rmax); frame->GetXaxis()->SetNdivisions(505); frame->GetXaxis()->SetTickLength(0); frame->GetXaxis()->SetTitle("irradiation [MGy]"); frame->GetYaxis()->SetTitle("thermal impedance [K cm^2/W]"); grT777_1->Draw("P"); grT777_2->Draw("P"); TLatex * latex = new TLatex(-0.25, 3.60, "T777"); latex->Draw(); c->Print("RvsDose_T7777.pdf"); c->Clear(); TH1F * frame = c->DrawFrame(-0.5, 0.0, 3.5, Rmax); frame->GetXaxis()->SetNdivisions(505); frame->GetXaxis()->SetTickLength(0); frame->GetXaxis()->SetTitle("irradiation [MGy]"); frame->GetYaxis()->SetTitle("thermal impedance [K cm^2/W]"); grT557_1->Draw("P"); grT557_2->Draw("P"); TLatex * latex = new TLatex(-0.25, 3.60, "T557"); latex->Draw(); c->Print("RvsDose_T557.pdf"); c->Clear(); TH1F * frame = c->DrawFrame(-0.5, 0.0, 3.5, Rmax); frame->GetXaxis()->SetNdivisions(505); frame->GetXaxis()->SetTickLength(0); frame->GetXaxis()->SetTitle("irradiation [MGy]"); frame->GetYaxis()->SetTitle("thermal impedance [K cm^2/W]"); grMPC315_1->Draw("P"); grMPC315_2->Draw("P"); grT725_1->Draw("P"); grT725_2->Draw("P"); grT777_1->Draw("P"); grT777_2->Draw("P"); grT557_1->Draw("P"); grT557_2->Draw("P"); c->Print("RvsDoseNoLegend.pdf"); TLegend * legend = new TLegend(0.15, 0.65, 0.3, 0.875); legend->AddEntry(grMPC315_1, "MPC315", "F"); legend->AddEntry(grT725_1, "T725", "F"); legend->AddEntry(grT777_1, "T777", "F"); legend->AddEntry(grT557_1, "T557", "F"); legend->Draw(); c->Print("RvsDose.pdf"); int specMarkerStyle = 4; float specMarkerSize = 1.2; TGraph * grMPC315specs = new TGraph(); grMPC315specs->SetMarkerSize(specMarkerSize); grMPC315specs->SetMarkerStyle(specMarkerStyle); grMPC315specs->SetMarkerColor(MPC315color); grMPC315specs->SetPoint(0, 0.208, 0.25); TGraph * grT725specs = new TGraph(); grT725specs->SetMarkerStyle(specMarkerStyle); grT725specs->SetMarkerSize(specMarkerSize); grT725specs->SetMarkerColor(T725color); grT725specs->SetPoint(0, 0.710, 1); TGraph * grT777specs = new TGraph(); grT777specs->SetMarkerStyle(specMarkerStyle); grT777specs->SetMarkerSize(specMarkerSize); grT777specs->SetMarkerColor(T777color); grT777specs->SetPoint(0, 0.130, 2.1); TGraph * grT557specs = new TGraph(); grT557specs->SetMarkerStyle(specMarkerStyle); grT557specs->SetMarkerSize(specMarkerSize); grT557specs->SetMarkerColor(T557color); grT557specs->SetPoint(0, 0.130, 3); c->Clear(); c->SetGridx(true); c->SetGridy(false); TH1F * frame = c->DrawFrame(-0.1, -0.5, 2.4, 3.5); frame->GetXaxis()->SetNdivisions(520); frame->GetXaxis()->SetTitle("thermal impedance [K cm^2/W]"); frame->GetYaxis()->Set(4, -0.5, 3.5); frame->GetYaxis()->SetLabelSize(0.05); frame->GetYaxis()->SetBinLabel(1, "MPC315"); frame->GetYaxis()->SetBinLabel(2, "T725"); frame->GetYaxis()->SetBinLabel(3, "T777"); frame->GetYaxis()->SetBinLabel(4, "T557"); frame->GetYaxis()->SetTickLength(0); grMPC315specs->Draw("P"); grT725specs->Draw("P"); grT777specs->Draw("P"); grT557specs->Draw("P"); grMPC315_11->Draw("P"); grT725_11->Draw("P"); grT777_11->Draw("P"); grT777_12->Draw("P"); grT557_11->Draw("P"); TLine * line = new TLine(-0.1, 0.5, 2.4, 0.5); line->Draw(); TLine * line = new TLine(-0.1, 1.5, 2.4, 1.5); line->Draw(); TLine * line = new TLine(-0.1, 2.5, 2.4, 2.5); line->Draw(); TLegend * legend = new TLegend(0.5, 0.15, 0.875, 0.275); legend->AddEntry(grMPC315specs, "specs", "P"); legend->AddEntry(grMPC315_11, "measured (10 psi)", "P"); legend->AddEntry(grMPC315_10, "measured (0 psi)", "P"); legend->Draw(); c->Print("TIM_Comparison_Specs.pdf"); grMPC315_10->Draw("P"); grT725_10->Draw("P"); grT777_10->Draw("P"); grT557_10->Draw("P"); c->Print("TIM_Comparison.pdf"); }
void makeStack(TString myVar, TString myCut, TString myName, TString myAxisNameX, TString myAxisNameY, vector<const Sample*>& listOfSignals, vector<const Sample*>& listOfSamples, vector<const Sample*> listOfDatasets, TString inFileName, bool isBlind, bool isLog, bool drawSignal, bool drawLegend, int nBins, float xLow, float xHigh, float* xlowVec) { // prepare the input file TFile* infile = new TFile(inFileName, "READ"); infile -> cd(); // prepare the stack THStack *hs = new THStack("hs",""); // prepare the histos pointers TH1F* hist[20]; // prepare the tree pointers TTree* tree[20]; // prepare the legend TLegend* leg = new TLegend(.7485,.7225,.9597,.9604); leg->SetFillColor(0); // prepare the colors Int_t col[20] = {46,2,12,5,3,4,9,7,47,49,49,50,51,52,53,54,55,56,57,58}; // prepare the cut if (isBlind) myCut += "*(phoMetDeltaPhi < 2.9)"; // prepare the Y axis lable if (xlowVec != 0) myAxisNameY = "Events/" + myAxisNameY; else { float binWidth = (xHigh-xLow)/nBins; TString tempString; tempString.Form("%.2f ",binWidth); myAxisNameY = "Events/" + tempString + myAxisNameY; } // prepare the legend strings vector<TString> theLegends; // loop through the datasets and produce the plots TH1F* hdata; TH1F* hsignal; //prepare data and signal histos if (xlowVec != 0) hdata = new TH1F("hdata","",nBins,xlowVec); else hdata = new TH1F("hdata","",nBins,xLow,xHigh); if (xlowVec != 0) hsignal = new TH1F("hsignal","",nBins,xlowVec); else hsignal = new TH1F("hsignal","",nBins,xLow,xHigh); TTree* treedata[20]; for (UInt_t iDatas=0; iDatas < listOfDatasets.size(); iDatas++) { //get the tree treedata[iDatas] = (TTree*) infile -> Get(listOfDatasets.at(iDatas)->Name()->Data()); //fill the histogram if ( iDatas == 0 ) treedata[iDatas] -> Draw(myVar + " >> hdata","evt_weight*kf_weight*pu_weight" + myCut); else treedata[iDatas] -> Draw(myVar + " >>+ hdata","evt_weight*kf_weight*pu_weight" + myCut); if ( isBlind && iDatas == 0 ) leg -> AddEntry(hdata, "DATA (19.8 fb^{-1})", "pl"); }//end loop on datasets if (xlowVec != 0) { for (int iBin = 1; iBin <= nBins; iBin++) hdata->SetBinError (iBin,hdata->GetBinError(iBin)/hdata->GetBinWidth(iBin)); for (int iBin = 1; iBin <= nBins; iBin++) hdata->SetBinContent(iBin,hdata->GetBinContent(iBin)/hdata->GetBinWidth(iBin)); } TTree* treesignal[20]; for (UInt_t iSignal=0; iSignal < listOfSignals.size(); iSignal++) { //get the tree treesignal[iSignal] = (TTree*) infile -> Get(listOfSignals.at(iSignal)->Name()->Data()); //fill the histogram TString thisScale = Form("%f *", *(listOfSignals.at(iSignal)->Scale())); if ( iSignal == 0 ) treesignal[iSignal] -> Draw(myVar + " >> hsignal",thisScale + "evt_weight*kf_weight*pu_weight" + myCut); else treesignal[iSignal] -> Draw(myVar + " >>+ hsignal",thisScale + "evt_weight*kf_weight*pu_weight" + myCut); if ( drawSignal && iSignal == 0 ) leg -> AddEntry(hsignal, "Signal", "l"); }//end loop on signals if (xlowVec != 0) { for (int iBin = 1; iBin <= nBins; iBin++) hsignal->SetBinError (iBin,hsignal->GetBinError(iBin)/hsignal->GetBinWidth(iBin)); for (int iBin = 1; iBin <= nBins; iBin++) hsignal->SetBinContent(iBin,hsignal->GetBinContent(iBin)/hsignal->GetBinWidth(iBin)); } hsignal -> SetLineColor(49); hsignal -> SetLineWidth(4.0); int theHistCounter = 0; // loop through the samples and produce the plots for (UInt_t iSample=0; iSample < listOfSamples.size(); iSample++) { //determine if the histo is first of the series bool isFirstOfSerie = (*listOfSamples.at(iSample)->Legend()).CompareTo(" "); bool isLastOfSerie = false; if (iSample == listOfSamples.size() - 1) isLastOfSerie = true; if (iSample < listOfSamples.size() - 1 && (*listOfSamples.at(iSample+1)->Legend()).CompareTo(" ") != 0) isLastOfSerie = true; //get the tree tree[iSample] = (TTree*) infile -> Get(listOfSamples.at(iSample)->Name()->Data()); //if sample first of the list create a new histogram if (isFirstOfSerie) { TString thisHistName = "h_" + *(listOfSamples.at(iSample)->Name()); //variable bin histo if (xlowVec != 0) hist[theHistCounter] = new TH1F(thisHistName,thisHistName,nBins,xlowVec); //fixed bin histo else hist[theHistCounter] = new TH1F(thisHistName,thisHistName,nBins,xLow,xHigh); hist[theHistCounter] -> Sumw2(); hist[theHistCounter] -> SetFillColor(col[theHistCounter]); hist[theHistCounter] -> SetFillStyle(1001); theLegends.push_back(*listOfSamples.at(iSample)->Legend()); } //fill the histogram TString thisScale = Form("%f *", *(listOfSamples.at(iSample)->Scale())); if (isFirstOfSerie) tree[iSample] -> Draw(myVar + " >> " + TString(hist[theHistCounter] -> GetName()),thisScale + "evt_weight*kf_weight*pu_weight" + myCut); else tree[iSample] -> Draw(myVar + " >>+ " + TString(hist[theHistCounter] -> GetName()),thisScale + "evt_weight*kf_weight*pu_weight" + myCut); //add the histogram to the stack if the last of the series: //either last sample or ~ sample followed by non ~ sample if (isLastOfSerie) { if (xlowVec != 0) { for (int iBin = 1; iBin <= nBins; iBin++) hist[theHistCounter]->SetBinError (iBin,hist[theHistCounter]->GetBinError(iBin)/hist[theHistCounter]->GetBinWidth(iBin)); for (int iBin = 1; iBin <= nBins; iBin++) hist[theHistCounter]->SetBinContent(iBin,hist[theHistCounter]->GetBinContent(iBin)/hist[theHistCounter]->GetBinWidth(iBin)); } hs -> Add(hist[theHistCounter]); theHistCounter++; } }//end loop on samples //Fix the legend for (int iHisto = theHistCounter-1; iHisto >= 0; iHisto--) { leg -> AddEntry(hist[iHisto], theLegends[iHisto], "f"); } //get the maximum to properly set the frame float theMax = hdata -> GetBinContent(hdata -> GetMaximumBin()) + hdata -> GetBinError(hdata -> GetMaximumBin()); TH1* theMCSum = (TH1*) hs->GetStack()->Last(); float theMaxMC = theMCSum->GetBinContent(theMCSum->GetMaximumBin()) + theMCSum->GetBinError(theMCSum->GetMaximumBin()); if (theMaxMC > theMax) theMax = theMaxMC; //prepare the ratio band and plot TH1* theMCRatioBand = makeRatioBand(theMCSum); TH1* theRatioPlot = makeRatioPlot(hdata,theMCSum); TCanvas* can = new TCanvas(); can -> SetLogy(isLog); TPad *pad1 = new TPad("pad1","top pad",0,0.30,1,1); pad1->SetBottomMargin(0.02); pad1->SetLeftMargin(0.13); pad1->Draw(); TPad *pad2 = new TPad("pad2","bottom pad",0,0.0,1,0.30); pad2->SetTopMargin(0.02); pad2->SetLeftMargin(0.13); pad2->SetBottomMargin(0.4); pad2->SetGridy(); pad2->Draw(); pad1->cd(); hs->Draw("hist"); hdata->Draw("same,pe"); if (drawSignal) hsignal->Draw("same,hist"); if (drawLegend) leg->Draw("same"); //hs->GetXaxis()->SetTitle(myAxisNameX); hs->GetYaxis()->SetTitle(myAxisNameY); hs->GetXaxis()->SetLabelSize(0.04); hs->GetYaxis()->SetLabelSize(0.04); hs->GetXaxis()->SetLabelOffset(0.025); hs->GetYaxis()->SetLabelOffset(0.035); //hs->GetXaxis()->SetTitleOffset(1.1); hs->GetYaxis()->SetTitleOffset(1.1); hs->SetMaximum(theMax); if (isLog) hs->SetMinimum(0.01); pad2->cd(); theMCRatioBand->GetXaxis()->SetTitle(myAxisNameX); theMCRatioBand->GetXaxis()->SetTitleSize(0.16); theMCRatioBand->GetXaxis()->SetTitleOffset(1.1); theMCRatioBand->GetXaxis()->SetLabelSize(0.12); theMCRatioBand->GetXaxis()->SetLabelOffset(0.07); theMCRatioBand->GetYaxis()->SetTitle("Data/MC"); theMCRatioBand->GetYaxis()->SetTitleSize(0.10); theMCRatioBand->GetYaxis()->SetTitleOffset(0.6); theMCRatioBand->GetYaxis()->SetLabelSize(0.06); theMCRatioBand->GetYaxis()->SetLabelOffset(0.03); theMCRatioBand->SetFillStyle(3001); theMCRatioBand->SetFillColor(kBlue); theMCRatioBand->SetLineWidth(1); theMCRatioBand->SetLineColor(kBlack); theMCRatioBand->SetMarkerSize(0.1); theMCRatioBand->SetMaximum(4.); theMCRatioBand->SetMinimum(0.); theMCRatioBand->Draw("E2"); TLine *line = new TLine(xLow,1,xHigh,1); line->SetLineColor(kBlack); line->Draw("same"); theRatioPlot->Draw("same,pe"); can->cd(); can->Modified(); can -> SaveAs(myName + ".pdf","pdf"); //cleanup the memory allocation delete theMCSum; delete hs; delete leg; delete hdata; delete pad1; delete pad2; delete can; delete theMCRatioBand; delete theRatioPlot; infile -> Close(); delete infile; return; }
void plottingmacro_IVF() { double fa = 0.46502; double fb = 0.53498; bool debug_ = true; // std::string path("Nov10thFall11Plots/"); // std::string path("Nov10Fall1160MTopSlimPlots/"); std::string path("Nov10Fall1160MTopIVFPlots_b/"); if(debug_) std::cout << "Init the style form setTDRStyle" << std::endl; setTDRStyle(); gStyle->SetErrorX(0.5); gROOT->ForceStyle(); initOptions(); if(debug_) std::cout << "Init the sample" << std::endl; // std::vector<Sample> s = Nov10thDiJetPtUpdatedSlimHistos(); //std::vector<Sample> s = Nov10Fall1160MTopSlimHistos(); std::vector<Sample> s = Nov10Fall1160MTopIVFHistos(); Sample data(1,"fake data","S1.root",0,true,1000); if(debug_) std::cout << "Init the data sample" << std::endl; for(size_t i=0;i< s.size();i++) if(s[i].data) {data=s[i];break;} if(debug_) std::cout << "Ls data sample" << std::endl; data.file()->ls(); if(debug_) std::cout << "Init the mc sample" << std::endl; for(size_t i=0;i< s.size();i++) s[i].dump(1,fa,fb); std::vector<std::string> names; if(debug_) std::cout << "Get List of Keys" << std::endl; TList * subs = data.file()->GetListOfKeys(); for(size_t i=0;i< subs->GetSize();i++) { TString nn = subs->At(i)->GetName(); if( nn.Contains(TRegexp("Count*")) ) continue; if(debug_) std::cout << "Get List of Keys in subdirs" << std::endl; TList * objs = ((TDirectoryFile *)data.file()->Get(subs->At(i)->GetName()))->GetListOfKeys(); for(size_t j=0;j< objs->GetSize();j++) { if(debug_) std::cout << "Name = " << subs->At(i)->GetName()+std::string("/") + objs->At(j)->GetName() << std::endl; names.push_back(subs->At(i)->GetName()+std::string("/") + objs->At(j)->GetName()); // std::cout << subs->At(i)->GetName() << "/" << objs->At(j)->GetName() << std::endl; //TODO: select plots via regexp } } if(debug_) std::cout << "Starting plotting" << std::endl; std::string process; for(size_t i = 0 ; i < names.size() ; i++) { std::map<std::string,TH1F *> grouped; TString n=names[i]; // if(!n.Contains(TRegexp("VlightRegionHZee/HiggsPtVlightRegionHZee"))) continue; // if(!n.Contains(TRegexp("VlightRegionHZee/ZPtVlightRegionHZee"))) continue; // if(!n.Contains(TRegexp("VlightRegionHZee"))) continue; // if(!n.Contains(TRegexp("ZSVRegionZmmSV"))) continue; // if(!n.Contains(TRegexp("ZSVRegionZeeSV"))) continue; // if(!n.Contains(TRegexp("ZSVRegionZcombSV"))) continue; // if(!n.Contains(TRegexp("ZSVPureRegionZcombSV"))) continue; // if(!n.Contains(TRegexp("ZSVTTbarPureRegionZcombSV"))) continue; if(!n.Contains(TRegexp("TTbarRegionZeeSVJets"))) continue; if(n.Contains(TRegexp("RegionHZcomb"))) process = "Z(l^{+}l^{-})H(b#bar{b})"; if(n.Contains(TRegexp("RegionHZmm"))) process = "Z(#mu^{+}#mu^{-})H(b#bar{b})"; if(n.Contains(TRegexp("RegionHZee"))) process = "Z(e^{+}e^{-})H(b#bar{b})"; if(debug_) std::cout << "Creating the Canvas" << std::endl; TCanvas *c = new TCanvas(); c->SetLogy(false); c->SetTitle(names[i].c_str()); if(debug_) std::cout << "Creating histograms" << std::endl; TH1F *hd = ((TH1F*)data.file()->Get(names[i].c_str())); hd->Sumw2(); Options o=options[names[i]]; // hd->Rebin(o.rebin); hd->SetMarkerStyle(20); hd->GetXaxis()->SetLabelOffset(99); hd->SetYTitle(o.yaxis.c_str()); double nbin = hd->GetNbinsX(); double min_bin = hd->GetXaxis()->GetXmin(); double max_bin = hd->GetXaxis()->GetXmax(); TH1F *hmc = new TH1F("hmc","hmc", nbin, min_bin, max_bin); hmc->SetFillColor(kWhite); hmc->Sumw2(); // hmc->Rebin(o.rebin); if(debug_) std::cout << "Creating the THStack and Legend" << std::endl; THStack * sta = new THStack("sta",hd->GetTitle()); TLegend * l = new TLegend(o.legendx1,o.legendy1,o.legendx2,o.legendy2); //0.7,0.1,0.9,0.6); l->SetFillColor(kWhite); l->SetBorderSize(0); l->SetTextFont(62); l->SetTextSize(0.03); if(debug_) std::cout << "Adding data to the legend" << std::endl; l->AddEntry(hd, "Data","P"); if(debug_) std::cout << "Adding MC to the THStack" << std::endl; //with the proper trigger eff // double SF[] = {1.01,1.03,1.00}; // double SF[] = {1.03,1.054,1.032}; double SF[] = {1.0,1.0,1.0}; if(debug_){ for(int i = 0; i< 3; ++i) std::cout << "SF [" << i << "] = " << SF[i] << std::endl; } double mcIntegral=0; for(size_t j=0;j< s.size() ;j++) { if(!s[j].data) { if(debug_) std::cout << "Creating TH1F from file " << s[j].name << std::endl; TH1F * h = ((TH1F*)s[j].file()->Get(names[i].c_str())); h->Sumw2(); if(debug_){ std::cout << "TH1F created from file " << s[j].name << std::endl; std::cout << "Scaling : " << s[j].scale(data.lumi(),fa,fb) << std::endl; std::cout << "Scaling with SF : " << s[j].scale(data.lumi(),fa,fb,SF) << std::endl; std::cout << "Histo integral before scaling = " << h->Integral() << std::endl; } h->Scale(s[j].scale(data.lumi(),fa,fb,SF)); if(debug_){ std::cout << "Histo integral after scaling = " << h->Integral() << std::endl; std::cout << "Managing style... " << std::endl; } h->SetLineWidth(1.); h->SetFillColor(s[j].color); h->SetLineColor(s[j].color); // h->Rebin(options[names[i]].rebin); if(debug_) std::cout << "Cloning and update legend " << std::endl; if(grouped.find(s[j].name) == grouped.end()){ l->AddEntry(h,s[j].name.c_str(),"F"); } std::cout << "Sample : " << s[j].name << " - Integral for plot " << names[i] << " = " << h->Integral(-10000,10000) << std::endl; mcIntegral += h->Integral(); sta->Add(h); hmc->Add(h); //TO FIX grouped map // sovrascrive histo con lo stesso nome tipo VV o ST etc... grouped[s[j].name]=(TH1F *)h->Clone(("_"+names[i]).c_str()); } } if(debug_){ std::cout << "Data total = " << hd->Integral() << std::endl; std::cout << "MC = " << mcIntegral << std::endl; std::cout << "Data/MC = " << hd->Integral()/mcIntegral << std::endl; } TPad * TopPad = new TPad("TopPad","Top Pad",0.,0.3,1.,1. ) ; TPad * BtmPad = new TPad("BtmPad","Bottom Pad",0.,0.,1.,0.313 ) ; TopPad->SetBottomMargin(0.02); BtmPad->SetTopMargin(0.0); BtmPad->SetFillStyle(4000); TopPad->SetFillStyle(4000); BtmPad->SetFillColor(0); BtmPad->SetBottomMargin(0.35); TopPad->Draw() ; BtmPad->Draw() ; std::cout << "hd maximum = " << hd->GetMaximum() << " sta maximum = " << sta->GetMaximum() << std::endl; double maxY; if(hd->GetMaximum() > sta->GetMaximum()) maxY = (hd->GetMaximum())*1.5; else maxY = (sta->GetMaximum())*1.5; TopPad->cd(); hd->Draw("E1X0"); sta->Draw("sameHIST"); hmc->Draw("sameE2"); hmc->SetFillColor(2); hmc->SetMarkerSize(0); hmc->SetFillStyle(3013); hd->Draw("E1X0same"); l->Draw("same"); std::cout << "Set Maximum to = " << maxY << std::endl; hd->GetYaxis()->SetRangeUser(0.,maxY); hd->GetXaxis()->SetRangeUser(options[names[i]].min,options[names[i]].max); BtmPad->cd(); std::cout << "Division" << std::endl; TH1D * divisionErrorBand = (TH1D*)(hmc)->Clone("divisionErrorBand"); divisionErrorBand->Sumw2(); divisionErrorBand->Divide(hmc); divisionErrorBand->Draw("E2"); divisionErrorBand->SetMaximum(2.49); divisionErrorBand->SetMinimum(0); divisionErrorBand->SetMarkerStyle(20); divisionErrorBand->SetMarkerSize(0.55); divisionErrorBand->GetXaxis()->SetTitleOffset(1.12); divisionErrorBand->GetXaxis()->SetLabelSize(0.12); divisionErrorBand->GetXaxis()->SetTitleSize(0.5); divisionErrorBand->GetYaxis()->SetTitle("Data/MC"); divisionErrorBand->GetYaxis()->SetLabelSize(0.12); divisionErrorBand->GetYaxis()->SetTitleSize(0.12); divisionErrorBand->GetYaxis()->SetTitleOffset(0.40); divisionErrorBand->GetYaxis()->SetNdivisions(505); //divisionErrorBand->UseCurrentStyle(); divisionErrorBand->SetFillColor(2); divisionErrorBand->SetFillStyle(3001); divisionErrorBand->SetMarkerSize(0.); TH1D * division = (TH1D*)(hd)->Clone("division"); division->Sumw2(); division->Divide(hmc); // division->SetMaximum(2.5); // division->SetMinimum(0); // division->SetMarkerStyle(20); // division->SetMarkerSize(0.55); // division->GetXaxis()->SetLabelSize(0.12); // division->GetXaxis()->SetTitleSize(0.14); // division->GetYaxis()->SetLabelSize(0.10); // division->GetYaxis()->SetTitleSize(0.10); // division->GetYaxis()->SetTitle("Data/MC"); Double_t min = division->GetXaxis()->GetXmin(); Double_t max = division->GetXaxis()->GetXmax(); division->Draw("E1X0same"); TLine *line = new TLine(min, 1.0, max, 1.0); line->SetLineColor(kRed); line->Draw("same"); TLegend * leg3 =new TLegend(0.50,0.86,0.69,0.96); leg3->AddEntry(divisionErrorBand,"MC uncert. (stat.)","f"); leg3->SetFillColor(0); leg3->SetLineColor(0); leg3->SetShadowColor(0); leg3->SetTextFont(62); leg3->SetTextSize(0.06); leg3->Draw(); TPaveText *pave = new TPaveText(0.15,0.85,0.32,0.96,"brNDC"); pave->SetTextAlign(12); pave->SetLineColor(0); pave->SetFillColor(0); pave->SetShadowColor(0); //TText *text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f",histDt->Chi2Test(histCopyMC5,"UWCHI2/NDF"),histDt->KolmogorovTest(histCopyMC5))); // stat + sys TText *text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f",hd->Chi2Test(hmc,"UWCHI2/NDF"),hd->KolmogorovTest(hmc))); // stat only text->SetTextFont(62); text->SetTextSize(0.08); pave->Draw(); TopPad->cd(); TLatex latex; latex.SetNDC(); latex.SetTextAlign(12); latex.SetTextSize(0.052); latex.DrawLatex(0.17,0.89,"CMS Preliminary"); latex.SetTextSize(0.04); latex.DrawLatex(0.17,0.84,"#sqrt{s} = 7 TeV, L = 4.7 fb^{-1}"); // latex.DrawLatex(0.17,0.79,"Z(e^{+}e^{-})H(b#bar{b})"); latex.DrawLatex(0.17,0.79,process.c_str()); c->Update(); std::string cName= hd->GetName(); cName += "_bare.pdf"; cName = path+cName; c->Print(cName.c_str(),"pdf"); // std::cout << names[i] << " d: " << hd->Integral() << " "; // THStack * sta2 = new THStack("sta2",hd->GetTitle()); // float tot=0; // float toterr2=0; // if(debug_) // std::cout << "Putting the iterator in the for loop" << std::endl; // for(std::map<std::string,TH1F *>::reverse_iterator it=grouped.rbegin(); it!=grouped.rend();++it) // { // if(debug_) // std::cout << "Using the iterator" << std::endl; // std::cout << (*it).first << " " << (*it).second->Integral() << " | " << std::endl ; // if((*it).second->GetEntries() > 0) { // float er=1.*sqrt((*it).second->GetEntries())/(*it).second->GetEntries()*(*it).second->Integral(); // toterr2+=er*er; // } // tot+=(*it).second->Integral(); // sta2->Add(it->second); // } // std::cout << " Tot: " << tot << "+-" << sqrt(toterr2) << " SF: " << hd->Integral()/tot << std::endl; // TCanvas *c2 = new TCanvas(); // c2->SetTitle(names[i].c_str()); // std::cout << "hd maximum = " << hd->GetMaximum() << " sta2 maximum = " << sta2->GetMaximum() << std::endl; // if(hd->GetMaximum() > sta2->GetMaximum()) maxY = hd->GetBinContent(hd->GetMaximumBin()) * 1.5; // else maxY = ( sta2->GetMaximum())*1.5; // // hd->Draw("E1"); // sta2->Draw("PADSHIST"); // // hd->Draw("E1same"); // // l->Draw("same"); // std::cout << "Set Maximum to = " << maxY << std::endl; // hd->GetYaxis()->SetRangeUser(0.,maxY); // hd->GetXaxis()->SetRangeUser(options[names[i]].min,options[names[i]].max); // c2->Update(); // std::string c2Name = hd->GetName(); // c2Name = path+c2Name; // c2Name += "_norm.pdf"; // c2->Print(c2Name.c_str(),"pdf"); } }
void monplots(TString runno, TString filename, TString module, TWISMacroResult & results) { Double_t maxenerms = 1.5; Double_t maxpedrms = 0.8; TString defdir = "castor/cern.ch/user/t/tilebeam/commissioning/"; TString deffile = "tiletb_"+runno+"_MonoCis.0.root"; if(filename == ""){ filename = defdir+deffile; } TFile *f = TFile::Open(filename); TTree *t = (TTree*)f->Get("TileRec/h1000"); Float_t efit[48], pedfit[48]; Int_t cispar[16]; TString vare = "Efit"+module; TString varp = "Pedfit"+module; TString varc = "Cispar"; t->SetBranchAddress(vare, &efit); t->SetBranchAddress(varp, &pedfit); t->SetBranchAddress(varc, &cispar); Int_t nevt = t->GetEntries(); Int_t nevt_for_2D = (nevt>MAXEVT_FOR_2D) ? MAXEVT_FOR_2D : nevt; Int_t i, j; /********** MonExpert **********/ Int_t samp[48][9]; TString var = "Sample"+module; t->SetBranchAddress(var, &samp); TH1F *h[48]; TH2F *c[48]; TString hname, htitle; TString cname, ctitle; /*******************************/ t->GetEntry(100); Double_t charge = 2*4.096*cispar[6]*cispar[7]/1023; Double_t uphist = charge +20; Double_t minmean = charge - 10; TH1F *hene[48], *hped[48]; TString nene, tene, nped, tped; for(j=0;j<48;j++){ nene = "ene"; nene += j; tene = "Energy "; tene += j; hene[j]=new TH1F(nene, tene, 100, 0, uphist); nped = "ped"; nped += j; tped = "Pedestal "; tped += j; hped[j]=new TH1F(nped, tped, 100, 0, 100); /********** MonExpert **********/ hname = "Amp"; hname += j; htitle="Sample 3, ch"; htitle += j; h[j]=new TH1F(hname, htitle, 100, 0, 200); cname = "amptime"; cname += j; ctitle="Sample3vsTime,ch"; ctitle += j; c[j]=new TH2F(cname, ctitle, nevt_for_2D/10, 0, nevt_for_2D, 100, 0, 200); /*******************************/ } for(Int_t i=0;i<nevt;i++) { t->GetEntry(i); for(j=0;j<48;j++) { hene[j]->Fill(efit[j]); hped[j]->Fill(pedfit[j]); /********** MonExpert **********/ if (i % 20 == 0 && i < MAXEVT_FOR_2D) { h[j]->Fill(samp[j][3]); c[j]->Fill(i, samp[j][3]); } /*******************************/ } } Double_t chan[48], meanene[48], rmsene[48], meanped[48], rmsped[48]; vector<Int_t> bad; Double_t badMeanEneX[48], badRMSEneX[48], badPedRMSX[48]; Double_t badMeanEneY[48], badRMSEneY[48], badPedRMSY[48]; Int_t NbadMeanEne = 0, NbadRMSEne = 0, NbadPedRMS = 0; for(j=0;j<48;j++){ chan[j]=j; if(j != 31 && j!=32 && j!=43){ meanene[j]=hene[j]->GetMean(); if (meanene[j] < minmean) { badMeanEneX[NbadMeanEne] = j; badMeanEneY[NbadMeanEne] = meanene[j]; NbadMeanEne++; } rmsene[j]=hene[j]->GetRMS(); if (rmsene[j] > maxenerms) { badRMSEneX[NbadRMSEne] = j; badRMSEneY[NbadRMSEne] = rmsene[j]; NbadRMSEne++; } meanped[j]=hped[j]->GetMean(); rmsped[j]=hped[j]->GetRMS(); if (rmsped[j] > maxpedrms) { badPedRMSX[NbadPedRMS] = j; badPedRMSY[NbadPedRMS] = rmsped[j]; NbadPedRMS++; } if(meanene[j] < minmean || rmsene[j] > maxenerms || rmsped[j] > maxpedrms) bad.push_back(j); } else { meanene[j]=0.0; rmsene[j]=0.0; meanped[j]=0.0; rmsped[j]=0.0; } } TLine *lmean = new TLine(0, minmean, 50, minmean); lmean->SetLineColor(2); TLine *lenerms = new TLine(0, maxenerms, 50, maxenerms); lenerms->SetLineColor(2); TLine *lpedrms = new TLine(0, maxpedrms, 50, maxpedrms); lpedrms->SetLineColor(2); TPolyMarker *badMeanEne = new TPolyMarker(NbadMeanEne, badMeanEneX, badMeanEneY, "p"); badMeanEne->SetMarkerColor(2); badMeanEne->SetMarkerStyle(21); TPolyMarker *badRMSEne = new TPolyMarker(NbadRMSEne, badRMSEneX, badRMSEneY, "p"); badRMSEne->SetMarkerColor(2); badRMSEne->SetMarkerStyle(21); TPolyMarker *badPedRMS = new TPolyMarker(NbadPedRMS, badPedRMSX, badPedRMSY, "p"); badPedRMS->SetMarkerColor(2); badPedRMS->SetMarkerStyle(21); TGraph *genemean = new TGraph(48, chan, meanene); genemean->SetMarkerStyle(21); genemean->SetTitle("Mean Energy"); genemean->GetXaxis()->SetTitle("Channel"); TGraph *generms = new TGraph(48, chan, rmsene); generms->SetMarkerStyle(21); generms->SetTitle("RMS Energy"); generms->GetXaxis()->SetTitle("Channel"); TGraph *gpedmean = new TGraph(48, chan, meanped); gpedmean->SetMarkerStyle(21); gpedmean->SetTitle("Mean Pedestal"); gpedmean->GetXaxis()->SetTitle("Channel"); TGraph *gpedrms = new TGraph(48, chan, rmsped); gpedrms->SetMarkerStyle(21); gpedrms->SetTitle("RMS Pedestal"); gpedrms->GetXaxis()->SetTitle("Channel"); TCanvas *cmon= new TCanvas("cmon", "MonoCis", 700, 500); cmon->Divide(2,2); cmon->cd(1); genemean->Draw("AP"); lmean->Draw(); badMeanEne->Draw(); cmon->cd(2); generms->Draw("AP"); lenerms->Draw(); badRMSEne->Draw(); cmon->cd(3); gpedmean->Draw("AP"); cmon->cd(4); gpedrms->Draw("AP"); lpedrms->Draw(); badPedRMS->Draw(); cout.precision(3); //cout<<"Number of bad channels is "<<bad.size()<<"<br />"<<endl; results.addValue("Number of bad channels", bad.size()); if(bad.size() > 0) { //cout<<"Channel"<<'\t'<<"Mean energy"<<'\t'<<"RMS energy"<<'\t'<<"RMS Monocis"<<"<br />"<<endl; TString table; table = "<table class=\"main\" xmlns=\"http://www.w3.org/1999/xhtml\">\n"; table += "<tr><th>Channel</th><th>Mean energy</th><th>RMS energy</th><th>RMS Monocis</th></tr>\n"; for(i=0;i<bad.size();i++) { Int_t ch = bad.at(i); //cout<<ch<<"\t"<<meanene[i]<<"\t\t"<<rmsene[i]<<"\t\t"<<rmsped[i]<<"<br />"<<endl; table += "<tr><td>"; table += ch; table += "</td><td>"; table += meanene[i]; table += "</td><td>"; table += rmsene[i]; table +="</td><td>"; table += rmsped[i]; table +="</td></tr>\n"; } table += "</table>\n"; results.addTable("Bad channels", table); } TString moduleDir = "LB" + module + "/"; TString filenameps = outputDir + moduleDir +"r"+runno+"_"+module+"_MonoCis.ps"; TString filenamepng = outputDir + moduleDir +"r"+runno+"_"+module+"_MonoCis.png"; cmon->Print(filenameps); cmon->Print(filenamepng); TString plotFilename = outputWebDir + moduleDir + "r"+runno+"_"+module+"_MonoCis.png"; TString plotPsFilename = outputWebDir + moduleDir + "r"+runno+"_"+module+"_MonoCis.ps"; TString completeModuleName = "LB" + module; wis2Tilecomm(runno.Data(), completeModuleName.Data(), plotFilename.Data(), results); wis2Tilecomm(runno.Data(), completeModuleName.Data(), plotPsFilename.Data(), results); TString linkTitle = "Send results to QC Sheet"; TString linkHref = "http://atlasmonitor.web.cern.ch/atlasmonitor/saveValuesExample.jsp?module="; linkHref += "LB" + module + "&run=" + runno + "&badChannels="; linkHref += bad.size(); //results.addLink(linkTitle, linkHref); results.addPlot("", plotFilename); /********** MonExpert **********/ TCanvas *c1 = new TCanvas("c1", "Amp,1-24", 900, 900); c1->Divide(4,6); TCanvas *c5 = new TCanvas("c5", "Amp,25-48", 900, 900); c5->Divide(4,6); TCanvas *c3 = new TCanvas("c3", "AmpTime,1-24", 900, 900); c3->Divide(4,6); TCanvas *c7 = new TCanvas("c7", "AmpTime,25-48",900,900); c7->Divide(4,6); for(j = 0; j < 24; j++) { c1->cd(j+1); gPad->SetLogy(); h[j]->Draw(); c5->cd(j+1); gPad->SetLogy(); h[j+24]->Draw(); c3->cd(j+1); c[j]->Draw(); c7->cd(j+1); c[j+24]->Draw(); } // Saving plots to disk filenamepng = outputDir + "expert/" + moduleDir + "r" + runno + "_" + module + "_MonoCis_Expert_Amp1-24.png"; c1->Print(filenamepng); filenamepng = outputDir + "expert/" + moduleDir + "r" + runno + "_" + module + "_MonoCis_Expert_Amp25-48.png"; c5->Print(filenamepng); filenamepng = outputDir + "expert/" + moduleDir + "r" + runno + "_" + module + "_MonoCis_Expert_AmpTime1-24.png"; c3->Print(filenamepng); filenamepng = outputDir + "expert/" + moduleDir + "r" + runno + "_" + module + "_MonoCis_Expert_AmpTime25-48.png"; c7->Print(filenamepng); completeModuleName = "LB" + module; // Saving plots to Results Database (TileComm Analysis) TString plot1 = outputWebDir + "expert/" + moduleDir + "r"+runno+"_"+module+"_MonoCis_Expert_Amp1-24.png"; wis2Tilecomm(runno.Data(), completeModuleName.Data(), plot1.Data(), results); TString plot2 = outputWebDir + "expert/" + moduleDir + "r"+runno+"_"+module+"_MonoCis_Expert_Amp25-48.png"; wis2Tilecomm(runno.Data(), completeModuleName.Data(), plot2.Data(), results); TString plot3 = outputWebDir + "expert/" + moduleDir + "r"+runno+"_"+module+"_MonoCis_Expert_AmpTime1-24.png"; wis2Tilecomm(runno.Data(), completeModuleName.Data(), plot3.Data(), results); TString plot4 = outputWebDir + "expert/" + moduleDir + "r"+runno+"_"+module+"_MonoCis_Expert_AmpTime25-48.png"; wis2Tilecomm(runno.Data(), completeModuleName.Data(), plot4.Data(), results); // Showing links in macro results page results.addValue("MonoCis Expert Plots", ""); results.addLink("Amp Channels 1-24", plot1); results.addLink("Amp Channels 25-48", plot2); results.addLink("AmpTime Channels 1-24", plot3); results.addLink("AmpTime Channels 25-48", plot4); /*******************************/ }
void InclusiveJets_2010_mcdataRatio(){ //general root settings gROOT->SetStyle("Plain"); gStyle->SetOptStat(0); //get rid of statistics box // to set the errors of the histograms to sqrt(sum of squares of weights) TH1::SetDefaultSumw2() ; //Ranges for plots Float_t xmin=17.5 , ymin = 0.00001, xmax = 1684.0, ymax = 10000000000000000.; //for the linecolor and linestyle Int_t icol[8]={8,kViolet,7,4,12,46,6,7}; Int_t isty[8]={1,1,1,1,1,1,1,1}; Int_t imark[5] = {21,22,25,26,3}; //get the root files TFile *f[3]; f[0] = new TFile("out_aida_40times900kevents_errorcut50/Z2MPIHADONbornkt5ktsupp250_errorcut.root"); f[1] = new TFile("out_aida_40times900kevents_errorcut50/Z2MPIHADOFFbornkt5ktsupp250_errorcut.root"); f[2] = new TFile("out_aida_40times900kevents_errorcut50/NOTUNEbornkt5ktsupp250_errorcut.root"); //get the Tgraph and convert into histo TH1F _histotmp[6][3]; Int_t n = 3; //number of files Int_t nh = 6; // number of histograms = number of y bins for(const int ifile = 0; ifile < n; ifile++){ _histotmp[0][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d01_x01_y01;1")); // |y| <0.5 _histotmp[1][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d02_x01_y01;2")); // 0.5 < |y| < 1.0 _histotmp[2][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d03_x01_y01;2")); // 1.0 < |y| < 1.5 _histotmp[3][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d04_x01_y01;2")); // 1.5 < |y| < 2.0 _histotmp[4][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5 _histotmp[5][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d06_x01_y01;1")); // 2.5 < |y| < 3.0 for(const int ihisto = 0; ihisto < nh; ihisto++){ _histotmp[ihisto][ifile].SetName(""); } } //change the histo so that I can plot it and do the ratio TH1F *_histo[6][3]; for(const int ifile = 0; ifile < n; ifile++){ for(const int ihisto = 0; ihisto < nh; ihisto++){ TH1F *_histo[ihisto][ifile]= (TH1F*)_histotmp[ihisto][ifile].Clone(""); /* _histo[ihisto][ifile]->Divide((TH1*)_histo[ihisto][1]); //histo 0 / hsito 1 TH1F *_ratio1[ihisto]= (TH1F*)_ratiotmp1[ihisto]->Clone(""); _ratiotmp2[ihisto]->Divide((TH1*)_histo[ihisto][2]); //histo 0 / hsito 2 TH1F *_ratio2[ihisto]= (TH1F*)_ratiotmp2[ihisto]->Clone(""); */ _histo[ihisto][ifile]->SetLineWidth(2); _histo[ihisto][ifile]->SetLineColor(icol[ihisto]); _histo[ihisto][ifile]->SetMarkerStyle(2); _histo[ihisto][ifile]->SetMarkerColor(icol[ihisto]); } //scale the histos that it fits in one histogram _histo[0][ifile]->Scale(10000); _histo[1][ifile]->Scale(1000); _histo[2][ifile]->Scale(100); _histo[3][ifile]->Scale(10); _histo[4][ifile]->Scale(1); } //get the data 2010 //data = new TFile("out_aida/CMS_2011_S9086218.root"); //TH1F _histodata1 = Gr2Hi((TGraph*)data->Get("d01_x01_y01;1")); // |y| <0.5 //TH1F _histodata2 = Gr2Hi((TGraph*)data->Get("d02_x01_y01;1")); // 0.5 < |y| < 1.0 //TH1F _histodata3 = Gr2Hi((TGraph*)data->Get("d03_x01_y01;1")); // 1.0 < |y| < 1.5 //TH1F _histodata4 = Gr2Hi((TGraph*)data->Get("d04_x01_y01;1")); // 1.5 < |y| < 2.0 //TH1F _histodata5 = Gr2Hi((TGraph*)data->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5 //TH1F _histodata6 = Gr2Hi((TGraph*)data->Get("d06_x01_y01;1")); // 2.5 < |y| < 3.0 Double_t xAxis1[35] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 737, 846, 1684}; TH1F *d01_x01_y01_histo = new TH1F("d01_x01_y01_histo","d01_x01_y01_histo",34, xAxis1); d01_x01_y01_histo->SetBinContent(1,1.97e+11); d01_x01_y01_histo->SetBinContent(2,1.02e+11); d01_x01_y01_histo->SetBinContent(3,5.14e+10); d01_x01_y01_histo->SetBinContent(4,2.66e+10); d01_x01_y01_histo->SetBinContent(5,1.38e+10); d01_x01_y01_histo->SetBinContent(6,6.53e+09); d01_x01_y01_histo->SetBinContent(7,3.35e+09); d01_x01_y01_histo->SetBinContent(8,1.8e+09); d01_x01_y01_histo->SetBinContent(9,9.2e+08); d01_x01_y01_histo->SetBinContent(10,4.66e+08); d01_x01_y01_histo->SetBinContent(11,2.37e+08); d01_x01_y01_histo->SetBinContent(12,1.18e+08); d01_x01_y01_histo->SetBinContent(13,5.43e+07); d01_x01_y01_histo->SetBinContent(14,2.39e+07); d01_x01_y01_histo->SetBinContent(15,1.08e+07); d01_x01_y01_histo->SetBinContent(16,5240000); d01_x01_y01_histo->SetBinContent(17,2610000); d01_x01_y01_histo->SetBinContent(18,1360000); d01_x01_y01_histo->SetBinContent(19,716000); d01_x01_y01_histo->SetBinContent(20,381000); d01_x01_y01_histo->SetBinContent(21,207000); d01_x01_y01_histo->SetBinContent(22,117000); d01_x01_y01_histo->SetBinContent(23,66800); d01_x01_y01_histo->SetBinContent(24,37900); d01_x01_y01_histo->SetBinContent(25,22000); d01_x01_y01_histo->SetBinContent(26,12900); d01_x01_y01_histo->SetBinContent(27,7540); d01_x01_y01_histo->SetBinContent(28,4410); d01_x01_y01_histo->SetBinContent(29,2770); d01_x01_y01_histo->SetBinContent(30,1450); d01_x01_y01_histo->SetBinContent(31,846); d01_x01_y01_histo->SetBinContent(32,499); d01_x01_y01_histo->SetBinContent(33,205); d01_x01_y01_histo->SetBinContent(34,20.2); d01_x01_y01_histo->SetBinError(1,2.547782e+10); d01_x01_y01_histo->SetBinError(2,1.24325e+10); d01_x01_y01_histo->SetBinError(3,6.016764e+09); d01_x01_y01_histo->SetBinError(4,3.005329e+09); d01_x01_y01_histo->SetBinError(5,1.530463e+09); d01_x01_y01_histo->SetBinError(6,7.056178e+08); d01_x01_y01_histo->SetBinError(7,3.617535e+08); d01_x01_y01_histo->SetBinError(8,1.96072e+08); d01_x01_y01_histo->SetBinError(9,9.919588e+07); d01_x01_y01_histo->SetBinError(10,5.102008e+07); d01_x01_y01_histo->SetBinError(11,2.639067e+07); d01_x01_y01_histo->SetBinError(12,1.335539e+07); d01_x01_y01_histo->SetBinError(13,6258885); d01_x01_y01_histo->SetBinError(14,2836105); d01_x01_y01_histo->SetBinError(15,1319900); d01_x01_y01_histo->SetBinError(16,663920.6); d01_x01_y01_histo->SetBinError(17,342646.4); d01_x01_y01_histo->SetBinError(18,184642.2); d01_x01_y01_histo->SetBinError(19,100845.5); d01_x01_y01_histo->SetBinError(20,55764.14); d01_x01_y01_histo->SetBinError(21,31565.29); d01_x01_y01_histo->SetBinError(22,18614.95); d01_x01_y01_histo->SetBinError(23,11075.51); d01_x01_y01_histo->SetBinError(24,6579.499); d01_x01_y01_histo->SetBinError(25,4015.708); d01_x01_y01_histo->SetBinError(26,2479.083); d01_x01_y01_histo->SetBinError(27,1527.99); d01_x01_y01_histo->SetBinError(28,943.6936); d01_x01_y01_histo->SetBinError(29,627.92); d01_x01_y01_histo->SetBinError(30,350.3168); d01_x01_y01_histo->SetBinError(31,219.1467); d01_x01_y01_histo->SetBinError(32,139.7467); d01_x01_y01_histo->SetBinError(33,62.02427); d01_x01_y01_histo->SetBinError(34,7.233998); d01_x01_y01_histo->SetEntries(34); d01_x01_y01_histo->SetStats(0); //d01_x01_y01_histo->Scale(10000); d01_x01_y01_histo->SetLineWidth(2); d01_x01_y01_histo->SetMarkerStyle(21); d01_x01_y01_histo->SetMarkerSize(0.7); d01_x01_y01_histo->SetFillColor(kGray); Double_t xAxis2[34] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 790, 1684}; TH1F *d02_x01_y01_histo = new TH1F("d02_x01_y01_histo","d02_x01_y01_histo",33, xAxis2); d02_x01_y01_histo->SetBinContent(1,1.89e+10); d02_x01_y01_histo->SetBinContent(2,9.74e+09); d02_x01_y01_histo->SetBinContent(3,4.99e+09); d02_x01_y01_histo->SetBinContent(4,2.49e+09); d02_x01_y01_histo->SetBinContent(5,1.31e+09); d02_x01_y01_histo->SetBinContent(6,6.28e+08); d02_x01_y01_histo->SetBinContent(7,3.23e+08); d02_x01_y01_histo->SetBinContent(8,1.71e+08); d02_x01_y01_histo->SetBinContent(9,8.84e+07); d02_x01_y01_histo->SetBinContent(10,4.42e+07); d02_x01_y01_histo->SetBinContent(11,2.22e+07); d02_x01_y01_histo->SetBinContent(12,1.13e+07); d02_x01_y01_histo->SetBinContent(13,5130000); d02_x01_y01_histo->SetBinContent(14,2230000); d02_x01_y01_histo->SetBinContent(15,1010000); d02_x01_y01_histo->SetBinContent(16,482000); d02_x01_y01_histo->SetBinContent(17,238000); d02_x01_y01_histo->SetBinContent(18,122000); d02_x01_y01_histo->SetBinContent(19,64200); d02_x01_y01_histo->SetBinContent(20,34100); d02_x01_y01_histo->SetBinContent(21,18700); d02_x01_y01_histo->SetBinContent(22,10100); d02_x01_y01_histo->SetBinContent(23,5720); d02_x01_y01_histo->SetBinContent(24,3420); d02_x01_y01_histo->SetBinContent(25,1890); d02_x01_y01_histo->SetBinContent(26,1130); d02_x01_y01_histo->SetBinContent(27,590); d02_x01_y01_histo->SetBinContent(28,376); d02_x01_y01_histo->SetBinContent(29,196); d02_x01_y01_histo->SetBinContent(30,130); d02_x01_y01_histo->SetBinContent(31,62.4); d02_x01_y01_histo->SetBinContent(32,30.1); d02_x01_y01_histo->SetBinContent(33,2.14); d02_x01_y01_histo->SetBinError(1,2.47211e+09); d02_x01_y01_histo->SetBinError(2,1.196891e+09); d02_x01_y01_histo->SetBinError(3,5.890842e+08); d02_x01_y01_histo->SetBinError(4,2.837945e+08); d02_x01_y01_histo->SetBinError(5,1.465766e+08); d02_x01_y01_histo->SetBinError(6,6.848512e+07); d02_x01_y01_histo->SetBinError(7,3.536592e+07); d02_x01_y01_histo->SetBinError(8,1.879562e+07); d02_x01_y01_histo->SetBinError(9,9619569); d02_x01_y01_histo->SetBinError(10,4860292); d02_x01_y01_histo->SetBinError(11,2483524); d02_x01_y01_histo->SetBinError(12,1278948); d02_x01_y01_histo->SetBinError(13,596427.3); d02_x01_y01_histo->SetBinError(14,266851); d02_x01_y01_histo->SetBinError(15,124973); d02_x01_y01_histo->SetBinError(16,61551.8); d02_x01_y01_histo->SetBinError(17,31482.64); d02_x01_y01_histo->SetBinError(18,16749.58); d02_x01_y01_histo->SetBinError(19,9172.852); d02_x01_y01_histo->SetBinError(20,5077.065); d02_x01_y01_histo->SetBinError(21,2898.771); d02_x01_y01_histo->SetBinError(22,1633.017); d02_x01_y01_histo->SetBinError(23,965.8504); d02_x01_y01_histo->SetBinError(24,606.0352); d02_x01_y01_histo->SetBinError(25,351.8168); d02_x01_y01_histo->SetBinError(26,221.2594); d02_x01_y01_histo->SetBinError(27,122.0002); d02_x01_y01_histo->SetBinError(28,82.34314); d02_x01_y01_histo->SetBinError(29,45.69701); d02_x01_y01_histo->SetBinError(30,32.27314); d02_x01_y01_histo->SetBinError(31,16.82748); d02_x01_y01_histo->SetBinError(32,8.687436); d02_x01_y01_histo->SetBinError(33,0.745178); d02_x01_y01_histo->SetEntries(33); d02_x01_y01_histo->SetStats(0); d02_x01_y01_histo->SetLineStyle(0); d02_x01_y01_histo->SetLineWidth(2); d02_x01_y01_histo->SetMarkerStyle(22); d02_x01_y01_histo->SetMarkerSize(0.7); d02_x01_y01_histo->SetFillColor(kGray); Double_t xAxis3[33] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 1410}; TH1F *d03_x01_y01_histo = new TH1F("d03_x01_y01_histo","d03_x01_y01_histo",32, xAxis3); d03_x01_y01_histo->SetBinContent(1,1.84e+09); d03_x01_y01_histo->SetBinContent(2,9.24e+08); d03_x01_y01_histo->SetBinContent(3,4.64e+08); d03_x01_y01_histo->SetBinContent(4,2.34e+08); d03_x01_y01_histo->SetBinContent(5,1.19e+08); d03_x01_y01_histo->SetBinContent(6,5.88e+07); d03_x01_y01_histo->SetBinContent(7,2.92e+07); d03_x01_y01_histo->SetBinContent(8,1.57e+07); d03_x01_y01_histo->SetBinContent(9,8090000); d03_x01_y01_histo->SetBinContent(10,4090000); d03_x01_y01_histo->SetBinContent(11,2050000); d03_x01_y01_histo->SetBinContent(12,994000); d03_x01_y01_histo->SetBinContent(13,452000); d03_x01_y01_histo->SetBinContent(14,192000); d03_x01_y01_histo->SetBinContent(15,86200); d03_x01_y01_histo->SetBinContent(16,40500); d03_x01_y01_histo->SetBinContent(17,20100); d03_x01_y01_histo->SetBinContent(18,10000); d03_x01_y01_histo->SetBinContent(19,5210); d03_x01_y01_histo->SetBinContent(20,2720); d03_x01_y01_histo->SetBinContent(21,1470); d03_x01_y01_histo->SetBinContent(22,803); d03_x01_y01_histo->SetBinContent(23,435); d03_x01_y01_histo->SetBinContent(24,252); d03_x01_y01_histo->SetBinContent(25,138); d03_x01_y01_histo->SetBinContent(26,75.7); d03_x01_y01_histo->SetBinContent(27,43.1); d03_x01_y01_histo->SetBinContent(28,23.5); d03_x01_y01_histo->SetBinContent(29,13.1); d03_x01_y01_histo->SetBinContent(30,6.96); d03_x01_y01_histo->SetBinContent(31,3.31); d03_x01_y01_histo->SetBinContent(32,0.263); d03_x01_y01_histo->SetBinError(1,3.267438e+08); d03_x01_y01_histo->SetBinError(2,1.460402e+08); d03_x01_y01_histo->SetBinError(3,6.756898e+07); d03_x01_y01_histo->SetBinError(4,3.169167e+07); d03_x01_y01_histo->SetBinError(5,1.534246e+07); d03_x01_y01_histo->SetBinError(6,7206299); d03_x01_y01_histo->SetBinError(7,3487964); d03_x01_y01_histo->SetBinError(8,1852766); d03_x01_y01_histo->SetBinError(9,937690); d03_x01_y01_histo->SetBinError(10,474695.6); d03_x01_y01_histo->SetBinError(11,239744.8); d03_x01_y01_histo->SetBinError(12,117028.5); d03_x01_y01_histo->SetBinError(13,54375.43); d03_x01_y01_histo->SetBinError(14,23751.81); d03_x01_y01_histo->SetBinError(15,11010.17); d03_x01_y01_histo->SetBinError(16,5355.962); d03_x01_y01_histo->SetBinError(17,2760.221); d03_x01_y01_histo->SetBinError(18,1428.408); d03_x01_y01_histo->SetBinError(19,775.8965); d03_x01_y01_histo->SetBinError(20,422.7916); d03_x01_y01_histo->SetBinError(21,238.9779); d03_x01_y01_histo->SetBinError(22,137.1344); d03_x01_y01_histo->SetBinError(23,78.10703); d03_x01_y01_histo->SetBinError(24,47.62767); d03_x01_y01_histo->SetBinError(25,27.54976); d03_x01_y01_histo->SetBinError(26,16.01829); d03_x01_y01_histo->SetBinError(27,9.722084); d03_x01_y01_histo->SetBinError(28,5.653863); d03_x01_y01_histo->SetBinError(29,3.37332); d03_x01_y01_histo->SetBinError(30,1.948179); d03_x01_y01_histo->SetBinError(31,1.026618); d03_x01_y01_histo->SetBinError(32,0.09205037); d03_x01_y01_histo->SetEntries(32); d03_x01_y01_histo->SetStats(0); d03_x01_y01_histo->SetLineStyle(0); d03_x01_y01_histo->SetLineWidth(2); d03_x01_y01_histo->SetMarkerStyle(25); d03_x01_y01_histo->SetMarkerSize(0.7); d03_x01_y01_histo->SetFillColor(kGray); Double_t xAxis4[30] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 1032}; TH1F *d04_x01_y01_histo = new TH1F("d04_x01_y01_histo","d04_x01_y01_histo",29, xAxis4); d04_x01_y01_histo->SetBinContent(1,1.44e+08); d04_x01_y01_histo->SetBinContent(2,7.35e+07); d04_x01_y01_histo->SetBinContent(3,3.8e+07); d04_x01_y01_histo->SetBinContent(4,1.89e+07); d04_x01_y01_histo->SetBinContent(5,9700000); d04_x01_y01_histo->SetBinContent(6,4670000); d04_x01_y01_histo->SetBinContent(7,2280000); d04_x01_y01_histo->SetBinContent(8,1220000); d04_x01_y01_histo->SetBinContent(9,629000); d04_x01_y01_histo->SetBinContent(10,305000); d04_x01_y01_histo->SetBinContent(11,151000); d04_x01_y01_histo->SetBinContent(12,73400); d04_x01_y01_histo->SetBinContent(13,32900); d04_x01_y01_histo->SetBinContent(14,13900); d04_x01_y01_histo->SetBinContent(15,6160); d04_x01_y01_histo->SetBinContent(16,2860); d04_x01_y01_histo->SetBinContent(17,1400); d04_x01_y01_histo->SetBinContent(18,711); d04_x01_y01_histo->SetBinContent(19,356); d04_x01_y01_histo->SetBinContent(20,186); d04_x01_y01_histo->SetBinContent(21,94.5); d04_x01_y01_histo->SetBinContent(22,50.9); d04_x01_y01_histo->SetBinContent(23,25.6); d04_x01_y01_histo->SetBinContent(24,13.3); d04_x01_y01_histo->SetBinContent(25,7); d04_x01_y01_histo->SetBinContent(26,3.45); d04_x01_y01_histo->SetBinContent(27,1.73); d04_x01_y01_histo->SetBinContent(28,0.796); d04_x01_y01_histo->SetBinContent(29,0.066); d04_x01_y01_histo->SetBinError(1,3.637846e+07); d04_x01_y01_histo->SetBinError(2,1.67099e+07); d04_x01_y01_histo->SetBinError(3,7851714); d04_x01_y01_histo->SetBinError(4,3568673); d04_x01_y01_histo->SetBinError(5,1703586); d04_x01_y01_histo->SetBinError(6,750723.4); d04_x01_y01_histo->SetBinError(7,343490.2); d04_x01_y01_histo->SetBinError(8,173448.2); d04_x01_y01_histo->SetBinError(9,84294.21); d04_x01_y01_histo->SetBinError(10,39082.27); d04_x01_y01_histo->SetBinError(11,18979.5); d04_x01_y01_histo->SetBinError(12,9119.636); d04_x01_y01_histo->SetBinError(13,4140.893); d04_x01_y01_histo->SetBinError(14,1810.098); d04_x01_y01_histo->SetBinError(15,830.3785); d04_x01_y01_histo->SetBinError(16,399.9657); d04_x01_y01_histo->SetBinError(17,204.9602); d04_x01_y01_histo->SetBinError(18,109.8075); d04_x01_y01_histo->SetBinError(19,59.1287); d04_x01_y01_histo->SetBinError(20,33.42105); d04_x01_y01_histo->SetBinError(21,18.47046); d04_x01_y01_histo->SetBinError(22,10.88183); d04_x01_y01_histo->SetBinError(23,6.000047); d04_x01_y01_histo->SetBinError(24,3.41489); d04_x01_y01_histo->SetBinError(25,1.994767); d04_x01_y01_histo->SetBinError(26,1.086542); d04_x01_y01_histo->SetBinError(27,0.610451); d04_x01_y01_histo->SetBinError(28,0.3130872); d04_x01_y01_histo->SetBinError(29,0.03211142); d04_x01_y01_histo->SetEntries(29); d04_x01_y01_histo->SetStats(0); d04_x01_y01_histo->SetLineStyle(0); d04_x01_y01_histo->SetLineWidth(2); d04_x01_y01_histo->SetMarkerStyle(26); d04_x01_y01_histo->SetMarkerSize(0.7); d04_x01_y01_histo->SetFillColor(kGray); Double_t xAxis5[27] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 737}; TH1F *d05_x01_y01_histo = new TH1F("d05_x01_y01_histo","d05_x01_y01_histo",26, xAxis5); d05_x01_y01_histo->SetBinContent(1,1.05e+07); d05_x01_y01_histo->SetBinContent(2,5520000); d05_x01_y01_histo->SetBinContent(3,2720000); d05_x01_y01_histo->SetBinContent(4,1440000); d05_x01_y01_histo->SetBinContent(5,738000); d05_x01_y01_histo->SetBinContent(6,348000); d05_x01_y01_histo->SetBinContent(7,168000); d05_x01_y01_histo->SetBinContent(8,89800); d05_x01_y01_histo->SetBinContent(9,43800); d05_x01_y01_histo->SetBinContent(10,21800); d05_x01_y01_histo->SetBinContent(11,10300); d05_x01_y01_histo->SetBinContent(12,5030); d05_x01_y01_histo->SetBinContent(13,2180); d05_x01_y01_histo->SetBinContent(14,896); d05_x01_y01_histo->SetBinContent(15,384); d05_x01_y01_histo->SetBinContent(16,170); d05_x01_y01_histo->SetBinContent(17,78.5); d05_x01_y01_histo->SetBinContent(18,35.8); d05_x01_y01_histo->SetBinContent(19,16.5); d05_x01_y01_histo->SetBinContent(20,7.25); d05_x01_y01_histo->SetBinContent(21,3.27); d05_x01_y01_histo->SetBinContent(22,1.38); d05_x01_y01_histo->SetBinContent(23,0.579); d05_x01_y01_histo->SetBinContent(24,0.22); d05_x01_y01_histo->SetBinContent(25,0.0808); d05_x01_y01_histo->SetBinContent(26,0.00548); d05_x01_y01_histo->SetBinError(1,1978672); d05_x01_y01_histo->SetBinError(2,935188); d05_x01_y01_histo->SetBinError(3,421635.1); d05_x01_y01_histo->SetBinError(4,206618.7); d05_x01_y01_histo->SetBinError(5,100557.7); d05_x01_y01_histo->SetBinError(6,44514.08); d05_x01_y01_histo->SetBinError(7,20942.13); d05_x01_y01_histo->SetBinError(8,11048.87); d05_x01_y01_histo->SetBinError(9,5260.105); d05_x01_y01_histo->SetBinError(10,2634.555); d05_x01_y01_histo->SetBinError(11,1278.591); d05_x01_y01_histo->SetBinError(12,627.8137); d05_x01_y01_histo->SetBinError(13,282.1732); d05_x01_y01_histo->SetBinError(14,121.6466); d05_x01_y01_histo->SetBinError(15,55.24865); d05_x01_y01_histo->SetBinError(16,25.82574); d05_x01_y01_histo->SetBinError(17,12.76174); d05_x01_y01_histo->SetBinError(18,6.253124); d05_x01_y01_histo->SetBinError(19,3.142438); d05_x01_y01_histo->SetBinError(20,1.508923); d05_x01_y01_histo->SetBinError(21,0.7510828); d05_x01_y01_histo->SetBinError(22,0.3514478); d05_x01_y01_histo->SetBinError(23,0.1646418); d05_x01_y01_histo->SetBinError(24,0.071108); d05_x01_y01_histo->SetBinError(25,0.02988224); d05_x01_y01_histo->SetBinError(26,0.002567773); d05_x01_y01_histo->SetEntries(26); d05_x01_y01_histo->SetStats(0); d05_x01_y01_histo->SetLineStyle(0); d05_x01_y01_histo->SetLineWidth(2); d05_x01_y01_histo->SetMarkerStyle(3); d05_x01_y01_histo->SetMarkerSize(0.7); d05_x01_y01_histo->SetFillColor(kGray); // MC / Data TH1F *_ratio[6][3]; for(const int ifile = 0; ifile < n; ifile++){ for(const int ihisto = 0; ihisto < nh; ihisto++){ TH1F *_ratio[ihisto][ifile]= (TH1F*)_histo[ihisto][ifile]->Clone(""); _ratio[ihisto][ifile]->SetLineWidth(1); _ratio[ihisto][ifile]->SetLineColor(icol[ihisto]); _ratio[ihisto][ifile]->SetMarkerStyle(imark[ihisto]); _ratio[ihisto][ifile]->SetMarkerSize(0.5); _ratio[ihisto][ifile]->SetMarkerColor(icol[ihisto]); } _ratio[0][ifile]->Divide((TH1*)d01_x01_y01_histo); _ratio[1][ifile]->Divide((TH1*)d02_x01_y01_histo); _ratio[2][ifile]->Divide((TH1*)d03_x01_y01_histo); _ratio[3][ifile]->Divide((TH1*)d04_x01_y01_histo); _ratio[4][ifile]->Divide((TH1*)d05_x01_y01_histo); // TH1F *_ratio[ihisto]= (TH1F*)_ratiotmp1[ihisto]->Clone(""); // _ratiotmp2[ihisto]->Divide((TH1*)_histo[ihisto][2]); //histo 0 / hsito 2 // TH1F *_ratio2[ihisto]= (TH1F*)_ratiotmp2[ihisto]->Clone(""); } //create a canvas to draw TGraph and TH1F TCanvas *c1 = new TCanvas("c1", "c1",369,0,680,750); //pads (inclusive jet cross section, MC / data ) Pad_inclJet = new TPad("Pad_inclJet","xs",0.01,0.51,1.0,1.0); Pad_inclJet->Draw(); Pad_MCdata1 = new TPad("Pad_MCdata1","ratio",0.01,0.40,1.0,0.50); Pad_MCdata1->Draw(); Pad_MCdata2 = new TPad("Pad_MCdata2","ratio",0.01,0.30,1.0,0.40); Pad_MCdata2->Draw(); Pad_MCdata3 = new TPad("Pad_MCdata3","ratio",0.01,0.20,1.0,0.30); Pad_MCdata3->Draw(); Pad_MCdata4 = new TPad("Pad_MCdata4","ratio",0.01,0.10,1.0,0.20); Pad_MCdata4->Draw(); Pad_MCdata5 = new TPad("Pad_MCdata5","ratio",0.01,0.0,1.0,0.10); Pad_MCdata5->Draw(); // first pad style Pad_inclJet->cd(); gStyle->SetOptStat(0); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLogy(); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.03); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); //empty histo for border and style TH1F *shape = new TH1F("","",1, xmin, xmax); shape->SetMinimum(ymin); shape->SetMaximum(ymax); shape->GetXaxis()->SetTitle("Jet p_{T} (GeV/c)"); shape->GetXaxis()->SetLabelSize(0.03); shape->GetXaxis()->SetTitleSize(0.03); shape->GetXaxis()->SetNdivisions(508); shape->GetXaxis()->SetTitleOffset(1.3); shape->GetYaxis()->SetTitle("#frac{d^{2}#sigma}{dp_{T}d|y|} (pb/GeV)"); shape->GetYaxis()->SetLabelSize(0.03); shape->GetYaxis()->SetTitleSize(0.03); shape->GetYaxis()->SetTitleOffset(1.6); shape->Draw("e"); //data d01_x01_y01_histo->Draw("E2same"); d02_x01_y01_histo->Draw("E2same"); d03_x01_y01_histo->Draw("E2same"); d04_x01_y01_histo->Draw("E2same"); d05_x01_y01_histo->Draw("E2same"); _histo[0][0]->Draw("E1same"); _histo[1][0]->Draw("E1same"); _histo[2][0]->Draw("E1same"); _histo[3][0]->Draw("E1same"); _histo[4][0]->Draw("E1same"); gPad->SetLogy(); gPad->SetLogx(); TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.17,0.79,0.37,0.95,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.03); text = pt->AddText("CMS 2010"); text = pt->AddText("#sqrt{s} = 7 TeV"); text = pt->AddText("anti-k_{T} R = 0.5"); pt->Draw(); TLegend *leg = new TLegend(0.68,0.77,0.83,0.928); leg->SetBorderSize(1); leg->SetTextSize(0.025); leg->SetLineColor(0); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); leg->AddEntry((TH1F*)_histo[0][0],"POWHEG & Pythia6 Z2","pfl"); leg->AddEntry((TH1F*) d01_x01_y01_histo, "|y| <0.5 (x 10^{4})","pfl"); leg->AddEntry((TH1F*) d02_x01_y01_histo, "0.5 < |y| < 1.0 (x 10^{3})","pfl"); leg->AddEntry((TH1F*) d03_x01_y01_histo, "1.0 < |y| < 1.5 (x 10^{2})","pfl"); leg->AddEntry((TH1F*) d04_x01_y01_histo, "1.5 < |y| < 2.0 (x 10^{1})","pfl"); leg->AddEntry((TH1F*) d05_x01_y01_histo, "2.0 < |y| < 2.5 (x 10^{0})","pfl"); leg->Draw(); //second pad MC / Data Pad_MCdata1->cd(); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.0); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); gPad->SetLogx(); //AK Empty histo for style and borders TH1F *shape_MCdata = new TH1F("","",1, xmin, xmax); shape_MCdata->SetMinimum(0.5); shape_MCdata->SetMaximum(2.0); shape_MCdata->GetXaxis()->SetTitle("Jet p_{T} (GeV/c)"); shape_MCdata->GetXaxis()->SetLabelSize(0.0); shape_MCdata->GetXaxis()->SetTitleSize(0.0); shape_MCdata->GetXaxis()->SetTitleOffset(0.6); shape_MCdata->GetYaxis()->SetTitle("MC/Data"); shape_MCdata->GetYaxis()->SetLabelSize(0.15); shape_MCdata->GetYaxis()->SetTitleSize(0.15); shape_MCdata->GetYaxis()->SetTitleOffset(0.2); shape_MCdata->GetYaxis()->SetNdivisions(108, kTRUE); shape_MCdata->Draw("e"); // horizontal line at y = 1 TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.89,0.7,0.94,0.8,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.2); text = pt->AddText("|y| <0.5"); pt->Draw(); _ratio[0][0]->Draw("EhistSame"); Pad_MCdata2->cd(); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.0); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); gPad->SetLogx(); shape_MCdata->Draw("e"); // horizontal line at y = 1 TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.2); text = pt->AddText("0.5 < |y| < 1.0"); pt->Draw(); _ratio[1][0]->Draw("EhistSame"); Pad_MCdata3->cd(); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.0); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); gPad->SetLogx(); shape_MCdata->Draw("e"); // horizontal line at y = 1 TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.2); text = pt->AddText("1.0 < |y| < 1.5"); pt->Draw(); _ratio[2][0]->Draw("EhistSame"); Pad_MCdata4->cd(); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.0); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); gPad->SetLogx(); shape_MCdata->Draw("e"); // horizontal line at y = 1 TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.2); text = pt->AddText("1.5 < |y| < 2.0"); pt->Draw(); _ratio[3][0]->Draw("EhistSame"); Pad_MCdata5->cd(); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.0); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); gPad->SetLogx(); shape_MCdata->Draw("e"); // horizontal line at y = 1 TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.2); text = pt->AddText("2.0 < |y| < 2.5"); pt->Draw(); _ratio[4][0]->Draw("EhistSame"); //write in png file mysubpad1 =(TPad*)c1->GetPad(0); mysubpad1->Print("pics/InclusiveJets_10_mcdataRatio.png"); }
void PlotChargeFieldFocus2D( const TString &sim, Int_t time, Int_t zoom=2, Int_t Nbins=2, const TString &options="") { #ifdef __CINT__ gSystem->Load("libplasma.so"); #endif PlasmaGlob::Initialize(); // Palettes! gROOT->Macro("PlasmaPalettes.C"); // Init Units table PUnits::UnitsTable::Get(); // Load PData PData *pData = PData::Get(sim.Data()); pData->LoadFileNames(time); if(!pData->IsInit()) return; TString opt = options; // More makeup if(opt.Contains("grid")) { gStyle->SetPadGridX(1); gStyle->SetPadGridY(1); } gStyle->SetTitleFont(42); gStyle->SetStatFont(42); gStyle->SetTextFont(42); gStyle->SetTitleFont(42,"xyz"); gStyle->SetLabelFont(42,"xyz"); // Some plasma constants Double_t n0 = pData->GetPlasmaDensity(); Double_t kp = pData->GetPlasmaK(); Double_t skindepth = 1.; if(kp!=0.0) skindepth = 1/kp; Double_t E0 = pData->GetPlasmaE0(); // Some beam properties: Float_t Ebeam = pData->GetBeamEnergy() * PUnits::MeV; Float_t gamma = Ebeam / PConst::ElectronMassE; Float_t vbeam = TMath::Sqrt(1 - 1/(gamma*gamma)); // cout << Form(" - Bunch gamma = %8.4f", gamma ) << endl; // cout << Form(" - Bunch velocity = %8.4f c", vbeam ) << endl; Float_t nb = pData->GetBeamDensity(); // Time in OU Float_t Time = pData->GetRealTime(); // z start of the plasma in normalized units. Float_t zStartPlasma = pData->GetPlasmaStart()*kp; // z start of the beam in normalized units. Float_t zStartBeam = pData->GetBeamStart()*kp; // z start of the neutral in normalized units. Float_t zStartNeutral = pData->GetNeutralStart()*kp; // z end of the neutral in normalized units. Float_t zEndNeutral = pData->GetNeutralEnd()*kp; if(opt.Contains("center")) { Time -= zStartPlasma; if(opt.Contains("comov")) // Centers on the head of the beam. Time += zStartBeam; } Float_t shiftz = pData->Shift(opt); // cout << "Shift = " << shiftz << endl; // Calculate the "axis range" in number of bins. If Nbins==0 a RMS width is taken. Double_t rms0 = pData->GetBeamRmsY() * kp; if(pData->IsCyl()) rms0 = pData->GetBeamRmsR() * kp; Int_t FirstyBin = 0; Int_t LastyBin = 0; if(Nbins==0) { Nbins = TMath::Nint(rms0 / pData->GetDX(1)); } // Slice width limits. if(!pData->IsCyl()) { FirstyBin = pData->GetNX(1)/2 + 1 - Nbins; LastyBin = pData->GetNX(1)/2 + Nbins; } else { FirstyBin = 1; LastyBin = Nbins; } // ------------------------------------------------------------------------------- // Get charge density histos Int_t Nspecies = pData->NSpecies(); TH2F **hDen2D = new TH2F*[Nspecies]; TH1F **hDen1D = new TH1F*[Nspecies]; for(Int_t i=0;i<Nspecies;i++) { hDen2D[i] = NULL; hDen1D[i] = NULL; if(!pData->GetChargeFileName(i)) continue; cout << Form(" Getting charge density of specie: ") << i << endl; char hName[24]; sprintf(hName,"hDen2D_%i",i); hDen2D[i] = (TH2F*) gROOT->FindObject(hName); if(hDen2D[i]) delete hDen2D[i]; if(!pData->Is3D()) hDen2D[i] = pData->GetCharge(i,opt); else hDen2D[i] = pData->GetCharge2DSliceZY(i,-1,Nbins,opt+"avg"); // cout << Form(" Charge density of specie '%s' loaded into histogram '%s'",pData->GetSpeciesName(i).c_str(),hName) << endl; hDen2D[i]->SetName(hName); hDen2D[i]->GetXaxis()->CenterTitle(); hDen2D[i]->GetYaxis()->CenterTitle(); hDen2D[i]->GetZaxis()->CenterTitle(); if(opt.Contains("comov")) hDen2D[i]->GetXaxis()->SetTitle("#zeta [c/#omega_{p}]"); else hDen2D[i]->GetXaxis()->SetTitle("z [c/#omega_{p}]"); if(pData->IsCyl()) hDen2D[i]->GetYaxis()->SetTitle("r [c/#omega_{p}]"); else hDen2D[i]->GetYaxis()->SetTitle("y [c/#omega_{p}]"); hDen2D[i]->GetZaxis()->SetTitle("n [n_{0}]"); if(!opt.Contains("1dline")) continue; sprintf(hName,"hDen1D_%i",i); hDen1D[i] = (TH1F*) gROOT->FindObject(hName); if(hDen1D[i]) delete hDen1D[i]; if(pData->Is3D()) { hDen1D[i] = pData->GetH1SliceZ3D(pData->GetChargeFileName(i)->c_str(),"charge",-1,Nbins,-1,Nbins,opt+"avg"); } else if(pData->IsCyl()) { // Cylindrical: The first bin with r>0 is actually the number 1 (not the 0). hDen1D[i] = pData->GetH1SliceZ(pData->GetChargeFileName(i)->c_str(),"charge",1,Nbins,opt+"avg"); } else { // 2D cartesian hDen1D[i] = pData->GetH1SliceZ(pData->GetChargeFileName(i)->c_str(),"charge",-1,Nbins,opt+"avg"); } // cout << Form(" Charge density of specie '%s' loaded into histogram '%s'",pData->GetSpeciesName(i).c_str(),hName) << endl; hDen1D[i]->SetName(hName); hDen1D[i]->GetXaxis()->CenterTitle(); hDen1D[i]->GetYaxis()->CenterTitle(); if(opt.Contains("comov")) hDen1D[i]->GetXaxis()->SetTitle("#zeta [c/#omega_{p}]"); else hDen1D[i]->GetXaxis()->SetTitle("z [c/#omega_{p}]"); hDen1D[i]->GetYaxis()->SetTitle("n [n_{0}]"); } // Get electric fields const Int_t Nfields = 3; TH2F **hE2D = new TH2F*[Nfields]; TH1F **hE1D = new TH1F*[Nfields]; for(Int_t i=0;i<Nfields;i++) { hE2D[i] = NULL; hE1D[i] = NULL; if(!pData->GetEfieldFileName(i)) continue; cout << Form(" Getting electric field number ") << i+1 << endl; char hName[24]; sprintf(hName,"hE2D_%i",i); hE2D[i] = (TH2F*) gROOT->FindObject(hName); if(hE2D[i]) delete hE2D[i]; if(!pData->Is3D()) hE2D[i] = pData->GetEField(i,opt); else hE2D[i] = pData->GetEField2DSliceZY(i,-1,Nbins,opt+"avg"); hE2D[i]->SetName(hName); hE2D[i]->GetXaxis()->CenterTitle(); hE2D[i]->GetYaxis()->CenterTitle(); hE2D[i]->GetZaxis()->CenterTitle(); if(opt.Contains("comov")) hE2D[i]->GetXaxis()->SetTitle("#zeta [c/#omega_{p}]"); else hE2D[i]->GetXaxis()->SetTitle("z [c/#omega_{p}]"); if(pData->IsCyl()) hE2D[i]->GetYaxis()->SetTitle("r [c/#omega_{p}]"); else hE2D[i]->GetYaxis()->SetTitle("y [c/#omega_{p}]"); if(i==0) hE2D[i]->GetZaxis()->SetTitle("E_{z} [E_{0}]"); else if(i==1) hE2D[i]->GetZaxis()->SetTitle("E_{y} [E_{0}]"); else if(i==2) hE2D[i]->GetZaxis()->SetTitle("E_{x} [E_{0}]"); if(!opt.Contains("1dline")) continue; sprintf(hName,"hE1D_%i",i); hE1D[i] = (TH1F*) gROOT->FindObject(hName); if(hE1D[i]) delete hE1D[i]; // 1D histograms char nam[3]; sprintf(nam,"e%i",i+1); if(pData->Is3D()) { if(i==0) hE1D[i] = pData->GetH1SliceZ3D(pData->GetEfieldFileName(i)->c_str(),nam,-1,Nbins,-1,Nbins,opt+"avg"); else hE1D[i] = pData->GetH1SliceZ3D(pData->GetEfieldFileName(i)->c_str(),nam,-Nbins,Nbins,-Nbins,Nbins,opt+"avg"); } else if(pData->IsCyl()) { // Cylindrical: The first bin with r>0 is actually the number 1 (not the 0). hE1D[i] = pData->GetH1SliceZ(pData->GetEfieldFileName(i)->c_str(),nam,1,Nbins,opt+"avg"); } else { // 2D cartesian if(i==0) hE1D[i] = pData->GetH1SliceZ(pData->GetEfieldFileName(i)->c_str(),nam,-1,Nbins,opt+"avg"); else hE1D[i] = pData->GetH1SliceZ(pData->GetEfieldFileName(i)->c_str(),nam,-Nbins,Nbins,opt+"avg"); } hE1D[i]->SetName(hName); if(opt.Contains("comov")) hE1D[i]->GetXaxis()->SetTitle("#zeta [c/#omega_{p}]"); else hE1D[i]->GetXaxis()->SetTitle("z [c/#omega_{p}]"); if(i==0) hE1D[i]->GetYaxis()->SetTitle("E_{z} [E_{0}]"); else if(i==1) hE1D[i]->GetYaxis()->SetTitle("E_{y} [E_{0}]"); else if(i==2) hE1D[i]->GetYaxis()->SetTitle("E_{x} [E_{0}]"); } // Now, combine the electric field components into the total |E| // and calculate ionization probability for He: // Outter Helium electron Double_t Eion0 = 24.59 * PUnits::eV; Double_t Z = 1; Double_t l = 0; Double_t m = 0; TH1F *hIonProb1D = NULL; if(opt.Contains("ionprob")) { hIonProb1D = (TH1F*) hE1D[0]->Clone("hIonProb1D"); hIonProb1D->Reset(); Int_t NbinsX = hE1D[0]->GetNbinsX(); for(Int_t j=1;j<=NbinsX;j++) { Double_t E1 = hE1D[0]->GetBinContent(j); Double_t E2 = hE1D[1]->GetBinContent(j); Double_t E3 = hE1D[2]->GetBinContent(j); Double_t E = TMath::Sqrt(E1*E1+E2*E2+E3*E3); E *= E0; Double_t IonProb = (PFunc::ADK(E,Eion0,Z,l,m)/PUnits::atomictime)*PUnits::femtosecond; hIonProb1D->SetBinContent(j,IonProb); } hIonProb1D->GetYaxis()->SetTitle("W_{ADK} [fs^{-1}]"); } // Tunning the Histograms // --------------------- // Chaning to user units: // -------------------------- if(opt.Contains("units") && n0) { for(Int_t i=0;i<Nspecies;i++) { if(!hDen2D[i]) continue; Int_t NbinsX = hDen2D[i]->GetNbinsX(); Float_t xMin = skindepth * hDen2D[i]->GetXaxis()->GetXmin() / PUnits::um; Float_t xMax = skindepth * hDen2D[i]->GetXaxis()->GetXmax() / PUnits::um; Int_t NbinsY = hDen2D[i]->GetNbinsY(); Float_t yMin = skindepth * hDen2D[i]->GetYaxis()->GetXmin() / PUnits::um; Float_t yMax = skindepth * hDen2D[i]->GetYaxis()->GetXmax() / PUnits::um; hDen2D[i]->SetBins(NbinsX,xMin,xMax,NbinsY,yMin,yMax); // for(Int_t j=0;j<hDen2D[i]->GetNbinsX();j++) { // for(Int_t k=0;k<hDen2D[i]->GetNbinsY();k++) { // hDen2D[i]->SetBinContent(j,k, hDen2D[i]->GetBinContent(j,k) * n0 / (1e15/PUnits::cm3) ); // } // } if(pData->IsCyl()) hDen2D[i]->GetYaxis()->SetTitle("r [#mum]"); else hDen2D[i]->GetYaxis()->SetTitle("y [#mum]"); if(opt.Contains("comov")) hDen2D[i]->GetXaxis()->SetTitle("#zeta [#mum]"); else hDen2D[i]->GetXaxis()->SetTitle("z [#mum]"); // hDen2D[i]->GetZaxis()->SetTitle("n [10^{15}/cm^{3}]"); if(!hDen1D[i]) continue; hDen1D[i]->SetBins(NbinsX,xMin,xMax); if(opt.Contains("comov")) hDen1D[i]->GetXaxis()->SetTitle("#zeta [#mum]"); else hDen1D[i]->GetXaxis()->SetTitle("z [#mum]"); } for(Int_t i=0;i<Nfields;i++) { Int_t NbinsX = hE2D[i]->GetNbinsX(); Float_t xMin = skindepth * hE2D[i]->GetXaxis()->GetXmin() / PUnits::um; Float_t xMax = skindepth * hE2D[i]->GetXaxis()->GetXmax() / PUnits::um; Int_t NbinsY = hE2D[i]->GetNbinsY(); Float_t yMin = skindepth * hE2D[i]->GetYaxis()->GetXmin() / PUnits::um; Float_t yMax = skindepth * hE2D[i]->GetYaxis()->GetXmax() / PUnits::um; hE2D[i]->SetBins(NbinsX,xMin,xMax,NbinsY,yMin,yMax); if(hE1D[i]) hE1D[i]->SetBins(NbinsX,xMin,xMax); for(Int_t j=0;j<hE2D[i]->GetNbinsX();j++) { for(Int_t k=0;k<hE2D[i]->GetNbinsY();k++) { hE2D[i]->SetBinContent(j,k, hE2D[i]->GetBinContent(j,k) * ( E0 / (PUnits::GV/PUnits::m) ) ); } if(!hE1D[i]) continue; hE1D[i]->SetBinContent(j, hE1D[i]->GetBinContent(j) * ( E0 / (PUnits::GV) ) ); } if(pData->IsCyl()) hE2D[i]->GetYaxis()->SetTitle("r [#mum]"); else hE2D[i]->GetYaxis()->SetTitle("y [#mum]"); if(opt.Contains("comov")) hE2D[i]->GetXaxis()->SetTitle("#zeta [#mum]"); else hE2D[i]->GetXaxis()->SetTitle("z [#mum]"); if(i==0) hE2D[i]->GetZaxis()->SetTitle("E_{z} [GV/m]"); else if(i==1) hE2D[i]->GetZaxis()->SetTitle("E_{y} [GV/m]"); else if(i==2) hE2D[i]->GetZaxis()->SetTitle("E_{x} [GV/m]"); if(!hE1D[i]) continue; if(opt.Contains("comov")) hE1D[i]->GetXaxis()->SetTitle("#zeta [mm]"); else hE1D[i]->GetXaxis()->SetTitle("z [mm]"); if(i==0) hE1D[i]->GetYaxis()->SetTitle("E_{z} [GV/m]"); else if(i==1) hE1D[i]->GetYaxis()->SetTitle("E_{y} [GV/m]"); else if(i==2) hE1D[i]->GetYaxis()->SetTitle("E_{x} [GV/m]"); } if(hIonProb1D) { Int_t NbinsX = hIonProb1D->GetNbinsX(); Float_t xMin = skindepth * hIonProb1D->GetXaxis()->GetXmin() / PUnits::um; Float_t xMax = skindepth * hIonProb1D->GetXaxis()->GetXmax() / PUnits::um; hIonProb1D->SetBins(NbinsX,xMin,xMax); } } // --------------------------------------------------- Vertical Zoom ------------ Float_t range = (hDen2D[0]->GetYaxis()->GetXmax() - hDen2D[0]->GetYaxis()->GetXmin())/zoom; Float_t midPoint = (hDen2D[0]->GetYaxis()->GetXmax() + hDen2D[0]->GetYaxis()->GetXmin())/2.; Double_t ymin = midPoint-range/2; Double_t ymax = midPoint+range/2; if(pData->IsCyl()) { ymin = hDen2D[0]->GetYaxis()->GetXmin(); ymax = range; } hDen2D[0]->GetYaxis()->SetRangeUser(ymin,ymax); hE2D[0]->GetYaxis()->SetRangeUser(ymin,ymax); hE2D[1]->GetYaxis()->SetRangeUser(ymin,ymax); // ------------- z Zoom --------------------------------- Plasma palette ----------- // Set the range of the plasma charge density histogram for maximum constrast // using a dynamic palette wich adjust the nominal value to a certain color. Float_t density = 1; // if(opt.Contains("units") && n0) // density = n0 / (1e17/PUnits::cm3); Float_t Base = density; Float_t BaseB = TMath::Nint(100*(nb/n0))/100.0; Float_t gMax = hDen2D[0]->GetMaximum(); Float_t gMin = (0.1001) * Base; if(BaseB<Base) gMin = (0.1001) * BaseB; if(gMax<Base) gMax = 1.1*Base; Float_t *Max = new Float_t[Nspecies]; Float_t *Min = new Float_t[Nspecies]; for(Int_t i=0;i<Nspecies;i++) { if(!hDen2D[i]) continue; Max[i] = hDen2D[i]->GetMaximum(); Min[i] = 0.01*Max[i]; // if(i==1) = Min[i] = 1.001E-4; if(i==2) Min[i] = 1.001E-3; if(Max[i]>gMax) gMax = Max[i]; hDen2D[i]->GetZaxis()->SetRangeUser(Min[i],Max[i]); } hDen2D[0]->GetZaxis()->SetRangeUser(gMin,gMax); // if(hDen2D[1]) { // hDen2D[1]->GetZaxis()->SetRangeUser(gMin,Max[1]); // } // if(Nspecies>=3) { // if(hDen2D[2]) { // hDen2D[2]->GetZaxis()->SetRangeUser(gMin,Max[2]); // } // } // Dynamic plasma palette const Int_t plasmaDNRGBs = 3; const Int_t plasmaDNCont = 128; Double_t basePos = 0.5; if(gMax!=gMin) { if(opt.Contains("logz")) { Float_t a = 1.0/(TMath::Log10(gMax)-TMath::Log10(gMin)); Float_t b = TMath::Log10(gMin); basePos = a*(TMath::Log10(Base) - b); } else { basePos = (1.0/(gMax-gMin))*(Base - gMin); } } Double_t plasmaDStops[plasmaDNRGBs] = { 0.00, basePos, 1.00 }; Double_t plasmaDRed[plasmaDNRGBs] = { 0.99, 0.90, 0.00 }; Double_t plasmaDGreen[plasmaDNRGBs] = { 0.99, 0.90, 0.00 }; Double_t plasmaDBlue[plasmaDNRGBs] = { 0.99, 0.90, 0.00 }; PPalette * plasmaPalette = (PPalette*) gROOT->FindObject("plasma"); plasmaPalette->CreateGradientColorTable(plasmaDNRGBs, plasmaDStops, plasmaDRed, plasmaDGreen, plasmaDBlue, plasmaDNCont); // Change the range of z axis for the fields to be symmetric. Float_t Emax = hE2D[0]->GetMaximum(); Float_t Emin = hE2D[0]->GetMinimum(); if(Emax > TMath::Abs(Emin)) Emin = -Emax; else Emax = -Emin; hE2D[0]->GetZaxis()->SetRangeUser(Emin,Emax); Emax = hE2D[1]->GetMaximum(); Emin = hE2D[1]->GetMinimum(); if(Emax > TMath::Abs(Emin)) Emin = -Emax; else Emax = -Emin; hE2D[1]->GetZaxis()->SetRangeUser(Emin,Emax); // "Axis range" in Osiris units: Double_t ylow = hDen2D[1]->GetYaxis()->GetBinLowEdge(FirstyBin); Double_t yup = hDen2D[1]->GetYaxis()->GetBinUpEdge(LastyBin); Double_t xmin = hDen2D[1]->GetXaxis()->GetXmin(); Double_t xmax = hDen2D[1]->GetXaxis()->GetXmax(); TLine *lineYzero = new TLine(xmin,0.0,xmax,0.0); lineYzero->SetLineColor(kGray+2); lineYzero->SetLineStyle(2); TLine *lineYup = new TLine(xmin,yup,xmax,yup); lineYup->SetLineColor(kGray+1); lineYup->SetLineStyle(2); TLine *lineYdown = new TLine(xmin,ylow,xmax,ylow); lineYdown->SetLineColor(kGray+1); lineYdown->SetLineStyle(2); zStartPlasma -= shiftz; zStartNeutral -= shiftz; zEndNeutral -= shiftz; if(opt.Contains("units")) { zStartPlasma *= skindepth / PUnits::um; zStartNeutral *= skindepth / PUnits::um; zEndNeutral *= skindepth / PUnits::um; } // cout << "Start plasma = " << zStartPlasma << endl; TLine *lineStartPlasma = new TLine(zStartPlasma,ymin,zStartPlasma,ymax); lineStartPlasma->SetLineColor(kRed); lineStartPlasma->SetLineStyle(1); lineStartPlasma->SetLineWidth(2); // cout << "Start plasma = " << zStartNeutral << endl; TLine *lineStartNeutral = new TLine(zStartNeutral,ymin,zStartNeutral,ymax); lineStartNeutral->SetLineColor(kGray+1); lineStartNeutral->SetLineStyle(1); lineStartNeutral->SetLineWidth(2); // cout << "End plasma = " << zEndNeutral << endl; TLine *lineEndNeutral = new TLine(zEndNeutral,ymin,zEndNeutral,ymax); lineEndNeutral->SetLineColor(kGray+1); lineEndNeutral->SetLineStyle(2); lineEndNeutral->SetLineWidth(2); // Plotting // ----------------------------------------------- // Canvas setup TCanvas *C; if(opt.Contains("hres") && !opt.Contains("pdf")) // high resolution for plain grahics output. C = new TCanvas("C","2D Charge density, Accelerating and focusing fields",1500,2000); else C = new TCanvas("C","2D Charge density, Accelerating and focusing fields",750,1000); // Palettes setup TExec *exPlasma = new TExec("exPlasma","plasmaPalette->cd();"); TExec *exHot = new TExec("exHot","hotPalette->cd();"); TExec *exElec = new TExec("exElec","electronPalette->cd();"); TExec *exField = new TExec("exField","rbow2Palette->cd();"); // Text objects TPaveText *textTime = new TPaveText(0.7,0.83,0.85,0.90,"NDC"); PlasmaGlob::SetPaveTextStyle(textTime,32); char ctext[128]; if(opt.Contains("units") && n0) sprintf(ctext,"z = %5.1f #mum", Time * skindepth / PUnits::um); else sprintf(ctext,"t = %5.1f #omega_{p}^{-1}",Time); textTime->AddText(ctext); TPaveText *textDen = new TPaveText(0.13,0.83,0.38,0.90,"NDC"); PlasmaGlob::SetPaveTextStyle(textDen,12); textDen->SetTextColor(kOrange+10); if(opt.Contains("units") && n0) sprintf(ctext,"n_{0} = %5.2f x 10^{15} / cm^{3}", 1e-15 * n0 * PUnits::cm3); else if(pData->GetBeamDensity() && n0) sprintf(ctext,"n_{b}/n_{0} = %5.2f", pData->GetBeamDensity()/n0); textDen->AddText(ctext); TPaveText *textWav = new TPaveText(0.13,0.75,0.38,0.82,"NDC"); PlasmaGlob::SetPaveTextStyle(textWav,12); textWav->SetTextColor(kGray+2); sprintf(ctext,"#lambda_{p} = %5.3f mm", skindepth * TMath::TwoPi() / PUnits::um); textWav->AddText(ctext); // Actual Plotting! // ------------------------------------------------------------ // Output file TString fOutName = Form("./%s/Plots/ChargeFieldFocus2D/ChargeFieldFocus2D",pData->GetPath().c_str()); fOutName += Form("-%s_%i",pData->GetName(),time); // Setup Pad layout: Double_t lMargin = 0.10; Double_t rMargin = 0.12; Double_t bMargin = 0.10; Double_t tMargin = 0.02; Double_t vSpacing = 0.01; Double_t hStep = (1.-lMargin-rMargin); Double_t vStep = (1.-bMargin-tMargin)/3.; TPad *pad[3]; // top plots pad[0] = new TPad("padt", "padt",0.00, bMargin + 2.*vStep + vSpacing, lMargin+hStep+rMargin, 1.00); pad[0]->SetLeftMargin(1./(lMargin+hStep)*lMargin); pad[0]->SetRightMargin(1./(rMargin+hStep)*rMargin); pad[0]->SetBottomMargin(0.0); pad[0]->SetTopMargin(1./(tMargin+vStep)*tMargin); pad[0]->Draw(); // middle plots pad[1] = new TPad("padm", "padm",0.00, bMargin + vStep + vSpacing, lMargin + hStep + rMargin, bMargin + 2.*vStep ); pad[1]->SetLeftMargin(1./(lMargin+hStep)*lMargin); pad[1]->SetRightMargin((1./(rMargin+hStep)*rMargin)); pad[1]->SetBottomMargin(0.0); pad[1]->SetTopMargin(0.); pad[1]->Draw(); // bottom plots pad[2] = new TPad("padb", "padb",0.00, 0.,lMargin+hStep+rMargin,bMargin+vStep); pad[2]->SetLeftMargin(1./(lMargin+hStep)*lMargin); pad[2]->SetRightMargin((1./(rMargin+hStep)*rMargin)); pad[2]->SetBottomMargin(1./(bMargin+vStep)*bMargin); pad[2]->SetTopMargin(0.); pad[2]->Draw(); // Draw! pad[0]->cd(); // <---------------------------------------------- Top Plot --------- if(opt.Contains("logz")) { pad[0]->SetLogz(1); } else { pad[0]->SetLogz(0); } pad[0]->SetFrameLineWidth(3); TH2F *hFrame = (TH2F*) gROOT->FindObject("hFrame1"); if(hFrame) delete hFrame; hFrame = (TH2F*) hDen2D[0]->Clone("hFrame1"); hFrame->Reset(); hFrame->GetXaxis()->SetLabelOffset(999); hFrame->GetYaxis()->SetTitleSize(0.075); hFrame->GetYaxis()->SetTitleOffset(0.65); hFrame->GetYaxis()->SetLabelSize(0.065); hFrame->GetYaxis()->SetLabelOffset(0.02); hFrame->GetYaxis()->SetTickLength(0.02); hFrame->GetZaxis()->SetTitleSize(0.06); hFrame->GetZaxis()->SetTitleOffset(0.45); hFrame->GetZaxis()->SetLabelSize(0.06); hFrame->GetZaxis()->SetTickLength(0.02); // hFrame->GetZaxis()->SetNdivisions(505); hFrame->Draw("col"); if(Nspecies>=3) { if(hDen2D[2]) { exHot->Draw(); hDen2D[2]->Draw("colz same"); } } exPlasma->Draw(); hDen2D[0]->Draw("colz same"); if(hDen2D[1]) { exElec->Draw(); hDen2D[1]->Draw("colz same"); } if(opt.Contains("1dline")) { lineYzero->Draw(); lineYdown->Draw(); lineYup->Draw(); } if(zStartPlasma>xmin && zStartPlasma<xmax) lineStartPlasma->Draw(); if(zStartNeutral>xmin && zStartNeutral<xmax) lineStartNeutral->Draw(); if(zEndNeutral>xmin && zEndNeutral<xmax) lineEndNeutral->Draw(); pad[0]->Update(); TPaletteAxis *palette = NULL; for(Int_t i=0;i<Nspecies;i++) { if(!hDen2D[i]) continue; palette = (TPaletteAxis*) hDen2D[i]->GetListOfFunctions()->FindObject("palette"); if(!palette) continue; Float_t y1 = gPad->GetBottomMargin(); Float_t y2 = 1 - gPad->GetTopMargin(); Float_t x1 = gPad->GetLeftMargin(); Float_t x2 = 1 - gPad->GetRightMargin(); palette->SetY2NDC( (i+1)*(y2-y1)/Nspecies + y1); palette->SetY1NDC( i*(y2-y1)/Nspecies + y1); palette->SetX1NDC(x2 + 0.005); palette->SetX2NDC(x2 + 0.03); palette->SetTitleOffset(0.65); palette->SetTitleSize(0.07); palette->SetLabelSize(0.065); palette->SetBorderSize(2); palette->SetLineColor(1); } // 1D charge density plots: Float_t yaxismin = pad[0]->GetUymin(); Float_t yaxismax = pad[0]->GetUymin() + 0.33*(pad[0]->GetUymax() - pad[0]->GetUymin()) - 0.00; // Float_t denmin = (0.1001) * density; Float_t denmin = gMin; Float_t denmax = gMax; if(opt.Contains("logz")) { denmin = TMath::Log10(denmin); denmax = TMath::Log10(denmax); } for(Int_t i=0;i<Nspecies;i++) { if(!hDen1D[i]) continue; Float_t slope = (yaxismax - yaxismin)/(denmax - denmin); for(Int_t j=0;j<hDen1D[i]->GetNbinsX();j++) { Float_t content = hDen1D[i]->GetBinContent(j+1); if(opt.Contains("logz")) content = TMath::Log10(content); if(content<denmin) hDen1D[i]->SetBinContent(j+1,yaxismin); else hDen1D[i]->SetBinContent(j+1,(content - denmin) * slope + yaxismin); } hDen1D[i]->SetLineWidth(2); if(i==1) { hDen1D[i]->SetLineColor(PlasmaGlob::elecLine); hDen1D[i]->Draw("same C"); } else if (i==2) { hDen1D[i]->SetLineColor(kOrange+8); hDen1D[i]->Draw("same C"); } } textTime->Draw(); // textDen->Draw(); // textWav->Draw(); pad[0]->RedrawAxis(); pad[1]->cd(); // <--------------------------------------------- Mid Plot pad[1]->SetFrameLineWidth(3); TH2F *hFrame2 = (TH2F*) gROOT->FindObject("hFrame2"); if(hFrame2) delete hFrame2; hFrame2 = (TH2F*) hE2D[0]->Clone("hFrame2"); hFrame2->Reset(); Float_t yFactor = pad[0]->GetAbsHNDC()/pad[1]->GetAbsHNDC(); hFrame2->GetXaxis()->SetLabelOffset(999); hFrame2->GetYaxis()->SetTitleSize(0.075*yFactor); hFrame2->GetYaxis()->SetTitleOffset(0.65/yFactor); hFrame2->GetYaxis()->SetLabelSize(0.0650*yFactor); hFrame2->GetYaxis()->SetLabelOffset(0.02/yFactor); hFrame2->GetYaxis()->SetTickLength(0.02/yFactor); hE2D[0]->GetZaxis()->SetTitleSize(0.06*yFactor); hE2D[0]->GetZaxis()->SetTitleOffset(0.45/yFactor); hE2D[0]->GetZaxis()->SetLabelSize(0.06*yFactor); hE2D[0]->GetZaxis()->SetTickLength(0.02/yFactor); // hFrame2->GetZaxis()->SetNdivisions(505); hFrame2->Draw("col"); exField->Draw(); hE2D[0]->Draw("colz same"); if(opt.Contains("1dline")) { lineYzero->Draw(); lineYdown->Draw(); lineYup->Draw(); } if(zStartPlasma>xmin && zStartPlasma<xmax) lineStartPlasma->Draw(); if(zStartNeutral>xmin && zStartNeutral<xmax) lineStartNeutral->Draw(); if(zEndNeutral>xmin && zEndNeutral<xmax) lineEndNeutral->Draw(); pad[1]->Update(); palette = (TPaletteAxis*) hE2D[0]->GetListOfFunctions()->FindObject("palette"); Float_t y1 = pad[1]->GetBottomMargin(); Float_t y2 = 1 - pad[1]->GetTopMargin(); Float_t x2 = 1 - pad[1]->GetRightMargin(); palette->SetY2NDC(y2 - 0.01); palette->SetY1NDC(y1 + 0.01); palette->SetX1NDC(x2 + 0.005); palette->SetX2NDC(x2 + 0.03); palette->SetTitleSize(0.07*yFactor); palette->SetTitleOffset(0.65/yFactor); palette->SetLabelSize(0.065*yFactor); palette->SetBorderSize(2); palette->SetLineColor(1); // 1D electric field plots: if(hE1D[0]) { // yaxismin = pad[1]->GetUymin() + 0.16666*(pad[1]->GetUymax() - pad[1]->GetUymin()); // yaxismax = pad[1]->GetUymax() - 0.16666*(pad[1]->GetUymax() - pad[1]->GetUymin()); Float_t yaxismin = pad[1]->GetUymin(); Float_t yaxismax = pad[1]->GetUymax(); Float_t emin = hE1D[0]->GetMinimum(); Float_t emax = hE1D[0]->GetMaximum(); //Float_t slope = (yaxismax - yaxismin)/(emax - emin); Float_t slope = yaxismin/emin; for(Int_t j=0;j<hE1D[0]->GetNbinsX();j++) { Float_t content = hE1D[0]->GetBinContent(j+1); hE1D[0]->SetBinContent(j+1,(content - emin) * slope + yaxismin); } hE1D[0]->SetLineWidth(2); hE1D[0]->SetLineColor(PlasmaGlob::elecLine); // hE1D[0]->SetLineColor(kGray+2); hE1D[0]->Draw("same C"); } // Plot ionization probability: if(hIonProb1D) { Float_t ionmin = 0; Float_t ionmax = hIonProb1D->GetMaximum(); Float_t slope = yaxismax/ionmax; for(Int_t j=0;j<hIonProb1D->GetNbinsX();j++) { Float_t content = hIonProb1D->GetBinContent(j+1); hIonProb1D->SetBinContent(j+1,content * slope); } hIonProb1D->SetLineWidth(2); hIonProb1D->SetLineColor(kGray+2); hIonProb1D->Draw("same C"); } pad[1]->RedrawAxis(); pad[2]->cd(); // <--------------------------------------------- Bottom Plot pad[2]->SetFrameLineWidth(3); TH2F *hFrame3 = (TH2F*) gROOT->FindObject("hFrame3"); if(hFrame3) delete hFrame3; hFrame3 = (TH2F*) hE2D[1]->Clone("hFrame3"); hFrame3->Reset(); yFactor = pad[0]->GetAbsHNDC()/pad[2]->GetAbsHNDC(); hFrame3->GetXaxis()->SetTitleSize(0.075); hFrame3->GetXaxis()->SetLabelSize(0.070); hFrame3->GetYaxis()->SetTitleSize(0.075*yFactor); hFrame3->GetYaxis()->SetTitleOffset(0.65/yFactor); hFrame3->GetYaxis()->SetLabelSize(0.0650*yFactor); hFrame3->GetYaxis()->SetLabelOffset(0.02/yFactor); hFrame3->GetYaxis()->SetTickLength(0.02/yFactor); hE2D[1]->GetZaxis()->SetTitleSize(0.06*yFactor); hE2D[1]->GetZaxis()->SetTitleOffset(0.45/yFactor); hE2D[1]->GetZaxis()->SetLabelSize(0.06*yFactor); hE2D[1]->GetZaxis()->SetTickLength(0.02/yFactor); // hE2D[1]->GetZaxis()->SetNdivisions(505); hFrame3->Draw("col"); exField->Draw(); hE2D[1]->Draw("colz same"); if(opt.Contains("1dline")) { lineYzero->Draw(); lineYup->Draw(); } if(zStartPlasma>xmin && zStartPlasma<xmax) lineStartPlasma->Draw(); if(zStartNeutral>xmin && zStartNeutral<xmax) lineStartNeutral->Draw(); if(zEndNeutral>xmin && zEndNeutral<xmax) lineEndNeutral->Draw(); pad[2]->Update(); palette = (TPaletteAxis*)hE2D[1]->GetListOfFunctions()->FindObject("palette"); y1 = pad[2]->GetBottomMargin(); y2 = 1 - pad[2]->GetTopMargin(); x2 = 1 - pad[2]->GetRightMargin(); palette->SetY2NDC(y2 - 0.01); palette->SetY1NDC(y1 + 0.01); palette->SetX1NDC(x2 + 0.005); palette->SetX2NDC(x2 + 0.03); palette->SetTitleSize(0.07*yFactor); palette->SetTitleOffset(0.65/yFactor); palette->SetLabelSize(0.065*yFactor); palette->SetBorderSize(2); palette->SetLineColor(1); // 1D electric field plots: if(hE1D[1]) { // yaxismin = pad[2]->GetUymin() + 0.16666*(pad[2]->GetUymax() - pad[2]->GetUymin()); // yaxismax = pad[2]->GetUymax() - 0.16666*(pad[2]->GetUymax() - pad[2]->GetUymin()); Float_t yaxismin = pad[2]->GetUymin(); Float_t yaxismax = pad[2]->GetUymax(); Float_t emin = hE1D[1]->GetMinimum(); Float_t emax = hE1D[1]->GetMaximum(); Float_t slope = yaxismin/emin; for(Int_t j=0;j<hE1D[1]->GetNbinsX();j++) { Float_t content = hE1D[1]->GetBinContent(j+1); hE1D[1]->SetBinContent(j+1,(content - emin) * slope + yaxismin); } hE1D[1]->SetLineWidth(2); //hE1D[1]->SetLineStyle(2); // hE1D[1]->SetLineColor(kGray+2); hE1D[1]->SetLineColor(PlasmaGlob::elecLine); hE1D[1]->Draw("same C"); } // Plot ionization probability: if(hIonProb1D) { Float_t ionmin = 0; Float_t ionmax = hIonProb1D->GetMaximum(); Float_t slope = yaxismax/ionmax; for(Int_t j=0;j<hIonProb1D->GetNbinsX();j++) { Float_t content = hIonProb1D->GetBinContent(j+1); hIonProb1D->SetBinContent(j+1,content * slope); } hIonProb1D->SetLineWidth(2); hIonProb1D->SetLineColor(kGray+2); hIonProb1D->Draw("same C"); } pad[2]->RedrawAxis(); C->cd(); // Print to a file PlasmaGlob::imgconv(C,fOutName,opt); // --------------------------------------------------------- }
void unfoldPt(int mode=0) { // Matched Tracklets TFile *inf = new TFile("match-10TeV-12.root"); TNtuple *nt = (TNtuple*)inf->FindObjectAny("nt"); // Test sample TFile *infTest = new TFile("./TrackletTree-Run123596.root"); TNtuple *ntTest = (TNtuple*)infTest->FindObjectAny("TrackletTree12"); TFile *pdfFile; if (mode==0) pdfFile = new TFile("pdf.root","recreate"); else pdfFile = new TFile("pdf.root"); double nPtBin=15; double minPt=log(0.05); double maxPt=log(10); double nDphiBin=600; double maxDphi=0.4; char* mycut = Form("abs(eta)<2&&log(pt)>%f&&log(pt)<%f",minPt,maxPt); char* mycut1=Form("abs(eta)<2&&log(pt)>%f&&log(pt)<%f&&abs(eta-eta1)<0.01&&abs(deta)<0.01",minPt,maxPt); TH2F *h; TH1F *hdphi = new TH1F("hdphi","",nDphiBin,0,maxDphi); TH1F *hdphi2; TH1F *hpt; TH1F *hptH = new TH1F("hptH","",nPtBin,minPt,maxPt); TH1F *hptUnfold = new TH1F("hptUnfold","",nPtBin,minPt,maxPt); TH1F *hptMC = new TH1F("hptMC","",nPtBin,minPt,maxPt); TH1F *hptTemp = new TH1F("hptTemp","",nPtBin,minPt,maxPt); // Delta phi as a function of matched genparticle transverse momentum TCanvas *c = new TCanvas("c","",600,600); if (mode == 0) { h = new TH2F("h","",nPtBin,minPt,maxPt,nDphiBin,0,maxDphi); hdphi2 = new TH1F("hdphiMC","",nDphiBin,0,maxDphi); hpt = new TH1F("hpt","",nPtBin,minPt,maxPt); h->SetXTitle("ln(P_{T}) GeV/c"); h->SetYTitle("|#Delta#phi|"); nt->Draw("abs(dphi):log(pt)>>h",mycut1,"col"); // used to generate pdf nt->Draw("abs(dphi)>>hdphiMC",mycut,""); nt->Draw("log(pt)>>hpt",mycut,""); h->Write(); hpt->Write(); hdphi2->Write(); } else { h = (TH2F*) pdfFile->FindObjectAny("h"); hdphi2 = (TH1F*) pdfFile->FindObjectAny("hdphiMC"); hpt = (TH1F*) pdfFile->FindObjectAny("hpt"); } // Delta phi fit TCanvas *c2 = new TCanvas("c2","",600,600); c2->SetLogy(); c2->SetLogx(); // dphi for unfolding and MC truth: ntTest->Draw("abs(dphi)>>hdphi","abs(eta1)<2&&abs(deta)<0.1","",200000); ntTest->Draw("log(pt)>>hptH",mycut,"",200000); histFunction2D *myfun = new histFunction2D(h); TF1 *test = new TF1("histFun",myfun,&histFunction2D::evaluate,0,maxDphi,nPtBin+1); TF1 *test2 = new TF1("histFunMC",myfun,&histFunction2D::evaluate,0,maxDphi,nPtBin+1); for (int i=0;i<nPtBin+1;i++) { test->SetParameter(i,1); } hdphi2->SetXTitle("|#Delta#phi|"); hdphi2->SetYTitle("Arbitrary Normalization"); hdphi2->Fit("histFunMC","M"); hdphi->SetXTitle("|#Delta#phi|"); hdphi->SetYTitle("Arbitrary Normalization"); hdphi->Fit("histFun","M"); hdphi->SetStats(0); hdphi->Draw(); for (int i=0;i<nPtBin+1;i++) { TF1 *testPlot = new TF1(Form("histFun%d",i),myfun,&histFunction2D::evaluate,0,maxDphi,nPtBin+1); testPlot->SetParameter(i,test->GetParameter(i)); testPlot->SetLineColor(i+2); testPlot->Draw("same"); } int total=0,totalMC=0; for (int i=0;i<nPtBin;i++){ if (test->GetParameter(i)==0) continue; hptUnfold->SetBinContent(i+1,fabs(test->GetParameter(i))); hptUnfold->SetBinError(i+1,test->GetParError(i)); hptMC->SetBinContent(i+1,fabs(test2->GetParameter(i))); hptMC->SetBinError(i+1,test2->GetParError(i)); total+=fabs(test->GetParameter(i)); totalMC+=fabs(test2->GetParameter(i)); } hptUnfold->SetEntries(total); hptMC->SetEntries(totalMC); TCanvas *c3 = new TCanvas("c3","",600,600); hpt->Sumw2(); hptH->Sumw2(); //hptMC->Sumw2(); double normMC=0; double norm=0; double normTruth=0; hptUnfold->SetMarkerColor(2); hptUnfold->SetMarkerStyle(4); // hptUnfold->Scale(1./hptUnfold->GetEntries()); TH1F *hptCorrected = (TH1F*)hptUnfold->Clone(); hptCorrected->SetName("hptCorrected"); hptMC->Divide(hpt); hptCorrected->Divide(hptMC); for (int i=0;i<nPtBin;i++){ if (hptMC->GetBinContent(i)<=0.001)hptCorrected->SetBinContent(i,0); } hptCorrected->Scale(1./(hptCorrected->GetSum())); hptCorrected->SetMarkerStyle(20); hpt->Scale(1./hpt->GetEntries()); if (hptH->GetEntries())hptH->Scale(1./hptH->GetEntries()); hptTemp->SetXTitle("ln(P_{T}) GeV/c"); hptTemp->SetYTitle("Arbitrary Normalization"); hptTemp->Draw(); hptH->SetXTitle("ln(P_{T}) GeV/c"); hptH->SetYTitle("Arbitrary Normalization"); hptH->Draw("hist"); hptH->SetLineColor(4); hpt->Draw("hist same "); hptCorrected->Draw("same"); TH1F *hptUnfoldRatio = (TH1F*)hptUnfold->Clone(); hptUnfoldRatio->SetName("hptUnfoldRatio"); hptUnfoldRatio->Scale(1./hptUnfoldRatio->GetSum()); //hptUnfoldRatio->Divide(hptH); TH1F *hptCorrectedRatio = (TH1F*)hptCorrected->Clone(); hptCorrectedRatio->SetName("hptCorrectedRatio"); hptCorrectedRatio->SetMarkerColor(2); //hptCorrectedRatio->Divide(hptH); TCanvas *c4 = new TCanvas("c4","",600,600); TLine *l = new TLine(-2.5,1,2.5,1); hptUnfoldRatio->Draw(); hptMC->Draw("same"); hptCorrectedRatio->Draw("same"); l->Draw("same"); }
void PlotAll_DATA_JMT_TEST(bool print=false) { gROOT->LoadMacro("invar_yield_ana_v9.C+"); gROOT->LoadMacro("invar_yield_ana_GEN_v9.C+"); char dir[100]; char dir_corr[100]; bool GEN = false; bool CORRECT = false; bool REBIN = false; bool MC = false; bool multcrct =false; bool seccrct = false; bool cross = false; bool loose = false; bool jet_based_correction = true; bool entire_range = true; bool zerobin = false; bool onetwothreebin = false; bool evteffcorr = false; bool full_eta =true; bool oneoverpt=true; bool minpt=true; bool rescrct=false; bool rebOnly=false; bool log_scale = true; int mom_index = 4; int mult_bin = 0; double jet_min=0; double jet_max=2000; double eta_max; float pt_max; float ymin, ymax; float ymin_r, ymax_r; if(entire_range){ if(MC) pt_max = 55, ymin = 3e-13, ymax = 9e1, ymin_r = 0.30, ymax_r = 1.65; else pt_max = 170, ymin = 3e-16, ymax = 9e1, ymin_r = 0.35, ymax_r = 1.65; }else{ if(MC) pt_max = 10, ymin = 5e-7, ymax = 2e1, ymin_r = 0.7, ymax_r = 1.4; else pt_max = 6.5, ymin = 5e-6, ymax = 5e1, ymin_r = 0.75, ymax_r = 1.25; } if(full_eta) eta_max = 2.4; else eta_max = 1.0; char file1[200], file2[200], file3[200], file4[200], file5[200], file6[200], file7[200]; //sprintf(file1,"../root_files/MB-C10-A20RR-TRKANASKIM-MERGED.root"); //sprintf(file1,"../root_files/MB-C10-M6RR-JMTskim-v0_0615.root"); //sprintf(file1,"../root_files/MB-C10-PR9-JMTskim-v0_v2_0615.root"); sprintf(file1,"../root_files/MB-C10-M6RR-MBskim-v0_0615.root"); sprintf(file2,"../root_files/TrkHistMC_june09_qcdMB.root"); sprintf(file3,"../root_files/TrkHistMC_june09_qcdMB.root"); sprintf(file4,"../root_files/TrkHistMC_june09_qcdPt15.root"); sprintf(file5,"../root_files/TrkHistMC_june09_qcdPt30v3.root"); sprintf(file6,"../root_files/TrkHistMC_june09_qcdPt80v3.root"); sprintf(file7,"../root_files/TrkHistMC_june09_qcdPt170v3.root"); //MC = false, GEN = false, CORRECT = true, multcrct = true, seccrct = true, evteffcorr = true, zerobin = true, onetwothreebin = true; MC = false, GEN = false, CORRECT = true, multcrct = true, seccrct = true, evteffcorr = true, zerobin = true, onetwothreebin = true, rescrct= true; sprintf(dir,"trackAna_STD"); sprintf(dir_corr,"trkEffAnalyzer"); invar_yield_ana_v9_data spec_rec_tight = invar_yield_ana_v9_graph(file1,file2,file3,file4,file5,file6,file7, dir,dir_corr,GEN,CORRECT,multcrct,seccrct,MC,jet_based_correction, evteffcorr,zerobin,onetwothreebin,cross,oneoverpt,rescrct,rebOnly,mom_index,mult_bin,jet_min,jet_max,0,eta_max); MC = false, GEN = false, CORRECT = true, multcrct = true, seccrct = true, evteffcorr = true, zerobin = true, onetwothreebin = true, rescrct= true; sprintf(dir,"trackAna_STD"); sprintf(dir_corr,"trkEffAnalyzer"); jet_min = 0; jet_max = 45;//-->60 invar_yield_ana_v9_data spec_rec_tight_res = invar_yield_ana_v9_graph(file1,file2,file3,file4,file5,file6,file7, dir,dir_corr,GEN,CORRECT,multcrct,seccrct,MC,jet_based_correction, evteffcorr,zerobin,onetwothreebin,cross,oneoverpt,rescrct,rebOnly,mom_index,mult_bin,jet_min,jet_max,0,eta_max); //sprintf(file1,"../root_files/MB-C10-PR9-JMTskim-v0_v2_0615.root"); //sprintf(file1,"../root_files/MB-C10-PR9-M6RR-JMTskim-v0_0615.root"); //sprintf(file1,"../root_files/JMT-R10A-PR1-JMTskim-v0_0615.root"); sprintf(file1,"../root_files/MB-C10-PR9-M6RR-JMTskim-JMT-R10A-PR1-JMTskim-v0_0615.root"); MC = false, GEN = false, CORRECT = true, multcrct = true, seccrct = true, evteffcorr = true, zerobin = true, onetwothreebin = true, rescrct= true; sprintf(dir,"trackAna_STD"); sprintf(dir_corr,"trkEffAnalyzer"); jet_min = 45;//=-> 60 jet_max = 2000; invar_yield_ana_v9_data spec_rec_tight_resR = invar_yield_ana_v9_graph(file1,file2,file3,file4,file5,file6,file7, dir,dir_corr,GEN,CORRECT,multcrct,seccrct,MC,jet_based_correction, evteffcorr,zerobin,onetwothreebin,cross,oneoverpt,rescrct,rebOnly,mom_index,mult_bin,jet_min,jet_max,0,eta_max); //GEN MC sprintf(file1,"../root_files/TrkHistMC_june09_qcdMB.root"); sprintf(file2,"../root_files/TrkHistMC_june09_qcdMB.root"); sprintf(file3,"../root_files/TrkHistMC_june09_qcdMB.root"); sprintf(file4,"../root_files/TrkHistMC_june09_qcdPt15.root"); sprintf(file5,"../root_files/TrkHistMC_june09_qcdPt30v3.root"); sprintf(file6,"../root_files/TrkHistMC_june09_qcdPt80v3.root"); sprintf(file7,"../root_files/TrkHistMC_june09_qcdPt170v3.root"); MC = true, GEN = true, CORRECT = false, multcrct = false, seccrct = false, evteffcorr = false, zerobin = false, onetwothreebin = false, rescrct= false; sprintf(dir,"preTrackAna"); sprintf(dir_corr,"trkEffAnalyzer"); jet_min = 0; jet_max = 2000; invar_yield_ana_v9_data spec_rec_tight_MC = invar_yield_ana_v9_graph(file1,file2,file3,file4,file5,file6,file7, dir,dir_corr,GEN,CORRECT,multcrct,seccrct,MC,jet_based_correction, evteffcorr,zerobin,onetwothreebin,cross,oneoverpt,rescrct,rebOnly,mom_index,mult_bin,jet_min,jet_max,0,eta_max); // P0 sprintf(file1,"../root_files/mergePY8.root"); sprintf(file2,"../root_files/mergePY8.root"); sprintf(file3,"../root_files/mergePY8.root"); sprintf(file4,"../root_files/mergePY8.root"); sprintf(file5,"../root_files/mergePY8.root"); sprintf(file6,"../root_files/mergePY8.root"); sprintf(file7,"../root_files/mergePY8.root"); /* sprintf(file1,"../root_files/mergeP0.root"); sprintf(file2,"../root_files/mergeP0.root"); sprintf(file3,"../root_files/mergeP0.root"); sprintf(file4,"../root_files/mergeP0.root"); sprintf(file5,"../root_files/mergeP0.root"); sprintf(file6,"../root_files/mergeP0.root"); sprintf(file7,"../root_files/mergeP0.root"); */ MC = true, GEN = true, CORRECT = false, multcrct = false, seccrct = false, evteffcorr = false, zerobin = false, onetwothreebin = false, rescrct= false; sprintf(dir,"preTrackAna"); sprintf(dir_corr,"trkEffAnalyzer"); jet_min = 0; jet_max = 2000; invar_yield_ana_v9_data spec_rec_tight_MC_p0 = invar_yield_ana_v9_graph(file1,file2,file3,file4,file5,file6,file7, dir,dir_corr,GEN,CORRECT,multcrct,seccrct,MC,jet_based_correction, evteffcorr,zerobin,onetwothreebin,cross,oneoverpt,rescrct,rebOnly,mom_index,mult_bin,jet_min,jet_max,0,eta_max); // Pythia 8 sprintf(file1,"../root_files/mergePY8.root"); sprintf(file2,"../root_files/mergePY8.root"); sprintf(file3,"../root_files/mergePY8.root"); sprintf(file4,"../root_files/mergePY8.root"); sprintf(file5,"../root_files/mergePY8.root"); sprintf(file6,"../root_files/mergePY8.root"); sprintf(file7,"../root_files/mergePY8.root"); MC = true, GEN = true, CORRECT = false, multcrct = false, seccrct = false, evteffcorr = false, zerobin = false, onetwothreebin = false, rescrct= false; sprintf(dir,"preTrackAna"); sprintf(dir_corr,"trkEffAnalyzer"); jet_min = 0; jet_max = 2000; invar_yield_ana_v9_data spec_rec_tight_MC_py8 = invar_yield_ana_v9_graph(file1,file2,file3,file4,file5,file6,file7, dir,dir_corr,GEN,CORRECT,multcrct,seccrct,MC,jet_based_correction, evteffcorr,zerobin,onetwothreebin,cross,oneoverpt,rescrct,rebOnly,mom_index,mult_bin,jet_min,jet_max,0,eta_max); //--------------------------- CMS measurement --------------------------- TGraphErrors* cms_7000GeV = (TGraphErrors*) CMS_7TEV(1); //TF1* f2 = new TF1("fitpythia","[0]*(1+(x/[1])+(pow(x,2)/[2])+(pow(x,3)/[3])+(pow(x,4)/[4])+(pow(x,5)/[5]))^[6]",0.2,6.0); //f2->SetParameters(1.81426e+01,1.08477e+00,1,1,1,1,-9.48034e+00); //cms_7000GeV->Fit(f2,"RN"); //TF1 *f2 = new TF1("fitTsallis","[0]*(1+(sqrt(0.1396**2+x**2)-0.1396)/([1]*[2]))**(-[2])",0.5,200); //f2->SetParameters(1.32522e+01,1.67841e-01,7.26036e+00); // fit the measurement //f2->SetParameters(1.82045e+01,1.53540e-01,7.06942e+00); // fit the fit (used in paper) //f2->SetLineColor(1); TF1* f2 = new TF1("fitPythia","[0]*(1+(x/[1])+(pow(x,2)/[2])+(pow(x,3)/[3])+(pow(x,4)/[4])+(pow(x,5)/[5]))^[6]",0.5,180); f2->SetParameters(2.96361e+01,2.66339e-01,1.34086e-01,2.96428e-01,1.74015e+00,5.16931e+00,-1.70643e+00); //--------------------------------------------------- PYTHIA truth GEN------------------------ //gROOT->LoadMacro("invar_yield_ana_GEN_v9.C+"); char file1_GEN[100], file2_GEN[100], file3_GEN[100], file4_GEN[100], file5_GEN[100], file6_GEN[100], file7_GEN[100]; char file8_GEN[100], file9_GEN[100], file10_GEN[100]; sprintf(file1_GEN,"../root_files/TrkHistMC_june04_qcdPt0To15v3cFix.root"); sprintf(file2_GEN,"../root_files/TrkHistMC_june04_qcdPt15to20v2.root"); sprintf(file3_GEN,"../root_files/TrkHistMC_june04_qcdPt20to30v2.root"); sprintf(file4_GEN,"../root_files/TrkHistMC_june04_qcdPt30to50v2.root"); sprintf(file5_GEN,"../root_files/TrkHistMC_june04_qcdPt50to80v2.root"); sprintf(file6_GEN,"../root_files/TrkHistMC_june04_qcdPt80to120v2.root"); sprintf(file7_GEN,"../root_files/TrkHistMC_june04_qcdPt120to170v2.root"); sprintf(file8_GEN,"../root_files/TrkHistMC_june04_qcdPt170to230v2.root"); sprintf(file9_GEN,"../root_files/TrkHistMC_june04_qcdPt230to300v2.root"); sprintf(file10_GEN,"../root_files/TrkHistMC_june04_qcdPt300to380v2.root"); invar_yield_ana_GEN_v9_data gen_nsd_spect = invar_yield_ana_GEN_v9_graph(file1_GEN,file2_GEN,file3_GEN,file4_GEN, file5_GEN,file6_GEN,file7_GEN,file8_GEN, file9_GEN,file10_GEN,true,117.,0,eta_max); //--------------------------------------------------- PYTHIA truth GEN------------------------ double intLum; TH1D *dndpt_rec_tight=0; TH1D *dndpt_rec_tight_res=0; TH1D *dndpt_rec_tight_resR=0; TH1D *dndpt_rec_tight_added=0; TH1D *dndpt_rec_tight_MC=0; TH1D *dndpt_rec_tight_MC_p0=0; TH1D *dndpt_rec_tight_MC_py8=0; TH1D *dndpt_gen_nsd=0; TGraphErrors *dndpt_gen_nsd_tg=0; if(REBIN){ dndpt_rec_tight = spec_rec_tight.hRInvX; intLum = spec_rec_tight.integratedLum; dndpt_rec_tight->Scale(1./intLum); dndpt_rec_tight_res = spec_rec_tight_res.hRInvX; intLum = spec_rec_tight_res.integratedLum; dndpt_rec_tight_res->Scale(1./intLum); dndpt_rec_tight_MC = spec_rec_tight_MC.hRInvX; intLum = spec_rec_tight_MC.integratedLum; dndpt_rec_tight_MC->Scale(1./intLum); //dndpt_gen_nsd = gen_nsd_spect.hRInvX; //dndpt_gen_nsd_tg = gen_nsd_spect.RInvX; }else{ dndpt_rec_tight = spec_rec_tight.hRInvX; intLum = spec_rec_tight.integratedLum; dndpt_rec_tight->Scale(1./intLum); dndpt_rec_tight_res = spec_rec_tight_res.hRInvX; intLum = spec_rec_tight_res.integratedLum; dndpt_rec_tight_res->Scale(1./intLum); dndpt_rec_tight_resR = spec_rec_tight_resR.hRInvX; intLum = spec_rec_tight_resR.integratedLum; dndpt_rec_tight_resR->Scale(1./intLum); float scale = 1.15223531582625199e-04/5.06700000000000000e+04; //dndpt_rec_tight_resR->Scale(scale); //dndpt_rec_tight_resR->Scale(1./8.5E1); //dndpt_rec_tight_resR->Scale(1./7.5E2); dndpt_rec_tight_resR->Scale(1./4E2); dndpt_rec_tight_MC = spec_rec_tight_MC.hInvX; intLum = spec_rec_tight_MC.integratedLum; dndpt_rec_tight_MC->Scale(1./intLum); dndpt_rec_tight_MC_p0 = spec_rec_tight_MC_p0.hRInvX; intLum = spec_rec_tight_MC_p0.integratedLum; dndpt_rec_tight_MC_p0->Scale(1./intLum); dndpt_rec_tight_MC_py8 = spec_rec_tight_MC_py8.hRInvX; intLum = spec_rec_tight_MC_py8.integratedLum; dndpt_rec_tight_MC_py8->Scale(1./intLum); //dndpt_rec_tight_MC_py8->Draw("hist"); dndpt_gen_nsd = gen_nsd_spect.hRInvX; dndpt_gen_nsd_tg = gen_nsd_spect.RInvX; dndpt_rec_tight_added = (TH1D*) dndpt_rec_tight_res->Clone("dndpt_rec_tight_added"); dndpt_rec_tight_added->Add(dndpt_rec_tight_resR); } dndpt_rec_tight_added->Fit(f2,"RN"); // Basic canvas and dummy histogram TCanvas *call = new TCanvas("call","call",510,670); call->cd(); //if(entire_range) call->SetLogx(); // ------------------------------- Pad settings TPad *pp1 = new TPad("p1","p1",0,0.34,1,1,0,0,0); pp1->SetBottomMargin(0.0); pp1->SetTopMargin(0.05*(1/0.72)); pp1->Draw(); pp1->cd(); pp1->SetNumber(1); call->cd(); TPad *pp1_1 = new TPad("p1_1","p1_1",0,0.0,1,0.34,0,0,0); pp1_1->SetTopMargin(0); pp1_1->SetBottomMargin(0.14*(1/0.34)); pp1_1->Draw(); pp1_1->cd(); pp1_1->SetNumber(2); // ----- pad 1 pp1->cd(); pp1->SetLogy(); if(log_scale && entire_range) pp1->SetLogx(); Char_t xTitle[100],yTitle[100]; if(!cross) sprintf(yTitle,"Ed^{3}N/d^{3}p [GeV^{-2}c^{3}]"); else sprintf(yTitle,"Ed^{3}#sigma/d^{3}p [mb GeV^{-2}c^{3}]"); sprintf(xTitle,"p_{T} [GeV/c]"); TH1D *dum = GetDummyHist(pt_max,ymin,ymax,xTitle,yTitle); dum->Draw(); dum->GetXaxis()->SetNdivisions(908); dum->GetYaxis()->SetNdivisions(407); dndpt_rec_tight_MC_py8->Draw("histsame"); TPad *call_pd = (TPad*)gPad; call_pd->cd(); gPad->SetLogy(); if(minpt){ dndpt_rec_tight->GetXaxis()->SetRange(3,dndpt_rec_tight->GetXaxis()->GetLast()); dndpt_rec_tight_res->GetXaxis()->SetRange(3,dndpt_rec_tight_res->GetXaxis()->GetLast()); dndpt_rec_tight_resR->GetXaxis()->SetRange(3,dndpt_rec_tight_resR->GetXaxis()->GetLast()); dndpt_rec_tight_MC->GetXaxis()->SetRange(3,dndpt_rec_tight_MC->GetXaxis()->GetLast()); dndpt_rec_tight_MC_p0->GetXaxis()->SetRange(3,dndpt_rec_tight_MC_p0->GetXaxis()->GetLast()); //dndpt_rec_tight_MC_p0->GetXaxis()->SetRange(3, //dndpt_rec_tight_MC_p0->GetXaxis()->FindBin(19)); //dndpt_rec_tight_MC_py8->GetXaxis()->SetRange(3, //dndpt_rec_tight_MC_py8->GetXaxis()->GetLast()); dndpt_rec_tight_added->GetXaxis()->SetRange(3,dndpt_rec_tight_added->GetXaxis()->GetLast()); dndpt_gen_nsd->GetXaxis()->SetRange(3,dndpt_gen_nsd->GetXaxis()->GetLast()); } //plotting f2->SetLineStyle(1); f2->SetLineWidth(1.5); //f2->Draw("same"); th1Style1(cms_7000GeV,13,30,1.0,13,1,1,1); //th1Style1(dndpt_gen_nsd,96,20,1,96,2,1,2); th1Style1(dndpt_gen_nsd_tg,96,20,1.0,96,1.5,1,2); //th1Style1(dndpt_rec_tight_MC_p0,2,20,1.0,2,1.5,2,3); //th1Style1(dndpt_rec_tight_MC_py8,4,20,1.0,4,1.5,2,3); //th1Style1(dndpt_rec_tight,6,25,1.0,6,1.5,1,1); //th1Style1(dndpt_rec_tight_res,2,24,1.0,2,1.5,1,1); //th1Style1(dndpt_rec_tight_resR,4,24,1.0,4,1.5,1,1); th1Style1(dndpt_rec_tight_added,1,20,1.0,1,1.5,1,1); TLegend *leg2=0; if(log_scale && entire_range) leg2 = new TLegend(0.21,0.09,0.58,0.47); else leg2 = new TLegend(0.47,0.47,0.84,0.85); leg2->SetMargin(0.3); leg2->SetBorderSize(0); leg2->SetFillColor(kWhite); leg2->SetFillStyle(0); //leg2->SetTextSize(0.039); leg2->SetTextSize(0.035); leg2->SetMargin(0.3); if(full_eta) leg2->SetHeader("pp #rightarrow h+X, 7 TeV DATA, |#eta|<2.4"); else leg2->SetHeader("pp #rightarrow h+X, 7 TeV DATA, |#eta|<1.0"); //leg2->AddEntry(dndpt_rec_tight,"MB full","pl"); //leg2->AddEntry(dndpt_rec_tight_res,"MB (E_{T}<60 GeV/c)","pl"); //leg2->AddEntry(dndpt_rec_tight_resR,"Jet15U (E_{T}>60 GeV/c)","pl"); leg2->AddEntry(dndpt_rec_tight_added,"MB + Jet15U ","pl"); leg2->AddEntry(cms_7000GeV,"CMS 7 TeV |#eta|<2.4","pl"); leg2->AddEntry(dndpt_gen_nsd_tg,"PYTHIA D6T","l"); leg2->AddEntry(dndpt_rec_tight_MC_p0,"PYTHIA P0","l"); leg2->AddEntry(dndpt_rec_tight_MC_py8,"PYTHIA 8","l"); leg2->AddEntry(f2,"power-law fit","l"); leg2->Draw(); TLatex * tex; tex = new TLatex(0.69,0.88,"CMS Preliminary"); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->SetNDC(); tex->Draw(); // ------ pad2 pp1_1->cd(); if(log_scale && entire_range) pp1_1->SetLogx(); sprintf(yTitle,"Ratio"); //TH1D *dum2 = GetDummyHist(-0.1,2.3,xTitle,yTitle); TH1D *dum2 = GetDummyHist(pt_max,ymin_r,ymax_r,xTitle,yTitle); dum2->GetYaxis()->SetLabelSize(0.07); dum2->GetYaxis()->SetTitleSize(0.10); dum2->GetYaxis()->SetTitleOffset(0.75); dum2->GetXaxis()->SetLabelSize(0.09); dum2->GetXaxis()->SetLabelOffset(0.05); dum2->GetXaxis()->SetTitleSize(0.11); dum2->GetXaxis()->SetTitleOffset(1.47); dum2->GetYaxis()->SetNdivisions(405); dum2->GetYaxis()-> SetDecimals(true); dum2->Draw(); TLine *line = new TLine(0,1,pt_max,1); line->SetLineStyle(2); line->SetLineWidth(2); line->Draw(); TH1D *dndpt_rec_tight_dum = (TH1D*) dndpt_rec_tight->Clone("dndpt_rec_tight_dum"); TH1D *dndpt_rec_tight_res_dum = (TH1D*) dndpt_rec_tight_res->Clone("dndpt_rec_tight_res_dum"); TH1D *dndpt_rec_tight_resR_dum = (TH1D*) dndpt_rec_tight_resR->Clone("dndpt_rec_tight_resR_dum"); TH1D *dndpt_rec_tight_MC_dum = (TH1D*) dndpt_rec_tight_MC->Clone("dndpt_rec_tight_MC_dum"); TH1D *dndpt_rec_tight_MC_p0_dum = (TH1D*) dndpt_rec_tight_MC_p0->Clone("dndpt_rec_tight_MC_p0_dum"); TH1D *dndpt_rec_tight_added_dum = (TH1D*) dndpt_rec_tight_added->Clone("dndpt_rec_tight_added_dum"); TH1D *dndpt_rec_tight_added_dum2 = (TH1D*) dndpt_rec_tight_added->Clone("dndpt_rec_tight_added_dum2"); TH1D *dndpt_gen_nsd_dum = (TH1D*) dndpt_gen_nsd->Clone("dndpt_gen_nsd_dum"); TH1D *dndpt1_dum_div_cms7000 = (TH1D*) ratio_hist_to_func(dndpt_rec_tight_added_dum,f2,0.4,200.0); TH1D *dndpt1_dum_div_cms7000_res = (TH1D*) ratio_hist_to_func(dndpt_rec_tight_res_dum,f2,0.4,6.0); TH1D *dndpt1_dum_div_cms7000_resR = (TH1D*) ratio_hist_to_func(dndpt_rec_tight_resR_dum,f2,0.4,6.0); TGraphErrors *cms7000_div_fit = (TGraphErrors*) ratio_func_to_func(cms_7000GeV,f2,0.4,6.0); /* TH1D *dndpt1_dum_div_cms7000 = (TH1D*) ratio_hist_to_func(dndpt_rec_tight_dum,f2,0.4,200.0); TH1D *dndpt1_dum_div_cms7000_res = (TH1D*) ratio_hist_to_func(dndpt_rec_tight_res_dum,f2,0.4,200.0); TH1D *dndpt1_dum_div_cms7000_resR = (TH1D*) ratio_hist_to_func(dndpt_rec_tight_resR_dum,f2,0.4,200.0); TGraphErrors *cms7000_div_fit = (TGraphErrors*) ratio_func_to_func(cms_7000GeV,f2,0.4,200.0); */ dndpt_gen_nsd_dum->Sumw2(); dndpt_rec_tight_dum->Sumw2(); dndpt_rec_tight_res_dum->Sumw2(); dndpt_rec_tight_resR_dum->Sumw2(); dndpt_rec_tight_MC_dum->Sumw2(); dndpt_rec_tight_MC_p0_dum->Sumw2(); dndpt_rec_tight_added_dum->Sumw2(); dndpt_rec_tight_added_dum2->Sumw2(); if(minpt){ dndpt_rec_tight_dum->GetXaxis()->SetRange(3,dndpt_rec_tight_dum->GetXaxis()->GetLast()); dndpt_rec_tight_added_dum2->GetXaxis()->SetRange(3,dndpt_rec_tight_added_dum2->GetXaxis()->GetLast()); dndpt_rec_tight_added_dum->GetXaxis()->SetRange(3,dndpt_rec_tight_added_dum->GetXaxis()->GetLast()); dndpt_rec_tight_MC_dum->GetXaxis()->SetRange(3,dndpt_rec_tight_MC_dum->GetXaxis()->GetLast()); dndpt_rec_tight_MC_p0_dum->GetXaxis()->SetRange(3,dndpt_rec_tight_MC_p0_dum->GetXaxis()->GetLast()); } dndpt_rec_tight_added_dum2->Divide(dndpt_gen_nsd_dum); //dndpt_rec_tight_dum->Divide(dndpt_rec_tight_MC_dum); //dndpt_rec_tight_added_dum->Divide(dndpt_rec_tight_dum); dndpt_rec_tight_added_dum->Divide(dndpt_rec_tight_MC_p0_dum); th1Style1(dndpt_rec_tight_added_dum,2,20,1.0,2,1.5,2,3); th1Style1(dndpt_rec_tight_added_dum2,96,20,1.0,96,1.5,2,3); th1Style1(dndpt1_dum_div_cms7000,1,20,1.0,1,1.5,1,1); //th1Style1(dndpt1_dum_div_cms7000_res,2,24,1.0,2,1.5,1,1); //th1Style1(dndpt1_dum_div_cms7000_resR,6,25,1.0,6,1.5,1,1); //th1Style1(cms7000_div_fit,13,30,1.0,13,1.5,1,1); //th1Style1(dndpt_rec_tight_added_dum,1,20,1.0,1,1.5,1,1); // Print the values!! //PrintXsection(dndpt_rec_tight,117.); //PrintXsection(dndpt_rec_tight_added,1.); if(print){ if(entire_range){ if(log_scale){ if(full_eta) printCanvases(call,"spectra_DATA_JMT_TEST_fullEta_logx_v4",2,1); else printCanvases(call,"spectra_DATA_JMT_TEST_logx_v4",2,1); }else{ if(full_eta) printCanvases(call,"spectra_DATA_JMT_TEST_fullEta_v4",2,1); else printCanvases(call,"spectra_DATA_JMT_TEST_v4",2,1); } }else{ if(full_eta) printCanvases(call,"spectra_DATA_JMT_TEST_narrow_fullEta_v4",1,1); else printCanvases(call,"spectra_DATA_JMT_TEST_narrow_v4",1,1); } } }
void plotr0vstheta(){ TFile *f; int isSum=0; const int ntotbin=5; const int trkpointmin[ntotbin] = {120,150,185,220,260}; const int trkpointmax[ntotbin] = {150,185,220,260,300}; int xbin=0; c1 = new TCanvas("c1"," ",1200,700); makeMultiPanelCanvas(c1,3,2,0,0,0.25,0.2,0.03); gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetErrorX(0); TH1D *hFrame = new TH1D("","",100,0,2); hFrame->SetTitle(""); hFrame->GetXaxis()->SetTitle("#theta"); hFrame->GetYaxis()->SetTitle("r_{0}"); hFrame->GetYaxis()->SetTitleOffset(1.1); hFrame->GetXaxis()->SetTitleSize(0.04); hFrame->GetYaxis()->SetTitleSize(0.04); hFrame->GetXaxis()->SetRangeUser(0,1.5); hFrame->SetMinimum(0.04); hFrame->SetMaximum(0.25); for(int trkbin=0;trkbin<ntotbin; trkbin++){ if(isSum==0){ f = TFile::Open(Form("M%d%d/mergedV_Prod.root",trkpointmax[trkbin],trkpointmin[trkbin])); } else{ f = TFile::Open(Form("M%d%d/mergedV_Sum.root",trkpointmax[trkbin],trkpointmin[trkbin])); } TVectorD* vecr0 = (TVectorD*)f->Get(Form("D_%d/D_0/r0",xbin)); double *r0 = vecr0->GetMatrixArray(); double r0mean = getmean(r0,ntheta); double theta[ntheta]; for(int itheta=0;itheta<ntheta;itheta++){ theta[itheta]=itheta*TMath::Pi()/ntheta/nn; } int maxper10 = findmaxper(r0,ntheta,r0mean); double maxper = (double)(maxper10+1)/10; c1->cd(trkbin+1); hFrame->Draw(); TGraph *gr0theta = new TGraph(ntheta,theta,r0); gr0theta->SetMarkerStyle(20); gr0theta->SetMarkerSize(1.3); gr0theta->SetMarkerColor(1); gr0theta->SetLineColor(1); gr0theta->Draw("Psame"); TLine *lup = new TLine(gr0theta->GetXaxis()->GetXmin(),r0mean*(1+maxper), gr0theta->GetXaxis()->GetXmax(),r0mean*(1+maxper)); TLine *ldown = new TLine(gr0theta->GetXaxis()->GetXmin(),r0mean*(1-maxper), gr0theta->GetXaxis()->GetXmax(),r0mean*(1-maxper)); TLine *l = new TLine(hFrame->GetXaxis()->GetXmin(),r0mean, hFrame->GetXaxis()->GetXmax(),r0mean); l->SetLineStyle(2); lup->SetLineStyle(2); ldown->SetLineStyle(2); l->SetLineWidth(1.2); lup->SetLineWidth(1.2); ldown->SetLineWidth(1.2); TLatex *tl = new TLatex(); // tl->SetNDC(); tl->SetTextFont(42); tl->SetTextSize(0.04); // tl->SetBorderStyle(0); tl->DrawLatex(0,r0mean*(1+maxper),Form("mean up %.f%%",maxper*100)); tl->DrawLatex(0,r0mean*(1-maxper),Form("mean down %.f%%",maxper*100)); tl->SetNDC(); tl->DrawLatex(0.7,0.85,Form("Multiplicity %d to %d",trkpointmin[trkbin],trkpointmax[trkbin])); l->Draw("same"); lup->Draw("same"); ldown->Draw("same"); } c1->cd(ntotbin+1); TLatex *tlx0 = new TLatex(0.12,0.3,Form("PF candidate")); TLatex *tlx1 = new TLatex(0.12,0.25,Form("%.1f<p_{T}<%.1f (GeV/c)",0.3,6.0)); tlx0->SetNDC(); tlx1->SetNDC(); tlx0->SetTextSize(0.045); tlx1->SetTextSize(0.045); hFrame->Draw(); tlx0->Draw("same"); tlx1->Draw("same"); if(isSum==0)c1->SaveAs("hr0theta_Prod.png"); else c1->SaveAs("hr0theta_Sum.png"); }
int Plotter_ELECTRONS(){ // gROOT->ProcessLine(".x setTDRStyle.C"); TFile* f; double ErecEgenMin = 0.92; double ErecEgenMax = 1.08; bool doEB=false; bool doEE=true; if (doEB) f= new TFile("histos_compareSCcorrections_ELECTRON_EB.root","read"); if (doEE) f= new TFile("histos_compareSCcorrections_ELECTRON_EE.root","read"); string legendeEB = "Electron EB"; string legendeEE = "Electron EE"; string slegende, sceta, picturesuffix; if (doEB) { slegende = legendeEB; sceta = "C(#eta)"; picturesuffix = "Electron_EB"; } if (doEE) { slegende = legendeEE; sceta = "Raw"; picturesuffix = "Electron_EE"; } string extension = "pdf";//pdf //Pt TCanvas* CanvasPt = new TCanvas("CanvasPt","CanvasPt"); ErecEgenMean_vsPtCeta->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsPtCeta->SetXTitle("E_{T,raw} (GeV)"); ErecEgenMean_vsPtCeta->GetYaxis()->SetTitleOffset(1.5); ErecEgenMean_vsPtCeta->SetAxisRange(0,200,"X"); if (doEB) ErecEgenMean_vsPtCeta->SetAxisRange(0.96,1.05,"Y"); if (doEE) ErecEgenMean_vsPtCeta->SetAxisRange(0.95,1.06,"Y"); ErecEgenMean_vsPtCeta->SetMarkerColor(kBlack); ErecEgenMean_vsPtCeta->SetMarkerSize(1); ErecEgenMean_vsPtCeta->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPtCeta->Draw("P"); // //ErecEgenMean_vsPtElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsPtElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsPtElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsPtElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPtElectronNewETH->Draw("Psame"); ErecEgenMean_vsPtElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsPtElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsPtElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPtElectronNewETHEnergyScheme->Draw("Psame"); TLine* line = new TLine(5,1,200,1); line->SetLineWidth(2); line->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsPtCeta->GetName(), sceta.c_str(), "p"); //legende->AddEntry(ErecEgenMean_vsPtElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPtElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPtElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasPt->Update(); CanvasPt->Draw(); string pic = "ErecEgenMean_vsPt_" + picturesuffix + "." + extension; CanvasPt->Print(pic.c_str()); //CanvasPt->Print("ErecEgenMean_vsPt.gif"); //return; //Eta TCanvas* CanvasEta = new TCanvas("CanvasEta","CanvasEta"); ErecEgenMean_vsEtaCeta->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsEtaCeta->SetXTitle("#eta"); ErecEgenMean_vsEtaCeta->GetYaxis()->SetTitleOffset(1.5); ErecEgenMean_vsEtaCeta->SetAxisRange(0.95,1.05,"Y"); ErecEgenMean_vsEtaCeta->SetMarkerColor(kBlack); ErecEgenMean_vsEtaCeta->SetMarkerSize(1); ErecEgenMean_vsEtaCeta->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEtaCeta->Draw("P"); // // //ErecEgenMean_vsEtaElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsEtaElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsEtaElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsEtaElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEtaElectronNewETH->Draw("Psame"); ErecEgenMean_vsEtaElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsEtaElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsEtaElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEtaElectronNewETHEnergyScheme->Draw("Psame"); TLine* line2; if (doEB) line2 = new TLine(-1.44,1,1.44,1); if (doEE) line2 = new TLine(-2.5,1,2.5,1); line2->SetLineWidth(2); line2->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsEtaCeta->GetName(), sceta.c_str(), "p"); //legende->AddEntry(ErecEgenMean_vsEtaElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEtaElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEtaElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasEta->Update(); CanvasEta->Draw(); string pic = "ErecEgenMean_vsEta_" + picturesuffix + "." + extension; CanvasEta->Print(pic.c_str()); //CanvasEta->Print("ErecEgenMean_vsEta.gif"); //return; //Phi TCanvas* CanvasPhi = new TCanvas("CanvasPhi","CanvasPhi"); ErecEgenMean_vsPhiCeta->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsPhiCeta->SetXTitle("#phi"); ErecEgenMean_vsPhiCeta->GetYaxis()->SetTitleOffset(1.5); ErecEgenMean_vsPhiCeta->SetAxisRange(0.95,1.05,"Y"); ErecEgenMean_vsPhiCeta->SetMarkerColor(kBlack); ErecEgenMean_vsPhiCeta->SetMarkerSize(1); ErecEgenMean_vsPhiCeta->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPhiCeta->Draw("P"); // // //ErecEgenMean_vsPhiElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsPhiElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsPhiElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsPhiElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPhiElectronNewETH->Draw("Psame"); ErecEgenMean_vsPhiElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsPhiElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsPhiElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPhiElectronNewETHEnergyScheme->Draw("Psame"); TLine* line3 = new TLine(-3.1415,1,3.1415,1); line3->SetLineWidth(2); line3->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsPhiCeta->GetName(), sceta.c_str(), "p"); //legende->AddEntry(ErecEgenMean_vsPhiElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPhiElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPhiElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasPhi->Update(); CanvasPhi->Draw(); string pic = "ErecEgenMean_vsPhi_" + picturesuffix + "." + extension; CanvasPhi->Print(pic.c_str()); //CanvasPhi->Print("ErecEgenMean_vsPhi.gif"); //return; //Brem TCanvas* CanvasBrem = new TCanvas("CanvasBrem","CanvasBrem"); ErecEgenMean_vsBremCeta->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsBremCeta->SetXTitle("#sigma_{#phi}/#sigma_{#eta}"); ErecEgenMean_vsBremCeta->GetYaxis()->SetTitleOffset(1.5); ErecEgenMean_vsBremCeta->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsBremCeta->SetMarkerColor(kBlack); ErecEgenMean_vsBremCeta->SetMarkerSize(1); ErecEgenMean_vsBremCeta->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsBremCeta->Draw("P"); // // //ErecEgenMean_vsBremElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsBremElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsBremElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsBremElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsBremElectronNewETH->Draw("Psame"); ErecEgenMean_vsBremElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsBremElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsBremElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsBremElectronNewETHEnergyScheme->Draw("Psame"); TLine* line4 = new TLine(0.88,1,5,1); line4->SetLineWidth(2); line4->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsBremCeta->GetName(), sceta.c_str(), "p"); //legende->AddEntry(ErecEgenMean_vsBremElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsBremElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsBremElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasBrem->Update(); CanvasBrem->Draw(); string pic = "ErecEgenMean_vsBrem_" + picturesuffix + "." + extension; CanvasBrem->Print(pic.c_str()); //CanvasBrem->Print("ErecEgenMean_vsBrem.gif"); //R9 TCanvas* CanvasR9 = new TCanvas("CanvasR9","CanvasR9"); ErecEgenMean_vsR9Ceta->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsR9Ceta->SetXTitle("R9"); ErecEgenMean_vsR9Ceta->GetYaxis()->SetTitleOffset(1.5); if (doEB) ErecEgenMean_vsR9Ceta->SetAxisRange(0.92,1.08,"Y"); if (doEE)ErecEgenMean_vsR9Ceta->SetAxisRange(0.8,1.2,"Y"); ErecEgenMean_vsR9Ceta->SetMarkerColor(kBlack); ErecEgenMean_vsR9Ceta->SetMarkerSize(1); ErecEgenMean_vsR9Ceta->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsR9Ceta->Draw("P"); // // //ErecEgenMean_vsR9ElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsR9ElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsR9ElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsR9ElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsR9ElectronNewETH->Draw("Psame"); ErecEgenMean_vsR9ElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsR9ElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsR9ElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsR9ElectronNewETHEnergyScheme->Draw("Psame"); TLine* line5 = new TLine(0.,1,0.94,1); line5->SetLineWidth(2); line5->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsR9Ceta->GetName(), sceta.c_str(), "p"); //legende->AddEntry(ErecEgenMean_vsR9ElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsR9ElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsR9ElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasR9->Update(); CanvasR9->Draw(); //CanvasR9->Print("ErecEgenMean_vsR9.gif"); string pic = "ErecEgenMean_vsR9_" + picturesuffix + "." + extension; CanvasR9->Print(pic.c_str()); //return; //Energy TCanvas* CanvasEnergy = new TCanvas("CanvasEnergy","CanvasEnergy"); ErecEgenMean_vsEnergyCeta->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsEnergyCeta->SetXTitle("Energy (GeV)"); ErecEgenMean_vsEnergyCeta->GetYaxis()->SetTitleOffset(1.5); if (doEB) { ErecEgenMean_vsEnergyCeta->SetAxisRange(0.98,1.06,"Y"); ErecEgenMean_vsEnergyCeta->SetAxisRange(0,450,"X"); } if (doEE) { ErecEgenMean_vsEnergyCeta->SetAxisRange(0.9,1.1,"Y"); ErecEgenMean_vsEnergyCeta->SetAxisRange(0,1000,"X"); } ErecEgenMean_vsEnergyCeta->SetMarkerColor(kBlack); ErecEgenMean_vsEnergyCeta->SetMarkerSize(1); ErecEgenMean_vsEnergyCeta->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEnergyCeta->Draw("P"); // // //ErecEgenMean_vsEnergyElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsEnergyElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsEnergyElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsEnergyElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEnergyElectronNewETH->Draw("Psame"); ErecEgenMean_vsEnergyElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsEnergyElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsEnergyElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEnergyElectronNewETHEnergyScheme->Draw("Psame"); TLine* line; if (doEB) line = new TLine(0,1,450,1); if (doEE) line = new TLine(0,1,1000,1); line->SetLineWidth(2); line->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsEnergyCeta->GetName(), sceta.c_str(), "p"); //legende->AddEntry(ErecEgenMean_vsEnergyElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEnergyElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEnergyElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasEnergy->Update(); CanvasEnergy->Draw(); //CanvasEnergy->Print("ErecEgenMean_vsEnergy.gif"); string pic = "ErecEgenMean_vsEnergy_" + picturesuffix + "." + extension; CanvasEnergy->Print(pic.c_str()); return; //Pt TCanvas* CanvasPt_detail = new TCanvas("CanvasPt_detail","CanvasPt_detail"); ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetXTitle("E_{T,raw} (GeV)"); ErecEgenMean_vsPtElectronNewETHbremetaOnly->GetYaxis()->SetTitleOffset(1.5); if (doEB) ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetAxisRange(0.96,1.05,"Y"); if (doEE) ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetAxisRange(0.95,1.06,"Y"); ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPtElectronNewETHbremetaOnly->Draw("P"); //ErecEgenMean_vsPtElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsPtElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsPtElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsPtElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPtElectronNewETH->Draw("Psame"); ErecEgenMean_vsPtElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsPtElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsPtElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPtElectronNewETHEnergyScheme->Draw("Psame"); TLine* line = new TLine(5,1,200,1); line->SetLineWidth(2); line->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsPtElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); //legende->AddEntry(ErecEgenMean_vsPtElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPtElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPtElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasPt_detail->Update(); CanvasPt_detail->Draw(); string pic = "ErecEgenMean_vsPt_" + picturesuffix + "_detail.gif"; CanvasPt_detail->Print(pic.c_str()); //CanvasPt->Print("ErecEgenMean_vsPt.gif"); //return; //Eta TCanvas* CanvasEta_detail = new TCanvas("CanvasEta_detail","CanvasEta_detail"); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->SetXTitle("#eta"); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->GetYaxis()->SetTitleOffset(1.5); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->SetAxisRange(0.95,1.05,"Y"); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->Draw("P"); //ErecEgenMean_vsEtaElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsEtaElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsEtaElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsEtaElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEtaElectronNewETH->Draw("Psame"); ErecEgenMean_vsEtaElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsEtaElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsEtaElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEtaElectronNewETHEnergyScheme->Draw("Psame"); TLine* line2; if (doEB) line2 = new TLine(-1.44,1,1.44,1); if (doEE) line2 = new TLine(-2.5,1,2.5,1); line2->SetLineWidth(2); line2->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsEtaElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); //legende->AddEntry(ErecEgenMean_vsEtaElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEtaElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEtaElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasEta_detail->Update(); CanvasEta_detail->Draw(); string pic = "ErecEgenMean_vsEta_" + picturesuffix + "_detail.gif"; CanvasEta_detail->Print(pic.c_str()); //CanvasEta->Print("ErecEgenMean_vsEta.gif"); //return; //Phi TCanvas* CanvasPhi_detail = new TCanvas("CanvasPhi_detail","CanvasPhi_detail"); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->SetXTitle("#phi"); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->GetYaxis()->SetTitleOffset(1.5); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->SetAxisRange(0.95,1.05,"Y"); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->Draw("P"); //ErecEgenMean_vsPhiElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsPhiElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsPhiElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsPhiElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPhiElectronNewETH->Draw("Psame"); ErecEgenMean_vsPhiElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsPhiElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsPhiElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPhiElectronNewETHEnergyScheme->Draw("Psame"); TLine* line3 = new TLine(-3.1415,1,3.1415,1); line3->SetLineWidth(2); line3->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsPhiElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); //legende->AddEntry(ErecEgenMean_vsPhiElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPhiElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPhiElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasPhi_detail->Update(); CanvasPhi_detail->Draw(); string pic = "ErecEgenMean_vsPhi_" + picturesuffix + "_detail.gif"; CanvasPhi_detail->Print(pic.c_str()); //CanvasPhi->Print("ErecEgenMean_vsPhi.gif"); //Brem TCanvas* CanvasBrem_detail = new TCanvas("CanvasBrem_detail","CanvasBrem_detail"); ErecEgenMean_vsBremElectronNewETHbremetaOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsBremElectronNewETHbremetaOnly->SetXTitle("#sigma_{#phi}/#sigma_{#eta}"); ErecEgenMean_vsBremElectronNewETHbremetaOnly->GetYaxis()->SetTitleOffset(1.5); ErecEgenMean_vsBremElectronNewETHbremetaOnly->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsBremElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsBremElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsBremElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsBremElectronNewETHbremetaOnly->Draw("P"); //ErecEgenMean_vsBremElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsBremElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsBremElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsBremElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsBremElectronNewETH->Draw("Psame"); ErecEgenMean_vsBremElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsBremElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsBremElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsBremElectronNewETHEnergyScheme->Draw("Psame"); TLine* line4 = new TLine(0.88,1,5,1); line4->SetLineWidth(2); line4->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsBremElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); //legende->AddEntry(ErecEgenMean_vsBremElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsBremElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsBremElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasBrem_detail->Update(); CanvasBrem_detail->Draw(); string pic = "ErecEgenMean_vsBrem_" + picturesuffix + "_detail.gif"; CanvasBrem_detail->Print(pic.c_str()); //CanvasBrem->Print("ErecEgenMean_vsBrem.gif"); //R9 TCanvas* CanvasR9_detail = new TCanvas("CanvasR9_detail","CanvasR9_detail"); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetXTitle("R9"); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->GetYaxis()->SetTitleOffset(1.5); if (doEB) ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetAxisRange(0.92,1.08,"Y"); if (doEE)ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetAxisRange(0.8,1.2,"Y"); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->Draw("P"); //ErecEgenMean_vsR9ElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsR9ElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsR9ElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsR9ElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsR9ElectronNewETH->Draw("Psame"); ErecEgenMean_vsR9ElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsR9ElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsR9ElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsR9ElectronNewETHEnergyScheme->Draw("Psame"); TLine* line5 = new TLine(0.,1,0.94,1); line5->SetLineWidth(2); line5->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsR9ElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); //legende->AddEntry(ErecEgenMean_vsR9ElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsR9ElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsR9ElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasR9_detail->Update(); CanvasR9_detail->Draw(); //CanvasR9->Print("ErecEgenMean_vsR9.gif"); string pic = "ErecEgenMean_vsR9_" + picturesuffix + "_detail.gif"; CanvasR9_detail->Print(pic.c_str()); //return; //Energy TCanvas* CanvasEnergy_detail = new TCanvas("CanvasEnergy_detail","CanvasEnergy_detail"); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetXTitle("Energy (GeV)"); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->GetYaxis()->SetTitleOffset(1.5); if (doEB) ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetAxisRange(0.98,1.06,"Y"); if (doEE) ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetAxisRange(0.9,1.1,"Y"); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->Draw("P"); //ErecEgenMean_vsEnergyElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsEnergyElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsEnergyElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsEnergyElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEnergyElectronNewETH->Draw("Psame"); ErecEgenMean_vsEnergyElectronNewETHEnergyScheme->SetMarkerColor(kBlue); ErecEgenMean_vsEnergyElectronNewETHEnergyScheme->SetMarkerSize(1); ErecEgenMean_vsEnergyElectronNewETHEnergyScheme->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEnergyElectronNewETHEnergyScheme->Draw("Psame"); TLine* line = new TLine(0,1,500,1); line->SetLineWidth(2); line->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); //legende->AddEntry(ErecEgenMean_vsEnergyElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEnergyElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEnergyElectronNewETHEnergyScheme->GetName(), "f(Brem,#eta) #times F(Energy) Electron", "p"); legende->Draw(); CanvasEnergy_detail->Update(); CanvasEnergy_detail->Draw(); //CanvasEnergy->Print("ErecEgenMean_vsEnergy.gif"); string pic = "ErecEgenMean_vsEnergy_" + picturesuffix + "_detail.gif"; CanvasEnergy_detail->Print(pic.c_str()); return; /* //SIGMA EFF double SigmaMin = 0; double SigmaMax = 0.1; //Pt TCanvas* CanvasSigmaPt = new TCanvas("CanvasSigmaPt","CanvasSigmaPt"); ErecEgenSigmaEff_vsPtCeta->SetYTitle("#sigma_{eff} E_{rec}/E_{gen}"); ErecEgenSigmaEff_vsPtCeta->SetXTitle("E_{T,raw} (GeV)"); ErecEgenSigmaEff_vsPtCeta->GetYaxis()->SetTitleOffset(1.5); ErecEgenSigmaEff_vsPtCeta->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsPtCeta->SetMarkerColor(kBlack); ErecEgenSigmaEff_vsPtCeta->SetMarkerSize(1); ErecEgenSigmaEff_vsPtCeta->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsPtCeta->Draw("P"); //ErecEgenSigmaEff_vsPtElectronOldAF->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsPtElectronOldAF->SetMarkerColor(kBlue); ErecEgenSigmaEff_vsPtElectronOldAF->SetMarkerSize(1); ErecEgenSigmaEff_vsPtElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsPtElectronOldAF->Draw("Psame"); //ErecEgenSigmaEff_vsPtElectronNewETH->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsPtElectronNewETH->SetMarkerColor(8); ErecEgenSigmaEff_vsPtElectronNewETH->SetMarkerSize(1); ErecEgenSigmaEff_vsPtElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsPtElectronNewETH->Draw("Psame"); TLine* line = new TLine(10,1,250,1); line->SetLineWidth(2); line->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, "Correction scheme, EB R9<0.94"); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenSigmaEff_vsPtCeta->GetName(), "C(#eta)", "p"); legende->AddEntry(ErecEgenSigmaEff_vsPtElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenSigmaEff_vsPtElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasSigmaPt->Update(); CanvasSigmaPt->Draw(); CanvasSigmaPt->Print("ErecEgenSigma_vsPt.gif"); //Eta TCanvas* CanvasSigmaEta = new TCanvas("CanvasSigmaEta","CanvasSigmaEta"); ErecEgenSigmaEff_vsEtaCeta->SetYTitle("#sigma_{eff} E_{rec}/E_{gen}"); ErecEgenSigmaEff_vsEtaCeta->SetXTitle("#eta"); ErecEgenSigmaEff_vsEtaCeta->GetYaxis()->SetTitleOffset(1.5); ErecEgenSigmaEff_vsEtaCeta->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsEtaCeta->SetMarkerColor(kBlack); ErecEgenSigmaEff_vsEtaCeta->SetMarkerSize(1); ErecEgenSigmaEff_vsEtaCeta->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsEtaCeta->Draw("P"); //ErecEgenSigmaEff_vsEtaElectronOldAF->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsEtaElectronOldAF->SetMarkerColor(kBlue); ErecEgenSigmaEff_vsEtaElectronOldAF->SetMarkerSize(1); ErecEgenSigmaEff_vsEtaElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsEtaElectronOldAF->Draw("Psame"); //ErecEgenSigmaEff_vsEtaElectronNewETH->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsEtaElectronNewETH->SetMarkerColor(8); ErecEgenSigmaEff_vsEtaElectronNewETH->SetMarkerSize(1); ErecEgenSigmaEff_vsEtaElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsEtaElectronNewETH->Draw("Psame"); TLine* line2 = new TLine(-1.44,1,1.44,1); line2->SetLineWidth(2); line2->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, "Correction scheme, EB R9<0.94"); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenSigmaEff_vsEtaCeta->GetName(), "C(#eta)", "p"); legende->AddEntry(ErecEgenSigmaEff_vsEtaElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenSigmaEff_vsEtaElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasSigmaEta->Update(); CanvasSigmaEta->Draw(); CanvasSigmaEta->Print("ErecEgenSigma_vsEta.gif"); //Phi TCanvas* CanvasSigmaPhi = new TCanvas("CanvasSigmaPhi","CanvasSigmaPhi"); ErecEgenSigmaEff_vsPhiCeta->SetYTitle("#sigma_{eff} E_{rec}/E_{gen}"); ErecEgenSigmaEff_vsPhiCeta->SetXTitle("#phi"); ErecEgenSigmaEff_vsPhiCeta->GetYaxis()->SetTitleOffset(1.5); ErecEgenSigmaEff_vsPhiCeta->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsPhiCeta->SetMarkerColor(kBlack); ErecEgenSigmaEff_vsPhiCeta->SetMarkerSize(1); ErecEgenSigmaEff_vsPhiCeta->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsPhiCeta->Draw("P"); //ErecEgenSigmaEff_vsPhiElectronOldAF->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsPhiElectronOldAF->SetMarkerColor(kBlue); ErecEgenSigmaEff_vsPhiElectronOldAF->SetMarkerSize(1); ErecEgenSigmaEff_vsPhiElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsPhiElectronOldAF->Draw("Psame"); //ErecEgenSigmaEff_vsPhiElectronNewETH->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsPhiElectronNewETH->SetMarkerColor(8); ErecEgenSigmaEff_vsPhiElectronNewETH->SetMarkerSize(1); ErecEgenSigmaEff_vsPhiElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsPhiElectronNewETH->Draw("Psame"); TLine* line3 = new TLine(-3.1415,1,3.1415,1); line3->SetLineWidth(2); line3->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, "Correction scheme, EB R9<0.94"); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenSigmaEff_vsPhiCeta->GetName(), "C(#eta)", "p"); legende->AddEntry(ErecEgenSigmaEff_vsPhiElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenSigmaEff_vsPhiElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasSigmaPhi->Update(); CanvasSigmaPhi->Draw(); CanvasSigmaPhi->Print("ErecEgenSigma_vsPhi.gif"); //Brem TCanvas* CanvasSigmaBrem = new TCanvas("CanvasSigmaBrem","CanvasSigmaBrem"); ErecEgenSigmaEff_vsBremCeta->SetYTitle("#sigma_{eff} E_{rec}/E_{gen}"); ErecEgenSigmaEff_vsBremCeta->SetXTitle("#sigma_{#phi}/#sigma_{#eta}"); ErecEgenSigmaEff_vsBremCeta->GetYaxis()->SetTitleOffset(1.5); ErecEgenSigmaEff_vsBremCeta->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsBremCeta->SetMarkerColor(kBlack); ErecEgenSigmaEff_vsBremCeta->SetMarkerSize(1); ErecEgenSigmaEff_vsBremCeta->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsBremCeta->Draw("P"); //ErecEgenSigmaEff_vsBremElectronOldAF->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsBremElectronOldAF->SetMarkerColor(kBlue); ErecEgenSigmaEff_vsBremElectronOldAF->SetMarkerSize(1); ErecEgenSigmaEff_vsBremElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsBremElectronOldAF->Draw("Psame"); //ErecEgenSigmaEff_vsBremElectronNewETH->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsBremElectronNewETH->SetMarkerColor(8); ErecEgenSigmaEff_vsBremElectronNewETH->SetMarkerSize(1); ErecEgenSigmaEff_vsBremElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsBremElectronNewETH->Draw("Psame"); TLine* line4 = new TLine(0.88,1,5,1); line4->SetLineWidth(2); line4->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, "Correction scheme, EB R9<0.94"); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenSigmaEff_vsBremCeta->GetName(), "C(#eta)", "p"); legende->AddEntry(ErecEgenSigmaEff_vsBremElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenSigmaEff_vsBremElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasSigmaBrem->Update(); CanvasSigmaBrem->Draw(); CanvasSigmaBrem->Print("ErecEgenSigma_vsBrem.gif"); //R9 TCanvas* CanvasSigmaR9 = new TCanvas("CanvasSigmaR9","CanvasSigmaR9"); ErecEgenSigmaEff_vsR9Ceta->SetYTitle("#sigma_{eff} E_{rec}/E_{gen}"); ErecEgenSigmaEff_vsR9Ceta->SetXTitle("R9"); ErecEgenSigmaEff_vsR9Ceta->GetYaxis()->SetTitleOffset(1.5); ErecEgenSigmaEff_vsR9Ceta->SetAxisRange(0,0.15,"Y"); ErecEgenSigmaEff_vsR9Ceta->SetMarkerColor(kBlack); ErecEgenSigmaEff_vsR9Ceta->SetMarkerSize(1); ErecEgenSigmaEff_vsR9Ceta->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsR9Ceta->Draw("P"); //ErecEgenSigmaEff_vsR9ElectronOldAF->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsR9ElectronOldAF->SetMarkerColor(kBlue); ErecEgenSigmaEff_vsR9ElectronOldAF->SetMarkerSize(1); ErecEgenSigmaEff_vsR9ElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsR9ElectronOldAF->Draw("Psame"); //ErecEgenSigmaEff_vsR9ElectronNewETH->SetAxisRange(SigmaMin,SigmaMax,"Y"); ErecEgenSigmaEff_vsR9ElectronNewETH->SetMarkerColor(8); ErecEgenSigmaEff_vsR9ElectronNewETH->SetMarkerSize(1); ErecEgenSigmaEff_vsR9ElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenSigmaEff_vsR9ElectronNewETH->Draw("Psame"); TLine* line5 = new TLine(0.,1,0.94,1); line5->SetLineWidth(2); line5->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, "Correction scheme, EB R9<0.94"); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenSigmaEff_vsR9Ceta->GetName(), "C(#eta)", "p"); legende->AddEntry(ErecEgenSigmaEff_vsR9ElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenSigmaEff_vsR9ElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasSigmaR9->Update(); CanvasSigmaR9->Draw(); CanvasSigmaR9->Print("ErecEgenSigma_vsR9.gif"); */ return; //Comparaison detaillee brem, eta, et //Pt TCanvas* CanvasDetailPt = new TCanvas("CanvasDetailPt","CanvasDetailPt"); ErecEgenMean_vsPtElectronOldAFbremOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsPtElectronOldAFbremOnly->SetXTitle("E_{T,raw} (GeV)"); ErecEgenMean_vsPtElectronOldAFbremOnly->GetYaxis()->SetTitleOffset(1.5); ErecEgenMean_vsPtElectronOldAFbremOnly->SetAxisRange(0,200,"X"); if (doEB) ErecEgenMean_vsPtElectronOldAFbremOnly->SetAxisRange(0.99,1.02,"Y"); if (doEE) ErecEgenMean_vsPtElectronOldAFbremOnly->SetAxisRange(0.98,1.02,"Y"); ErecEgenMean_vsPtElectronOldAFbremOnly->SetMarkerColor(kBlack); ErecEgenMean_vsPtElectronOldAFbremOnly->SetMarkerSize(1); ErecEgenMean_vsPtElectronOldAFbremOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPtElectronOldAFbremOnly->Draw("P"); //ErecEgenMean_vsPtElectronOldAF->SetAxisRange(0.98,1.04,"Y"); ErecEgenMean_vsPtElectronOldAF->SetMarkerColor(kBlue); ErecEgenMean_vsPtElectronOldAF->SetMarkerSize(1); ErecEgenMean_vsPtElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPtElectronOldAF->Draw("Psame"); //ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsPtElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPtElectronNewETHbremetaOnly->Draw("Psame"); //ErecEgenMean_vsPtElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsPtElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsPtElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsPtElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPtElectronNewETH->Draw("Psame"); TLine* line = new TLine(10,1,200,1); line->SetLineWidth(2); line->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsPtElectronOldAFbremOnly->GetName(), "f(Brem) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPtElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPtElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPtElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasDetailPt->Update(); CanvasDetailPt->Draw(); CanvasDetailPt->Print("ErecEgenMean_vsPt_detail.gif"); //return; //Eta TCanvas* CanvasDetailEta = new TCanvas("CanvasDetailEta","CanvasDetailEta"); ErecEgenMean_vsEtaElectronOldAFbremOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsEtaElectronOldAFbremOnly->SetXTitle("#eta"); ErecEgenMean_vsEtaElectronOldAFbremOnly->GetYaxis()->SetTitleOffset(1.5); if (doEB) ErecEgenMean_vsEtaElectronOldAFbremOnly->SetAxisRange(0.97,1.03,"Y"); if (doEE) ErecEgenMean_vsEtaElectronOldAFbremOnly->SetAxisRange(0.97,1.03,"Y"); ErecEgenMean_vsEtaElectronOldAFbremOnly->SetMarkerColor(kBlack); ErecEgenMean_vsEtaElectronOldAFbremOnly->SetMarkerSize(1); ErecEgenMean_vsEtaElectronOldAFbremOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEtaElectronOldAFbremOnly->Draw("P"); //ErecEgenMean_vsEtaElectronOldAF->SetAxisRange(0.98,1.04,"Y"); ErecEgenMean_vsEtaElectronOldAF->SetMarkerColor(kBlue); ErecEgenMean_vsEtaElectronOldAF->SetMarkerSize(1); ErecEgenMean_vsEtaElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEtaElectronOldAF->Draw("Psame"); //ErecEgenMean_vsEtaElectronNewETHbremetaOnly->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEtaElectronNewETHbremetaOnly->Draw("Psame"); //ErecEgenMean_vsEtaElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsEtaElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsEtaElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsEtaElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEtaElectronNewETH->Draw("Psame"); TLine* line2; if (doEB) line2 = new TLine(-1.44,1,1.44,1); if (doEE) line2 = new TLine(-2.5,1,2.5,1); line2->SetLineWidth(2); line2->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsEtaElectronOldAFbremOnly->GetName(), "f(Brem) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEtaElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEtaElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEtaElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasDetailEta->Update(); CanvasDetailEta->Draw(); CanvasDetailEta->Print("ErecEgenMean_vsEta_detail.gif"); //return; //Phi TCanvas* CanvasDetailPhi = new TCanvas("CanvasDetailPhi","CanvasDetailPhi"); ErecEgenMean_vsPhiElectronOldAFbremOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsPhiElectronOldAFbremOnly->SetXTitle("#phi"); ErecEgenMean_vsPhiElectronOldAFbremOnly->GetYaxis()->SetTitleOffset(1.5); ErecEgenMean_vsPhiElectronOldAFbremOnly->SetAxisRange(0.98,1.03,"Y"); ErecEgenMean_vsPhiElectronOldAFbremOnly->SetMarkerColor(kBlack); ErecEgenMean_vsPhiElectronOldAFbremOnly->SetMarkerSize(1); ErecEgenMean_vsPhiElectronOldAFbremOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPhiElectronOldAFbremOnly->Draw("P"); //ErecEgenMean_vsPhiElectronOldAF->SetAxisRange(0.98,1.04,"Y"); ErecEgenMean_vsPhiElectronOldAF->SetMarkerColor(kBlue); ErecEgenMean_vsPhiElectronOldAF->SetMarkerSize(1); ErecEgenMean_vsPhiElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPhiElectronOldAF->Draw("Psame"); //ErecEgenMean_vsPhiElectronNewETHbremetaOnly->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPhiElectronNewETHbremetaOnly->Draw("Psame"); //ErecEgenMean_vsPhiElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsPhiElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsPhiElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsPhiElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsPhiElectronNewETH->Draw("Psame"); TLine* line3 = new TLine(-3.1415,1,3.1415,1); line3->SetLineWidth(2); line3->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsPhiElectronOldAFbremOnly->GetName(), "f(Brem) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPhiElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPhiElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); legende->AddEntry(ErecEgenMean_vsPhiElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasDetailPhi->Update(); CanvasDetailPhi->Draw(); CanvasDetailPhi->Print("ErecEgenMean_vsPhi_detail.gif"); //return; //Brem TCanvas* CanvasDetailBrem = new TCanvas("CanvasDetailBrem","CanvasDetailBrem"); ErecEgenMean_vsBremElectronOldAFbremOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsBremElectronOldAFbremOnly->SetXTitle("#sigma_{#phi}/#sigma_{#eta}"); ErecEgenMean_vsBremElectronOldAFbremOnly->GetYaxis()->SetTitleOffset(1.5); if (doEB) ErecEgenMean_vsBremElectronOldAFbremOnly->SetAxisRange(0.98,1.03,"Y"); if (doEE) ErecEgenMean_vsBremElectronOldAFbremOnly->SetAxisRange(0.95,1.08,"Y"); ErecEgenMean_vsBremElectronOldAFbremOnly->SetMarkerColor(kBlack); ErecEgenMean_vsBremElectronOldAFbremOnly->SetMarkerSize(1); ErecEgenMean_vsBremElectronOldAFbremOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsBremElectronOldAFbremOnly->Draw("P"); //ErecEgenMean_vsBremElectronOldAF->SetAxisRange(0.98,1.04,"Y"); ErecEgenMean_vsBremElectronOldAF->SetMarkerColor(kBlue); ErecEgenMean_vsBremElectronOldAF->SetMarkerSize(1); ErecEgenMean_vsBremElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsBremElectronOldAF->Draw("Psame"); //ErecEgenMean_vsBremElectronNewETHbremetaOnly->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsBremElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsBremElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsBremElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsBremElectronNewETHbremetaOnly->Draw("Psame"); //ErecEgenMean_vsBremElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsBremElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsBremElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsBremElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsBremElectronNewETH->Draw("Psame"); TLine* line4 = new TLine(0.88,1,5,1); line4->SetLineWidth(2); line4->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsBremElectronOldAFbremOnly->GetName(), "f(Brem) Electron", "p"); legende->AddEntry(ErecEgenMean_vsBremElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsBremElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); legende->AddEntry(ErecEgenMean_vsBremElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasDetailBrem->Update(); CanvasDetailBrem->Draw(); CanvasDetailBrem->Print("ErecEgenMean_vsBrem_detail.gif"); //return; //R9 TCanvas* CanvasDetailR9 = new TCanvas("CanvasDetailR9","CanvasDetailR9"); ErecEgenMean_vsR9ElectronOldAFbremOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsR9ElectronOldAFbremOnly->SetXTitle("R9"); ErecEgenMean_vsR9ElectronOldAFbremOnly->GetYaxis()->SetTitleOffset(1.5); if (doEB) ErecEgenMean_vsR9ElectronOldAFbremOnly->SetAxisRange(0.96,1.04,"Y"); if (doEE) ErecEgenMean_vsR9ElectronOldAFbremOnly->SetAxisRange(0.8,1.2,"Y"); ErecEgenMean_vsR9ElectronOldAFbremOnly->SetMarkerColor(kBlack); ErecEgenMean_vsR9ElectronOldAFbremOnly->SetMarkerSize(1); ErecEgenMean_vsR9ElectronOldAFbremOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsR9ElectronOldAFbremOnly->Draw("P"); //ErecEgenMean_vsR9ElectronOldAF->SetAxisRange(0.96,1.04,"Y"); ErecEgenMean_vsR9ElectronOldAF->SetMarkerColor(kBlue); ErecEgenMean_vsR9ElectronOldAF->SetMarkerSize(1); ErecEgenMean_vsR9ElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsR9ElectronOldAF->Draw("Psame"); //ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsR9ElectronNewETHbremetaOnly->Draw("Psame"); //ErecEgenMean_vsR9ElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsR9ElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsR9ElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsR9ElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsR9ElectronNewETH->Draw("Psame"); TLine* line5; if (doEB) line5 = new TLine(0,1,0.94,1); if (doEE) line5 = new TLine(0,1,0.95,1); line5->SetLineWidth(2); line5->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsR9ElectronOldAFbremOnly->GetName(), "f(Brem) Electron", "p"); legende->AddEntry(ErecEgenMean_vsR9ElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsR9ElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); legende->AddEntry(ErecEgenMean_vsR9ElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasDetailR9->Update(); CanvasDetailR9->Draw(); CanvasDetailR9->Print("ErecEgenMean_vsR9_detail.gif"); //Energy TCanvas* CanvasDetailEnergy = new TCanvas("CanvasDetailEnergy","CanvasDetailEnergy"); ErecEgenMean_vsEnergyElectronOldAFbremOnly->SetYTitle("E_{rec}/E_{gen}"); ErecEgenMean_vsEnergyElectronOldAFbremOnly->SetXTitle("Energy (GeV)"); ErecEgenMean_vsEnergyElectronOldAFbremOnly->GetYaxis()->SetTitleOffset(1.5); if (doEB) ErecEgenMean_vsEnergyElectronOldAFbremOnly->SetAxisRange(0.99,1.02,"Y"); if (doEE) ErecEgenMean_vsEnergyElectronOldAFbremOnly->SetAxisRange(0.9,1.1,"Y"); ErecEgenMean_vsEnergyElectronOldAFbremOnly->SetMarkerColor(kBlack); ErecEgenMean_vsEnergyElectronOldAFbremOnly->SetMarkerSize(1); ErecEgenMean_vsEnergyElectronOldAFbremOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEnergyElectronOldAFbremOnly->Draw("P"); //ErecEgenMean_vsEnergyElectronOldAF->SetAxisRange(0.98,1.04,"Y"); ErecEgenMean_vsEnergyElectronOldAF->SetMarkerColor(kBlue); ErecEgenMean_vsEnergyElectronOldAF->SetMarkerSize(1); ErecEgenMean_vsEnergyElectronOldAF->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEnergyElectronOldAF->Draw("Psame"); //ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetMarkerColor(kRed); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetMarkerSize(1); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->Draw("Psame"); //ErecEgenMean_vsEnergyElectronNewETH->SetAxisRange(ErecEgenMin,ErecEgenMax,"Y"); ErecEgenMean_vsEnergyElectronNewETH->SetMarkerColor(8); ErecEgenMean_vsEnergyElectronNewETH->SetMarkerSize(1); ErecEgenMean_vsEnergyElectronNewETH->SetMarkerStyle(kFullDotLarge); ErecEgenMean_vsEnergyElectronNewETH->Draw("Psame"); TLine* line6 = new TLine(0,1,500,1); line6->SetLineWidth(2); line6->Draw("same"); legende = new TLegend(0.3, 0.7, 0.95, 0.95, slegende.c_str()); legende->SetFillColor(kWhite); legende->AddEntry(ErecEgenMean_vsEnergyElectronOldAFbremOnly->GetName(), "f(Brem) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEnergyElectronOldAF->GetName(), "f(Brem) #times F(#eta,E_{T}) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEnergyElectronNewETHbremetaOnly->GetName(), "f(Brem,#eta) Electron", "p"); legende->AddEntry(ErecEgenMean_vsEnergyElectronNewETH->GetName(), "f(Brem,#eta) #times F(E_{T}) Electron", "p"); legende->Draw(); CanvasDetailEnergy->Update(); CanvasDetailEnergy->Draw(); CanvasDetailEnergy->Print("ErecEgenMean_vsEnergy_detail.gif"); return 0; }
void PlotAll_DATA_PREAPP() { gROOT->LoadMacro("invar_yield_ana_v9.C"); char dir[100]; char dir_corr[100]; bool GEN = false; bool CORRECT = false; bool REBIN = true; bool MC = false; bool multcrct =false; bool seccrct = false; bool cross = false; bool loose = false; bool jet_based_correction = true; bool entire_range = true; bool zerobin = false; bool onetwothreebin = false; bool evteffcorr = false; bool full_eta =true; bool oneoverpt=true; bool minpt=true; double eta_max; float pt_max; float ymin, ymax; float ymin_r, ymax_r; if(entire_range) { if(MC) pt_max = 55, ymin = 3e-13, ymax = 9e1, ymin_r = 0.30, ymax_r = 1.65; else pt_max = 100, ymin = 3e-14, ymax = 9e1, ymin_r = 0.6, ymax_r = 1.65; } else { if(MC) pt_max = 10, ymin = 5e-7, ymax = 2e1, ymin_r = 0.7, ymax_r = 1.4; //else pt_max = 10, ymin = 5e-7, ymax = 5e1, ymin_r = 0.97, ymax_r = 1.03; else pt_max = 10, ymin = 5e-7, ymax = 5e1, ymin_r = 0.5, ymax_r = 1.5; } if(full_eta) eta_max = 2.4; else eta_max = 1.0; char file1[100], file2[100], file3[100], file4[100], file5[100], file6[100], file7[100]; sprintf(file1,"../root_files/MB-C10-A20RR-TRKANASKIM-MERGED.root"); //sprintf(file1,"../root_files/MB-C10-MERGED.root"); //sprintf(file1,"../root_files/MB-C10-A20PR_proc0531.root"); //sprintf(file2,"../root_files/TrkHistMC_june04_10Mv2.root"); //sprintf(file3,"../root_files/TrkHistMC_june04_10Mv2.root"); sprintf(file2,"../root_files/TrkHistMC_june04_QCD_10Mv6.root"); sprintf(file3,"../root_files/TrkHistMC_june04_QCD_10Mv6.root"); sprintf(file4,"../root_files/TrkHistMCv10_QCD_Pt15v3.root"); sprintf(file5,"../root_files/TrkHistMCv11_qcdPt30.root"); sprintf(file6,"../root_files/TrkHistMCv11_qcdPt80.root"); sprintf(file7,"../root_files/TrkHistMCv11_qcdPt170v2.root"); MC = false, GEN = false, CORRECT = true, multcrct = true, seccrct = true, evteffcorr = true, zerobin = true, onetwothreebin = true; sprintf(dir,"trackAna_STD"); sprintf(dir_corr,"trkEffAnalyzer"); invar_yield_ana_v9_data spec_rec_tight = invar_yield_ana_v9_graph(file1,file2,file3,file4,file5,file6,file7, dir,dir_corr,GEN,CORRECT,multcrct,seccrct,MC,jet_based_correction, evteffcorr,zerobin,onetwothreebin,cross,oneoverpt,0,eta_max); //sprintf(file1,"../root_files/TrkHistMC_june04_10Mv2.root"); //sprintf(file2,"../root_files/TrkHistMC_june04_10Mv2.root"); //sprintf(file3,"../root_files/TrkHistMC_june04_10Mv2.root"); sprintf(file1,"../root_files/TrkHistMC_june04_QCD_10Mv6.root"); sprintf(file2,"../root_files/TrkHistMC_june04_QCD_10Mv6.root"); sprintf(file3,"../root_files/TrkHistMC_june04_QCD_10Mv6.root"); sprintf(file4,"../root_files/TrkHistMCv10_QCD_Pt15v3.root"); sprintf(file5,"../root_files/TrkHistMCv11_qcdPt30.root"); sprintf(file6,"../root_files/TrkHistMCv11_qcdPt80.root"); sprintf(file7,"../root_files/TrkHistMCv11_qcdPt170v2.root"); // GEN MC MC = true, GEN = true, CORRECT = false, multcrct = false, seccrct = false, evteffcorr = false, zerobin = false, onetwothreebin = false; sprintf(dir,"preTrackAna"); sprintf(dir_corr,"trkEffAnalyzer"); invar_yield_ana_v9_data spec_rec_tight_MC = invar_yield_ana_v9_graph(file1,file2,file3,file4,file5,file6,file7, dir,dir_corr,GEN,CORRECT,multcrct,seccrct,MC,jet_based_correction, evteffcorr,zerobin,onetwothreebin,cross,oneoverpt,0,eta_max); //--------------------------- CMS measurement --------------------------- TGraphErrors* cms_7000GeV = (TGraphErrors*) CMS_7TEV(1); TF1 *f2 = new TF1("f2","[0]*(1+(sqrt(0.1396**2+x**2)-0.1396)/([1]*[2]))**(-[2])",0,6); f2->SetParameters(2*TMath::Pi(),0.13,7.7); cms_7000GeV->Fit(f2,"RN"); f2->SetLineColor(kRed); //--------------------------------------------------- PYTHIA truth GEN------------------------ gROOT->LoadMacro("invar_yield_ana_GEN_v9.C"); char file1_GEN[100], file2_GEN[100], file3_GEN[100], file4_GEN[100], file5_GEN[100], file6_GEN[100], file7_GEN[100]; char file8_GEN[100], file9_GEN[100], file10_GEN[100]; sprintf(file1_GEN,"../root_files/TrkHistMC_june04_qcdPt0To15v3cFix.root"); sprintf(file2_GEN,"../root_files/TrkHistMC_june04_qcdPt15to20v2.root"); sprintf(file3_GEN,"../root_files/TrkHistMC_june04_qcdPt20to30v2.root"); sprintf(file4_GEN,"../root_files/TrkHistMC_june04_qcdPt30to50v2.root"); sprintf(file5_GEN,"../root_files/TrkHistMC_june04_qcdPt50to80v2.root"); sprintf(file6_GEN,"../root_files/TrkHistMC_june04_qcdPt80to120v2.root"); sprintf(file7_GEN,"../root_files/TrkHistMC_june04_qcdPt120to170v2.root"); sprintf(file8_GEN,"../root_files/TrkHistMC_june04_qcdPt170to230v2.root"); sprintf(file9_GEN,"../root_files/TrkHistMC_june04_qcdPt230to300v2.root"); sprintf(file10_GEN,"../root_files/TrkHistMC_june04_qcdPt300to380v2.root"); invar_yield_ana_GEN_v9_data gen_nsd_spect = invar_yield_ana_GEN_v9_graph(file1_GEN,file2_GEN,file3_GEN,file4_GEN, file5_GEN,file6_GEN,file7_GEN,file8_GEN, file9_GEN,file10_GEN,true,117.,0,eta_max); //--------------------------------------------------- PYTHIA truth GEN------------------------ double intLum; if(REBIN) { TH1D *dndpt_rec_tight = spec_rec_tight.hRInvX; intLum = spec_rec_tight.integratedLum; dndpt_rec_tight->Scale(1./intLum); TH1D *dndpt_rec_tight_MC = spec_rec_tight_MC.hRInvX; intLum = spec_rec_tight_MC.integratedLum; dndpt_rec_tight_MC->Scale(1./intLum); TH1D *dndpt_gen_nsd = gen_nsd_spect.hRInvX; TGraphErrors *dndpt_gen_nsd_tg = gen_nsd_spect.RInvX; } else { } // Basic canvas and dummy histogram TCanvas *call = new TCanvas("call","call",510,670); call->cd(); //if(entire_range) call->SetLogx(); // ------------------------------- Pad settings pp1 = new TPad("p1","p1",0,0.34,1,1,0,0,0); pp1->SetBottomMargin(0.0); pp1->SetTopMargin(0.05*(1/0.72)); pp1->Draw(); pp1->cd(); pp1->SetNumber(1); call->cd(); pp1_1 = new TPad("p1_1","p1_1",0,0.0,1,0.34,0,0,0); pp1_1->SetTopMargin(0); pp1_1->SetBottomMargin(0.14*(1/0.34)); pp1_1->Draw(); pp1_1->cd(); pp1_1->SetNumber(2); // ----- pad 1 pp1->cd(); pp1->SetLogy(); if(entire_range) pp1->SetLogx(); Char_t xTitle[100],yTitle[100]; if(!cross) sprintf(yTitle,"Ed^{3}N/d^{3}p [GeV^{-2}c^{3}]"); else sprintf(yTitle,"Ed^{3}#sigma/d^{3}p [mb GeV^{-2}c^{3}]"); sprintf(xTitle,"p_{T} [GeV/c]"); TH1D *dum = GetDummyHist(pt_max,ymin,ymax,xTitle,yTitle); dum->Draw(); dum->GetXaxis()->SetNdivisions(908); dum->GetYaxis()->SetNdivisions(407); TPad *call_pd = (TPad*)gPad; call_pd->cd(); gPad->SetLogy(); if(minpt) { dndpt_rec_tight->GetXaxis()->SetRange(3,dndpt_rec_tight->GetXaxis()->GetLast()); dndpt_rec_tight_MC->GetXaxis()->SetRange(3,dndpt_rec_tight_MC->GetXaxis()->GetLast()); dndpt_gen_nsd->GetXaxis()->SetRange(3,dndpt_gen_nsd->GetXaxis()->GetLast()); } //plotting th1Style1(cms_7000GeV,13,30,1.0,13,1,1,1); //th1Style1(dndpt_gen_nsd,96,20,1,96,2,1,2); th1Style1(dndpt_gen_nsd_tg,96,20,1,96,2,1,2); //th1Style1(dndpt_rec_tight_MC,2,20,1.0,2,1.5,1,3); th1Style1(dndpt_rec_tight,1,20,1.0,1,1.5,1,1); if(entire_range) TLegend *leg2 = new TLegend(0.21,0.09,0.58,0.47); else TLegend *leg2 = new TLegend(0.37,0.47,0.74,0.85); leg2->SetMargin(0.3); leg2->SetBorderSize(0); leg2->SetFillColor(kWhite); leg2->SetFillStyle(0); leg2->SetTextSize(0.039); leg2->SetMargin(0.3); if(full_eta) leg2->SetHeader("pp #rightarrow h+X, 7 TeV DATA, |#eta|<2.4"); else leg2->SetHeader("pp #rightarrow h+X, 7 TeV DATA, |#eta|<1.0"); leg2->AddEntry(dndpt_rec_tight,"RECO (TRK+EVT corrected)","pl"); leg2->AddEntry(cms_7000GeV,"CMS 7 TeV |#eta|<2.4","pl"); leg2->AddEntry(dndpt_gen_nsd_tg,"PYTHIA D6T","l"); leg2->Draw(); TLatex * tex; tex = new TLatex(0.69,0.88,"CMS Preliminary"); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->SetNDC(); tex->Draw(); // ------ pad2 pp1_1->cd(); if(entire_range) pp1_1->SetLogx(); sprintf(yTitle,"Ratio"); //TH1D *dum2 = GetDummyHist(-0.1,2.3,xTitle,yTitle); TH1D *dum2 = GetDummyHist(pt_max,ymin_r,ymax_r,xTitle,yTitle); dum2->GetYaxis()->SetLabelSize(0.07); dum2->GetYaxis()->SetTitleSize(0.10); dum2->GetYaxis()->SetTitleOffset(0.75); dum2->GetXaxis()->SetLabelSize(0.09); dum2->GetXaxis()->SetLabelOffset(0.05); dum2->GetXaxis()->SetTitleSize(0.11); dum2->GetXaxis()->SetTitleOffset(1.47); dum2->GetYaxis()->SetNdivisions(405); dum2->GetYaxis()-> SetDecimals(true); dum2->Draw(); TLine *line = new TLine(0,1,pt_max,1); line->SetLineStyle(2); line->SetLineWidth(2); line->Draw(); TH1D *dndpt_rec_tight_dum = (TH1D*) dndpt_rec_tight->Clone("dndpt_rec_tight_dum"); TH1D *dndpt_rec_tight_dum2 = (TH1D*) dndpt_rec_tight->Clone("dndpt_rec_tight_dum2"); TH1D *dndpt_rec_tight_MC_dum = (TH1D*) dndpt_rec_tight_MC->Clone("dndpt_rec_tight_MC_dum"); TH1D *dndpt_gen_nsd_dum = (TH1D*) dndpt_gen_nsd->Clone("dndpt_gen_nsd_dum"); TH1D *dndpt1_dum_div_cms7000 = (TH1D*) ratio_hist_to_func(dndpt_rec_tight_dum, f2->GetParameter(0), f2->GetParameter(1), f2->GetParameter(2)); dndpt_gen_nsd_dum->Sumw2(); dndpt_rec_tight_dum->Sumw2(); dndpt_rec_tight_MC_dum->Sumw2(); dndpt_rec_tight_dum->Divide(dndpt_gen_nsd_dum); //dndpt_rec_tight_dum2->Divide(dndpt_rec_tight_MC_dum); if(minpt) { dndpt_rec_tight_dum->GetXaxis()->SetRange(3,dndpt_rec_tight_dum->GetXaxis()->GetLast()); //dndpt_rec_tight_dum2->GetXaxis()->SetRange(3,dndpt_rec_tight_dum2->GetXaxis()->GetLast()); } th1Style1(dndpt_rec_tight_dum,96,20,1,96,2,1,3); //th1Style1(dndpt_rec_tight_dum2,2,24,1.0,2,1.5,1,1); th1Style1(dndpt1_dum_div_cms7000,13,30,1.0,13,1.5,1,1); // Print the values!! //PrintXsection(dndpt_rec_tight,117.); PrintXsection(dndpt_rec_tight,1.); if(entire_range) { if(full_eta) printCanvases(call,"spectra_DATA_PREAPP_fullEta",2,1); else printCanvases(call,"spectra_DATA_PREAPP",2,1); } else { if(full_eta) printCanvases(call,"spectra_DATA_PREAPP_narrow_fullEta",1,1); else printCanvases(call,"spectra_DATA_PREAPP_narrow",1,1); } }
void drawEventZR(double vrlb, double vzlb, double vrl0, double vzl0, double pmu1, double etamu1, double pmu2, double etamu2, double ppr, double etapr, double ppi, double etapi, int colors = 0) { Color_t colMu1(1), colMu2(1), colPr(1), colPi(1), colL0(1), colLb(1); switch(colors) { case 0: colLb=1; colL0=2; colMu1=2; colMu2=2; colPr=3; colPi=4; break; case 1: colLb=11; colL0=50; colMu1=50; colMu2=50; colPr=8; colPi=9; break; } cout << etamu1 << " " << etamu2 << " " << etapr << " " << etapi << endl; const double thetamu1 = 2*TMath::ATan(TMath::Exp(-etamu1)); const double thetamu2 = 2*TMath::ATan(TMath::Exp(-etamu2)); const double thetapr = 2*TMath::ATan(TMath::Exp(-etapr)); const double thetapi = 2*TMath::ATan(TMath::Exp(-etapi)); //const double thetamu1 = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etamu1)))*sign(etamu1); //const double thetamu2 = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etamu2)))*sign(etamu2); //const double thetapr = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapr)))*sign(etapr); //const double thetapi = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapi)))*sign(etapi); // draw the vertices TMarker *m; const double xlb = vzlb; const double ylb = vrlb; m = new TMarker(xlb,ylb,7); m->SetMarkerColor(colLb); m->Draw(); const double xl0 = vzl0; const double yl0 = vrl0; m = new TMarker(xl0,yl0,7); m->SetMarkerColor(colL0); m->Draw(); // draw the l0 flight line TLine *l; l = new TLine(vzlb,vrlb,vzl0,vrl0); l->SetLineColor(colL0); l->SetLineStyle(2); l->Draw(); // draw the muons TArrow *a; const double xmu1 = xlb + scalemu * pmu1 * TMath::Cos(thetamu1); const double ymu1 = ylb + scalemu * pmu1 * TMath::Sin(thetamu1); a = new TArrow(xlb,ylb,xmu1,ymu1,.01,">"); a->SetLineColor(colMu1); a->Draw(); const double xmu2 = xlb + scalemu * pmu2 * TMath::Cos(thetamu2); const double ymu2 = ylb + scalemu * pmu2 * TMath::Sin(thetamu2); a = new TArrow(xlb,ylb,xmu2,ymu2,.01,">"); a->SetLineColor(colMu2); a->Draw(); // draw the p and pi const double xpr = xl0 + scalepr * ppr * TMath::Cos(thetapr); const double ypr = yl0 + scalepr * ppr * TMath::Sin(thetapr); a = new TArrow(xl0,yl0,xpr,ypr,.01,">"); a->SetLineColor(colPr); a->Draw(); const double xpi = xl0 + scalepi * ppi * TMath::Cos(thetapi); const double ypi = yl0 + scalepi * ppi * TMath::Sin(thetapi); a = new TArrow(xl0,yl0,xpi,ypi,.01,">"); a->SetLineColor(colPi); a->Draw(); }