Go to the source code of this file.
Functions | |
linearityoffset () |
linearityoffset | ( | ) |
Definition at line 3 of file linearityoffset.C.
00004 { 00005 //.X show.C(1,2) 00006 00007 TString directory = "/gpfs/LAPP-DATA/LC/Detecteurs/MicroMegas/data/MICROROC/MR1/TEST_DAC/RESULTS/"; 00008 00009 const Int_t NbOfRun = 16 ; // one run for each pedestal of channel 7 00010 // const Int_t NbOfPoints = 16 ; // pied: 0 to 15 00011 const Int_t NbOfChannels = 64 ; 00012 00013 Double_t n, a, b, c, d ; 00014 00015 /////////////////////////// 00016 // Plot noise vs t 00017 /////////////////////////// 00018 // Float_t temperature[]={25.5, 47.0, 68.5, 87.0, 105.0}; 00019 Double_t x[NbOfRun]; 00020 for (Int_t i=0;i<NbOfRun;i++) 00021 { 00022 x[i]=i ; 00023 } 00024 00025 Double_t data_inflex[NbOfChannels][NbOfRun] ; // first dim is for x / y 00026 00027 Double_t mean_inflex[NbOfRun] ; 00028 // Gather y data from files 00029 for (Int_t run=0;run<NbOfRun;run++) // x axis 00030 { //for (Int_t ped=0;ped<NbOfPoints;ped++) 00031 //{ 00032 mean_inflex [run] = 0 ; 00033 TString name_file = directory + "run" + Form("%d", 2*run+1) + "_pied" + Form("%d", ped) + ".txt" ; 00034 cout << name_file << endl ; 00035 ifstream fp ; 00036 fp.open(name_file.Data()) ; 00037 00038 if (!fp.good()) cout << "pb !"; 00039 for (Int_t ch=0;ch<NbOfChannels;ch++) 00040 { fp >> n >> a >> b >> c >> d ; 00041 //cout << n << " " << a << " " << b << " " << c << " " << d << endl ; 00042 if (!fp.good()) break; 00043 // fill data 00044 data_inflex [ch][run] = a ; // DAC units 00045 // fill mean for all channels 00046 mean_inflex [run] += data_inflex [ch][run] ; 00047 } 00048 fp.close(); 00049 mean_inflex [run] /= NbOfChannels ; 00050 //} 00051 } 00052 00053 // cout << "Temperature" ; 00054 // for (Int_t run=0;run<NbOfPoints;run++) // x axis 00055 // { cout << "\t" << temperature[run] ; 00056 // } 00057 // cout << endl << "Offset" << "\t" ; 00058 // for (Int_t run=0;run<NbOfPoints;run++) // x axis 00059 // { cout << "\t" << data_noise[1][run] ; 00060 // } 00061 // cout << endl ; 00062 00063 // exit(-1); 00064 00065 //---------------------------------------------------------------- 00066 // BUILD GRAPH 00067 //---------------------------------------------------------------- 00068 TCanvas * c1 = new TCanvas("c1","MICROROC offset dac"); 00069 TMultiGraph * mg = new TMultiGraph("mg",""); 00070 TGraph * gr[NbOfChannels]; 00071 for(Int_t igraph=0;igraph<NbOfRun;igraph++) // one graph per temperature 00072 { gr [igraph] = new TGraph(NbOfPoints, x, mean_inflex [igraph] ); // TGraph (n, x, y) 00073 gr [igraph]->SetLineColor(kBlue+igraph) ; 00074 gr [igraph]->SetLineWidth(1); 00075 gr [igraph]->SetMarkerColor(kBlue+igraph); 00076 gr [igraph]->SetMarkerStyle(8); 00077 gr [igraph]->SetMarkerSize(1); 00078 mg->Add(gr [igraph]); 00079 } 00080 00081 mg->Draw("ALP"); 00082 mg->GetXaxis()->SetTitle("Pedestal [DACu]"); 00083 mg->GetXaxis()->SetRangeUser(0.,110.); 00084 mg->GetYaxis()->SetTitle("Inflexion Point [DACu]"); 00085 // mg->GetYaxis()->SetRangeUser(2.4,2.5); 00086 mg->GetYaxis()->SetTitleOffset(1.1); 00087 mg->Draw("ALP"); // to refresh 00088 // Legend 00089 // TString temp_string = Form ("%f", x[1]) ; 00090 // temp_string 00091 TLegend * leg = new TLegend(0.1,0.75,0.25,0.9) ; 00092 for(Int_t igraph=0;igraph<NbOfRun;igraph++) // one graph per temperature 00093 { 00094 TString temp_string = Form ("%5.1f #circC", temperature[igraph]) ; 00095 leg->AddEntry(gr [igraph], temp_string, "lp"); 00096 } 00097 leg->SetFillStyle(1); 00098 leg->SetFillColor(0); 00099 leg->Draw(); 00100 00101 return 0 ; 00102 00103 }