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


C++ TArrow::SetLineWidth方法代码示例

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


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

示例1: drawLabels

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

示例2: drawAxis

void drawAxis()
{
  TArrow *arr = new TArrow(0,0,1,0,0.03,"|>");
  arr->SetFillColor(1);
  arr->SetLineWidth(2);
  arr->Draw();
  
  arr = new TArrow(0,0,0,1,0.03,"|>");
  arr->SetFillColor(1);
  arr->SetLineWidth(2);
  arr->Draw();
}
开发者ID:skymeson,项目名称:root_macros,代码行数:12,代码来源:phaseDiagram.C

示例3: drawArrow

void drawArrow(Double_t u, Double_t v, Double_t du, Double_t due, Double_t dv, Double_t dve){

  if ( du+dv ){ 

    Double_t arrowLengthSqr = du*du+dv*dv;
    Double_t relErrorOnArrowLength = sqrt(du*du*due*due+dv*dv*dve*dve)/arrowLengthSqr;
    
    Int_t color = 0; //-10, -9, -7, -4, 0
    Int_t lwid = 2;
    if ( relErrorOnArrowLength>0.5 ) color=kBlue-9;
    if ( relErrorOnArrowLength<0.4 ) color=kBlue-7;
    if ( relErrorOnArrowLength<0.3 ) color=kBlue-4;
    if ( relErrorOnArrowLength<0.2 ) color=kBlue;
    //    if ( relErrorOnArrowLength<0.1 ) color=kBlue;
    if ( relErrorOnArrowLength<0.1 ) {
      color=kBlue;
      lwid = 3;
    }
   if ( relErrorOnArrowLength<0.05 ) {
      color=kBlue;
      lwid = 4;
    }
   
   Double_t arrowSize = 0.006;

    TArrow * ar = new TArrow(u-0.5*du,v-0.5*dv,u+0.5*du,v+0.5*dv,arrowSize,"|>");
    ar->SetLineWidth(lwid);
    ar->SetFillColor(color);
    ar->SetLineColor(color);
    ar->Draw();
  }

}
开发者ID:GiacomoSguazzoni,项目名称:usercode,代码行数:33,代码来源:rootils.C

示例4: Plot

void Plot(RooRealVar *mass, RooDataSet *data, RooAbsPdf *pdf, pair<double,double> sigRange, vector<double> fwhmRange, string title, string savename){

  double semin=sigRange.first;
  double semax=sigRange.second;
  double fwmin=fwhmRange[0];
  double fwmax=fwhmRange[1];
  double halfmax=fwhmRange[2];
  double binwidth=fwhmRange[3];

  RooPlot *plot = mass->frame(Bins(binning_),Range("higgsRange"));
  if (data) data->plotOn(plot,Invisible());
  pdf->plotOn(plot,NormRange("higgsRange"),Range(semin,semax),FillColor(19),DrawOption("F"),LineWidth(2),FillStyle(1001),VLines(),LineColor(15));
  TObject *seffLeg = plot->getObject(int(plot->numItems()-1));
  pdf->plotOn(plot,NormRange("higgsRange"),Range(semin,semax),LineColor(15),LineWidth(2),FillStyle(1001),VLines());
  pdf->plotOn(plot,NormRange("higgsRange"),Range("higgsRange"),LineColor(kBlue),LineWidth(2),FillStyle(0));
  TObject *pdfLeg = plot->getObject(int(plot->numItems()-1));
  if (data) data->plotOn(plot,MarkerStyle(kOpenSquare));
  TObject *dataLeg = plot->getObject(int(plot->numItems()-1));
  TLegend *leg = new TLegend(0.15,0.89,0.5,0.55);
  leg->SetFillStyle(0);
  leg->SetLineColor(0);
  leg->SetTextSize(0.03);
  if (data) leg->AddEntry(dataLeg,"Simulation","lep");
  leg->AddEntry(pdfLeg,"Parametric model","l");
  leg->AddEntry(seffLeg,Form("#sigma_{eff} = %1.2f GeV",0.5*(semax-semin)),"fl");

  plot->GetXaxis()->SetNdivisions(509);
  halfmax*=(plot->getFitRangeBinW()/binwidth);
  TArrow *fwhmArrow = new TArrow(fwmin,halfmax,fwmax,halfmax,0.02,"<>");
  fwhmArrow->SetLineWidth(2.);
  TPaveText *fwhmText = new TPaveText(0.15,0.45,0.45,0.58,"brNDC");
  fwhmText->SetFillColor(0);
  fwhmText->SetLineColor(kWhite);
  fwhmText->SetTextSize(0.03);
  fwhmText->AddText(Form("FWHM = %1.2f GeV",(fwmax-fwmin)));

  TLatex lat1(0.65,0.85,"#splitline{CMS Preliminary}{Simulation}");
  lat1.SetNDC(1);
  lat1.SetTextSize(0.03);
  TLatex lat2(0.65,0.75,title.c_str());
  lat2.SetNDC(1);
  lat2.SetTextSize(0.025);

  TCanvas *canv = new TCanvas("c","c",600,600);
  plot->SetTitle("");
  plot->GetXaxis()->SetTitle("m_{#gamma#gamma} (GeV)");
  plot->Draw();
  leg->Draw("same");
  fwhmArrow->Draw("same <>");
  fwhmText->Draw("same");
  lat1.Draw("same");
  lat2.Draw("same");
  canv->Print(Form("%s.pdf",savename.c_str()));
  canv->Print(Form("%s.png",savename.c_str()));
  string path = savename.substr(0,savename.find('/'));
  canv->Print(Form("%s/animation.gif+100",path.c_str()));
  delete canv;

}
开发者ID:h2gglobe,项目名称:UserCode,代码行数:59,代码来源:makeParametricSignalModelPlots.C

