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


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

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


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

示例3: Overlap_1and3Pixel

void Overlap_1and3Pixel(){		// name of file

using namespace std;

int i=0;			// used to name the TGraphs
int j=0;

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[15];			// defines array to number of TGraphs

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

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

	TString str =TString::Format("/afs/cern.ch/user/m/mbucklan/TCAD_Analysis/SimpleCMOS_2d/1pixel/CC_Simple_Pixel_bias=%.0f_500.txt",bias);		// does some magic, creates string with name of file
	
	if (i==4){
	
	i++;
	
	}

	gr[i] = new TGraph(str,"%lE %lE");		// creates graph called gr and reads file
	
	TString str1 =TString::Format("1 pixel %.0fV",bias);		// 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
	gr[i]->SetLineWidth(1);

	mg->Add(gr[i]);				// adds graph to multigraph
	
	leg->AddEntry(gr[i],str1,"l");
	
	i++;
	
	
}

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

	TString str3 =TString::Format("/afs/cern.ch/user/m/mbucklan/TCAD_Analysis/SimpleCMOS_2d/3pixel/CC_3pixel_bias=%.1f_200.txt",bias);		// does some magic, creates string with name of file
	
	if (j==4){
	
	j++;
	
	}

	gr[i] = new TGraph(str3,"%lE %lE");		// creates graph called gr and reads file
	
	TString str4 =TString::Format("3 pixel %.0fV",bias);		// creates string with bias value
	gr[i]->SetTitle(str4);			// sets title to string
	gr[i]->SetLineColor(j+1);		// sets line colour, changes for each graph
	gr[i]->SetLineWidth(1);
	gr[i]->SetLineStyle(2);
	
	mg->Add(gr[i]);				// adds graph to multigraph
	
	leg->AddEntry(gr[i],str4,"l");
	
	i++;
	j++;
	
}

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("Collected Charge for 1 and 3 Pixel 100#mum Thick Sensor, Resistivity=100#Omegacm");
mg->SetMinimum(0);

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

leg->SetTextSize(0.03);
leg->SetBorderSize(0);		// no border
leg->Draw();


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

示例4: graphLE3

void graphLE3(Long64_t entry=0,int num=2,int spot=0){
  
  gROOT->ProcessLine(".L ~/analysis/scripts/LoadStyle.C");
  LoadStyle();

  LendaEvent * event = new LendaEvent();
  
  TTree* flt =(TTree*)gDirectory->Get("flt");
  
  flt->SetBranchAddress("Event",&event);

  flt->GetEntry(entry);

  cout<<event->Traces.size()<<endl;


  int size = (int) event->Traces[spot].size();

  Double_t* x = malloc(size*sizeof(Double_t));
  Double_t* y = malloc(size*sizeof(Double_t));

  Double_t* y1= malloc(size*sizeof(Double_t));
    

  Double_t* y2=malloc(size*sizeof(Double_t));
    

    cout<<"size is "<<size<<endl;
    for (int i=0;i<size;i++){

      x[i]=i*10;
      y[i]=event->Traces[spot][i] -380;
      y1[i]=event->Filters[spot][i];
      y2[i]=event->CFDs[spot][i];
    }
    cout<<"50 "<<event->CFDs[spot][50]<<endl;
    cout<<"50 "<<event->CFDs[spot][51]<<endl;
    cout<<"50 "<<event->CFDs[spot][52]<<endl;
    cout<<"50 "<<event->CFDs[spot][53]<<endl;



    TGraph *gr = new TGraph(size,x,y);
    TGraph *gr1 = new TGraph(size,x,y1);
    TGraph *gr2 = new TGraph(size,x,y2);

    TCanvas *c = new TCanvas();

    c->cd(1);

    gr->SetFillColor(kBlack);
    gr1->SetFillColor(0);
    gr2->SetFillColor(0);

    gr->SetLineColor(kBlack);
    gr1->SetLineColor(kBlue);
    gr2->SetLineColor(kRed);
    gr->SetLineWidth(3);
    gr2->SetLineWidth(3);
    gr1->SetLineWidth(3);

    gr->SetMarkerSize(.7);
    gr1->SetMarkerSize(.7);
    gr2->SetMarkerSize(.7);


    gr->SetMarkerStyle(8);
    gr1->SetMarkerStyle(8);
    gr2->SetMarkerStyle(8);
    TMultiGraph *mg = new TMultiGraph();

    leg = new TLegend(0.7,0.7,1,1);
    leg->SetLineWidth(0);
    leg->SetHeader("");
    leg->AddEntry(gr, "Trace","l");
    leg->AddEntry(gr1,"Fast Filter","l");
    leg->AddEntry(gr2,"CFD Filter","l");

    leg->SetTextSize(.05);
    leg->SetFillColor(kWhite);
    mg->Add(gr);
    mg->Add(gr1);
    mg->Add(gr2);

    mg->SetTitle("Pixie Digital Waveform");
    mg->Draw("a L P");
    mg->GetHistogram()->GetXaxis()->SetTitle("Time [ns]");
    mg->GetHistogram()->GetYaxis()->SetTitle("ADC Channel");
    mg->GetHistogram()->GetYaxis()->SetTitleOffset(1.3);

    leg->Draw();      
    
}
开发者ID:soam5515,项目名称:Scripts,代码行数:93,代码来源:graphLE3.C

示例5: Pulse_shape_int_v3


//.........这里部分代码省略.........
			
			}
			
			adapted_file << endl;	
		
 	 	}
	
	}
	
	int n=0;			// n by m array for int_data
	int m=0;
	
	
	memset(int_data, 0, sizeof(int_data));			//set all array elements to 0

	for (int h=1;h<=bins+1;h++){		// loop that finds area under curve at increasing time points using trap rule and stores to array
		
		double sum=0;
		
		for (int d=1;d<=h-1;d++){			// loop for last term in trap rule formula, sum of midpoints
		
			sum+=adapted_data[d][1];
			
		}
		
		int_data[n][m]= adapted_data[n][0];
		m++;
		int_data[n][m]= 0.5*bin_width*(adapted_data[0][1] + adapted_data[h][1] + 2*(sum));
		n++;
		m=0;
		
		
	}
	
	TString str3 =TString::Format("/afs/cern.ch/work/m/mbucklan/TCAD_Analysis/SimpleCMOS_2d/1pixel/CC_Simple_Pixel_bias=%.0f_500.txt",bias);		// does some magic, creates string with name of file
	
	// write data array to text file
	ofstream myfile (str3);
	if (myfile.is_open()) {

    		for (int k = 0; k <= bins; k++) {
	
			for (int l = 0; l < 2; l++) {
		
				myfile << int_data[0+k][0+l] << " ";
			
			}
			
			myfile << endl;	
		
 	 	}
	
	}
	
	
	if (i==4){
	
	i++;
	
	}
	
	gr1[i] = new TGraph(str3,"%lE %lE");		// creates graph and reads file
	
		
	gr1[i]->SetTitle(str1);			// sets title to string
	gr1[i]->SetLineColor(i+1);		// sets line colour, changes for each graph
		
	mg->Add(gr1[i]);			// adds graph to multigraph
	
	leg->AddEntry(gr1[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 graph

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

leg->SetTextSize(0.03);
//leg->SetBorderSize(0);		// no border
leg->Draw();


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


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