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


C++ TText::SetTextFont方法代码示例

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


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

示例1: table

void table(Float_t x1, Float_t x2, Float_t yrange, TText *t, 
   const char **symbol, Bool_t octal)
{
   Int_t i;
   Int_t n = 0;
   for (i=0;i<1000;i++) {
      if (!strcmp(symbol[i],"END")) break;
      n++;
   }
   Float_t y1  = 2.5;
   Float_t y2  = yrange - 0.5;
   Float_t dx  = (x2-x1)/5;
   Float_t dy  = (y2 - 1 -y1)/(n+1);
   Float_t y   = y2 - 1 - 0.7*dy;
   Float_t xc0 = x1  + 0.5*dx;
   Float_t xc1 = xc0 + dx;
   Float_t xc2 = xc1 + dx;
   Float_t xc3 = xc2 + dx;
   Float_t xc4 = xc3 + dx;
   TLine *line = new TLine();
   line->DrawLine(x1,y1,x1,y2);
   line->DrawLine(x1,y1,x2,y1);
   line->DrawLine(x1,y2,x2,y2);
   line->DrawLine(x2,y1,x2,y2);
   line->DrawLine(x1,y2-1,x2,y2-1);
   line->DrawLine(x1+  dx,y1,x1+  dx,y2);
   line->DrawLine(x1+2*dx,y1,x1+2*dx,y2);
   line->DrawLine(x1+3*dx,y1,x1+3*dx,y2);
   line->DrawLine(x1+4*dx,y1,x1+4*dx,y2);
   TText *tit = new TText(0,0,"a");
   tit->SetTextSize(0.015);
   tit->SetTextFont(72);
   tit->SetTextAlign(22);
   tit->DrawText(xc0,y2-0.6,"Input");
   tit->DrawText(xc1,y2-0.6,"Roman");
   tit->DrawText(xc2,y2-0.6,"Greek");
   tit->DrawText(xc3,y2-0.6,"Special");
   tit->DrawText(xc4,y2-0.6,"Zapf");
   char text[12];
   for (i=0;i<n;i++) {
      if (octal) {
         unsigned char value = *symbol[i];
         sprintf(text,"@\\ %3o",value);
      } else {
         strcpy(text,symbol[i]);
      }
      t->DrawText(xc0,y,text);
      sprintf(text,"%s",symbol[i]);
      t->DrawText(xc1,y,text);
      sprintf(text,"`%s",symbol[i]);
      t->DrawText(xc2,y,text);
      sprintf(text,"'%s",symbol[i]);
      t->DrawText(xc3,y,text);
      sprintf(text,"~%s",symbol[i]);
      t->DrawText(xc4,y,text);
      y -= dy;
   }
}
开发者ID:adevress,项目名称:root-1,代码行数:58,代码来源:pstable.C

示例2: postprocess

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));

}
开发者ID:maszyman,项目名称:PlotMacros,代码行数:50,代码来源:drawDist.C

示例3: fill_with_text

void fill_with_text(TGraph *real, TGraph *down, TGraph *up, TVirtualPad *can, int scantype, std::string scanx = "") {
  can->cd();
  float xpos_of_text = 0.22;
  TLegend* this_leg = new TLegend(xpos_of_text,0.6,0.38,0.75);
  //TLegend* this_leg = new TLegend(xpos_of_text,0.55,0.45,0.75,"n_{jets} #geq 3"); // this was the style of the paper. 
  this_leg->SetFillColor(0);
  this_leg->SetBorderSize(0);
  this_leg->SetTextSize(0.035);
  //this_leg->SetTextSize(0.04); // paper style. 
  if(scantype==PlottingSetup::SMS||scantype==PlottingSetup::GMSB) {
    //this_leg->AddEntry(real,"#sigma^{prod} = #sigma^{NLO-QCD}" , "l");
    //this_leg->AddEntry(up,"#sigma^{prod} = 3 #times #sigma^{NLO-QCD}" , "l");
    //this_leg->AddEntry(down,"#sigma^{prod} = 1/3 #times #sigma^{NLO-QCD}" , "l");
    this_leg->AddEntry(real,"#sigma^{NLO-QCD}" , "l");
    this_leg->AddEntry(up,"3 #times #sigma^{NLO-QCD}" , "l");
    this_leg->AddEntry(down,"1/3 #times #sigma^{NLO-QCD}" , "l");
  } else {
    write_warning(__FUNCTION__,"Not implemented yet for mSUGRA");
  }
    
  this_leg->Draw();
  TText *title = write_text(xpos_of_text+0.005,0.52,"JZB");
  title->SetTextSize(0.04);
  title->SetTextAlign(13);
  title->SetTextFont(62);
  title->Draw();
  
  write_SMS_text( scantype, scanx, xpos_of_text );
  
//  //string legT5zz="pp #rightarrow  #tilde{g} #tilde{g}, #tilde{g} #rightarrow 2j + #chi^{0}_{1}, #chi^{0}_{1} #rightarrow Z + #tilde{G}";
//  string legT5zz="pp #rightarrow  #tilde{g} #tilde{g}, #tilde{g} #rightarrow 2j + #chi^{0}_{2}, #chi^{0}_{2} #rightarrow Z #chi^{0}_{1}";
//  string legT5zzl2="m(#tilde{q}) >> m(#tilde{g}), x = "+scanx;
//  string legT5zzl3=" GMSB";
//  TText *title = write_text(xpos_of_text,0.85,legT5zz);
//  title->SetTextAlign(11);
//  title->SetTextSize(0.035);
//  if(scantype!=PlottingSetup::mSUGRA) title->Draw("same");
//  TText *title2 = write_text(xpos_of_text,0.79,legT5zzl2);
//  title2->SetTextAlign(11);
//  title2->SetTextSize(0.035);
//  if(scantype!=PlottingSetup::mSUGRA) title2->Draw("same");
//  TText *title3 = write_text(0.40,0.79,legT5zzl3);
//  title3->SetTextAlign(11);
//  title3->SetTextSize(0.035);
//  title3->SetTextColor(kRed);
////  if(scantype==PlottingSetup::GMSB) title3->Draw("same");
  DrawPrelim();
  draw_diagonal_xchange( scantype, scanx );
}
开发者ID:MarcoAndreaBuchmann,项目名称:CBAF,代码行数:49,代码来源:ExclusionPlot.C

示例4: plot_example

