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


C++ TCanvas::DrawFrame方法代码示例

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


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

示例1: Terminate

void TempVsTime::Terminate()
{
  // The Terminate() function is the last function to be called during
  // a query. It always runs on the client, it can be used to present
  // the results graphically or save the results to file.
  
  TCanvas *c;
  TH1F* frame;
  
  c = new TCanvas("c1", "c1", 700, 500);
  frame = c->DrawFrame(0, -0.2,
                       maxUTime, 0.8);
  frame->GetXaxis()->SetTitle("Time [s]");
  frame->GetYaxis()->SetTitle("Current [A]");

  grCurrent->Draw("L");
  
  c->Print("CurrentVsTime.png");

  c = new TCanvas("c2", "c2", 700, 500);
  frame = c->DrawFrame(0, -0.2,
                       maxUTime, 8.2);
  frame->GetXaxis()->SetTitle("Time [s]");
  frame->GetYaxis()->SetTitle("Voltage [V]");

  grVoltage->Draw("L");
  
  c->Print("VoltageVsTime.png");
  
  c = new TCanvas("c3", "c3", 700, 500);
  frame = c->DrawFrame(0, 0.0,
                       maxUTime, 30.0);
  frame->GetXaxis()->SetTitle("Time [s]");
  frame->GetYaxis()->SetTitle("Bath [deg C]");

  grBath->Draw("L");
  
  c->Print("BathVsTime.png");

  c = new TCanvas("c4", "c4", 700, 500);
  
  frame = c->DrawFrame(0, Tmin-0.2*(Tmax-Tmin),
                       maxUTime, Tmax+0.2*(Tmax-Tmin));
  frame->GetXaxis()->SetTitle("Time [s]");
  frame->GetYaxis()->SetTitle("Temperature [K]");
  
  grT[5]->Draw("L");
  grT[4]->Draw("L");
  grT[3]->Draw("L");
  grT[2]->Draw("L");
  grT[1]->Draw("L");

  grTtop->Draw("L");
  grTbottom->Draw("L");
  grTambient->Draw("L");
  
  c->Print("TempVsTime.png");
}
开发者ID:Negusbuk,项目名称:Analysis,代码行数:58,代码来源:TempVsTime.C

示例2: QAcentrality

