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


C++ TPaveText::SetLineColor方法代码示例

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


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

示例1: DrawStatBox

void DrawStatBox(TObject** Histos, std::vector<char*> legend, bool Mean, double X, double Y, double W, double H)
{
   int    N             = legend.size();
   char   buffer[255];

   if(Mean)H*=3;
   for(int i=0;i<N;i++){
           TPaveText* stat = new TPaveText(X,Y-(i*H), X+W, Y-(i+1)*H, "NDC");
	   TH1* Histo = (TH1*)Histos[i];
           sprintf(buffer,"Entries : %i\n",(int)Histo->GetEntries());
           stat->AddText(buffer);

           if(Mean){
           sprintf(buffer,"Mean    : %6.2f\n",Histo->GetMean());
           stat->AddText(buffer);

           sprintf(buffer,"RMS     : %6.2f\n",Histo->GetRMS());
           stat->AddText(buffer);
           }

           stat->SetFillColor(0);
           stat->SetLineColor(Color[i]);
           stat->SetTextColor(Color[i]);
           stat->SetBorderSize(0);
           stat->SetMargin(0.05);
           stat->SetTextAlign(12);
           stat->Draw();
   }
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:29,代码来源:GainPlot.C

示例2: plotBkgModel

void plotBkgModel(TList* HistList, std::string name){
  
  gROOT->SetBatch();
  system("mkdir -p plots/ada/bkgMod");
  system("mkdir -p plots/grad/bkgMod");

  std::string bdt;
  TString str = HistList->At(0)->GetName();
  if (str.Contains("ada")) bdt="ada";
  else if (str.Contains("grad")) bdt="grad";
  else std::cout << "Error find BDT type" << std::endl;
  assert (str.Contains("ada") || str.Contains("grad"));
  
  gStyle->SetOptStat(0);
  gROOT->SetStyle("Plain");
  gROOT->ForceStyle();
  int color[6] = {kGreen+4,kGreen-1,kGreen,kRed,kRed-2,kRed+4};

  TCanvas *canv = new TCanvas();
  TLegend *leg = new TLegend(0.45,0.6,0.85,0.85);
  leg->SetLineColor(0);
  leg->SetFillColor(0);
  TPaveText *txt = new TPaveText(0.2,0.1,0.4,0.35,"NDC");
  txt->SetFillColor(0);
  txt->SetLineColor(0);
  txt->AddText("#int L = 4.76 fb^{-1}");

  for (int i=1; i<HistList->GetEntries(); i++){
    //if (((TH1F*)HistList->At(i))->GetNbinsX()!=((TH1F*)HistList->At(0))->GetNbinsX()) std::cout << "Plot problem: calling plot for histograms with different number of bins" << std::endl;
    //assert (((TH1F*)HistList->At(i))->GetNbinsX()==((TH1F*)HistList->At(0))->GetNbinsX());
    TH1F *temp = linearBin((TH1F*)HistList->At(i));
    temp->Scale(((TH1F*)HistList->At(0))->Integral()/temp->Integral());
    temp->SetLineColor(color[i-1]);
    temp->SetMarkerStyle(20);
    temp->SetMarkerColor(color[i-1]);
    temp->SetTitle(Form("Data in sidebands %s %s",bdt.c_str(),name.c_str()));
    temp->GetXaxis()->SetTitle("");
    temp->GetYaxis()->SetRangeUser(1.0,2.*(((TH1F*)HistList->At(0))->GetMaximum()));
    if (i==1) temp->Draw("p");
    else temp->Draw("same p");
    if (i==1) leg->AddEntry(temp,"Low 3 sideband","lep");
    if (i==2) leg->AddEntry(temp,"Low 2 sideband","lep");
    if (i==3) leg->AddEntry(temp,"Low 1 sideband","lep");
    if (i==4) leg->AddEntry(temp,"High 1 sideband","lep");
    if (i==5) leg->AddEntry(temp,"High 2 sideband","lep");
    if (i==6) leg->AddEntry(temp,"High 3 sideband","lep");
  }
  leg->Draw("same");
  txt->Draw("same");

  canv->SetLogy();
  canv->Print(("plots/"+bdt+"/bkgMod/"+name+".png").c_str(),"png");
  
  delete canv;
  delete txt;
  delete leg;

  bkgCalls++;
}
开发者ID:kreczko,项目名称:HiggsAnalysisExample,代码行数:59,代码来源:BDTInterpolation.C

示例3: 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

示例4: s_intersection

void s_intersection()
{
   gROOT->GetListOfCanvases()->Delete();
   TCanvas *c = new TCanvas("composite shape", "Intersection boolean operation", 700, 1000);

   c->Divide(1,2,0,0);
   c->cd(2);
   gPad->SetPad(0,0,1,0.4);
   c->cd(1);
   gPad->SetPad(0,0.4,1,1);
   
   if (gGeoManager) delete gGeoManager;
   
   new TGeoManager("xtru", "poza12");
   TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
   TGeoMedium *med = new TGeoMedium("MED",1,mat);
   TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
   gGeoManager->SetTopVolume(top);

   // define shape components with names
   TGeoBBox *box = new TGeoBBox("bx", 40., 40., 40.); 
   TGeoSphere *sph = new TGeoSphere("sph", 40., 45.);
   // define named geometrical transformations with names
   TGeoTranslation *tr = new TGeoTranslation(0., 0., 45.);
   tr->SetName("tr");
   // register all used transformations
   tr->RegisterYourself();
   // create the composite shape based on a Boolean expression
   TGeoCompositeShape *cs = new TGeoCompositeShape("mir", "sph:tr * bx");

   TGeoVolume *vol = new TGeoVolume("COMP2",cs);
   top->AddNode(vol,1);
   gGeoManager->CloseGeometry();
   gGeoManager->SetNsegments(100);
   top->Draw();
   MakePicture();

   c->cd(2);

   TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);

   pt->SetLineColor(1);

   TText *text = pt->AddText("TGeoCompositeShape - composite shape class");

   text->SetTextColor(2);
   pt->AddText("----- Here is an example of boolean intersection operation : A * B");
   pt->AddText("----- A == sphere (with inner radius non-zero), B == box");
   pt->AddText(" ");
   pt->SetAllWith("-----","color",4);
   pt->SetAllWith("-----","font",72);
   pt->SetAllWith("-----","size",0.04);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.044);
   pt->Draw();
   c->cd(1);
}
开发者ID:alcap-org,项目名称:AlcapDAQ,代码行数:57,代码来源:csgdemo.C

