Go to the source code of this file.
Functions | |
noise_vs_t () |
noise_vs_t | ( | ) |
Definition at line 3 of file noise_vs_t.C.
00004 { 00005 //.X show.C(1,2) 00006 //cout << chip_num << " " << ch_num << endl ; 00007 TString directory = "/gpfs/LAPP-DATA/LC/Detecteurs/MicroMegas/data/MICROROC/MR1/TEST_TEMPERATURE/RESULTS/"; 00008 00009 const Int_t NbOfPoints = 9 ; // x 00010 const Int_t NbOfChannels = 64 ; 00011 Int_t pied = 7 ; 00012 00013 Double_t n, a, b, c, d ; 00014 00015 /////////////////////////// 00016 // Plot noise vs t 00017 /////////////////////////// 00018 Double_t temperature[]={25.5, 36.7, 47.0, 55.8, 68.5, 78.0, 87.0, 94.5, 105.0}; 00019 Double_t data_noise[NbOfChannels][NbOfPoints] ; // first dim is for x / y 00020 Double_t data_inflex[NbOfChannels][NbOfPoints] ; // first dim is for x / y 00021 00022 Double_t mean_noise[NbOfPoints] ; 00023 Double_t mean_inflex[NbOfPoints] ; 00024 // Gather y data from files 00025 for (Int_t run=0;run<NbOfPoints;run++) // x axis 00026 { 00027 mean_noise [run] = 0 ; 00028 mean_inflex [run] = 0 ; 00029 TString name_file = directory + "run" + Form("%d", run+1) + "_pied" + Form("%d", pied) + ".txt" ; 00030 cout << name_file << endl ; 00031 ifstream fp ; 00032 fp.open(name_file.Data()) ; 00033 00034 if (!fp.good()) cout << "pb !"; 00035 for (Int_t ch=0;ch<NbOfChannels;ch++) 00036 { fp >> n >> a >> b >> c >> d ; 00037 //cout << n << " " << a << " " << b << " " << c << " " << d << endl ; 00038 if (!fp.good()) break; 00039 // fill data 00040 data_inflex [ch][run] = a ; // DAC units 00041 data_noise [ch][run] = c * 0.13 ; // DAC unit to fC http://lappwiki01.in2p3.fr/Linear_Collider_LAPP/index.php/MicrorocProd 00042 // fill mean 00043 mean_inflex [run] += data_inflex [ch][run] ; 00044 mean_noise [run] += data_noise [ch][run] ; 00045 } 00046 fp.close(); 00047 mean_inflex [run] /= NbOfChannels ; 00048 mean_noise [run] /= NbOfChannels ; 00049 } 00050 00051 // cout << "Temperature" ; 00052 // for (Int_t run=0;run<NbOfPoints;run++) // x axis 00053 // { cout << "\t" << temperature[run] ; 00054 // } 00055 // cout << endl << "Offset" << "\t" ; 00056 // for (Int_t run=0;run<NbOfPoints;run++) // x axis 00057 // { cout << "\t" << data_noise[1][run] ; 00058 // } 00059 // cout << endl ; 00060 00061 //---------------------------------------------------------------- 00062 // BUILD GRAPH FOR NOISE 00063 //---------------------------------------------------------------- 00064 TCanvas * c1 = new TCanvas("c1","MICROROC offset dac"); 00065 TMultiGraph * mg = new TMultiGraph("mg",""); 00066 TGraph * gr[NbOfChannels]; 00067 for(Int_t igraph=0;igraph<NbOfChannels;igraph++) 00068 { gr [igraph] = new TGraph(NbOfPoints, temperature, data_noise[igraph] ); // TGraph (n, x, y) 00069 gr [igraph]->SetLineColor(kBlue-10+igraph%8) ; 00070 cout << igraph%32 << " " ; 00071 gr [igraph]->SetLineWidth(1); 00072 gr [igraph]->SetMarkerColor(kBlue-10+igraph%8); 00073 gr [igraph]->SetMarkerStyle(8); 00074 gr [igraph]->SetMarkerSize(1); 00075 mg->Add(gr [igraph]); 00076 } 00077 // Add mean 00078 TGraph * mean = new TGraph(NbOfPoints, temperature, mean_noise) ; 00079 mean->SetLineColor(kRed) ; 00080 mean->SetLineWidth(5); 00081 mean->SetMarkerColor(kRed); 00082 mg->Add(mean); 00083 00084 // Add simulation 00085 Double_t sim_temp[] = {20., 40., 60., 80., 100.}; 00086 Double_t sim_noise[] ={0.196, 0.202, 0.208, 0.214, 0.221}; 00087 TGraph * sim = new TGraph(5, sim_temp, sim_noise) ; 00088 sim->SetLineColor(kGreen) ; 00089 sim->SetLineWidth(3); 00090 sim->SetMarkerColor(kGreen); 00091 mg->Add(sim); 00092 00093 mg->Draw("ALP"); 00094 mg->GetXaxis()->SetTitle("Temperature [#circC]"); 00095 mg->GetXaxis()->SetRangeUser(0.,110.); 00096 mg->GetYaxis()->SetTitle("Noise #sigma [fC]"); 00097 // mg->GetYaxis()->SetRangeUser(2.4,2.5); 00098 mg->GetYaxis()->SetTitleOffset(1.1); 00099 mg->Draw("ALP"); // to refresh 00100 // 00101 TLegend * leg = new TLegend(0.7,0.75,0.9,0.9) ; 00102 leg->AddEntry(gr [7],"All channels","lp"); //p: marker only -- l: line 00103 leg->AddEntry(mean,"Mean","lp"); 00104 leg->AddEntry(sim,"Simulation","lp"); 00105 leg->SetFillStyle(0); 00106 leg->Draw(); 00107 00108 00109 //---------------------------------------------------------------- 00110 // BUILD GRAPH FOR TEMPERATURE 00111 //---------------------------------------------------------------- 00112 TCanvas * c2 = new TCanvas("c2","MICROROC offset dac"); 00113 TMultiGraph * mg2 = new TMultiGraph("mg2",""); 00114 TGraph * gr[NbOfChannels]; 00115 for(Int_t igraph=0;igraph<NbOfChannels;igraph++) 00116 { gr [igraph] = new TGraph(NbOfPoints, temperature, data_inflex[igraph] ); // TGraph (n, x, y) 00117 gr [igraph]->SetLineColor(kBlue-10+igraph%8) ; 00118 cout << igraph%32 << " " ; 00119 gr [igraph]->SetLineWidth(1); 00120 gr [igraph]->SetMarkerColor(kBlue-10+igraph%8); 00121 gr [igraph]->SetMarkerStyle(8); 00122 gr [igraph]->SetMarkerSize(1); 00123 mg2->Add(gr [igraph]); 00124 } 00125 // Add mean 00126 TGraph * mean = new TGraph(NbOfPoints, temperature, mean_inflex) ; 00127 mean->SetLineColor(kRed) ; 00128 mean->SetLineWidth(5); 00129 mean->SetMarkerColor(kRed); 00130 mg2->Add(mean); 00131 00132 00133 mg2->Draw("ALP"); 00134 mg2->GetXaxis()->SetTitle("Temperature [#circC]"); 00135 mg2->GetXaxis()->SetRangeUser(0.,110.); 00136 mg2->GetYaxis()->SetTitle("Pedestal [DACu]"); 00137 mg2->GetYaxis()->SetRangeUser(200,217.5); 00138 mg2->GetYaxis()->SetTitleOffset(1.1); 00139 mg2->Draw("ALP"); // to refresh 00140 // 00141 TLegend * leg2 = new TLegend(0.7,0.8,0.9,0.9) ; 00142 leg2->AddEntry(gr [7],"All channels","lp"); //p: marker only -- l: line 00143 leg2->AddEntry(mean,"Mean","lp"); 00144 leg2->SetFillStyle(0); 00145 leg2->Draw(); 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 // 00167 // 00168 00169 // Double_t data[2][NbOfGraph][NbOfPoints] ; // first dim is for x / y 00170 00171 00172 // for(Int_t i=0;i<NbOfPoints;i++) 00173 // { data[0][0][i] = temperature_measured[i] ; // x 00174 // data[1][0][i] = voltage_measured[i] ; // y 00175 // data[0][1][i] = temperature_simulated[i] ; 00176 // data[1][1][i] = voltage_simulated[i] ; 00177 // cout << data[0][0][i] << " " ; 00178 // } 00179 // cout << endl ; 00180 // 00181 // 00182 00183 //// Pedestal: Scurve and derive 00184 // TFile * f_ped = new TFile(name_file_ped) ; 00185 // TString * h_ped_name_h = new TString() ; 00186 // h_ped_name_h->Form("hscurve_%d", ch_num) ; 00187 // TString * h_ped_name_d = new TString() ; 00188 // h_ped_name_d->Form("deriv_%d", ch_num) ; 00189 // TH1I * h_ped_h = (TH1I*) f_ped->Get(h_ped_name_h->Data()) ; 00190 // TH1I * h_ped_d = (TH1I*) f_ped->Get(h_ped_name_d->Data()) ; 00191 // h_ped_h->GetXaxis()->SetRangeUser(100,500); 00192 // h_ped_d->GetXaxis()->SetRangeUser(100,500); 00193 // 00194 // TCanvas * c1 = new TCanvas("c1","Pedestals",0, 0, 800, 300); 00195 // c1->Divide(2,1); 00196 // c1->cd(1); 00197 // h_ped_h->Draw(); 00198 // c1->cd(2); 00199 // h_ped_d->Draw(); 00200 // 00201 // // Data: Scurve and derive 00202 // TFile * f_dat = new TFile(name_file_data) ; 00203 // TString * h_dat_name_h = new TString() ; 00204 // h_dat_name_h->Form("hscurve_%d", ch_num) ; 00205 // TString * h_dat_name_d = new TString() ; 00206 // h_dat_name_d->Form("deriv_%d", ch_num) ; 00207 // TH1I * h_dat_h = (TH1I*) f_dat->Get(h_dat_name_h->Data()) ; 00208 // TH1I * h_dat_d = (TH1I*) f_dat->Get(h_dat_name_d->Data()) ; 00209 // h_dat_h->GetXaxis()->SetRangeUser(350,750); 00210 // h_dat_d->GetXaxis()->SetRangeUser(350,750); 00211 // 00212 // TCanvas * c2 = new TCanvas("c2","Data",0, 350, 800, 300); 00213 // c2->Divide(2,1); 00214 // c2->cd(1); 00215 // h_dat_h->Draw(); 00216 // c2->cd(2); 00217 // h_dat_d->Draw(); 00218 00219 return 0 ; 00220 00221 }