void compnclusts(Int_t run) { TFile* f = new TFile(Form("hodtest_%d.root",run)); cout << "hcana root file " << Form("hodtest_%d.root",run) << endl; TH1F* h = nclust; TFile* f1 = new TFile(Form("%d_hbk.root",run)); cout << "Engine root file " << Form("%d_hbk.root",run) << endl; TH1F* h1; switch (run) { case 50017 : // h1 = h212; //A+ break; default : h1 = h412; //hnclusters } TCanvas *c1 = new TCanvas("c1", "Shower Cluster Map", 1000, 667); gPad->SetLogy(); h1->SetFillColor(kGreen); h1->SetLineColor(kGreen); h1->SetFillStyle(1111); h1->Draw(); h->SetFillColor(kBlue); h->SetLineWidth(2); h->SetFillStyle(0); h->Draw("same"); TLatex l; l.SetTextSize(0.04); Float_t maxy = h1->GetBinContent(h1->GetMaximumBin()); Float_t xmin = h1->GetXaxis()->GetXmin(); Float_t xmax = h1->GetXaxis()->GetXmax(); Float_t xt = xmin + 0.67*(xmax-xmin); l.SetTextColor(kGreen); l.DrawLatex(xt,0.095*maxy,"Engine"); l.SetTextColor(kBlue); l.DrawLatex(xt,0.045*maxy,"hcana"); // Difference between the histograms. TCanvas *c2 = new TCanvas("c2", "Cluster differences", 1000, 667); TH1F* dif = h->Clone(); dif->Add(h,h1,1.,-1.); dif->SetTitle("Difference"); dif->SetFillColor(kRed); dif->SetLineColor(kRed); dif->SetLineWidth(1); dif->SetFillStyle(1111); dif->Draw(); }
void comparecfback(TString file1, TString file2, TString histname1, TString histname2, TString histname3,TString sys) { TFile* ifile1_ = new TFile(Form("%s",file1.Data()), "read"); TFile* ifile2_ = new TFile(Form("%s",file2.Data()), "read"); TH1D* hist1; TH1D* hist2; TH1D* hist3; // if ( (strcmp(sys,"V0LL") == 0) || (strcmp(sys,"V0ALAL") == 0) || (strcmp(sys,"V0LAL") == 0) ) { // hist1 = (TH1D*)ifile1_->Get(Form("Numcqinv%stpcM%d%s",sys,mult,kT)); // hist2 = (TH1D*)ifile2_->Get(Form("Numcqinv%stpcM%d%s",sys,mult,kT)); // } // else { hist1 = (TH1D*)ifile1_->Get(Form("%s",histname1.Data())); hist2 = (TH1D*)ifile2_->Get(Form("%s",histname2.Data())); hist3 = (TH1D*)ifile2_->Get(Form("%s",histname3.Data())); // } TCanvas *myCan = new TCanvas("asd","asd"); myCan->Draw(); myCan->cd(); hist1->SetMarkerColor(kBlack); hist2->SetMarkerColor(kRed); hist3->SetMarkerColor(kBlue); hist1->SetMarkerStyle(20); hist2->SetMarkerStyle(20); hist3->SetMarkerStyle(20); hist1->SetMarkerSize(1.6); hist2->SetMarkerSize(1.6); hist3->SetMarkerSize(1.6); hist1->SetTitle(""); hist1->GetXaxis()->SetRangeUser(0.,1.0); hist2->GetXaxis()->SetRangeUser(0.,1.0); hist3->GetXaxis()->SetRangeUser(0.,1.0); gStyle->SetOptStat(0); //hist1->Scale(1./1.026);//1.026, 1.05 hist1->SetMaximum(1.015); hist1->SetMinimum(0.9425); hist1->GetXaxis()->SetTitleSize(0.05); hist1->GetYaxis()->SetTitleSize(0.05); hist1->Draw("p"); hist2->Draw("psame"); hist3->Draw("psame"); TLatex Tl; Tl.SetTextAlign(23); Tl.SetTextSize(0.08); Tl.SetTextColor(kBlack); Tl.DrawLatex(0.5,0.995,"p#bar{p}"); Tl.SetTextColor(kRed); Tl.DrawLatex(0.5,0.980,"p#bar{#Lambda}"); Tl.SetTextColor(kBlue); Tl.DrawLatex(0.5,0.965,"#bar{p}#Lambda"); myCan->SaveAs(Form("comp%s.eps",sys.Data())); }
void drawLabels(){ // "Hadron Gas" TLatex *xHad1 = new TLatex(0.11, 0.13, "Hadron"); TLatex *xHad2 = new TLatex(0.15, 0.085, "Gas"); xHad1->SetTextSize(0.04); xHad2->SetTextSize(0.04); if(iColor)xHad1->SetTextColor(4); if(iColor)xHad2->SetTextColor(4); xHad1->Draw(); xHad2->Draw(); //"Quark Gloun Plasma" TLatex *xQGP1 = new TLatex(0.55, 0.8, "Quark Gluon"); TLatex *xQGP2 = new TLatex(0.62, 0.755, "Plasma"); xQGP1->SetTextSize(0.04); xQGP2->SetTextSize(0.04); if(iColor)xQGP1->SetTextColor(4); if(iColor)xQGP2->SetTextColor(4); xQGP1->Draw(); xQGP2->Draw(); //"Early Universe" TArrow *aUniv = new TArrow(.025, 0.95,.025, 0.45,0.03,"|>"); aUniv->SetLineWidth(2); if(iColor)aUniv->SetLineColor(2); if(iColor)aUniv->SetFillColor(2); aUniv->Draw(); TLatex *xUniv = new TLatex(0.075, 0.58, "Early Universe"); xUniv->SetTextSize(0.04); xUniv->SetTextAngle(90); if(iColor)xUniv->SetTextColor(2); xUniv->Draw(); //"Neutron Stars" TArrow *aNeut = new TArrow(.65, .05 ,.99, 0.075,0.03,"|>"); aNeut->SetLineWidth(2); if(iColor)aNeut->SetLineColor(8); if(iColor)aNeut->SetFillColor(8); aNeut->Draw(); TLatex *xNeut = new TLatex(0.735, 0.08, "Neutron Stars"); xNeut->SetTextSize(0.04); xNeut->SetTextAngle(5); if(iColor)xNeut->SetTextColor(8); xNeut->Draw(); //"Critical Point" TLatex *xCrit1 = new TLatex(0.2, 0.585, "Critical"); TLatex *xCrit2 = new TLatex(0.225, 0.54, "Point"); xCrit1->SetTextSize(0.04); xCrit2->SetTextSize(0.04); xCrit1->Draw(); xCrit2->Draw(); }
void ATLASLabelOld(Double_t x,Double_t y,bool Preliminary,Color_t color) { TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); l.SetNDC(); l.SetTextFont(72); l.SetTextColor(color); l.DrawLatex(x,y,"ATLAS"); if (Preliminary) { TLatex p; p.SetNDC(); p.SetTextFont(42); p.SetTextColor(color); p.DrawLatex(x+0.115,y,"Preliminary"); } }
void ATLASLumi(Double_t x,Double_t y, float datlum, int energy=7) { // add the Atlas Lumi and centre of mass //float datlum=8.2; // if (!fIsPseudoData) { // TString tit="#sqrt{s} = 7 TeV, #int L dt="; TString tit; if(energy == 7) tit +="#sqrt{s} = 7 TeV"; if(energy == 8) tit +="#sqrt{s} = 8 TeV"; if(energy == 13) tit +="#sqrt{s} = 13 TeV"; tit +=Form(", %.1f",datlum); tit +=" fb^{-1}"; // float fTextScaleFactor=0.8; TLatex l; //l.SetTextAlign(12); l.SetNDC(); //l.SetTextFont(42);// standard l.SetTextFont(72); // italics float siz=l.GetTextSize(); l.SetTextSize(siz*fTextScaleFactor); //l.SetTextSize(siz*0.7); // set the size here l.SetTextColor(1); l.DrawLatex(x,y,tit); }
void ellipises(){ TEllipse *e1 = new TEllipse(0.66, 0.66, 0.025, 0.2, 0., 360., 0.); e1->SetLineWidth(2); e1->SetFillStyle(3003); e1->SetFillColor(1); if(iColor)e1->SetFillColor(kBlue); if(iColor)e1->SetLineColor(kBlue); e1->SetNoEdges(); e1->Draw(); TEllipse *e2 = new TEllipse(0.33, 0.33, 0.025, 0.2, 0., 360., 180.); e2->SetLineWidth(2); e2->SetFillStyle(3003); e2->SetFillColor(1); if(iColor)e2->SetFillColor(kRed); if(iColor)e2->SetLineColor(kRed); e2->SetNoEdges(); e2->Draw(); TBox *b1 = new TBox(0.3, 0.6, 0.7, 0.4); b1->SetFillColor(0); b1->SetLineColor(0); b1->Draw(); TEllipse *e3 = new TEllipse(0.5, 0.5, 0.1, 0.066, 0., 360., 0.); e3->SetLineWidth(2); if(iColor)e3->SetFillColor(kRed+2); if(iColor)e3->SetLineColor(kRed+2); e3->Draw(); TLatex *xFire = new TLatex(0.445, 0.49, "Fireball"); if(iColor)xFire->SetTextColor(0); xFire->SetTextSize(0.04); xFire->Draw(); TLatex *xA1 = new TLatex(0.72, 0.665, "Nucleus"); xA1->SetTextSize(0.04); if(iColor)xA1->SetTextColor(kBlue); xA1->Draw(); TLatex *xA2 = new TLatex(0.77, 0.625, "A"); xA2->SetTextSize(0.04); if(iColor)xA2->SetTextColor(kBlue); xA2->Draw(); TLatex *xB1 = new TLatex(0.13, 0.37, "Nucleus"); xB1->SetTextSize(0.04); if(iColor)xB1->SetTextColor(kRed); xB1->Draw(); TLatex *xB2 = new TLatex(0.18, 0.33, "B"); xB2->SetTextSize(0.04); if(iColor)xB2->SetTextColor(kRed); xB2->Draw(); TLatex *xSide = new TLatex(0.45, 0.95, "#bf{Side View}"); xSide->SetTextSize(0.04); xSide->Draw(); }
void decorate(TCanvas *can,TH2D &h, bool addLHC=true){ TLatex * tex = new TLatex(); tex->SetNDC(); tex->SetTextFont(42); tex->SetLineWidth(2); tex->SetTextSize(0.03); tex->DrawLatex(0.32,0.93,"4.9 fb^{-1} (7 TeV) + 19.7 fb^{-1} (8 TeV) + 2.3 fb^{-1} (13 TeV)"); tex->SetTextFont(42); tex->SetTextSize(0.06); //if (!addLHC){ // tex->SetTextSize(0.04); // tex->SetTextColor(kWhite); // if (isPrelim) tex->DrawLatex(0.155, 0.85, "#bf{CMS} #it{Preliminary}"); // else tex->DrawLatex(0.155, 0.85, "#bf{CMS}"); //} else { if (isPrelim) { tex->SetTextSize(0.04); tex->DrawLatex(0.155, 0.85, "#bf{CMS} #it{Preliminary}"); } else tex->DrawLatex(0.14, 0.93, "#bf{CMS}"); //} TGraph *SM = new TGraph(); SM->SetPoint(0,1,1); SM->SetMarkerColor(kOrange); SM->SetMarkerStyle(33); SM->SetMarkerSize(4); SM->Draw("Psame"); TLegend *leg; if (addLHC) { if (isPrelim) leg = new TLegend(0.14,0.56,0.4,0.83); else leg = new TLegend(0.14,0.62,0.4,0.89); } else leg = new TLegend(0.52,0.84,0.78,0.89); leg->SetTextSize(0.042); leg->SetFillStyle(0); leg->SetTextColor(kWhite); leg->SetBorderSize(0); TGraph *gr = new TGraph(); gr->SetLineWidth(2); gr->SetMarkerStyle(34); gr->SetLineColor(kWhite); gr->SetMarkerColor(kWhite); TGraph *gr2 = new TGraph(); gr2->SetLineWidth(2); gr2->SetLineColor(kWhite); gr2->SetLineStyle(2); gr->SetMarkerSize(2); if (addLHC){ leg->AddEntry(SM,"SM production","P"); leg->AddEntry(gr,"LHC best fit","P"); leg->AddEntry(gr, "68% CL","L"); leg->AddEntry(gr2,"95% CL","L"); leg->Draw(); } else { TLatex *lat = new TLatex(); lat->SetTextSize(0.04); lat->SetTextColor(kWhite); lat->DrawLatex(1.05,1.05,"SM production"); } can->SetTicky(); can->SetTickx(); can->RedrawAxis(); }
void ATLAS_LABEL(Double_t x,Double_t y,Color_t color, std::string extra) { TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); l.SetNDC(); l.SetTextFont(72); l.SetTextColor(color); l.DrawLatex(x,y, ("ATLAS " + extra ).c_str()); }
void mySmallText(Double_t x,Double_t y,Color_t color,char *text) { Double_t tsize=0.044; TLatex l; l.SetTextSize(tsize); l.SetNDC(); l.SetTextColor(color); l.DrawLatex(x,y,text); }
void drawPlots::myText(Double_t x,Double_t y,Color_t color,char *text) { TLatex l; //l.SetTextAlign(12); // l.SetTextSize(size); l.SetNDC(); l.SetTextColor(color); l.DrawLatex(x,y,text); }
// *************************************** // // draw the ATLAS label // // *************************************** // void drawPlots::ATLAS_LABEL(Double_t x,Double_t y,Color_t color) { TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); l.SetNDC(); l.SetTextFont(72); l.SetTextColor(color); l.DrawLatex(x,y,"ATLAS"); }
void myText(Double_t x,Double_t y,Color_t color, const char *text) { //Double_t tsize=0.05; TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); l.SetNDC(); l.SetTextColor(color); l.DrawLatex(x,y,text); }
TLatex* NewLatex() { TLatex *latex = new TLatex; latex->SetNDC(kTRUE); latex->SetTextSize(0.06); latex->SetTextColor(kRed); return latex; }
void comphh(Int_t run, TH1F* h1, TH1F* h2) { TFile* f = new TFile(Form("hodtest_%d.root",run)); cout << "hcana root file " << Form("hodtest_%d.root",run) << endl; TCanvas *c1 = new TCanvas("c1", "h1 vs h2", 1000, 667); // gPad->SetLogy(); h1->SetFillColor(kGreen); h1->SetLineColor(kGreen); h1->Draw(); h2->SetLineColor(kBlue); h2->SetFillStyle(0); h2->SetLineWidth(2); h2->Draw("same"); TLatex l; l.SetTextSize(0.04); Float_t maxy = h1->GetBinContent(h1->GetMaximumBin()); Float_t xmin = h1->GetXaxis()->GetXmin(); Float_t xmax = h1->GetXaxis()->GetXmax(); Float_t xt = xmin + 0.75*(xmax-xmin); l.SetTextColor(kGreen); l.DrawLatex(xt,0.65*maxy,"h1"); l.SetTextColor(kBlue); l.DrawLatex(xt,0.75*maxy,"h2"); // Difference between the histograms. TCanvas *c2 = new TCanvas("c2", "Epr differences", 1000, 667); TH1F* dif = h2->Clone(); dif->Add(h2,h1,1.,-1.); dif->SetTitle("Difference"); dif->SetFillColor(kRed); dif->SetLineColor(kRed); dif->SetLineWidth(1); dif->SetFillStyle(1111); dif->Draw(); }
TLatex* AddLabel(const char*txt,float x,float y,int color,float size) { TLatex* lt = new TLatex(x,y,txt); lt->SetNDC(); lt->SetTextColor(color); lt->SetTextSize(size); lt->Draw(); return lt; }
void drawText(const char *text, float xp, float yp, int textSize=20){ TLatex *tex = new TLatex(xp,yp,text); tex->SetTextFont(43); tex->SetTextSize(textSize); tex->SetTextColor(kBlack); tex->SetLineWidth(1); tex->SetNDC(); tex->Draw(); }
void ATLASLabel(Double_t x,Double_t y,const char* text,Color_t color) { TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); l.SetNDC(); l.SetTextFont(72); l.SetTextColor(color); double delx = 0.115*696*gPad->GetWh()/(472*gPad->GetWw()); l.DrawLatex(x,y,"ATLAS"); if (text) { TLatex p; p.SetNDC(); p.SetTextFont(42); p.SetTextColor(color); p.DrawLatex(x+delx,y,text); // p.DrawLatex(x,y,"#sqrt{s}=900GeV"); } }
void add_plot_label( char* label, double x, double y, double size = 0.05, int color = 1, int font = 62, int align = 22 ){ TLatex *latex = new TLatex( x, y, label ); latex->SetNDC(); latex->SetTextSize(size); latex->SetTextColor(color); latex->SetTextFont(font); latex->SetTextAlign(align); latex->Draw(); }
//------------------------------------------------------------// // Make TLatex //------------------------------------------------------------// TLatex* makeLatex() { TLatex* lat = new TLatex(); lat->SetTextSize(0.04); lat->SetTextFont(42); lat->SetTextColor(kBlack); lat->SetNDC(); return lat; }
void drawText(const char *text, float xp, float yp){ TLatex *tex = new TLatex(xp,yp,text); tex->SetTextFont(63); tex->SetTextSize(17); //tex->SetTextSize(0.05); tex->SetTextColor(kBlack); tex->SetLineWidth(1); tex->SetNDC(); tex->Draw(); }
TLatex* drawLatex(Double_t x, Double_t y, char* text, Int_t textFont, Double_t textSize, Int_t colorIndex) { TLatex *latex = new TLatex(x,y,text); latex->SetNDC(); latex->SetTextFont(textFont); latex->SetTextSize(textSize); latex->SetTextColor(colorIndex); latex->Draw("same"); return latex; }
void text_write() { for( size_t ii=0; ii<ntxt; ii++ ) { TLatex latex; if( txtNDC[ii] ) latex.SetNDC(); latex.SetTextFont(txtFont[ii]); latex.SetTextSize(txtSize[ii]); latex.SetTextColor(txtColor[ii]); latex.SetTextAlign(txtAlign[ii]); latex.DrawLatex(txtX[ii],txtY[ii],txt[ii].c_str()); } }
void postprocess(TCanvas* c2, const char* name, Int_t rWrite, Int_t rPerformance) { if (rPerformance){ TLatex *alice = new TLatex(0.65,0.47,"Performance"); alice->SetNDC(); alice->SetTextColor(myDarkRed); alice->SetTextFont(42); alice->SetTextSize(0.05); alice->SetLineWidth(2); alice->Draw(); TLatex *alice2 = new TLatex(0.62,0.41,"LHC10h - Pass2"); alice2->SetNDC(); alice2->SetTextColor(myDarkRed); alice->SetTextFont(42); alice2->SetTextSize(0.05); alice2->SetLineWidth(2); alice2->Draw(); TText *date = new TText(0.68,0.35,cStamp2); date->SetNDC(); date->SetTextFont(42); date->SetTextSize(0.04); date->Draw(); //Acquire canvas proportions Double_t AliLogo_LowX = 0.67; Double_t AliLogo_LowY = 0.53; Double_t AliLogo_Height = 0.22; //ALICE logo is a png file that is 821x798 pixels->should be wider than a square Double_t AliLogo_Width = (821./798.) * AliLogo_Height * gPad->GetWh() / gPad->GetWw(); TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",AliLogo_LowX,AliLogo_LowY,AliLogo_LowX+AliLogo_Width,AliLogo_LowY+AliLogo_Height); // myPadLogo->SetFillColor(2); // color to first figure out where is the pad then comment ! myPadSetUp(myPadLogo,0,0,0,0); //myPadLogo->SetFixedAspectRatio(1); myPadLogo->Draw(); myPadLogo->cd(); TASImage *myAliceLogo = new TASImage("alice_logo_transparent.png"); myAliceLogo->Draw(); } if (rWrite == 1) c2->SaveAs(Form("%s.png",name)); if (rWrite == 2) c2->SaveAs(Form("%s.eps",name)); }
void ATLASVersion(char* version,Double_t x,Double_t y,Color_t color) { if (version) { char versionString[100]; sprintf(versionString,"Version %s",version); TLatex l; l.SetTextAlign(22); l.SetTextSize(0.04); l.SetNDC(); l.SetTextFont(72); l.SetTextColor(color); l.DrawLatex(x,y,versionString); } }
void ATLASLabel(Double_t x,Double_t y, bool Preliminary) { float fTextScaleFactor=0.8; TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); float siz=l.GetTextSize(); l.SetTextSize(siz*fTextScaleFactor); // set the size here l.SetNDC(); l.SetTextFont(72); l.SetTextColor(1); double delx = 0.115*696*gPad->GetWh()/(472*gPad->GetWw()); l.DrawLatex(x,y,"ATLAS"); if (Preliminary) { TLatex p; siz=p.GetTextSize(); p.SetTextSize(siz*fTextScaleFactor); // set the size here p.SetNDC(); p.SetTextFont(42); p.SetTextColor(1); // p.DrawLatex(x+delx-.03,y,"Preliminary"); p.DrawLatex(x+delx,y,"Internal"); } }
void spectra_mw(const char *prefix = "pt/PhiNsigma_KTPCnsig30_STD2010_00_DEFAULT_00") { TGraphErrors *g = ReadMWGraph(Form("%s/mass", prefix), 1); g->Draw("ACP"); TLatex latex; latex.SetTextFont(42); latex.SetTextAlign(12); latex.SetTextSize(0.03); latex.SetTextColor(kBlue+1); latex.DrawLatex(1.2, 1.01877, "MC generated"); latex.SetTextColor(kGreen+1); latex.DrawLatex(1.2, 1.01877-0.00015, "MC reconstructed"); latex.SetTextColor(kRed+1); latex.DrawLatex(1.2, 1.01877-2*0.000155, "Real data (uncorrected)"); latex.SetTextColor(kBlack); latex.DrawLatex(1.2, 1.01877-3*0.00016, "Real data (corrected)"); gPad->Print(Form("%s.pdf", g->GetName())); gPad->Clear(); gPad->SetLogy(0); TGraphErrors *g = ReadMWGraph(Form("%s/mass", prefix), 3); g->Draw("AP"); latex.SetTextAlign(22); latex.SetTextSize(0.04); latex.SetTextColor(kBlack); latex.DrawLatex(2.0, 1.0207, "pp @ #sqrt{s} = 2.76 TeV"); latex.DrawLatex(2.0, 1.0205, "TPC 3.0 #sigma"); latex.DrawLatex(2.0, 1.0202, "#phi #rightarrow K^{ +} K^{ -}"); latex.SetTextSize(0.035); latex.DrawLatex(1.7, 1.0182, "uncertainties: stat. (bars) & syst. (boxes)"); gPad->Print(Form("%s.pdf", g->GetName())); gPad->Clear(); TGraphErrors *g = ReadMWGraph(Form("%s/width", prefix), 2); g->Draw("AP"); TLatex latex; latex.SetTextAlign(22); latex.SetTextSize(0.04); latex.SetTextColor(kBlack); latex.DrawLatex(1.7, 0.0090, "pp @ #sqrt{s} = 2.76 TeV"); latex.DrawLatex(1.7, 0.0085, "TPC 3.0 #sigma"); latex.DrawLatex(1.7, 0.0077, "#phi #rightarrow K^{ +} K^{ -}"); latex.SetTextSize(0.035); latex.DrawLatex(1.7, 0.0007, "uncertainties: stat. (bars) & syst. (boxes)"); gPad->Print(Form("%s.pdf", g->GetName())); // gPad->Clear(); // gPad->SetLogy(); // TGraphErrors *g = ReadPtGraphSys("pt/out.txt"); // if (!g) return; // g->Draw("AP"); // gPad->Print(Form("%s.pdf", g->GetName())); }
TF1* fit_xy_res(double &x, double &xe, double &max, bool do_fit, int idel, int ipad, TCanvas *tc, TH1F* h, const char *meth, const char *var_tag, const char *det_tag, const char *var, const char *det_desc) { tc->cd(1+ipad); //cout << "var_tag = " << var_tag << endl; TLatex *tt = new TLatex(); tt->SetTextSize(0.08); tt->SetTextColor(4); tt->SetNDC(true); double fmx = 2.2; double fit_min= h->GetMean()-fmx*h->GetRMS(); double fit_max= h->GetMean()+fmx*h->GetRMS(); TF1* f = new TF1(Form("fxres_%s_%d_%s",det_tag,idel,meth), "gaus",fit_min,fit_max); if (do_fit) { h->Fit(f,"R+Q"); x = f->GetParameter(2); xe = f->GetParError(2); if (f->GetParameter(1) < f->GetParError(1)) cout << " OK: "; else cout << " OOPS: "; cout << var_tag << " " << meth << " " << det_tag << idel; cout << " mean= " << f->GetParameter(1) << " pm " << f->GetParError(1); cout << " sigma= " << f->GetParameter(2) << " pm " << f->GetParError(2) << endl; } else { max = TMath::Max(max, x); h->Draw(); //tt->DrawLatex(0.12,0.15, h->GetTitle()); } tt->DrawLatex(0.65,0.8, meth); tt->DrawLatex(0.65,0.7, var); tt->DrawLatex(0.65,0.6, det_desc); tt->DrawLatex(0.65,0.5, Form("#delta = %d%%",idel-5 )); max = TMath::Max(max, x); gPad->SetGridx(); return f; }
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); } }
// Show the Pt spectra, and start the tree viewer. int showEventSample() { // Load needed libraries loadLibraries(); // Open the file TFile* file = TFile::Open(FILENAME, "READ"); if (!file || !file->IsOpen()) { Error("showEventSample", "Couldn;t open file %s", FILENAME); return 1; } // Get the tree TTree* tree = (TTree*)file->Get(TREENAME); if (!tree) { Error("showEventSample", "couldn't get TTree %s", TREENAME); return 2; } // Start the viewer. tree->StartViewer(); // Get the histogram TH1D* hist = (TH1D*)file->Get(HISTNAME); if (!hist) { Error("showEventSample", "couldn't get TH1D %s", HISTNAME); return 4; } // Draw the histogram in a canvas gStyle->SetOptStat(1); TCanvas* canvas = new TCanvas("canvas", "canvas"); canvas->SetLogy(); hist->Draw("e1"); TF1* func = hist->GetFunction("expo"); char expression[64]; sprintf(expression,"T #approx %5.1f", -1000 / func->GetParameter(1)); TLatex* latex = new TLatex(1.5, 1e-4, expression); latex->SetTextSize(.1); latex->SetTextColor(4); latex->Draw(); return 0; }
void MakeLabels( TH2F* frame ) { // write labels TString labels[] = { "CDF-I", "D0-I", "CDF-II", "LEP-II", "NuTeV" }; TLatex* text = new TLatex; text->SetTextAlign( 32 ); text->SetTextSize( frame->GetLabelSize( "Y" ) ); Float_t dy = (frame->GetYaxis()->GetXmax() - frame->GetYaxis()->GetXmin())/5.; Float_t dx = frame->GetXaxis()->GetXmax() - frame->GetXaxis()->GetXmin(); Float_t yy = frame->GetYaxis()->GetXmin() - 0.5*dy; for (Int_t i=5-1; i>=0; i--) { text->SetTextColor( 1 ); text->DrawLatex( frame->GetXaxis()->GetXmin(), yy += dy, labels[i] + " " ); } frame->AppendPad(); }