void plot_example(){
 THStack *hs = new THStack("hs","");
   TH1F *h1 = new TH1F("h1","test hstack",10,-4,4);
   h1->FillRandom("gaus",20000);
   h1->SetFillColor(kRed);
   hs->Add(h1);
   TH1F *h2 = new TH1F("h2","test hstack",10,-4,4);
   h2->FillRandom("gaus",15000);
   h2->SetFillColor(kBlue);
   hs->Add(h2);
   TH1F *h3 = new TH1F("h3","test hstack",10,-4,4);
   h3->FillRandom("gaus",10000);
   h3->SetFillColor(kGreen);
   hs->Add(h3);
   TCanvas *cs = new TCanvas("cs","cs",10,10,700,900);
   TText T; T.SetTextFont(42); T.SetTextAlign(21);
   cs->Divide(2,2);
   cs->cd(1); hs->Draw(); T.DrawTextNDC(.5,.95,"Default drawing option");
   cs->cd(2); hs->Draw("nostack"); T.DrawTextNDC(.5,.95,"Option \"nostack\"");
   cs->cd(3); hs->Draw("nostackb"); T.DrawTextNDC(.5,.95,"Option \"nostackb\"");
   cs->cd(4); hs->Draw("lego1"); T.DrawTextNDC(.5,.95,"Option \"lego1\"");
}
开发者ID:MengyaoShi,项目名称:GGHAA2Mu2TauAnalysis,代码行数:22,代码来源:plot_example.C

示例5: event

void event(){
   TCanvas *c1 = new TCanvas("c1","ROOT Event description",700,500);
   c1->Range(0,0,14,15.5);
   TPaveText *event = new TPaveText(1,13,3,15);
   event->SetFillColor(11);
   event->Draw();
   event->AddText("Event");
   TLine *line = new TLine(1.1,13,1.1,1.5);
   line->SetLineWidth(2);
   line->Draw();
   line->DrawLine(1.3,13,1.3,3.5);
   line->DrawLine(1.5,13,1.5,5.5);
   line->DrawLine(1.7,13,1.7,7.5);
   line->DrawLine(1.9,13,1.9,9.5);
   line->DrawLine(2.1,13,2.1,11.5);
   TArrow *arrow = new TArrow(1.1,1.5,3.9,1.5,0.02,"|>");
   arrow->SetFillStyle(1001);
   arrow->SetFillColor(1);
   arrow->Draw();
   arrow->DrawArrow(1.3,3.5,3.9,3.5,0.02,"|>");
   arrow->DrawArrow(1.5,5.5,3.9,5.5,0.02,"|>");
   arrow->DrawArrow(1.7,7.5,3.9,7.5,0.02,"|>");
   arrow->DrawArrow(1.9,9.5,3.9,9.5,0.02,"|>");
   arrow->DrawArrow(2.1,11.5,3.9,11.5,0.02,"|>");
   TPaveText *p1 = new TPaveText(4,1,11,2);
   p1->SetTextAlign(12);
   p1->SetFillColor(42);
   p1->AddText("1 Mbyte");
   p1->Draw();
   TPaveText *p2 = new TPaveText(4,3,10,4);
   p2->SetTextAlign(12);
   p2->SetFillColor(42);
   p2->AddText("100 Kbytes");
   p2->Draw();
   TPaveText *p3 = new TPaveText(4,5,9,6);
   p3->SetTextAlign(12);
   p3->SetFillColor(42);
   p3->AddText("10 Kbytes");
   p3->Draw();
   TPaveText *p4 = new TPaveText(4,7,8,8);
   p4->SetTextAlign(12);
   p4->SetFillColor(42);
   p4->AddText("1 Kbytes");
   p4->Draw();
   TPaveText *p5 = new TPaveText(4,9,7,10);
   p5->SetTextAlign(12);
   p5->SetFillColor(42);
   p5->AddText("100 bytes");
   p5->Draw();
   TPaveText *p6 = new TPaveText(4,11,6,12);
   p6->SetTextAlign(12);
   p6->SetFillColor(42);
   p6->AddText("10 bytes");
   p6->Draw();
   TText *text = new TText();
   text->SetTextAlign(12);
   text->SetTextSize(0.04);
   text->SetTextFont(72);
   text->DrawText(6.2,11.5,"Header:Event_flag");
   text->DrawText(7.2,9.5,"Trigger_Info");
   text->DrawText(8.2,7.5,"Muon_Detector: TOF");
   text->DrawText(9.2,5.5,"Calorimeters");
   text->DrawText(10.2,3.5,"Forward_Detectors");
   text->DrawText(11.2,1.5,"TPCs");
}
开发者ID:Y--,项目名称:root,代码行数:65,代码来源:event.C

示例6: pstable

