void plotr0vstheta(){ TFile *f; int isSum=0; if(isSum==0){ f = TFile::Open("mergedV_Prod.root"); } else{ f = TFile::Open("mergedV_Sum.root"); } int xbin=0; // TVectorD* vecVmean = (TVectorD*)f->Get(Form("D_%d/Vmean",xbin)); TVectorD* vecV = (TVectorD*)f->Get(Form("D_%d/D_0/r01",xbin)); double *V = vecV->GetMatrixArray(); double Vmean = getmean(V,ntheta); double theta[ntheta]; for(int itheta=0;itheta<ntheta;itheta++){ theta[itheta]=itheta*TMath::Pi()/ntheta/nn; } int maxper10 = findmaxper(V,ntheta,Vmean); double maxper = (double)(maxper10+2)/10; TGraph *gV2theta = new TGraph(ntheta,theta,V); gV2theta->SetTitle(""); gV2theta->GetXaxis()->SetTitle("#theta"); gV2theta->GetYaxis()->SetTitle("r_{0}"); gV2theta->GetYaxis()->SetTitleOffset(1.1); gV2theta->GetXaxis()->SetTitleSize(0.04); gV2theta->GetYaxis()->SetTitleSize(0.04); gV2theta->SetMarkerStyle(20); gV2theta->SetMarkerSize(1.3); gV2theta->SetMarkerColor(1); gV2theta->SetLineColor(1); gV2theta->SetMinimum(Vmean*(1-maxper*1.5)); gV2theta->SetMaximum(Vmean*(1+maxper*1.5)); gV2theta->Draw("AP"); TLine *lup = new TLine(gV2theta->GetXaxis()->GetXmin(),Vmean*(1+maxper), gV2theta->GetXaxis()->GetXmax(),Vmean*(1+maxper)); TLine *ldown = new TLine(gV2theta->GetXaxis()->GetXmin(),Vmean*(1-maxper), gV2theta->GetXaxis()->GetXmax(),Vmean*(1-maxper)); TLine *l = new TLine(gV2theta->GetXaxis()->GetXmin(),Vmean, gV2theta->GetXaxis()->GetXmax(),Vmean); 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,Vmean*(1+maxper),Form("mean up %.f%%",maxper*100)); tl->DrawLatex(0,Vmean*(1-maxper),Form("mean down %.f%%",maxper*100)); tl->DrawLatex(1,0.2,Form("Multiplicity %d to %d",120,150)); l->Draw("same"); lup->Draw("same"); ldown->Draw("same"); if(isSum==0)c1->SaveAs("hr0theta_Prod.png"); else c1->SaveAs("hr0theta_Sum.png"); }
void DrawInsituCorr_vs_Pt(Str jetAlgo) { myJES = new JetCalibrationTool(jetAlgo,_jesFile); TH1F *h = new TH1F("","",100,15,2500); h->SetXTitle("Jet p_{T}"); h->SetYTitle("Residual correction for data only"); h->SetMaximum(1.1); h->SetMinimum(0.85); h->Draw(); TLine *l = new TLine(); l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4); l->DrawLine(16,1,2400,1); for (int i=0;i<6;++i) { double eta=4.0*i/5; Graph *g = GetInsituGraphVsPt(eta); FormatGraph(g,i); g->Draw("PL"); double x=0.52, y=0.3-0.05*i; if (i>2) { x=0.74; y=0.3-0.05*(i-3); } DrawLabel(Form("#eta = %.1f",eta),x,y,i); } l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(1); tex->SetNDC(); tex->SetTextAlign(12); //tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description()); tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo)); }
void DrawInsituCorr_vs_Eta(Str jetAlgo) { Nbins=sizeof(Ebins)/sizeof(double); myJES = new JetCalibrationTool(jetAlgo,_jesFile); TH1F *h = new TH1F("","",100,-4.8,4.8); h->SetXTitle("Jet #eta_{det}"); h->SetYTitle("Residual correction for data only"); h->SetMaximum(1.1); h->SetMinimum(0.85); h->Draw(); TLine *l = new TLine(); l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4); l->DrawLine(-4.65,1,4.65,1); for (int i=0;i<Nbins;++i) { Graph *g = GetInsituGraph(Ebins[i]); FormatGraph(g,i); g->Draw("PL"); double x=0.52, y=0.3-0.05*i; if (i>2) { x=0.74; y=0.3-0.05*(i-3); } DrawLabel(Form("p_{T} = %.0f GeV",Ebins[i]),x,y,i); } l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(1); tex->SetNDC(); tex->SetTextAlign(12); //tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description()); tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo)); }
void PlotMinEtFromSim(Bool_t isPhos = kFALSE){ gStyle->SetOptTitle(0); gStyle->SetOptStat(0); gStyle->SetOptFit(0); Float_t min = 0; float max = 1; TString filename, detname; if(isPhos){ min = 0.655; max = 0.785; detname = "PHOS"; filename = "rootFiles/LHC11a10a_bis/Et.ESD.simPbPb.PHOS.LHC11a10a_bis.Run139465.root"; } else{ min = 0.58; max = 0.725; filename = "rootFiles/LHC11a10a_bis/Et.ESD.simPbPb.EMCal.LHC11a10a_bis.Run139465.root"; detname = "EMCal"; } TFile *f = TFile::Open(filename, "READ"); TList *l = dynamic_cast<TList*>(f->Get("out1")); TH1F *fHistSimulatedGammaEnergyAboveThreshold = l->FindObject("fHistSimulatedGammaEnergyAboveThreshold"); TH1F *fHistSimulatedGammaEnergy = l->FindObject("fHistSimulatedGammaEnergy"); SetStyles(fHistSimulatedGammaEnergyAboveThreshold,20,TColor::kRed); fHistSimulatedGammaEnergyAboveThreshold->Divide(fHistSimulatedGammaEnergy); TCanvas *c1 = new TCanvas("c1","Simulation",600,400); c1->SetTopMargin(0.02); c1->SetRightMargin(0.03); c1->SetLeftMargin(0.11745); c1->SetBottomMargin(0.11745); c1->SetBorderSize(0); c1->SetFillColor(0); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetFrameFillColor(0); c1->SetFrameBorderMode(0); fHistSimulatedGammaEnergyAboveThreshold->SetMaximum(max +0.1); fHistSimulatedGammaEnergyAboveThreshold->SetMinimum(min-0.1); fHistSimulatedGammaEnergyAboveThreshold->GetXaxis()->SetTitle("Centrality bin"); fHistSimulatedGammaEnergyAboveThreshold->GetYaxis()->SetTitle("f_{minEt}"); fHistSimulatedGammaEnergyAboveThreshold->GetYaxis()->SetLabelSize(0.06); fHistSimulatedGammaEnergyAboveThreshold->GetXaxis()->SetLabelSize(0.06); fHistSimulatedGammaEnergyAboveThreshold->GetYaxis()->SetTitleSize(0.06); fHistSimulatedGammaEnergyAboveThreshold->GetXaxis()->SetTitleSize(0.06); fHistSimulatedGammaEnergyAboveThreshold->Draw(); TLine *lineMin = new TLine(-0.5,min,19.5,min); lineMin->Draw(); TLine *lineMax = new TLine(-0.5,max,19.5,max); lineMax->Draw(); lineMin->SetLineColor(TColor::kBlue); lineMax->SetLineColor(TColor::kBlue); lineMin->SetLineStyle(2); lineMax->SetLineStyle(2); TString outfile = "/tmp/MinEtFromSim"+detname+".png"; c1->SaveAs(outfile.Data()); }
void RangePlotter::AddAnalysisMarkers(int a_iPanelIndex, SignalAnalyzer::AnalysisMarkers& a_analysisMarkers) { m_pCanvas->cd(a_iPanelIndex + 1); // printf("pulse threshold: %f\n", a_analysisMarkers.GetPulseThreshold().Continuous()); TLine* pulseThresholdLine = new TLine(0, a_analysisMarkers.GetPulseThreshold().Continuous(), m_vpMultiGraph[a_iPanelIndex]->GetXaxis()->GetXmax(), a_analysisMarkers.GetPulseThreshold().Continuous()); pulseThresholdLine->SetLineStyle(2); pulseThresholdLine->SetBit(kCanDelete); // printf("edge threshold: %f\n", a_analysisMarkers.GetEdgeThreshold().Continuous()); TLine* edgeThresholdLine = new TLine(0, a_analysisMarkers.GetEdgeThreshold().Continuous(), m_vpMultiGraph[a_iPanelIndex]->GetXaxis()->GetXmax(), a_analysisMarkers.GetEdgeThreshold().Continuous()); edgeThresholdLine->SetLineStyle(2); edgeThresholdLine->SetBit(kCanDelete); /* int i = 0; for (auto& it: a_analysisMarkers.m_vChannelsEdgeAndMinimum) { int color = ((TGraph*) m_vpMultiGraph[a_iPanelIndex]->GetListOfGraphs()->At(i))->GetLineColor(); float fYMin = m_vpMultiGraph[a_iPanelIndex]->GetYaxis()->GetXmin(); float fYMax = m_vpMultiGraph[a_iPanelIndex]->GetYaxis()->GetXmax(); if (std::get<EDGE_THRES_INDEX>(it).Exists()) { TMarker* markerMin = new TMarker(std::get<MIN_PULSE_INDEX>(it).GetX(), std::get<MIN_PULSE_INDEX>(it).GetY(), 22); markerMin->SetMarkerColor(color); markerMin->SetMarkerSize(2); markerMin->Draw(); TBox* pulseWindow = new TBox(std::get<EDGE_THRES_INDEX>(it).GetX(), fYMin, std::get<EDGE_THRES_INDEX>(it).GetX() + a_analysisMarkers.GetExpectedPulseWidth().Continuous(), fYMax); pulseWindow->SetFillColor(color); pulseWindow->SetFillStyle(3004); pulseWindow->Draw(); } i++; } */ if (Configuration::Instance().TagPrimaryPulseStep()) { for (auto& it: a_analysisMarkers.m_vChannelsWithPulse) { m_vpGraph[it]->SetLineWidth(3); } } if (Configuration::Instance().ShowEdgeThresholdMarkerStep()) { pulseThresholdLine->Draw(); } if (Configuration::Instance().ShowPulseThresholdMarkerStep()) { edgeThresholdLine->Draw(); } m_pCanvas->Update(); }
void plotV2vstheta(){ gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetErrorX(0); int xbin = 0; TFile *f = new TFile("mergedV_Prod.root"); TVectorD *vecV = (TVectorD*)f->Get(Form("D_%d/V")); TVectorD *vecdeltaV = (TVectorD*)f->Get(Form("D_%d/deltaV")); TVectorD *vecVmean = (TVectorD*)f->Get(Form("Vmean")); double *V = vecV->GetMatrixArray(); double *deltaV = vecdeltaV->GetMatrixArray(); double *Vmean = vecVmean->GetMatrixArray(); double theta[ntheta]; for(int itheta=0;itheta<ntheta;itheta++){ theta[itheta]=itheta*TMath::Pi()/ntheta/nn; } TH1D *hFrame = new TH1D("","",300,-1,2); hFrame->GetXaxis()->SetTitle("#theta"); hFrame->GetYaxis()->SetTitle("referenceV_{2}"); hFrame->GetXaxis()->SetTitleSize(0.04); hFrame->GetYaxis()->SetTitleSize(0.04); hFrame->GetXaxis()->SetRangeUser(-0.1,1.5); hFrame->SetMaximum(0.055); hFrame->SetMinimum(0.045); hFrame->Draw(); TGraphErrors *gr = new TGraphErrors(ntheta,theta,V,0,deltaV); gr->SetMarkerSize(1.2); gr->SetMarkerStyle(20); gr->Draw("Psame"); TLine *l = new TLine(0,inV2,1.4,inV2); l->SetLineStyle(2); l->Draw("same"); c1->Print("V2vstheta.png"); }
void DrawFitValue( TH2* frame, Double_t mean, Double_t err ) { Int_t DarkColor = TColor::GetColor( "#115000" ); Int_t LightColor = TColor::GetColor( "#bdff66" ); Double_t xmin = mean - err; Double_t xmax = mean + err; Double_t ymin = frame->GetYaxis()->GetXmin(); Double_t ymax = frame->GetYaxis()->GetXmax(); Double_t x[5] = { xmin, xmin, xmax, xmax, xmin }; Double_t y[5] = { ymin, ymax, ymax, ymin, ymin }; TGraph *box = new TGraph( 5, x, y ); box->SetLineColor( DarkColor ); box->SetFillColor( LightColor ); box->Draw("F"); TLine* louter = new TLine; TLine* linner = new TLine; louter->SetLineWidth( 1 ); louter->SetLineColor( DarkColor ); linner->SetLineWidth( 1 ); linner->SetLineStyle( 3 ); linner->SetLineColor( DarkColor ); louter->DrawLine( xmin, ymin, xmin, ymax ); louter->DrawLine( xmax, ymin, xmax, ymax ); linner->DrawLine( mean, ymin, mean, ymax ); }
void DrawJMS_vs_Eta(Str jetAlgo) { double massEbins[] = {50, 100, 250, 500, 750, 1500}; double massNbins = sizeof(massEbins)/sizeof(double); myJES = new JetCalibrationTool(jetAlgo,_jesFile); TH1F *h = new TH1F("","",100,-4.8,4.8); h->SetXTitle("Jet #eta_{det}"); h->SetYTitle("Jet mass response"); h->SetMaximum(1.4); h->SetMinimum(0.6); h->Draw(); TLine *l = new TLine(); l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4); l->DrawLine(-4.65,1,4.65,1); for (int i=0;i<massNbins;++i) { Graph *g = GetJMSGraph(massEbins[i]); FormatGraph(g,i); g->Draw("PL"); double x=0.52, y=0.3-0.05*i; if (i>2) { x=0.74; y=0.3-0.05*(i-3); } DrawLabel(Form("E = %.0f GeV",massEbins[i]),x,y,i); } tex->SetNDC(); tex->SetTextAlign(12); tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description()); tex->DrawLatex(0.18,0.9,jetAlgo); }
void drawline(double xpos, int colour, int style) { TLine *line = new TLine(xpos,0,xpos,15); line->SetLineStyle(style); line->SetLineColor(colour); line->Draw(); }
void myBoxText(Double_t x, Double_t y,Double_t boxsize,Int_t mcolor,char *text) { Double_t tsize=0.06; TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize); l.SetNDC(); l.DrawLatex(x,y,text); Double_t y1=y-0.25*tsize; Double_t y2=y+0.25*tsize; Double_t x2=x-0.3*tsize; Double_t x1=x2-boxsize; printf("x1= %f x2= %f y1= %f y2= %f \n",x1,x2,y1,y2); TPave *mbox= new TPave(x1,y1,x2,y2,0,"NDC"); mbox->SetFillColor(mcolor); mbox->SetFillStyle(1001); mbox->Draw(); TLine mline; mline.SetLineWidth(4); mline.SetLineColor(1); mline.SetLineStyle(1); Double_t y_new=(y1+y2)/2.; mline.DrawLineNDC(x1,y_new,x2,y_new); }
void drawLine(TAxis* a) { TLine* line = new TLine; line->SetLineStyle(2); line->DrawLine(a->GetXmin(),1,a->GetXmax(),1); }
void Drawtrackeff(){ gStyle->SetOptStat(kFALSE); TString type="eta"; TCanvas *c1 = new TCanvas("c1","c1",600,600); TH1D* heff = Draw(type,1,20); TH1D* hFrame = new TH1D("","",2030,-3,200); hFrame->SetTitle(""); if(type=="pt"){ c1->SetLogx(); // c1->SetLogy(); hFrame->GetXaxis()->SetTitle("p_{T}"); hFrame->GetXaxis()->SetRangeUser(0,200); } else if(type=="eta"){ hFrame->GetXaxis()->SetTitle("#eta"); hFrame->GetXaxis()->SetRangeUser(-3,3); } hFrame->GetYaxis()->SetRangeUser(0,1); hFrame->GetYaxis()->SetTitle("tracking efficiency"); hFrame->GetYaxis()->SetTitleOffset(1.1); TLegend *leg = new TLegend(0.3,0.75,0.85,0.88); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextSize(0.025); TLine *l = new TLine(hFrame->GetXaxis()->GetXmin(),1,hFrame->GetXaxis()->GetXmax(),1); l->SetLineStyle(2); l->SetLineWidth(1.2); hFrame->Draw(); heff->Draw("Psame"); l->Draw("same"); //leg->Draw("same"); c1->Print(Form("trackeff_%s.png",type.Data())); }
void TPTiming () { TAxis * ax = TPMatchEmul2D->GetZaxis() ; ax->SetRangeUser(-1,6) ; TCanvas* canv = new TCanvas("canv", "canv") ; canv->SetLogz(0) ; gStyle->SetOptStat(10) ; int color[10]= {1,10,3,4,5,6,7,8,9,2} ; gStyle->SetPalette(7, color) ; TPMatchEmul2D->GetXaxis()->SetTitle("Phi index"); TPMatchEmul2D->GetYaxis()->SetTitle("Eta index"); TPMatchEmul2D->Draw("colz") ; TH2I * label = new TH2I("label", "",72, 1, 73, 38, -19, 19) ; label->SetMarkerSize(0.6); label->SetBit(kCanDelete); for (int x=3 ; x<73 ; x+=4) { for (int y=21; y<=37; y++) { int towernb = 4*(y-21)+1 ; label->SetBinContent(x-1, y, towernb) ; //EB+ label->SetBinContent(x, 40-y, towernb) ; //EB- } } label->Draw("same text") ; TLatex txt; txt.SetTextSize(0.02); TLine line; line.SetLineColor(1) ; line.SetLineStyle(1) ; line.SetLineWidth(1) ; TAxis* xAxis = TPMatchEmul2D->GetXaxis(); TAxis* yAxis = TPMatchEmul2D->GetYaxis(); // draw SM borders and numbers float sm ; for (int i=0; i<36 ; i++ ) { if (i<18) { sm = 4*i+3 ; line.DrawLine(sm, 1, sm, 18) ; txt.SetTextAlign(32); txt.DrawText(sm-1+0.3, -17.7, Form("-%d",i+1)); } else { sm = 4*(i-18)+3 ; line.DrawLine(sm, 0, sm, -17) ; txt.SetTextAlign(12); txt.DrawText(sm-2+0.3, 18.5, Form("+%d",i-17)); } } line.DrawLine(1, 0, 73, 0) ; line.DrawLine(1, -17, 73, -17) ; line.DrawLine(1, 1, 73, 1) ; line.DrawLine(1, 18, 73, 18) ; }
void HiggsPlot::PlotBF(int iDecay, double tBmH_max, double BF_max){ if(iDecay<0 || iDecay>2) {cout<<"iDecay must be 0, 1 or 2"<<endl; return;} styles style; style.setPadsStyle(-1); style.setDefaultStyle(); int nBins = 1000; TString hName, epsName = "public_html/Higgs_BF_TEMP_BaBar.eps", label, Llabel, Rlabel; TString yTitle[] = {"BF(B#rightarrow#tau#nu) (10^{-5})", "R(D)", "R(D*)"}; TString TagDecay[] = {"BF", "R(D)", "R(D*)"}; TCanvas can; TH1F *hBF[2]; for(int his=0; his<1; his++) { hName = "hBF"; hName += his; hBF[his] = new TH1F(hName,"",nBins,0,tBmH_max); } double tBmH, BF[2]; for(int bin=1; bin<=nBins; bin++){ tBmH = hBF[0]->GetBinCenter(bin); Compute(tBmH,BF,iDecay); hBF[0]->SetBinContent(bin, BF[0]); hBF[0]->SetBinError(bin, BF[1]); } hBF[0]->SetFillColor(2); hBF[0]->SetLineColor(2); hName += "1"; hBF[1] = static_cast<TH1F*>(hBF[0]->Clone(hName)); for(int bin=1; bin<=nBins; bin++)hBF[1]->SetBinError(bin,0); hBF[1]->SetFillColor(0);hBF[1]->SetLineColor(1); hBF[1]->SetLineWidth(2); TBox box; box.SetLineColor(4);box.SetFillColor(4); TLine line; line.SetLineStyle(1); line.SetLineColor(4); line.SetLineWidth(3); if(BF_max>0) hBF[0]->SetMaximum(BF_max); hBF[0]->Draw("e3"); box.SetFillStyle(3002); box.DrawBox(0,Measurement[iDecay][0]-Measurement[iDecay][1], tBmH_max,Measurement[iDecay][0]+Measurement[iDecay][1]); line.DrawLine(0,Measurement[iDecay][0],tBmH_max,Measurement[iDecay][0]); hBF[0]->Draw("e3 same"); hBF[1]->Draw("c same"); Compute(0,BF,iDecay); label = "#splitline{"; label += TagDecay[iDecay]; label += "_{SM} = "; if(iDecay==0){ label+="(";label+=RoundNumber(BF[0],1); label+=" #pm "; label+=RoundNumber(BF[1],1); label+=")#times10^{-5}}{BF_{exp} = ("; label+=RoundNumber(Measurement[iDecay][0],1); label+=" #pm "; label+=RoundNumber(Measurement[iDecay][1],1); label+=")#times10^{-5}}"; Llabel = ""; Rlabel = label; } else { label+=RoundNumber(BF[0],3); label+=" #pm "; label+=RoundNumber(BF[1],3); label+="}{"; label += TagDecay[iDecay]; label += "_{exp} = "; label+=RoundNumber(Measurement[iDecay][0],3); label+=" #pm "; label+=RoundNumber(Measurement[iDecay][1],3); label+="}"; Rlabel = ""; Llabel = label; } style.setTitles(hBF[0],"tan#beta/m_{H^{+}} (GeV^{-1})",yTitle[iDecay],Llabel,Rlabel); epsName.ReplaceAll("TEMP",DecayName[iDecay]); can.SaveAs(epsName); for(int his=0; his<2; his++) hBF[his]->Delete(); }
void plotV2vstheta(){ TFile *f; if(isSum==0){ f = TFile::Open("mergedV_Prod.root"); } else{ f = TFile::Open("mergedV_Sum.root"); } int xbin=0; TVectorD* vecVmean = (TVectorD*)f->Get(Form("D_%d/Vmean",xbin)); TVectorD* vecV = (TVectorD*)f->Get(Form("D_%d/D_0/V",xbin)); double Vmean = (*vecVmean)[0]; cout<<Vmean<<endl; double *V = vecV->GetMatrixArray(); double theta[ntheta]; for(int itheta=0;itheta<ntheta;itheta++){ theta[itheta]=itheta*TMath::Pi()/ntheta/nn; cout<<V[itheta]<<endl; } TGraph *gV2theta = new TGraph(ntheta,theta,V); gV2theta->SetMarkerStyle(20); gV2theta->SetMarkerSize(1.3); gV2theta->SetMarkerColor(1); gV2theta->SetLineColor(1); gV2theta->SetMinimum(Vmean*0.98); gV2theta->SetMaximum(Vmean*1.02); gV2theta->Draw("AP"); TLine *lup = new TLine(gV2theta->GetXaxis()->GetXmin(),Vmean*1.01, gV2theta->GetXaxis()->GetXmax(),Vmean*1.01); TLine *ldown = new TLine(gV2theta->GetXaxis()->GetXmin(),Vmean*0.99, gV2theta->GetXaxis()->GetXmax(),Vmean*0.99); TLine *l = new TLine(gV2theta->GetXaxis()->GetXmin(),Vmean, gV2theta->GetXaxis()->GetXmax(),Vmean); l->SetLineStyle(2); lup->SetLineStyle(2); ldown->SetLineStyle(2); l->SetLineWidth(1.2); lup->SetLineWidth(1.2); ldown->SetLineWidth(1.2); l->Draw("same"); lup->Draw("same"); ldown->Draw("same"); if(isSum==0)c1->SaveAs("hV2theta_Prod.png"); else c1->SaveAs("hV2theta_Sum.png"); }
void plotV2vsflow(){ gStyle->SetOptFit(kFALSE); gStyle->SetOptStat(kFALSE); TCanvas *c1 = new TCanvas("c1","c1",600,600); TLegend *leg = new TLegend(0.2,0.1,0.4,0.4); leg->SetTextSize(0.05); leg->SetBorderSize(0); leg->SetFillColor(0); const int ninflow = 6; int xbin=0; TString dir; double V2_Prod[ninflow],V2err_Prod[ninflow]; const int mult = 150; TF1 *PtDistr = new TF1("PtDistr","0.03*(exp (-(x/0.594540))+0.00499506*exp (-(x/1.89391)))", 0.3,6.0); //Real Data TF1 *V2vsPt = new TF1("V2vsPt","((x/3.31699)^2.35142/(1+(x/3.49188)^3.54429))*(.00005+(1/x)^1.50600)",0.3,6.0); TF1 *V2 = new TF1("V2","0.03*(exp (-(x/0.594540))+0.00499506*exp (-(x/1.89391)))*((x/3.31699)^2.35142/(1+(x/3.49188)^3.54429))*(.00005+(1/x)^1.50600)",0.3,6.0); double InV2 = V2->Integral(0.3,6.0)/PtDistr->Integral(0.3,6.0); double inV2[ninflow]={}; for(int i=0;i<ninflow;i++){ inV2[i] = InV2 * i / 5 ; dir=Form("pPbDataV20%dm%d",i,mult); TFile *mergedV_Prod = TFile::Open(Form("%s/mergedV_Prod.root",dir.Data())); if(i==) TFile *mergedV_Prod = TFile::Open(Form("%s/mergedV_Sum.root",dir.Data())); TVectorD *vecMult = (TVectorD*)mergedV_Prod->Get("totmultall"); TVectorD *vecNevent = (TVectorD*)mergedV_Prod->Get("Nevent"); TVectorD *vecV2_Prod=(TVectorD*)mergedV_Prod->Get(Form("Vmean",xbin)); TVectorD *vecV2err_Prod=(TVectorD*)mergedV_Prod->Get(Form("deltaVmean",xbin)); V2_Prod[i]=(*vecV2_Prod)[xbin]; V2err_Prod[i]=(*vecV2err_Prod)[xbin]; cout<<inV2[i]<<endl; // V2sp[i]=InV2/V2_Prod[i]; // V2spError[i]=InV2/V2_Prod[i]/V2_Prod[i]*(*vecV2err_Prod)[xbin]; // cout<<V2sp[i]<<"pm"<<V2spError[i]<<"\t"; } V2_Prod[1]=0; cout<<endl<<InV2<<endl; TH1D* hFrame = new TH1D("","",2000,-1,1); hFrame->GetXaxis()->SetRangeUser(0., 0.08); hFrame->GetYaxis()->SetRangeUser(0., 0.08); hFrame->Draw(); TGraphErrors *grProd=new TGraphErrors(ninflow,inV2,V2_Prod,0,V2err_Prod); grProd->SetMarkerColor(1); grProd->SetMarkerSize(1.6); grProd->SetLineColor(1); grProd->SetMarkerStyle(20); hFrame->GetXaxis()->SetTitle("Input V2"); hFrame->GetYaxis()->SetTitle("Calc V2"); hFrame->Draw(); grProd->Draw("Psame"); TLine *l = new TLine(0,0,0.06,0.06); l->SetLineStyle(2); l->Draw("same"); c1->SaveAs("V2vsflow.gif"); }
TH2D * plotJEtCorr(TTree * tr, TCut cut, TString var, TString name, TString title, Int_t normType=0) { TH2D * hist = plot2D(tr,cut,var,name,title,80,0,300,40,0,2); TLine *l = new TLine(0,1,300,1); l->SetLineStyle(2); TCanvas * cJEtCorr0 = new TCanvas("c"+name,"c"+name,500,500); cJEtCorr0->SetRightMargin(0.15); hist->Draw("colz"); l->Draw(); return hist; }
//------------------------------------------------------------// // Make line //------------------------------------------------------------// TLine* makeLine(float x0, float x1, float y0, float y1, int color=kBlack, int style=1) { TLine* line = new TLine(x0,y0,x1,y1); line->SetLineWidth(1); line->SetLineColor(color); line->SetLineStyle(style); return line; }
void drawEventRPhi(double vxlb, double vylb, double vxl0, double vyl0, double pmu1, double phimu1, double pmu2, double phimu2, double ppr, double phipr, double ppi, double phipi, 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; } // draw the vertices TMarker *m; const double xlb = vxlb; const double ylb = vylb; m = new TMarker(xlb,ylb,7); m->SetMarkerColor(colLb); m->Draw(); const double xl0 = vxl0; const double yl0 = vyl0; m = new TMarker(xl0,yl0,7); m->SetMarkerColor(colL0); m->Draw(); // draw the l0 flight line TLine *l; l = new TLine(vxlb,vylb,vxl0,vyl0); l->SetLineColor(colL0); l->SetLineStyle(2); l->Draw(); // draw the muons TArrow *a; const double xmu1 = xlb + scalemu * pmu1 * TMath::Cos(phimu1); const double ymu1 = ylb + scalemu * pmu1 * TMath::Sin(phimu1); a = new TArrow(xlb,ylb,xmu1,ymu1,.01,">"); a->SetLineColor(colMu1); a->Draw(); const double xmu2 = xlb + scalemu * pmu2 * TMath::Cos(phimu2); const double ymu2 = ylb + scalemu * pmu2 * TMath::Sin(phimu2); 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(phipr); const double ypr = yl0 + scalepr * ppr * TMath::Sin(phipr); a = new TArrow(xl0,yl0,xpr,ypr,.01,">"); a->SetLineColor(colPr); a->Draw(); const double xpi = xl0 + scalepi * ppi * TMath::Cos(phipi); const double ypi = yl0 + scalepi * ppi * TMath::Sin(phipi); a = new TArrow(xl0,yl0,xpi,ypi,.01,">"); a->SetLineColor(colPi); a->Draw(); }
pair <float,float> find_interpolated_point(TH2F* histo, int xbin, bool mSUGRA=true) { int minaccept=4; TCanvas *flatcan = new TCanvas("flatcan","flatcan"); stringstream histoname; histoname << "exclusion shape for x bin " << xbin; TH1F *flathisto; if(mSUGRA) flathisto = new TH1F("flat",histoname.str().c_str(),histo->GetNbinsY(),histo->GetYaxis()->GetBinLowEdge(1),histo->GetYaxis()->GetBinLowEdge(histo->GetNbinsY())+histo->GetYaxis()->GetBinWidth(histo->GetNbinsY())); else flathisto = new TH1F("flat",histoname.str().c_str(),histo->GetNbinsX(),histo->GetXaxis()->GetBinLowEdge(1),histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX())+histo->GetXaxis()->GetBinWidth(histo->GetNbinsX())); int acceptedpoints=0; int nbins=histo->GetNbinsY(); if(!mSUGRA) histo->GetNbinsX(); for(int i=1;i<nbins;i++) { float value=0; if(i<=nbins-2) value=((1/3.0)*(histo->GetBinContent(xbin,i)+histo->GetBinContent(xbin+1,i)+histo->GetBinContent(xbin+2,i))); if(i==nbins-1) value=((1/2.0)*(histo->GetBinContent(xbin,i)+histo->GetBinContent(xbin,i+1))); if(i==nbins) value=(histo->GetBinContent(xbin,i)); if(value<20&&value>0) { flathisto->SetBinContent(i,value); flathisto->SetBinError(i,TMath::Sqrt(value)); acceptedpoints++; } } float pointone=-100; TLine *excluded; if(acceptedpoints>minaccept) { flathisto->Fit("expo","Q"); TF1 *fitfunc = (TF1*)flathisto->GetFunction("expo"); pointone=-(fitfunc->GetParameter(0)/fitfunc->GetParameter(1)); excluded=new TLine(pointone,0,pointone,10); } pair <float,float> anything; anything.first=histo->GetXaxis()->GetBinCenter(xbin); anything.second=pointone; stringstream flatname; flathisto->GetYaxis()->SetRangeUser(0,10); flathisto->Draw(); if(acceptedpoints>minaccept) excluded->SetLineColor(kGreen); if(acceptedpoints>minaccept) excluded->SetLineStyle(2); if(acceptedpoints>minaccept) excluded->SetLineWidth(2); if(acceptedpoints>minaccept) excluded->Draw("same"); flatname << "Limits/partials/partial_" << xbin << "___" << histo->GetName() << ".png"; if(draweachone) CompleteSave(flatcan,flatname.str()); delete flatcan; delete flathisto; return anything; }
void drawTheory(int i, double mean, double nErr, double pErr, double vstep) { double lowY = (i+1)*vstep; // margins are 1 vstep each double uppY = (i+2)*vstep; TBox* band = new TBox(mean-nErr,lowY+0.1*vstep,mean+pErr,uppY-0.1*vstep); band->SetFillColor(kYellow-4); band->Draw(); TLine* center = new TLine(mean, 0, mean, 1); center->SetLineStyle(2); // dash center->SetLineWidth(4); center->SetLineColor(2); center->Draw(); return; }
void setCtauFrom2DRange(RooWorkspace& myws, RooPlot* frame, string dsName, bool setLogScale, vector<double> rangeErr, double excEvts) { // Find maximum and minimum points of Plot to rescale Y axis TH1* h = myws.data(dsName.c_str())->createHistogram("hist", *myws.var("ctau"), Binning(frame->GetNbinsX(),frame->GetXaxis()->GetXmin(),frame->GetXaxis()->GetXmax())); Double_t YMax = h->GetBinContent(h->GetMaximumBin()); Double_t YMin = 1e99; for (int i=1; i<=h->GetNbinsX(); i++) if (h->GetBinContent(i)>0) YMin = min(YMin, h->GetBinContent(i)); Double_t Yup(0.),Ydown(0.); if(setLogScale) { Yup = YMax*TMath::Power((YMax/0.1), 0.5); Ydown = 0.1; } else { Yup = YMax+(YMax-0.0)*0.5; Ydown = 0.0; } frame->GetYaxis()->SetRangeUser(Ydown,Yup); delete h; if (excEvts>0.0) { TLine *minline = new TLine(rangeErr[0], 0.0, rangeErr[0], (setLogScale?(Ydown*TMath::Power((Yup/Ydown),0.4)):(Ydown + (Yup-Ydown)*0.4))); minline->SetLineStyle(2); minline->SetLineColor(1); minline->SetLineWidth(3); frame->addObject(minline); TLine *maxline = new TLine(rangeErr[1], 0.0, rangeErr[1], (setLogScale?(Ydown*TMath::Power((Yup/Ydown),0.4)):(Ydown + (Yup-Ydown)*0.4))); maxline->SetLineStyle(2); maxline->SetLineColor(1); maxline->SetLineWidth(3); frame->addObject(maxline); } };
void DrawHijing2GeV() { TCanvas *c1 = new TCanvas(); TFile *fin = TFile::Open("Gamma_Neutron_Hijing_Energy_Graphs.root"); gROOT->cd(); TH1 *h1lim = new TH1F("h1lim","",1,0,0.1); TH1 *hjbkg = (TH1 *) fin->Get("hjbkg")->Clone(); TGraph *anti_neutron2GeV = (TGraph *) fin->Get("anti_neutron2GeV")->Clone(); TGraph *neutron2GeV = (TGraph *) fin->Get("neutron2GeV")->Clone(); h1lim->SetStats(0); h1lim->SetMaximum(0.3); h1lim->SetTitle("2 GeV Hadronic Showers with HIJING background"); h1lim->GetYaxis()->SetTitle("Deposited Energey [GeV]"); h1lim->GetYaxis()->SetTitleOffset(1.2); h1lim->GetXaxis()->SetTitle("cone size (#sqrt{#Delta#Phi^{2}+#Delta#Theta^{2}})"); h1lim->GetXaxis()->SetTitleOffset(1.2); h1lim->Draw(); hjbkg->SetStats(0); hjbkg->SetLineColor(6); hjbkg->SetMaximum(5.5); hjbkg->SetLineWidth(2); hjbkg->Draw("same"); anti_neutron2GeV->SetLineColor(4); anti_neutron2GeV->SetLineWidth(2); anti_neutron2GeV->Draw("same"); neutron2GeV->SetLineColor(2); neutron2GeV->SetLineWidth(2); neutron2GeV->Draw("same"); TLine *tl = new TLine(); tl->SetLineStyle(2); tl->DrawLine(0.024,0,0.024,0.3); TLegend *legrda = new TLegend(0.67,0.34,0.87,0.54,NULL,"brNDC"); legrda->SetLineColor(1); legrda->SetLineStyle(1); legrda->SetLineWidth(1); legrda->SetFillColor(10); legrda->SetFillStyle(1001); legrda->SetBorderSize(0); // legrda->SetTextSize(labelsize); legrda->AddEntry(hjbkg,"HIJING bkg"); legrda->AddEntry(anti_neutron2GeV,"2 GeV Anti Neutron","l"); legrda->AddEntry(neutron2GeV,"2 GeV Neutron", "l"); legrda->AddEntry(tl,"EMCal tower size","l"); legrda->Draw(); fin->Close(); c1->Print("Hijing2GeV.png"); }
void drawP1D(){ gStyle->SetOptStat(0); gStyle->SetOptTitle(0); text.SetNDC(1); text.SetTextFont(43); text.SetTextSize(16); text1.SetNDC(1); text1.SetTextFont(43); text1.SetTextSize(18); text2.SetNDC(1); text2.SetTextFont(43); text2.SetTextSize(20); txt.SetNDC(1);//internal symbol txt.SetTextFont(43); txt.SetTextSize(21); txt.SetTextColor(16); txt.SetTextAngle(40); lab1.SetNDC(1); lab2.SetNDC(1); lab3.SetNDC(1); lab4.SetNDC(1); lab1.SetTextSize(17); lab2.SetTextSize(16); lab3.SetTextSize(16); lab4.SetTextSize(15); lab1.SetTextFont(73); lab2.SetTextFont(43); lab3.SetTextFont(43); lab4.SetTextFont(43); line.SetLineStyle(3); readin(0); readin(1); for (int ipt=0; ipt<1; ipt++) { int ic = 0; drawplot(ipt, ic); // drawcorr(ipt, ic); } }
void SetupTowerDisplay(TH2F *hist) { hist->SetStats(kFALSE); hist->SetXTitle("ieta"); hist->SetYTitle("iphi"); hist->GetXaxis()->CenterTitle(); hist->GetYaxis()->CenterTitle(); hist->GetXaxis()->SetNdivisions(65); hist->GetXaxis()->SetLabelColor(0); hist->GetXaxis()->SetTickLength(.78); hist->GetXaxis()->SetTitleOffset(0.95); hist->GetYaxis()->SetNdivisions(72); hist->GetYaxis()->SetLabelColor(0); hist->GetYaxis()->SetTitleOffset(0.85); TText *yLabel = new TText(); TLine *pLine = new TLine(); pLine->SetLineStyle(1); pLine->SetLineColor(1); pLine->SetLineWidth(1); yLabel->SetTextAlign(22); yLabel->SetTextSize(0.015); char phi_num[3]; char eta_num[3]; TText *xLabel = new TText(); xLabel->SetTextSize(0.015); xLabel->SetTextAlign(22); for (Int_t i=1; i<73; ++i) { sprintf(phi_num,"%d",i); if(TMath::Abs(i%2)==1) {yLabel->DrawText(-33,0.5+i,phi_num);} else {yLabel->DrawText(-34.5,0.5+i,phi_num);} pLine->DrawLine(-32,i,33,i); } for (Int_t i=-32; i<33;++i) { sprintf(eta_num,"%d",i); if(TMath::Abs(i%2)==0) {xLabel->DrawText(0.5+i,-0.5,eta_num);} else {xLabel->DrawText(0.5+i,-2,eta_num);} pLine->DrawLine(i,1,i,72); } }
/// /// Draw a horizontal line at given p-value, put a /// label on top of it stating the corresponding CL. /// void OneMinusClPlot::drawCLguideLine(float pvalue) { m_mainCanvas->cd(); m_mainCanvas->Update(); float ymin = gPad->GetUymin(); float ymax = gPad->GetUymax(); float xmin = gPad->GetUxmin(); float xmax = gPad->GetUxmax(); float labelPos = xmin+(xmax-xmin)*0.10; if ( arg->isQuickhack(2) ) labelPos = xmin+(xmax-xmin)*0.55; if ( arg->isQuickhack(23) ) labelPos = xmin+(xmax-xmin)*0.8; float labelPosYmin = 0; float labelPosYmax = 0; if ( arg->plotlog ) { labelPosYmin = pvalue; labelPosYmax = labelPosYmin * 2.; } else { labelPosYmin = pvalue + 0.02; labelPosYmax = labelPosYmin + 0.05; } TPaveText *t = new TPaveText(labelPos, labelPosYmin, labelPos+(xmax-xmin)*0.5, labelPosYmax, "BR"); t->SetBorderSize(0); t->SetFillStyle(0); t->SetTextAlign(12); t->SetTextFont(font); t->SetTextSize(labelsize); t->AddText(Form("%.1f%%",(1.-pvalue)*100.)); t->Draw(); TLine* l = new TLine(xmin, pvalue, xmax, pvalue); l->SetLineWidth(1); l->SetLineColor(kBlack); l->SetLineStyle(kDotted); l->Draw(); }
void plotThisOne() { gSystem->Load("libAskRay.so"); TCanvas * can = new TCanvas("can","can"); TH1F *framey = can->DrawFrame(-7e6,-7e6,+7e6,+7e6); TEllipse *elipsey = new TEllipse(0,0,6378.1e3,6378.1e3); elipsey->SetLineColor(8); elipsey->SetLineWidth(3); elipsey->Draw();//Ellipse(0,0,6378.1e3,6378.1e3); Double_t gz[361],gx[361]; Int_t count=0; for(Double_t theta=-180;theta<=180;theta+=1) { Double_t radius=AskGeom::getGeoidFromTheta(theta*TMath::DegToRad()); gz[count]=radius*TMath::Cos(theta*TMath::DegToRad()); gx[count]=radius*TMath::Sin(theta*TMath::DegToRad()); // cout << theta << "\t" << radius << "\t" << gz[count] << "\t" << gx[count] << endl; count++; } TGraph *geoid = new TGraph(count,gx,gz); geoid->Draw("l"); TLine *liney = new TLine(); liney->SetLineColor(9); liney->SetLineWidth(1); liney->SetLineStyle(2); Double_t point1[3]={-294476, 489656, 6.33461e+06}; Double_t point2[3]={-297716, 487929, 6.34309e+06}; liney->DrawLine(point1[1],point1[2],point2[1],point2[2]); }
void draw_diagonal_xchange(int scantype, std::string scanx = "" ) { // Line marking the diagonal TLine *line; float verticaloffset=0.0; if(scantype==PlottingSetup::GMSB) verticaloffset=75.0; line = new TLine(50.+75.0, 50.0+verticaloffset, 1200., 1200.0-75.0+verticaloffset); line->SetLineStyle(7); line->SetLineWidth(4); //line->Draw("same"); // Do not draw: draw the other one instead // Add a dashed line to indicate where x changes float offset = 0.; if ( 0 == scanx.compare("0.5") ) { offset = 91/0.5; } else if ( 0 == scanx.compare("0.25") ) { offset = 91/0.25; } else if ( 0 == scanx.compare("0.75") ) { offset = 91/0.75; } else if ( scantype==PlottingSetup::GMSB) { offset = 0; }; if ( offset>0. ) { line->DrawLine(50+offset, 50.0, 1175., 1175.0-offset); }else if ( scantype==PlottingSetup::GMSB ) { line->DrawLine(100, 100, 1175., 1175.0-offset); } }
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 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)); } }