00001
00002
00003
00004 analyze_prod(const Int_t prod)
00005 {
00006 gROOT->Reset();
00007
00008
00009 gStyle->SetFrameFillStyle(0);
00010 gStyle->SetPalette(1);
00011 gStyle->SetOptStat(111111);
00012 gStyle->SetFrameFillStyle(0);
00013 gStyle->SetOptStat("");
00014 gStyle->SetOptFit(0111);
00015 gStyle->SetStatX(0.9);
00016 gStyle->SetStatY(0.9);
00017 gStyle->SetStatH(0.1);
00018 gStyle->SetStatW(0.1);
00019
00020
00021
00022
00023 gStyle->SetOptStat("");
00024 gStyle->SetOptFit(10001);
00025
00026 const Int_t NbOfChannels = 64 ;
00027
00028 const TString directory = Form("/gpfs/LAPP-DATA/LC/Detecteurs/MicroMegas/data/MICROROC/PROD_%d/RESULTS/", prod);
00029 cout << directory << endl ;
00030 switch (prod)
00031 { case 1:
00032 Int_t start = 1 ;
00033
00034 Int_t stop = 30 ;
00035 break ;
00036 case 2:
00037 Int_t start = 342 ;
00038 Int_t stop = 1136 ;
00039 break ;
00040 default:
00041 cout << "This production run does not exist yet !" << endl ;
00042 exit(-1) ;
00043 }
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 Double_t n, gain ;
00055 Double_t pedestal_inflex, pedestal_inflex_err, pedestal_noise, pedestal_noise_err ;
00056 Double_t data_inflex, data_inflex_err, data_noise, data_noise_err ;
00057 TH1F * h_gain = new TH1F ("h_gain", "",100, 0.12, 0.16) ;
00058 h_gain->SetXTitle("");
00059 TH1F * h_ped = new TH1F ("h_ped", "", 1024, 0, 1024) ;
00060 h_ped->SetXTitle("[DACu]");
00061 TH1F * h_data = new TH1F ("h_data", "", 1024, 0, 1024) ;
00062 h_data->SetXTitle("[DACu]");
00063 ifstream file_gain, file_data, file_pedestal ;
00064 for (Int_t chip=start;chip<=stop;chip++)
00065 { const TString name_file_gain = directory + Form("chip_%d_gain_OK.txt", chip) ;
00066 file_gain.open(name_file_gain.Data()) ;
00067 if (!file_gain.good())
00068 { cout << "Chip " << chip << " has been rejected during test" << endl ;
00069
00070
00071
00072 }
00073 else
00074 { const TString name_file_pedestal = directory + Form("chip_%d_pedestal.txt", chip) ;
00075 file_pedestal.open(name_file_pedestal.Data()) ;
00076 const TString name_file_data = directory + Form("chip_%d_data.txt", chip) ;
00077 file_data.open(name_file_data.Data()) ;
00078 for (Int_t ch=0;ch<NbOfChannels;ch++)
00079 { file_gain >> gain ;
00080 if (!file_gain.good()) break;
00081 file_pedestal >> n >> pedestal_inflex >> pedestal_inflex_err >> pedestal_noise >> pedestal_noise_err ;
00082 file_data >> n >> data_inflex >> data_inflex_err >> data_noise >> data_noise_err ;
00083 h_gain->Fill(gain) ;
00084 h_ped->Fill(pedestal_inflex) ;
00085 h_data->Fill(data_inflex) ;
00086 }
00087 }
00088 file_gain.close();
00089 file_pedestal.close();
00090 file_data.close();
00091
00092
00093 }
00094
00095 TCanvas * c1 = new TCanvas("c1","MICROROC gain");
00096 h_gain->SetLineColor(kBlue+1);
00097 h_gain->Draw();
00098 h_gain->Fit("gaus","R", "SAME", 0.13 , 0.15);
00099 h_gain->GetFunction("gaus")->SetLineColor(kRed);
00100 h_gain->GetXaxis()->SetTitle("Gain [V/fC]");
00101
00102 TCanvas * c2 = new TCanvas("c2","MICROROC pedestal");
00103 c2->cd() ;
00104
00105 h_ped->Draw();
00106 h_ped->SetLineColor(kBlue+1);
00107 h_ped->Fit("gaus","R", "SAME", 160, 210);
00108 h_ped->GetFunction("gaus")->SetLineColor(kBlue+8);
00109
00110 h_data->Draw("SAMES");
00111 h_data->SetLineColor(kGreen+1);
00112 h_data->Fit("gaus","R", "SAME", 500, 580);
00113 h_data->GetFunction("gaus")->SetLineColor(kGreen+5);
00114
00115 c1->Update();
00116
00117 const TPaveStats *p1 = (TPaveStats*) h_ped->GetListOfFunctions()->FindObject("stats");
00118 h_ped->GetListOfFunctions()->Print();
00119
00120
00121 h_ped->SetStats(0);
00122 p1->SetTextColor(kBlue+8);
00123 p1->SetX1NDC(0.75);
00124 p1->SetY1NDC(0.8);
00125 p1->SetY2NDC(0.9);
00126 p1->Draw();
00127
00128
00129
00130
00131 const TPaveStats *p2 = (TPaveStats*) h_data->GetListOfFunctions()->FindObject("stats");
00132 p2->Print();
00133 h_data->GetListOfFunctions()->Remove(p2);
00134 h_data->SetStats(0);
00135 p2->SetTextColor(kGreen+5);
00136 p2->SetX1NDC(0.75);
00137 p2->SetX2NDC(0.9);
00138 p2->SetY1NDC(0.7);
00139 p2->SetY2NDC(0.8);
00140 p2->Draw();
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241 return 0 ;
00242
00243 }