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


C++ TMultiGraph::GetYaxis方法代码示例

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


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

示例1: qcd1

void qcd1() {

    setTDRStyle();

    unsigned int nbins = 8;
    std::vector<double> bins;
    //bins.push_back(275.);
    //bins.push_back(325.);
    //for ( int i = 0; i < nbins-2; ++i ) { bins.push_back(375.+100.*i); }
    bins.push_back(298.);
    bins.push_back(348.);
    bins.push_back(416.);
    bins.push_back(517.);
    bins.push_back(617.);
    bins.push_back(719.);
    bins.push_back(819.);
    bins.push_back(1044.);

    std::vector<double> widths;
    //widths.push_back(25.);
    //widths.push_back(25.);
    //for ( int i = 0; i < nbins-2; ++i ) { widths.push_back(50.); }
    widths.resize(nbins,0.);

    std::vector<double> tr_effs;
    tr_effs.resize(nbins,1.);

    std::vector<double> tr_errs;
    tr_errs.resize(nbins,0.2);

    std::vector<double> vals;
    vals.push_back(630453600.);
    vals.push_back(286166200.);
    vals.push_back(209611400.);
    vals.push_back(69777150.);
    vals.push_back(26101500.);
    vals.push_back(20182300.);
    vals.push_back(4745175.);
    vals.push_back(4776350.);

    std::vector<double> errs;
    errs.push_back(1181263.323734);
    errs.push_back(562792.359579);
    errs.push_back(340602.025831);
    errs.push_back(98254.312882);
    errs.push_back(60093.832878);
    errs.push_back(52839.982494);
    errs.push_back(25625.390241);
    errs.push_back(25701.459103);

    TCanvas* c = new TCanvas("tmp","tmp",900,600);

    TGraphAsymmErrors* gr1 = new TGraphAsymmErrors(8);
    gr1->SetName("Graph1");
    gr1->SetTitle("");
    gr1->SetFillColor(1);
    gr1->SetLineWidth(2);
    gr1->SetMarkerStyle(24);
    gr1->SetMarkerColor(1);
    gr1->SetMarkerSize(2.);

    TGraphAsymmErrors* gr2 = new TGraphAsymmErrors(8);
    gr2->SetName("Graph2");
    gr2->SetTitle("");
    gr2->SetFillColor(1);
    gr2->SetLineWidth(2);
    gr2->SetMarkerStyle(20);
    gr1->SetMarkerColor(1);
    gr2->SetMarkerSize(1.5);

    for ( unsigned int i = 0; i < bins.size(); ++i ) {
        double x = bins[i];
        double ex = widths[i];
        double y = vals[i];
        double ey = errs[i];

        gr1->SetPoint(i+1,x,y);
        gr1->SetPointError(i+1,ex,ex,ey,ey);

        std::cout << " HT= " << bins[i] << " yield= " << y << " +/- " << ey << std::endl;

        y = y / tr_effs[i];
        ey = y * sqrt( (ey/y)*(ey/y) + (tr_errs[i]/tr_effs[i])*(tr_errs[i]/tr_effs[i]) );

        gr2->SetPoint(i+1,x,y);
        gr2->SetPointError(i+1,ex,ex,ey,ey);

        std::cout << " HT= " << bins[i] << " yield= " << y << " +/- " << ey << std::endl;

    }

    TMultiGraph* mg = new TMultiGraph();
    mg->Add(gr1,"p");
    mg->Add(gr2,"p");
    mg->Draw("ap");
    mg->GetXaxis()->SetTitle("H_{T} (GeV)");
    mg->GetYaxis()->SetTitle("Bulk yields");
    mg->GetYaxis()->SetRangeUser(1.e5,1.e9);
    mg->GetXaxis()->SetRangeUser(275.,1175.);

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

示例2: draw_cross


//.........这里部分代码省略.........
yerr2[0] = 0.097;
yerr2[1] = 0.071;
yerr2[2] = 0.0617;
yerr2[3] = 0.0313;
yerr2[4] = 0.0292;
yerr2[5] = 0.0264;
	yerr3[0] = 0.0174;
	yerr3[1] = 0.0362;
	yerr3[2] = 0.0559;
	yerr3[3] = 0.0611;
	yerr3[4] = 0.0864;
	yerr3[5] = 0.1384;

*/


   TMultiGraph *mg = new TMultiGraph("mg","Q2 resolution");
   TGraphErrors *g1 = new TGraphErrors(7,x,y1,0,0);
   TGraphErrors *g2 = new TGraphErrors(7,x,y2,0,0);	
//   TGraphErrors *g3 = new TGraphErrors(6,x,y3,0,yerr3);

  TCanvas *c11 = new TCanvas("c11","counts vs T",600,600);

//  g1->Draw("A*");
g1->SetName("g1");
g1->SetTitle("");  
g1->SetMarkerStyle(21);
g1->SetMarkerColor(1);
g1->SetMarkerSize(1.0);
g1->SetDrawOption("AP");
g1->SetLineColor(1);
g1->SetLineWidth(0);
g1->SetFillStyle(0);
g1->GetYaxis()->SetTitle("Q2 resolution (%)");
g1->GetXaxis()->SetTitle("Angle bin (deg)");


g2->SetName("g2");
g2->SetTitle("");
g2->SetMarkerStyle(22); 
g2->SetMarkerSize(1.5);
g2->SetMarkerColor(4);
g2->SetDrawOption("P");
g2->SetLineColor(2);
g2->SetLineWidth(0);
g2->SetFillStyle(0);



/*
g3->SetName("g3");
g3->SetMarkerStyle(22);
g3->SetMarkerSize(0.8);
g3->SetMarkerColor(4);
g3->SetDrawOption("P");
g3->SetLineColor(7);
g3->SetLineWidth(2);
g3->SetFillStyle(0);

*/

//mg->Add(g3);
mg->Add(g1);
mg->Add(g2);

//g1->Draw("ALP");
开发者ID:liye1984,项目名称:compton-ifarm-Primex2,代码行数:67,代码来源:draw_cross.C

示例3: result_JES_akPu4PF_

void result_JES_akPu4PF_(refpt> 75 && refpt < 120)&&(abs(refeta)<2)_Centrality()
{
//=========Macro generated from canvas: Can_result_0/
//=========  (Mon Apr 18 02:39:41 2016) by ROOT version6.02/13
   TCanvas *Can_result_0 = new TCanvas("Can_result_0", "",18,40,700,500);
   gStyle->SetOptFit(1);
   Can_result_0->Range(-18.75,0.9236134,118.75,1.043845);
   Can_result_0->SetFillColor(0);
   Can_result_0->SetBorderMode(0);
   Can_result_0->SetBorderSize(2);
   Can_result_0->SetFrameBorderMode(0);
   Can_result_0->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("name");
   multigraph->SetTitle("JES_akPu4PF");
   
   Double_t Graph_fx1001[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1001[4] = {
   1.025461,
   0.982262,
   0.9644553,
   0.970611};
   Double_t Graph_fex1001[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1001[4] = {
   0.001598024,
   0.0009318739,
   0.0008002418,
   0.0004502591};
   TGraphErrors *gre = new TGraphErrors(4,Graph_fx1001,Graph_fy1001,Graph_fex1001,Graph_fey1001);
   gre->SetName("Graph");
   gre->SetTitle("some title_0");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   
   TH1F *Graph_Graph1001 = new TH1F("Graph_Graph1001","some title_0",100,0,110);
   Graph_Graph1001->SetMinimum(0.9573146);
   Graph_Graph1001->SetMaximum(1.0334);
   Graph_Graph1001->SetDirectory(0);
   Graph_Graph1001->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   Graph_Graph1001->SetLineColor(ci);
   Graph_Graph1001->GetXaxis()->SetLabelFont(42);
   Graph_Graph1001->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetXaxis()->SetTitleFont(42);
   Graph_Graph1001->GetYaxis()->SetLabelFont(42);
   Graph_Graph1001->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetYaxis()->SetTitleFont(42);
   Graph_Graph1001->GetZaxis()->SetLabelFont(42);
   Graph_Graph1001->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1001);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1002[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1002[4] = {
   1.025808,
   0.9823451,
   0.964104,
   0.9707841};
   Double_t Graph_fex1002[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1002[4] = {
   0.001641175,
   0.0009556419,
   0.0008206184,
   0.000461058};
   gre = new TGraphErrors(4,Graph_fx1002,Graph_fy1002,Graph_fex1002,Graph_fey1002);
   gre->SetName("Graph");
   gre->SetTitle("some title_1");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   gre->SetLineColor(2);
   gre->SetMarkerColor(2);
   
   TH1F *Graph_Graph1002 = new TH1F("Graph_Graph1002","some title_1",100,0,110);
   Graph_Graph1002->SetMinimum(0.9568668);
   Graph_Graph1002->SetMaximum(1.033866);
//.........这里部分代码省略.........
开发者ID:Jelov,项目名称:JetEnergy_SR,代码行数:101,代码来源:result_JES_akPu4PF_(refpt>+75+&&+refpt+<+120)&&(abs(refeta)<2)_Centrality.C

示例4: Eff_Doping

void Eff_Doping(){		// name of file

using namespace std;

double bias=30;
int i=0;			// used to name the TGraphs

TCanvas *c1 = new TCanvas("c1","c1",600,400);
TPad *pad1 = new TPad("pad1","",0,0,1,1);
TLegend *leg = new TLegend(.80,.70,.85,.87);

TGraph *gr[4];			// defines array to number of TGraphs

TMultiGraph *mg = new TMultiGraph();		// create multigraph

for (double fluence=13;fluence<=15;fluence+=1){		// loop to create multigraph for select bias values

	TString str =TString::Format("/afs/cern.ch/work/m/mbucklan/TCAD/SimpleCMOS/DepletionSimRemesh_3pixels_Rad/Neffextraction_3pixel_yCut_bias=%.1f_pitch=15.0_Fluence=1e+%.0f.txt",bias,fluence);		// does some magic, creates string with name of file
		
	if (i==4){
	
	i++;
	
	}

	gr[i] = new TGraph(str,"%lg %lg");		// creates graph called gr and reads file
	
	
	TString str1 =TString::Format("1e%.0f n_{eq} cm^{-2}",fluence);		// creates string with bias value
	
	gr[i]->SetTitle(str1);			// sets title to string
	gr[i]->SetLineColor(i+1);		// sets line colour, changes for each graph
	
	mg->Add(gr[i]);				// adds graph to multigraph
	leg->AddEntry(gr[i],str1,"l");
	
	i++;
	
}
	
pad1->Draw();
pad1->cd();
pad1->SetTickx(1);		//draws ticks on top side x axis
pad1->SetTicky(1);		//draws ticks on right hand side y axis

gPad->Update();
	
mg->Draw("AL");		// draws multigraph

// Make the graph look fancy...ish
mg->GetXaxis()->SetTitle("Depth (#mum)");
mg->GetYaxis()->SetTitle("Effective Doping Concentration (cm^{-3})");

TString str2 =TString::Format("Effective Doping Concentration for 3 Pixel 100#mum Thick Sensor at %.0fV, Resistivity=100#Omegacm",bias);		// does some magic, creates string with name of file

mg->GetHistogram()->SetTitle(str2);

mg->SetMinimum(-2e12);

leg->SetTextSize(0.03);
leg->Draw();

}
开发者ID:mbucklan,项目名称:TCAD,代码行数:63,代码来源:Eff_Doping.C

示例5: PlotRanges

/**
The purpose of this function is to conveniently plot an event. Each event is plotted on a TCanvas. Divided into as many pads as there are panels. Each pad is a TMultiGraph with a TLegend, and shows the channels of the digitizer connected to the lines of that panel. The grouping into pads must not necessarily be according to panels, but in any other prefered way.

@param a_channels - a vector of a vector of samples, containing all 32 channels
@ param a_channelsToPadsAssociation - a map from std::string, which is the name of the panel (or group of channels) to be assigned to each pad to a vector if integers, which is the list of channels indices corresponding to indices of channels in the paramater a_channels to associate to a pad
@param sEventTitle - a string containing the title of the event (for example, the time stamp)
*/
void RangePlotter::PlotRanges(Channels_t& a_channels, Range_t& a_channelsToPadsAssociation, std::string sEventTitle)
{	
//	printf("Plotting\n");
	//m_pCanvas->Clear();
	m_pCanvas->SetTitle(sEventTitle.c_str());
	
	
	int iPadCounter = 0;
	if(0 == m_vpMultiGraph.size())
	{
		MakePads(a_channelsToPadsAssociation.size());	
		for (auto& rangeIt: a_channelsToPadsAssociation)
		{	
			TMultiGraph* pMg = new TMultiGraph();	
			m_vpMultiGraph.push_back(std::unique_ptr<TMultiGraph>(pMg));

	//		m_pCanvas->cd(iPadCounter + 1);
			ChangePad(iPadCounter);
			int i = 0;

			auto legend = new TLegend(0.8,0.8,1,1, "Channels");
			m_vpLegends.push_back(std::unique_ptr<TLegend>(legend));
			printf("printing panel %s\n", rangeIt.first.c_str());
			for (auto& chanIt: rangeIt.second)
			{
				int iNumOfSamples = a_channels[chanIt].size();
				TGraph* pGr = new TGraph(iNumOfSamples);
				std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);
				for (int counter = 0; counter < iNumOfSamples; counter++)
				{
					pGr->SetPoint(counter, vTimeSeq[counter], TransformToVoltage(a_channels[chanIt][counter]));
				}

				m_vpGraph[chanIt] = pGr;
				pGr->SetLineColor(m_colors[i%(sizeof(m_colors)/sizeof(int))]);
				pGr->SetName((m_sInstanceName + std::string("Pan_") + rangeIt.first + std::string("chan_") + std::to_string(chanIt)).c_str());
				std::string sGraphTitle = std::string("Channel ") + std::to_string(chanIt);
				pGr->SetTitle(sGraphTitle.c_str());
				legend->AddEntry(pGr,std::to_string(chanIt).c_str(), "l");
		
				pMg->Add(pGr);
				i++;
			}

			if(Configuration::Instance().ShowTriggerInWaveformsStep())
			{
				int iNumOfSamples = a_channels[a_channels.size() - 1].size();
				m_vpGraphPrecisionTrigger = new TGraph(iNumOfSamples);
				std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);
				for (int counter = 0; counter < iNumOfSamples; counter++)
				{
					m_vpGraphPrecisionTrigger->SetPoint(counter, vTimeSeq[counter], TransformToVoltage(a_channels[a_channels.size() - 1][counter]));
				}
				
				m_vpGraphPrecisionTrigger->SetName((m_sInstanceName + std::string("Pan_") + rangeIt.first + "_Trig").c_str());	
				m_vpGraphPrecisionTrigger->SetTitle("Trigger");
				legend->AddEntry(m_vpGraphPrecisionTrigger,"Trigger", "l");
				pMg->Add(m_vpGraphPrecisionTrigger);
			}
			
			std::string sMultiGraphTitle = std::string("Panel ") + rangeIt.first;
			pMg->SetTitle(sMultiGraphTitle.c_str());

			pMg->Draw("AL");
			pMg->GetXaxis()->SetTitle("Time [nanoseconds]");
			pMg->GetXaxis()->CenterTitle();
			pMg->GetYaxis()->SetTitle("Voltage [volts]");
			pMg->GetYaxis()->CenterTitle();

			gPad->Modified();

			pMg->SetMinimum(m_fMinVoltage);
			pMg->SetMaximum(m_fMaxVoltage);
			legend->Draw();
			iPadCounter++;
		}
		m_pCanvas->Update();
	}
	else
	{
//		printf("Plottin again\n");
		for (auto& rangeIt: a_channelsToPadsAssociation)
		{
			printf("Panel %s\n", rangeIt.first.c_str());
			m_pCanvas->cd(iPadCounter + 1);
			for (auto& chanIt: rangeIt.second)
			{
//				printf("Chanenl %d\n", chanIt);
				//TODO: num of samples is constant per run at least!
				m_vpGraph[chanIt]->SetLineWidth(1);
				int iNumOfSamples = a_channels[chanIt].size();	
				std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);	
				for (int counter = 0; counter < iNumOfSamples; counter++)
//.........这里部分代码省略.........
开发者ID:davereikher,项目名称:pps-daq,代码行数:101,代码来源:RangePlotter.cpp

示例6: pionContaminationVeta


//.........这里部分代码省略.........
	TGraphErrors* gPionYield = new TGraphErrors(20,eta,normlzd_PiYield,0,0);
	gPionYield->SetMarkerColor(kRed+2);
	gPionYield->SetMarkerStyle(24);
	
	TGraphErrors* gPionFrac = new TGraphErrors(20,eta,pionFrac,0,pionFracErr);
	TGraphErrors* gKpFrac   = new TGraphErrors(20,eta,kpFrac,0,kpFracErr);	
	TGraphErrors* gElecFrac = new TGraphErrors(20,eta,electFrac,0,electFracErr);
	
	
	
	
	gPionFrac->SetMarkerColor(kViolet+1);
  gPionFrac->SetLineColor(kViolet+1);
  gPionFrac->SetLineWidth(2);
	gKpFrac->SetMarkerColor(kGreen+2);
  gKpFrac->SetLineColor(kGreen+2);
  gKpFrac->SetLineWidth(2);
	gKpFrac->SetMarkerStyle(22);	
	gElecFrac->SetMarkerColor(kBlue);
	gElecFrac->SetLineColor(kBlue);
	gElecFrac->SetLineWidth(2);
	gElecFrac->SetMarkerStyle(20);
	
	
	TMultiGraph* multiFracs = new TMultiGraph();
	multiFracs->Add(gPionFrac);
	multiFracs->Add(gKpFrac);
	multiFracs->Add(gElecFrac);
	//multiFracs->Add(gPionYield);
  
	TCanvas* cMultiG = new TCanvas();
	multiFracs->Draw("AP");
	multiFracs->GetXaxis()->SetTitle("#eta^{#pi^{+}#pi^{-}}");
	multiFracs->GetYaxis()->SetTitle("particle Fractions");
	gPad->Modified();
	
	TLegend* leg = new TLegend(0.52,0.17,0.89,0.30);
	leg->AddEntry(gPionFrac,"Pion","P");
	leg->AddEntry(gKpFrac,"K/P","P");
	leg->AddEntry(gElecFrac,"Electron","P");
	//  leg->Draw();
	
	TCanvas* cPiYeild = new TCanvas();
	TGraphErrors* gPionYield = new TGraphErrors(20,eta,piYield,0,0);
	
	
	gPionYield->Draw("AP");
	gPionYield->SetMarkerColor(kRed+2);
	gPionYield->SetMarkerStyle(24);
	gPionYield->GetXaxis()->SetTitle("#eta^{#pi^{+}#pi^{-}}");
	gPionYield->GetYaxis()->SetTitle("Pion Yield");
	
	
	
	
	
	cout << pionYieldWhole/totalYieldWhole << endl;
	
	
	
	
	hTotal->Draw();
	
  TF1 *fitFunc = new TF1("fitFunc","gaus(0)+gaus(3)+gaus(6)",-10,10);
  TF1 *piFunc = new TF1("piFunc","gaus(0)",-10,10);
  TF1 *kpFunc = new TF1("kpFunc","gaus(0)",-10,10);
开发者ID:keithdlandry,项目名称:2012IFF,代码行数:67,代码来源:pionContaminationVeta.C

示例7: IsovsPt


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


  c95->SetLineColor(kMagenta); 
  c9->SetLineColor(kRed);
  c8->SetLineColor(kOrange);
  c7->SetLineColor(kYellow);



  c95->SetMarkerSize(1);
  c9->SetMarkerSize(1);
  c8->SetMarkerSize(1);
  c7->SetMarkerSize(1);




  TMultiGraph *PhoIso = new TMultiGraph();
  TMultiGraph *ChgIso = new TMultiGraph();
  TMultiGraph *NeuIso = new TMultiGraph();


  PhoIso->Add(p95,"p");
  PhoIso->Add(p9,"p");
  PhoIso->Add(p7,"p");
  PhoIso->Add(p8,"p");


  ChgIso->Add(c95,"p");
  ChgIso->Add(c9,"p");
  ChgIso->Add(c7,"p");
  ChgIso->Add(c8,"p");

  NeuIso->Add(n95,"p");
  NeuIso->Add(n9,"p");
  NeuIso->Add(n7,"p");
  NeuIso->Add(n8,"p");

  



  TCanvas *c1 = new TCanvas("c1","Iso P vs Pt",1000,500);
  c1->Divide(2,1); 

  c1->cd(1);
  PhoIso->Draw("AP");
  PhoIso->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  PhoIso->GetYaxis()->SetTitle("Isolation PF:gamma");
  

  
  c1->cd(2)->SetLogz();
  
  isoPptS->Draw("colz");  
  isoPptS->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  isoPptS->GetYaxis()->SetTitle("Isolation PF:gamma");

  c1->SaveAs("PhotonIso_95.png");


  TCanvas *c2 = new TCanvas("c2","Iso C vs Pt",1000,500);
  c2->Divide(2,1);
  c2->cd(1);
  ChgIso->Draw("AP");
  ChgIso->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  ChgIso->GetYaxis()->SetTitle("Isolation PF:ch hadrons");
  

  c2->cd(2)->SetLogz();
  
  isoCptS->Draw("colz");  
  isoCptS->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  isoCptS->GetYaxis()->SetTitle("Isolation PF:ch hadrons");


  c2->SaveAs("ChargeIso_95.png");
  
  TCanvas *c3 = new TCanvas("c3","Iso N vs Pt",1000,500);
  c3->Divide(2,1);
  c3->cd(1);
  NeuIso->Draw("AP");
  NeuIso->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  NeuIso->GetYaxis()->SetTitle("Isolation PF:h0");
  

  c3->cd(2)->SetLogz();
  
  isoNptS->Draw("colz");  
  isoNptS->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  isoNptS->GetYaxis()->SetTitle("Isolation PF:h0");


  c3->SaveAs("NeutralIso_95_HoEcut.png");

  c1->Update();
  c2->Update();
  c3->Update();

}
开发者ID:skyriacoCMS,项目名称:PhotonID,代码行数:101,代码来源:IsovsPt.C

示例8: plot

void plot(TString hname, TString legpos, TString pdfname, TString pdfmode="", Int_t rebinFactor=2)
{
	TGraphAsymmErrors* gJES = new TGraphAsymmErrors(); gJES->GetXaxis()->SetTitle(histos1[hname+"_calib"]->GetXaxis()->GetTitle()); gJES->GetYaxis()->SetTitle("Normalized"); gJES->SetTitle(histos1[hname+"_calib"]->GetTitle()); 
	TGraphAsymmErrors* gJER = new TGraphAsymmErrors(); gJER->GetXaxis()->SetTitle(histos1[hname+"_calib"]->GetXaxis()->GetTitle()); gJER->GetYaxis()->SetTitle("Normalized"); gJER->SetTitle(histos1[hname+"_calib"]->GetTitle()); 
	TGraphAsymmErrors* gTOT = new TGraphAsymmErrors(); gTOT->GetXaxis()->SetTitle(histos1[hname+"_calib"]->GetXaxis()->GetTitle()); gTOT->GetYaxis()->SetTitle("Normalized"); gTOT->SetTitle(histos1[hname+"_calib"]->GetTitle()); 

	Double_t entries_calib = 0;
	for(Int_t i=1 ; i<=histos1[hname+"_calib"]->GetNbinsX() ; i++) entries_calib+=histos1[hname+"_calib"]->GetBinContent(i);
	Double_t entries_uncalib = 0;
	for(Int_t i=1 ; i<=histos1[hname+"_uncalib"]->GetNbinsX() ; i++) entries_uncalib+=histos1[hname+"_uncalib"]->GetBinContent(i);

	histos1[hname+"_uncalib"]->Rebin(rebinFactor);
	histos1[hname+"_calib"]->Rebin(rebinFactor);
	histos1[hname+"_JESUP"]->Rebin(rebinFactor);
	histos1[hname+"_JESDWN"]->Rebin(rebinFactor);
	histos1[hname+"_JERUP"]->Rebin(rebinFactor);
	histos1[hname+"_JERDWN"]->Rebin(rebinFactor);

	for(Int_t i=1 ; i<=histos1[hname+"_calib"]->GetNbinsX() ; i++)
	{
		float x = histos1[hname+"_calib"]->GetBinCenter(i);
		float y = histos1[hname+"_calib"]->GetBinContent(i)/entries_calib;
		float dx = histos1[hname+"_calib"]->GetBinWidth(i)/2;

		gJES->SetPoint(i-1, x, y);
		gJER->SetPoint(i-1, x, y);
		gTOT->SetPoint(i-1, x, y);
		
		float dyJES1 = fabs(y-histos1[hname+"_JESUP"]->GetBinContent(i)/entries_calib);
		float dyJES2 = fabs(y-histos1[hname+"_JESDWN"]->GetBinContent(i)/entries_calib);
		float dyJES  = (dyJES1>dyJES2) ? dyJES1 : dyJES2;
		float yErrDwnJES = dyJES;
		float yErrUpJES  = dyJES;

		if((y-yErrDwnJES)<0.) yErrDwnJES = 0.;
		gJES->SetPointError(i-1, dx,dx, yErrDwnJES,yErrUpJES);
		
		float dyJER1 = fabs(y-histos1[hname+"_JERUP"]->GetBinContent(i)/entries_calib);
		float dyJER2 = fabs(y-histos1[hname+"_JERDWN"]->GetBinContent(i)/entries_calib);
		float dyJER  = (dyJER1>dyJER2) ? dyJER1 : dyJER2;
		float yErrDwnJER = dyJER;
		float yErrUpJER  = dyJER;

		if((y-yErrDwnJER)<0.) yErrDwnJER = 0.;
		gJER->SetPointError(i-1, dx,dx, yErrDwnJER,yErrUpJER);
		
		
		float yErrDwnTOT = sqrt(yErrDwnJES*yErrDwnJES + yErrDwnJER*yErrDwnJER);
		float yErrUpTOT  = sqrt(yErrUpJES*yErrUpJES + yErrUpJER*yErrUpJER);
		if((y-yErrDwnTOT)<0.) yErrDwnTOT = 0.;
		gTOT->SetPointError(i-1, dx,dx, yErrDwnTOT,yErrUpTOT);
	}
	
	gTOT->SetFillColor(kRed); gTOT->SetLineColor(kRed);
	gTOT->SetFillColor(kRed); gTOT->SetLineColor(kRed);
	
	gJER->SetFillColor(kYellow); gJER->SetLineColor(kYellow);
	gJER->SetFillColor(kYellow); gJER->SetLineColor(kYellow);

	gJES->SetFillColor(kGreen); gJES->SetLineColor(kGreen);
	gJES->SetFillColor(kGreen); gJES->SetLineColor(kGreen);
	
	TMultiGraph *mgBands = new TMultiGraph();
	mgBands->Add(gTOT);
	mgBands->Add(gJER);
	mgBands->Add(gJES);
	
	
	TLegend* legLeft = new TLegend(0.12,0.65,0.42,0.85,NULL,"brNDC");
	legLeft->SetFillStyle(4000); //will be transparent
	legLeft->SetFillColor(0);
	legLeft->SetTextFont(42);
	legLeft->SetBorderSize(0);
	legLeft->AddEntry(histos1[hname+"_calib"], "Calibrated jets","ple");
	legLeft->AddEntry(histos1[hname+"_uncalib"], "Non calibrated jets","ple");
	legLeft->AddEntry(gJES, "JES uncertainty","f");
	legLeft->AddEntry(gJER, "JER uncertainty","f");
	legLeft->AddEntry(gTOT, "Total uncertainty","f");
	
	
	TLegend* legRight = new TLegend(0.5,0.65,0.8,0.85,NULL,"brNDC");
	legRight->SetFillStyle(4000); //will be transparent
	legRight->SetFillColor(0);
	legRight->SetTextFont(42);
	legRight->SetBorderSize(0);
	legRight->AddEntry(histos1[hname+"_calib"], "Calibrated jets","ple");
	legRight->AddEntry(histos1[hname+"_uncalib"], "Non calibrated jets","ple");
	legRight->AddEntry(gJES, "JES uncertainty","f");
	legRight->AddEntry(gJER, "JER uncertainty","f");
	legRight->AddEntry(gTOT, "Total uncertainty","f");
	
	histos1[hname+"_calib"]->Scale(1./entries_calib);
	histos1[hname+"_uncalib"]->Scale(1./entries_uncalib);
	
	TCanvas* cnv = new TCanvas("c","c",600,400);
	cnv->Draw();
	cnv->SetTicks(1,1);
	cnv->cd();
	histos1[hname+"_calib"]->Draw("p");
	mgBands->Draw("a2");
//.........这里部分代码省略.........
开发者ID:noamhod,项目名称:Tau3mu.8TeV.NTUPanalysis,代码行数:101,代码来源:syst.C

示例9: plot


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

  for(unsigned int i = 0 ; i < nMassPoints; i++){

    TFile f(Form("higgsCombine%s%s.Asymptotic.mH%.0f.root",stream.Data(),channel.Data(),X[i]),"READ");
    if(f.IsZombie()){
      cout << "Cannot open file for " << string(channel.Data()) << " and mass " << X[i] << endl;
      continue;
    }

    Double_t r;
    TTree* limit = (TTree*)f.Get("limit");
    limit->SetBranchAddress("limit",&r);

    for(int k = 0 ; k< limit->GetEntries() ; k++){
      limit->GetEntry(k);
      if(k==0) expY2sL[i] = r;
      if(k==1) expY1sL[i] = r;
      if(k==2) expY[i]    = r;
      if(k==3) expY1sH[i] = r;
      if(k==4) expY2sH[i] = r;
      if(k==5) obsY[i]    = r;
    }

  }
 


  for(int i = 0 ; i < nMassPoints ; i++){
    expY1sH[i] = TMath::Abs(expY1sH[i]-expY[i]);
    expY1sL[i] = TMath::Abs(expY1sL[i]-expY[i]);
    expY2sH[i] = TMath::Abs(expY2sH[i]-expY[i]);
    expY2sL[i] = TMath::Abs(expY2sL[i]-expY[i]);

    cout << "Mass " << X[i] << " => " << expY2sL[i] << ", " << expY1sL[i] << ", " << expY1sH[i] << ", "
	 << expY2sH[i] << ", " << endl;
  }

  TMultiGraph *mg = new TMultiGraph();
  mg->SetTitle("");

  TGraphAsymmErrors* expected = new TGraphAsymmErrors(nMassPoints, X, expY, expX1sL ,expX1sL , expX1sL, expX1sL);
  TGraphAsymmErrors* oneSigma = new TGraphAsymmErrors(nMassPoints, X, expY, expX1sL, expX1sL,  expY1sL, expY1sH);
  TGraphAsymmErrors* twoSigma = new TGraphAsymmErrors(nMassPoints, X, expY, expX2sL, expX2sL,  expY2sL, expY2sH);
  TGraphAsymmErrors* observed = new TGraphAsymmErrors(nMassPoints, X, obsY, expX1sL ,expX1sL , expX1sL, expX1sL);

 
  oneSigma->SetMarkerColor(kBlack);
  oneSigma->SetMarkerStyle(kFullCircle);
  oneSigma->SetFillColor(kGreen);
  oneSigma->SetFillStyle(1001);

  twoSigma->SetMarkerColor(kBlack);
  twoSigma->SetMarkerStyle(kFullCircle);
  twoSigma->SetFillColor(kYellow);
  twoSigma->SetFillStyle(1001);

  expected->SetMarkerColor(kBlack);
  expected->SetMarkerStyle(kFullCircle);
  expected->SetMarkerSize(1.5);
  expected->SetLineColor(kBlack);
  expected->SetLineWidth(2);

  observed->SetMarkerColor(kBlue);
  observed->SetMarkerStyle(1);
  observed->SetLineColor(kBlue);
  observed->SetLineWidth(4);

  mg->Add(twoSigma);
  mg->Add(oneSigma);
  mg->Add(expected);
  mg->Add(observed);

  mg->Draw("ALP3");

  c1->cd();
  gPad->Modified();
  mg->GetXaxis()->SetLimits(110,145);
  mg->GetYaxis()->SetTitleOffset(0.97);
  mg->SetMinimum(0.);
  mg->SetMaximum(xMax_);
  mg->GetXaxis()->SetTitle("m_{H} (GeV)");
  mg->GetYaxis()->SetTitle("#sigma X BR(H#rightarrow#tau#tau)_{95% CLs}/#sigma_{SM}");

  leg->SetHeader(Form("#splitline{CMS Preliminary #sqrt{s}=7 TeV}{4.6 fb^{-1}, %s}",legend.Data()));

  leg->AddEntry(expected,"Expected","P");
  leg->AddEntry(observed,"Observed","L");

  leg->Draw();

  TF1 *line = new TF1("line","1",100,150);
  line->SetLineColor(kRed);
  line->SetLineWidth(2);

  line->Draw("SAME");

  gPad->SaveAs(Form("limit_%s_%s.png",stream.Data(), channel.Data()));
  gPad->SaveAs(Form("limit_%s_%s.pdf",stream.Data(), channel.Data()));

}
开发者ID:bianchini,项目名称:usercode,代码行数:101,代码来源:makePlot.C

示例10: parameters


//.........这里部分代码省略.........
//			"outParams_2_initParams_2_5_0_BAUR_mm_SM.txt_5_0_MG5_LO_mm_SM.txt"	,	"MG5 (LO)",
//			"outParams_2_initParams_2_5_0_BAUR_mm_SM.txt_5_0_MG5_NLO_mm_SM.txt"	,	"MG5 (NLO)"
	};


	int numOfFiles = (sizeof(list3) / sizeof(list3[0])) / 2;

	string list[2*numOfFiles];

	for (int i = 0; i < 2*numOfFiles; i++)
		list[i] = list3[i];

	cout << "Number of input files : " << (sizeof(list) / sizeof(list[0])) /2 << endl;

	int NPAR;

	map<int, vector<pair<double, double> > > parMap;

	for (int i = 0; i < (sizeof(list) / sizeof(list[0])) / 2; i++)
		{
		cout << "Working with file : " << list[2*i] << endl;
		params.push_back(readParams(list[2*i]));

		const int npar = params.back().size() / 2;
		NPAR = npar;

		double X[npar];
		double XE[npar];

		double axis[npar];
		double axisE[npar];

		for (int j = 0; j < npar; j++)
			{
			axis[j] = j;
			axisE[j] = 0;
			}

		for (int j = 0; j < npar; j++)
			{
//			X[j] = params.back().at(2*j) / params.back().at(0);
			X[j] = params.back().at(2*j);
//			cout << params.back().at(2*j) << " / " << params.back().at(0) << " = " << X[j] << endl;
//			XE[j] = params.back().at(2*j+1) / fabs(params.back().at(0));
			XE[j] = params.back().at(2*j+1);
//			cout << params.back().at(2*j+1) << " / " << params.back().at(0) << " = " << XE[j] << endl;

//			if (parMap.find(i) == parMap.end())
//				{
//				vector<pair<double, double> > parVec;
//				parVec.push_back(make_pair(X[j], XE[j]));
//				parMap[i] = parVec;
//				}
//			else parMap[i].push_back(make_pair(X[j]. XE[j]));
			parMap[i].push_back(make_pair(X[j], XE[j]));
			}

		TGraphErrors * gr = new TGraphErrors(npar, axis, X, axisE, XE);
		gr->SetLineColor(i+1);
		gr->SetMarkerStyle(4+i);
		gr->SetMarkerColor(i+1);

		leg->AddEntry(gr, (list[2*i+1]).c_str(), "lp");

		mg->Add(gr);
		}

	TCanvas * c1 = new TCanvas();

	tex->DrawLatex(0.18, 0.96, "CMS Preliminary, 2011");


//	tex->DrawLatex(0.18, 0.96, "CMS Preliminary, 2011, Electron Channel");
	tex->DrawLatex(0.18, 0.96, "CMS Preliminary, 2011, Muon Channel");
	tex->DrawLatex(0.8, 0.96, "#sqrt{s} = 7 TeV");


	mg->Draw("APE");

	for (int i = 0; i < NPAR; i++)
//		mg->GetXaxis()->SetBinLabel(6*(i+1), "#gamma_{T}");
		mg->GetXaxis()->SetBinLabel(5.4*(i+1), aplitudes[i].c_str());

//	mg->GetYaxis()->SetTitle("Parameter / T^{1}_{-1,-1,-1}");
	mg->GetYaxis()->SetTitle("Parameter Value");
	
	leg->Draw();

	c1->SaveAs("/afs/fnal.gov/files/home/room2/iraklich/public_html/ZGAMMA/MACROS/output/params.gif");

	if (numOfFiles == 2)
		for (int i = 0; i < NPAR; i++)
			{
			double diff = parMap[0].at(i).first - parMap[1].at(i).first;
			double sigma = parMap[0].at(i).second * parMap[0].at(i).second + parMap[1].at(i).second * parMap[1].at(i).second;
	
			cout << (diff*diff)/sigma << endl;
			}

	}
开发者ID:iraklic,项目名称:myZgamma,代码行数:101,代码来源:parameters.C

示例11: DrawData

void DrawData(char *  title, TGraphErrors * h1, TGraphErrors * h2, TGraphErrors * h3 = 0, TGraphErrors * h4 = 0, TGraphErrors * h5 = 0, TGraphErrors * h6 = 0) {  

  
   gPad->SetFillColor(fillCol);
   gPad->SetGrid();
   gPad->SetLogy();
   gPad->SetLogx();
   //gStyle->SetFillColor(30);

   TMultiGraph * mg = new TMultiGraph();

h1->SetLineColor(3);
h1->SetMarkerColor(3);
h1->SetMarkerStyle(20);
h1->SetLineWidth(2);
mg->Add(h1);

h2->SetLineColor(4);
h2->SetMarkerColor(4);
h2->SetMarkerStyle(21);
h2->SetLineWidth(2);
 mg->Add(h2);

 if (h3 != 0 ) { 
h3->SetLineColor(2);
h3->SetMarkerColor(2);
h3->SetMarkerStyle(22);
h3->SetLineWidth(2);
 mg->Add(h3);
 }
if (h4!= 0) { 
   h4->SetLineColor(5);
   h4->SetMarkerColor(5);
   h4->SetMarkerStyle(23);
   h4->SetLineWidth(2);
 mg->Add(h4);
 }
if (h5!= 0) { 
   h5->SetLineColor(6);
   h5->SetMarkerColor(6);
   h5->SetMarkerStyle(29);
   h5->SetLineWidth(2);
 mg->Add(h5);
 }
if (h6!= 0) { 
   h6->SetLineColor(7);
   h6->SetMarkerColor(7);
   h6->SetMarkerStyle(3);
   h6->SetLineWidth(2);
 mg->Add(h6);
 }


TGraphErrors * hd = h1; 
// hd->SetLineWidth(2);
//hd->GetXaxis()->SetLabelSize(0);
//hd->GetXaxis()->SetNdivisions(510);
    hd->GetYaxis()->SetTitleSize(0.05);
    hd->GetXaxis()->SetTitle("Matrix size ");
    hd->GetYaxis()->SetTitle("CPU Time ");
    hd->GetYaxis()->SetTitleOffset(0.7);
    hd->SetTitle("");
//    h1->SetMaximum(20);
//   h1->SetMinimum(0.0);

    gStyle->SetOptStat(0);

 
    mg->Draw("alp");

    // ned to do after drawing
    mg->GetXaxis()->SetLimits(1.8,32);
    mg->GetXaxis()->SetTitle("Matrix size ");
    mg->GetXaxis()->SetMoreLogLabels(1);
    mg->GetXaxis()->SetNoExponent(1);
    mg->GetYaxis()->SetTitle("CPU Time ");
    mg->GetYaxis()->SetTitleOffset(1.25);

    TLegend * tleg = new TLegend(0.78, 0.25, 0.97 ,0.45);
    tleg->AddEntry(h1, "SMatrix", "p");
    tleg->AddEntry(h2, "TMatrix", "p");
    if (h3 != 0) tleg->AddEntry(h3, "SMatrix_sym", "p");
    if (h4 != 0) tleg->AddEntry(h4, "TMatrix_sym", "p");
    if (h5 != 0) tleg->AddEntry(h5, "HepMatrix", "p");
    if (h6 != 0) tleg->AddEntry(h6, "HepMatrix_sym", "p");
    tleg->Draw();

    { 
       TPaveText *pt1 = new TPaveText(0.78,0.15,0.97,0.2,"brNDC");
       pt1->AddText(systemName.c_str());
       pt1->SetBorderSize(1);
       pt1->Draw();
       pt1->SetFillColor(0);
    }

    { 
       TPaveText *pt1 = new TPaveText(0.3,0.91,0.7,0.98,"brNDC");
       pt1->AddText(title);
       pt1->SetBorderSize(1);
       pt1->Draw();
//.........这里部分代码省略.........
开发者ID:My-Source,项目名称:root,代码行数:101,代码来源:matrixOperations.C

示例12: runBATCalculator


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

    modelconfig.SetPdf(*(myWS->pdf("model")));
    modelconfig.SetParametersOfInterest(*(myWS->set("poiSet")));
    modelconfig.SetPriorPdf(*(myWS->pdf("prior")));
    modelconfig.SetNuisanceParameters(*(myWS->set("nuisanceSet")));
    modelconfig.SetObservables(*(myWS->set("obsSet")));


    // use BATCalculator to the derive credibility intervals as a function of the observed number of
    // events in the hypothetical experiment

    // define vector with tested numbers of events
    TVectorD obsEvents;
    // define vectors which will be filled with the lower and upper limits for each tested number
    // of observed events
    TVectorD BATul;
    TVectorD BATll;

    // fix upper limit of tested observed number of events
    int obslimit = 10;

    obsEvents.ResizeTo(obslimit);
    BATul.ResizeTo(obslimit);
    BATll.ResizeTo(obslimit);


    cout << "starting the calculation of Bayesian credibility intervals with BATCalculator" << endl;
    // loop over observed number of events in the hypothetical experiment
    for (int obs = 1; obs <= obslimit; obs++) {

        obsEvents[obs - 1] = (static_cast<double>(obs));

        // prepare data input for the the observed number of events
        // adjust number of observed events in the workspace. This is communicated to ModelConfig!
        myWS->var("n")->setVal(obs);
        // create data
        RooDataSet data("data", "", *(modelconfig.GetObservables()));
        data.add( *(modelconfig.GetObservables()));

        // prepare BATCalulator
        BATCalculator batcalc(data, modelconfig);

        // give the BATCalculator a unique name (always a good idea in ROOT)
        TString namestring = "mybatc_";
        namestring += obs;
        batcalc.SetName(namestring);

        // fix amount of posterior probability in the calculated interval.
        // the name confidence level is incorrect here
        batcalc.SetConfidenceLevel(0.90);

        // fix length of the Markov chain. (in general: the longer the Markov chain the more
        // precise will be the results)
        batcalc.SetnMCMC(20000);

        // retrieve SimpleInterval object containing the information about the interval (this
        // triggers the actual calculations)
        SimpleInterval* interval = batcalc.GetInterval1D("sigma_s");

        std::cout << "BATCalculator: 90% credibility interval: [ " << interval->LowerLimit() << " - " << interval->UpperLimit() << " ] or 95% credibility upper limit\n";

        // add the interval borders for the current number of observed events to the vectors
        // containing the lower and upper limits
        BATll[obs - 1] = interval->LowerLimit();
        BATul[obs - 1] = interval->UpperLimit();

        // clean up for next loop element
        batcalc.CleanCalculatorForNewData();
        delete interval;
    }
    cout << "all limits calculated" << endl;

    // summarize the results in a plot

    TGraph* grBATll = new TGraph(obsEvents, BATll);
    grBATll->SetLineColor(kGreen);
    grBATll->SetLineWidth(200);
    grBATll->SetFillStyle(3001);
    grBATll->SetFillColor(kGreen);

    TGraph* grBATul = new TGraph(obsEvents, BATul);
    grBATul->SetLineColor(kGreen);
    grBATul->SetLineWidth(-200);
    grBATul->SetFillStyle(3001);
    grBATul->SetFillColor(kGreen);

    // create and draw multigraph
    TMultiGraph* mg = new TMultiGraph("BayesianLimitsBATCalculator", "BayesianLimitsBATCalculator");
    mg->SetTitle("example of Bayesian credibility intervals derived with BATCAlculator ");

    mg->Add(grBATll);
    mg->Add(grBATul);

    mg->Draw("AC");

    mg->GetXaxis()->SetTitle ("# observed events");
    mg->GetYaxis()->SetTitle("limits on signal S (size of test: 0.1)");

    mg->Draw("AC");
}
开发者ID:Kaoschuks,项目名称:bat,代码行数:101,代码来源:runBATCalculator.C

示例13: Pythia8_Dijet30_result_JER_akPu4PF_

void Pythia8_Dijet30_result_JER_akPu4PF_(abs(refeta)<2)&&(hiBin>60)_refpt()
{
//=========Macro generated from canvas: Can_result_3/
//=========  (Mon Apr 18 03:09:33 2016) by ROOT version6.02/13
   TCanvas *Can_result_3 = new TCanvas("Can_result_3", "",18,40,700,500);
   gStyle->SetOptFit(1);
   Can_result_3->Range(-2.301397,-0.01150186,237.5545,0.3828568);
   Can_result_3->SetFillColor(0);
   Can_result_3->SetBorderMode(0);
   Can_result_3->SetBorderSize(2);
   Can_result_3->SetFrameBorderMode(0);
   Can_result_3->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("name");
   multigraph->SetTitle("JER_akPu4PF");
   
   Double_t Graph_fx1007[11] = {
   45,
   55,
   65,
   75,
   85,
   95,
   105,
   115,
   130,
   150,
   180};
   Double_t Graph_fy1007[11] = {
   0.1976721,
   0.1639212,
   0.1562002,
   0.1480066,
   0.1479035,
   0.1333827,
   0.1160421,
   0.1205967,
   0.1105508,
   0.08141581,
   0.09210746};
   Double_t Graph_fex1007[11] = {
   5,
   5,
   5,
   5,
   5,
   5,
   5,
   5,
   10,
   10,
   20};
   Double_t Graph_fey1007[11] = {
   0.001003849,
   0.001317066,
   0.001658995,
   0.002251738,
   0.003095601,
   0.004152981,
   0.005688263,
   0.008277583,
   0.006320737,
   0.01258781,
   0.01599127};
   TGraphErrors *gre = new TGraphErrors(11,Graph_fx1007,Graph_fy1007,Graph_fex1007,Graph_fey1007);
   gre->SetName("Graph");
   gre->SetTitle("some title_0");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   
   TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","some title_0",100,24,216);
   Graph_Graph1007->SetMinimum(0.0558432);
   Graph_Graph1007->SetMaximum(0.2116608);
   Graph_Graph1007->SetDirectory(0);
   Graph_Graph1007->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   Graph_Graph1007->SetLineColor(ci);
   Graph_Graph1007->GetXaxis()->SetLabelFont(42);
   Graph_Graph1007->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1007);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1008[10] = {
   33.60148,
   40.66353,
//.........这里部分代码省略.........
开发者ID:Jelov,项目名称:JetEnergy_SR,代码行数:101,代码来源:Pythia8_Dijet30_result_JER_akPu4PF_(abs(refeta)<2)&&(hiBin>60)_refpt.C

示例14: Plot_1D_graphs


//.........这里部分代码省略.........
      
      int ival = base->TPDAC;
      //int ival = base->Delay;
    
      for(int v = 0; v < Nval; v++){
	if(ival == Value[v]){
	  Ntot[c][v] += 1.;
	  Y[c][v] += base->PDO;
	  Yerr[c][v] += base->PDO*base->PDO;
	}
      }
    }
  }

  for(int c = 0; c < Nch; c++){
    for(int v = 0; v < Nval; v++){
      double mean  = Y[c][v] / max(Ntot[c][v],1.);
      double mean2 = Yerr[c][v] / max(Ntot[c][v],1.);

      Y[c][v] = mean;
      Yerr[c][v] = sqrt(mean2-mean*mean);
    }
  }

  vector<TGraphErrors*> gr;
  TMultiGraph *mg = new TMultiGraph();

  for(int c = 0; c < Nch; c++){
    gr.push_back(new TGraphErrors(Nval,X,Y[c],Xerr,Yerr[c]));
    gr[c]->SetMarkerStyle(21);
    gr[c]->SetMarkerSize(1);
    gr[c]->SetMarkerColor(1393+2*c);
    gr[c]->SetLineColor(1393+2*c);
    gr[c]->SetLineWidth(3);
    gr[c]->SetFillColor(kWhite);
    mg->Add(gr[c]);
  }
  
  TCanvas* can = new TCanvas("can","can",600,500);
  can->SetLeftMargin(0.15);
  can->SetRightMargin(0.04);
  can->SetBottomMargin(0.15);
  can->SetTopMargin(0.085);
  
  can->Draw();
  can->SetGridx();
  can->SetGridy();
  
  can->cd();

  mg->Draw("AEP");
  
  mg->Draw();
  mg->GetXaxis()->CenterTitle();
  mg->GetXaxis()->SetTitleFont(132);
  mg->GetXaxis()->SetTitleSize(0.06);
  mg->GetXaxis()->SetTitleOffset(1.06);
  mg->GetXaxis()->SetLabelFont(132);
  mg->GetXaxis()->SetLabelSize(0.05);
  mg->GetXaxis()->SetTitle(varXname.c_str());
  mg->GetYaxis()->CenterTitle();
  mg->GetYaxis()->SetTitleFont(132);
  mg->GetYaxis()->SetTitleSize(0.06);
  mg->GetYaxis()->SetTitleOffset(1.);
  mg->GetYaxis()->SetLabelFont(132);
  mg->GetYaxis()->SetLabelSize(0.05);
  mg->GetYaxis()->SetTitle(varYname.c_str());

  TLegend* leg = new TLegend(0.688,0.22,0.93,0.42);
  leg->SetTextFont(132);
  leg->SetTextSize(0.045);
  leg->SetFillColor(kWhite);
  leg->SetLineColor(kWhite);
  leg->SetShadowColor(kWhite);
  for(int i = 0; i < Nch; i++){
    string llabel = "CH = "+to_string(CH[i]);
    leg->AddEntry(gr[i],llabel.c_str());
  }
  leg->SetLineColor(kWhite);
  leg->SetFillColor(kWhite);
  leg->SetShadowColor(kWhite);
  leg->Draw("SAME");
  
  TLatex l;
  l.SetTextFont(132);
  l.SetNDC();
  l.SetTextSize(0.05);
  l.SetTextFont(132);
  l.DrawLatex(0.27,0.94,"MMFE8 Analysis");
  l.SetTextSize(0.04);
  l.SetTextFont(42);
  l.DrawLatex(0.02,0.943,"#bf{#it{ATLAS}} Internal");

  string label = "VMM # = "+to_string(VMM);
  l.SetTextSize(0.05);
  l.SetTextFont(132);
  l.DrawLatex(0.64,0.94, label.c_str());

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

示例15: qcd


//.........这里部分代码省略.........
  errs.resize(8,0.14);
//   errs.push_back(0.14);
//   errs.push_back(0.24);
//   errs.push_back(0.35);
//   errs.push_back(0.50);
//   errs.push_back(0.80);

  std::vector<double> entries;
  entries.push_back(46272.);
  entries.push_back(43592.);
  entries.push_back(58746.);
  entries.push_back(78644.);
  entries.push_back(29516.);
  entries.push_back(11668.);
  entries.push_back(5416.);
  entries.push_back(5368.);

  std::vector<double> prescales;
  prescales.push_back(2000.);
  prescales.push_back(1000.);
  prescales.push_back(500.);
  prescales.push_back(125.);
  prescales.push_back(125.);
  prescales.push_back(125.);
  prescales.push_back(125.);
  prescales.push_back(125.);
  
  TCanvas* c = new TCanvas("tmp","tmp",900,600);
  
  TGraphAsymmErrors* gr1 = new TGraphAsymmErrors(8);
  gr1->SetName("Graph1");
  gr1->SetTitle("");
  gr1->SetFillColor(1);
  gr1->SetLineWidth(2);
  gr1->SetMarkerStyle(24);
  gr1->SetMarkerColor(1);
  gr1->SetMarkerSize(2.);

  TGraphAsymmErrors* gr2 = new TGraphAsymmErrors(8);
  gr2->SetName("Graph2");
  gr2->SetTitle("");
  gr2->SetFillColor(1);
  gr2->SetLineWidth(2);
  gr2->SetMarkerStyle(20);
  gr1->SetMarkerColor(1);
  gr2->SetMarkerSize(1.5);

  for ( int i = 0; i < bins.size(); ++i ) {
    double x = bins[i]+widths[i];
    double y = entries[i]*prescales[i];
    double ex = widths[i];
    double ey = sqrt(entries[i])*prescales[i];
    
    gr1->SetPoint(i+1,x,y);
    gr1->SetPointError(i+1,0.,0.,ey,ey);

    y = y / effs[i];
    ey = y * sqrt( (ey/y)*(ey/y) + (errs[i]/effs[i])*(errs[i]/effs[i]) );
    
    gr2->SetPoint(i+1,x,y);
    gr2->SetPointError(i+1,ex,ex,ey,ey);

    std::cout << " HT= " << bins[i] << " yield= " << y << " +/- " << ey << std::endl; 
 
  }
  
  TMultiGraph* mg = new TMultiGraph();
  mg->Add(gr1,"p");
  mg->Add(gr2,"p");
  mg->Draw("ap");
  mg->GetXaxis()->SetTitle("H_{T} (GeV)");
  mg->GetYaxis()->SetTitle("Bulk yields");
  mg->GetYaxis()->SetRangeUser(1.e5,1.e9);
  mg->GetXaxis()->SetRangeUser(275.,975.);

  TF1* fit = new TF1("fit","expo",275.,875.);
  gr2->Fit(fit,"R");
  fit->Draw("same");
  
  TLegend* leg = new TLegend( 0.45, 0.70, 0.85, 0.80 );
  leg->SetFillColor(0);
  leg->SetLineColor(0); 
  leg->SetShadowColor(0); 
  leg->SetTextSize(0.035);
  leg->AddEntry(gr1,"Raw counts weighted by prescales","p");
  leg->AddEntry(gr2,"Trigger efficiency corrected","p");
  leg->Draw("same");

  std::stringstream sss;
  sss << "CMS, 1.5 fb^{-1}, #sqrt{s} = 8 TeV";
  TLatex* tex = new TLatex(0.17,0.88,sss.str().c_str());
  tex->SetNDC();
  tex->SetTextSize(0.035);
  tex->Draw();

  c->SetLogy();

  return;
  
}
开发者ID:bainbrid,项目名称:susy_work,代码行数:101,代码来源:bulk_yields.C


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