1 static int startday=050;
4 static const int NRUN=10000;
8 static const int NVAL=19;
10 static int flag[NRUN];
11 static Float_t frun[NRUN];
12 static Long64_t idx[NRUN];
13 static double val[NVAL][NRUN];
14 static TGraph* g[NVAL];
16 void read(
int irun,
int runnum,
int log){
18 int yearday=runnum/1000;
19 sprintf(file,
"www/%d/%d.Mismatch.txt",yearday,runnum);
20 FILE* f=fopen(file,
"r");
21 if(!f) { printf(
"Failed to open %s\n",file);
return; }
27 for(
int i=0; i<NVAL+1; i++){
30 if(i<18) val[i][irun]=v;
31 if(i==19) val[i-1][irun]=v;
33 printf(
"irun=%d run=%8d : ",irun,runnum);
34 for(
int i=0; i<NVAL; i++) {printf(
"%6.3f ",val[i][irun]);}
37 if(val[NVAL-1][irun]>=0.0 && val[NVAL-1][irun]<=100.0){
38 for(
int i=0; i<NVAL; i++){
41 if(val[i][irun]>=0.001) v=log10(val[i][irun]);
42 g[i]->SetPoint(ngoodrun,
double(irun),v);
44 g[i]->SetPoint(ngoodrun,
double(irun),val[i][irun]);
51 void readall(
int day,
int log){
57 printf(
"Yearday=%d Year=%d Day=%d\n",day,year,yearday);
58 if(yearday!=0) {startday=yearday; endday=yearday;}
59 for(
int d=startday; d<=endday; d++){
61 char dirname[100]; sprintf(dirname,
"www/%5d/",yday);
62 TSystemDirectory dir(dirname,dirname);
63 TList *files = dir.GetListOfFiles();
68 while ((file=(TSystemFile*)next())) {
69 fname = file->GetName();
70 if (!file->IsDirectory() && fname.EndsWith(
".Mismatch.txt")) {
71 sscanf(fname.Data(),
"%8f",&r);
74 printf(
"%s %8.0f\n",fname.Data(),r);
80 TMath::Sort((
long)i,frun,idx,0);
81 for(
int j=0; j<nrun; j++){
82 read(j,(
int)frun[idx[j]], log);
86 void plot(
float xmin=-1,
float xmax=0,
float ymin=-3.1,
float ymax=2){
87 if(xmax==0) xmax=nrun;
88 TH2F *frame =
new TH2F(
"frame",
"",1,xmin,xmax,1,ymin,ymax);
90 for(
int v=0; v<NVAL; v++){
93 TText* t0=
new TText(0.05 ,0.95,
"BitMismatch%"); t0->SetNDC(); t0->SetTextSize(0.05); t0->SetTextColor(kBlack); t0->Draw();
94 TText* t1=
new TText(0.15 ,0.85,
"QT12->Layer0"); t1->SetNDC(); t1->SetTextSize(0.05); t1->SetTextColor(kRed); t1->Draw();
95 TText* t2=
new TText(0.15 ,0.80,
"QT34->Layer0"); t2->SetNDC(); t2->SetTextSize(0.05); t2->SetTextColor(kMagenta);t2->Draw();
96 TText* t3=
new TText(0.15 ,0.75,
"Layer0->1"); t3->SetNDC(); t3->SetTextSize(0.05); t3->SetTextColor(kBlue); t3->Draw();
97 TText* t4=
new TText(0.15 ,0.70,
"Layer1->2"); t4->SetNDC(); t4->SetTextSize(0.05); t4->SetTextColor(kOrange); t4->Draw();
98 TText* t5=
new TText(0.15 ,0.65,
"Layer2->TCU"); t5->SetNDC(); t5->SetTextSize(0.05); t5->SetTextColor(kGreen); t5->Draw();
99 TText* t6=
new TText(0.15 ,0.60,
"Average"); t6->SetNDC(); t6->SetTextSize(0.05); t6->SetTextColor(kBlack); t6->Draw();
102 void history(
int day=16054,
int log=0){
103 int color[NVAL]={kRed,kRed,kMagenta,kMagenta,
105 kMagenta,kMagenta,kMagenta,kMagenta,
106 kBlue,kBlue,kBlue,kBlue,
107 kOrange, kGreen, kBlack};
108 for(
int v=0; v<NVAL; v++){
110 g[v]->SetMarkerStyle(20);
111 g[v]->SetMarkerSize(1);
112 g[v]->SetLineColor(color[v]);
113 g[v]->SetLineWidth(2);
116 gStyle->SetOptStat(0);
117 c1 =
new TCanvas(
"c1",
"History",50,0,700,720);
120 c1->cd(1); plot(-1,0,-5.0,60.0);
121 c1->cd(2); plot(-1,0,-0.5,4.0);
127 if(day%1000!=0) { sprintf(file,
"%d/history.%5d.png",day,day); }
128 else { sprintf(file,
"history.png",day);}
130 printf(
"Create %s\n",file);