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(); }
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(); }
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(); }
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(); }
void Pulse_shape_int_v3(){ // name of file using namespace std; int i=0; // used to name the TGraphs int bins = 500; double total_time = 1e-8; double bin_width = total_time/bins; double raw_data[bins+1][2]; // data from TCAD, current cleaned file double adapted_data[bins+1][2]; // data with leakage current subtracted, adapted array file double int_data[bins+1][2]; // integrated data i.e. the charge, CC file 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 *gr1[7]; // 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/work/m/mbucklan/TCAD/SimpleCMOS/DepletionSimRemesh_Particle_v10/Current_Cleaned_bias=%.0f_500.txt",bias); // does some magic, creates string with name of file TString str1 =TString::Format("%.0fV",bias); // creates string with bias value int a=0; // a by b array for raw_data int b=0; memset(raw_data, 0, sizeof(raw_data)); //set all array elements to 0 // read current data from file and store in array ifstream infile (str); if (infile.is_open()){ for (int c=0;c<=bins;c++){ infile >> raw_data[a][b] >> raw_data[a][b+1]; a++; b=0; } } int x=0; // x by y array for adapted_data int y=0; memset(adapted_data, 0, sizeof(adapted_data)); //set all array elements to 0 for (int e=0;e<=bins;e++){ adapted_data[x][0]= raw_data[x][0]; adapted_data[x][1]= raw_data[x][1] - raw_data[0][1]; x++; } TString str2 =TString::Format("/afs/cern.ch/work/m/mbucklan/TCAD_Analysis/SimpleCMOS_2d/1pixel/Adapted_array_Simple_Pixel_bias=%.0f_500.txt",bias); // does some magic, creates string with name of file // write adapted_data array to text file ofstream adapted_file (str2); if (adapted_file.is_open()) { for (int f = 0; f <= bins; f++) { for (int g = 0; g < 2; g++) { adapted_file << adapted_data[0+f][0+g] << " "; } 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(); }