当前位置: 首页>>代码示例>>C++>>正文


C++ TLatex::DrawLatex方法代码示例

本文整理汇总了C++中TLatex::DrawLatex方法的典型用法代码示例。如果您正苦于以下问题:C++ TLatex::DrawLatex方法的具体用法?C++ TLatex::DrawLatex怎么用?C++ TLatex::DrawLatex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TLatex的用法示例。


在下文中一共展示了TLatex::DrawLatex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawPlots

void DrawPlots(TString fn="rootplots/ttbar_partonLevel_histos_"+run+".root") {
  TFile *f = TFile::Open(fn);
  if (f==NULL) fatal("Cannot open file "+fn);
  
  TString pdf("Pdfs/top_plot_"+run+".pdf");
  c = new TCanvas();

  c->Print(pdf+"[");

  //divide canvas into quadrants
    c->Divide(2,2);

    TLatex tex; tex.SetNDC();
    tex.DrawLatex(0.35,0.49,"Leptonic pseudotop");
    c->cd(1); GetHisto(f,"pseudo_mass_matched")->Draw("e1");
    c->Update();

    c->cd(2); GetHisto(f,"pseudo_mass_unmatched")->Draw("e1");
    c->Update();

    c->cd(3); GetHisto(f,"pseudo_pt_matched")->Draw("e1 ");
    c->Update();

    c->cd(4); GetHisto(f,"pseudo_pt_unmatched") ->Draw("e1 ");
    c->Print(pdf);



    c->cd(1); GetHisto(f,"pseudo_eta_matched")->Draw("e1 ");
    c->Update();

    c->cd(2); GetHisto(f,"pseudo_eta_unmatched")->Draw("e1 ");

    c->Update();

    c->cd(3); GetHisto(f,"whadronic")->Draw("e1 y+ ");
    c->Update();

    c->cd(4); GetHisto(f,"wleptonic")->Draw("e1");
    c->Print(pdf);


    c->cd(1); GetHisto(f,"m_top")->Draw("e1");

    c->cd(2); GetHisto(f,"eta_top")->Draw("e1 c ");

    c->cd(3); GetHisto(f,"pt_top") ->Draw("e1 ");

    c->cd(4); GetHisto(f,"y_top")->Draw("e1 ");
    c->Print(pdf);



    c->cd(1); GetHisto(f,"eff_vs_topPt")->Draw("e1 ");

    c->cd(2); GetHisto(f,"neff_vs_topPt")->Draw("e1  ");

    c->cd(3); GetHisto(f,"eff_vs_topMass") ->Draw("e1 ");

    c->cd(4); GetHisto(f,"eff_vs_topeta") ->Draw("e1");
    c->Print(pdf);


    c->cd(1); GetHisto(f,"pseudo_btop_mass")->Draw("e1 ");

    c->cd(2); GetHisto(f,"pseudo_HW_top")->Draw("e1 ");

    c->cd(3); GetHisto(f,"pseudb")->Draw("e1");

    c->cd(4); GetHisto(f,"eff_vs_bmass")->Draw("e1");
    c->Print(pdf);

    c->Print(pdf+"]");


  }
开发者ID:bigrabbit1998,项目名称:Analysis,代码行数:76,代码来源:DrawPlots.C

示例2: sanityChecker_babies


//.........这里部分代码省略.........
  // char* labels[n] = {"S*_{T} < 0.5 TeV",
  // 		     "S*_{T} 0.5-1.0 TeV",
  // 		     "S*_{T} 1.0-1.6 TeV",
  // 		     "S*_{T} 1.6-2.4 TeV",
  // 		     "S*_{T} > 2.4 TeV"
  // };

  // char* filename = "plots/tj-ST.pdf";

  // //-------------------------------
  // // tW filenames and labels
  // //-------------------------------

  // const unsigned int n = 5;

  // char* names[n] = {Form("tB-4p-0-500-v1510_14TEV_%s_%s_%s"       , phase , config , PU ) ,
  // 		    Form("tB-4p-500-900-v1510_14TEV_%s_%s_%s"     , phase , config , PU ) ,
  // 		    Form("tB-4p-900-1500-v1510_14TEV_%s_%s_%s"    , phase , config , PU ) ,
  // 		    Form("tB-4p-1500-2200-v1510_14TEV_%s_%s_%s"   , phase , config , PU ) ,
  // 		    Form("tB-4p-2200-100000-v1510_14TEV_%s_%s_%s" , phase , config , PU )  
  // };

  // char* labels[n] = {"S*_{T} < 0.5 TeV",
  // 		     "S*_{T} 0.5-0.9 TeV",
  // 		     "S*_{T} 0.9-1.5 TeV",
  // 		     "S*_{T} 1.5-2.2 TeV",
  // 		     "S*_{T} > 2.2 TeV"
  // };

  // char* filename = "plots/tB-ST.pdf";

  //--------------------------------------------
  // NO NEED TO MODIFY ANYTHING BELOW HERE
  //--------------------------------------------

  TChain* chains[n];
  //TFile* files[n];

  int   colors[7] = { 2 , 3 , 4 , 5 , 6 , 7 , 8 };

  // need double precision here for largest samples!! 
  TH1D* hst[n];
  TH1D* hstlo[n];

  THStack* htstack = new THStack();

  TLegend *leg = new TLegend(0.5,0.5,0.8,0.8);

  cout << endl << endl;
  cout << "Printing out yields in 1/fb using cross sections from:" << endl;
  cout << "https://twiki.cern.ch/twiki/bin/viewauth/CMS/HiggsWG/Phase2UpgradeStudies#Background_samples" << endl;
  cout << "The unweighted yields should match the cross sections on this page (X1000)." << endl;
  cout << "The weighted yields have the additional Event.Weight applied." << endl;

  for( int i = 0 ; i < n ; i++ ){

    chains[i] = new TChain("t");
    chains[i]->Add(Form("output/%s/%s_baby.root",version,names[i]));

    hst[i]   = new TH1D("hst"  ,"weighted S_{T} [GeV]",100,0,10000);
    hstlo[i] = new TH1D("hstlo","unweighted S_{T} [GeV]",100,0,10000);

    chains[i]->Draw("st>>hst"  ,"weight*genweight");
    chains[i]->Draw("st>>hstlo","weight");

    hst[i]->SetFillColor(colors[i]);
    hst[i]->Rebin(rebin);
    hst[i]->SetMinimum(1);

    cout << endl;
    cout << "1 pb yields for sample " << names[i] << endl;
    cout << "Unweighted yield  " << hstlo[i]->Integral() << endl;
    cout << "Weighted yield    " << hst[i]->Integral() << endl;

    hst[i]->GetXaxis()->SetTitle("S_{T} [GeV]");
    hst[i]->GetYaxis()->SetTitle("events");

    leg->AddEntry( hst[i] , labels[i] , "lf" );

    htstack->Add(hst[i]);
  }

  TCanvas *c2 = new TCanvas("c2","c2",1200,600);
  c2->cd();
  gStyle->SetOptStat(0);

  gPad->SetLogy();
  htstack->Draw();
  htstack->GetXaxis()->SetTitle("S_{T} [GeV]");
  htstack->GetYaxis()->SetTitle("events");

  TLatex *t = new TLatex();
  t->SetNDC();
  t->DrawLatex(0.5,0.85,"14 TeV, L = 1 pb^{-1}");

  leg->SetBorderSize(0);
  leg->SetFillColor(0);
  leg->Draw();

}
开发者ID:olivito,项目名称:phase2,代码行数:101,代码来源:sanityChecker_babies.C

示例3: draw_light

