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


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

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


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

示例1: Pulse_shape_int_graph

void Pulse_shape_int_graph(){		// name of file

using namespace std;

double bias=0;
int i=0;

TCanvas *c1 = new TCanvas("c1","c1", 600, 400);
TPad *pad1 = new TPad("pad1","",0,0,1,1);

TGraph *gr1[5];			// defines array to number of TGraphs

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

for (double bias=2;bias<=10;bias+=2){		// loop to create of graph for select bias values

	TString str1 =TString::Format("%.1f V",bias);		// creates string with bias value
	TString str2 =TString::Format("/afs/cern.ch/user/m/mbucklan/TCAD_Analysis/SimpleCMOS_2d/1pixel/Test_CC_Simple_Pixel_bias=%.0f.txt",bias);		// does some magic, creates string with name of file
	
	gr1[i] = new TGraph(str2,"%lE %lE");		// creates graph called gr and reads file
		
	gr1[i]->SetTitle(str1);			// sets title to string
	gr1[i]->SetLineColor(i+1);		// sets line colour, changes for each graph
	//gr1[i]->SetLineWidth(1);
	//gr1[i]->SetMarkerSize(0.9);
	//gr1[i]->SetMarkerStyle(21);
		
	mg->Add(gr1[i]);				// adds graph to multigraph
	i+=1;
	
}

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("AC");		// draws graph

// Make the graph look fancy...ish
mg->GetXaxis()->SetTitle("Time (s)");
mg->GetYaxis()->SetTitle("Collected Charge (C)");
mg->GetHistogram()->SetTitle("Colled Charge for 1 Pixel 100#mum Thick Sensor, Resistivity=100#Omegacm");

//mg->GetXaxis()->SetLimits(1.0e-8,11.5e-8);

TLegend *leg = new TLegend(.80,.70,.85,.87);
leg->AddEntry(gr1[0],"2V","l");
leg->AddEntry(gr1[1],"4V","l");
leg->AddEntry(gr1[2],"6V","l");
leg->AddEntry(gr1[3],"8V","l");
leg->AddEntry(gr1[4],"10V","l");

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


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

示例2: plotter

void plotter(Int_t octant=1){

gROOT->Reset();
gROOT->SetStyle("Plain");

TString runNums[5] = {"14296","15736","16654","17635","18875"};

TCanvas *c1 = new TCanvas();

TGraphErrors *gPos = new TGraphErrors(Form("md%dpos.dat",octant),"%lg %lg %lg");
TGraphErrors *gNeg = new TGraphErrors(Form("md%dneg.dat",octant),"%lg %lg %lg");

gPos->SetMarkerColor(kBlue);
gNeg->SetMarkerColor(kRed);
gPos->SetLineColor(kBlue);
gNeg->SetLineColor(kRed);
gPos->SetFillStyle(0);
gNeg->SetFillStyle(0);
gPos->SetTitle(Form("MD%dPOS",octant));
gNeg->SetTitle(Form("MD%dNEG",octant));

TMultiGraph *gm = new TMultiGraph("gm",Form("1/Yield for MD%d",octant));
gm->Add(gPos);
gm->Add(gNeg);

gm->Draw("ap");

gm->GetYaxis()->SetTitle("1/Yield (uA/V)");
gm->GetXaxis()->SetTitle("Run Number");

gm->GetXaxis()->SetNdivisions(505,kTRUE);

for(Int_t i=0; i<5; i++){
	gm->GetXaxis()->SetBinLabel(gm->GetXaxis()->FindBin(150000+i*10000),runNums[i].Data());

}
gm->GetXaxis()->SetTitleOffset(1.4);

c1->BuildLegend();


}
开发者ID:sjmacewan,项目名称:Qweak,代码行数:42,代码来源:plotter.C

示例3: CreateSinglePlotFromTable

void CreateSinglePlotFromTable(TString filename,TString XTitle="", TString YTitle="", bool boolLog=true){
  //  TString filename_=filename;
  ifstream infile;
  infile.open(filename.Data());
  if (!infile.is_open())
    return;

  cout << "filename " << filename << endl;

  char line[1024];
  int count=0;
  while (infile.good()){
    infile.getline(line,1024);
    //cout << line << endl;
    char * pch = strtok (line," ");
    while (pch != NULL){
      if (count){
	values.push_back(atof(pch));
      }else{
	labels.push_back(pch);
      }
      pch = strtok (NULL, " ");
    }
    count++;
  }
  TCanvas *c1 = new TCanvas();
  const size_t m = labels.size();
  int n = values.size()/labels.size();
  TGraph* gr[m];
  TMultiGraph *mg = new TMultiGraph();
  TLegend *tleg = new TLegend(0.9,1.,1.,0.80);
  double* x = (double*) malloc(m*n*sizeof(double));
  for (size_t i=0;i<n;++i) {
    for (size_t j=1;j<m;++j) {
    if (!i){
      gr[j-1]= new TGraph(n);
      gr[j-1]->SetMarkerStyle(19+j);
      gr[j-1]->SetMarkerColor(j);
      mg->Add(gr[j-1],"p");
      tleg->AddEntry(gr[j-1],labels[j],"p");
    }
    gr[j-1]->SetPoint(i,*(&values[0]+i*m),*(&values[0]+i*m+j));
    //cout << *(&values[0]+i*m)<< " " << *(&values[0]+i*m+j) << endl;
   }
  }
  if (boolLog)
    c1->SetLogy();
  mg->Draw("a");
  mg->GetXaxis()->SetTitle(XTitle);
  mg->GetYaxis()->SetTitle(YTitle);
  tleg->Draw();
  gPad->Update();
  c1->Print(filename.ReplaceAll(".dat",".gif"));
};
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:54,代码来源:CreateSinglePlotFromTable.C

示例4: TMultiGraph

TMultiGraph *time_series( TGraph *g[], TString legend[], TString ptitle, TString ytitle, Int_t nsensor ) {
  TMultiGraph *mg = new TMultiGraph( "mg", "mg" );
  TLegend *leg = new TLegend(0.8680651,0.7870257,0.9982345,0.9987,NULL,"brNDC");
  
  Int_t icolor = 1;
  
  for ( Int_t i = 0; i < nsensor; i++ ) {
    g[i]->SetMarkerColor( icolor );
    g[i]->SetLineColor( icolor++ );
    leg->AddEntry( g[i], legend[i], "L" );
    mg->Add( g[i], "p" );
  }
  
  mg->Draw("a");
   
  // Make changes to axis after drawing, otherwise they don't exist
  mg->SetTitle( ptitle );
  mg->GetYaxis()->SetTitle( ytitle );

  mg->GetXaxis()->SetTimeDisplay(1);
  mg->GetXaxis()->SetNdivisions(-504); 
  mg->GetXaxis()->SetTitleOffset( 0.4 );
  mg->GetXaxis()->SetLabelOffset( 0.05 );
  mg->GetXaxis()->SetTimeFormat("#splitline{%m/%d/%y}{%H:%M:%S}");
  mg->GetXaxis()->SetTimeOffset(0); 
  leg->SetFillColor(0);
  leg->Draw();
  
  return mg;
}
开发者ID:haggerty,项目名称:radmon,代码行数:30,代码来源:radmonanb.C

示例5: Draw

void TDSPMultiEcho::Draw(Option_t *o, Double_t x0, Double_t x1, UInt_t num) {
  TString opt = o;
  opt.ToLower();

  Ssiz_t pos;

  if ((pos = opt.Index("multi"))!= kNPOS) {
    opt.Remove(pos,5);
    TMultiGraph *m = MultiGraph(NULL,x0,x1,num);
    m->Draw(o);
    m->GetXaxis()->SetTitle("#tau / #mu s");
    gPad->Update();
    return;
  }
  TGraph *a = Graph(NULL,x0,x1,num);
  a->Draw(o);
  a->GetXaxis()->SetTitle("#tau / #mu s");
  gPad->Update();
}
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:19,代码来源:TDSPMultiEcho.cpp

示例6: start

void start(const char *basename, const double offset = 0.0)
{

  TFile *file1 = TFile::Open(Form("Data/ROOT/%s_VMIN_SIPM1_meanHistSub_projections.root",basename));
  TFile *file2 = TFile::Open(Form("Data/ROOT/%s_VMIN_SIPM2_meanHistSub_projections.root",basename));

  if(file1==NULL) {cout<<"cannot find file1"<<endl;return;}
  if(file2==NULL) {cout<<"cannot find file2"<<endl;return;}

  calc(file1,file2,basename,0);
  calc(file1,file2,basename,1);
  calc(file1,file2,basename,2);
  calc(file1,file2,basename,3);
  calc(file1,file2,basename,4);
  calc(file1,file2,basename,5);
  calc(file1,file2,basename,6);
  calc(file1,file2,basename,7);
  calc(file1,file2,basename,8);

  ofstream fout(Form("Data/Text/%s_Asymmetries.txt"));
  double pn[9];
  for(int i=0; i<9; i++)
    {
      fout<<frac1[i]<<" "
	  <<frac2[i]<<" "
	  <<fracAv[i]<<" "
	  <<fracAs[i]<<" "
	  <<endl;
      //pn[i] = i+0.5; // projection number
      pn[i] = -2.0 + i/2.0; // distance
      pn[i] += offset;
    }

  TGraph *tg1 = new TGraph(9,pn,frac1);
  TGraph *tg2 = new TGraph(9,pn,frac2);
  TGraph *tgAv = new TGraph(9,pn,fracAv);
  TGraph *tgAs = new TGraph(9,pn,fracAs);
  tg1->SetMarkerStyle(kFullCircle);
  tg2->SetMarkerStyle(kFullCircle);
  tgAv->SetMarkerStyle(kOpenCircle);
  tgAs->SetMarkerStyle(kFullSquare);
  tg1->SetMarkerColor(kBlue);
  tg2->SetMarkerColor(kRed);
  tgAv->SetMarkerColor(kBlack);
  tgAs->SetMarkerColor(kBlack);
  TMultiGraph *tmg = new TMultiGraph();
  tmg->Add(tgAs);
  tmg->Add(tg1);
  tmg->Add(tg2);
  tmg->Add(tgAv);
  tmg->Draw("ap");
  tmg->SetMaximum(1.0);
  tmg->SetMinimum(0.0);
  tmg->GetXaxis()->SetLimits(-2.25+offset,2.25+offset);
  //tmg->GetXaxis()->SetLimits(0.0,9.0); // projection number
  tmg->GetXaxis()->SetTitle("Distance from fiber (cm)");
  tmg->GetYaxis()->SetTitle("f_{core} from different methods");
  TLegend *leg1 = new TLegend(0.18,0.18,0.28,0.38);
  leg1->AddEntry(tg1,"SiPM1","p");
  leg1->AddEntry(tg2,"SiPM2","p");
  leg1->AddEntry(tgAv,"Average SiPM1+SiPM2","p");
  leg1->AddEntry(tgAs,"Asymmetry","p");
  leg1->SetFillStyle(0);
  leg1->SetTextSize(0.05);
  leg1->Draw();

  c1->Print(Form("Figures/%s_AsymmetryComparison.png",basename));
  c1->Print(Form("Figures/%s_AsymmetryComparison.pdf",basename));

}
开发者ID:belmonrj,项目名称:TestStand,代码行数:70,代码来源:DrawAsymmetry.C

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

示例8: plotS11Baby

void plotS11Baby() {

   const int numFiles=8;
   char filename[180];
   int antFiles[numFiles][2]={{1,17},{1,18},{1,28},{1,27},{2,7},{2,8},{5,8},{5,9}};
   int whichOpen[numFiles]={1,1,2,2,5,5,6,6};
   int plotThis[numFiles]={1,1,1,1,2,2,2,2};
   char *graphDesc[numFiles]={"Office (1)","Office (2)","Outside (1)","Outside (2)","Salt Day I (1)","Salt Day I (2)","Salt Day III (1)","Salt Day III (2)"};
   TGraph *grOpen[NUM_OPENS]; 
   TGraph *grOpenPower[NUM_OPENS];
   for(int i=0;i<NUM_OPENS;i++) {
      grOpen[i]=getOpenWave(i); 
      //      grOpenPower[i]=FFTtools::makePowerSpectrumVoltsSecondsPadded(grOpen[i],8);
      grOpenPower[i]=FFTtools::makePSVSBartlettPaddedOverlap(grOpen[i],32,1024);
      Double_t *freq=grOpenPower[i]->GetX();
      //      cout << i << "\t" << grOpenPower[i]->GetN() << "\t" <<  freq[1]-freq[0] << "\n";
   }
   
   TGraph *grAnt[numFiles];
   TGraph *grAntPower[numFiles];
   TGraph *grAntRatio[numFiles];
   TGraph *grAntTrans[numFiles];
   for(int i=0;i<numFiles;i++) {
       sprintf(filename,"/home/rjn/saltStuff/hockley2009/disk_%d/TEK%05d.txt",antFiles[i][0],antFiles[i][1]);
       grAnt[i]=getWaveFromTxt(filename);
       grAnt[i]=cropLikeOpen(grAnt[i],whichOpen[i]);
       if(i<3) {
	 //	  grAntPower[i]=FFTtools::makePowerSpectrumVoltsSecondsPadded(grAnt[i],8);
	  grAntPower[i]=FFTtools::makePSVSBartlettPaddedOverlap(grAnt[i],32,1024);
       }
       else {
	  grAntPower[i]=FFTtools::makePSVSBartlettPaddedOverlap(grAnt[i],32,1024);
	  //	  TGraph *grTemp=FFTtools::makePowerSpectrumVoltsSecondsPadded(grAnt[i],8);
	  //	  grAntPower[i]=FFTtools::smoothFFT(grTemp,2);
       }
       grAntRatio[i]=FFTtools::dbGraphs(grAntPower[i],grOpenPower[whichOpen[i]]);
       grAntTrans[i]=FFTtools::ratioSubtractOneGraphs(grAntPower[i],grOpenPower[whichOpen[i]]);
       //       Double_t *freq=grAntPower[i]->GetX();
       //       cout << i << "\t" << freq[1]-freq[0] << "\n";
       //       cout << i << "\t" << grAntPower[i]->GetN() << "\t" <<  freq[1]-freq[0] << "\n";
       //       cout << grAntRatio[i] << "\t" << grAntTrans[i] << endl;
   }


  TCanvas *canWave = new TCanvas("canBabyWave","canBabyWave",800,800);
  canWave->Divide(1,numFiles);
  for(int i=0;i<numFiles;i++) {
     canWave->cd(i+1);
     grAnt[i]->SetLineColor(getNiceColour(i));     
     grAnt[i]->Draw("al");
     grAnt[i]->SetTitle(graphDesc[i]);
     grAnt[i]->GetXaxis()->SetTitle("Time (s)");
     grAnt[i]->GetYaxis()->SetTitle("Voltage (V)");

  }

  TCanvas *can = new TCanvas("canBaby","canBaby",900,600);
  can->Divide(1,2);
  for(int subPad=1;subPad<=2;subPad++) {
    can->cd(subPad);
    TMultiGraph *mg = new TMultiGraph();
    
    TLegend *leggy = new TLegend(0.2,0.2,0.4,0.5);
    leggy->SetBorderSize(0);
    leggy->SetFillColor(0);
    leggy->SetFillStyle(0);  
    for(int i=0;i<numFiles;i++) {
      if(plotThis[i]!=subPad) continue;
      grAntRatio[i]->SetLineColor(getNiceColour(i));
      grAntRatio[i]->SetLineWidth(2);
      mg->Add(grAntRatio[i],"l");
      leggy->AddEntry(grAntRatio[i],graphDesc[i],"l");
    }
    mg->Draw("al");
    mg->SetTitle("S11 Measurements Baby");
    mg->SetMaximum(0);
    mg->SetMinimum(-20);
    mg->GetXaxis()->SetRangeUser(0,1000);
    mg->GetXaxis()->SetTitle("Frequency (MHz)");
    mg->GetYaxis()->SetTitle("Reflected Power (dB)");
    leggy->Draw();
  }


  TCanvas *canTrans = new TCanvas("canTransBaby","canTransBaby",900,600);
  canTrans->Divide(1,2);
  for(int subPad=1;subPad<=2;subPad++) {
    canTrans->cd(subPad);
    TMultiGraph *mg = new TMultiGraph();
    TLegend *leggy2 = new TLegend(0.2,0.55,0.4,0.85);
    leggy2->SetBorderSize(0);
    leggy2->SetFillColor(0);
    leggy2->SetFillStyle(0);  
    for(int i=0;i<numFiles;i++) {
      if(plotThis[i]!=subPad) continue;
      grAntTrans[i]->SetLineColor(getNiceColour(i));
      grAntTrans[i]->SetLineWidth(2);
      mg->Add(grAntTrans[i],"l");
      leggy2->AddEntry(grAntTrans[i],graphDesc[i],"l");
    }
//.........这里部分代码省略.........
开发者ID:nichol77,项目名称:saltStuff,代码行数:101,代码来源:plotS11.C

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

示例10: draw_cross


//.........这里部分代码省略.........
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");
mg->Draw("AP");
开发者ID:liye1984,项目名称:compton-ifarm-Primex2,代码行数:67,代码来源:draw_cross.C

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

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

示例13: makePlots

void makePlots(vector<inputValues> b, vector<inputValues> t, vector<outputValues> o) {

    // Plot output values vs pulse width
    TMultiGraph * eLPlot   = new TMultiGraph();
    TMultiGraph * ePsiPlot = new TMultiGraph();
    TMultiGraph * vPsiPlot = new TMultiGraph();

    vector<TGraph*> eLPlots;
    vector<TGraph*> ePsiPlots;
    vector<TGraph*> vPsiPlots;

    for (int i = 0; i < b.size(); i++) {

        int pointNum = 0;

        eLPlots.push_back(new TGraph());
        ePsiPlots.push_back(new TGraph());
        vPsiPlots.push_back(new TGraph());
        eLPlots[i]->SetMarkerStyle(21);
        ePsiPlots[i]->SetMarkerStyle(21);
        vPsiPlots[i]->SetMarkerStyle(21);
        eLPlots[i]->SetMarkerColor(i+1);
        ePsiPlots[i]->SetMarkerColor(i+1);
        vPsiPlots[i]->SetMarkerColor(i+1);

        for (int j = 0; j < t.size(); j++) {
            if (t[j].cm == b[i].cm) {
                eLPlots[i]->SetPoint(pointNum, t[j].pw, o[j].eL);
                ePsiPlots[i]->SetPoint(pointNum, t[j].pw, o[j].ePsi);
                vPsiPlots[i]->SetPoint(pointNum, t[j].pw, o[j].vPsi);
                
                pointNum++;

                // Debugging
                //cout << pointNum << " " << t[j].pw << " " << o[j].eL << " " << o[j].ePsi <<  endl;
            }
	    }
        eLPlot->Add(eLPlots[i]);
        ePsiPlot->Add(ePsiPlots[i]);
        vPsiPlot->Add(vPsiPlots[i]);
    }

    eLPlot->SetTitle("Average Number of LED-induced Photoelectrons per Trigger");
    ePsiPlot->SetTitle("Single-photoelectron Response Mean in Few-PE Regime");
    vPsiPlot->SetTitle("Single-photoelectron Response Variance");


    TCanvas * eL_c = new TCanvas("eL_c", "eL Canvas", 200, 10, 700, 500);
    eLPlot->Draw("AP");
    eLPlot->GetXaxis()->SetTitle("LED Pulse Width / (ns)");
    eLPlot->GetYaxis()->SetTitle("Photoelectrons / Trigger");
    eL_leg = new TLegend(0.15, 0.67, 0.43, 0.85);
    eL_leg->SetHeader("   Integration Window: 156.25ns");
    eL_leg->AddEntry(eLPlots[0], "Normal Mode", "P");
    eL_leg->AddEntry(eLPlots[1], "Charge Mode", "P");
    eL_leg->Draw();
    gPad->Modified();


    TCanvas * ePsi_c = new TCanvas("ePsi_c", "ePsi Canvas", 200, 10, 700, 500);
    ePsiPlot->Draw("AP");
    ePsiPlot->GetXaxis()->SetTitle("LED Pulse Width / (ns)");
    ePsiPlot->GetYaxis()->SetTitle("pC");
    ePsiPlot->GetYaxis()->SetRangeUser(0.2, 1.4);
    ePsi_leg = new TLegend(0.6, 0.7, 0.88, 0.88);
    ePsi_leg->SetHeader("   Integration Window: 156.25ns");
    ePsi_leg->AddEntry(ePsiPlots[0], "Normal Mode", "P");
    ePsi_leg->AddEntry(ePsiPlots[1], "Charge Mode", "P");
    ePsi_leg->Draw();
    gPad->Modified();

    //TCanvas * vPsi_c = new TCanvas("vPsi_c", "vPsi Canvas", 200, 10, 700, 500);
    //vPsiPlot->Draw("AP");
    //vPsiPlot->GetXaxis()->SetTitle("LED Pulse Width / (ns)");
    //vPsiPlot->GetYaxis()->SetTitle("pC^2");
    //vPsiPlot->GetXaxis()->SetRangeUser(7.2, 8.4);
    //vPsi_leg = new TLegend(0.15, 0.65, 0.5, 0.85);
    //vPsi_leg->AddEntry(eLPlots[0], "PMT Voltage = 1250V", "P");
    //vPsi_leg->AddEntry(eLPlots[1], "PMT Voltage = 1300V", "P");
    //vPsi_leg->AddEntry(eLPlots[2], "PMT Voltage = 1350V", "P");
    //vPsi_leg->AddEntry(eLPlots[3], "PMT Voltage = 1400V", "P");
    //vPsi_leg->Draw();
    //gPad->Modified();

    // Plot spectra
    //TCanvas * spectra_c = new TCanvas("spectra_c", "Spectra Canvas", 200, 10, 700, 500);
    //spectra_c->SetLogy();
    //for (int i = t.size() - 1; i >= 0; i--) {
    //    //t[i].h->Sumw2();
    //    t[i].h->SetLineColor(i+1);
    //    t[i].h->Draw("SAME");
    //    t[i].h->SetStats(0);
    //    t[i].h->GetYaxis()->SetRangeUser(1.0, 500000.0);
    //    t[i].h->SetTitle("PMT Spectra of Pulsed LED w/ Varying Pulse Width");
    //    t[i].h->GetXaxis()->SetTitle("Integrated Charge / (pC)");
    //    t[i].h->GetYaxis()->SetTitle("Events");
    //}
    ////b[0].h->Sumw2();
    //b[0].h->Draw("SAME");
    //b[0].h->SetStats(0);
//.........这里部分代码省略.........
开发者ID:btcardwell,项目名称:milliqAnalysis,代码行数:101,代码来源:singlePeVaryMode.cpp

示例14: main


//.........这里部分代码省略.........
      errRatioX[i] = eX1;
      errRatioY[i] = ratio[i]*sqrt((eY1*eY1)/(ptY*ptY) + (eY2*eY2)/(ptY*ptY));
    }
    
    mgX->Add(graphs.at(grs));
    mgY->Add(graphs.at(grs+range));
    
    graphs.at(grs+2*range) = new TGraphErrors(graphs.at(grs)->GetN(), graphs.at(grs)->GetX(), ratio, errRatioX, errRatioY);
    graphs.at(grs+2*range)->SetLineColor(kBlue+3*(grs-3));
    graphs.at(grs+2*range)->SetMarkerColor(kBlue+3*(grs-3));
    graphs.at(grs+2*range)->SetMarkerStyle(20+grs);
    mgXY->Add(graphs.at(grs+2*range));
  }
    
  //Used to fit stuff, but it wasn't all that necessary
//   TF1 *p1 = new TF1("p1", "[0]*(x-[1])*(x-[2]) + [3]", -1*FIXMAX, FIXMAX);
//   TF1 *p2 = new TF1("p2", "[0]*(x-[1])*(x-[2]) + [3]", -1*FIXMAX, FIXMAX);
//   
//   p1->SetParameters(-1, 0, 0, 1);
//   p2->SetParameters(-1, 0, 0, 1);
//   
//   graphs.at(range-1)->Fit(p1, "RQME");
//   graphs.at(2*range-1)->Fit(p2, "RQME");
//   
//   float fitmax1 = p1->GetParameter(1);
//   float fitmax2 = p2->GetParameter(1);
//   
//   float fitDiff = fitmax1 - fitmax2;
//   
//   cout << "X Center: " << fitmax1 << " Y Center: " << fitmax2 << " Difference: " << fitDiff << endl;

  /////////////////////////  Drawing the X Graph  /////////////////////////
  c->cd(1);
  mgX->Draw("apl");
  mgX->GetXaxis()->SetTitle("Hodoscope X Position (mm)");
  mgX->GetYaxis()->SetTitle("m2/m1");
  mgX->GetYaxis()->SetTitleOffset(1.75);
  mgX->GetYaxis()->SetRangeUser(.9, 1.05);
  
  c->SetLeftMargin(0.15);
  
  TLegend* legX = new TLegend(0.1,0.1,0.5,0.3);
  legX->SetNColumns(2);
  TString entryName;
  for(int i = 0; i < range; i++){
    entryName.Form("Y in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
    legX->AddEntry(graphs.at(i),entryName.Data(),"lp");
  }
  legX->Draw();
  
  //p1->Draw("same");
  
  /////////////////////////  Drawing the Y Graph  /////////////////////////
  c->cd(2);
  mgY->Draw("apl");
  mgY->GetXaxis()->SetTitle("Hodoscope Y Position (mm)");
  mgY->GetYaxis()->SetTitle("m2/m1");
  mgY->GetYaxis()->SetTitleOffset(1.75);
  mgY->GetYaxis()->SetRangeUser(.9, 1.05);
  
  c->SetLeftMargin(0.15);
  
  TLegend* legY = new TLegend(0.1,0.1,0.5,0.3);
  legY->SetNColumns(2);
  for(int i = 0; i < range; i++){
    entryName.Form("X in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
    legY->AddEntry(graphs.at(i+range), entryName.Data(), "lp");
  }
  legY->Draw();
  
  //p2->Draw("same");
  
  /////////////////////////  Drawing the Ratio  /////////////////////////
  c->cd(3);
  mgXY->Draw("apl");
  mgXY->GetXaxis()->SetTitle("Hodoscope Position (mm)");
  mgXY->GetYaxis()->SetTitle("(my2/my1)/(mx2/mx1)");
  mgXY->GetYaxis()->SetTitleOffset(1.75);
  mgXY->GetYaxis()->SetRangeUser(.95, 1.05);
  
  c->SetLeftMargin(0.15);
  
  TLegend* legXY = new TLegend(0.1,0.1,0.5,0.3);
  legXY->SetNColumns(2);
  for(int i = 0; i < range; i++){
    entryName.Form("Range in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
    legXY->AddEntry(graphs.at(i+2*range),entryName.Data(),"lp");
  }
  legXY->Draw();
  
  /////////////////////////  Saving  /////////////////////////
  TString saveName;
  saveName.Form("Resolution Comparison %g_%g-%g_%g.png", FIXMAX, VARMIN, VARMAX, STEP);
  c->SaveAs(saveName.Data());
  
  saveName.Form("Resolution Comparison %g_%g-%g_%g.root", FIXMAX, VARMIN, VARMAX, STEP);
  c->SaveAs(saveName.Data());
  
  return 1;
}
开发者ID:H4VFE,项目名称:PlotTools,代码行数:101,代码来源:resCompare.cpp

示例15: drawFigure7

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// drawFigure7
//
//    parameter = "dg0"
//    parameter = "lam0"
//    parameter = "dk0"
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void drawFigure7(TString parameter = "dk0")
{
  gInterpreter->ExecuteMacro("WZPaperStyle.C");

  gSystem->mkdir("pdf", kTRUE);
  gSystem->mkdir("png", kTRUE);


  // Individual settings
  //----------------------------------------------------------------------------
  if (parameter.Contains("dg0"))
    {
      xtitle = "#Delta#kappa^{Z}";
      ytitle = "#lambda";
      xmin   = -0.5;
      xmax   =  0.5;
      ymin   = -0.039;
      ymax   =  0.053;
    }
  else if (parameter.Contains("lam0"))
    {
      xtitle = "#Delta#kappa^{Z}";
      ytitle = "#Deltag^{Z}_{1}";
      xmin   = -0.53;
      xmax   =  0.53;
      ymin   = -0.05;
      ymax   =  0.09;
    }
  else if (parameter.Contains("dk0"))
    {
      xtitle = "#Deltag^{Z}_{1}";
      ytitle = "#lambda";
      xmin   = -0.059;
      xmax   =  0.059;
      ymin   = -0.037;
      ymax   =  0.052;
    }


  // Read the input file
  //----------------------------------------------------------------------------
  TFile* file = new TFile("rootfiles/contours_" + parameter + "_2Dpol2.root", "read");

  TGraph* cont_exp_68 = (TGraph*)file->Get("cont_exp_68");
  TGraph* cont_exp_95 = (TGraph*)file->Get("cont_exp_95");
  TGraph* cont_exp_99 = (TGraph*)file->Get("cont_exp_99");
  TGraph* cont_obs_95 = (TGraph*)file->Get("cont_obs_95");
  TGraph* bestFit     = (TGraph*)file->Get("bestFit");

  bestFit->SetMarkerSize(1.5);
  bestFit->SetMarkerStyle(34);

  TGraph* g_large = new TGraph(2);

  g_large->SetPoint(0, -1.0, 1.0);
  g_large->SetPoint(1,  1.0, 1.0);


  // Draw
  //----------------------------------------------------------------------------
  TCanvas* canvas = new TCanvas("canvas", "canvas");

  TMultiGraph* mg = new TMultiGraph();

  mg->Add(cont_exp_68);
  mg->Add(cont_exp_95);
  mg->Add(cont_exp_99);
  mg->Add(cont_obs_95);
  mg->Add(bestFit, "p");
  mg->Add(g_large);

  mg->Draw("ac");

  mg->SetMinimum(ymin);
  mg->SetMaximum(ymax);


  // Axis labels
  //----------------------------------------------------------------------------
  TAxis* xaxis = mg->GetXaxis();
  TAxis* yaxis = mg->GetYaxis();
  
  xaxis->SetLabelFont  (    42);
  xaxis->SetLabelOffset(  0.01);
  xaxis->SetLabelSize  (  0.05);
  xaxis->SetNdivisions (   505);
  xaxis->SetTitle      (xtitle);
  xaxis->SetTitleFont  (    42);
  xaxis->SetTitleOffset(   1.2);
  xaxis->SetTitleSize  (  0.05);

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


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