1 static const int NTB=15;
3 static const int kFgtNumDiscs=6;
4 static const int kFgtNumQuads=4;
5 static const int kFgtNumElecIds=30720;
7 static const int NHist=10;
8 static const int N1dHist=12;
9 static const int N2dHist=5;
10 static const int NTrkHist=6;
12 static TH1F *hist0[NHist];
13 static TH1F *hist1[kFgtNumDiscs][kFgtNumQuads][N1dHist];
14 static TH2F *hist2[kFgtNumDiscs][N2dHist];
15 static TH1F *histTrk[kFgtNumQuads][NTrkHist];
17 static const char* cquad[kFgtNumQuads]={
"A",
"B",
"C",
"D"};
18 static const char* cHist[NHist]={
"MaxTimeBin",
"ADC",
"DataSize",
"ZSdata",
"10sigma",
"Nevt",
"LandauChi2",
"LandauSig",
"LandauMpv",
"Mpv-3Sig"};
20 static const char* c1dHist[N1dHist]={
"NHitStrip",
"PhiHit",
"RHit",
"NCluster",
"ClusterSize",
"ClusterCharge",
"MaxADC",
"ChargeAsy",
"CluChargeT",
"MaxADCT",
"ChargeAsyTrk",
"LandauN"};
22 static const int l1dHist[N1dHist]={ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0};
24 static const int m1dHist[N1dHist]={ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
26 static const int f1dHist[N1dHist]={ 0, -1, -1, 0, 0, 2, 2, 1, 2, 2, 1, 2};
29 static const char* c2dHist[N1dHist]={
"XY",
"ADCvsTB",
"APVTB",
"XYT",
"APVTB2"};
32 static const char* cTrkHist[NTrkHist]={
"NTrk",
"NHitTrk",
"DCA",
"ZVTX",
"Chi2",
"HitDisc"};
33 static const int lTrkHist[NTrkHist]={ 1, 1, 0, 0, 0, 0};
35 static const int color[kFgtNumDiscs]={46,2,8,4,6,9};
36 static const int colorQuad[kFgtNumDiscs]={2,8,4,6};
40 static int runnum, yearday, png, pdf;
42 float mPeakC[kFgtNumDiscs][kFgtNumQuads];
43 float mPeakA[kFgtNumDiscs][kFgtNumQuads];
44 float mFracA[kFgtNumDiscs][kFgtNumQuads];
45 float mPeakL[kFgtNumDiscs][kFgtNumQuads];
48 static const UInt_t Number = 3;
49 Double_t Red[Number] = { 0.00, 0.00, 1.00};
50 Double_t Green[Number] = { 0.00, 1.00, 0.00};
51 Double_t Blue[Number] = { 1.00, 0.00, 0.00};
52 Double_t Length[Number] = { 0.00, 0.50, 1.00 };
54 TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
57 void save(
char* name){
61 sprintf(fname,
"plot/%d_%s.png",runnum,name);
63 sprintf(fname,
"%d/%d_%s.png",yearday,runnum,name);
69 void plot1d(
int hid) {
70 gStyle->SetOptStat(0);
75 for(
int quad=0; quad<kFgtNumQuads; quad++){
76 TVirtualPad* pad1 = c1->cd(quad+1);
77 pad1->SetLogy(l1dHist[hid]);
78 double xmin, xmax, ymin=0.0, ymax=0.0;
79 if(l1dHist[hid]==1) ymin=0.1;
80 for(
int disc=0; disc<kFgtNumDiscs; disc++){
81 sprintf(c,
"%1d%1s-%s",disc+1,cquad[quad],c1dHist[hid]);
83 TH1F *h = hist1[disc][quad][hid] = (TH1F*)file->Get(c);
84 xmin=h->GetXaxis()->GetXmin();
85 xmax=h->GetXaxis()->GetXmax();
86 double m=h->GetMaximum();
88 printf(
"disc=%d max=%6.1f ymax=%6.1f xmin=%6.1f xmax=%6.1f\n",disc+1,m,ymax,xmin,xmax);
90 sprintf(c,
"Quad%1s-%s",cquad[quad],c1dHist[hid]);
91 TH2F *frame =
new TH2F(c,c,1,xmin,xmax,1,ymin,ymax*1.2); frame->SetStats(0); frame->Draw();
92 for(
int disc=0; disc<kFgtNumDiscs; disc++){
93 TH1F *h=hist1[disc][quad][hid];
94 h->SetLineColor(color[disc]); h->SetLineWidth(3); h->Draw(
"SAME");
96 float mean=h->GetMean();
97 sprintf(c,
"%1d%s mean=%6.2f",disc+1,cquad[quad],mean);
98 }
else if(f1dHist[hid]==1){
99 int res = h->Fit(
"gaus",
"0Q");
100 TF1 *f = h->GetFunction(
"gaus");
101 float sig = f->GetParameter(2);
102 if(res==0 && sig>0.0001 && h->GetEntries()>5){
103 f->SetLineColor(color[disc]); f->SetLineWidth(2); f->Draw(
"SAME");
104 sprintf(c,
"%1d%s sig=%6.3f",disc+1,cquad[quad],sig);
106 sprintf(c,
"%1d%s",disc+1,cquad[quad]);
108 }
else if(f1dHist[hid]==2){
109 int res = h->Fit(
"landau",
"0Q");
110 TF1 *f = h->GetFunction(
"landau");
111 float peak = f->GetParameter(1);
112 if(res==0 && peak>0 && h->GetEntries()>5){
113 f->SetLineColor(color[disc]); f->SetLineWidth(2); f->Draw(
"SAME");
114 sprintf(c,
"%1d%s mpv=%6.0f",disc+1,cquad[quad],peak);
116 sprintf(c,
"%1d%s",disc+1,cquad[quad]);
120 float x1= 0.2, x2= 0.55;
121 float y1=0.8 - 0.07*disc;
122 float y2=0.8 - 0.07*(disc-3);
123 if(disc<3) { t1 =
new TText(x1,y1,c); }
124 else { t1 =
new TText(x2,y2,c); }
126 t1->SetTextSize(0.04);
127 t1->SetTextColor(color[disc]);
133 gStyle->SetOptStat(0);
134 gStyle->SetOptTitle(0);
135 gStyle->SetOptFit(0);
136 for(
int disc=0; disc<kFgtNumDiscs; disc++){
137 for(
int quad=0; quad<kFgtNumQuads; quad++){
138 TPad* pad = c1->cd(disc*4+quad+1);
139 pad->SetRightMargin(0.01); pad->SetLeftMargin(0.1);
140 pad->SetTopMargin(0.01); pad->SetBottomMargin(0.1);
141 pad->SetLogy(l1dHist[hid]);
142 sprintf(c,
"%1d%1s-%s",disc+1,cquad[quad],c1dHist[hid]);
143 TH1F *h = hist1[disc][quad][hid] = (TH1F*)file->Get(c);
144 h->SetFillColor(color[disc]);
145 h->GetXaxis()->SetLabelSize(0.1);
146 h->GetYaxis()->SetLabelSize(0.1);
147 h->GetXaxis()->SetNdivisions(205);
151 float mean=h->GetMean();
152 sprintf(c,
"%1d%s mean=%6.2f",disc+1,cquad[quad],mean);
153 }
else if(f1dHist[hid]==1){
154 int res = h->Fit(
"gaus",
"0Q");
155 TF1 *f = h->GetFunction(
"gaus");
156 float sig = f->GetParameter(2);
157 if(res==0 && sig>0.0001 && h->GetEntries()>5){
158 f->SetLineColor(color[disc]); f->SetLineWidth(2); f->Draw(
"SAME");
159 sprintf(c,
"%1d%s sig=%6.3f",disc+1,cquad[quad],sig);
161 sprintf(c,
"%1d%s",disc+1,cquad[quad]);
163 }
else if(f1dHist[hid]==2){
164 int res = h->Fit(
"landau",
"0Q");
165 TF1 *f = h->GetFunction(
"landau");
166 float peak = f->GetParameter(1);
167 if(res==0 && peak>0 && h->GetEntries()>5){
168 f->SetLineColor(1); f->SetLineWidth(2); f->Draw(
"SAME");
169 sprintf(c,
"%1d%s mpv=%6.0f",disc+1,cquad[quad],peak);
171 sprintf(c,
"%1d%s",disc+1,cquad[quad]);
173 if(hid==8) {mPeakC[disc][quad]=peak;}
175 mPeakA[disc][quad]=peak;
176 int n=h->GetEntries();
179 int bin=h->FindBin(cut);
180 int nbin=h->GetNbinsX();
181 float sat=h->Integral(bin,nbin+1);
183 mFracA[disc][quad]=sat/float(n);
186 if(hid==11) {mPeakL[disc][quad]=peak;}
188 TText *t1 =
new TText(0.3,0.85,c);
190 t1->SetTextSize(0.15);
191 t1->SetTextColor(color[disc]);
200 void plot2d(
int hid) {
201 gStyle->SetOptStat(0);
204 if(hid!=2 && hid!=4){
206 for(
int disc=0; disc<kFgtNumDiscs; disc++){
207 TPad *pad = c1->cd(disc+1);
209 pad->SetTopMargin(0.01); pad->SetBottomMargin(0.02);
210 sprintf(c,
"Disc%1d%s",disc+1,c2dHist[hid]);
212 TH2F *h = hist2[disc][hid] = (TH2F*)file->Get(c);
216 gStyle->SetOptTitle(0);
217 gStyle->SetOptFit(0);
221 int disc=4;
char name[100]=
"LandauMPV";
223 TVirtualPad *pad2 = c1->cd(1);
225 TVirtualPad *pad3=pad2->cd(1);
226 pad3->SetLogz(1); pad2->SetLogz(0);
227 sprintf(c,
"Disc%1d%s",disc,c2dHist[hid]);
228 TH2F *h = hist2[disc][hid] = (TH2F*)file->Get(c);
230 TText *tt1=
new TText(0.05,0.1,
"(RDO-1)*12+ARM*2+GRP"); tt1->SetTextAngle(90); tt1->SetNDC(); tt1->Draw();
231 sprintf(txt,
"Tbin for %s",name);
232 TText *tt2=
new TText(0.3,0,txt); tt2->SetNDC(); tt2->Draw();
234 TVirtualPad* pad4 = c1->cd(2);
235 pad4->SetTopMargin(0.01); pad4->SetBottomMargin(0.1);
240 for(
int i=0; i<24; i++){
241 char ccc[10]; sprintf(ccc,
"_%d_%d",disc,i);
242 h1[i] = h->ProjectionX(ccc,i+1,i+1);
243 if(h1[i]->GetMaximum() > max && i!=0) {max=h1[i]->GetMaximum(); maxid=i; }
246 printf(
"max=%f off=%f\n",max,off);
247 for(
int i=0; i<24; i++){
248 h1[i]->GetXaxis()->SetRangeUser(2,11);
249 int res = h1[i]->Fit(
"gaus",
"0Q");
250 TF1* f=h1[i]->GetFunction(
"gaus");
251 if(h1[i]->GetMaximum()>max/3 && res==0){
252 mean[i] = f->GetParameter(1);
258 for(
int rdo=1; rdo<=2; rdo++){
259 for(
int arm=0; arm<6; arm++){
260 for(
int grp=0; grp<2; grp++){
261 i=(rdo-1)*12+arm*2+grp;
262 int nb=h1[i]->GetNbinsX();
263 for(
int t=0; t<nb; t++){ h1[i]->AddBinContent(t+1,off*i); }
264 h1[i]->SetLineColor(i%6+1); h1[i]->SetLineWidth(3);
266 h1[i]->SetMinimum(0);
267 h1[i]->SetMaximum(max*6.5);
269 }
else {h1[i]->Draw(
"PL same");}
271 sprintf(name,
"Rdo%1dArm%1dGrp%1d",rdo,arm,grp);
272 TText *tx =
new TText(8.5,(max/4.0)*(i+0.2),name); tx->SetTextColor(i%6+1); tx->SetTextSize(0.03);
278 TText *tt4=
new TText(0.4,0,txt); tt4->SetNDC(); tt4->Draw();
281 float t2[24]={-8.47, -5.16, -0.21, -2.23, 1.11, -4.09,
282 -3.13, -9.08, -5.88, -7.01, -6.22, -9.79,
283 0.75, -8.91, 0.16, 1.12, -0.99, -4.56,
284 7.57, -3.68, 7.12, -6.54, -4.08, -8.21};
285 TGraph *g=
new TGraph(1);
287 for(
int i=0; i<24; i++){
288 if(mean[i]>0) {g->SetPoint(j,(mean[i]-6.0)*27,t2[i]); j++;}
290 TVirtualPad* pad5=pad2->cd(2);
291 g->SetMarkerStyle(20+i/6); g->SetMarkerSize(1);
293 for(
int i=0; i<24; i++){
294 TGraph *g2=
new TGraph(1);
295 if(mean[i]>0) {g2->SetPoint(j,(mean[i]-6.0)*27,t2[i]); j++;}
296 g2->SetMarkerStyle(20+i/6); g2->SetMarkerSize(2); g2->SetMarkerColor(i%6+1);
300 TText *tt5=
new TText(0.05,0.1,
"(VPHASE_ADC-1.2V)/0.95V*27nsec/2"); tt5->SetTextAngle(90); tt5->SetNDC(); tt5->Draw();
301 TText *tt6=
new TText(0.5,0,
"(Tbin-6)*27nsec"); tt6->SetNDC(); tt6->Draw();
303 gStyle->SetOptTitle(0);
304 gStyle->SetOptFit(0);
308 int disc=4;
char name[100]=
"LandauMPV";
310 sprintf(c,
"Disc%1d%s",disc,c2dHist[2]);
311 TH2F *h = hist2[disc][2] = (TH2F*)file->Get(c);
314 for(
int rdo=1; rdo<=2; rdo++){
315 for(
int arm=0; arm<6; arm++){
316 for(
int grp=0; grp<2; grp++){
317 int i=(rdo-1)*12+arm*2+grp;
318 TVirtualPad *pad2 = c1->cd(i+1);
319 pad2->SetTopMargin(0.01); pad2->SetBottomMargin(0.1);
320 char ccc[10]; sprintf(ccc,
"_%d_%d",disc,i);
321 h1[i]=h->ProjectionX(ccc,i+1,i+1);
322 h1[i]->GetXaxis()->SetRangeUser(2,12); h1[i]->SetFillColor(4);
323 h1[i]->GetXaxis()->SetLabelSize(0.1); h1[i]->GetYaxis()->SetLabelSize(0.1);
325 int res = h1[i]->Fit(
"gaus",
"Q");
326 TF1* f=h1[i]->GetFunction(
"gaus"); f->SetLineColor(2); f->SetLineWidth(2);
328 mean[i] = f->GetParameter(1);
331 sprintf(name,
"Rdo%1dArm%1d-%1d",rdo,arm,grp);
332 TText *tx =
new TText(0.5,0.85,name); tx->SetTextSize(0.1); tx->SetNDC();
335 sprintf(name,
"peak=%4.1f",mean[i]);
336 TText *tx2 =
new TText(0.55,0.75,name); tx2->SetTextSize(0.12); tx2->SetNDC();
348 gStyle->SetOptStat(0);
349 gStyle->SetOptTitle(1);
353 for(
int hid=0; hid<6; hid++){
354 TVirtualPad* pad = c1->cd(hid+1);
355 pad->SetLogy(lTrkHist[hid]);
356 double xmin, xmax, ymin=0.0, ymax=0.0;
357 if(lTrkHist[hid]==1) ymin=0.1;
358 for(
int quad=0; quad<kFgtNumQuads; quad++){
359 sprintf(c,
"Quad%1s-%s",cquad[quad],cTrkHist[hid]);
361 TH1F *h = histTrk[quad][hid] = (TH1F*)file->Get(c);
362 xmin=h->GetXaxis()->GetXmin();
363 xmax=h->GetXaxis()->GetXmax();
364 double m=h->GetMaximum();
368 ymax*=1.2;
if(lTrkHist[hid]==1){ymax*=20.0;}
369 sprintf(c,
"%s",cTrkHist[hid]);
370 TH2F *frame =
new TH2F(c,c,1,xmin,xmax,1,ymin,ymax); frame->SetStats(0); frame->Draw();
371 for(
int quad=0; quad<kFgtNumQuads; quad++){
372 TH1F *h=histTrk[quad][hid];
373 h->SetLineColor(colorQuad[quad]); h->SetLineWidth(3);
376 float mean=h->GetMean();
377 if(hid==1 || hid==4) {sprintf(c,
"%s mean=%6.4f",cquad[quad],mean);}
378 else {sprintf(c,
"%s mean=%6.2f",cquad[quad],mean);}
380 h->SetMarkerColor(colorQuad[quad]); h->SetMarkerStyle(20); h->SetMarkerSize(1);
382 sprintf(c,
"Quad%s",cquad[quad]);
385 float x1= 0.2, x2= 0.55;
386 float y1=0.8 - 0.07*quad;
387 float y2=0.8 - 0.07*(quad-2);
388 if(quad<2) { t1 =
new TText(x1,y1,c); }
389 else { t1 =
new TText(x2,y2,c); }
391 t1->SetTextSize(0.06);
392 t1->SetTextColor(colorQuad[quad]);
400 void makeqaplot(
int run=0,
int plt=0,
int save=0){
403 if(save==0) {png=0; pdf=0;}
404 if(save==1) {png=1; pdf=0;}
405 if(save==2) {png=0; pdf=1;}
406 if(save==3) {png=1; pdf=1;}
408 c1 =
new TCanvas(
"c1",
"QA",50,50,800,800);
409 gStyle->SetLabelSize(0.04,
"xy");
411 gStyle->SetPalette(1);
412 gStyle->SetStatW(0.4);
415 if(run==0) {sprintf(fname,
"fgtQA.root");}
416 else {sprintf(fname,
"%d/fgtQA_%d.root",yearday,run);}
418 cout <<
"Opening "<<fname<<endl;
419 file=
new TFile(fname,
"");
422 if(plt==0 || plt==1) {
423 gStyle->SetOptStat(111110);
425 for(
int i=0; i<3; i++){
426 TVirtualPad* pad = c1->cd(i+1);
430 hist0[i]=(TH1F*) file->Get(cHist[i]);
431 hist0[i]->SetFillColor(kBlue);
434 float ntot = float(hist0[i]->GetEntries());
436 int nbin = hist0[i]->GetNbinsX();
437 float nofgt = hist0[i]->Integral(1,1);
438 int bin = hist0[i]->FindBin(
float(kFgtNumElecIds));
439 float nonzs = hist0[i]->Integral(bin-1,nbin+1);
440 float zs = hist0[i]->Integral(2,bin-2);
441 hist0[i]->GetXaxis()->SetRange(2, bin-2);
442 float mean = hist0[i]->GetMean() / float(kFgtNumElecIds);
444 sprintf(c,
"Total %d",ntot); TText *t1 =
new TText(0.3,0.8,c); t1->SetNDC(); t1->SetTextSize(0.06); t1->Draw();
445 sprintf(c,
"NoFGT %d (%5.2f)",nofgt,nofgt/ntot); TText *t2 =
new TText(0.3,0.7,c); t2->SetNDC(); t2->SetTextSize(0.06); t2->Draw();
446 sprintf(c,
"NoneZS %d (%5.2f)",nonzs,nonzs/ntot); TText *t3 =
new TText(0.3,0.6,c); t3->SetNDC(); t3->SetTextSize(0.06); t3->Draw();
447 sprintf(c,
"ZS %d (%5.2f)",zs,zs/ntot); TText *t4 =
new TText(0.3,0.5,c); t4->SetNDC(); t4->SetTextSize(0.06); t4->Draw();
448 sprintf(c,
"Mean ZS data size/fullsize= %5.3f",mean); TText *t5 =
new TText(0.3,0.4,c); t5->SetNDC(); t5->SetTextSize(0.06); t5->Draw();
449 if(mean>0.08) { t5->SetTextColor(2); }
450 else { t5->SetTextColor(4); }
457 if(plt==0 || plt==2) {
459 gStyle->SetOptStat(0);
460 gStyle->SetOptTitle(0);
462 for(
int i=3; i<6; i++){ hist0[i]=(TH1F*) file->Get(cHist[i]); }
463 int nevt=hist0[5]->GetEntries();
464 printf(
"Nevent=%d\n",nevt);
466 pad=c1->cd(1); pad->SetLogy(); pad->SetTopMargin(0.01); pad->SetRightMargin(0.01);
467 hist0[3]->GetXaxis()->SetLabelSize(0.07); hist0[3]->GetYaxis()->SetLabelSize(0.07);
468 hist0[3]->SetFillColor(kRed); hist0[3]->Scale(1/
float(nevt)); hist0[3]->Draw();
469 TText *tx=
new TText(0.87,0.0,
"EleID"); tx->SetNDC(); tx->SetTextSize(0.1); tx->Draw();
470 TText *t3=
new TText(0.05,0.1,
"F3=frac in 3sig/2tb"); t3->SetNDC(); t3->SetTextSize(0.08); t3->SetTextAngle(90); t3->Draw();
472 pad=c1->cd(2); pad->SetLogy(); pad->SetTopMargin(0.01); pad->SetRightMargin(0.01);
473 hist0[4]->GetXaxis()->SetLabelSize(0.07); hist0[4]->GetYaxis()->SetLabelSize(0.07);
474 hist0[4]->SetFillColor(kBlue); hist0[4]->Scale(1/
float(nevt)); hist0[4]->Draw();
476 TText *t4=
new TText(0.05,0.1,
"F10=frac in 10sig & >500"); t4->SetNDC(); t4->SetTextSize(0.08); t4->SetTextAngle(90); t4->Draw();
479 int max=hist0[3]->GetNbinsX();
480 printf(
"Max=%d\n",max);
481 TH1F *h1 =
new TH1F(
"ZSdataFrac",
"ZSdataFrac",50,min,0);
482 TH1F *h2 =
new TH1F(
"10SigmaFrac",
"10SigmaFrac",50,min,0);
483 float f1[kFgtNumElecIds],f2[kFgtNumElecIds];
484 for(
int i=0; i<max; i++){
485 f1[i] = log10(hist0[3]->GetBinContent(i+1));
if(f1[i]<min) {f1[i]=min;} h1->Fill(f1[i]);
486 f2[i] = log10(hist0[4]->GetBinContent(i+1));
if(f2[i]<min) {f2[i]=min;} h2->Fill(f2[i]);
488 pad = c1->cd(3); pad->Divide(2,1);
491 pad2->SetLogy(); pad2->SetTopMargin(0.01); pad2->SetRightMargin(0.01);
492 h1->GetXaxis()->SetLabelSize(0.1); h1->GetYaxis()->SetLabelSize(0.1);
493 h2->GetXaxis()->SetLabelSize(0.1); h2->GetYaxis()->SetLabelSize(0.1);
494 h1->SetLineColor(kRed); h2->SetLineColor(kBlue);
495 if(h1->GetMaximum()>h2->GetMaximum()){
496 h1->Draw(); h2->Draw(
"SAME");
498 h2->Draw(); h1->Draw(
"SAME");
500 TText *t5=
new TText(0.2,0.88,
"Log(F3)"); t5->SetNDC(); t5->SetTextSize(0.1); t5->SetTextColor(2); t5->Draw();
501 TText *t6=
new TText(0.6,0.88,
"Log(F10)"); t6->SetNDC(); t6->SetTextSize(0.1); t6->SetTextColor(4); t6->Draw();
505 float ped[kFgtNumElecIds],rms[kFgtNumElecIds],p,r;
506 int status[kFgtNumElecIds]; memset(status,0,
sizeof(status));
507 cout<<
"Reading Ped File "<<endl;
508 std::ifstream in(
"ped.txt");
510 cout <<
"Can't find file!\n";
514 in >> eid >> t >> p >> r;
519 TH1F * hr1=
new TH1F(
"RMS",
"RMS",60,0,120);
520 TH1F * hr2=
new TH1F(
"RMS2",
"RMS2",60,0,120);
521 TH1F * hr3=
new TH1F(
"RMS3",
"RMS3",60,0,120);
522 TH1F * hr4=
new TH1F(
"RMS4",
"RMS4",60,0,120);
523 TH1F * hr5=
new TH1F(
"RMS5",
"RMS5",60,0,120);
524 float f1l=-3.5, f1h=-0.5;
525 float f2l=-3.5, f2h=-1.2;
526 for(
int i=0; i<kFgtNumElecIds; i++){
527 if(f1[i]<f1l) status[i]+=1;
528 if(f1[i]>f1h) status[i]+=2;
529 if(f1[i]<f2l) status[i]+=4;
530 if(f1[i]>f2h) status[i]+=8;
532 if(f1[i]<f1l) {hr2->Fill(rms[i]);}
533 if(f1[i]<f1l || f1[i]>f1h) {hr3->Fill(rms[i]);}
534 if(f1[i]<f1l || f1[i]>f1h || f2[i]<f2l) {hr4->Fill(rms[i]);}
535 if(f1[i]<f1l || f1[i]>f1h || f2[i]<f2l || f2[i]>f2h) {hr5->Fill(rms[i]);}
539 sprintf(filename,
"%d/status/status.%d.txt",yearday,run);
541 sprintf(filename,
"%d/status/status.%d.lowstat.txt",yearday,run);
543 FILE* pfile=fopen(filename,
"w");
545 printf(
"Couldn't open file %s\n",filename);
547 printf(
"Writing %s\n",filename);
548 for(
int i=0; i<kFgtNumElecIds; i++){
549 fprintf(pfile,
"%d 0x%d\n",i,status[i]);
555 pad2->SetLogy(0); pad2->SetTopMargin(0.01); pad2->SetRightMargin(0.01);
556 hr1->GetXaxis()->SetLabelSize(0.1); hr1->GetYaxis()->SetLabelSize(0.05);
557 hr1->SetFillColor(3); hr1->Draw();
558 hr5->SetFillColor(9); hr5->Draw(
"same");
559 hr4->SetFillColor(4); hr4->Draw(
"same");
560 hr3->SetFillColor(6); hr3->Draw(
"same");
561 hr2->SetFillColor(2); hr2->Draw(
"same");
562 char cc1[100]; sprintf(cc1,
"Log(F3)<%4.1f",f1l);
563 char cc2[100]; sprintf(cc2,
"Log(F3)>%4.1f",f1h);
564 char cc3[100]; sprintf(cc3,
"Log(F10)<%4.1f",f2l);
565 char cc4[100]; sprintf(cc4,
"Log(F10)>%4.1f",f2h);
566 TText *t7 =
new TText(0.6,0.88,cc1); t7->SetNDC(); t7->SetTextSize(0.07); t7->SetTextColor(2); t7->Draw();
567 TText *t8 =
new TText(0.6,0.78,cc2); t8->SetNDC(); t8->SetTextSize(0.07); t8->SetTextColor(6); t8->Draw();
568 TText *t9 =
new TText(0.6,0.68,cc3); t9->SetNDC(); t9->SetTextSize(0.07); t9->SetTextColor(4); t9->Draw();
569 TText *t10=
new TText(0.6,0.58,cc4); t10->SetNDC(); t10->SetTextSize(0.07); t10->SetTextColor(9); t10->Draw();
570 TText *t11=
new TText(0.6,0.48,
"OK"); t11->SetNDC(); t11->SetTextSize(0.07); t11->SetTextColor(3); t11->Draw();
571 TText *t12=
new TText(0.8,0.15,
"PedRMS"); t12->SetNDC(); t12->SetTextSize(0.07); t12->Draw();
575 if(plt==0 || plt==3) {
578 gStyle->SetOptTitle(1);
579 gStyle->SetOptStat(111110);
580 for(
int i=0; i<4; i++){
581 TVirtualPad* pad = c1->cd(i+1);
584 hist0[i+6]=(TH1F*) file->Get(cHist[i+6]);
585 hist0[i+6]->SetFillColor(kBlue);
592 memset(mPeakC,0,
sizeof(mPeakC));
593 memset(mPeakA,0,
sizeof(mPeakA));
594 memset(mFracA,0,
sizeof(mFracA));
595 memset(mPeakL,0,
sizeof(mPeakL));
596 for(
int i=0; i<N1dHist; i++) {
if(plt==0 || plt==10+i) plot1d(i);}
597 for(
int i=0; i<N2dHist; i++) {
if(plt==0 || plt==50+i) plot2d(i);}
598 if(plt==0 || plt==60) plotTrk();
602 sprintf(filename,
"%d/gain.%d.txt",yearday,run);
603 FILE* file=fopen(filename,
"w");
605 printf(
"Couldn't open $file\n",filename);
607 printf(
"Writing %s\n",filename);
608 for(
int i=0; i<kFgtNumDiscs; i++){
609 for(
int j=0; j<kFgtNumQuads; j++){
610 fprintf(file,
"%d %d %f %f %f %f\n",i,j,mPeakC[i][j],mPeakA[i][j],mFracA[i][j],mPeakL[i][j]);