void draw_light(){
	gStyle->SetOptStat(0);
    TCanvas* c1= new TCanvas("c1","c1");
    TLatex b;
    TLatex res;
  	TFile* f1=NULL;TFile* f2=NULL; 
	TH1F *h1=NULL;TH1F *h2=NULL;TGraphAsymmErrors *h5=NULL;TGraphAsymmErrors *h4=NULL;
//	 f1=new TFile("../rootfiles/mc2dstd_EBEB__DiPhoJets.root","read");
 	// f1=new TFile("../forroofit/mc2dpp_fulletarange.root","read");
 	 f1=new TFile("../forroofit/mc2dpp_fulletarange_madgraph.root","read");
//	 f1=new TFile("../forroofit/mc1f1p_fulletarange.root","read");
	 f2=new TFile("../forroofit/mc2dpp_fulletarange.root","read");
//	f2=new TFile("../rootfiles/mc1p1f_EBEB__.root","read");
	assert(f1);assert(f2);
    if(iso){
	   h1=(TH1F*)f1->Get("h_iso");
	   h2=(TH1F*)f2->Get("h_isogen");
	   TLegend* leg = new TLegend(0.55, 0.65, .9, .9);
	   b.SetNDC();b.SetTextSize(0.06);b.SetTextColor(kRed);
	   b.DrawLatex(0.55,0.5,"PRELIMINARY");
	   c1->cd();
	   if(logplot){
			c1->SetLogy();
		}   
	   c1->SetGridx();
	   h1->SetMarkerColor(kBlue+1);h1->SetLineColor(kBlue+1);h1->SetMarkerStyle(20);
	//   h1->SetTitle("both photons in EB, true pp photons in DiPhotonBox+ DiPhotonJets madgraph");  
	     h1->SetTitle("EBEB, fake photon from Gamma Jets, true photon from DiPhotonBox+ DiPhotonJets madgraph");  
	     h1->GetXaxis()->SetTitle("Charged Iso (GeV)");
	   h2->SetMarkerColor(kRed+1);h2->SetLineColor(kRed+1); h2->SetMarkerStyle(20);
	   h1->Draw();
	   h2->Draw("SAME");
	   leg->AddEntry(h1,"true p with h2gg vertex" ,"p");
	   leg->AddEntry(h2,"true f with primary vertex", "p");
	   leg->Draw();
	}
	if(eff){
	  c4= new TCanvas("c4","c4");
      c4->cd();
//	   TCanvas* c2= (TCanvas*)f1->Get("eff_h2ggv_diphopt");
	   h4=(TGraphAsymmErrors*)f1->Get("eff_h2ggv_diphopt");
	   h5=(TGraphAsymmErrors*)f1->Get("eff_pv_diphopt");
	 //  TCanvas* c3= (TCanvas*)f1->Get("eff_pv_diphopt");
	  // h5=(TGraphAsymmErrors*)f1->GetPrimitive("eff_pv_diphopt");
	   TLegend* leg2 = new TLegend(0.12, 0.12, .4, .2);
      leg2->SetFillColor(kWhite);
      
	   c4->SetGridx();
	   h4->SetMarkerColor(kBlue+1);h4->SetLineColor(kBlue+1);h4->SetMarkerStyle(20);
	   //h4->GetXaxis()->SetRangeUser(0.,500.);
	   h5->SetMarkerColor(kRed+1);h5->SetLineColor(kRed+1);h5->SetMarkerStyle(20);
	   //h4->SetTitle("both photons in EB, true pp photons in DiPhotonBox+ DiPhotonJets madgraph");h4->GetXaxis()->SetTitle("Diphoton pt (GeV)"); 
	  // h4->SetTitle("true pp photons in DiPhotonBox+ Jets Sherpa, matching within 1 cm in z");h4->GetXaxis()->SetTitle("Diphoton pt (GeV)"); 
	  // h4->SetTitle("1 true 1 fake photon in GJets MC, matching within 1 cm in z");h4->GetXaxis()->SetTitle("Diphoton pt (GeV)"); 
	   h4->SetTitle("true pp photons in DiPhotonBox+ Jets madgraph, matching within 1 cm in z");h4->GetXaxis()->SetTitle("Diphoton pt (GeV)"); 
	   c4->Draw();
        h4->Draw("AP");
	   h5->Draw("P SAME");
	   leg2->AddEntry(h4,"vertex by legacy algorithm" ,"p");
	   leg2->AddEntry(h5,"primary vertex", "p");
	   leg2->Draw();
	   b.SetNDC();b.SetTextSize(0.06);b.SetTextColor(kRed);
       b.DrawLatex(0.12,0.4,"PRELIMINARY");
 	   res.SetNDC();res.SetTextSize(0.04);res.SetTextColor(kBlack);
     //  res.DrawLatex(0.12,0.3,"hggv eff 0.75, pv eff 0.53");
   //     res.DrawLatex(0.12,0.3,"hggv eff 0.79, pv eff 0.65");
       res.DrawLatex(0.12,0.3,"hggv eff 0.77, pv eff 0.62");
       c4->Update();
	}
	  /////////////////////////////
		   

//Save
    const char* outfileiso=Form("../plots/1p1f2ppisolation_pvvertex_comp_EB_%s.root", ((logplot)? "log" : "lin"));  c1->SaveAs(outfileiso);  
   const char* outfileiso2=Form("../plots/1p1f2ppisolation_pvvertex_comp_EB_%s.pdf", ((logplot)? "log" : "lin"));  c1->SaveAs(outfileiso2);
   if(eff){	const char* outfileeff="../plots/efficiency_vertex_comp_madgraph_fulletarange.root";  c4->SaveAs(outfileeff);
   	   const char* outfileeff2="../plots/efficiency_vertex_comp_madgraph_fulletarange.png";  c4->SaveAs(outfileeff2);}

}
开发者ID:quittnat,项目名称:light_diphoton,代码行数:79,代码来源:vertex_plot.C

示例4: if

