10 gStyle->SetPalette(1,0);
11 gStyle->SetOptStat(kFALSE);
12 gStyle->SetOptStat(11111111);
13 gStyle->SetPadRightMargin(0.15);
14 gStyle->SetPadLeftMargin(0.15);
15 gStyle->SetPadBottomMargin(0.15);
20 Double_t
const rms0=1;
21 Double_t
const offset_down=23+10;
22 Double_t
const offset_up=-23+10;
27 TH1F *
sigma =
new TH1F (
"sigma",
"Sigma",100,0,5);
37 TString
outfile =
"dat/"+filename+
".dat";
38 cout <<
"Opening text output file: " << outfile.Data() << endl;
39 TString outfile2 =
"dat/"+filename+
".dat2";
40 cout <<
"Opening constant output file: " << outfile.Data() << endl;
43 filedat.open (outfile.Data(), ios::out);
45 filedat2.open (outfile2.Data(), ios::out);
47 TFile *in =
new TFile(filename+
".root",
"read");
49 TDirectory *
dir = (TDirectory*)gDirectory->FindObjectAny(
"BCAL_LED_time");
54 cout <<
"*** Cannot find directory" << endl;
57 TH1F *low_bias_down_time_vchannel = (TH1F*)gDirectory->FindObjectAny(
"low_bias_down_time_vchannel");
58 TH1F *low_bias_up_time_vchannel = (TH1F*)gDirectory->FindObjectAny(
"low_bias_up_time_vchannel");
59 TH1F *high_bias_down_time_vchannel = (TH1F*)gDirectory->FindObjectAny(
"high_bias_down_time_vchannel");
60 TH1F *high_bias_up_time_vchannel = (TH1F*)gDirectory->FindObjectAny(
"high_bias_up_time_vchannel");
64 Int_t ndim = low_bias_down_time_vchannel->GetNbinsX();
65 Double_t xlo = low_bias_down_time_vchannel->GetBinLowEdge(1);
66 Double_t width = low_bias_down_time_vchannel->GetBinWidth(1);
67 printf (
"\nhist_read: ndim=%d, xlo=%f, width=%f\n\n",ndim,xlo,width);
69 for(Int_t j=0;j<ndim;j++) {
71 Int_t chid = low_bias_down_time_vchannel->GetBinCenter(j+1);
75 Int_t module = chid/16 + 1;
76 Int_t
layer = (chid - (module-1)*16)/4 + 1;
77 Int_t sector = (chid - (module-1)*16 - (layer-1)*4) +1;
79 Double_t tdiff_low_down = low_bias_down_time_vchannel->GetBinContent(j+1);
80 Double_t tdiff_low_up = low_bias_up_time_vchannel->GetBinContent(j+1);
81 Double_t tdiff_high_down = high_bias_down_time_vchannel->GetBinContent(j+1);
82 Double_t tdiff_high_up = high_bias_up_time_vchannel->GetBinContent(j+1);
86 tdiff_low_down = tdiff_low_down != 0? tdiff_low_down + offset_down : 0;
87 tdiff_low_up = tdiff_low_up != 0? tdiff_low_up + offset_up : 0;
88 tdiff_high_down = tdiff_high_down != 0? tdiff_high_down + offset_down : 0;
89 tdiff_high_up = tdiff_high_up != 0? tdiff_high_up + offset_up : 0;
93 Double_t
sum = tdiff_low_down + tdiff_low_up + tdiff_high_down + tdiff_high_up;
94 Double_t sum2 = tdiff_low_down*tdiff_low_down + tdiff_low_up*tdiff_low_up + tdiff_high_down*tdiff_high_down + tdiff_high_up*tdiff_high_up;
96 sum1 = abs(tdiff_low_down)>0? sum1+1 : sum1;
97 sum1 = abs(tdiff_low_up)>0? sum1+1 : sum1;
98 sum1 = abs(tdiff_high_down)>0? sum1+1 : sum1;
99 sum1 = abs(tdiff_high_up)>0? sum1+1 : sum1;
100 Double_t rms = sum1 > 0?
sqrt(sum2/sum1 - sum*sum/sum1/sum1): 0;
103 sprintf (
string,
"chid low_down low_up high_down high_up rms %4d %4d %4d %4d %10.2f %10.2f %10.2f %10.2f %10.4f",chid,module,layer,sector,tdiff_low_down,tdiff_low_up,tdiff_high_down,tdiff_high_up,rms);
104 if (rms > rms0 | rms ==0) {
106 printf (
"%s ***\n",
string);
107 if (rms > rms0) fail1++;
108 if (rms == 0) fail0++;
109 filedat <<
string <<
" ***" << endl;
112 filedat <<
string << endl;
115 Double_t average = sum1 > 0? sum/sum1 : 0;
116 filedat2 << chid*2 <<
"\t" << 0 << endl;
117 filedat2 << chid*2 + 1 <<
"\t" << average << endl;
121 cout <<
"*** Fails: N(rms==0):" << fail0 <<
", N(rms > rms0):" << fail1 << endl;
122 filedat <<
"*** Fails: N(rms==0):" << fail0 <<
", N(rms > rms0):" << fail1 << endl;
125 TCanvas *
c0 =
new TCanvas(
"c0",
"c0 hist_read",200,10,1200,700);
130 low_bias_down_time_vchannel->SetTitle(title);
133 low_bias_down_time_vchannel->GetXaxis()->SetTitleSize(0.05);
134 low_bias_down_time_vchannel->GetYaxis()->SetTitleSize(0.05);
135 low_bias_down_time_vchannel->GetXaxis()->SetTitle(
"Low Down - chid");
136 low_bias_down_time_vchannel->GetYaxis()->SetTitle(
"Time Difference (Down-Up) (ns)");
137 low_bias_down_time_vchannel->SetMarkerColor(2);
138 low_bias_down_time_vchannel->SetMarkerStyle(20);
139 low_bias_down_time_vchannel->SetMarkerSize(0.5);
140 low_bias_down_time_vchannel->Draw(
"");
151 low_bias_up_time_vchannel->SetTitle(
"");
154 low_bias_up_time_vchannel->GetXaxis()->SetTitleSize(0.05);
155 low_bias_up_time_vchannel->GetYaxis()->SetTitleSize(0.05);
156 low_bias_up_time_vchannel->GetXaxis()->SetTitle(
"Low Up - chid");
157 low_bias_up_time_vchannel->GetYaxis()->SetTitle(
"Time Difference (Down-Up) (ns)");
158 low_bias_up_time_vchannel->SetMarkerColor(2);
159 low_bias_up_time_vchannel->SetMarkerStyle(20);
160 low_bias_up_time_vchannel->SetMarkerSize(0.5);
161 low_bias_up_time_vchannel->Draw(
"");
165 high_bias_down_time_vchannel->SetTitle(
"");
168 high_bias_down_time_vchannel->GetXaxis()->SetTitleSize(0.05);
169 high_bias_down_time_vchannel->GetYaxis()->SetTitleSize(0.05);
170 high_bias_down_time_vchannel->GetXaxis()->SetTitle(
"High Down - chid");
171 high_bias_down_time_vchannel->GetYaxis()->SetTitle(
"Time Difference (Down-Up) (ns)");
172 high_bias_down_time_vchannel->SetMarkerColor(2);
173 high_bias_down_time_vchannel->SetMarkerStyle(20);
174 high_bias_down_time_vchannel->SetMarkerSize(0.5);
175 high_bias_down_time_vchannel->Draw(
"");
179 high_bias_up_time_vchannel->SetTitle(
"");
182 high_bias_up_time_vchannel->GetXaxis()->SetTitleSize(0.05);
183 high_bias_up_time_vchannel->GetYaxis()->SetTitleSize(0.05);
184 high_bias_up_time_vchannel->GetXaxis()->SetTitle(
"High Up - chid");
185 high_bias_up_time_vchannel->GetYaxis()->SetTitle(
"Time Difference (Down-Up) (ns)");
186 high_bias_up_time_vchannel->SetMarkerColor(2);
187 high_bias_up_time_vchannel->SetMarkerStyle(20);
188 high_bias_up_time_vchannel->SetMarkerSize(0.5);
189 high_bias_up_time_vchannel->Draw(
"");
197 sigma->GetXaxis()->SetTitleSize(0.05);
198 sigma->GetYaxis()->SetTitleSize(0.05);
199 sigma->GetYaxis()->SetTitle(
"Entries");
200 sigma->GetXaxis()->SetTitle(
"Sigma between configurations");
201 sigma->SetLineColor(2);
205 c0->SaveAs(
"plots/"+filename+
"_plots.pdf");
void hist_read(TString filename)
sprintf(text,"Post KinFit Cut")
Double_t sigma[NCHANNELS]
printf("string=%s", string)