示例5: Plot10Mu

void Plot10Mu(const char* text,float X, float Y, float size)
{
	TPaveText* atext = new TPaveText(X,Y,X+size,Y+size);
	atext->AddText(text);
	atext->SetLineColor(0);
	atext->SetFillColor(0);
	atext->SetTextFont(42);
	atext->SetTextSize(0.04);
	atext->Draw();
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:10,代码来源:makeArrowPlots.C

示例6: s_difference

void s_difference()
{
   gROOT->GetListOfCanvases()->Delete();
   TCanvas *c = new TCanvas("composite shape", "Difference boolean operation", 700, 1000);

   c->Divide(1,2,0,0);
   c->cd(2);
   gPad->SetPad(0,0,1,0.4);
   c->cd(1);
   gPad->SetPad(0,0.4,1,1);
   
   if (gGeoManager) delete gGeoManager;
   
   new TGeoManager("xtru", "poza12");
   TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
   TGeoMedium *med = new TGeoMedium("MED",1,mat);
   TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
   gGeoManager->SetTopVolume(top);

   // define shape components with names
   TGeoTorus *tor = new TGeoTorus("tor", 45., 15., 20., 45., 145.); 
   TGeoSphere *sph = new TGeoSphere("sph", 20., 45., 0., 180., 0., 270.);
   // create the composite shape based on a Boolean expression
   TGeoCompositeShape *cs = new TGeoCompositeShape("mir", "sph - tor");

   TGeoVolume *vol = new TGeoVolume("COMP3",cs);
   top->AddNode(vol,1);
   gGeoManager->CloseGeometry();
   gGeoManager->SetNsegments(60);
   top->Draw();
   MakePicture();

   c->cd(2);

   TPaveText *pt = new TPaveText(.01, .01, .99, .99);

   pt->SetLineColor(1);

   TText *text = pt->AddText("TGeoCompositeShape - composite shape class");

   text->SetTextColor(2);

   pt->AddText("----- It's an example of boolean difference: A - B");
   pt->AddText("----- A == part of sphere (0-180, 0-270), B == partial torus (45-145)");
   pt->AddText(" ");
   pt->SetAllWith("-----","color",4);
   pt->SetAllWith("-----","font",72);
   pt->SetAllWith("-----","size",0.04);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.044);
   pt->Draw();
   c->cd(1);
}
开发者ID:alcap-org,项目名称:AlcapDAQ,代码行数:53,代码来源:csgdemo.C

示例7: banner4Plot

void banner4Plot (){
  TPaveText* pt ;
  pt = new TPaveText(.14,0.91,.25,.94,"NDC");
  pt->AddText("Preliminary");
  pt->SetFillColor(0);
  pt->SetTextSize(0.035);
  pt->SetFillStyle(0);
  pt->SetLineColor(0);
  pt->SetLineWidth(0);
  pt->SetMargin(0);
  pt->SetShadowColor(0);
  pt->Draw();
}
开发者ID:amartelli,项目名称:iMCP_TB,代码行数:13,代码来源:drawEfficiency.cpp

示例8: makeZPhiArrowPlot