PostProcessQAV0(Bool_t lAttemptInvMassFit = kTRUE,
                Char_t *output            = "pdf"                          // "eps", "png" or "pdf"
               ){


  CustomGStyleSettings();  

  //==============================================================
  //Open Output File
  TFile* file = TFile::Open("AnalysisResults.root"), "READ");
  if (!file){
    cout<<"Output file not found!"<<endl;
    return;
  }
	file->cd("PWGLFQAV0_QA");
	TList* clist  = (TList*)file->FindObjectAny("clist");
  if (!clist){
    cout<<"File does not seem to hold QA list output!"<<endl;
    return;
  }  
  //==============================================================

  //==============================================================
  //Open Event Histogram: first canvas
  TH1D* fHistEvent = (TH1D*)clist->FindObject("fHistEvent");
  TCanvas *cHistEvent = new TCanvas("cHistEvent","",800,670); 
  cHistEvent->SetTopMargin(0.15);
  cHistEvent->SetGridx(); 
  cHistEvent->SetGridy();
  fHistEvent->Draw();

  fHistEvent->SetMarkerSize(1.35);
  fHistEvent->GetXaxis()->SetTitleOffset(1.2);
  fHistEvent->GetYaxis()->SetTitleOffset(1.2);
  fHistEvent->Draw("same text00");

  TLatex Tl;
  Tl.SetNDC();
  Tl.SetTextSize(0.05);
  Tl.DrawLatex(.35, .9277, "Event Counters")  ;  
  if      (output == "png") cHistEvent->SaveAs("LF_QAanalysis_V0_page1.png");  
  else if (output == "eps") cHistEvent->SaveAs("LF_QAanalysis_V0_page1.eps");
  else if (output == "pdf") cHistEvent->SaveAs("LF_QAanalysis_V0.pdf(");    

  //==============================================================

  //==============================================================
  //Invariant Mass Plots: Base, no dE/dx
  /*
  TH2D *f2dHistInvMassK0Short    = (TH2D*)clist->FindObject("f2dHistInvMassK0Short");
  TH2D *f2dHistInvMassLambda     = (TH2D*)clist->FindObject("f2dHistInvMassLambda");
  TH2D *f2dHistInvMassAntiLambda = (TH2D*)clist->FindObject("f2dHistInvMassAntiLambda");
    
  f2dHistInvMassK0Short     -> Scale ( 1. / ((Double_t)fHistEvent->GetBinContent(4) ) );
  f2dHistInvMassLambda      -> Scale ( 1. / ((Double_t)fHistEvent->GetBinContent(4) ) );
  f2dHistInvMassAntiLambda  -> Scale ( 1. / ((Double_t)fHistEvent->GetBinContent(4) ) );

  TCanvas *cInvMassK0Short = new TCanvas ( "cInvMassK0Short", "", 1200,800); 
  cInvMassK0Short->Divide(1,2); 
  cInvMassK0Short->cd(2)->Divide(3,1); 
  cInvMassK0Short->cd(1); 
  cInvMassK0Short->cd(1)->SetLogz();
  cInvMassK0Short->cd(1)->SetLeftMargin(0.065);
  cInvMassK0Short->cd(1)->SetTopMargin(0.13);
  cInvMassK0Short->cd(1)->SetBottomMargin(0.11);

  f2dHistInvMassK0Short->GetYaxis()->SetTitleSize(0.05);
  f2dHistInvMassK0Short->GetYaxis()->SetTitleOffset(0.6);
  f2dHistInvMassK0Short->GetXaxis()->SetTitleSize(0.05);
  f2dHistInvMassK0Short->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  f2dHistInvMassK0Short->GetZaxis()->SetTitle("Counts / Event");
  f2dHistInvMassK0Short->GetZaxis()->SetTitleOffset(0.7);
  f2dHistInvMassK0Short->GetZaxis()->SetRangeUser( f2dHistInvMassK0Short->GetMinimum(1e-10)*0.9, f2dHistInvMassK0Short->GetMaximum()*1.2 );
  f2dHistInvMassK0Short->Draw("colz");
  Tl.DrawLatex(.35, .9277, "Mass under K^{0}_{S} hypothesis, no TPC dE/dx")  ;   

  TH1D *fLowPtK0ShortSample = (TH1D*) f2dHistInvMassK0Short->ProjectionY( "fLowPtK0ShortSample", 
    f2dHistInvMassK0Short->GetXaxis()->FindBin(0.5001),
    f2dHistInvMassK0Short->GetXaxis()->FindBin(0.9999) );

  TH1D *fMidPtK0ShortSample = (TH1D*) f2dHistInvMassK0Short->ProjectionY( "fMidPtK0ShortSample", 
    f2dHistInvMassK0Short->GetXaxis()->FindBin(1.5001),
    f2dHistInvMassK0Short->GetXaxis()->FindBin(2.4999) );

  TH1D *fHiPtK0ShortSample = (TH1D*) f2dHistInvMassK0Short->ProjectionY( "fHiPtK0ShortSample", 
    f2dHistInvMassK0Short->GetXaxis()->FindBin(5.0001),
    f2dHistInvMassK0Short->GetXaxis()->FindBin(9.9999) );

  for(Int_t ic = 1; ic<4; ic++){ 
    cInvMassK0Short->cd(2)->cd(ic)->SetTopMargin(0.14);
    cInvMassK0Short->cd(2)->cd(ic)->SetLeftMargin(0.15);
    cInvMassK0Short->cd(2)->cd(ic)->SetBottomMargin(0.11);
    cInvMassK0Short->cd(2)->cd(ic)->SetGridx(); 
    cInvMassK0Short->cd(2)->cd(ic)->SetGridy();
  }

  cInvMassK0Short->cd(2)->cd(1); 
  fLowPtK0ShortSample->GetXaxis()->SetTitleOffset(1.1);
  fLowPtK0ShortSample->GetYaxis()->SetTitleOffset(2.33);
  fLowPtK0ShortSample->GetYaxis()->SetTitle("Counts/Event");
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:PostProcessQAV0.C

示例5: example_plot

TCanvas* example_plot( int iPeriod, int iPos, bool t, int nt,double miPt, double maPt,string c,string hname, string lbl1, string lbl2,string lbl3 )
{ 
  //  if( iPos==0 ) relPosX = 0.12;

  int W = 800;
  int H = 600;

  int H_ref = 600; 
  int W_ref = 800; 

  // references for T, B, L, R
  float T = 0.08*H_ref;
  float B = 0.12*H_ref; 
  float L = 0.12*W_ref;
  float R = 0.04*W_ref;

  TString canvName = "FigMass_";
  canvName += W;
  canvName += "_";
  canvName += H;
  canvName += "_";  
  canvName += iPeriod;
  if( writeExtraText ) canvName += "_prelim";
  if( iPos%10==0 ) canvName += "_out";
  else if( iPos%10==1 ) canvName += "_left";
  else if( iPos%10==2 )  canvName += "_center";
  else if( iPos%10==3 )  canvName += "_right";

  TCanvas* canv = new TCanvas(canvName,canvName,50,50,W,H);
  canv->SetFillColor(0);
  canv->SetBorderMode(0);
  canv->SetFrameFillStyle(0);
  canv->SetFrameBorderMode(0);
  canv->SetLeftMargin( L/W );
  canv->SetRightMargin( R/W );
  canv->SetTopMargin( T/H );
  canv->SetBottomMargin( B/H );
  canv->SetTickx(0);
  canv->SetTicky(0);
 
  fit(4,t,nt,miPt,maPt,c);
//  fit(4,1,32,"Mass>8.6 && Mass<11.0 && TMath::Abs(EtaMuP)<1.2 && TMath::Abs(EtaMuM)<1.2 && Rapidity<1.2 ");
  
    {
    TLatex latex;

    int n_ = 3;
    float x1_l = 0.95;
    float y1_l = 0.70;

    float dx_l = 0.37;
    float dy_l = 0.23;
    float x0_l = x1_l-dx_l;
    float y0_l = y1_l-dy_l;

    TPad* legend = new TPad("legend_0","legend_0",x0_l,y0_l,x1_l, y1_l );
    //    legend->SetFillColor( kGray );
    legend->Draw();
    legend->cd();
    float gap_ = 1./(n_+1);
    float bwx_ = 0.12;

    x_l[0] = 1.2*bwx_;
    y_l[0] = 1-gap_;

    latex.SetTextFont(42);
    latex.SetTextAngle(0);
    latex.SetTextColor(kBlack);
    latex.SetTextSize(0.20);
    latex.SetTextAlign(12);

    float xx_ = x_l[0];
    float yy_ = y_l[0];
    //latex.DrawLatex(xx_+1.*bwx_,yy_,"#sigma = 26.5 #pm 2.2 MeV");
    //latex.DrawLatex(xx_+1.*bwx_,yy_,"#sigma = 13 MeV");
//    latex.DrawLatex(xx_+0.5*bwx_,yy_,"#sqrt{f_{1}#sigma_{1}^{2}+f_{2}#sigma_{2}^{2}} = 110 MeV");
   latex.DrawLatex(xx_+0.5*bwx_,yy_,lbl1.c_str());
    yy_ -= gap_;
//    latex.DrawLatex(xx_+0.5*bwx_,yy_,"p_{T}^{#mu^{+}#mu^{-}} > 13 GeV");
    latex.DrawLatex(xx_+0.5*bwx_,yy_,lbl2.c_str());
    yy_ -= gap_;
    latex.DrawLatex(xx_+0.5*bwx_,yy_,lbl3.c_str());
   // latex.DrawLatex(xx_+1.*bwx_,yy_,"|#eta_{#mu}| < 0.5");

    canv->cd();
  }
  // writing the lumi information and the CMS "logo"
  CMS_lumi( canv, iPeriod, iPos );

  canv->Update();
  canv->RedrawAxis();
  canv->GetFrame()->Draw();

  string hn="Plots/"+hname+".pdf";
  string hnpng ="Plots/"+hname+".png";
  canv->SaveAs(hn.c_str());
  canv->SaveAs(hnpng.c_str());
//  canv->Print(hname+".png",".png");

  return canv;
//.........这里部分代码省略.........
开发者ID:CmsHI,项目名称:upsilonFits,代码行数:101,代码来源:PlotMass.C

示例6: Warning


//.........这里部分代码省略.........
    p->SetLogy();
  }
  p->SetLogz();
  h->Draw("colz");

  TObjArray* fits = new TObjArray;
  h->FitSlicesY(0, 1, -1, 0, "QN", fits);

  TF1* mean = new TF1("mean", "pol1");
  TF1* var  = new TF1("var", "pol1");
  // mean->FixParameter(0, 0);
  // var->FixParameter(0, 0);
  for (Int_t i = 0; i < 3; i++) { 
    p = c->cd(2+i);
    if (spd) { 
      p->SetLogx();
      p->SetLogy();
    }
    TH1* hh = static_cast<TH1*>(fits->At(i));
    hh->Draw();

    if (i == 0) continue;
    
    hh->Fit((i == 1? mean : var), "+Q");
    
  }

  TGraphErrors* g1 = new TGraphErrors(h->GetNbinsX());
  g1->SetFillColor(kBlue-10);
  g1->SetFillStyle(3001);
  g1->SetLineStyle(1);
  TGraph* u1 = new TGraph(h->GetNbinsX());
  TGraph* l1 = new TGraph(h->GetNbinsX());
  u1->SetLineColor(kBlue+1);
  l1->SetLineColor(kBlue+1);
  u1->SetName("u1");
  l1->SetName("l1");
  TGraphErrors* g2 = new TGraphErrors(h->GetNbinsX());
  g2->SetFillColor(kRed-10);
  g2->SetFillStyle(3001);
  g2->SetLineStyle(2);
  TGraph* u2 = new TGraph(h->GetNbinsX());
  TGraph* l2 = new TGraph(h->GetNbinsX());
  u2->SetLineColor(kRed+1);
  l2->SetLineColor(kRed+1);
  u2->SetName("u2");
  l2->SetName("l2");
  for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
    Double_t x  = hh->GetXaxis()->GetBinCenter(i);
    Double_t y  = mean->Eval(x);
    Double_t e  = var->Eval(y);
    Double_t e1 = nVar * e;
    if (spd) e1 *= TMath::Log10(e);
    // Printf("%10e -> %10e +/- %10e", x, y, ee);
    g1->SetPoint(i-1, x, y);
    g1->SetPointError(i-1, 0, e1);
    u1->SetPoint(i-1, x, y+e1);
    l1->SetPoint(i-1, x, y-e1);
    // Printf("%3d: %f -> %f +/- %f", i, x, y, ee);

    Double_t e2 = nVar*0.05*x;
    g2->SetPoint(i-1, x, x);
    g2->SetPointError(i-1, 0, e2);
    u2->SetPoint(i-1, x, x+e2);
    l2->SetPoint(i-1, x, x-e2);
  }

  p = c->cd(1);
  c->Clear();
  c->cd();
  c->SetLogz();
  h->Draw("colz");
  g1->Draw("3 same");
  u1->Draw("l same");
  l1->Draw("l same");
  g2->Draw("3 same");
  u2->Draw("l same");
  l2->Draw("l same");

  Double_t ly = 0.9;
  Double_t dy = 0.06;
  TLatex* ltx = new TLatex(0.15, ly, Form("#LTy#GT = %f + %f x",
					   mean->GetParameter(0),
					   mean->GetParameter(1)));
  ltx->SetNDC();
  ltx->SetTextSize(dy);
  ltx->SetTextAlign(13);
  ltx->Draw();

  ly -= dy + 0.01;
  ltx->DrawLatex(0.15, ly, Form("#sigma_{y} = %f + %f x", 
				var->GetParameter(0),
				var->GetParameter(1)));
  
  ly -= dy + 0.01;
  ltx->DrawLatex(0.15, ly, Form("#delta = %f #sigma %s", 
				nVar, (spd ? "log_{10}(#sigma" : "")));
	    
					   
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:Outliers.C

示例7: pi0_mfitpeak


//.........这里部分代码省略.........
    


    res[0] = S_all; 
    res[1] = Serr_all; 

    res[2] = parf[1]; 
    res[3] = errparf[1];
    
    res[4] = parf[2]; 
    res[5] = errparf[2];

    res[6] = SB; 
    res[7] = SBerr; 
    


    total->SetLineWidth(3);
    
   total->SetLineColor(kBlue);

   p4bkgfin->SetLineWidth(3);
   
   p4bkgfin->SetLineColor(kRed);
   mh1->DrawCopy("sep");

   //   total->SetRange(0.07,0.185);
   //    p4bkgfin->SetRange(0.07,0.185);
   total->Draw("same");
   p4bkgfin->SetLineStyle(kDashed);
   p4bkgfin->Draw("same");   

   TLatex l;
   
   //   l.SetTextSize(0.06);
   l.SetTextSize(0.05);
   
   
   l.SetTextColor(1);
   l.SetNDC();
   
  
   float sigma = parf[2]/ parf[1]*100; 
   float sigmaerr = errparf[2]/ parf[1]*100; 
   char *sigma_name = new char[50]; 
   if(sigmaerr>0.005)
     sprintf(sigma_name,"#sigma = %3.2f #pm %3.2f %% ",sigma,sigmaerr);
   else sprintf(sigma_name,"#sigma = %3.2f %% ",sigma);
   
   if(posFlag==1){
     l.DrawLatex(0.54,0.75,sigma_name);
   }else if( posFlag==2){
     l.DrawLatex(0.54,0.3,sigma_name);

   }
      
      //  sprintf(sigma_name,"S/B = %3.2f #pm %3.2f ",SB,SBerr);
      //
      sprintf(sigma_name,"S = %2.1f #pm %2.1f",S_all,Serr_all);
	      //
      
      // l.DrawLatex(0.5,0.5,sigma_name);
      
      sprintf(sigma_name,"M = %3.1f #pm %3.1f MeV",parf[1]*1000.,errparf[1]*1000);
      if(posFlag==1){
      l.DrawLatex(0.54,0.82,sigma_name);
      }else if( posFlag==2){
	l.DrawLatex(0.54,0.37,sigma_name);

      }
      ///l.DrawLatex(0.169,470.,"d)");


      c2->Modified();
   c2->Update();
   //   c2->SaveAs("nice_pi0.gif");

   
   
   if( text_x >0 && text_y >0){
    TLatex *   tex = new TLatex(text_x, text_y, texName);
    tex->SetNDC();
    tex->SetTextSize(0.06);
    tex->SetLineWidth(2);
    tex->Draw();
  }
  

   char *filename = new char[1000];

   
   sprintf(filename,"%s/%s.gif",dirName,histName);
   c2->Print(filename);
   sprintf(filename,"%s/%s.C",dirName,histName);
   c2->Print(filename);
   
   // .x pi0_mfitpeak.C ("pi0ana_508030.root","minv_spb",0)
   // .x pi0_mfitpeak.C ("pi0ana_npu.root","minv_bkg",0)  
   // .x pi0_mfitpeak.C ("pi0ana_punormv2.root","minv_spb",0)
}
开发者ID:cmsPizeroCalibration,项目名称:Pi0Analyzer,代码行数:101,代码来源:pi0_mfitpeak_npol_v1.C

示例8: latex4

void latex4() {
   TCanvas *c1 = new TCanvas("greek","greek",600,700);

   TLatex l;
   l.SetTextSize(0.03);

   // Draw the columns titles
   l.SetTextAlign(22);
   l.DrawLatex(0.165, 0.95, "Lower case");
   l.DrawLatex(0.495, 0.95, "Upper case");
   l.DrawLatex(0.825, 0.95, "Variations");

   // Draw the lower case letters
   l.SetTextAlign(12);
   float y, x1, x2;
   y = 0.90; x1 = 0.07; x2 = x1+0.2;
                 l.DrawLatex(x1, y, "alpha : ")   ; l.DrawLatex(x2, y, "#alpha");
   y -= 0.0375 ; l.DrawLatex(x1, y, "beta : ")    ; l.DrawLatex(x2, y, "#beta");
   y -= 0.0375 ; l.DrawLatex(x1, y, "gamma : ")   ; l.DrawLatex(x2, y, "#gamma");
   y -= 0.0375 ; l.DrawLatex(x1, y, "delta : ")   ; l.DrawLatex(x2, y, "#delta");
   y -= 0.0375 ; l.DrawLatex(x1, y, "epsilon : ") ; l.DrawLatex(x2, y, "#epsilon");
   y -= 0.0375 ; l.DrawLatex(x1, y, "zeta : ")    ; l.DrawLatex(x2, y, "#zeta");
   y -= 0.0375 ; l.DrawLatex(x1, y, "eta : ")     ; l.DrawLatex(x2, y, "#eta");
   y -= 0.0375 ; l.DrawLatex(x1, y, "theta : ")   ; l.DrawLatex(x2, y, "#theta");
   y -= 0.0375 ; l.DrawLatex(x1, y, "iota : ")    ; l.DrawLatex(x2, y, "#iota");
   y -= 0.0375 ; l.DrawLatex(x1, y, "kappa : ")   ; l.DrawLatex(x2, y, "#kappa");
   y -= 0.0375 ; l.DrawLatex(x1, y, "lambda : ")  ; l.DrawLatex(x2, y, "#lambda");
   y -= 0.0375 ; l.DrawLatex(x1, y, "mu : ")      ; l.DrawLatex(x2, y, "#mu");
   y -= 0.0375 ; l.DrawLatex(x1, y, "nu : ")      ; l.DrawLatex(x2, y, "#nu");
   y -= 0.0375 ; l.DrawLatex(x1, y, "xi : ")      ; l.DrawLatex(x2, y, "#xi");
   y -= 0.0375 ; l.DrawLatex(x1, y, "omicron : ") ; l.DrawLatex(x2, y, "#omicron");
   y -= 0.0375 ; l.DrawLatex(x1, y, "pi : ")      ; l.DrawLatex(x2, y, "#pi");
   y -= 0.0375 ; l.DrawLatex(x1, y, "rho : ")     ; l.DrawLatex(x2, y, "#rho");
   y -= 0.0375 ; l.DrawLatex(x1, y, "sigma : ")   ; l.DrawLatex(x2, y, "#sigma");
   y -= 0.0375 ; l.DrawLatex(x1, y, "tau : ")     ; l.DrawLatex(x2, y, "#tau");
   y -= 0.0375 ; l.DrawLatex(x1, y, "upsilon : ") ; l.DrawLatex(x2, y, "#upsilon");
   y -= 0.0375 ; l.DrawLatex(x1, y, "phi : ")     ; l.DrawLatex(x2, y, "#phi");
   y -= 0.0375 ; l.DrawLatex(x1, y, "chi : ")     ; l.DrawLatex(x2, y, "#chi");
   y -= 0.0375 ; l.DrawLatex(x1, y, "psi : ")     ; l.DrawLatex(x2, y, "#psi");
   y -= 0.0375 ; l.DrawLatex(x1, y, "omega : ")   ; l.DrawLatex(x2, y, "#omega");

   // Draw the upper case letters
   y = 0.90; x1 = 0.40; x2 = x1+0.2;
                 l.DrawLatex(x1, y, "Alpha : ")   ; l.DrawLatex(x2, y, "#Alpha");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Beta : ")    ; l.DrawLatex(x2, y, "#Beta");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Gamma : ")   ; l.DrawLatex(x2, y, "#Gamma");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Delta : ")   ; l.DrawLatex(x2, y, "#Delta");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Epsilon : ") ; l.DrawLatex(x2, y, "#Epsilon");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Zeta : ")    ; l.DrawLatex(x2, y, "#Zeta");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Eta : ")     ; l.DrawLatex(x2, y, "#Eta");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Theta : ")   ; l.DrawLatex(x2, y, "#Theta");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Iota : ")    ; l.DrawLatex(x2, y, "#Iota");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Kappa : ")   ; l.DrawLatex(x2, y, "#Kappa");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Lambda : ")  ; l.DrawLatex(x2, y, "#Lambda");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Mu : ")      ; l.DrawLatex(x2, y, "#Mu");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Nu : ")      ; l.DrawLatex(x2, y, "#Nu");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Xi : ")      ; l.DrawLatex(x2, y, "#Xi");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Omicron : ") ; l.DrawLatex(x2, y, "#Omicron");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Pi : ")      ; l.DrawLatex(x2, y, "#Pi");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Rho : ")     ; l.DrawLatex(x2, y, "#Rho");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Sigma : ")   ; l.DrawLatex(x2, y, "#Sigma");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Tau : ")     ; l.DrawLatex(x2, y, "#Tau");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Upsilon : ") ; l.DrawLatex(x2, y, "#Upsilon");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Phi : ")     ; l.DrawLatex(x2, y, "#Phi");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Chi : ")     ; l.DrawLatex(x2, y, "#Chi");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Psi : ")     ; l.DrawLatex(x2, y, "#Psi");
   y -= 0.0375 ; l.DrawLatex(x1, y, "Omega : ")   ; l.DrawLatex(x2, y, "#Omega");

   // Draw the variations
   x1 = 0.73; x2 = x1+0.2;
   y = 0.7500 ; l.DrawLatex(x1, y, "varepsilon : ") ; l.DrawLatex(x2, y, "#varepsilon");
   y = 0.6375 ; l.DrawLatex(x1, y, "vartheta : ")   ; l.DrawLatex(x2, y, "#vartheta");
   y = 0.2625 ; l.DrawLatex(x1, y, "varsigma : ")   ; l.DrawLatex(x2, y, "#varsigma");
   y = 0.1875 ; l.DrawLatex(x1, y, "varUpsilon : ") ; l.DrawLatex(x2, y, "#varUpsilon");
   y = 0.1500 ; l.DrawLatex(x1, y, "varphi : ")     ; l.DrawLatex(x2, y, "#varphi");
   y = 0.0375 ; l.DrawLatex(x1, y, "varomega : ")   ; l.DrawLatex(x2, y, "#varomega");

   // Save the picture in various formats
   c1->Print("greek.ps");
   c1->Print("greek.gif");
   c1->Print("greek.pdf");
   c1->Print("greek.svg");
}
开发者ID:MycrofD,项目名称:root,代码行数:83,代码来源:latex4.C

示例9: spectra_mw

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()));
}
开发者ID:musinsky,项目名称:bordel,代码行数:54,代码来源:spectra_mw.C

示例10: fill_stack_eventcategories

void fill_stack_eventcategories(TString variable_name, TString data_name, std::vector<TString> signal_names, std::vector<TString> names){
    TString canvas_name=variable_name+"_stack_canvas";
    CreateCanvas(canvas_name,"",900,600);
    TString stack_name=variable_name+"_stack";
    CreateStack(stack_name,"");

    int Nbkg=names.size();
    
    vector<int> colors;
    colors.push_back(4);
    colors.push_back(9);
    colors.push_back(5);
    colors.push_back(419);
    
    colors.push_back(7);
    if(colors.size()<Nbkg) {
        cout << "please specify colors" << endl;
        return;
    }
    
    TLegend *L = new TLegend(0.6,0.57,0.89,0.89);
	L->SetFillColor(10);
	L->SetLineColor(10);
	L->SetLineWidth(0);
    
    for(int ibkg=0; ibkg<Nbkg; ibkg++){
        TString histName=variable_name+names.at(ibkg);
        hName[histName]->SetFillColor(colors.at(ibkg));
        stackName[stack_name]->Add(hName[histName]);
        L->AddEntry(hName[histName], names.at(ibkg));
    }
    
    
	TString eventspad_name="eventspad_"+variable_name;
	TString ratiopad_name="ratiopad_"+variable_name;
	
	TPad *events_pad = new TPad(eventspad_name,"Events",0.0,0.3,1,1);
	TPad *ratio_pad = new TPad(ratiopad_name,"Ratio",0,0.,1,0.3);
	
	events_pad->SetTopMargin(0.1);
	events_pad->SetBottomMargin(0.05);
	ratio_pad->SetTopMargin(0.05);
	ratio_pad->SetBottomMargin(0.3);
	
	CName[canvas_name]->cd();
	events_pad->Draw();
	ratio_pad->Draw();
	
	events_pad->cd();
    gPad->SetLogy();
    
    hName[variable_name+data_name]->GetYaxis()->SetTitleOffset(0.65);
    hName[variable_name+data_name]->GetYaxis()->SetTitleSize(0.08);
    hName[variable_name+data_name]->GetYaxis()->SetLabelSize(0.05);
    hName[variable_name+data_name]->GetXaxis()->SetLabelSize(0);
    hName[variable_name+data_name]->GetXaxis()->SetTitleSize(0);
    
    hName[variable_name+data_name]->SetMarkerSize(0.5);
    hName[variable_name+data_name]->SetMarkerStyle(20);
    hName[variable_name+data_name]->DrawCopy("E1");
    stackName[stack_name]->DrawClone("histo same");
    hName[variable_name+data_name]->DrawCopy("E1 same");// draw data on top of MC and MC on top of data, so that data will always be visible

    
    TLatex txt;
    txt.SetNDC(kTRUE);
    txt.DrawLatex(0.2,0.85,"S_{T} > 300 GeV");
    txt.DrawLatex(0.4,0.75,"S_{T} > 500 GeV");
    txt.DrawLatex(0.65,0.42,"S_{T} > 1000 GeV");

    
    for(int isig=0; isig<signal_names.size();isig++){
        TString sigName=variable_name+signal_names.at(isig);
        hName[sigName]->SetLineWidth(3);
        hName[sigName]->SetLineStyle(kDashed);
        hName[sigName]->SetLineColor(1+isig);
        L->AddEntry(hName[sigName], signal_names.at(isig));
        hName[sigName]->DrawCopy("hist same");
    }
    L->DrawClone("same");
    ratio_pad->cd();
    TString dataMC=variable_name+"_RatioDataMC";

    hName[dataMC]->GetYaxis()->SetTitleOffset(0.45);
	hName[dataMC]->GetYaxis()->SetTitleSize(0.15);
	hName[dataMC]->GetYaxis()->SetTitleOffset(0.45);
	hName[dataMC]->GetYaxis()->SetLabelSize(0.08);
	
	
	hName[dataMC]->GetXaxis()->SetTitleSize(0.15);
	hName[dataMC]->GetXaxis()->SetLabelSize(0.12);
	hName[dataMC]->GetXaxis()->SetTitleSize(0.15);
    
    hName[dataMC]->DrawCopy("E1");
    
}
开发者ID:btcarlso,项目名称:UserCode,代码行数:96,代码来源:stealth_plots.c

示例11: MakeIntegerAxis


//.........这里部分代码省略.........
    // Calculate the result 
    TH2D* res = c->Result(correct);
    
    // Now loop and compare 
    Double_t mBase = 0;
    Double_t mPois = 0;
    for (Int_t iEta = 0; iEta < nBin; iEta++) { 
      for (Int_t iPhi = 0; iPhi < nBin; iPhi++) { 
	Double_t p = res->GetBinContent(iEta, iPhi);
	Double_t t = base->GetBinContent(iEta, iPhi);

	mBase += t;
	mPois += p;
	corr->Fill(t, p);
	diff->Fill(p-t);
      }
    }
    Int_t nn = nBin * nBin;
    mean->Fill(mBase / nn, mPois / nn);
  }

  TCanvas* cc = new TCanvas("c", "c", 900, 900);
  cc->SetFillColor(0);
  cc->SetFillStyle(0);
  cc->SetBorderMode(0);
  cc->SetRightMargin(0.02);
  cc->SetTopMargin(0.02);
  cc->Divide(2,2);
  
  TVirtualPad* pp = cc->cd(1);
  pp->SetFillColor(0);
  pp->SetFillStyle(0);
  pp->SetBorderMode(0);
  pp->SetRightMargin(0.15);
  pp->SetTopMargin(0.02);
  pp->SetLogz();
  pp->SetGridx();
  pp->SetGridy();
  corr->Draw();
  lcorr->Draw();

  pp = cc->cd(2);
  pp->SetFillColor(0);
  pp->SetFillStyle(0);
  pp->SetBorderMode(0);
  pp->SetRightMargin(0.02);
  pp->SetTopMargin(0.02);
#if 0
  c->GetMean()->Draw();
#elif 1 
  pp->SetLogy();
  diff->Draw();
#elif 1
  c->GetOccupancy()->Draw();
#else
  pp->SetLogy();
  dist->SetStats(0);
  dist->Scale(1. / dist->Integral());
  dist->Draw();
  TH1D* m1 = c->GetMean();
  m1->Scale(1. / m1->Integral());
  m1->Draw("same");
  Double_t eI;
  Double_t ii = 100 * dist->Integral(2, 0);
  TLatex* ll = new TLatex(.97, .85, 
			  Form("Input #bar{m}: %5.3f", mp));
  ll->SetNDC();
  ll->SetTextFont(132);
  ll->SetTextAlign(31);
  ll->Draw();
  ll->DrawLatex(.97, .75, Form("Result #bar{m}: %5.3f", dist->GetMean()));
  ll->DrawLatex(.97, .65, Form("Occupancy: #int_{1}^{#infty}P(s)ds = %6.2f%%",
			       ii));
			 
#endif

  pp = cc->cd(3);
  pp->SetFillColor(0);
  pp->SetFillStyle(0);
  pp->SetBorderMode(0);
  pp->SetRightMargin(0.15);
  pp->SetTopMargin(0.02);
  pp->SetGridx();
  pp->SetGridy();
  c->GetCorrection()->Draw();

  pp = cc->cd(4);
  pp->SetFillColor(0);
  pp->SetFillStyle(0);
  pp->SetBorderMode(0);
  pp->SetRightMargin(0.15);
  pp->SetTopMargin(0.02);
  pp->SetLogz();
  pp->SetGridx();
  pp->SetGridy();
  mean->Draw();
  lmean->Draw();

  cc->cd();
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:TestPoisson.C

示例12: fitRatio_kyo01


//.........这里部分代码省略.........
           
            else if (isPrompt==0 && isPbp==1 && iy==7) {
                func[iy]->FixParameter(0, -3.40711e+02);
                func[iy]->FixParameter(1, 3.20176e+00); 
                func[iy]->FixParameter(2, 1.09760e+00);
            }


        }  
        //else if(isPrompt==1 && isPbp==0 && iy==4){
        //  func[iy] = new TF1(Form("func_%d",iy), fitHevi,0.0,30.0,5); 
        //  func[iy]->SetParameters(-3.40747e+02,3.32373e+00,6.51294e-01,2.98861e+00,1.14947e+02);
        //} 
        else{
            func[iy] = new TF1(Form("func_%d",iy), fitHevi,0.0,30.0,5); 
            //func[iy]->SetParameters(-3.40711e+02,-2.02319e+00,1.42753e+00,2.98897e+00,1.14958e+02); //yeonju 0509
            func[iy]->SetParameters(-3.40711e+02,-5.20176e+00,1.79760e+00,2.98896e+00,1.14958e+02); //yeonju 0509
            //func[iy]->SetParameters(-3.40747e+02,3.32373e+00,6.51294e-01,2.98861e+00,1.14947e+02); //yeonju
            //yeonju
            if (isPrompt==0 && iy==2) {
                func[iy]->FixParameter(0, -3.40711e+02);
                func[iy]->FixParameter(1, -5.20176e+00); 
                func[iy]->FixParameter(2, 1.79760e+00);
                func[iy]->FixParameter(3, 2.98896);

            } else if (isPrompt==0 && iy==6) {
                func[iy]->FixParameter(0, -3.40711e+02);
                func[iy]->FixParameter(1, 3.20176e+00); 
                func[iy]->FixParameter(2, 1.79760e+00);

            }        
            //KYO
            if (isPrompt && iy==6) {
                func[iy]->FixParameter(0,-3.40743e+02);
                func[iy]->FixParameter(1,-2.56691e+01);
                func[iy]->FixParameter(2,5.14736e+00); 
            }
            else if (isPrompt && (iy==2 || iy==1)) {
                func[iy]->FixParameter(0,-3.40743e+02);
                func[iy]->FixParameter(1,-1.37032e-01);
                func[iy]->FixParameter(2,1.19902);
            }

            /*
               func[iy] = new TF1(Form("func_%d",iy), fitExp,0.0,30.0,3);
               if(isPrompt==0 && isPbp==1 && (iy==2 || iy==3 || iy==4 || iy==5) ) func[iy]->SetParameters(-1.01556e+01,1.51712e-01,2.80282e+01);
               if(isPrompt==0 && isPbp==0 && (iy==2 || iy==3 || iy==4) ) func[iy]->SetParameters(-1.01556e+01,1.51712e-01,2.80282e+01);
               if(isPrompt==1 && isPbp==0 && (iy==3) ) func[iy]->SetParameters(-1.01556e+01,1.51712e-01,2.80282e+01);
               if(isPrompt==1 && isPbp==1 && (iy==3) ) func[iy]->SetParameters(-1.01556e+01,1.51712e-01,2.80282e+01);
               */
        }
        //KYO for TGraphAsymmErrors only
        if (!isPrompt && iy==0){
            func[iy]->SetParameters(-1.04829e+01,-5.38813e+00,2.10443e+00,1.74460e+00,6.89848e+02);
            func[iy]->FixParameter(0,-1.04829e+01);
            func[iy]->FixParameter(1,-5.38813e+00);
            func[iy]->FixParameter(2,2.10443e+00);
        }
        SetGraphStyle(gRatio[iy],2,0);
        SetGraphStyle(gRatioOverlay[iy],4,10);
        func[iy]->SetLineColor(kRed);
        gRatio[iy]->Fit(Form("func_%d",iy));
        gRatio[iy]->Draw("AP");
        gRatioOverlay[iy]->Draw("P");
        //func[iy]->Draw("same");
        if (iy==0){
            if (isPrompt) latex->DrawLatex(0.23,0.23,"Prompt J/#psi Pbp");
            else latex->DrawLatex(0.23, 0.23,"Non-prompt J/#psi Pbp");
        }
        latex->DrawLatex(0.56,0.80,Form("%s",rapArr[iy].c_str()));
        dashedLine(0.,1.,25.,1.,1,1);

        /*
				for(int ifpt=0;ifpt<nPtFine;ifpt++){
            int hBin = gRatio[iy]->FindBin(ptFineArrNum[ifpt+1]-0.1);
            double mean = func[iy]->Eval(ptFineArrNum[ifpt+1]);
            double sigma = gRatio[iy]->GetBinError(hBin) / mean;
            hWeight[iy]->SetBinContent(ifpt+1, mean);
            hWeight[iy]->SetBinError(ifpt+1, sigma);
            //cout <<"x : "<<ptFineArrNum[ifpt+1]-0.01<< ", gRatio bin : " <<hBin << ", Ratio error value : " <<  gRatio[iy]->GetBinError(hBin) << endl;
            //cout << iy+1 << "th rapidity, "<< ifpt<<"th fine ptbin, mean = "<< mean <<", sigma = "<<sigma<<endl;
        }
				*/
    }
    c1 -> Update();

    for(int iy=0;iy<nRap;iy++){
				cout << " **** " <<iy<< "th rap, values at min pT = " <<func[iy]->Eval(minPt[iy])<<endl;	
    }
    
		fout->cd();	
    for(int iy=0;iy<nRap;iy++){
        //hWeight[iy]->Write();
        gRatio[iy]->Write();
        func[iy]->Write();
    }
    c1->Write();
    fout->Close();

}//end of main func.
开发者ID:KiSooLee,项目名称:pPbJPsiAnalysis,代码行数:101,代码来源:fitRatio_kyo01.C

