////////////////////////////////// // ////////////////////////////////// int plot(const char* Filename = "table.dat") { gStyle->SetOptStat(kFALSE); TFile f("cid.root","RECREATE"); char t[256]; FILE *ft = fopen(Filename,"r"); while(!feof(ft)){ fscanf(ft,"%s",&t); printf("%s\n",t); char name[20]; char t1[20]; char t2[20]; char t3[20]; char s4[256]; strcpy(t1,t); strcpy(t2,t); strcpy(t3,t); strcpy(name,t); strcat(t1,"a"); strcat(t2,"b"); strcat(t3,"c"); Int_t run; Int_t cid1; Int_t cid2; Int_t start_run = 180000; Int_t end_run = 202000; TTree *table = new TTree(t,"cid"); table -> Branch("cid1",&cid1,"cid1/I"); table -> Branch("cid2",&cid2,"cid2/I"); table -> Branch("name",&s4,"name/C"); table -> Branch("run",&run,"run/I"); TH2C *table1 = new TH2C(t1, t, 1000,start_run ,end_run, 5000, 0, 500000); TH2C *table2 = new TH2C(t2, t, 1000,start_run ,end_run, 5000, 0, 500000); TH2C *table3 = new TH2C(t3, t, 1000,start_run ,end_run, 5000, 0, 500000); FILE *fp = fopen(Filename,"r"); int s1; int s2; int s3; while(!feof(fp)) { fscanf(fp,"%d %s %d %d",&s1,s4,&s2,&s3); int s5 = s2 -s3; s5 = abs(s5); if (!strcmp (s4,t)) { if ( s5!=0){ printf("%d %d %d %s %d\n", s1,s2,s3,s4,s5); } run = s1; cid1 = s2; cid2 = s3; table1->SetLineColor(1); table2->SetLineColor(2); table3->SetLineColor(3); table1->GetXaxis()->SetTitle("PROCESS RUN"); table1->GetYaxis()->SetTitle("CID"); table2->GetXaxis()->SetTitle("PROCESS RUN"); table2->GetYaxis()->SetTitle("CID"); table3->GetXaxis()->SetTitle("PROCESS RUN"); table3->GetYaxis()->SetTitle("CID"); table1->Fill(s1,s2); table2->Fill(s1,s3); table3->Fill(s1,s5); table->Fill(); } } fclose(fp); table1->Draw("BOX"); table2->Draw("SAMEBOX"); table3->Draw("SAMEBOX"); strcat(name,".eps"); c1->Print(name); } f->Write(); }