int makeZPhiArrowPlot( TTree* data, const char* name, double zLim, double phiLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){
	
	
	TCanvas* OBPCanvas = new TCanvas(name,name,1050,875);
	OBPCanvas->DrawFrame(-zLim, -phiLim, 1.2*zLim, phiLim, ";module position z [cm];module position r*phi [cm]");
	OBPCanvas->SetFillColor(0);
	OBPCanvas->SetFrameBorderMode(0);
	
	TFrame* aFrame = OBPCanvas->GetFrame();
	aFrame->SetFillColor(0);
	
	int passcut = 0;
	for(int entry = 0;entry<data->GetEntries(); entry++)
    {
		data->GetEntry(entry);
			if ((level_ == level)&&(((sublevel_ == sublevel)&&(sublevel != 0))||(sublevel == 0))){
			if ((z_ <= zMax)&&(z_ > zMin)&&(r_ <= rMax)&&(r_ > rMin)){
				TArrow* aArraw = new TArrow( z_, r_*phi_ , z_ + barrelRPhiRescale*dz_, r_*phi_+barrelRPhiRescale*r_*dphi_,0.0075,">");
				aArraw->Draw();
				passcut++;
			}
		}
	}
	DrawRPhiLegend( zLim, phiLim, barrelRPhiRescale );
	
	char sliceLeg[192]; 
	sprintf( sliceLeg, "%s: %f < r <= %f", name, rMin, rMax );
	//Plot10Mu( name, xLim/2, yLim, 0.2*xLim );
	TPaveText* atext = new TPaveText(0.2*zLim,0.85*phiLim,0.66*zLim,0.99*phiLim);
	atext->AddText(sliceLeg);
	atext->SetLineColor(0);
	atext->SetFillColor(0);
	atext->SetTextFont(42);
	atext->SetTextSize(0.04);
	atext->Draw();
	
	
	
	char outfile[192];
	sprintf( outfile, "%s/%s.png", outputDir_, name );
	OBPCanvas->Print( outfile );
	
	return passcut;
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:44,代码来源:makeArrowPlots.C

示例9: getHeader

TPaveText* getHeader(double lumi, TString channelName)
{
  TPaveText* pt = new TPaveText(0.18,0.75,0.18,0.88,"brNDC");

  pt->SetBorderSize(1);
  pt->SetTextFont(42);
  pt->SetTextSize(0.04);
  pt->SetLineColor(0);
  pt->SetLineStyle(1);
  pt->SetLineWidth(1);
  pt->SetFillColor(0);
  pt->SetFillStyle(1001);
  pt->SetTextAlign(12);
  pt->AddText("CMS Preliminary");
  pt->AddText(Form("%.1f fb^{-1} at  #sqrt{s} = 7 TeV", lumi));
  if ( channelName != "" ) pt->AddText(channelName);

  return pt;
}
开发者ID:YoungKwonJo,项目名称:TTbar2b,代码行数:19,代码来源:makePlotsCSVWeight.C

示例10: createPlot

// -----------------------------------------------------------------------------
//
TCanvas* createPlot( TDirectory* output_file,
		     std::string output_canvas, 
		     //std::vector< std::vector<std::string> > input_files, 
		     std::vector<std::string> input_files, 
		     std::vector<std::string> input_histos, 
		     std::vector<std::string> input_legend, 
 		     std::vector<int> marker_style, 
 		     std::vector<int> marker_colour, 
 		     std::vector<float> marker_size, 
 		     std::vector<float> lumis, 
		     double lumi,
		     int rebin, 
		     bool norm, 
		     bool log,
		     double min = -1.,
		     double max = -1.,
		     int integral = -1 )
{

  // SetSomeStyles();

  // Check integral
  if ( integral >= input_files.size() ) { integral = -1; }

  // Loop through histogram names
  std::vector<TH1D*> his;
  for ( uint ihis = 0; ihis < input_histos.size(); ++ihis ) {
    if ( integral < 0 || ihis <= integral ) {
      his.push_back( (TH1D*)getHisto( input_files[ihis], input_histos[ihis], "QcdBkgdEst", rebin ) );
    } else {
      his.back()->Add( (TH1D*)getHisto( input_files[ihis], input_histos[ihis], "QcdBkgdEst", rebin ) );
    }
  }
  
  // Create legend
  TLegend* legend = new TLegend( 0.65, 0.52-0.03*his.size(), 0.9, 0.52,  NULL, "brNDC" );
  legend->SetFillColor(0);
  legend->SetLineColor(0); 
  legend->SetTextAlign(31);
  legend->SetTextSize(0.025);
  
  // Create canvas
  TCanvas* aCanvas = createCanvas( output_canvas, output_file, log );
  
  TPaveText* stats = new TPaveText( 0.65, 0.54, 0.9, 0.54+0.03*his.size(), "brNDC" );
  stats->SetFillColor(0);
  stats->SetLineColor(0);

  TLatex* prelim = new TLatex( 0.15, 0.96, "#scale[0.8]{CMS preliminary 2011}" );
  prelim->SetTextSize(0.03);
  prelim->SetNDC();
  std::stringstream ssl; ssl << "#scale[0.8]{#int L dt = " << lumi/1000. << " fb^{-1}, #sqrt{s} = 7 TeV}";
  TLatex* lumistxt = new TLatex( 0.95, 0.96, ssl.str().c_str() );
  lumistxt->SetTextSize(0.03);
  lumistxt->SetNDC();
  lumistxt->SetTextAlign(31);
  
  // For Ted
  bool print_ted = true;
  std::stringstream ted;
  if ( print_ted ) { ted << "self._htMeans = ("; }

  // Loop through histograms
  double aMax = 0.;
  double aMin = 1.e12;
  for ( uint ihis = 0; ihis < his.size(); ++ihis ) {
    if ( !his[ihis] ) { continue; }
    
    // Line colour and fill
    his[ihis]->Scale(lumis[ihis]/100.);
    his[ihis]->SetMarkerStyle(marker_style[ihis]);
    his[ihis]->SetMarkerColor(marker_colour[ihis]);
    his[ihis]->SetMarkerSize(marker_size[ihis]);
    his[ihis]->SetLineColor(marker_colour[ihis]);
    his[ihis]->SetLineStyle(0);
    his[ihis]->SetLineWidth(0);
    
    // Populate legend
    if ( input_legend.size() > ihis ) { legend->AddEntry( his[ihis], input_legend[ihis].c_str(), "ep" ); }
    else                              { legend->AddEntry( his[ihis], input_histos[ihis].c_str(), "ep" ); }

    // Populate stats box
    std::stringstream ss;
    //ss << "Mean=" << int(his[ihis]->GetMean()*100.)/100. << ", RMS=" << int(his[ihis]->GetRMS()*100.)/100.;
    ss << "Entries=" << his[ihis]->GetEntries();
    TText* text = stats->AddText(ss.str().c_str());
    text->SetTextAlign(11);
    text->SetTextSize(0.025);
    text->SetTextColor(marker_colour[ihis]);

    // For Ted
    if ( print_ted ) ted << std::setw(9) << std::scientific << std::setprecision(3) << his[ihis]->GetMean() << ", ";
    
    // Calc min/max number of entries
    if ( his[ihis]->GetMaximum() > aMax ) { aMax = his[ihis]->GetMaximum(); }
    if ( his[ihis]->GetMinimum(1.e-12) < aMin ) { aMin = his[ihis]->GetMinimum(1.e-12); }

  }
//.........这里部分代码省略.........
开发者ID:bluejelibaby,项目名称:AnalysisV2,代码行数:101,代码来源:overlay.C

示例11: plotDavid

void plotDavid(TH1F* bkgT, TH1F* sigT, TH1F* dataT, std::string name){
  
  gROOT->SetBatch();
  system("mkdir -p plots/ada/david");
  system("mkdir -p plots/grad/david");
  system("mkdir -p plots/ada/diff");
  system("mkdir -p plots/grad/diff");

  std::string bdt;
  TString str = dataT->GetName();
  if (str.Contains("ada")) bdt="ada";
  else if (str.Contains("grad")) bdt="grad";
  else std::cout << "Error find BDT type" << std::endl;
  assert (str.Contains("ada") || str.Contains("grad"));

  if (bkgT->GetNbinsX() != sigT->GetNbinsX() || sigT->GetNbinsX() != dataT->GetNbinsX()) std::cout << "Plot problem: calling plot for histograms with different number of bins" << std::endl;
  assert(bkgT->GetNbinsX() == sigT->GetNbinsX() || sigT->GetNbinsX() == dataT->GetNbinsX());
  
  TH1F *bkg = linearBin(bkgT);
  TH1F *sig2 = linearBin(sigT);
  TH1F *sig5 = (TH1F*)sig2->Clone();
  TH1F *sig10 = (TH1F*)sig2->Clone();
  TH1F *data = linearBin(dataT);
  TH1F *diff = (TH1F*)data->Clone();
  diff->Add(bkg,-1);

  gStyle->SetOptStat(0);
  gROOT->SetStyle("Plain");
  gROOT->ForceStyle();

  TCanvas *canv = new TCanvas();
  bkg->SetLineColor(kBlue);
  bkg->SetFillColor(kBlue-9);
  sig2->SetLineColor(kRed);
  sig2->SetLineStyle(3);
  sig2->Scale(1.);
  sig5->SetLineColor(kRed);
  sig5->SetLineStyle(7);
  sig5->Scale(3.);
  sig10->SetLineColor(kRed);
  sig10->Scale(5.);
  data->SetMarkerStyle(20);
  bkg->SetTitle(("Background, data and signal distributions for "+bdt+" "+name).c_str());
  sig2->SetTitle(("Background, data and signal distributions for "+bdt+" "+name).c_str());
  data->SetTitle(("Background, data and signal distributions for "+bdt+" "+name).c_str());
  bkg->GetXaxis()->SetTitle("");
  sig2->GetXaxis()->SetTitle("");
  data->GetXaxis()->SetTitle("");
  bkg->GetYaxis()->SetTitle("Events");
  sig2->GetYaxis()->SetTitle("Events");
  data->GetYaxis()->SetTitle("Events");

  TLegend *leg = new TLegend(0.45,0.6,0.85,0.85);
  leg->SetLineColor(0);
  leg->SetFillColor(0);
  leg->AddEntry(bkg,"Background","f");
  leg->AddEntry(data,"Data","lep");
  leg->AddEntry(sig10,"Signal (1, 3, 5 #times SM)","l");
  TPaveText *txt = new TPaveText(0.2,0.1,0.4,0.35,"NDC");
  txt->SetFillColor(0);
  txt->SetLineColor(0);
  txt->AddText("#int L = 4.76 fb^{-1}");

  bkg->GetYaxis()->SetRangeUser(1.0,2.*(data->GetMaximum()));

  bkg->Draw("e2");
  sig2->Draw("same hist");
  sig5->Draw("same hist");
  sig10->Draw("same hist");
  data->Draw("same e");
  leg->Draw("same");
  txt->Draw("same");

  canv->SetLogy();
  canv->Print(("plots/"+bdt+"/david/"+name+".png").c_str(),"png");
  canv->SetLogy(false);
  canv->Clear();
  TLegend *leg2 = new TLegend(0.45,0.6,0.85,0.85);
  leg2->SetFillColor(0);
  leg2->SetLineColor(0);
  sig10->GetYaxis()->SetRangeUser((-1*sig10->GetMaximum())+10,sig10->GetMaximum()+20);
  sig10->GetXaxis()->SetTitle("");
  sig10->GetYaxis()->SetTitle("Events");
  sig10->SetTitle(Form("Data, background difference compared to signal %s %s",bdt.c_str(),name.c_str()));
  diff->SetMarkerStyle(20);
  diff->GetXaxis()->SetTitle("");
  diff->GetYaxis()->SetTitle("Events");
  leg2->AddEntry(diff,"Data - background model","lep");
  leg2->AddEntry(sig10,"Signal (1, 3, 5 #times SM)","l");
  TF1 *line = new TF1("line","0.0",0.0,sig10->GetNbinsX()+1);
  line->SetLineColor(kBlue);
  sig10->Draw("hist");
  sig5->Draw("same hist");
  sig2->Draw("same hist");
  line->Draw("same");
  diff->Draw("p same");
  leg2->Draw("same");
  txt->Draw("same");
  canv->Print(("plots/"+bdt+"/diff/"+name+".png").c_str(),"png");

//.........这里部分代码省略.........
开发者ID:kreczko,项目名称:HiggsAnalysisExample,代码行数:101,代码来源:BDTInterpolation.C

示例12: rsLimit7TeV

void rsLimit7TeV(){

  setTDRStyle();

//=========Macro generated from canvas: cLimit/Limit
//=========  (Mon Feb 22 22:44:48 2010) by ROOT version5.18/00a
//   TCanvas *cLimit = new TCanvas("cLimit", "Limit",450,40,800,550);
//  TCanvas *cLimit = new TCanvas("cLimit", "Limit",100,122,600,600);
  cLimit = new TCanvas("cLimit","cLimit",800,600);

   gStyle->SetOptStat(0);
   //   cLimit->Range(595.5973,-0.03483694,1345.283,0.2539571);
   cLimit->SetFillColor(0);
   cLimit->SetBorderMode(0);
   cLimit->SetBorderSize(2);
   cLimit->SetLeftMargin(0.139262);
   cLimit->SetRightMargin(0.0604027);
   cLimit->SetTopMargin(0.0804196);
   cLimit->SetBottomMargin(0.120629);
   cLimit->SetFrameBorderMode(0);
   cLimit->SetFrameBorderMode(0);
   
   TGraph *graph = new TGraph(11);
   graph->SetName("Graph");
   graph->SetTitle("");
   graph->SetFillColor(1);


   Int_t ci;   // for color index setting
   ci = TColor::GetColor("#ff0000");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);

   ci = TColor::GetColor("#ff0000");
   graph->SetMarkerColor(ci);
   graph->SetMarkerStyle(20);
   graph->SetMarkerSize(1.0);
   graph->SetPoint(0,  863,0.01);
   graph->SetPoint(1, 1132,0.02);
   graph->SetPoint(2, 1274,0.03);
   graph->SetPoint(3, 1395,0.04);
   graph->SetPoint(4, 1503,0.05);
   graph->SetPoint(5, 1597,0.06);
   graph->SetPoint(6, 1676,0.07);
   graph->SetPoint(7, 1742,0.08);
   graph->SetPoint(8, 1801,0.09);
   graph->SetPoint(9, 1844,0.1);
   graph->SetPoint(10,1881,0.11);
   
   cout << " Don't forget to change this..." << endl;
   TH1 *Graph6 = new TH1F("Graph6","",100,863,1881);
   Graph6->SetMinimum(0);
   Graph6->SetMaximum(0.12);
   Graph6->SetDirectory(0);
   Graph6->SetStats(0);
   Graph6->GetXaxis()->SetTitle("M_{1} [GeV]");
   Graph6->GetYaxis()->SetTitle("Coupling k/#bar{M}_{Pl}");
   Graph6->GetXaxis()->SetLabelFont(42);
   Graph6->GetYaxis()->SetLabelFont(42);
   Graph6->GetYaxis()->SetTitleOffset(1.8);
   graph->SetHistogram(Graph6);
   
   graph->GetYaxis()->SetTitleOffset(1.19);
   graph->Draw("al");


   TGraph* graph2 = new TGraph(11);
   graph2->SetMarkerColor(ci);
   graph2->SetMarkerStyle(20);
   graph2->SetMarkerSize(0.0);
   graph2->SetPoint(0,  845,0.01);
   graph2->SetPoint(1, 1133,0.02);
   graph2->SetPoint(2, 1275,0.03);
   graph2->SetPoint(3, 1396,0.04);
   graph2->SetPoint(4, 1504,0.05);
   graph2->SetPoint(5, 1598,0.06);
   graph2->SetPoint(6, 1677,0.07);
   graph2->SetPoint(7, 1743,0.08);
   graph2->SetPoint(8, 1801,0.09);
   graph2->SetPoint(9, 1844,0.1);
   graph2->SetPoint(10,1881,0.11);
   graph2->SetLineStyle(kDashed);
   graph2->SetLineColor(ci);
   graph2->SetLineWidth(3);
   graph2->GetXaxis()->SetLabelFont(42);
   graph2->GetYaxis()->SetLabelFont(42);
   graph2->Draw("plsame");


//    graph = new TGraph(3);
//    graph->SetName("Graph");
//    graph->SetTitle("");
//    graph->SetFillColor(1);

//    ci = TColor::GetColor("#0000ff");
//    graph->SetLineColor(ci);
//    graph->SetLineWidth(3);

//    ci = TColor::GetColor("#0000ff");
//    graph->SetMarkerColor(ci);
//.........这里部分代码省略.........
开发者ID:cms-exotica-diphotons,项目名称:DiPhotonAnalysis,代码行数:101,代码来源:rsLimit7TeV.C

示例13: MergeMetHists


//.........这里部分代码省略.........
	gStyle->SetCanvasDefW(1200);
	gStyle->SetCanvasDefH(600);
	int labelfont = 10 * 4 + 2;		//10 * font ID + precision (2 = scalable)
	int titlefont = 10 * 4 + 2;		//10 * font ID + precision (2 = scalable)
	gStyle->SetLabelFont(labelfont,"X");
	gStyle->SetLabelFont(labelfont,"Y");
	gStyle->SetTitleFont(titlefont,"X");
	gStyle->SetTitleFont(titlefont,"Y");
	gStyle->SetLabelSize(0.04,"X");
	gStyle->SetLabelSize(0.027,"Y");
	//gStyle->SetLabelOffset(0.9);
	gStyle->SetTitleSize(0.03,"Y");
	gStyle->SetTitleOffset(1.8,"Y");
	//TGaxis::SetMaxDigits(3);



	hist_data->UseCurrentStyle();
	hist_bg->UseCurrentStyle();

	TCanvas *c1= new TCanvas;
	c1->Divide(2,1);
	c1->cd(1);
	if (logy)
	{
		if (hist_data->GetEntries() > 0 && hist_bg->GetEntries() > 0) gPad->SetLogy();
	}
	gPad->SetTickx();
	gPad->SetTicky();
	gPad->SetGridx();
	gPad->SetGridy();

	TPaveText *tp = new TPaveText(0.02,0.92,0.98,0.99,"NDC");
	tp->SetLineColor(10);
	tp->SetTextFont(titlefont);


	std::string tt(hist_data->GetTitle());
//	hist_data->SetTitle("");
//	hist_bg->SetTitle("");
	if (title.length()>0)
	{

		//tt += " - ";
		tt += title;
		//tt = title;
		if (debug)
		{
			std::cout << tt << std::endl;
		}
		tp->AddText(tt.c_str());
	}

	std::stringstream ytitle, xtitle;
	ytitle << "Events / " << setprecision(3) << hist_data->GetXaxis()->GetBinWidth(1) << " GeV";
	if (debug)
	{
		std::cout << hist_data->GetBinWidth(1) <<std::endl;
	}
	if (name == "MetAll") xtitle << "#slash{E}_{T} (for all events) (GeV)";
	else if (name == "Met") xtitle << "#slash{E}_{T} (after cuts) (GeV)";
	else if (name == "MetSig") xtitle << "#slash{E}_{T} Significance (for all events)";
	else if (name == "Njet15") xtitle << "Njets^{E_{T}>15GeV} (After #slash{E}_{T}-Sig cut)";
	else if (name == "Njet20") xtitle << "Njets^{E_{T}>20GeV} (After #slash{E}_{T}-Sig cut)";
	else if (name == "Njet25") xtitle << "Njets^{E_{T}>25GeV} (After #slash{E}_{T}-Sig cut)";
	else if (name == "Njet30") xtitle << "Njets^{E_{T}>30GeV} (After #slash{E}_{T}-Sig cut)";
开发者ID:hkaushalya,项目名称:CDFPhoJets,代码行数:67,代码来源:MergeMetHists_DebugSyst.C

示例14: BackgroundPrediction

void BackgroundPrediction(std::string pname,int rebin_factor,int model_number = 0,int imass=750, bool plotBands = false)
{
    rebin = rebin_factor;
    std::string fname = std::string("../fitFilesMETPT34/") + pname + std::string("/histos_bkg.root");
    
    stringstream iimass ;
    iimass << imass;
    std::string dirName = "info_"+iimass.str()+"_"+pname;
    
    
    gStyle->SetOptStat(000000000);
    gStyle->SetPadGridX(0);
    gStyle->SetPadGridY(0);
    
    setTDRStyle();
    gStyle->SetPadGridX(0);
    gStyle->SetPadGridY(0);
    gStyle->SetOptStat(0000);
    
    writeExtraText = true;       // if extra text
    extraText  = "Preliminary";  // default extra text is "Preliminary"
    lumi_13TeV  = "2.7 fb^{-1}"; // default is "19.7 fb^{-1}"
    lumi_7TeV  = "4.9 fb^{-1}";  // default is "5.1 fb^{-1}"
    
    
    double ratio_tau=-1;
    
    TFile *f=new TFile(fname.c_str());
    TH1F *h_mX_CR_tau=(TH1F*)f->Get("distribs_18_10_1")->Clone("CR_tau");
    TH1F *h_mX_SR=(TH1F*)f->Get("distribs_18_10_0")->Clone("The_SR");
    double maxdata = h_mX_SR->GetMaximum();
    double nEventsSR = h_mX_SR->Integral(600,4000);
    ratio_tau=(h_mX_SR->GetSumOfWeights()/(h_mX_CR_tau->GetSumOfWeights()));
    //double nEventsSR = h_mX_SR->Integral(600,4000);
    
    std::cout<<"ratio tau "<<ratio_tau<<std::endl;
    
    TH1F *h_SR_Prediction;
    TH1F *h_SR_Prediction2;
    
    if(blind) {
        h_SR_Prediction2 = (TH1F*)h_mX_CR_tau->Clone("h_SR_Prediction2");
        h_mX_CR_tau->Rebin(rebin);
        h_mX_CR_tau->SetLineColor(kBlack);
        h_SR_Prediction=(TH1F*)h_mX_CR_tau->Clone("h_SR_Prediction");
    } else {
        h_SR_Prediction2=(TH1F*)h_mX_SR->Clone("h_SR_Prediction2");
        h_mX_SR->Rebin(rebin);
        h_mX_SR->SetLineColor(kBlack);
        h_SR_Prediction=(TH1F*)h_mX_SR->Clone("h_SR_Prediction");
        
    }
    h_SR_Prediction->SetMarkerSize(0.7);
    h_SR_Prediction->GetYaxis()->SetTitleOffset(1.2);
    h_SR_Prediction->Sumw2();
    
    /*TFile *f_sig = new TFile((dirName+"/w_signal_"+iimass.str()+".root").c_str());
    RooWorkspace* xf_sig = (RooWorkspace*)f_sig->Get("Vg");
    RooAbsPdf *xf_sig_pdf = (RooAbsPdf *)xf_sig->pdf((std::string("signal_fixed_")+pname).c_str());
    
    RooWorkspace w_sig("w");
    w_sig.import(*xf_sig_pdf,RooFit::RenameVariable((std::string("signal_fixed_")+pname).c_str(),(std::string("signal_fixed_")+pname+std::string("low")).c_str()),RooFit::RenameAllVariablesExcept("low","x"));
    xf_sig_pdf = w_sig.pdf((std::string("signal_fixed_")+pname+std::string("low")).c_str());
   
    RooArgSet* biasVars = xf_sig_pdf->getVariables();
    TIterator *it = biasVars->createIterator();
    RooRealVar* var = (RooRealVar*)it->Next();
    while (var) {
        var->setConstant(kTRUE);
        var = (RooRealVar*)it->Next();
    }
    */
    RooRealVar x("x", "m_{X} (GeV)", SR_lo, SR_hi);
    
    RooRealVar nBackground((std::string("bg_")+pname+std::string("_norm")).c_str(),"nbkg",h_mX_SR->GetSumOfWeights());
    RooRealVar nBackground2((std::string("alt_bg_")+pname+std::string("_norm")).c_str(),"nbkg",h_mX_SR->GetSumOfWeights());
    std::string blah = pname;
    //pname=""; //Antibtag=tag to constrain b-tag to the anti-btag shape
    
    
    /* RooRealVar bg_p0((std::string("bg_p0_")+pname).c_str(), "bg_p0", 4.2, 0, 200.);
     RooRealVar bg_p1((std::string("bg_p1_")+pname).c_str(), "bg_p1", 4.5, 0, 300.);
     RooRealVar bg_p2((std::string("bg_p2_")+pname).c_str(), "bg_p2", 0.000047, 0, 10.1);
     RooGenericPdf bg_pure = RooGenericPdf((std::string("bg_pure_")+blah).c_str(),"(pow([email protected]/13000,@1)/pow(@0/13000,@[email protected]*log(@0/13000)))",RooArgList(x,bg_p0,bg_p1,bg_p2));
   */
    RooRealVar bg_p0((std::string("bg_p0_")+pname).c_str(), "bg_p0", 0., -1000, 200.);
    RooRealVar bg_p1((std::string("bg_p1_")+pname).c_str(), "bg_p1", -13, -1000, 1000.);
    RooRealVar bg_p2((std::string("bg_p2_")+pname).c_str(), "bg_p2", -1.4, -1000, 1000.);
    bg_p0.setConstant(kTRUE);
    //RooGenericPdf bg_pure = RooGenericPdf((std::string("bg_pure_")+blah).c_str(),"(pow(@0/13000,@[email protected]*log(@0/13000)))",RooArgList(x,bg_p1,bg_p2));
    RooGenericPdf bg = RooGenericPdf((std::string("bg_")+blah).c_str(),"(pow(@0/13000,@[email protected]*log(@0/13000)))",RooArgList(x,bg_p1,bg_p2));
  

    /*TF1* biasFunc = new TF1("biasFunc","(0.63*x/1000-1.45)",1350,3600);
    TF1* biasFunc2 = new TF1("biasFunc2","TMath::Min(2.,2.3*x/1000-3.8)",1350,3600);
    double bias_term_s = 0;
    if ((imass > 2450 && blah == "antibtag") || (imass > 1640 && blah == "btag")) {
        if (blah == "antibtag") {
            bias_term_s = 2.7*biasFunc->Eval(imass);
        } else {
//.........这里部分代码省略.........
开发者ID:cvernier,项目名称:Vg,代码行数:101,代码来源:BackgroundPrediction.c

示例15: arrangeCanvas

//*************************************************************
void arrangeCanvas(TCanvas *canv,TH1F* meanplots[100],TH1F* widthplots[100],Int_t nFiles, TString LegLabels[10], bool onlyBias){
//*************************************************************

  TPaveText *ali = new TPaveText(0.18,0.87,0.50,0.93,"NDC");  
  ali->SetFillColor(10);
  ali->SetTextColor(1);
  ali->SetTextFont(42);
  ali->SetMargin(0.);
  ali->SetLineColor(10);
  ali->SetShadowColor(10);
  // pt->SetTextAlign(11);
  TText *alitext = ali->AddText("Alignment: PCL"); //"Preliminary 2015 - 0T collision data");
  alitext->SetTextSize(0.04);

  TLegend *lego = new TLegend(0.18,0.80,0.78,0.92);
  lego-> SetNColumns(2);
  //TLegend *lego = new TLegend(0.18,0.77,0.50,0.86);
  lego->SetFillColor(10);
  lego->SetTextSize(0.04);
  lego->SetTextFont(42);
  lego->SetFillColor(10);
  lego->SetLineColor(10);
  lego->SetShadowColor(10);

  TPaveText *pt  = NULL;
  TPaveText *pt2 = NULL;
  TPaveText *pt3 = NULL;

  if(!onlyBias){ 
    pt =new TPaveText(0.179,0.955,0.260,0.985,"NDC");
  } else {
    pt =new TPaveText(0.179,0.955,0.260,0.985,"NDC");
  }

  pt->SetFillColor(10);
  pt->SetTextColor(1);
  pt->SetTextFont(61);
  // pt->SetTextAlign(11);
  TText *text1 = pt->AddText("CMS"); //"Preliminary 2015 - 0T collision data");
  text1->SetTextSize(0.05);
 
  float extraOverCmsTextSize  = 0.76;

  if(!onlyBias){ 
    pt2 =new TPaveText(0.3,0.95,0.503,0.98,"NDC");
  } else {
    pt2 =new TPaveText(0.3,0.95,0.503,0.98,"NDC");
  }

  pt2->SetFillColor(10);
  pt2->SetTextColor(1);
  pt2->SetTextFont(52);
  pt2->SetTextAlign(22);
  TText *text2 = pt2->AddText("work in progress");
  text2->SetTextSize(0.05*extraOverCmsTextSize);

  if(!onlyBias){ 
    pt3 =new TPaveText(0.6,0.95,0.98,0.98,"NDC");
  } else {
    pt3 =new TPaveText(0.6,0.95,0.98,0.98,"NDC");
  }

  pt3->SetFillColor(10);
  pt3->SetTextColor(1);
  pt3->SetTextFont(42);
  // pt2->SetTextAlign(11);
  TText *text3 = pt3->AddText("3.8T collision data 2015");
  text3->SetTextSize(0.05*extraOverCmsTextSize);

  canv->SetFillColor(10);  
  if(!onlyBias) {
    canv->Divide(2,1);
    
    canv->cd(1)->SetBottomMargin(0.12);
    canv->cd(1)->SetLeftMargin(0.17);
    canv->cd(1)->SetRightMargin(0.02);
    canv->cd(1)->SetTopMargin(0.06);  
    
    canv->cd(2)->SetBottomMargin(0.12);
    canv->cd(2)->SetLeftMargin(0.17);
    canv->cd(2)->SetRightMargin(0.02);
    canv->cd(2)->SetTopMargin(0.06);  
  
    canv->cd(1);
  } else {
    
    canv->cd()->SetBottomMargin(0.14);
    canv->cd()->SetLeftMargin(0.17);
    canv->cd()->SetRightMargin(0.02);
    canv->cd()->SetTopMargin(0.06);  
    canv->cd();

  }

  Double_t absmin(999.);
  Double_t absmax(-999.);

  for(Int_t i=0; i<nFiles; i++){
    if(meanplots[i]->GetMaximum()>absmax) absmax = meanplots[i]->GetMaximum();
//.........这里部分代码省略.........
开发者ID:mmusich,项目名称:PVToolScripts,代码行数:101,代码来源:AutoFitResiduals_forApproval.C


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