示例13: Sigmoide

void Sigmoide(TGraphAsymmErrors* Efficiency,TGraphErrors* EfficiencyStat,OutFileRoot& out,std::string name,Reader& read)
{  
  double min=999999;
  double max=-99999;
  int lLimit=0; 
  int uLimit=0;
  for (int i = 0; i < Efficiency->GetN(); i++)
  {
    double x=0.0;
    double y=0.0;
    Efficiency->GetPoint(i, x, y);
    if(x>max)max=x;
    if(x<min)min=x;
    double errorY = Efficiency->GetErrorYlow(i);
    double errorYlow_stat = EfficiencyStat->GetErrorYlow(i);
    double errorYhigh_stat = EfficiencyStat->GetErrorYhigh(i);
    double errorYhigh = sqrt(errorY/2*errorY/2+errorYhigh_stat*errorYhigh_stat);
    double errorYlow = sqrt(errorY/2*errorY/2 + errorYlow_stat*errorYlow_stat);
    Efficiency->SetPoint(i, x, y-errorY/2);
    Efficiency->SetPointEYhigh (i, errorYhigh);
    Efficiency->SetPointEYlow (i, errorYlow);
    if (i == 0) lLimit = x;
    else if (i == Efficiency->GetN()-1) uLimit = x;
    std::cout<<yellow << "HV = " << x << " eff = "  << y-errorY/2 << " errorY = " << errorY/2 << " errorYhigh_stat = " << errorYhigh_stat << " errorYlow_stat = " << errorYlow_stat <<normal<<std::endl;
    
  }
  int color = 2;
  int marker = 20;
  TCanvas* c1 = new TCanvas();
  c1->SetTitle((name+Efficiency->GetTitle()).c_str());
  c1->SetName((name+Efficiency->GetTitle()).c_str());
  TH1D* PLOTTER = new TH1D("PLOTTER", "", 1, min, max);	
  PLOTTER->SetStats(0);
  std::string xLabel = "HV_{eff} (V)";
  if (read.getType() == "volEff" || read.getType() == "noisevolEff") 
  {
      xLabel = "Voltage_{eff} (V)";
  } 
  else if (read.getType() == "thrEff" ||read.getType() == "noisethrEff") 
  {
      xLabel = "Threshod ("+unitthr(read)+")";
  } 
  else if (read.getType() == "srcEff" ||read.getType() == "noisesrcEff") 
  {
      xLabel = "Attenuator";
  } 
  else if (read.getType() == "PulEff" ||read.getType() == "noisePulEff") 
  {
      xLabel = "Pulse (ns)";
  }
  std::string lName = "Sigmoid for RE11 GRPC; " + xLabel + "; Efficiency";
  PLOTTER->SetTitle(lName.c_str());
  PLOTTER->SetMaximum(1);
  PLOTTER->SetMinimum(0);
  PLOTTER->Draw("");
  Efficiency->SetMarkerColor(color);
  Efficiency->SetMarkerStyle(marker);
  Efficiency->Draw("SAMEPE");
  int HVhalf = (lLimit+uLimit)/2;
  //****************************************************
  TF1* sigmoid = new TF1("sigmoid","[0]/(1+exp([1]*([2]-x)))",lLimit,uLimit);
  sigmoid->SetParName(0,"#epsilon_{max}");
  sigmoid->SetParName(1,"#lambda");
  sigmoid->SetParName(2,"HV_{50%}");
  sigmoid->SetParameter(0,0.98);
  sigmoid->SetParameter(1,0.01);
  sigmoid->SetParameter(2,HVhalf);
  Efficiency->Fit(sigmoid);
  Efficiency->GetFunction("sigmoid")->SetLineColor(kBlue);
  double p1 = sigmoid->GetParameter(0);
  double p2 = sigmoid->GetParameter(1);
  double p3 = sigmoid->GetParameter(2);
  TLatex* ltx = new TLatex();
  ltx->SetTextSize(0.04);
  double knee = p3 - log(1/0.95-1)/p2;
  TLine* lKnee = new TLine(knee, 0, knee, 1);
  lKnee->SetLineStyle(2);
  lKnee->Draw();
  double WP = knee+150;
  double add = (uLimit-lLimit)/11.;
  if (uLimit-knee < 4/11.*(uLimit-lLimit)) add = -add*4;
  ltx->DrawLatex(knee+add, 0.22, Form("WP = %.f V", WP));
  ltx->DrawLatex(knee+add, 0.15, Form("knee = %.f V", knee));
  ltx->DrawLatex(knee+add, 0.08, Form("HV(50%) = %.f V", p3));
  TLine* plateau = new TLine(lLimit-50, p1, uLimit+50, p1);
  plateau->SetLineStyle(2);
  plateau->Draw();
  if ((knee - lLimit) < (uLimit-lLimit)*(3/11.)) add = knee + add;
  else add = lLimit+add;
  ltx->DrawLatex(add, p1+0.04, Form("plateau = %.2f", p1));
  c1->Update();
  out.writeObject("Sigmoid",c1);
  delete c1;
  delete ltx;
  delete sigmoid;
  delete PLOTTER;
} 
开发者ID:flagarde,项目名称:LR-GLASS,代码行数:97,代码来源:Sigmoid.cpp