示例5: TArrow

void
HHV4Vector::Draw(Int_t color, Int_t style) const
{  // draw particle for event display in x-y view
  TArrow *Ar = new TArrow(0, 0, Px(), Py(), 0.001, "|>");
  Ar->SetLineColor(color);
  Ar->SetFillColor(color);
  Ar->SetLineWidth(3);
  Ar->SetLineStyle(style);
  Ar->Draw();
}
开发者ID:ajgilbert,项目名称:ICHiggsTauTau,代码行数:10,代码来源:HHV4Vector.cpp

示例6: transparency

void transparency()
{
   TCanvas *c1 = new TCanvas("c1", "c1",224,330,700,527);
   c1->Range(-0.125,-0.125,1.125,1.125);

   TLatex *tex = new TLatex(0.06303724,0.0194223,"This text is opaque and this line is transparent");
   tex->SetLineWidth(2);
   tex->Draw();

   TArrow *arrow = new TArrow(0.5555158,0.07171314,0.8939828,0.6195219,0.05,"|>");
   arrow->SetLineWidth(4);
   arrow->SetAngle(30);
   arrow->Draw();

   // Draw a transparent graph.
   Double_t x[10] = {
   0.5232808, 0.8724928, 0.9280086, 0.7059456, 0.7399714,
   0.4659742, 0.8241404, 0.4838825, 0.7936963, 0.743553};
   Double_t y[10] = {
   0.7290837, 0.9631474, 0.4775896, 0.6494024, 0.3555777,
   0.622012, 0.7938247, 0.9482072, 0.3904382, 0.2410359};
   TGraph *graph = new TGraph(10,x,y);
   graph->SetLineColorAlpha(46, 0.1);
   graph->SetLineWidth(7);
   graph->Draw("l");

   // Draw an ellipse with opaque colors.
   TEllipse *ellipse = new TEllipse(0.1740688,0.8352632,0.1518625,0.1010526,0,360,0);
   ellipse->SetFillColor(30);
   ellipse->SetLineColor(51);
   ellipse->SetLineWidth(3);
   ellipse->Draw();

   // Draw an ellipse with transparent colors, above the previous one.
   ellipse = new TEllipse(0.2985315,0.7092105,0.1566977,0.1868421,0,360,0);
   ellipse->SetFillColorAlpha(9, 0.571);
   ellipse->SetLineColorAlpha(8, 0.464);
   ellipse->SetLineWidth(3);
   ellipse->Draw();

   // Draw a transparent blue text.
   tex = new TLatex(0.04871059,0.1837649,"This text is transparent");
   tex->SetTextColorAlpha(9, 0.476);
   tex->SetTextSize(0.125);
   tex->SetTextAngle(26.0);
   tex->Draw();
}
开发者ID:Y--,项目名称:root,代码行数:47,代码来源:transparency.C

示例7: draw_synapse

void draw_synapse(Double_t cx1, Double_t cy1, Double_t cx2, Double_t cy2,
                  Double_t  rad1, Double_t rad2, Double_t weightNormed)
{
   const Double_t TIP_SIZE   = 0.01;
   const Double_t MAX_WEIGHT = 8;
   const Double_t MAX_COLOR  = 100;  // red
   const Double_t MIN_COLOR  = 60;   // blue

   if (weightNormed == 0) return;

   //   gStyle->SetPalette(100, NULL);

   TArrow *arrow = new TArrow(cx1+rad1, cy1, cx2-rad2, cy2, TIP_SIZE, ">");
   arrow->SetFillColor(1);
   arrow->SetFillStyle(1001);
   arrow->SetLineWidth((Int_t)(TMath::Abs(weightNormed)*MAX_WEIGHT+0.5));
   arrow->SetLineColor((Int_t)((weightNormed+1.0)/2.0*(MAX_COLOR-MIN_COLOR)+MIN_COLOR+0.5));
   arrow->Draw();
}
开发者ID:TopBrussels,项目名称:TopTreeAnalysisBase,代码行数:19,代码来源:network.C

示例8: DrawDataStackedMC

