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


C++ TLegend::SetName方法代码示例

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


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

示例1: TLegend

TLegend *GetLegendData(TH1D *hpp,Int_t identifier){
    
  // TLegend * legend = new TLegend(0.011/gPad->GetWNDC()+gPad->GetLeftMargin(),0.13/gPad->GetHNDC()+gPad->GetBottomMargin(),0.2/gPad->GetWNDC()+gPad->GetLeftMargin(),0.18/gPad->GetHNDC()+gPad->GetBottomMargin());
   TLegend * legend = new TLegend(0.3,0.48,0.6,0.57,NULL,"brNDC");
  
    legend->SetFillColor(0);
    legend->SetFillStyle(0);
    legend->SetBorderSize(0);
    legend->SetTextFont(43);
    //    legend->SetTextSize(0.06/(gPad->GetHNDC())*scaleHeightPads);
    legend->SetTextSize(22.1*innerPadHeight/referencePadHeight*resizeTextFactor);// settings for font 42: 0.07/(gPad->GetHNDC())*scaleHeight
 
    legend->AddEntry(hpp,"pp, #sqrt{#it{s}} = 7 TeV","lep");
    legend->SetName(Form("LegendDataPP_%d",identifier));
    return legend;
  }
开发者ID:ktf,项目名称:AliPhysics,代码行数:16,代码来源:DoComparison_ppVsMCallPanelsNew.C

示例2: StackLegend

  /** 
   * Get or create a stack legend.  This is done by adding a TLegend
   * object to the list of functions for the first histogram in the
   * stack.
   * 
   * @param stack Stack to get the legend from/modify 
   * 
   * @return The legend object or null
   */
  TLegend* StackLegend(THStack* stack) 
  {
    TList* hists = stack->GetHists();
    if (!hists) return 0;
    
    TObject* first = hists->First();
    if (!first) return 0;

    TH1*    hist = static_cast<TH1*>(first);
    TList*  list = hist->GetListOfFunctions();
    TObject* o   = list->FindObject("legend");
    if (o) return static_cast<TLegend*>(o);
    
    TLegend* l = new TLegend(0.65, 0.65, 0.9, 0.9, "", "NDC");
    l->SetName("legend");
    l->SetBorderSize(0);
    l->SetFillColor(0);
    l->SetFillStyle(0);
    l->SetTextFont(42);
    list->Add(l);
    
    return l;
  }
开发者ID:ktf,项目名称:AliPhysics,代码行数:32,代码来源:UnfoldMultDists.C

示例3: main