示例14: Plot_2D


//.........这里部分代码省略.........
			 Ny, Ymin, Ymax);

  for(int i = 0; i < N; i++){
    base->GetEntry(i);

    if(base->VMM != 0)
      continue;

    if(base->CHword == 24)
      continue;

    if(base->Delay != 30)
      continue;
    
    // hist->Fill(base->CHpulse,base->CHword,base->PDO);
    //histN->Fill(base->CHpulse,base->CHword);
    histN->Fill(base->CHpulse,base->BCID);

    // if(base->CHpulse != 5)
    //   continue;
    // base->CHpulse = base->CHword;

    hist->Fill(base->VMM,base->CHpulse,base->PDO);
    hist2->Fill(base->VMM,base->CHpulse,base->PDO*base->PDO);
    // if(histN->GetBinContent(base->VMM,base->CHpulse) <= 0)
    //   histN->SetBinContent(base->VMM,base->CHpulse,base->BCID);
    // else
    //   if(histN->GetBinContent(base->VMM,base->CHpulse) > base->BCID)
    // histN->SetBinContent(base->VMM,base->CHpulse,base->BCID);
    // histN->Fill(base->VMM,base->CHpulse);
  
  }

  for(int x = 0; x < Nx; x++){
    for(int y = 0; y < Ny; y++){
      double v = hist->GetBinContent(x+1,y+1);
      double v2 = hist2->GetBinContent(x+1,y+1);
      double N = histN->GetBinContent(x+1,y+1);
      double vbar = v/max(int(N),1);
      double v2bar = v2/max(int(N),1);
      //hist->SetBinContent(x+1,y+1,sqrt(v2bar-vbar*vbar)/vbar);
      hist->SetBinContent(x+1,y+1,vbar);
    }
  }

  TCanvas* can = new TCanvas("can","can",600,500);
  can->SetLeftMargin(0.15);
  can->SetRightMargin(0.22);
  can->SetBottomMargin(0.15);
  can->SetTopMargin(0.08);

  can->Draw();
  can->SetGridx();
  can->SetGridy();
  
  can->cd();

  hist = histN;

  hist->Draw("COLZ");

  hist->GetXaxis()->CenterTitle();
  hist->GetXaxis()->SetTitleFont(132);
  hist->GetXaxis()->SetTitleSize(0.06);
  hist->GetXaxis()->SetTitleOffset(1.06);
  hist->GetXaxis()->SetLabelFont(132);
  hist->GetXaxis()->SetLabelSize(0.05);
  hist->GetXaxis()->SetTitle(varXname.c_str());
  hist->GetYaxis()->CenterTitle();
  hist->GetYaxis()->SetTitleFont(132);
  hist->GetYaxis()->SetTitleSize(0.06);
  hist->GetYaxis()->SetTitleOffset(1.12);
  hist->GetYaxis()->SetLabelFont(132);
  hist->GetYaxis()->SetLabelSize(0.05);
  hist->GetYaxis()->SetTitle(varYname.c_str());
  hist->GetZaxis()->CenterTitle();
  hist->GetZaxis()->SetTitleFont(132);
  hist->GetZaxis()->SetTitleSize(0.06);
  hist->GetZaxis()->SetTitleOffset(1.3);
  hist->GetZaxis()->SetLabelFont(132);
  hist->GetZaxis()->SetLabelSize(0.05);
  hist->GetZaxis()->SetTitle(varZname.c_str());
  hist->GetZaxis()->SetRangeUser(0.9*hist->GetMinimum(),1.1*hist->GetMaximum());

  TLatex l;
  l.SetTextFont(132);
  l.SetNDC();
  l.SetTextSize(0.05);
  l.SetTextFont(132);
  l.DrawLatex(0.5,0.943,"MMFE8 Analysis");
  l.SetTextSize(0.04);
  l.SetTextFont(42);
  l.DrawLatex(0.15,0.943,"#bf{#it{ATLAS}} Internal");

  l.SetTextSize(0.06);
  l.SetTextFont(132);
  l.DrawLatex(0.80,0.04, "VMM #6");

 
}
开发者ID:alexandertuna,项目名称:MMFE8,代码行数:101,代码来源:Plot_2D.C