void CCProtonPi0_SideBandTool::Plot_NoRatio(int ind, std::string sb_name, std::string var_name, MnvH1D* data, MnvH1D* mc_total, MnvH1D* signal, MnvH1D* WithPi0, MnvH1D* QELike, MnvH1D* SinglePiPlus, MnvH1D* Other)
{
    (void) mc_total;
    std::string type;
    if (ind == 0) type = "Nominal";
    else type = "Fitted";

    std::string norm = "POT";
    std::string plot_title = "Side Band: " + sb_name + " " + type + " " + norm + " Normalized";

    // Get Histograms -- Use new Histograms not to change originals
    MnvH1D* h_data = new MnvH1D(*data);
    h_data->GetYaxis()->CenterTitle();
    h_data->GetXaxis()->SetNdivisions(5,5,0);
    h_data->GetYaxis()->SetNdivisions(5,5,0);

    MnvH1D* h_signal = new MnvH1D(*signal);
    h_signal->GetYaxis()->CenterTitle();
    h_signal->SetFillColor(kGreen+1);
    h_signal->SetLineColor(kGreen+1);
    h_signal->SetFillStyle(3002);
    h_signal->SetLineWidth(2);
    h_signal->GetXaxis()->SetNdivisions(5,5,0);
    h_signal->GetYaxis()->SetNdivisions(5,5,0);

    MnvH1D* h_WithPi0 = new MnvH1D(*WithPi0);
    h_WithPi0->GetYaxis()->CenterTitle();
    h_WithPi0->SetFillColor(kRed);
    h_WithPi0->SetLineColor(kRed);
    h_WithPi0->SetFillStyle(3002);
    h_WithPi0->SetLineWidth(2);
    h_WithPi0->GetXaxis()->SetNdivisions(5,5,0);
    h_WithPi0->GetYaxis()->SetNdivisions(5,5,0);
  
    MnvH1D* h_QELike = new MnvH1D(*QELike);
    h_QELike->GetYaxis()->CenterTitle();
    h_QELike->SetFillColor(kOrange-1);
    h_QELike->SetLineColor(kOrange-1);
    h_QELike->SetFillStyle(3002);
    h_QELike->SetLineWidth(2);
    h_QELike->GetXaxis()->SetNdivisions(5,5,0);
    h_QELike->GetYaxis()->SetNdivisions(5,5,0);
 
    MnvH1D* h_SinglePiPlus = new MnvH1D(*SinglePiPlus);
    h_SinglePiPlus->GetYaxis()->CenterTitle();
    h_SinglePiPlus->SetFillColor(kBlue);
    h_SinglePiPlus->SetLineColor(kBlue);
    h_SinglePiPlus->SetFillStyle(3002);
    h_SinglePiPlus->SetLineWidth(2);
    h_SinglePiPlus->GetXaxis()->SetNdivisions(5,5,0);
    h_SinglePiPlus->GetYaxis()->SetNdivisions(5,5,0);

    MnvH1D* h_Other = new MnvH1D(*Other);
    h_Other->GetYaxis()->CenterTitle();
    h_Other->SetFillColor(kGray+2);
    h_Other->SetLineColor(kGray+2);
    h_Other->SetFillStyle(3002);
    h_Other->SetLineWidth(2);
    h_Other->GetXaxis()->SetNdivisions(5,5,0);
    h_Other->GetYaxis()->SetNdivisions(5,5,0);
  
    // Clear Error Bars
    h_signal->ClearAllErrorBands();
    h_WithPi0->ClearAllErrorBands();
    h_QELike->ClearAllErrorBands();
    h_SinglePiPlus->ClearAllErrorBands();
    h_Other->ClearAllErrorBands();

    TObjArray* mc_hists = new TObjArray;
    mc_hists->Add(h_Other);
    mc_hists->Add(h_SinglePiPlus);
    mc_hists->Add(h_QELike);
    mc_hists->Add(h_WithPi0);
    mc_hists->Add(h_signal);
 
    // ------------------------------------------------------------------------
    // Plot 
    // ------------------------------------------------------------------------
    MnvPlotter* plotter = new MnvPlotter();
    plotter->SetRootEnv();
 
    gStyle->SetCanvasDefW(640);
    gStyle->SetCanvasDefH(480); // 4x3 aspect ratio
    gStyle->SetPadRightMargin(0.05);
    gStyle->SetEndErrorSize(2);
    gStyle->SetStripDecimals(false);

    plotter->axis_minimum = 0.01;
    plotter->legend_text_size  = 0.04;
    plotter->legend_text_font = 42; // default 62 (bold)
    plotter->data_marker_size = 0.8;
    plotter->axis_title_font_x   = 42;
    plotter->axis_title_size_x   = 0.06;
    plotter->axis_title_offset_x = 1.1;
    plotter->axis_title_font_y   = 42;
    plotter->axis_title_size_y   = 0.06;
    plotter->axis_title_offset_y = 1.0;
    plotter->axis_label_size = 0.05;
    plotter->axis_label_font = 42;
    plotter->headroom = 1.75;
//.........这里部分代码省略.........
开发者ID:oaltinok,项目名称:Minerva_Neutrino,代码行数:101,代码来源:CCProtonPi0_SideBandTool.cpp

示例9: toyns

   void toyplotsge1btight() {

      gStyle->SetPadBottomMargin(0.15) ;
      gStyle->SetPadLeftMargin(0.15) ;
      gStyle->SetOptTitle(0) ;


      TCanvas* c1 = new TCanvas("c1","c1") ;

      TArrow* arrow = new TArrow() ;
      arrow->SetLineWidth(3) ;


      TChain toyns("tt_toy_nosusyfit") ;
      toyns.Add("an-11-257-v3-files/output-files/toyge1btight-smonly-mctest.root") ;

      TChain bgo("tt_cls_bgonly") ;
      TChain spb("tt_cls_splusb") ;

      bgo.Add("an-11-257-v3-files/output-files/toyge1btight-smonly-mctest.root") ;
      spb.Add("an-11-257-v3-files/output-files/toyge1btight-smonly-mctest.root") ;



     //============ fit values

      gStyle->SetOptStat("emr") ;

      TH1F* httwjfit = new TH1F("httwjfit","ttwj",40, 0., 45. ) ;
      TH1F* hqcdfit  = new TH1F("hqcdfit" ,"qcd" ,40, 0., 10. ) ;
      TH1F* hznnfit  = new TH1F("hznnfit" ,"znn" ,40, 0., 20. ) ;

      toyns.Draw("ttwj_sig_fit>>httwjfit","") ;
      toyns.Draw("qcd_sig_fit>>hqcdfit","") ;
      toyns.Draw("znn_sig_fit>>hznnfit","") ;

      httwjfit->SetLineWidth(2) ;
      hqcdfit->SetLineWidth(2) ;
      hznnfit->SetLineWidth(2) ;

      httwjfit->SetFillColor(11) ;
      hqcdfit->SetFillColor(11) ;
      hznnfit->SetFillColor(11) ;

      httwjfit->SetXTitle("Fit ttwj SIG events") ;
      hqcdfit->SetXTitle("Fit QCD SIG events") ;
      hznnfit->SetXTitle("Fit Znn SIG events") ;

      httwjfit->SetYTitle("Toy experiments") ;
      hqcdfit->SetYTitle("Toy experiments") ;
      hznnfit->SetYTitle("Toy experiments") ;

      httwjfit->Draw() ;
      arrow->DrawArrow(19.6,40,19.6,0) ;
      c1->SaveAs("an-11-257-v3-files/output-files/toymc-ttwj-sig-fit-ge1btight.png") ;
      hqcdfit->Draw() ;
      arrow->DrawArrow(1.3,60,1.3,0) ;
      c1->SaveAs("an-11-257-v3-files/output-files/toymc-qcd-sig-fit-ge1btight.png") ;
      hznnfit->Draw() ;
      arrow->DrawArrow(4.25,40,4.25,0) ;
      c1->SaveAs("an-11-257-v3-files/output-files/toymc-znn-sig-fit-ge1btight.png") ;


     //============ fit uncertainty

      TH1F* httwjerr = new TH1F("httwjerr","ttwj",40, 0., 10. ) ;
      TH1F* hqcderr  = new TH1F("hqcderr" ,"qcd" ,40, 0., 8. ) ;
      TH1F* hznnerr  = new TH1F("hznnerr" ,"znn" ,40, 0., 10. ) ;

      toyns.Draw("ttwj_sig_err>>httwjerr","") ;
      toyns.Draw("qcd_sig_err>>hqcderr","") ;
      toyns.Draw("znn_sig_err>>hznnerr","") ;

      httwjerr->SetLineWidth(2) ;
      hqcderr->SetLineWidth(2) ;
      hznnerr->SetLineWidth(2) ;

      httwjerr->SetFillColor(11) ;
      hqcderr->SetFillColor(11) ;
      hznnerr->SetFillColor(11) ;

      httwjerr->SetXTitle("err ttwj SIG events") ;
      hqcderr->SetXTitle("err QCD SIG events") ;
      hznnerr->SetXTitle("err Znn SIG events") ;

      httwjerr->SetYTitle("Toy experiments") ;
      hqcderr->SetYTitle("Toy experiments") ;
      hznnerr->SetYTitle("Toy experiments") ;

      httwjerr->Draw() ;
      c1->SaveAs("an-11-257-v3-files/output-files/toymc-ttwj-sig-err-ge1btight.png") ;
      hqcderr->Draw() ;
      c1->SaveAs("an-11-257-v3-files/output-files/toymc-qcd-sig-err-ge1btight.png") ;
      hznnerr->Draw() ;
      c1->SaveAs("an-11-257-v3-files/output-files/toymc-znn-sig-err-ge1btight.png") ;


     //============ q value distributions.

      gStyle->SetOptStat(0) ;
//.........这里部分代码省略.........
开发者ID:SusyRa2b,项目名称:Statistics,代码行数:101,代码来源:toyplotsge1btight.c

示例10: gluinostopMassLifetime


//.........这里部分代码省略.........
  TGraph* stop_exp      = new TGraph (*plots.getExpLimitStop());
  stop_xs.xsec2mass (stop_exp);
  TGraphAsymmErrors* stop_exp_1sig = new TGraphAsymmErrors (*plots.getExpLimitStop1Sig());
  stop_xs.xsec2mass (stop_exp_1sig);
  TGraphAsymmErrors* stop_exp_2sig = new TGraphAsymmErrors (*plots.getExpLimitStop2Sig());
  stop_xs.xsec2mass (stop_exp_2sig);

  
  TCanvas *canvas = new TCanvas("allMassLifetime", "allMassLifetime", 800, 600);
  
  canvas->SetLogx();
//  canvas->SetGridy();

  
  TH1F* h = new TH1F ("h", "", 1,  7.5e-8, 1e6);
  h->SetStats (0);
  h->SetMinimum (300);
  h->SetMaximum (2000);
  h->SetTitle("Beamgap Expt");
  //  h->GetXaxis()->SetTitle("#tau_{#tilde{g},#tilde{t},#tilde{#tau}} [s]");
  h->GetXaxis()->SetTitle("#tau [s]");
  h->GetYaxis()->SetTitle("m [GeV]  ");
  h->Draw ("");

  
  
  // limit arrows
  double* x = g_obs->GetX();
  for (int i = 0; i < g_obs->GetN(); ++i) {
    if (x[i] > 0.5) {
      double y =  g_obs->GetY()[i];
      TArrow* arrow = new TArrow (x[i], y, h->GetXaxis()->GetXmin(), y, 0.02);
      arrow->SetLineColor (kRed);
      arrow->SetLineWidth (2);
      //arrow->Draw();
      cout << "GLUINO mass limit @ " << x[i] << "sec is found: " << y << endl;
      break;
    }
  }
  x = g_obs->GetX();
  for (int i = 0; i < stop_obs->GetN(); ++i) {
    if (x[i] > 0.5) {
      double y =  stop_obs->GetY()[i];
      TArrow* arrow = new TArrow (x[i], y, h->GetXaxis()->GetXmin(), y, 0.02);
      arrow->SetLineColor (kBlue);
      arrow->SetLineWidth (2);
      //arrow->Draw();
      cout << "STOP mass limit @ " << x[i] << "sec is found: " << y << endl;
      break;
    }
  }
 
  // gluino  
  // 2 sigma band
  if (g_exp_2sig) {
    g_exp_2sig->SetLineColor(0);
    g_exp_2sig->SetLineStyle(0);
    g_exp_2sig->SetLineWidth(0);
    g_exp_2sig->SetFillColor(kYellow);
    g_exp_2sig->SetFillStyle(1001);
    g_exp_2sig->Draw("3");
  }
  
  // 1 sigma band
  if (g_exp_1sig) {
    // g_exp_1sig->SetLineColor(8);
开发者ID:allenji,项目名称:StoppPtls,代码行数:67,代码来源:gluinostopMassLifetime.C

示例11: toyplotsge1btight

void toyplotsge1btight() {

    gStyle->SetPadBottomMargin(0.15) ;
    gStyle->SetPadLeftMargin(0.15) ;
    gStyle->SetOptTitle(0) ;


    TCanvas* c1 = new TCanvas("c1","c1") ;

    TArrow* arrow = new TArrow() ;
    arrow->SetLineWidth(3) ;


    TChain toyns("toytt") ;
    toyns.Add("output-files/toy-data-ge1btight.root") ;


    //--- extract true values from TTree.

    double fit_tru_ttwj ;
    TBranch* b_fit_tru_ttwj ;
    toyns.SetBranchAddress("fit_tru_ttwj", &fit_tru_ttwj, &b_fit_tru_ttwj ) ;
    toyns.GetEntry() ;
    printf("\n\n true value for ttwj : %8.2f\n", fit_tru_ttwj ) ;

    double fit_tru_qcd ;
    TBranch* b_fit_tru_qcd ;
    toyns.SetBranchAddress("fit_tru_qcd", &fit_tru_qcd, &b_fit_tru_qcd ) ;
    toyns.GetEntry() ;
    printf("\n\n true value for qcd : %8.2f\n", fit_tru_qcd ) ;

    double fit_tru_znn ;
    TBranch* b_fit_tru_znn ;
    toyns.SetBranchAddress("fit_tru_znn", &fit_tru_znn, &b_fit_tru_znn ) ;
    toyns.GetEntry() ;
    printf("\n\n true value for znn : %8.2f\n", fit_tru_znn ) ;


    //============ fit values

    gStyle->SetOptStat("emr") ;

    TH1F* httwjfit = new TH1F("httwjfit","ttwj",40, 0., 40. ) ;
    TH1F* hqcdfit  = new TH1F("hqcdfit" ,"qcd" ,40, 0., 15. ) ;
    TH1F* hznnfit  = new TH1F("hznnfit" ,"znn" ,40, 0., 25. ) ;

    toyns.Draw("fit_val_ttwj>>httwjfit","fit_cov_qual==3") ;
    toyns.Draw("fit_val_qcd>>hqcdfit","fit_cov_qual==3") ;
    toyns.Draw("fit_val_znn>>hznnfit","fit_cov_qual==3") ;

    httwjfit->SetLineWidth(2) ;
    hqcdfit->SetLineWidth(2) ;
    hznnfit->SetLineWidth(2) ;

    httwjfit->SetFillColor(11) ;
    hqcdfit->SetFillColor(11) ;
    hznnfit->SetFillColor(11) ;

    httwjfit->SetXTitle("Fit ttwj SIG events") ;
    hqcdfit->SetXTitle("Fit QCD SIG events") ;
    hznnfit->SetXTitle("Fit Znn SIG events") ;

    httwjfit->SetYTitle("Toy experiments") ;
    hqcdfit->SetYTitle("Toy experiments") ;
    hznnfit->SetYTitle("Toy experiments") ;

    httwjfit->Draw() ;
    arrow->DrawArrow(fit_tru_ttwj, 0.4*(httwjfit->GetMaximum()), fit_tru_ttwj, 0) ;
    c1->SaveAs("output-files/toymc-ttwj-sig-fit-ge1btight.png") ;
    hqcdfit->Draw() ;
    arrow->DrawArrow(fit_tru_qcd, 0.4*(hqcdfit->GetMaximum()), fit_tru_qcd, 0) ;
    c1->SaveAs("output-files/toymc-qcd-sig-fit-ge1btight.png") ;
    hznnfit->Draw() ;
    arrow->DrawArrow(fit_tru_znn, 0.4*(hznnfit->GetMaximum()), fit_tru_znn, 0) ;
    c1->SaveAs("output-files/toymc-znn-sig-fit-ge1btight.png") ;


    //============ fit uncertainty

    TH1F* httwjerr = new TH1F("httwjerr","ttwj",40, 0., 15. ) ;
    TH1F* hqcderr  = new TH1F("hqcderr" ,"qcd" ,40, 0., 10. ) ;
    TH1F* hznnerr  = new TH1F("hznnerr" ,"znn" ,40, 0., 15. ) ;

    toyns.Draw("fit_err_ttwj>>httwjerr","fit_cov_qual==3") ;
    toyns.Draw("fit_err_qcd>>hqcderr","fit_cov_qual==3") ;
    toyns.Draw("fit_err_znn>>hznnerr","fit_cov_qual==3") ;

    httwjerr->SetLineWidth(2) ;
    hqcderr->SetLineWidth(2) ;
    hznnerr->SetLineWidth(2) ;

    httwjerr->SetFillColor(11) ;
    hqcderr->SetFillColor(11) ;
    hznnerr->SetFillColor(11) ;

    httwjerr->SetXTitle("err ttwj SIG events") ;
    hqcderr->SetXTitle("err QCD SIG events") ;
    hznnerr->SetXTitle("err Znn SIG events") ;

    httwjerr->SetYTitle("Toy experiments") ;
//.........这里部分代码省略.........
开发者ID:pjandir,项目名称:Statistics,代码行数:101,代码来源:toyplotsge1btight.c

示例12: chain

int
main (int argc, char *argv[])
{
  if (argc != 2)
    {
      cout << "Usage: " << argv[0] << " INPUT_FILE" << endl;
      cout << "  or:  " << argv[0] << " INPUT_LIST" << endl;
      cout << "" << endl;
      cout << endl;

      return 0;
    }
  string inputFile = argv[1], upperInputFile;
  upperInputFile.resize (inputFile.length ());
  transform (inputFile.begin (), inputFile.end (), upperInputFile.begin (), ::toupper);

  // so canvases don't appear on the screen when being created
  // very useful when running on the OSU T3 from CERN
  gROOT->SetBatch();
  gStyle->SetPadTopMargin(0.1);
  gStyle->SetPadBottomMargin(0.1);
  gStyle->SetPadLeftMargin(0.03);
  gStyle->SetPadRightMargin(0.08);

  //Create chain of root trees
  TChain chain("Delphes");

  if (upperInputFile.length () < 5 || upperInputFile.substr (upperInputFile.length () - 5, 5) != ".ROOT")
  {
    ifstream fin (inputFile);
    string line;
    while(getline(fin, line))
      {
        chain.Add(line.c_str());
      }
    fin.close();
  }
  else
    chain.Add(inputFile.c_str());

  // Create object of class ExRootTreeReader
  ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);

  // Get pointers to branches used in this analysis
  TClonesArray *branchTrack = treeReader->UseBranch("Track");
  TClonesArray *branchCluster = treeReader->UseBranch("Cluster"); 
  TClonesArray *branchNPU = treeReader->UseBranch("NPU");

  //gStyle->SetOptStat(10011);
  //actually, let's turn this off for now
  gStyle->SetOptStat(0);


  TH2D *hist[LEN];
  signal (SIGINT, signalHandler);
  //Loop over a LEN Events
  for (int event = 0; event < LEN && !interrupted; event++) {

    //Load Branches
    treeReader->ReadEntry(event);

    // N.B. this is a hack put in by Andrew using the ScalarHT class                                                                                                                                    
    // it's the number of pileup interactions, it's not actually the HT                                                                                                                                 
    unsigned nInteractions = (unsigned) ((ScalarHT *) branchNPU->At(0))->HT + 1;
    int nClusters = branchCluster->GetEntries();


    // create and format the histogram for this event
    TString name = "TrackPtVsTrackZ_" + TString(Form("%d",event+1));
    TCanvas *can = new TCanvas(name,name,1600,500);

    TString title = "Event " + TString(Form("%d",event+1)) + ": ";
    title += TString(Form("%d",nInteractions)) + " Interactions, ";
    title += TString(Form("%d",nClusters)) + " Clusters";

    hist[event] = new TH2D(name, title, X_BIN, X_MIN, X_MAX, Y_BIN, Y_MIN, Y_MAX);
    hist[event]->GetXaxis()->SetTitle("track z [mm]");
    hist[event]->GetXaxis()->SetLabelOffset(0.02);
    hist[event]->GetXaxis()->SetTitleOffset(1.2);
    hist[event]->GetYaxis()->SetTitle("track p_{T} [GeV]");
    hist[event]->GetYaxis()->SetTitleOffset(0.35);


    
    TArrow *genPVArrow = new TArrow(0,0,0,0.01,0.01,"|>");
    genPVArrow->SetLineColor(3);
    genPVArrow->SetFillColor(3);
    genPVArrow->SetLineWidth(0.1);
    genPVArrow->SetAngle(40);

    vector<float> interactionPositions;
    vector<TLine *> clusterLineVector;
    Cluster *recoPV = (Cluster *) branchCluster->At(0);
    TLine *highELine = new TLine(recoPV->Z,0,recoPV->Z,Y_MAX);
    highELine->SetLineColor(1);
    highELine->SetLineWidth(0.8);
    highELine->SetLineStyle(3);

    // Draw cluster lines
    // Skip first cluster since we've already drawn it (start from 1)
//.........这里部分代码省略.........
开发者ID:aehart,项目名称:Delphes,代码行数:101,代码来源:singleEventAnalyzer.cpp

示例13: fildir

void fildir(){


   TCanvas *c1 = new TCanvas("c1","ROOT FilDir description",700,900);
   c1->Range(1,1,19,24.5);
   TPaveLabel *title = new TPaveLabel(4,23,16,24.2,"ROOT File/Directory/Key description");
   title->SetFillColor(16);
   title->Draw();

   Int_t keycolor = 42;
   Int_t dircolor = 21;
   Int_t objcolor = 46;
   TPaveText *file = new TPaveText(2,19,6,22);
   file->SetFillColor(39);
   file->Draw();
   file->SetTextSize(0.04);
   file->AddText("TFile");
   file->AddText("Header");
   TArrow *arrow = new TArrow(6,20.5,17,20.5,0.02,"|>");
   arrow->SetFillStyle(1001);
   arrow->SetLineWidth(2);
   arrow->Draw();
   TPaveText *free1 = new TPaveText(8,20,11,21);
   free1->SetFillColor(18);
   free1->Draw();
   free1->AddText("First:Last");
   TPaveText *free2 = new TPaveText(12,20,15,21);
   free2->SetFillColor(18);
   free2->Draw();
   free2->AddText("First:Last");
   TText *tfree = new TText(6.2,21.2,"fFree = TList of free blocks");
   tfree->SetTextSize(0.02);
   tfree->Draw();
   TText *tkeys = new TText(5.2,18.2,"fKeys = TList of Keys");
   tkeys->SetTextSize(0.02);
   tkeys->Draw();
   TText *tmemory = new TText(3.2,15.2,"fListHead = TList of Objects in memory");
   tmemory->SetTextSize(0.02);
   tmemory->Draw();

   arrow->DrawArrow(5,17,17,17,0.02,"|>");
   TLine *line = new TLine(5,19,5,17);
   line->SetLineWidth(2);
   line->Draw();
   TPaveText *key0 = new TPaveText(7,16,10,18);
   key0->SetTextSize(0.04);
   key0->SetFillColor(keycolor);
   key0->AddText("Key 0");
   key0->Draw();
   TPaveText *key1 = new TPaveText(12,16,15,18);
   key1->SetTextSize(0.04);
   key1->SetFillColor(keycolor);
   key1->AddText("Key 1");
   key1->Draw();
   line->DrawLine(3,19,3,14);
   line->DrawLine(3,14,18,14);
   TPaveText *obj0 = new TPaveText(5,13,8,15);
   obj0->SetFillColor(objcolor);
   obj0->AddText("Object");
   obj0->Draw();
   TPaveText *dir1 = new TPaveText(10,13,13,15);
   dir1->SetFillColor(dircolor);
   dir1->AddText("SubDir");
   dir1->Draw();
   TPaveText *obj1 = new TPaveText(15,13,18,15);
   obj1->SetFillColor(objcolor);
   obj1->AddText("Object");
   obj1->Draw();
   arrow->DrawArrow(12,11,17,11,0.015,"|>");
   arrow->DrawArrow(11,9,17,9,0.015,"|>");
   line->DrawLine(12,13,12,11);
   line->DrawLine(11,13,11,9);
   TPaveText *key2 = new TPaveText(14,10.5,16,11.5);
   key2->SetFillColor(keycolor);
   key2->AddText("Key 0");
   key2->Draw();
   TPaveText *obj2 = new TPaveText(14,8.5,16,9.5);
   obj2->SetFillColor(objcolor);
   obj2->AddText("Object");
   obj2->Draw();
   TLine *ldot = new TLine(10,15,2,11);
   ldot->SetLineStyle(2);
   ldot->Draw();
   ldot->DrawLine(13,15,8,11);
   ldot->DrawLine(13,13,8,5);
   TPaveText *dirdata = new TPaveText(2,5,8,11);
   dirdata->SetTextAlign(12);
   dirdata->SetFillColor(dircolor);
   dirdata->Draw();
   dirdata->SetTextSize(0.015);
   dirdata->AddText("fModified: True if directory is modified");
   dirdata->AddText("fWritable: True if directory is writable");
   dirdata->AddText("fDatimeC: Creation Date/Time");
   dirdata->AddText("fDatimeM: Last mod Date/Time");
   dirdata->AddText("fNbytesKeys: Number of bytes of key");
   dirdata->AddText("fNbytesName : Header length up to title");
   dirdata->AddText("fSeekDir: Start of Directory on file");
   dirdata->AddText("fSeekParent: Start of Parent Directory");
   dirdata->AddText("fSeekKeys: Pointer to Keys record");
   TPaveText *keydata = new TPaveText(10,2,17,7);
//.........这里部分代码省略.........
开发者ID:MycrofD,项目名称:root,代码行数:101,代码来源:fildir.C

示例14: rf106_plotdecoration

void rf106_plotdecoration()
{

  // S e t u p   m o d e l 
  // ---------------------

  // Create observables
  RooRealVar x("x","x",-10,10) ;

  // Create Gaussian
  RooRealVar sigma("sigma","sigma",1,0.1,10) ;
  RooRealVar mean("mean","mean",-3,-10,10) ;
  RooGaussian gauss("gauss","gauss",x,mean,sigma) ;

  // Generate a sample of 1000 events with sigma=3
  RooDataSet* data = gauss.generate(x,1000) ;

  // Fit pdf to data
  gauss.fitTo(*data) ;


  // P l o t   p . d . f   a n d   d a t a 
  // -------------------------------------

  // Overlay projection of gauss on data
  RooPlot* frame = x.frame(Name("xframe"),Title("RooPlot with decorations"),Bins(40)) ;
  data->plotOn(frame) ;
  gauss.plotOn(frame) ;


  // A d d   b o x   w i t h   p d f   p a r a m e t e r s 
  // -----------------------------------------------------

  // Left edge of box starts at 55% of Xaxis)
  gauss.paramOn(frame,Layout(0.55)) ;


  // A d d   b o x   w i t h   d a t a   s t a t i s t i c s
  // -------------------------------------------------------  

  // X size of box is from 55% to 99% of Xaxis range, top of box is at 80% of Yaxis range)
  data->statOn(frame,Layout(0.55,0.99,0.8)) ;


  // A d d   t e x t   a n d   a r r o w 
  // -----------------------------------

  // Add text to frame
  TText* txt = new TText(2,100,"Signal") ;
  txt->SetTextSize(0.04) ;
  txt->SetTextColor(kRed) ;
  frame->addObject(txt) ;

  // Add arrow to frame
  TArrow* arrow = new TArrow(2,100,-1,50,0.01,"|>") ;
  arrow->SetLineColor(kRed) ;
  arrow->SetFillColor(kRed) ;
  arrow->SetLineWidth(3) ;
  frame->addObject(arrow) ;


  // P e r s i s t   f r a m e   w i t h   a l l   d e c o r a t i o n s   i n   R O O T   f i l e
  // ---------------------------------------------------------------------------------------------

  TFile f("rf106_plotdecoration.root","RECREATE") ;
  frame->Write() ;
  f.Close() ;

  // To read back and plot frame with all decorations in clean root session do
  // root> TFile f("rf106_plotdecoration.root") ;
  // root>  xframe->Draw() ;

  new TCanvas("rf106_plotdecoration","rf106_plotdecoration",600,600) ;
  gPad->SetLeftMargin(0.15) ; frame->GetYaxis()->SetTitleOffset(1.6) ; frame->Draw() ;
  
}
开发者ID:MycrofD,项目名称:root,代码行数:76,代码来源:rf106_plotdecoration.C

示例15: extractSignificanceStats


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

  float integralSM=hSM->Integral();
  float integralPS=hPS->Integral();
 
  float tailSM=hSM->Integral(1,hSM->FindBin(medianPS))/integralSM;
  float tailPS=hPS->Integral(hPS->FindBin(medianSM),hPS->GetNbinsX())/integralPS;
  cout<<"Tail prob SM: "<<tailSM<<"  ("<<ROOT::Math::normal_quantile_c(tailSM,1.0) <<" sigma)"<<endl;
  cout<<"Tail prob PS: "<<tailPS<<"  ("<<ROOT::Math::normal_quantile_c(tailPS,1.0) <<" sigma)"<<endl;

  diff=10.0;
  coverage=0.0;
  for(int i=1;i<hSM->GetNbinsX();i++){
    
    float fracSM=hSM->Integral(1,i) / integralSM;
    float fracPS=hPS->Integral(i,hPS->GetNbinsX()) / integralPS;
    if(fabs(fracSM-fracPS)<diff){
      diff=fabs(fracSM-fracPS);
      coverage=(fracSM+fracPS)/2.0;
    }

  }

  float sepH= 2*ROOT::Math::normal_quantile_c(1.0 - coverage, 1.0);
  cout<<"Separation from histograms = "<<sepH<<" with coverage "<<coverage<<endl;


  cout << "OBSERVED SIGNIFICANCE" << endl;

  cout << "observation: " << v_Obs[0] << endl;
  cout << "bin: " << hObs->GetMaximumBin() << endl;
  
  cout << " --------------- " << endl;
  double obsPval_SM = 1-hSM->Integral(0,hObs->GetMaximumBin())/hSM->Integral();
  cout << "pvalue SM: " << obsPval_SM << endl;
  cout << "signif SM: " << ROOT::Math::normal_quantile_c(obsPval_SM,1.0) << endl;;
  double obsPval_PS =  hPS->Integral(0,hObs->GetMaximumBin())/hPS->Integral();
  cout << "pvalue PS: " << obsPval_PS << endl;
  cout << "signif PS: " << ROOT::Math::normal_quantile_c(obsPval_PS,1.0) << endl;;


  gStyle->SetOptStat(0);
  TCanvas *c1=new TCanvas("c1","c1",500,500);
  c1->cd();
  hSM->Rebin(50);
  hPS->Rebin(50);
  float maxhSM=hSM->GetBinContent(hSM->GetMaximumBin());
  float maxhPS=hPS->GetBinContent(hPS->GetMaximumBin());
  if(maxhPS>maxhSM){
    hSM->SetMaximum(maxhPS*1.15);
    hPS->SetMaximum(maxhPS*1.15);
  }
  else{
    hSM->SetMaximum(maxhSM*1.15);
    hPS->SetMaximum(maxhSM*1.15);
  }
  hSM->SetXTitle("S = -2 #times ln(L_{1}/L_{2})");
  hSM->SetYTitle("Generated experiments");
  hPS->SetXTitle("S = -2 #times ln(L_{1}/L_{2})");
  hPS->SetYTitle("Generated experiments");
  hSM->SetLineColor(kMagenta-3);
  hSM->SetFillColor(kMagenta-3);
  hSM->SetLineWidth(2);
  hSM->SetFillStyle(3605);
  hPS->SetLineColor(kBlue+1);
  hPS->SetFillColor(kBlue+1);
  hPS->SetLineWidth(2);
  hPS->SetFillStyle(3695);
  hObs->SetLineColor(kGreen+3);
  hObs->SetLineWidth(2);
  hSM->Draw();
  hPS->Draw("sames");
  
  TArrow *obsArrow  = new TArrow(v_Obs[0],hSM->GetMaximum()/2.,v_Obs[0],0.0,.05,"|>");
  obsArrow->SetLineWidth(3);
  obsArrow->Draw("same");
  //hObs->Draw("sames");

  TLegend *leg = new TLegend(0.7,0.6,0.9,0.9);
  leg->SetFillColor(0);
  leg->SetBorderSize(0);
  leg->AddEntry(hSM,"  PS, 0-","f");
  leg->AddEntry(hPS,"  SM, 0+","f");
  leg->Draw();


  TPaveText pt(0.16,0.95,0.45,0.99,"NDC");
  pt.SetFillColor(0);
  pt.AddText("CMS Expected");
  pt.SetBorderSize(0);
  TPaveText pt2(0.55,0.95,0.99,0.99,"NDC");
  pt2.SetFillColor(0);
  pt2.AddText(Form(" #sqrt{s} = 7 TeV, L = %.3f fb^{-1}; #sqrt{s} = 8 TeV, L = %.3f fb^{-1}",lumi7TeV,lumi8TeV));
  pt2.SetBorderSize(0);
  pt.Draw();
  pt2.Draw();
  c1->SaveAs("sigsep_combine.eps");
  c1->SaveAs("sigsep_combine.root");

  return 0;
}//end main
开发者ID:HZZ4l,项目名称:CombinationPy,代码行数:101,代码来源:extractSignificanceStats.C


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