void QAcentrality(const Char_t *fdata)
{
  style();

  TFile *fin = TFile::Open(fdata);
  TList *lin = (TList *)fin->Get("clist");
  lin->ls();
  TH1 *hin = (TH1 *)lin->FindObject("EvCentrDist");
  Float_t sum = 1.2 * hin->Integral(hin->FindBin(0.1), hin->FindBin(79.9));
  hin->Scale(1. / sum);
  SetHistoStyle(hin, 20, kRed+1);
  TCanvas *c = new TCanvas("cQAcentrality", "cQAcentrality", 800, 800);
  TH1 * hfr = c->DrawFrame(0., 0.005, 100., 0.015);
  hfr->SetTitle(";centrality percentile;events");
  hin->Draw("same");
  c->SaveAs(canvasPrefix+"centrality.pdf");

  TH2 *hinv0 = (TH2 *)lin->FindObject("V0");
  TCanvas *cv0 = new TCanvas("cQAcentralityV0", "cQAcentralityV0", 800, 800);
  cv0->SetLogx();
  cv0->SetLogz();
  //  TH1 * hfrv0 = cv0->DrawFrame(100., -0.5, 50000., 10.5);
  // DrawBinLabelsY(hfrv0, kTRUE);
  // hfrv0->SetTitle(";V0 signal;");
  //hinv0->Draw("same,col");
  hinv0->Draw("col");
  cv0->SaveAs(canvasPrefix+"centralityV0.pdf");
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:28,代码来源:QA.C

示例3: macro

void macro() {
    TF1 *function = new TF1("function", 
			    "[0]*pow(x,2) + pow(x,4)", 
			    -5, 5);
  
    TCanvas *c = new TCanvas("c", "c", 800, 600);
    c->SetGrid();
    TH1F *histo_dummy;
    TLatex mylatex;
    char buffer[200];

    double v = 2; // initial value for the x**2 parameter in function
    for (int i=0; i<20; i++) {
	histo_dummy = c->DrawFrame(-3, -1.2, 3, 0.8);
	histo_dummy->SetXTitle("x");
	histo_dummy->SetYTitle("f(x)");

	function->SetParameter(0, v);
	function->Draw("same");

	mylatex.SetNDC(1);
	mylatex.DrawLatex(0.15,0.17,"f(x) = v#timesx^{2} + x^{4}");
	sprintf(buffer, "v=%2.1f", v);
	mylatex.DrawLatex(0.15,0.11,buffer);

	c->SaveAs("result.gif+20");
	v-=0.2;
    }
    c->SaveAs("result.gif++");
}
开发者ID:stellasia,项目名称:ROOTmacros,代码行数:30,代码来源:macro.C

示例4: solveNumerically

void solveNumerically()
{
  
  Double_t n0=1.35;
  Double_t m=-1*(1.78-1.35)/140;
  Double_t z0=-100;
  Double_t dMax=n0+m*z0;


  TCanvas *can = new TCanvas("can","can",600,400);
  // TF1 *lefty = new TF1("lefty",strangeLeft,0,dMax,5);
  // lefty->SetParameters(n0,m,z0,40,-30);
  // lefty->SetLineColor(8);
  // lefty->SetLineStyle(1);
  // lefty->SetNpx(1000);
  // lefty->Draw("");

  // TF1 *righty = new TF1("righty",strangeRight,0,dMax,5);
  // righty->SetParameters(n0,m,z0,40,-30);
  // righty->SetLineColor(kViolet);
  // righty->SetLineStyle(1);
  // righty->SetNpx(1000);
  // righty->Draw("same");


  TH1F*framey = can->DrawFrame(0,-50,dMax*1.1,0);
  TF1 *endy = new TF1("endy",strangeZ,0.02,dMax,4);
  endy->SetParameters(n0,m,z0,200);
  endy->SetLineColor(kViolet);
  endy->SetLineStyle(1);
  endy->SetNpx(1000);
  endy->Draw("same");

}
开发者ID:nichol77,项目名称:monte,代码行数:34,代码来源:solveNumerically.C

示例5: QAvertex

void QAvertex(const Char_t *fdata, const Char_t *fmc)
{
  style();

  TFile *fdtin = TFile::Open(fdata);
  TList *ldtin = (TList *)fdtin->Get("clist");
  TH2 *hdtin = (TH2 *)ldtin->FindObject("zv");
  TH1 *hdt = (TH1 *)ldtin->FindObject("zvNoSel");
  SetHistoStyle(hdt, 20, kRed+1);
  hdt->Scale(1. / hdt->Integral());

  TH1 *hdt0010 = hdtin->ProjectionX("hdt0010", 1, 4);
  SetHistoStyle(hdt0010, 20, kRed+1);
  hdt0010->Scale(1. / hdt0010->Integral());

  TH1 *hdt7080 = hdtin->ProjectionX("hdt7080", 11, 11);
  SetHistoStyle(hdt7080, 25, kAzure-3);
  hdt7080->Scale(1. / hdt7080->Integral());
  
  TFile *fmcin = TFile::Open(fmc);
  TList *lmcin = (TList *)fmcin->Get("clist");
  TH1 *hmc = (TH1 *)lmcin->FindObject("zvNoSel");
  SetHistoStyle(hmc, 25, kAzure-3);
  hmc->Scale(1. / hmc->Integral());

  TCanvas *c = new TCanvas("cVertex", "cVertex", 800, 800);
  TH1 * hfr = c->DrawFrame(-20., 0., 20., 0.1);
  hfr->SetTitle(";#it{z}_{vtx};");
  hdt0010->Draw("same");
  hdt7080->Draw("same");
  TLegend *legend = new TLegend(0.20, 0.18+0.60, 0.50, 0.30+0.60);
  legend->SetFillColor(0);
  legend->SetBorderSize(0);
  legend->SetTextFont(42);
  legend->SetTextSize(0.04);
  legend->AddEntry(hdt0010, "0-10%", "p");
  legend->AddEntry(hdt7080, "70-80%", "p");
  legend->Draw("same");
  c->SaveAs(canvasPrefix+"vertex.pdf");
  
  TCanvas *c1 = new TCanvas("cVertexDataMC", "cVertexDataMC", 800, 800);
  hfr = c1->DrawFrame(-20., 0., 20., 0.1);
  hfr->SetTitle(";#it{z}_{vtx};");
  hdt->Draw("same");
  hmc->Draw("same");
  legend = new TLegend(0.20, 0.18+0.60, 0.50, 0.30+0.60);
  legend->SetFillColor(0);
  legend->SetBorderSize(0);
  legend->SetTextFont(42);
  legend->SetTextSize(0.04);
  legend->AddEntry(hdt, "data", "p");
  legend->AddEntry(hmc, "Monte Carlo", "p");
  legend->Draw("same");
  c1->SaveAs(canvasPrefix+"vertexDataMC.pdf");
  
  //return 0;  
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:57,代码来源:QA.C

示例6: QAoccupancy

void QAoccupancy(const Char_t *fdata, const Char_t *fmc)
{
  style();

  TFile *fdtin = TFile::Open(fdata);
  TList *ldtin = (TList *)fdtin->Get("clist");
  TH2 *hdtin = (TH2 *)ldtin->FindObject("NClustersSPD2");
  TProfile *pdtin = hdtin->ProfileY("pdtin_clusters");
  pdtin->SetMarkerStyle(20);
  pdtin->SetMarkerSize(2);
  pdtin->SetMarkerColor(kAzure-3);
  
  TFile *fmcin = TFile::Open(fmc);
  TList *lmcin = (TList *)fmcin->Get("clist");
  TH2 *hmcin = (TH2 *)lmcin->FindObject("NClustersSPD2");
  TProfile *pmcin = hmcin->ProfileY("pmcin_clusters");
  pmcin->SetMarkerStyle(25);
  pmcin->SetMarkerSize(2);
  pmcin->SetMarkerColor(kRed+1);

  TCanvas *c = new TCanvas("cOccupancy", "cOccupancy", 800, 800);
  c->SetLogy();
  TH1 * hfr = c->DrawFrame(-0.5, 2., 10.5, 500.);
  DrawBinLabelsX(hfr, kTRUE);
  hfr->SetTitle(";;#LT#it{N}_{clusters,SPD-1}#GT");
  pdtin->DrawCopy("same");
  pmcin->DrawCopy("same");
  TLegend *legend = new TLegend(0.20, 0.18, 0.50, 0.30);
  legend->SetFillColor(0);
  legend->SetBorderSize(0);
  legend->SetTextFont(42);
  legend->SetTextSize(0.04);
  legend->AddEntry(pdtin, "data", "pl");
  legend->AddEntry(pmcin, "Monte Carlo", "pl");
  legend->Draw("same");
  c->SaveAs(canvasPrefix+"occupancy.pdf");
  return;
  TCanvas *cr = new TCanvas("cOccupancyr", "cOccupancyr", 800, 800);
  // hfr = cr->DrawFrame(-0.5, 0.75, 10.5, 1.25);
  // DrawBinLabelsX(hfr, kTRUE);
  // hfr->SetTitle(";;#LT#it{N}_{clusters,SPD-1}#GT ratio");
  pdtin->SetLineColor(kAzure-3);
  pdtin->SetLineWidth(3);
  pdtin->Divide(pmcin);
  pdtin->Draw("same,histo"); 
  legend = new TLegend(0.505025, 0.760673, 0.805276, 0.930142);
  legend->SetFillColor(0);
  legend->SetBorderSize(0);
  legend->SetTextFont(42);
  legend->SetTextSize(0.04);
  legend->AddEntry(pdtin, "data / Monte Carlo", "l");
  legend->Draw("same");
  cr->SaveAs(canvasPrefix+"occupancyr.pdf");
  
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:55,代码来源:QA.C

示例7: setCanvasOptions

void setCanvasOptions(TCanvas& canvas)
{
  canvas.SetWindowSize(610,630);
  canvas.SetFillStyle(0);
  canvas.SetFillColor(0);
  canvas.SetGrid();
  canvas.SetBorderMode(0);
  canvas.SetFrameBorderMode(0);
  canvas.SetFrameBorderSize(1);
  canvas.SetFrameFillColor(0);
  canvas.SetFrameFillStyle(0);
  canvas.SetFrameLineColor(1);
  canvas.SetFrameLineStyle(1);
  canvas.SetFrameLineWidth(1);
  canvas.SetTopMargin(0.05);
  canvas.SetBottomMargin(0.13);
  canvas.SetLeftMargin(0.13);
  canvas.SetRightMargin(0.05);
  canvas.SetTickx(1);
  canvas.SetTicky(1);
  TH1F* frame = canvas.DrawFrame(0.0, 0.0, 5.0, 1.0);
  frame->GetXaxis()->SetTitle("#DeltaR_{tag-probe}");
  frame->GetYaxis()->SetTitle("Unit-normalized events per 0.1");
  frame->GetXaxis()->SetTitleColor(1);
  frame->GetYaxis()->SetTitleColor(1);
  frame->GetXaxis()->SetTitleFont(42);
  frame->GetYaxis()->SetTitleFont(42);
  frame->GetXaxis()->SetTitleSize(0.06);
  frame->GetYaxis()->SetTitleSize(0.06);
  frame->GetXaxis()->SetTitleOffset(0.9);
  frame->GetYaxis()->SetTitleOffset(1.05);
  frame->GetXaxis()->SetLabelColor(1);
  frame->GetYaxis()->SetLabelColor(1);
  frame->GetXaxis()->SetLabelFont(42);
  frame->GetYaxis()->SetLabelFont(42);
  frame->GetXaxis()->SetLabelSize(0.05);
  frame->GetXaxis()->SetLabelOffset(0.007);
  frame->GetYaxis()->SetLabelOffset(0.007);
  frame->GetXaxis()->SetAxisColor(1);
  frame->GetYaxis()->SetAxisColor(1);
  frame->GetXaxis()->SetDecimals(kTRUE);
  frame->GetYaxis()->SetDecimals(kTRUE);
  frame->GetXaxis()->SetTickLength(0.03);
  frame->GetYaxis()->SetTickLength(0.03);
  frame->GetXaxis()->SetNdivisions(510);
  frame->GetYaxis()->SetNdivisions(510);
}
开发者ID:rpyohay,项目名称:physics-tools,代码行数:47,代码来源:KinematicAnalysis.C

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

void plotThisOne() {
   gSystem->Load("libAskRay.so");


  TCanvas * can = new TCanvas("can","can");
  TH1F *framey = can->DrawFrame(-7e6,-7e6,+7e6,+7e6);

  TEllipse *elipsey = new TEllipse(0,0,6378.1e3,6378.1e3);
  elipsey->SetLineColor(8);
  elipsey->SetLineWidth(3);			
  elipsey->Draw();//Ellipse(0,0,6378.1e3,6378.1e3);

  Double_t gz[361],gx[361];
  Int_t count=0;
  for(Double_t theta=-180;theta<=180;theta+=1) {
     
     Double_t radius=AskGeom::getGeoidFromTheta(theta*TMath::DegToRad());
     gz[count]=radius*TMath::Cos(theta*TMath::DegToRad());
      gx[count]=radius*TMath::Sin(theta*TMath::DegToRad());      
      
      //      cout << theta << "\t" << radius << "\t" << gz[count] << "\t" << gx[count] << endl;
      count++;
      
  }
  TGraph *geoid = new TGraph(count,gx,gz);
  geoid->Draw("l");
  
  TLine *liney = new TLine();
  liney->SetLineColor(9);
  liney->SetLineWidth(1);
  liney->SetLineStyle(2);

  Double_t point1[3]={-294476, 489656,  6.33461e+06};
  Double_t point2[3]={-297716, 487929,  6.34309e+06};

  liney->DrawLine(point1[1],point1[2],point2[1],point2[2]);

}
开发者ID:nichol77,项目名称:monte,代码行数:38,代码来源:plotThisOne.C

示例10: playsmoothiter

void playsmoothiter(const Char_t *datatag, const Char_t *mctag, const Char_t *anatag, Int_t bin, Bool_t ismc = kFALSE)
{

  TCanvas *c = new TCanvas("cs", "cs");
  c->DrawFrame(0., 0.5, 100., 1.5);

  TH1 *href = UnfoldMe_TAG(datatag, mctag, anatag, bin, kTRUE, kFALSE, ismc, 1., 4);
  TH1 *hout = NULL;
  TH1 *heff_ev = new TH1F("heff_ev", "", 12, 0, 12);
  TH1 *heff_ch = new TH1F("heff_ch", "", 12, 0, 12);
  for (Int_t j = 2; j < 10; j+=2) {
  for (Int_t i = 5; i < 16; i+=2) {
    printf("%d %d\n", j, i);
    hout = UnfoldMe_TAG(datatag, mctag, anatag, bin, kTRUE, kFALSE, ismc, 0.1 * i, j);
    heff_ev->Fill(integr_eff);
    heff_ch->Fill(dndeta_eff);

    hout->Divide(href);
    c->cd();
    hout->Draw("same");
    c->Update();
  }}

}
开发者ID:ktf,项目名称:AliPhysics,代码行数:24,代码来源:playV0M.C

示例11: plotTGraphs

TCanvas* plotTGraphs(std::vector<TGraph*> theGraphs, bool autoFormat, TString titleString, bool logX, bool logY)
{
	gROOT->cd();

	TCanvas* theCanvas = new TCanvas(titleString, titleString, 1600, 1200);
	theCanvas->cd();
	theCanvas->SetLeftMargin(.13);
	theCanvas->SetRightMargin(.06);
	theCanvas->SetGrid(1, 1);
	gPad->SetTickx(1);
	gPad->SetTicky(1);
	gPad->SetLogx(logX);
	gPad->SetLogy(logY);

	//Create frame based on the min and max from all the histograms;
	double minX = minFromTGraphs(theGraphs, true, true);
	double minY = minFromTGraphs(theGraphs, true, false);
	double maxX = maxFromTGraphs(theGraphs, true, true);
	double maxY = maxFromTGraphs(theGraphs, true, false);
	double lengthX = maxX - minX;
	double lengthY = maxY - minY;
	double widen = 0.05;
	if(!logX)
	{
		minX -= widen * lengthX;
		maxX += widen * lengthX;
	}
	else
	{
		minX *= widen;
		maxX /= widen;
	}

	if(!logY)
	{
		minY -= widen * lengthY;
		maxY += widen * lengthY;
	}
	else
	{
		minY *= widen;
		maxY /= widen;
	}
	TH1F* theFrameHist = theCanvas->DrawFrame(minX, minY, maxX, maxY);
	theFrameHist->SetTitleOffset(1.5, "y");
	theFrameHist->SetTitleOffset(1.3, "X");
	theFrameHist->SetTitle(titleString);

	//If it doesn't have a title string use the first histogram
	if(TString(theFrameHist->GetXaxis()->GetTitle()) == "")
	{
		theFrameHist->SetXTitle(theGraphs[0]->GetXaxis()->GetTitle());
		theFrameHist->SetYTitle(theGraphs[0]->GetYaxis()->GetTitle());
	}

	theCanvas->Update();
	theCanvas->Modified();

	TLegend* theLegend = nullptr;

	if(theGraphs.size() > 1)
	{
		double legendSize = .05 * theGraphs.size();
		if(legendSize < .15) legendSize = .15;

//		theLegend = new TLegend(0.55, .8 - legendSize, 0.87, 0.8);  //Top Right
//		theLegend = new TLegend(0.2, .8 - legendSize, 0.47, 0.8);  //Top Left
		theLegend = new TLegend(0.55, .4 - legendSize, 0.87, 0.4); //Bottom Right
	}

	for (unsigned int i = 0; i < theGraphs.size(); i++)
	{
		if(autoFormat)
		{
			theGraphs[i]->SetLineColor(MR_GRAPH_COLOR_LIST[i % MR_GRAPH_NUMCOLORS]);
			theGraphs[i]->SetMarkerColor(MR_GRAPH_COLOR_LIST[i % MR_GRAPH_NUMCOLORS]);
			theGraphs[i]->SetMarkerStyle(MR_MARKER_STYLE_LIST[i % MR_MARKER_NUMSTYLES]);
		}
		theGraphs[i]->Draw("P E1 same");
		if(theLegend != nullptr)
		{
			TString legendString = theGraphs[i]->GetTitle();
			legendString.Resize(legendString.First(';'));
			theLegend->AddEntry(theGraphs[i], legendString, "P E1");
		}
	}

	if(theLegend != nullptr) theLegend->Draw("same");

	return theCanvas;
}
开发者ID:mjbales,项目名称:mattroot,代码行数:91,代码来源:MRGraphics.cpp

示例12: massPlot

void massPlot(double lumi=-1., double maxInstLumi=-1.) {

  setTDRStyle();
  //tdrGrid(false, tdrStyle);

  writeExtraText = true;
  //extraText  = "Preliminary Simulation"; 
  //lumi_8TeV = ""; 
  int iPeriod = 2; // 1=7TeV, 2=8TeV, 3=7+8TeV, 7=7+8+13TeV 
  //int iPos=0;
  int iPos=11;
  //int iPos=22;
	
  if (lumi<0)
    lumi=LUMI;
  if (maxInstLumi<0)
    maxInstLumi=MAXINSTLUMI;
  DifferentXSLimitPlots plots(lumi);

  //mchamp index 0 is used, corresponds to 0th mass point = 100 GeV
  plots.calculateCrossSections(0,0,0,39,9);
    
  // three points on counting expt curve
  //TGraph* g_obs_gluino = plots.getMassLimitGluino();
  TGraph* g_gluino = plots.getExpMassLimitGluino();

  //TGraph* g_obs_stop = plots.getMassLimitStop();
  TGraph* g_stop = plots.getExpMassLimitStop();

  TGraph* g_obs_mchamp = plots.getMassLimitMchamp();
  TGraph* g_mchamp = plots.getExpMassLimitMchamp();

  //TGraphAsymmErrors* g_expGluino_1sig = plots.getExpMassLimitGluino1Sig();  
  //TGraphAsymmErrors* g_expGluino_2sig = plots.getExpMassLimitGluino2Sig();  

  //TGraphAsymmErrors* g_expStop_1sig = plots.getExpMassLimitStop1Sig();  
  //TGraphAsymmErrors* g_expStop_2sig = plots.getExpMassLimitStop2Sig();  

  TGraphAsymmErrors* g_exp_1sig = plots.getExpMassLimitMchamp1Sig();  
  TGraphAsymmErrors* g_exp_2sig = plots.getExpMassLimitMchamp2Sig();  

  // one point from lifetime fit
  TGraph* g_tpg = plots.getMassLimitGluinoTP();
  TGraph* g_tps = plots.getMassLimitStopTP();
  
  // theory prediction
  TGraph* g_thGluino = plots.getGluinoTheory();
  TGraph* g_thStop = plots.getStopTheory();
  TGraph* g_thMchamp = plots.getMchampTheory();
  
  TCanvas* canvas = new TCanvas("canvas","",10,10,575,500);

  Double_t x[10], yMinus[10], x2[10], y[10], yPlus[10], z[10];
  cout<<"MCHAMP LIMITS ARE: "<<endl;
  for(Int_t i=0; i<g_mchamp->GetN(); i++){
    g_mchamp->GetPoint(i, x[i], y[i]);
    yPlus[i] = g_exp_1sig->GetErrorYhigh(i);
    yMinus[i] = g_exp_1sig->GetErrorYlow(i);
    g_obs_mchamp->GetPoint(i, x2[i], z[i]);
    cout<<" mass is: "<<x[i]<<", expected limit is: "<<y[i]<<", expected +1 sigma is: "<<yPlus[i]<<", expected -1 sigma is: "<<yMinus[i]<<", observed limit is: "<<z[i]<<endl;
  }

  //canvas->SetGrid();
  canvas->SetLogy();
  
  TH1 * h;
  //h = canvas->DrawFrame(100., 1e-5, 1500., 1e6); //2DSA gluios and stops
  h = canvas->DrawFrame(100., 1e-5, 1000., 1e3); //2DSA
  //h = canvas->DrawFrame(100., 1e-5, 1000., 1e4); //1DSA
  //h->SetTitle(";m [GeV];#sigma [pb]");
  h->SetTitle(";m_{mchamp} [GeV];#sigma(pp #rightarrow mchamp mchamp) [pb]");
  //h->SetTitle(";m_{mchamp} [GeV];#sigma(pp #rightarrow mch mch) #times BF(mch #rightarrow #mu#mu)  [pb]");
  //h->SetTitle("Beamgap Expt;m_{#tilde{g}} [GeV/c^{2}]; #sigma(pp #rightarrow #tilde{g}#tilde{g}) #times BR(#tilde{g} #rightarrow g#tilde{#chi}^{0}) [pb]");
  
  // not covered region
  TBox* nc = new TBox(100., .1, 150., 5e2);
  nc->SetFillStyle(3354);
  nc->SetFillColor(kRed-4);
  //nc->Draw();
  
  /*
  // details
  //TPaveText* blurb = new TPaveText(305., 1.e1, 550., 4.5e2);
  TPaveText* blurb = new TPaveText(0.25, 0.70, 0.50, 0.92, "NDC");
  blurb->AddText("CMS Preliminary 2012");
  
  std::stringstream label;
  label<<"#int L dt = 19.7 fb^{-1}";
  blurb->AddText(label.str().c_str());
  label.str("");
  double peakInstLumi=maxInstLumi;
  int exponent=30;
  while (peakInstLumi>10) {
    peakInstLumi/=10.;
    ++exponent;
  }
  //label<<"L^{max}_{inst} = "<<peakInstLumi<<" x 10^{"<<exponent<<"} cm^{-2}s^{-1}";
  //blurb->AddText(label.str().c_str());
  //label.str("");
  label << "#sqrt{s} = " << ENERGY << " TeV";
//.........这里部分代码省略.........
开发者ID:jalimena,项目名称:StoppedHSCPMuon,代码行数:101,代码来源:massPlot.C

示例13: plot_Asymptotic_ForCombination


//.........这里部分代码省略.........
  /// The TGraphs themselves.

  //cout<<"Working on TGraph"<<endl;
  TGraphAsymmErrors *grobslim_cls;
  if(obs){
    grobslim_cls = new TGraphAsymmErrors(nMassEff, mass, obs_lim_cls);
    grobslim_cls->SetName("LimitObservedCLs");
  }
  TGraphAsymmErrors *grmedian_cls = new TGraphAsymmErrors(nMassEff, mass, medianD);
  grmedian_cls->SetName("LimitExpectedCLs");
  TGraphAsymmErrors *gr68_cls = new TGraphAsymmErrors(nMassEff, mass, medianD, 0, 0, down68err, up68err);
  gr68_cls->SetName("Limit68CLs");
  TGraphAsymmErrors *gr95_cls = new TGraphAsymmErrors(nMassEff, mass, medianD, 0, 0, down95err, up95err);
  gr95_cls->SetName("Limit95CLs");

  // TGraphAsymmErrors *grthSM=new TGraphAsymmErrors(nMassEff1,mass1,xs,0,0,0,0);//xs_downerr,xs_uperr);
  TGraph *grthSM=new TGraph(nMassEff,mass,xs);//xs_downerr,xs_uperr);
  grthSM->SetName("SMXSection");


  // TGraphAsymmErrors *grthSM10=new TGraphAsymmErrors(nMassEff1,mass1,xs10,0,0,0,0);
  TGraph *grthSM10=new TGraph(nMassEff,mass,xs10);
  grthSM10->SetName("SMXSection_2nd");

  // double fr_left = 590.0, fr_down = 1E-5, fr_right = 2000.0, fr_up = 0.5; 
   double fr_left = 590.0, fr_down = 0.00001, fr_right = 2500.0, fr_up = 5;

  TCanvas *cMCMC = new TCanvas("c_lim_Asymptotic", "canvas with limits for Asymptotic CLs", 630, 600);
  cMCMC->cd();
  cMCMC->SetGridx(1);
  cMCMC->SetGridy(1);
  // draw a frame to define the range

  TH1F *hr = cMCMC->DrawFrame(fr_left, fr_down, fr_right, fr_up, "");
  TString VV = "ZH";
  
  hr->SetXTitle("M_{Zp} [GeV]");
  hr->SetYTitle("#sigma_{95%} [pb]"); // #rightarrow 2l2q
  hr->SetMinimum(0.0001);
  hr->SetMaximum(100.0);

  gr95_cls->SetFillColor(kYellow);
  gr95_cls->SetFillStyle(1001);//solid
  gr95_cls->SetLineStyle(kDashed);
  gr95_cls->SetLineWidth(3);
  gr95_cls->GetXaxis()->SetTitle("M_{V'} [GeV]");
  gr95_cls->GetYaxis()->SetTitle("#sigma_{95%} #times BR(V' #rightarrow " + VV + ") [pb]"); // #rightarrow 2l2q
  gr95_cls->GetXaxis()->SetRangeUser(fr_left, fr_right);

  gr95_cls->Draw("3");
  //  gr95_cls->SetMinimum(0.00001);
  //gr95_cls->SetMaximum(1000.0);
  
  //grmedian_cls->SetMinimum(0.00001);
  //grmedian_cls->SetMaximum(1000.0);
  
  gr68_cls->SetFillColor(kGreen);
  gr68_cls->SetFillStyle(1001);//solid
  gr68_cls->SetLineStyle(kDashed);
  gr68_cls->SetLineWidth(3);
  gr68_cls->Draw("3same");
  grmedian_cls->GetXaxis()->SetTitle("M_{V'} [GeV]");
  grmedian_cls->GetYaxis()->SetTitle("#sigma_{95%} #times BR(V' #rightarrow " + VV + ") [pb]"); // #rightarrow 2l2q
  grmedian_cls->SetMarkerStyle(24);//25=hollow squre
  grmedian_cls->SetMarkerColor(kBlack);
  grmedian_cls->SetLineStyle(2);
开发者ID:latinos,项目名称:PlotsConfigurations,代码行数:67,代码来源:plot_Asymptotic_ForCombination.C

示例14: CalibEI

//___________________________________________________________________________________
void CalibEI(const Int_t ii, const Int_t opt)
{
  // i - # of the MWPC
  // opt - option to plot
  
  
  TGraphErrors *grMean, *grSigma;
  TCanvas *cnv;
  TH1D *h1;
  TH2D *h2;
  TH3D *h3;
  TLine *lZ = new TLine(-300.,0.,300.,0.);
  lZ->SetLineColor(kBlue);
  lZ->SetLineWidth(2.);
  TLine *lPhi = new TLine(0.,0.,360.,0.);
  lPhi->SetLineColor(kBlue);
  lPhi->SetLineWidth(2.);
  
  //
  TString i;
  stringstream ss;
  ss << ii;
  ss >> i;
  
  //
  switch (opt)
  {
    case 1:
      // dPhiEI
      cnv = new TCanvas("cEI"+i);
      h1 = (TH1D*)gDirectory->Get("GeomCalib_DphiEI"+i);
      h1->Draw();
      h1->Fit("gaus","","",-.6,.6);
      //   hEI->Fit("gaus");
      break;
      
    case 2:
      // dPhiEI(Z)
      cnv = new TCanvas("cEIZ"+i);
      h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_ZInters"+i);
      h2->Draw("color");
      lZ->Draw("same");
      //
      SliceH2(h2,"y",20,-1.,1.,1.,grMean,grSigma);
      // Sigma
      cnv = new TCanvas("cEIZ_Sigma"+i);
      h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.);
      cnv->GetFrame()->SetFillColor(0);
      cnv->GetFrame()->SetBorderSize(0);
      h1->SetXTitle("z, mm");
      h1->SetYTitle("#sigma, degrees");
      h1->SetTitle("dPhiEI(Z)");
      grSigma->SetMarkerStyle(20);
      grSigma->Draw("P");
      // Mean
      cnv = new TCanvas("cEIZ_Mean"+i);
      h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.);
      cnv->GetFrame()->SetFillColor(0);
      cnv->GetFrame()->SetBorderSize(0);
      h1->SetXTitle("z, mm");
      h1->SetYTitle("Mean, degrees");
      h1->SetTitle("dPhiEI(Z)");
      grMean->SetMarkerStyle(20);
      grMean->Fit("pol1");
      grMean->Draw("P");
      break;
      
    case 3:
      // dPhiEI(Phi)
      cnv = new TCanvas("cEIPhi"+i);
      h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_PhiEI"+i);
      h2->Draw("color");
      lPhi->Draw("same");
      //
      SliceH2(h2,"y",20,-1.,1.,1.,grMean,grSigma);
      // Sigma
      cnv = new TCanvas("cEIPhi_Sigma"+i);
      h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,10.);
      cnv->GetFrame()->SetFillColor(0);
      cnv->GetFrame()->SetBorderSize(0);
      h1->SetXTitle("#varphi, degrees");
      h1->SetYTitle("#sigma, degrees");
      h1->SetTitle("dPhiEI(Phi)");
      grSigma->SetMarkerStyle(20);
      grSigma->Draw("P");
      // Mean
      cnv = new TCanvas("cEIPhi_Mean"+i);
      h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.);
      cnv->GetFrame()->SetFillColor(0);
      cnv->GetFrame()->SetBorderSize(0);
      h1->SetXTitle("#varphi, degrees");
      h1->SetYTitle("Mean, degrees");
      h1->SetTitle("dPhiEI(Phi)");
      grMean->SetMarkerStyle(20);
      grMean->Fit("pol1");
      grMean->Draw("P");
      break;
    
    case 23:
//.........这里部分代码省略.........
开发者ID:A2-Collaboration,项目名称:acqu,代码行数:101,代码来源:GeomCalibCentralApparatus.C

示例15: CalibMwpcNaI

//___________________________________________________________________________________
void CalibMwpcNaI(const Int_t ii, const Int_t opt, TH1D &*h1, TH2D &*h2, TGraphErrors &*grMean, TGraphErrors &*grSigma)
{
  // General style
//   gROOT->ProcessLine(".x Style_Default_2.C");
//   gROOT->SetStyle("Default_2");
//   gROOT->ForceStyle();
  
  //
  TGraphErrors *grMean, *grSigma;
  TCanvas *cnv;
  TH1D *h1;
  TH2D *h2;
  TLine *lZ = new TLine(-300.,0.,300.,0.);
  lZ->SetLineColor(kBlue);
  lZ->SetLineWidth(2.);
  TLine *lTheta = new TLine(0.,0.,180.,0.);
  lTheta->SetLineColor(kBlue);
  lTheta->SetLineWidth(2.);
  TLine *lPhi = new TLine(0.,0.,360.,0.);
  lPhi->SetLineColor(kBlue);
  lPhi->SetLineWidth(2.);
  
  //
  TString i;
  stringstream ss;
  ss << ii;
  ss >> i;
  
  //
  switch (opt)
  {
    case 1:
      // dPhi Mwpc-NaI
      cnv = new TCanvas("dPhi"+i);
      h1 = (TH1D*)gDirectory->Get("GeomCalib_DphiMwpc"+i+"NaI");
      h1->Draw();
      h1->Fit("gaus","","",-1.8,1.8);
      //   hDphi->Fit("gaus");
      // dPhi(Z)
      cnv = new TCanvas("dPhi_VS_Z"+i);
      h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiMwpc"+i+"NaI_v_Z0Mwpc"+i+"NaI");
      h2->Draw("color");
      lZ->Draw("same");
      //
      SliceH2(h2,"y",20,-10.,10.,TMath::Sqrt(2.),grMean,grSigma);
      // Sigma
      cnv = new TCanvas("dPhi_Sigma_vs_Z"+i);
      h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.);
      cnv->GetFrame()->SetFillColor(0);
      cnv->GetFrame()->SetBorderSize(0);
      h1->SetXTitle("z, mm");
      h1->SetYTitle("#sigma_{#Delta#varphi}, degrees");
      h1->SetTitle("dPhi(Z), MWPC-"+i);
      grSigma->SetMarkerStyle(20);
      grSigma->Draw("P");
      // Mean
      cnv = new TCanvas("dPhi_Mean_vs_Z"+i);
      h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.);
      cnv->GetFrame()->SetFillColor(0);
      cnv->GetFrame()->SetBorderSize(0);
      h1->SetXTitle("z, mm");
      h1->SetYTitle("Mean, degrees");
      h1->SetTitle("dPhi(Z), MWPC-"+i);
      grMean->SetMarkerStyle(20);
      grMean->Fit("pol1");
      grMean->Draw("P");
      break;
      
    case 2:
      // dX
      cnv = new TCanvas("dX"+i);
      h1 = (TH1D*)gDirectory->Get("GeomCalib_DxMwpc"+i+"NaI");
      h1->Draw();
      h1->Fit("gaus","","",-20.,20.);
      // dX(Z)
      cnv = new TCanvas("dX_VS_Z"+i);
      h2 = (TH2D*)gDirectory->Get("GeomCalib_DxMwpc"+i+"NaI_v_Z0Mwpc"+i+"NaI");
      h2->Draw("color");
      lZ->Draw("same");
      //
      SliceH2(h2,"y",20,-50.,50.,TMath::Sqrt(2.),grMean,grSigma);
      // Sigma
      cnv = new TCanvas("dX_Sigma_vs_Z"+i);
      h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.);
      cnv->GetFrame()->SetFillColor(0);
      cnv->GetFrame()->SetBorderSize(0);
      h1->SetXTitle("z, mm");
      h1->SetYTitle("#sigma_{#DeltaX}, mm");
      h1->SetTitle("dX(Z), MWPC-"+i);
      grSigma->SetMarkerStyle(20);
      grSigma->Draw("P");
      // Mean
      cnv = new TCanvas("dX_Mean_vs_Z"+i);
      h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.);
      cnv->GetFrame()->SetFillColor(0);
      cnv->GetFrame()->SetBorderSize(0);
      h1->SetXTitle("z, mm");
      h1->SetYTitle("Mean, mm");
      h1->SetTitle("dX(Z), MWPC-"+i);
//.........这里部分代码省略.........
开发者ID:A2-Collaboration,项目名称:acqu,代码行数:101,代码来源:GeomCalibCentralApparatus.C


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