void pstable()
{
// Display all possible types of ROOT/Postscript characters

   const char *symbol1[] =
      {"A","B","C","D","E","F","G","H","I","J","K","L","M","N",
       "O","P","Q","R","S","T","U","V","W","X","Y","Z",
       "0","1","2","3","4","5","6","7","8","9",
       ".",",","+","-","*","/","=","(",")","{","}","END"};

   const char *symbol2[] =
      {"a","b","c","d","e","f","g","h","i","j","k","l","m","n",
       "o","p","q","r","s","t","u","v","w","x","y","z",
       ":",";","@","\\","_","|","%",
       "@'","<",">","[","]","\42","@\43","@\136",
       "@\77","@\41","@&","$","@\176"," ","END"};

   const char *symbol3[] =
      {"\241","\242","\243","\244","\245","\246","\247","\250",
       "\251","\252","\253","\254","\255","\256","\257","\260",
       "\261","\262","\263","\264","\265","\266","\267","\270",
       "\271","\272","\273","\274","\275","\276","\277","\300",
       "\301","\302","\303","\304","\305","\306","\307","\310",
       "\311","\312","\313","\314","\315","\316","\317","END"};

   const char *symbol4[] =
      {"\321","\322","\323","\324","\325","\326","\327","\330",
       "\331","\332","\333","\334","\335","\336","\337","\340",
       "\341","\342","\343","\344","\345","\346","\347","\340",
       "\351","\352","\353","\354","\355","\356","\357","\360",
       "\361","\362","\363","\364","\365","\366","\367","\370",
       "\371","\372","\373","\374","\375","\376","\377","END"};

   const char *symbol5[] =
      {"\177","\200","\201","\202","\203","\204","\205","\206",
       "\207","\210","\211","\212","\213","\214","\215","\216",
       "\217","\220","\221","\222","\223","\224","\225","\226",
       "\227","\230","\231","\232","\233","\234","\235","\236",
       "\237","\240","END"};

   Float_t xrange = 18;
   Float_t yrange = 25;
   Int_t w = 650;
   Int_t h = w*yrange/xrange;
   
   TCanvas *c1 = new TCanvas("c1","c1",200,10,w,h);
   c1->Range(0,0,xrange,yrange);

   TText *t = new TText(0,0,"a");
   t->SetTextSize(0.02);
   t->SetTextFont(62);
   t->SetTextAlign(22);

   table(0.5,0.5*xrange-0.5,yrange,t,symbol1,0);
   table(0.5*xrange+0.5,xrange-0.5,yrange,t,symbol2,0);
   TText *tlabel = new TText(0,0,"a");
   tlabel->SetTextFont(72);
   tlabel->SetTextSize(0.018);
   tlabel->SetTextAlign(22);
   tlabel->DrawText(0.5*xrange,1.3,
      "Input characters are standard keyboard characters");
   c1->Modified();
   c1->Update();
   c1->Print("pstable1.ps");

   TCanvas *c2 = new TCanvas("c2","c2",220,20,w,h);
   c2->Range(0,0,xrange,yrange);

   table(0.5,0.5*xrange-0.5,yrange,t,symbol3,1);
   table(0.5*xrange+0.5,xrange-0.5,yrange,t,symbol4,1);
   tlabel->DrawText(0.5*xrange,1.3,
      "Input characters using backslash and octal numbers");
   c2->Modified();
   c2->Update();
   c2->Print("pstable2.ps");

   TCanvas *c3 = new TCanvas("c3","c3",240,20,w,h);
   c3->Range(0,0,xrange,yrange);

   table(0.5,0.5*xrange-0.5,yrange,t,symbol5,1);
   tlabel->DrawText(0.5*xrange,1.3,
      "Input characters using backslash and octal numbers");
   c3->Modified();
   c3->Update();
   c3->Print("pstable3.ps");
}
开发者ID:adevress,项目名称:root-1,代码行数:86,代码来源:pstable.C

示例7: drawDCA


//.........这里部分代码省略.........
        asd0->SetMarkerColor(kBlack);
        asd0->SetMarkerStyle(20);
        asd0->Draw("pc");

        primpp->SetFillColor(kGreen+2);
        //primpp->Scale(1./norm);
        primpp->SetMarkerSize(1.3);
        primpp->SetMarkerColor(kGreen+2);
        primpp->SetMarkerStyle(20);
        primpp->Draw("psame");

        matpp->SetFillColor(kRed);
        //matpp->Scale(1./norm);
        matpp->SetMarkerSize(1.3);
        matpp->SetMarkerColor(kRed);
        matpp->SetMarkerStyle(20);
        matpp->Draw("psame");

        weakpp->SetFillColor(kBlue);
        //weakpp->Scale(1./norm);
        weakpp->SetMarkerSize(1.3);
        weakpp->SetMarkerColor(kBlue);
        weakpp->SetMarkerStyle(20);
        weakpp->Draw("psame");



        // _____endofsum____


        TLegend *myLegend = new TLegend(0.6,0.6,0.89,0.89);
        myLegend->SetFillColor(10);
        myLegend->SetBorderSize(0);

        myLegend->AddEntry(asd0,"all","f");
        myLegend->AddEntry(primpp,"primary","f");
        myLegend->AddEntry(weakpp,"weak decay","f");
        myLegend->AddEntry(matpp,"material","f");
        //myLegend->Draw("same");


        // logo

        TLatex *sys = new TLatex(0.16,0.91,"AMPT Pb-Pb #sqrt{s_{NN}} = 2.76 TeV");
        sys->SetNDC();
        sys->SetTextFont(42);
        sys->SetTextSize(0.05);
        sys->SetTextColor(kRed+2);
        sys->Draw();

        TDatime now;
        int iDate = now.GetDate();
        int iYear=iDate/10000;
        int iMonth=(iDate%10000)/100;
        int iDay=iDate%100;
        char* cMonth[12]={"Jan","Feb","Mar","Apr","May","Jun",
                          "Jul","Aug","Sep","Oct","Nov","Dec"};
        char cStamp1[25],cStamp2[25];
        sprintf(cStamp1,"%i %s %i",iDay, cMonth[iMonth-1], iYear);
        sprintf(cStamp2,"%i/%.2d/%i",iDay, iMonth, iYear);


        TText *date = new TText(0.27,0.5,cStamp2);
        date->SetNDC();
        date->SetTextFont(42);
        date->SetTextSize(0.04);
        date->Draw();

        //           //Acquire canvas proportions
//                 Double_t AliLogo_LowX = 0.27;
//                 Double_t AliLogo_LowY = 0.6;
//                 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_preliminary.eps");
//                 TASImage *myAliceLogo = new TASImage("alice_performance.eps");
// //		TASImage *myAliceLogo = new TASImage("alice_logo_transparent.png");
//                 myAliceLogo->Draw();

        DrawALICELogo(0,0.27,0.55,0.7,0.8);

//logo

        // postprocess(cansum,Form("DCAxyMC%s",status),rWrite,rPerformance,system);
        cansum->SaveAs("DCAxyMC.png");
        cansum->SaveAs("DCAxyMC.eps");
    }

//__________________________________________________


}
开发者ID:maszyman,项目名称:PlotMacros,代码行数:101,代码来源:drawDCA.C

示例8: lhcbStyle