示例15: main

int main() {
  ic::Plot::SetHTTStyle();

  std::string dir="/vols/cms04/pjd12/invcmssws/CMSSW_7_1_5/src/HiggsAnalysis/CombinedLimit/exocombcards/";

  std::vector<Scan> scans;
  //  scans.push_back({"higgsCombinefullScan.MultiDimFit.mH125.root", "Observed", 1, nullptr});
  //  scans.push_back({"higgsCombineexpected.MultiDimFit.mH125.root", "Exp. for SM H", 32, nullptr});
//   scans.push_back({"higgsCombinenoBBBScan.MultiDimFit.mH125.root", "no bbb syst.", 38, nullptr});
  scans.push_back({dir+"higgsCombineCombExp.MultiDimFit.mH125.root", "Exp. for SM H", 1, nullptr});
  scans.push_back({dir+"higgsCombineCombObs.MultiDimFit.mH125.root", "Obs. for SM H", 1, nullptr});

  TCanvas c1("canvas","canvas");

  std::vector<TLine *> lines;


  TLegend *leg = new TLegend(0.65,0.75,0.9,0.9,"","brNDC");

  unsigned counter = 0;
  for (auto & sc : scans) {
    TFile f1(sc.file.c_str());
    TTree *t1 = dynamic_cast<TTree*>(f1.Get("limit"));
    double best1 = 0.0;
    TString res;
    sc.gr = new TGraph(ExtractGraph(t1, best1));
    if(counter==1){
      auto x1 = GetCrossings(*(sc.gr), 1.0);
      auto x2 = GetCrossings(*(sc.gr), 3.84);
      lines.push_back(new TLine(x1[0],0,x1[0],1.0));
      lines.back()->SetLineColor(2);
      lines.back()->SetLineWidth(2);
      lines.push_back(new TLine(x2[0],0,x2[0],3.84));
      lines.back()->SetLineColor(2);
      lines.back()->SetLineWidth(2);
    }
    sc.gr->SetLineColor(sc.color);
    sc.gr->SetLineWidth(3);
    sc.gr->Draw(counter ? "LSAME" : "AL");
    TString leg_text = "#splitline{"+sc.label+"}{"+res+"}";
    leg->AddEntry(sc.gr, leg_text, "L");
    counter++;
  }
  // c1.cd();
  // // g1.Print();
  // g1.SetLineColor(1);
  // g1.SetLineWidth(2);
  // // g1.SetMarkerColor(7);
  // g1.Draw("AC");
  scans[0].gr->SetMaximum(9);
  scans[0].gr->SetMinimum(0.);
  scans[0].gr->GetXaxis()->SetRangeUser(0., 0.9);
  scans[0].gr->GetXaxis()->SetTitle("BR_{inv}");
  scans[0].gr->GetXaxis()->SetTitleOffset(1.1);
  scans[0].gr->GetXaxis()->SetNdivisions(1005,true);
  scans[0].gr->GetXaxis()->SetLabelSize(0.05);
  scans[0].gr->GetYaxis()->SetLabelSize(0.05);
  scans[0].gr->GetXaxis()->SetLabelOffset(0.02);
  scans[0].gr->GetYaxis()->SetLabelOffset(0.02);
  scans[0].gr->GetYaxis()->SetTitle("-2 #Delta ln L");
  scans[0].gr->SetLineStyle(2);
  scans[0].gr->SetLineColor(1);
  leg->SetBorderSize(1);
  leg->SetTextFont(42);
  leg->SetTextSize(0.03);
  leg->SetLineColor(1);
  leg->SetLineStyle(1);
  leg->SetLineWidth(1);
  leg->SetFillColor(0);
  leg->SetFillStyle(1001);
  leg->Draw();
  lines.push_back(new TLine(0.,1,0.9,1.0));
  lines.back()->SetLineColor(2);
  lines.push_back(new TLine(0.,3.84,0.9,3.84));
  lines.back()->SetLineColor(2);
  //  for (auto l : lines) l->Draw();

  DrawCMSLogoTest(&c1,"CMS","preliminary",10);

  TLatex lat = TLatex();
  lat.SetNDC();
  lat.SetTextSize(0.04);                                                                                                                                    
  lat.SetTextFont(42);

  TLatex lat2 = TLatex();
  lat2.SetNDC();
  lat2.SetTextSize(0.03);
  lat2.SetTextFont(42);

  lat.DrawLatex(0.2,0.73,"Combination of all");
  lat.DrawLatex(0.2,0.68,"H#rightarrow inv. channels");


  c1.Update();
  c1.SaveAs("scan.pdf");
  return 0;
}
开发者ID:ajgilbert,项目名称:ICHiggsTauTau,代码行数:97,代码来源:Plot1DScan.cpp


注:本文中的TLatex::DrawLatex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。