2 #include "fgtPedestal.h"
4 static const int MAX=2*6*20*128;
5 static const float markerSize=0.38;
7 makepedplot(
int run,
int statonly=0,
int comp=0){
9 float ped[MAX],rms[MAX],frac[MAX],p,r,f;
10 float ped2[MAX],rms2[MAX];
11 int eleId[MAX],status[MAX],eid,s,t,i;
15 if(run>0 && statonly==0){
16 sprintf(filename,
"%d/ped/ped.%d.txt",day,run);
18 sprintf(filename,
"ped.txt");
20 cout<<
"Reading File "<<filename<<endl;
21 std::ifstream in(filename);
23 cout <<
"Can't find file!\n";
28 in >> eid >> t >> p >> r;
38 sprintf(filename,
"%d/status/status.%d.txt",day,run);
40 sprintf(filename,
"status.txt");
42 cout<<
"Reading File "<<filename<<endl;
43 std::ifstream in2(filename);
45 cout <<
"Can't find file!\n";
49 in2 >> eid >> statread;
51 status[eid] = statread.Atoi();
57 memset(ped2,0,
sizeof(ped2));
58 memset(rms2,0,
sizeof(rms2));
59 TH1F * hd =
new TH1F(
"PED Offline-Tonko",
"PED Offline-Tonko",50,-30,30);
60 TH1F * he =
new TH1F(
"RMS Offline-Tonko",
"RMS Offline-Tonko",50,-30,30);
61 TGraph * de=
new TGraphErrors();
62 TGraph * dp=
new TGraphErrors();
63 cout<<
"Reading File fgt_pedestals.txt"<<endl;
64 std::ifstream in3(
"fgt_pedestals.txt");
66 cout <<
"Can't find file!\n";
71 in3 >> rdo >> arm >> apv >> ch >> t >> p >> r;
73 eid=(rdo-1)*6*20*128 + arm*20*128 + apv*128 + ch;
79 for(
int i=0; i<MAX; i++){
80 float d=ped[i]-ped2[i]; hd->Fill(d);
81 float e=rms[i]-rms2[i]; he->Fill(e);
83 de->SetPoint(j,
float(i),d);
84 dp->SetPoint(j,ped[i],d);
89 TCanvas * c1 =
new TCanvas(
"ped",
"ped",50,0,800,800);
91 gStyle->SetOptStat(1111110);
92 c1->cd(1); hd->Draw();
93 c1->cd(2); he->Draw();
94 de->GetHistogram()->SetTitle(
"PED:Offline-Tonko:Id");
95 dp->GetHistogram()->SetTitle(
"PED:Offline-Tonko:Ped");
96 c1->cd(3); de->SetMarkerStyle(22); de->SetMarkerSize(markerSize); de->Draw(
"AP");
97 c1->cd(4); dp->SetMarkerStyle(22); dp->SetMarkerSize(markerSize); dp->Draw(
"AP");
101 TGraph * gped=
new TGraphErrors();
102 TGraph * grms=
new TGraphErrors();
103 TGraph * bped=
new TGraphErrors();
104 TGraph * brms=
new TGraphErrors();
105 TGraph * gcor=
new TGraphErrors();
106 TGraph * bcor=
new TGraphErrors();
107 TH1F * hgped =
new TH1F(
"PED" ,
"PED", 100,0,2000);
108 TH1F * hbped =
new TH1F(
"PEDb",
"PEDb", 100,0,2000);
109 TH1F * hgrms =
new TH1F(
"RMS",
"RMS", 100,0,120);
110 TH1F * hbrms =
new TH1F(
"RNSb",
"RMSb", 100,0,120);
114 for(eid=0; eid<MAX; eid++){
116 gped->SetPoint(g,
float(eid),ped[eid]);
117 grms->SetPoint(g,
float(eid),rms[eid]);
118 gcor->SetPoint(g,ped[eid],rms[eid]);
119 hgped->Fill(ped[eid]);
120 hgrms->Fill(rms[eid]);
124 bped->SetPoint(b,
float(eid),ped[eid]);
125 brms->SetPoint(b,
float(eid),rms[eid]);
126 bcor->SetPoint(b,ped[eid],rms[eid]);
127 hbped->Fill(ped[eid]);
128 hbrms->Fill(rms[eid]);
134 printf(
"Status Good=%5d Bad=%5d",g,b);
136 TCanvas * c1 =
new TCanvas(
"ped",
"ped",0,0,1200,800);
140 gped->GetHistogram()->SetTitle(
"Pedestals;ElecId;ADC");
141 gped->SetMinimum(0); gped->SetMaximum(1500); gped->GetXaxis()->SetRangeUser(0,
float(MAX+1));
142 gped->SetMarkerStyle(21); gped->SetMarkerSize(markerSize); gped->SetMarkerColor(kBlue); gped->SetLineColor(kBlue);
144 bped->SetMarkerStyle(22); bped->SetMarkerSize(markerSize); bped->SetMarkerColor(kRed); bped->SetLineColor(kRed);
148 grms->GetHistogram()->SetTitle(
"PedRMS;ElecId;ADC");
149 grms->SetMinimum(0); grms->SetMaximum(200); grms->GetXaxis()->SetRangeUser(0,
float(MAX+1));
150 grms->SetMarkerStyle(21); grms->SetMarkerSize(markerSize); grms->SetMarkerColor(kBlue); grms->SetLineColor(kBlue);
152 brms->SetMarkerStyle(22); brms->SetMarkerSize(markerSize); brms->SetMarkerColor(kRed); brms->SetLineColor(kRed);
155 const char c[200]; Double_t x=500, y=160;
156 sprintf(c,
"Status Good=%d Bad=%d R(Bad/Total)=%5.2f",g,b,
float(b)/
float(a));
157 TText* t1=
new TText(x,y,c); t1->SetTextSize(0.1); t1->Draw();
159 c1->cd(3); gPad->Divide(3,1);
161 c1->cd(3); gPad->cd(1);
162 gcor->GetHistogram()->SetTitle(
"PEDvsRMS;PED;RMS");
163 gcor->SetMinimum(0); gcor->SetMaximum(150); gcor->GetXaxis()->SetRangeUser(0,1200);
164 gcor->SetMarkerStyle(21); gcor->SetMarkerSize(markerSize); gcor->SetMarkerColor(kBlue); gcor->SetLineColor(kBlue);
166 bcor->SetMarkerStyle(22); bcor->SetMarkerSize(markerSize); bcor->SetMarkerColor(kRed); bcor->SetLineColor(kRed);
169 c1->cd(3); gPad->cd(2); gPad->SetLogy(); hgped->SetFillColor(kBlue); hgped->Draw(); hbped->SetFillColor(kRed); hbped->Draw(
"same");
170 c1->cd(3); gPad->cd(3); gPad->SetLogy(); hgrms->SetFillColor(kBlue); hgrms->Draw(); hbrms->SetFillColor(kRed); hbrms->Draw(
"same");
175 sprintf(filename,
"%d/%d_ped.png",day,run);
176 c1->SaveAs(filename);