// all users - please change the name of this file to lhcbStyle.C
// Commits to lhcbdocs svn of .C files are not allowed
void lhcbStyle(){

  // define names for colours
  Int_t black  = 1;
  Int_t red    = 2;
  Int_t green  = 3;
  Int_t blue   = 4;
  Int_t yellow = 5; 
  Int_t magenta= 6;
  Int_t cyan   = 7;
  Int_t purple = 9;
  

////////////////////////////////////////////////////////////////////
// PURPOSE:
//
// This macro defines a standard style for (black-and-white) 
// "publication quality" LHCb ROOT plots. 
//
// USAGE:
//
// Include the lines
//   gROOT->ProcessLine(".L lhcbstyle.C");
//   lhcbStyle();
// at the beginning of your root macro.
//
// Example usage is given in myPlot.C
//
// COMMENTS:
//
// Font:
// 
// The font is chosen to be 132, this is Times New Roman (like the text of
//  your document) with precision 2.
//
// "Landscape histograms":
//
// The style here is designed for more or less square plots.
// For longer histograms, or canvas with many pads, adjustements are needed. 
// For instance, for a canvas with 1x5 histograms:
//  TCanvas* c1 = new TCanvas("c1", "L0 muons", 600, 800);
//  c1->Divide(1,5);
//  Adaptions like the following will be needed:
//  gStyle->SetTickLength(0.05,"x");
//  gStyle->SetTickLength(0.01,"y");
//  gStyle->SetLabelSize(0.15,"x");
//  gStyle->SetLabelSize(0.1,"y");
//  gStyle->SetStatW(0.15);
//  gStyle->SetStatH(0.5);
//
// Authors: Thomas Schietinger, Andrew Powell, Chris Parkes, Niels Tuning
// Maintained by Editorial board member (currently Niels)
///////////////////////////////////////////////////////////////////

  // Use times new roman, precision 2 
  Int_t lhcbFont        = 132;  // Old LHCb style: 62;
  // Line thickness
  Double_t lhcbWidth    = 2.00; // Old LHCb style: 3.00;
  // Text size
  Double_t lhcbTSize    = 0.06; 
  
  // use plain black on white colors
  gROOT->SetStyle("Plain"); 
  TStyle *lhcbStyle= new TStyle("lhcbStyle","LHCb plots style");
  
  //lhcbStyle->SetErrorX(0); //  don't suppress the error bar along X

  lhcbStyle->SetFillColor(1);
  lhcbStyle->SetFillStyle(1001);   // solid
  lhcbStyle->SetFrameFillColor(0);
  lhcbStyle->SetFrameBorderMode(0);
  lhcbStyle->SetPadBorderMode(0);
  lhcbStyle->SetPadColor(0);
  lhcbStyle->SetCanvasBorderMode(0);
  lhcbStyle->SetCanvasColor(0);
  lhcbStyle->SetStatColor(0);
  lhcbStyle->SetLegendBorderSize(0);

  // If you want the usual gradient palette (blue -> red)
  lhcbStyle->SetPalette(1);
  // If you want colors that correspond to gray scale in black and white:
  int colors[8] = {0,5,7,3,6,2,4,1};
  lhcbStyle->SetPalette(8,colors);

  // set the paper & margin sizes
  lhcbStyle->SetPaperSize(20,26);
  lhcbStyle->SetPadTopMargin(0.05);
  lhcbStyle->SetPadRightMargin(0.05); // increase for colz plots
  lhcbStyle->SetPadBottomMargin(0.16);
  lhcbStyle->SetPadLeftMargin(0.14);
  
  // use large fonts
  lhcbStyle->SetTextFont(lhcbFont);
  lhcbStyle->SetTextSize(lhcbTSize);
  lhcbStyle->SetLabelFont(lhcbFont,"x");
  lhcbStyle->SetLabelFont(lhcbFont,"y");
  lhcbStyle->SetLabelFont(lhcbFont,"z");
  lhcbStyle->SetLabelSize(lhcbTSize,"x");
//.........这里部分代码省略.........
开发者ID:apmorris,项目名称:scripts,代码行数:101,代码来源:lhcbStyle.C

示例9: analyze

void analyze() {
   TCanvas *c1 = new TCanvas("c1","Analyze.mac",620,790);
   c1->Range(-1,0,19,30);
   TPaveLabel *pl1 = new TPaveLabel(0,27,3.5,29,"Analyze");
   pl1->SetFillColor(42);
   pl1->Draw();
   TPaveText *pt1 = new TPaveText(0,22.8,4,25.2);
   TText *t1  = pt1->AddText("Parenthesis matching");
   TText *t2  = pt1->AddText("Remove unnecessary");
   TText *t2a = pt1->AddText("parenthesis");
   pt1->Draw();
   TPaveText *pt2 = new TPaveText(6,23,10,25);
   TText *t3 = pt2->AddText("break of");
   TText *t4 = pt2->AddText("Analyze");
   pt2->Draw();
   TPaveText *pt3 = new TPaveText(0,19,4,21);
   t4=pt3->AddText("look for simple");
   TText *t5 = pt3->AddText("operators");
   pt3->Draw();
   TPaveText *pt4 = new TPaveText(0,15,4,17);
   TText *t6 = pt4->AddText("look for an already");
   TText *t7 = pt4->AddText("defined expression");
   pt4->Draw();
   TPaveText *pt5 = new TPaveText(0,11,4,13);
   TText *t8 = pt5->AddText("look for usual");
   TText *t9 = pt5->AddText("functions :cos sin ..");
   pt5->Draw();
   TPaveText *pt6 = new TPaveText(0,7,4,9);
   TText *t10 = pt6->AddText("look for a");
   TText *t11 = pt6->AddText("numeric value");
   pt6->Draw();
   TPaveText *pt7 = new TPaveText(6,18.5,10,21.5);
   TText *t12 = pt7->AddText("Analyze left and");
   TText *t13 = pt7->AddText("right part of");
   TText *t14 = pt7->AddText("the expression");
   pt7->Draw();
   TPaveText *pt8 = new TPaveText(6,15,10,17);
   TText *t15 = pt8->AddText("Replace expression");
   pt8->Draw();
   TPaveText *pt9 = new TPaveText(6,11,10,13);
   TText *t16 = pt9->AddText("Analyze");
   pt9->SetFillColor(42);
   pt9->Draw();
   TPaveText *pt10 = new TPaveText(6,7,10,9);
   TText *t17 = pt10->AddText("Error");
   TText *t18 = pt10->AddText("Break of Analyze");
   pt10->Draw();
   TPaveText *pt11 = new TPaveText(14,22,17,24);
   pt11->SetFillColor(42);
   TText *t19  = pt11->AddText("Analyze");
   TText *t19a = pt11->AddText("Left");
   pt11->Draw();
   TPaveText *pt12 = new TPaveText(14,19,17,21);
   pt12->SetFillColor(42);
   TText *t20  = pt12->AddText("Analyze");
   TText *t20a = pt12->AddText("Right");
   pt12->Draw();
   TPaveText *pt13 = new TPaveText(14,15,18,18);
   TText *t21 = pt13->AddText("StackNumber++");
   TText *t22 = pt13->AddText("operator[StackNumber]");
   TText *t23 = pt13->AddText("= operator found");
   pt13->Draw();
   TPaveText *pt14 = new TPaveText(12,10.8,17,13.2);
   TText *t24 = pt14->AddText("StackNumber++");
   TText *t25 = pt14->AddText("operator[StackNumber]");
   TText *t26 = pt14->AddText("= function found");
   pt14->Draw();
   TPaveText *pt15 = new TPaveText(6,7,10,9);
   TText *t27 = pt15->AddText("Error");
   TText *t28 = pt15->AddText("break of Analyze");
   pt15->Draw();
   TPaveText *pt16 = new TPaveText(0,2,7,5);
   TText *t29 = pt16->AddText("StackNumber++");
   TText *t30 = pt16->AddText("operator[StackNumber] = 0");
   TText *t31 = pt16->AddText("value[StackNumber] = value found");
   pt16->Draw();
   TArrow *ar = new TArrow(2,27,2,25.4,0.012,"|>");
   ar->SetFillColor(1);
   ar->Draw();
   ar->DrawArrow(2,22.8,2,21.2,0.012,"|>");
   ar->DrawArrow(2,19,2,17.2,0.012,"|>");
   ar->DrawArrow(2,15,2,13.2,0.012,"|>");
   ar->DrawArrow(2,11,2, 9.2,0.012,"|>");
   ar->DrawArrow(2, 7,2, 5.2,0.012,"|>");
   ar->DrawArrow(4,24,6,24,0.012,"|>");
   ar->DrawArrow(4,20,6,20,0.012,"|>");
   ar->DrawArrow(4,16,6,16,0.012,"|>");
   ar->DrawArrow(4,12,6,12,0.012,"|>");
   ar->DrawArrow(4, 8,6, 8,0.012,"|>");
   ar->DrawArrow(10,20,14,20,0.012,"|>");
   ar->DrawArrow(12,23,14,23,0.012,"|>");
   ar->DrawArrow(12,16.5,14,16.5,0.012,"|>");
   ar->DrawArrow(10,12,12,12,0.012,"|>");
   TText *ta = new TText(2.2,22.2,"err = 0");
   ta->SetTextFont(71);
   ta->SetTextSize(0.015);
   ta->SetTextColor(4);
   ta->SetTextAlign(12);
   ta->Draw();
   ta->DrawText(2.2,18.2,"not found");
//.........这里部分代码省略.........
开发者ID:MycrofD,项目名称:root,代码行数:101,代码来源:analyze.C

示例10: plotpurity

void plotpurity()
{

 Bool_t dolines = kFALSE;
 //Bool_t dolines = kTRUE;
 TString lines = "";

 TString xn = "";
 //TString xn = "_onlyQCD";
 //TString xn = "_onlyGJ";
 //TString xn = "_denominator";
 if(dolines){lines="/lines";}

 std::vector<TString> rebins;
 rebins.push_back("");
// rebins.push_back("rebin1");
// rebins.push_back("rebin2");
// rebins.push_back("rebin3");
// rebins.push_back("rebin4");
// rebins.push_back("rebin5");

 std::vector<TString> ptranges;
// ptranges.push_back("90to120");
// ptranges.push_back("120to155");
// ptranges.push_back("155to175");
 ptranges.push_back("175to190");
 ptranges.push_back("190to250");
 ptranges.push_back("250to400");
 ptranges.push_back("400to700");
 ptranges.push_back("700to1000");
 ptranges.push_back("175to1000");
 //ptranges.push_back("250to1000");
 //ptranges.push_back("400to1000");

 std::vector<TString> isovars;
 //isovars.push_back("wchiso");
 isovars.push_back("chiso");
// isovars.push_back("sieieF5x5");
// isovars.push_back("sieipF5x5");
// isovars.push_back("sipipF5x5");
// isovars.push_back("rho");
// isovars.push_back("nVtx");
// isovars.push_back("phoet");
// isovars.push_back("pfMET");

 std::vector<TString> cuts;
 cuts.push_back("a_idnc");
 cuts.push_back("b_idnc_mL30");
 cuts.push_back("c_idnc_trig");
 cuts.push_back("d_idnc_mL30_trig");
 cuts.push_back("e_idnc_t175");
 cuts.push_back("f_idnc_mL30_t175");
 cuts.push_back("g_idnc_t250");
 cuts.push_back("h_idnc_mL30_t250");
 cuts.push_back("i_idnc_mL30_allt");
// cuts.push_back("oldj");

 TString inpath = "/afs/hep.wisc.edu/cms/tperry/LoneG_slc6_491_CMSSW_7_4_14/src/LoneGamma/qcdStudy/gitignore/Lire/analyzed";
 TString outpath = "/afs/hep.wisc.edu/cms/tperry/LoneG_slc6_491_CMSSW_7_4_14/src/LoneGamma/qcdStudy/gitignore/Lire/plots";
 TString wwwpath = "/afs/hep.wisc.edu/home/tperry/www/MonoPhoton/qcdPlots/Lire/purity";

 TString inname_GJ  = inpath+"/purity_GJets_Merged.root";
 TString inname_QCD = inpath+"/purity_QCD_Merged.root";
// TString inname_GJ  = inpath+"/purity_mrg4bins_GJets.root";
// TString inname_QCD = inpath+"/purity_mrg4bins_QCD.root";
 //TString inname_GJ  = inpath+"/purity_mrg3bins_GJets.root";
 //TString inname_QCD = inpath+"/purity_mrg3bins_QCD.root";
 
 TFile *infile_GJ  = new TFile(inname_GJ);
 TFile *infile_QCD = new TFile(inname_QCD);
 
 ofstream log;
 ofstream log_latex;
 log.open (outpath+"/Purity_log"+xn+".txt");
 log_latex.open (outpath+"/Purity_log_latex"+xn+".txt");

 Int_t fillcolor = 3;
 gStyle->SetOptStat(0);
 gStyle->SetOptTitle(0);
 gStyle->SetFrameLineWidth(3);
 gStyle->SetLineWidth(2);

 TCanvas* canvas = new TCanvas("canvas","canvas",900,100,500,500);
 gStyle->SetOptStat(0);
 gPad->SetTickx();
 gPad->SetTicky();
 gStyle->SetLineWidth(3);


 TText* title = new TText(1,1,"") ;
 title->SetTextSize(0.07);
 title->SetTextColor(kBlack);
 title->SetTextAlign(13);
 title->SetTextFont(62);

 TText* extra = new TText(1,1,"") ;
 extra->SetTextSize(0.05);
 extra->SetTextColor(kBlack);
 extra->SetTextAlign(13);
 extra->SetTextFont(52);
//.........这里部分代码省略.........
开发者ID:tmrhombus,项目名称:LoneGamma,代码行数:101,代码来源:plotpurity.C

示例11: Plot_searchBin_full_ICHEP_wQCD

void Plot_searchBin_full_ICHEP_wQCD(string option="", int pull=0){ // string option="QCD"

  // Use option="QCD" to produce plots in QCD binning

  char tempname[200];
  // Open root file
  sprintf(tempname,"LLPrediction_QCD.root");

  // true: do closure test (MC prediction vs MC truth)
  // false: do data driven prediction and compare to MC truth
  bool doDataVsMC = false;

  // Add systematics in quadrature to stat. uncertainty on prediction
  // Non-closure systematic not included yet!
  bool showSystematics = false;

  bool doClosurewoIsoTrackVeto = false;

  ///////////////////////////////////////////////////////////////////////////////////////////
  ////Some cosmetic work for official documents.
  //
  // Set basic style
  //
  setTDRStyle();
  gStyle->SetPalette(1) ; // for better color output

  //
  // Canvas size
  int W = 1200;
  int H = 740;
  int H_ref = 740;
  int W_ref = 800;
  float T = 0.10*H_ref;
  float B = 0.06*H_ref;
  float L = 0.16*W_ref;
  float R = 0.04*W_ref;

  //
  // Various vertical line coordinates
  float ymax_top = 40000.;
  float ymin_top = 0.015;

  float ymax2_top = 1000.;
  float ymax3_top = 200.;
  float ymax4_top = 30.;
  float ymax5_top = 5.;

  float ymax_bottom = 1.99;
  float ymin_bottom = 0.01;

  float ymax2_bottom = 2.15;
  float ymax3_bottom = 2.15;
  float ymax4_bottom = 2.15;

  //
  // Luminosity information for scaling
  double lumi     = 7.6; // normaliza to this lumi (fb-1)
  double lumi_ref = 7.6; // normaliza to 3 (fb-1)
  
  ///////////////////////////////////////////////////////////////////////////////////////////
  //
  // More specific style set, opening input files etc

  gStyle->SetOptStat(0);  ///to avoid the stat. on the plots
  //gStyle->SetErrorX(0);
  char xtitlename[200];
  char ytitlename[200];

  TFile * LLFile = new TFile(tempname,"R");
  printf("Opened %s\n",tempname);

  //
  // Define legend
  //
  Float_t legendX1 = .655; //.50;
  Float_t legendX2 = .955; //.70;
  Float_t legendY1 = .53; //.65;
  Float_t legendY2 = .78;

  TLegend* catLeg1 = new TLegend(legendX1,legendY1,legendX2,legendY2);
  //catLeg1->SetTextSize(0.060);
  catLeg1->SetTextSize(0.044);
  catLeg1->SetTextFont(42);
  catLeg1->SetFillColor(0);
  catLeg1->SetLineColor(1);
  catLeg1->SetBorderSize(1);

  //
  // Define canvas
  //
  TCanvas *canvas = new TCanvas("canvas","canvas",10,10,W,H);

  canvas->SetFillColor(0);
  canvas->SetBorderMode(0);
  canvas->SetFrameFillStyle(0);
  canvas->SetFrameBorderMode(0);
  canvas->SetLeftMargin( L/W );
  canvas->SetRightMargin( R/W );
  canvas->SetTopMargin( T/H );
  canvas->SetBottomMargin( B/H );
//.........这里部分代码省略.........
开发者ID:skurz,项目名称:Lost_Lepton_delphiClass,代码行数:101,代码来源:Plot_searchBin_full_ICHEP_wQCD.C

示例12: style

void style()
{
  ////////////////////////////////////////////////////////////////////
  // PURPOSE:
  //
  // This macro defines a reasonable style for (black-and-white)
  // "publication quality" ROOT plots. The default settings contain
  // many features that are either not desirable for printing on white
  // paper or impair the general readibility of plots.
  //
  // USAGE:
  //
  // Simply include the line
  //   gROOT->ProcessLine(".x $LHCBSTYLE/root/lhcbstyle.C");
  // at the beginning of your root macro.
  //
  // SOME COMMENTS:
  //
  // Statistics and fit boxes:
  //
  // "Decorative" items around the histogram are kept to a minimum.
  // In particular there is no box with statistics or fit information.
  // You can easily change this either by editing your private copy
  // of this style file or by calls to "gStyle" in your macro.
  // For example,
  //   gStyle->SetOptFit(1011);
  // will add some fit information.
  //
  // Font:
  //
  // The font is chosen to be 62, i.e.helvetica-bold-r-normal with
  // precision 2. Font is of course a matter of taste, but most people
  // will probably agree that Helvetica bold gives close to optimal
  // readibility in presentations. It appears to be the ROOT default,
  // and since there are still some features in ROOT that simply won't
  // respond to any font requests, it is the wise choice to avoid
  // ugly font mixtures on the same plot... The precision of the font (2)
  // is chosen in order to have a rotatable and scalable font. Be sure
  // to use true-type fonts! I.e.
  // Unix.*.Root.UseTTFonts: true  in your .rootrc file.
  //
  // "Landscape histograms":
  //
  // The style here is designed for more or less quadratic plots.
  // For very long histograms, adjustements are needed. For instance,
  // for a canvas with 1x5 histograms:
  //  TCanvas* c1 = new TCanvas("c1", "L0 muons", 600, 800);
  //  c1->Divide(1,5);
  // adaptions like the following will be needed:
  //  gStyle->SetTickLength(0.05,"x");
  //  gStyle->SetTickLength(0.01,"y");
  //  gStyle->SetLabelSize(0.15,"x");
  //  gStyle->SetLabelSize(0.1,"y");
  //  gStyle->SetStatW(0.15);
  //  gStyle->SetStatH(0.5);
  //
  ////////////////////////////////////////////////////////////////////
  /*cout << "executing lhcbStyle.C:" << endl;
    cout << "                      " << endl;
    cout << "                      " << endl;
    cout << "                         $      $   $   $$$   $    " << endl;
    cout << "                         $      $   $  $      $    " << endl;
    cout << "                         $      $$$$$  $      $$$  " << endl;
    cout << "                         $      $   $  $      $  $ " << endl;
    cout << "                         $$$$$  $   $   $$$   $$$  " << endl;
    cout << " " << endl;
    cout << "                           LHCb ROOT style file " << endl;
    cout << " " << endl;
    cout <<
    "     Problems, suggestions, contributions to [email protected]" << endl;
    cout << " " << endl;*/
  //gROOT->Reset();
  TStyle *lhcbStyle= new TStyle("lhcbStyle","Thomas personal plots style");
  // use helvetica-bold-r-normal, precision 2 (rotatable)
  Int_t lhcbFont = 62;
  // line thickness
  Double_t lhcbWidth = 3.00;
  // use plain black on white colors
  lhcbStyle->SetFrameBorderMode(0);
  lhcbStyle->SetCanvasBorderMode(0);
  lhcbStyle->SetPadBorderMode(0);
  lhcbStyle->SetPadColor(0);
  lhcbStyle->SetCanvasColor(0);
  lhcbStyle->SetStatColor(0);
  lhcbStyle->SetPalette(1);
  //lhcbStyle->SetTitleColor(0);
  //lhcbStyle->SetFillColor(0);
  // set the paper & margin sizes
  lhcbStyle->SetPaperSize(20,26);
  lhcbStyle->SetPadTopMargin(0.05);
  lhcbStyle->SetPadRightMargin(0.05); // increase for colz plots!!
  lhcbStyle->SetPadBottomMargin(0.16);
  lhcbStyle->SetPadLeftMargin(0.14);
  // use large fonts
  lhcbStyle->SetTextFont(lhcbFont);
  lhcbStyle->SetTextSize(0.08);
  lhcbStyle->SetLabelFont(lhcbFont,"x");
  lhcbStyle->SetLabelFont(lhcbFont,"y");
  lhcbStyle->SetLabelFont(lhcbFont,"z");
  lhcbStyle->SetLabelSize(0.03,"x");
//.........这里部分代码省略.........
开发者ID:renqgl90,项目名称:Seeding,代码行数:101,代码来源:style.C

示例13: postprocess

void postprocess(TCanvas* c2, const char* name, Int_t rWrite, Int_t rPerformance,const char* system) {
    if (rPerformance){
        TLatex *alice = new TLatex(0.22,0.57,"Pb-Pb #sqrt{s_{NN}} = 2.76 TeV");
        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();

        TDatime now;
        int iDate = now.GetDate();
        int iYear=iDate/10000;
        int iMonth=(iDate%10000)/100;
        int iDay=iDate%100;
        char* cMonth[12]={"Jan","Feb","Mar","Apr","May","Jun",
                          "Jul","Aug","Sep","Oct","Nov","Dec"};
        char cStamp1[25],cStamp2[25];
        sprintf(cStamp1,"%i %s %i",iDay, cMonth[iMonth-1], iYear);
        sprintf(cStamp2,"%i/%.2d/%i",iDay, iMonth, iYear);


        TText *date = new TText(0.67,0.48,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_performance.png");
//                 TASImage *myAliceLogo = new TASImage("alice_performance.eps");
// //    TASImage *myAliceLogo = new TASImage("alice_logo_transparent.png");
//                 myAliceLogo->Draw();

        DrawALICELogo(0,0.65,0.52,0.8,0.8);


    }

    if (rWrite == 1){
        c2->SaveAs(Form("%s_%s.png",name,system));
        //}
        //if (rWrite == 2)
        c2->SaveAs(Form("%s.eps",name));
    }
}
开发者ID:maszyman,项目名称:PlotMacros,代码行数:66,代码来源:drawDCA.C

示例14: gluinoMass

void gluinoMass(double lumi=-1., double maxInstLumi=-1.) {
	
  if (lumi<0)
    lumi=877.;
  if (maxInstLumi<0)
    maxInstLumi=1300.;
  LimitPlots plots(lumi);
  
  plots.calculateCrossSections(7,4,39,9);
	
  // expected limit (1 and 2 sigma bands)
  TGraph* g_exp = plots.getExpMassLimitGluino();
  TGraphAsymmErrors* g_exp1 = plots.getExpMassLimitGluino1Sig();
  TGraphAsymmErrors* g_exp2 = plots.getExpMassLimitGluino2Sig();
  
  // three points on counting expt curve
  TGraph* g_gluino = plots.getMassLimitGluino();
  TGraph* g_stop = plots.getMassLimitStop();
  
  // one point from lifetime fit
  TGraph* g_tp = plots.getMassLimitGluinoTP();
  
  // theory prediction
  TGraph* g_thGluino = plots.getGluinoTheory();
  TGraph* g_thStop = plots.getStopTheory();
  
  TCanvas* canvas = new TCanvas("canvas");
  
  //canvas->SetGrid();
  canvas->SetLogy();
  
  TH1 * h;
  h = canvas->DrawFrame(300., .02, 1000., 1e2);
  //h->SetTitle("Beamgap Expt;m_{#tilde{g}} [GeV/c^{2}]; Stopped HSCP Cross Section #times BR [pb]");
  h->SetTitle("Beamgap Expt;m_{#tilde{g}} [GeV/c^{2}]; #sigma(pp #rightarrow #tilde{g}#tilde{g}) #times BR(#tilde{g} #rightarrow g#tilde{#chi}^{0}) [pb]");
  
  // not covered region
  TBox* nc = new TBox(100., .1, 150., 5e2);
  nc->SetFillStyle(3354);
  nc->SetFillColor(kRed-4);
  //nc->Draw();
  
  // details
  TPaveText* blurb = new TPaveText(300., 2, 550., 1e2);
  blurb->AddText("CMS Preliminary 2012");

  std::stringstream label;
  label<<"#int L dt = "<<lumi<<" fb^{-1}";
  blurb->AddText(label.str().c_str());
  label.str("");
  double peakInstLumi=maxInstLumi;
  int exponent=30;
  while (peakInstLumi>10) {
    peakInstLumi/=10.;
    ++exponent;
  }
  label<<"L^{max}_{inst} = "<<peakInstLumi<<" x 10^{"<<exponent<<"} cm^{-2}s^{-1}";
  blurb->AddText(label.str().c_str());
  label.str("");
  label << "#sqrt{s} = " << ENERGY << " TeV";
  blurb->AddText(label.str().c_str());
  blurb->AddText("m_{#tilde{g}} - m_{#tilde{#chi}^{0}} = 100 GeV/c^{2}");
  //blurb->AddText("m_{#tilde{t}} - m_{#tilde{#chi}^{0}} = 200 GeV/c^{2}");	
  blurb->SetTextFont(42);
  blurb->SetBorderSize(0);
  blurb->SetFillColor(0);
  blurb->SetShadowColor(0);
  blurb->SetTextAlign(12);
  blurb->SetTextSize(0.032);

  
  // legend
  TBox *legbg = new TBox(600., 2., 900., 1e2);
  legbg->Draw();
  TLegend *leg = new TLegend(600., 2., 900., 1e2,"95% C.L. Limits","");
  leg->SetTextSize(0.028);
  leg->SetBorderSize(0);
  leg->SetTextFont(42);
  leg->SetFillColor(0);
  leg->AddEntry(g_exp, "Expected: 10 #mus - 1000 s Counting Exp. ", "l");
  leg->AddEntry(g_exp1, "Expected #pm1#sigma: 10 #mus - 1000 s Counting Exp. ", "f");
  leg->AddEntry(g_exp2, "Expected #pm2#sigma: 10 #mus - 1000 s Counting Exp. ", "f");
  //	  leg->AddEntry(graph3, "Obs.: 10^{6} s Counting Exp.", "l");
  leg->AddEntry(g_gluino, "Obs.: 10 #mus - 1000 s Counting Exp. ", "l");
  leg->AddEntry(g_tp, "Obs.: 10 #mus Timing Profile ", "l");
  //leg->AddEntry(g_stop, "Obs.: 10 #mus - 1000 s Counting Exp. (#tilde{t})", "l");
  //leg->AddEntry(graph_em, "Obs.: 10 #mus - 1000 s Counting Exp. (EM only)", "l");
  //  leg->AddEntry(graph1, "Obs.: 570 ns Counting Exp.", "l");
  leg->Draw();
  
  
  
  // 2 sigma expected band
  g_exp2->SetLineColor(0);
  g_exp2->SetLineStyle(0);
  g_exp2->SetLineWidth(0);
  g_exp2->SetFillColor(5);
  g_exp2->SetFillStyle(1001);
  g_exp2->Draw("3");
  
//.........这里部分代码省略.........
开发者ID:allenji,项目名称:StoppPtls,代码行数:101,代码来源:gluinoMass.C

示例15: MakeClosurePlot


//.........这里部分代码省略.........
  for (Int_t i = 0; i < hPred->GetNbinsX()+2; i++) {
    if (hPred->GetBinContent(i) > 1e-6) { //< not empty
      double binerror2 = (pow(hPred->GetBinError(i), 2));
      double binerror = sqrt(binerror2);
      ratiosysterr->SetBinError(i, binerror / hPred->GetBinContent(i));
    }
  }


  double max = hObs->GetMaximum();
  if (hPred->GetMaximum() > max) max = hPred->GetMaximum();

  if (logy) {
    hPred->SetMaximum(max*10);
    hPred->SetMinimum(0.09);
  } else {
    hPred->SetMaximum(max*1.5);
    hPred->SetMinimum(0.);
  }

  hPred->GetYaxis()->SetTitle("Events / bin");
  hPred->Draw("hist");
  hObs->Draw("e1,same");
  staterr->Draw("e2 same");
  hPred->GetXaxis()->SetTitleSize(0.035);
  hPred->GetXaxis()->SetLabelSize(0.035);
  /* hObs->GetYaxis()->SetTitleSize(0.035); */
  /* hObs->GetYaxis()->SetLabelSize(0.035); */

  TLegend * leg2 = new TLegend(0.72, 0.68, 0.94, 0.92);
  set_style(leg2,0.035);
  leg2->AddEntry(hObs,"Obs.","elp");
  leg2->AddEntry(hPred,"Pred.","f");
  leg2->AddEntry(staterr, "Syst. uncert.", "f");
  leg2->Draw();
  TLatex * latex = new TLatex();
  latex->SetNDC();
  latex->SetTextAlign(12);
  latex->SetTextFont(62);
  latex->SetTextSize(0.042);
  latex->DrawLatex(0.19, 0.89, "CMS Simulation");
  latex->SetTextSize(0.03);
  TString stamp = Form("#sqrt{s} = 13 TeV, L = %3.1f fb^{-1}", int_lumi);
  latex->DrawLatex(0.19, 0.84, stamp);

  pad2->cd();
  pad2->SetGridy(0);
  ratiostaterr->GetXaxis()->SetRangeUser(0,6);
  ratiostaterr->Draw("e2");
  //ratiosysterr->Draw("e2 same");
  ratiostaterr->Draw("e2 same");
  ratiounity->Draw();
  ratio->Draw("e1 same");

  TPaveText * pave = new TPaveText(0.18, 0.86, 0.4, 0.96, "brNDC");
  pave->SetLineColor(0);
  pave->SetFillColor(kWhite);
  pave->SetShadowColor(0);
  pave->SetBorderSize(1);
  double nchisq = hObs->Chi2Test(hPred, "UWCHI2/NDF, P"); // MC uncert. (stat)
  double p_value = hObs->Chi2Test(hPred, "UW"); // MC uncert. (stat)
  // //double kolprob = hdata_obs->KolmogorovTest(hmc_pred); // MC uncert. (stat)
  TText * text = pave->AddText(Form("#chi_{#nu}^{2}/ndf = %.3f, p = %.3f", nchisq, p_value));
  // //TText * text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f", nchisq, kolprob));
  text->SetTextFont(62);
  text->SetTextSize(0.07);
  // text->SetTextSize(0.06);
  pave->Draw();
  
  /* TLegend * ratioleg = new TLegend(0.72, 0.88, 0.94, 0.96); */
  /* set_style(ratioleg); */
  /* ratioleg->SetTextSize(0.07); */
  /* ratioleg->AddEntry(ratiostaterr, "MC uncert. (stat)", "f"); */
  /* ratioleg->Draw(); */

  pad1->cd();
  gPad->RedrawAxis();
  gPad->Modified();
  gPad->Update();
  pad2->cd();
  gPad->RedrawAxis();
  gPad->Modified();
  gPad->Update();

  c1->cd();
  
  c1->Print("Closure/plots/no_dp_cut/"+name+".pdf");

  delete staterr;
  delete ratio;
  delete ratiostaterr;
  delete ratiosysterr;
  delete leg2;
  // delete ratioleg;
  delete pad1;
  delete pad2;
  delete c1;
  delete latex;
  
}
开发者ID:jbradmil,项目名称:csa14,代码行数:101,代码来源:DoClosureTests.C


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