//.........这里部分代码省略.........
                        if(x/1e3>0.05&&x/1e3<=100)
                                galprop3P->SetPoint(j,x/1e3,y*1e7*pow(x/1e3,potenza));
                        j++;
                }
        }
	
	        j=0;
        {
                string filename="./Galprop/Tom/deut_100.dat";
                cout<<filename<<endl;
                ifstream fp(filename.c_str());
                while (!fp.eof()){
                        fp>>x>>y;
                        if(x/1e3>0.05&&x/1e3<=100)
                                galprop3P2->SetPoint(j,x/1e3,y*1e7*pow(x/1e3,potenza));
                        j++;
                }
        }
        galprop3P->GetXaxis()->SetRangeUser(0.1,20);
        galprop3P->GetYaxis()->SetRangeUser(1e-3,1e3);

        galprop3P->SetTitle("Deutons Flux: Geo. Zones");
        galprop3P->GetXaxis()->SetTitle("Kin.En./nucl. [GeV/nucl.]");
        galprop3P ->GetYaxis()->SetTitle("Flux [(m^2 sr GeV/nucl.)^-1]");
        galprop3P ->GetXaxis()->SetTitleSize(0.045);
        galprop3P->GetYaxis()->SetTitleSize(0.045);
        galprop3P ->GetYaxis()->SetRangeUser(1e-2,1e4);

	Frame->Draw();
	galprop3P->Draw("sameC");
        galprop3P2->Draw("sameC");
	
	TLegend * leg =new TLegend(0.8, 0.1,0.95,0.95);
	leg->SetName("leg");
        for(uint n=0;n<D_Graphs.size();n++){
                D_Graphs[n] ->Draw("Psame");
                D_Graphs[n]->SetMarkerSize(2); 
                leg->AddEntry(D_Graphs[n],D_Graphs[n]->GetTitle(),"p");
        }

	leg->SetFillColor(0);
	leg->SetLineWidth(2);
	leg->Draw("same");

	DFluxNaF->GetFlux()->Smooth();        

	PlotTH1FintoGraph(gPad,ToFDB, DFluxTOF->GetFlux(),"Kinetic Energy [GeV/nucl.]", "Flux",1,true,"Psame",0.1,10,0.01,1000,"This Work (TOF)",8);
	PlotTH1FintoGraph(gPad,NaFDB, DFluxNaF->GetFlux(),"Kinetic Energy [GeV/nucl.]", "Flux",1,true,"Psame",0.1,10,0.01,1000,"This Work (NaF)",22);
	PlotTH1FintoGraph(gPad,AglDB, DFluxAgl->GetFlux(),"Kinetic Energy [GeV/nucl.]", "Flux",1,true,"Psame",0.1,10,0.01,1000,"This Work (Agl)",29);

	
	Plots.Add(c2);
	Plots.writeObjsInFolder("Fluxes");

	TCanvas *c3 = new TCanvas("D/P ratio");
	c3->SetCanvasSize(2000,1500);
	j=0;
	TGraph* galprop3DP=new TGraph();
        TGraph* galprop3DP2=new TGraph();
        {
                string filename="./Galprop/Tom/dP_1500.dat";
                cout<<filename<<endl;
                ifstream fp(filename.c_str());
                while (!fp.eof()){
                        fp>>x>>y;
                        if(x/1e3>0.05&&x/1e3<=100)
开发者ID:francescodimiccoli,项目名称:Deutons,代码行数:67,代码来源:D_Fluxes.cpp

示例4: UTMplots


//.........这里部分代码省略.........
Data->Draw("misc.MT2>>DataZVSPT100","NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&NEles==0&&NMuons==0&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM==0&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=100","goff");

cout << "DataWVSPT0" << endl;
Data->Draw("misc.MT2>>DataWVSPT0",  "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM==0&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=0&&misc.Vectorsumpt<20","goff");
cout << "DataWVSPT20" << endl;
Data->Draw("misc.MT2>>DataWVSPT20", "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM==0&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=20&&misc.Vectorsumpt<30","goff");
cout << "DataWVSPT30" << endl;
Data->Draw("misc.MT2>>DataWVSPT30", "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM==0&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=30&&misc.Vectorsumpt<40","goff");
cout << "DataWVSPT40" << endl;
Data->Draw("misc.MT2>>DataWVSPT40", "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM==0&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=40&&misc.Vectorsumpt<50","goff");
cout << "DataWVSPT50" << endl;
Data->Draw("misc.MT2>>DataWVSPT50", "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM==0&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=50&&misc.Vectorsumpt<70","goff");
cout << "DataWVSPT70" << endl;
Data->Draw("misc.MT2>>DataWVSPT70", "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM==0&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=70&&misc.Vectorsumpt<100","goff");
cout << "DataWVSPT100" << endl;
Data->Draw("misc.MT2>>DataWVSPT100","NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM==0&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=100","goff");

cout << "DataWVSPT0" << endl;
Data->Draw("misc.MT2>>DataTopVSPT0",  "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM>=1&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=0&&misc.Vectorsumpt<20","goff");
cout << "DataTopVSPT20" << endl;
Data->Draw("misc.MT2>>DataTopVSPT20", "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM>=1&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=20&&misc.Vectorsumpt<30","goff");
cout << "DataTopVSPT30" << endl;
Data->Draw("misc.MT2>>DataTopVSPT30", "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM>=1&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=30&&misc.Vectorsumpt<40","goff");
cout << "DataTopVSPT40" << endl;
Data->Draw("misc.MT2>>DataTopVSPT40", "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM>=1&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=40&&misc.Vectorsumpt<50","goff");
cout << "DataTopVSPT50" << endl;
Data->Draw("misc.MT2>>DataTopVSPT50", "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM>=1&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=50&&misc.Vectorsumpt<70","goff");
cout << "DataTopVSPT70" << endl;
Data->Draw("misc.MT2>>DataTopVSPT70", "NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM>=1&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=70&&misc.Vectorsumpt<100","goff");
cout << "DataTopVSPT100" << endl;
Data->Draw("misc.MT2>>DataTopVSPT100","NJetsIDLoose40>=2&&misc.HT>750&&misc.MET>10&&(NEles+NMuons)==1&&NTausIDLoose3Hits==0&&misc.MinMetJetDPhi4Pt40>0.5&&NBJets40CSVM>=1&&misc.PassJet40ID ==1&&misc.HBHENoiseFlag == 0&&misc.CSCTightHaloIDFlag == 0&&misc.trackingFailureFlag==0&&misc.eeBadScFlag==0&&misc.EcalDeadCellTriggerPrimitiveFlag==0&&misc.TrackingManyStripClusFlag==0&&misc.TrackingTooManyStripClusFlag==0&&misc.TrackingLogErrorTooManyClustersFlag==0&&misc.CrazyHCAL==0&&(misc.MET>30||misc.MET/misc.CaloMETRaw<=2.)&&misc.Vectorsumpt>=100","goff");

TLegend *leg = new TLegend(.6,.6,.90,.90);
leg->SetName("leg");
leg -> SetFillColor(0);
leg -> SetBorderSize(0);
leg->AddEntry(LM6VSPT0,"0 #leq VSPT < 20 GeV", "l");
leg->AddEntry(LM6VSPT20,"20 #leq VSPT < 30 GeV", "l");
leg->AddEntry(LM6VSPT30,"30 #leq VSPT < 40 GeV", "l");
leg->AddEntry(LM6VSPT40,"40 #leq VSPT < 50 GeV", "l");
leg->AddEntry(LM6VSPT50,"50 #leq VSPT < 70 GeV", "l");
leg->AddEntry(LM6VSPT70,"70 #leq VSPT < 100 GeV", "l");
leg->AddEntry(LM6VSPT100,"100 GeV #leq VSPT", "l");

//store the file
TFile *file = new TFile("UTMfile.root","RECREATE");
file->cd();
LM6VSPT0  ->Write();
LM6VSPT20 ->Write();
LM6VSPT30 ->Write();
LM6VSPT40 ->Write();
LM6VSPT50 ->Write();
LM6VSPT70 ->Write();
LM6VSPT100->Write();
WJetsVSPT0  ->Write();
WJetsVSPT20 ->Write();
WJetsVSPT30 ->Write();
WJetsVSPT40 ->Write();
WJetsVSPT50 ->Write();
WJetsVSPT70 ->Write();
WJetsVSPT100->Write();
ZJetsVSPT0  ->Write();
ZJetsVSPT20 ->Write();
ZJetsVSPT30 ->Write();
ZJetsVSPT40 ->Write();
ZJetsVSPT50 ->Write();
开发者ID:MT2Analysis,项目名称:MT2Analysis,代码行数:67,代码来源:UTMplots.C


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